diff --git a/tools/marvin/marvin/data/__init__.py b/tools/marvin/marvin/data/__init__.py new file mode 100644 index 00000000000..d216be4ddc9 --- /dev/null +++ b/tools/marvin/marvin/data/__init__.py @@ -0,0 +1,16 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. \ No newline at end of file diff --git a/tools/marvin/marvin/data/account.py b/tools/marvin/marvin/data/account.py new file mode 100644 index 00000000000..1041cfec23e --- /dev/null +++ b/tools/marvin/marvin/data/account.py @@ -0,0 +1,38 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import factory +from marvin.factory.AccountFactory import AccountFactory +from marvin.utils import random_gen + +class UserAccountFactory(AccountFactory): + + accounttype = 0 + firstname = factory.Sequence(lambda n: random_gen()) + lastname = factory.Sequence(lambda n: random_gen()) + email = factory.LazyAttribute(lambda e: '{0}.{1}@cloudstack.org'.format(e.firstname, e.lastname).lower()) + username = factory.Sequence(lambda n: random_gen()) + password = 'password' + + +class AdminAccountFactory(UserAccountFactory): + accounttype = 1 + + +class DomainAdminFactory(UserAccountFactory): + accounttype = 2 + domainid = None diff --git a/tools/marvin/marvin/data/cluster.py b/tools/marvin/marvin/data/cluster.py new file mode 100644 index 00000000000..f4641cff4a6 --- /dev/null +++ b/tools/marvin/marvin/data/cluster.py @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import factory +from marvin.utils import random_gen +from marvin.factory.ClusterFactory import ClusterFactory + +class XenClusterFactory(ClusterFactory): + clustername = factory.Sequence(lambda n: "xencluster" + random_gen()) + clustertype = "XenServer" + hypervisor = "XenServer" + +class KvmClusterFactory(ClusterFactory): + clustername = factory.Sequence(lambda n: "kvmcluster" + random_gen()) + clustertype = "KVM" + hypervisor = "KVM" diff --git a/tools/marvin/marvin/data/diskoffering.py b/tools/marvin/marvin/data/diskoffering.py new file mode 100644 index 00000000000..88ae7cb3aa3 --- /dev/null +++ b/tools/marvin/marvin/data/diskoffering.py @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import factory +from marvin.factory.DiskOfferingFactory import DiskOfferingFactory +from marvin.utils import random_gen + +class SharedDiskOfferingFactory(DiskOfferingFactory): + + displaytext = "SharedDiskOffering" + name = factory.Sequence(lambda n : "SharedDiskOffering" + random_gen()) + storagetype = "shared" + disksize = 10 #MB + +class LocalDiskOfferingFactory(DiskOfferingFactory): + + displaytext = "LocalDiskOffering" + name = factory.Sequence(lambda n : "LocalDiskOffering" + random_gen()) + storagetype = "local" + disksize = 10 #MB diff --git a/tools/marvin/marvin/data/firewallrule.py b/tools/marvin/marvin/data/firewallrule.py new file mode 100644 index 00000000000..17073475922 --- /dev/null +++ b/tools/marvin/marvin/data/firewallrule.py @@ -0,0 +1,30 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from marvin.factory.FirewallRuleFactory import FirewallRuleFactory + +class SshFirewallRuleFactory(FirewallRuleFactory): + protocol = 'tcp' + startport = 22 + endport = 22 + cidrlist = '0.0.0.0/0' + +class HttpFirewallRuleFactory(FirewallRuleFactory): + protocol = 'tcp' + startport = 80 + endport = 80 + cidrlist = '0.0.0.0/0' diff --git a/tools/marvin/marvin/data/host.py b/tools/marvin/marvin/data/host.py new file mode 100644 index 00000000000..c8b4ab759f1 --- /dev/null +++ b/tools/marvin/marvin/data/host.py @@ -0,0 +1,31 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from marvin.factory.HostFactory import HostFactory + +class XenserverHostFactory(HostFactory): + + hypervisor = 'XenServer' + password = 'password' + username = 'root' + + +class KvmHostFactory(HostFactory): + + hypervisor = 'KVM' + password = 'password' + username = 'root' diff --git a/tools/marvin/marvin/data/networkoffering.py b/tools/marvin/marvin/data/networkoffering.py new file mode 100644 index 00000000000..8d80631e529 --- /dev/null +++ b/tools/marvin/marvin/data/networkoffering.py @@ -0,0 +1,73 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import factory +from marvin.factory.NetworkOfferingFactory import NetworkOfferingFactory +from marvin.utils import random_gen + + +class DefaultIsolatedNetworkOfferingWithSourceNatServiceFactory(NetworkOfferingFactory): + #FIXME: Service Capability Lists with CapabilityTypes (ElasticIP, RvR etc) needs handling + + displaytext = factory.Sequence(lambda n : "DefaultIsolatedNetworkOfferingWithSourceNatService" + random_gen()) + name = factory.Sequence(lambda n : "DefaultIsolatedNetworkOfferingWithSourceNatService" + random_gen()) + supportedservices = "Lb,Dns,PortForwarding,StaticNat,Dhcp,Firewall,Vpn,UserData,SourceNat" + traffictype = "GUEST" + availability = "Optional" + guestiptype = "Isolated" + + specifyVlan = False + specifyIpRanges = False + isPersistent = False + conserveMode = True + + serviceProviderList = [] + for service in map(lambda l: l.strip(' '), supportedservices.split(',')): + serviceProviderList.append( + { + 'service': service, + 'provider': 'VirtualRouter' + } + ) + + +class DefaultSharedNetworkOfferingWithSGServiceFactory(NetworkOfferingFactory): + + displaytext = factory.Sequence(lambda n : "DefaultSharedNetworkOfferingWithSGService" + random_gen()) + name = factory.Sequence(lambda n : "DefaultSharedNetworkOfferingWithSGService" + random_gen()) + availability = "Optional" + supportedservices = "SecurityGroup,Dns,Dhcp,UserData" + guestiptype = "Shared" + traffictype = "GUEST" + + specifyVlan = True + specifyIpRanges = True + isPersistent = False + conserveMode = True + + serviceProviderList = [] + for service in map(lambda l: l.strip(' '), supportedservices.split(',')): + if service == 'SecurityGroup': + provider = 'SecurityGroupProvider' + else: + provider = 'VirtualRouter' + serviceProviderList.append( + { + 'service': service, + 'provider': provider + } + ) diff --git a/tools/marvin/marvin/data/serviceoffering.py b/tools/marvin/marvin/data/serviceoffering.py new file mode 100644 index 00000000000..a56d4e5fb69 --- /dev/null +++ b/tools/marvin/marvin/data/serviceoffering.py @@ -0,0 +1,27 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import factory +from marvin.factory.ServiceOfferingFactory import ServiceOfferingFactory +from marvin.utils import random_gen + +class SmallServiceOfferingFactory(ServiceOfferingFactory): + cpunumber = 1 + cpuspeed = 100 #Mhz + memory = 100 #MB + displaytext = "Small Service Offering" + name = factory.Sequence(lambda n: "SmallServiceOffering" + random_gen()) diff --git a/tools/marvin/marvin/data/template.py b/tools/marvin/marvin/data/template.py new file mode 100644 index 00000000000..033835b1a74 --- /dev/null +++ b/tools/marvin/marvin/data/template.py @@ -0,0 +1,25 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +from marvin.factory.TemplateFactory import TemplateFactory + +class DefaultBuiltInTemplateFactory(TemplateFactory): + ostype = 'CentOS 5.3 (64-bit)' + displaytext = 'CentOS 5.3 (64-bit)' + name = 'CentOS 5.3 (64-bit)' + format = 'VHD' + hypervisor = 'XenServer' diff --git a/tools/marvin/marvin/data/user.py b/tools/marvin/marvin/data/user.py new file mode 100644 index 00000000000..13c4db20139 --- /dev/null +++ b/tools/marvin/marvin/data/user.py @@ -0,0 +1,50 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import factory +from marvin.factory.UserFactory import UserFactory +from marvin.data.account import UserAccountFactory +from marvin.utils import random_gen + +class UserFactory(UserFactory): + + firstname = factory.Sequence(lambda n: random_gen()) + lastname = factory.Sequence(lambda n: random_gen()) + email = factory.LazyAttribute(lambda e: '{0}.{1}@cloudstack.org'.format(e.firstname, e.lastname).lower()) + username = factory.Sequence(lambda n: random_gen()) + password = 'password' + account = factory.SubFactory(UserAccountFactory, + apiclient=factory.SelfAttribute('..apiclient'), + accounttype=0, + firstname=factory.SelfAttribute('..firstname'), + lastname=factory.SelfAttribute('..lastname'), + email=factory.SelfAttribute('..email'), + password=factory.SelfAttribute('..password'), + username=factory.SelfAttribute('..username'), + ) + +class AdminUserFactory(UserFactory): + + account = factory.SubFactory(UserAccountFactory, + apiclient=factory.SelfAttribute('..apiclient'), + accounttype=1, + firstname=factory.SelfAttribute('..firstname'), + lastname=factory.SelfAttribute('..lastname'), + email=factory.SelfAttribute('..email'), + password=factory.SelfAttribute('..password'), + username=factory.SelfAttribute('..username'), + ) diff --git a/tools/marvin/marvin/data/vm.py b/tools/marvin/marvin/data/vm.py new file mode 100644 index 00000000000..66f15a34d84 --- /dev/null +++ b/tools/marvin/marvin/data/vm.py @@ -0,0 +1,34 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import factory +from marvin.factory.VirtualMachineFactory import VirtualMachineFactory +from marvin.utils import random_gen + + +class VirtualMachineIsolatedNetwork(VirtualMachineFactory): + """ + Create a virtualmachine in an isolated network typically in an advanced zone + + Uses a serviceoffering of tinyInstance + Uses a builtin template available + Deploys in the first zone available + """ + + serviceofferingid = None + templateid = None + zoneid = None diff --git a/tools/marvin/marvin/data/zone.py b/tools/marvin/marvin/data/zone.py new file mode 100644 index 00000000000..f4a278acc8d --- /dev/null +++ b/tools/marvin/marvin/data/zone.py @@ -0,0 +1,33 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import factory +from marvin.factory.ZoneFactory import ZoneFactory +from marvin.utils import random_gen + +class AdvancedZoneFactory(ZoneFactory): + name = factory.Sequence(lambda n: "advzone" + random_gen()) + networktype = "Advanced" + dns1 = "8.8.8.8" + internaldns1 = "8.8.8.8" + + +class BasicZoneFactory(ZoneFactory): + name = factory.Sequence(lambda n: "basiczone" + random_gen()) + networktype = "Basic" + dns1 = "8.8.8.8" + internaldns1 = "8.8.8.8" \ No newline at end of file diff --git a/tools/marvin/marvin/docs/__init__.py b/tools/marvin/marvin/docs/__init__.py new file mode 100644 index 00000000000..d216be4ddc9 --- /dev/null +++ b/tools/marvin/marvin/docs/__init__.py @@ -0,0 +1,16 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. \ No newline at end of file diff --git a/tools/marvin/marvin/docs/errata.md b/tools/marvin/marvin/docs/errata.md new file mode 100644 index 00000000000..f6260691363 --- /dev/null +++ b/tools/marvin/marvin/docs/errata.md @@ -0,0 +1,22 @@ +## Idea Stack + +### Bugs + +- **marvin.sync and xml compilation produce different versions of cloudstackAPI** +- marvin build now requires inflect which will cause -Pdeveloper profile to break for the first time +- Entities should include @docstring for optional arguments in their actions() methods. **kwargs is confusing +- Dissociate the grammar list to make it extensible via a properties file +- Handle APIs that need parameters but dont have a required args list because multiple sets of args form a required list + - eg: disableAccount (either provide id (account) or accoutname and domainid) +- XML precache required for factory and base generation [CLOUDSTACK-4589](https://issues.apache.org/jira//browse/CLOUDSTACK-4589) +- Remove marvin dependency with apidoc build. Provide precache json [CLOUDSTACK-4589](https://issues.apache.org/jira//browse/CLOUDSTACK-4589) +- Better sync functionality +- Bump up version to 0.2.0 +- Improved cleanup support + +### Features +- Export deployment to JSON [CLOUDSTACK-4590](https://issues.apache.org/jira//browse/CLOUDSTACK-4590) +- nose2 and unittest2 support [CLOUDSTACK-4591](https://issues.apache.org/jira//browse/CLOUDSTACK-4591) +- Use distutils +- Python pip repository for cloudstack-marvin +- DSL for marvin using Behave [CLOUDSTACK-1952](https://issues.apache.org/jira/browse/CLOUDSTACK-1952) \ No newline at end of file diff --git a/tools/marvin/marvin/generate/__init__.py b/tools/marvin/marvin/generate/__init__.py new file mode 100644 index 00000000000..304062a2d78 --- /dev/null +++ b/tools/marvin/marvin/generate/__init__.py @@ -0,0 +1,21 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + + +# The generate package includes various transformations applied to +# the CloudStack DSL to convert it to the working model of marvin's +# test libraries \ No newline at end of file diff --git a/tools/marvin/marvin/legacy/__init__.py b/tools/marvin/marvin/legacy/__init__.py new file mode 100644 index 00000000000..beaa510d497 --- /dev/null +++ b/tools/marvin/marvin/legacy/__init__.py @@ -0,0 +1,19 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +# legacy marvin libraries that will soon be deprecated in +# future versions \ No newline at end of file