You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ts...@apache.org on 2013/04/21 14:23:21 UTC
[08/17] make the module structure more relevant and simple
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/UsageRecordsFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/UsageRecordsFactory.py b/tools/marvin/marvin/integration/lib/factory/UsageRecordsFactory.py
deleted file mode 100644
index e0c73c8..0000000
--- a/tools/marvin/marvin/integration/lib/factory/UsageRecordsFactory.py
+++ /dev/null
@@ -1,8 +0,0 @@
-import factory
-from marvin.integration.lib.base import UsageRecords
-class UsageRecordsFactory(factory.Factory):
-
- FACTORY_FOR = UsageRecords
-
- enddate = None
- startdate = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/UserFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/UserFactory.py b/tools/marvin/marvin/integration/lib/factory/UserFactory.py
deleted file mode 100644
index 1b13b8b..0000000
--- a/tools/marvin/marvin/integration/lib/factory/UserFactory.py
+++ /dev/null
@@ -1,34 +0,0 @@
-# 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.integration.lib.base import User
-from marvin.integration.lib.factory.CloudStackBaseFactory import CloudStackBaseFactory
-from marvin.integration.lib.factory.AccountFactory import AccountFactory
-
-class UserFactory(CloudStackBaseFactory):
-
- FACTORY_FOR = User.User
-
- account = factory.SubFactory(AccountFactory).factory()
- email = account.email
- firstname = account.firstname
- lastname = account.lastname
- password = account.password
- username = account.username
-
-class AdminUserFactory(UserFactory):
- account = factory.SubFactory(AccountFactory, accounttype=1).factory()
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/VMSnapshotFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VMSnapshotFactory.py b/tools/marvin/marvin/integration/lib/factory/VMSnapshotFactory.py
deleted file mode 100644
index bbd0bd7..0000000
--- a/tools/marvin/marvin/integration/lib/factory/VMSnapshotFactory.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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.integration.lib.base import VMSnapshot
-class VMSnapshotFactory(factory.Factory):
-
- FACTORY_FOR = VMSnapshot.VMSnapshot
-
- virtualmachineid = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/VPCFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VPCFactory.py b/tools/marvin/marvin/integration/lib/factory/VPCFactory.py
deleted file mode 100644
index bef42f6..0000000
--- a/tools/marvin/marvin/integration/lib/factory/VPCFactory.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.integration.lib.base import VPC
-class VPCFactory(factory.Factory):
-
- FACTORY_FOR = VPC
-
- cidr = None
- displaytext = None
- name = None
- vpcofferingid = None
- zoneid = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/VPCOfferingFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VPCOfferingFactory.py b/tools/marvin/marvin/integration/lib/factory/VPCOfferingFactory.py
deleted file mode 100644
index ad45093..0000000
--- a/tools/marvin/marvin/integration/lib/factory/VPCOfferingFactory.py
+++ /dev/null
@@ -1,25 +0,0 @@
-# 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.integration.lib.base import VPCOffering
-class VPCOfferingFactory(factory.Factory):
-
- FACTORY_FOR = VPCOffering
-
- displaytext = None
- name = None
- supportedservices = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/VirtualMachineFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VirtualMachineFactory.py b/tools/marvin/marvin/integration/lib/factory/VirtualMachineFactory.py
deleted file mode 100644
index 260a0ed..0000000
--- a/tools/marvin/marvin/integration/lib/factory/VirtualMachineFactory.py
+++ /dev/null
@@ -1,28 +0,0 @@
-# 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.integration.lib.base import VirtualMachine
-from marvin.integration.lib.factory.CloudStackBaseFactory import CloudStackBaseFactory
-
-class VirtualMachineFactory(CloudStackBaseFactory):
-
- FACTORY_FOR = VirtualMachine.VirtualMachine
-
- serviceofferingid = None
- templateid = None
- zoneid = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/VirtualRouterElementFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VirtualRouterElementFactory.py b/tools/marvin/marvin/integration/lib/factory/VirtualRouterElementFactory.py
deleted file mode 100644
index a1f85da..0000000
--- a/tools/marvin/marvin/integration/lib/factory/VirtualRouterElementFactory.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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.integration.lib.base import VirtualRouterElement
-class VirtualRouterElementFactory(factory.Factory):
-
- FACTORY_FOR = VirtualRouterElement
-
- nspid = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/VlanIpRangeFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VlanIpRangeFactory.py b/tools/marvin/marvin/integration/lib/factory/VlanIpRangeFactory.py
deleted file mode 100644
index 6ae1e35..0000000
--- a/tools/marvin/marvin/integration/lib/factory/VlanIpRangeFactory.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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.integration.lib.base import VlanIpRange
-class VlanIpRangeFactory(factory.Factory):
-
- FACTORY_FOR = VlanIpRange
-
- startip = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/VolumeFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VolumeFactory.py b/tools/marvin/marvin/integration/lib/factory/VolumeFactory.py
deleted file mode 100644
index e1f5cdb..0000000
--- a/tools/marvin/marvin/integration/lib/factory/VolumeFactory.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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.integration.lib.base import Volume
-class VolumeFactory(factory.Factory):
-
- FACTORY_FOR = Volume
-
- name = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/VpnConnectionFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VpnConnectionFactory.py b/tools/marvin/marvin/integration/lib/factory/VpnConnectionFactory.py
deleted file mode 100644
index 7ba45dd..0000000
--- a/tools/marvin/marvin/integration/lib/factory/VpnConnectionFactory.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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.integration.lib.base import VpnConnection
-class VpnConnectionFactory(factory.Factory):
-
- FACTORY_FOR = VpnConnection
-
- s2scustomergatewayid = None
- s2svpngatewayid = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/VpnCustomerGatewayFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VpnCustomerGatewayFactory.py b/tools/marvin/marvin/integration/lib/factory/VpnCustomerGatewayFactory.py
deleted file mode 100644
index ca85dbe..0000000
--- a/tools/marvin/marvin/integration/lib/factory/VpnCustomerGatewayFactory.py
+++ /dev/null
@@ -1,27 +0,0 @@
-# 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.integration.lib.base import VpnCustomerGateway
-class VpnCustomerGatewayFactory(factory.Factory):
-
- FACTORY_FOR = VpnCustomerGateway
-
- cidrlist = None
- esppolicy = None
- gateway = None
- ikepolicy = None
- ipsecpsk = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/VpnGatewayFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VpnGatewayFactory.py b/tools/marvin/marvin/integration/lib/factory/VpnGatewayFactory.py
deleted file mode 100644
index 76d9596..0000000
--- a/tools/marvin/marvin/integration/lib/factory/VpnGatewayFactory.py
+++ /dev/null
@@ -1,23 +0,0 @@
-# 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.integration.lib.base import VpnGateway
-class VpnGatewayFactory(factory.Factory):
-
- FACTORY_FOR = VpnGateway
-
- vpcid = None
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/VpnUserFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/VpnUserFactory.py b/tools/marvin/marvin/integration/lib/factory/VpnUserFactory.py
deleted file mode 100644
index 8647ea9..0000000
--- a/tools/marvin/marvin/integration/lib/factory/VpnUserFactory.py
+++ /dev/null
@@ -1,24 +0,0 @@
-# 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.integration.lib.base import VpnUser
-class VpnUserFactory(factory.Factory):
-
- FACTORY_FOR = VpnUser.VpnUser
-
- password = "password"
- username = "vpnuser"
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/ZoneFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/ZoneFactory.py b/tools/marvin/marvin/integration/lib/factory/ZoneFactory.py
deleted file mode 100644
index 81f7576..0000000
--- a/tools/marvin/marvin/integration/lib/factory/ZoneFactory.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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.integration.lib.base import Zone
-from marvin.integration.lib.factory.CloudStackBaseFactory import CloudStackBaseFactory
-from marvin.integration.lib.utils import random_gen
-
-class ZoneFactory(CloudStackBaseFactory):
-
- FACTORY_FOR = Zone
-
- dns1 = "8.8.8.8"
- internaldns1 = "8.8.8.8"
- name = None
- networktype = None
-
-class AdvancedZoneFactory(ZoneFactory):
- name = factory.Sequence(lambda n: "advzone" + random_gen())
- networktype = "Advanced"
-
-class BasicZoneFactory(ZoneFactory):
- name = factory.Sequence(lambda n: "basiczone" + random_gen())
- networktype = "Basic"
-
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/__init__.py b/tools/marvin/marvin/integration/lib/factory/__init__.py
deleted file mode 100644
index 13a8339..0000000
--- a/tools/marvin/marvin/integration/lib/factory/__init__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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.
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/test/__init__.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/test/__init__.py b/tools/marvin/marvin/integration/lib/factory/test/__init__.py
deleted file mode 100644
index d216be4..0000000
--- a/tools/marvin/marvin/integration/lib/factory/test/__init__.py
+++ /dev/null
@@ -1,16 +0,0 @@
-# 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
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/test/testFactories.py b/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
deleted file mode 100644
index fdef9c0..0000000
--- a/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
+++ /dev/null
@@ -1,152 +0,0 @@
-# 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 unittest
-import logging
-from marvin.cloudstackTestClient import cloudstackTestClient
-
-from marvin.integration.lib.factory.AccountFactory import *
-from marvin.integration.lib.base.Account import Account
-
-from marvin.integration.lib.factory.ServiceOfferingFactory import *
-
-from marvin.integration.lib.factory.NetworkOfferingFactory import *
-
-from marvin.integration.lib.base.Zone import Zone
-
-from marvin.integration.lib.factory.TemplateFactory import *
-from marvin.integration.lib.base.Template import Template
-
-from marvin.integration.lib.factory.VirtualMachineFactory import *
-
-from marvin.integration.lib.factory.UserFactory import *
-from marvin.integration.lib.base.User import User
-
-
-class BuildVsCreateStrategyTest(unittest.TestCase):
- def setUp(self):
- self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factories.cloudstack')).getApiClient()
-
- def tearDown(self):
- pass
-
- def test_buildAccountFactory(self):
- af = AccountFactory()
- self.assert_(af.username is not None, msg="Acount factory didn't initialize")
-
- def test_createAccountFactory(self):
- af = AccountFactory.create(apiclient=self.apiClient)
- self.assert_(isinstance(af, Account))
- self.assert_(af.account.id is not None, msg="Account creation failed")
- self.assert_(af.account.domain is not None, msg="Account belongs to no domain")
-
-
-class AccountFactoryTest(unittest.TestCase):
- def setUp(self):
- self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factories.cloudstack')).getApiClient()
-
- def test_adminAccountFactory(self):
- accnt = AdminAccountFactory.create(apiclient=self.apiClient)
- self.assert_(accnt is not None, msg="no account created by factory")
- self.assert_(accnt.account.name is not None)
-
- def test_userAccountFactoryCustomArgs(self):
- accnt = AccountFactory.create(apiclient=self.apiClient, firstname='test', lastname='test')
- a = accnt.list(apiclient=self.apiClient, account=accnt.account.username, domainid=accnt.account.domainid)
- self.assert_(accnt is not None, msg="no account created by factory")
- self.assert_(accnt.account.name is not None)
-
- @unittest.skip("Account doesn't deserialize correctly")
- def test_disableAccountPostFactoryGeneration(self):
- domadmin = DomainAdminFactory.create(apiclient=self.apiClient)
- self.assert_(domadmin is not None, msg="no account was created")
- domadmin.disable(self.apiClient, lock=True)
-
- def tearDown(self):
- pass
-
-
-class ServiceOfferingFactoryTest(unittest.TestCase):
- def setUp(self):
- self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factories.cloudstack')).getApiClient()
-
- def test_serviceOfferingFactory(self):
- soffering = ServiceOfferingFactory.create(apiclient=self.apiClient)
- self.assert_(soffering is not None, msg="no service offering was created")
- self.assert_(soffering.name is not None, msg="error in service offering factory creation")
-
-
- def tearDown(self):
- pass
-
-
-class NetworkOfferingFactoryTest(unittest.TestCase):
- def setUp(self):
- self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factories.cloudstack')).getApiClient()
-
- def test_defaultSourceNatOfferingFactory(self):
- snatOffering = DefaultIsolatedNetworkOfferingWithSourceNatServiceFactory.create(apiclient=self.apiClient)
- self.assert_(snatOffering is not None, msg = "no network offering was created")
- self.assert_(snatOffering.name is not None, msg="error in network offering creation")
-
- def test_defaultSGOfferingEnable(self):
- sgOffering = DefaultSharedNetworkOfferingWithSGServiceFactory.create(apiclient=self.apiClient)
- sgOffering.update(self.apiClient, state='Enabled')
-
- def tearDown(self):
- pass
-
-
-class VirtualMachineFactoryTest(unittest.TestCase):
- def setUp(self):
- self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factories.cloudstack')).getApiClient()
-
- def tearDown(self):
- pass
-
- def test_virtualMachineDeploy(self):
- accnt = AccountFactory.create(apiclient=self.apiClient)
- service = SmallServiceOfferingFactory.create(apiclient=self.apiClient)
- tf = DefaultBuiltInTemplateFactory.build() #FIXME: Using build() strategy is confusing
- zones = Zone.list(apiclient=self.apiClient)
- template = Template.list(apiclient=self.apiClient,
- templatefilter="featured",
- ostype = tf.ostype,
- zoneid = zones[0].id)
- vm = VirtualMachineFactory.create(apiclient=self.apiClient,
- serviceofferingid = service.id,
- templateid = template[0].id,
- zoneid = zones[0].id,
- account = accnt.account.name,
- domainid = accnt.account.domainid)
- vm.destroy(apiclient=self.apiClient)
-
-
-
-class UserFactorySubFactoryTest(unittest.TestCase):
- def setUp(self):
- self.apiClient = cloudstackTestClient(mgtSvr='localhost', logging=logging.getLogger('factories.cloudstack')).getApiClient()
-
- def tearDown(self):
- pass
-
- def test_userSubFactory(self):
- uf = UserFactory.create(apiclient=self.apiClient)
- user = User.list(apiclient=self.apiClient, username=uf.username)
- self.assert_(uf.username == user[0].username, msg="Usernames don't match")
-
-
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dd838d72/tools/marvin/marvin/integration/lib/generateBase.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/generateBase.py b/tools/marvin/marvin/integration/lib/generateBase.py
deleted file mode 100644
index f6d94c0..0000000
--- a/tools/marvin/marvin/integration/lib/generateBase.py
+++ /dev/null
@@ -1,202 +0,0 @@
-# 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 marvin
-from marvin.cloudstackAPI import *
-import os
-
-# Add verbs in grammar - same as cloudmonkey
-grammar = ['create', 'list', 'delete', 'update',
- 'enable', 'activate', 'disable', 'add', 'remove',
- 'attach', 'detach', 'associate', 'generate', 'ldap',
- 'assign', 'authorize', 'change', 'register', 'configure',
- 'start', 'restart', 'reboot', 'stop', 'reconnect',
- 'cancel', 'destroy', 'revoke', 'mark', 'reset',
- 'copy', 'extract', 'migrate', 'restore', 'suspend',
- 'get', 'query', 'prepare', 'deploy', 'upload', 'lock',
- 'disassociate', 'scale']
-
-LICENSE = """# 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.
-"""
-
-
-def get_api_cmds():
- api_classes = __import__('marvin.cloudstackAPI')
-
- cmdlist = map(
- lambda f: getattr(api_classes.cloudstackAPI, f),
- filter(
- lambda t: t.startswith('__') == False,
- dir(api_classes.cloudstackAPI)
- )
- )
-
- cmdlist = filter(
- lambda g: g is not None,
- cmdlist
- )
-
- clslist = map(
- lambda g: getattr(g, g.__name__.split('.')[-1] + 'Cmd'),
- filter(
- lambda h: h.__name__.split('.')[-1] not in ['baseCmd', 'baseResponse', 'cloudstackAPIClient'],
- cmdlist
- )
- )
-
- cmdlets = map(lambda t: t(), clslist)
- return cmdlets
-
-def get_entity_from_api(api):
- matching_verbs = filter(lambda v: api.__class__.__name__.startswith(v), grammar)
- if len(matching_verbs) > 0:
- verb = matching_verbs[0]
- entity = api.__class__.__name__.replace(verb, '').replace('Cmd', '')
- return entity
-
-def get_actionable_entities():
- cmdlets = sorted(get_api_cmds(), key=lambda k: get_entity_from_api(k))
- entities = {}
- for cmd in cmdlets:
- requireds = getattr(cmd, 'required')
- optionals = filter(lambda x: '__' not in x and 'required' not in x and 'isAsync' not in x, dir(cmd))
- matching_verbs = filter(lambda v: cmd.__class__.__name__.startswith(v), grammar)
- if len(matching_verbs)> 0:
- verb = matching_verbs[0]
- entity = cmd.__class__.__name__.replace(verb, '').replace('Cmd', '')
- if entity[:-1] in entities:
- # Accounts and Account are the same entity
- entity = entity[:-1]
- if entity[:-2] in entities:
- # IpAddresses and IpAddress are the same entity
- entity = entity[:-2]
- if entity not in entities:
- entities[entity] = { }
- entities[entity][verb] = {}
- entities[entity][verb]['args'] = requireds
- entities[entity][verb]['apimodule'] = cmd.__class__.__module__.split('.')[-1]
- entities[entity][verb]['apicmd'] = cmd.__class__.__name__
- return entities
-
-def write_entity_classes(entities):
- tabspace = ' '
- entitydict = {}
- #TODO: Add license header for ASLv2
- for entity, actions in entities.iteritems():
- body = []
- imports = []
- imports.append('from marvin.integration.lib.base import CloudStackEntity')
- body.append('class %s(CloudStackEntity.CloudStackEntity):'%entity)
- body.append('\n')
- body.append(tabspace + 'def __init__(self, items):')
- body.append(tabspace*2 + 'self.__dict__.update(items)')
- body.append('\n')
- for action, details in actions.iteritems():
- imports.append('from marvin.cloudstackAPI import %s'%details['apimodule'])
- if action in ['create', 'list', 'deploy']:
- body.append(tabspace + '@classmethod')
- if action in ['create', 'deploy']:
- body.append(tabspace + 'def %s(cls, apiclient, %sFactory, **kwargs):'%(action, entity))
- body.append(tabspace*2 + 'cmd = %(module)s.%(command)s()'%{"module": details["apimodule"], "command": details["apicmd"]})
- body.append(tabspace*2 + '[setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in %sFactory.__dict__.iteritems()]'%entity)
- body.append(tabspace*2 + '[setattr(cmd, key, value) for key,value in kwargs.iteritems()]')
- body.append(tabspace*2 + '%s = apiclient.%s(cmd)'%(entity.lower(), details['apimodule']))
- body.append(tabspace*2 + 'return %s(%s.__dict__)'%(entity, entity.lower()))
- else:
- if len(details['args']) > 0:
- body.append(tabspace + 'def %s(self, apiclient, %s, **kwargs):'%(action, ', '.join(list(set(details['args'])))))
- else:
- body.append(tabspace + 'def %s(self, apiclient, **kwargs):'%(action))
- body.append(tabspace*2 + 'cmd = %(module)s.%(command)s()'%{"module": details["apimodule"], "command": details["apicmd"]})
- if action not in ['create', 'list', 'deploy']:
- body.append(tabspace*2 + 'cmd.id = self.id')
- for arg in details['args']:
- body.append(tabspace*2 + 'cmd.%s = %s'%(arg, arg))
- body.append(tabspace*2 + '[setattr(cmd, key, value) for key,value in kwargs.iteritems()]')
- body.append(tabspace*2 + '%s = apiclient.%s(cmd)'%(entity.lower(), details['apimodule']))
- if action in ['list']:
- body.append(tabspace*2 + 'return map(lambda e: %s(e.__dict__), %s)'%(entity, entity.lower()))
- else:
- body.append(tabspace*2 + 'return %s'%(entity.lower()))
- body.append('\n')
-
- imports = '\n'.join(imports)
- body = '\n'.join(body)
- code = imports + '\n\n' + body
-
- entitydict[entity] = code
- #write_entity_factory(entity, actions)
- with open("./base/%s.py"%entity, "w") as writer:
- writer.write(LICENSE)
- writer.write(code)
-
-
-def write_entity_factory(entity, actions):
- tabspace = ' '
- #TODO: Add license header for ASLv2
- code = ''
- factory_defaults = []
- if 'create' in actions:
- factory_defaults.extend(actions['create']['args'])
- elif 'deploy' in actions:
- factory_defaults.extend(actions['deploy']['args'])
- elif 'associate' in actions:
- factory_defaults.extend(actions['associate']['args'])
- elif 'register' in actions:
- factory_defaults.extend(actions['register']['args'])
- else:
- return
-
- if os.path.exists("./factory/%sFactory.py"%entity):
- for arg in factory_defaults:
- code += tabspace + '%s = None\n'%arg
- with open("./factory/%sFactory.py"%entity, "r") as reader:
- rcode = reader.read()
- if rcode.find(code) > 0:
- return
- with open("./factory/%sFactory.py"%entity, "a") as writer:
- writer.write(code)
- else:
- code += 'import factory\n'
- code += 'from marvin.integration.lib.base import %s\n'%entity
- code += 'class %sFactory(factory.Factory):'%entity
- code += '\n\n'
- code += tabspace + 'FACTORY_FOR = %s.%s\n\n'%(entity,entity)
- for arg in factory_defaults:
- code += tabspace + '%s = None\n'%arg
- with open("./factory/%sFactory.py"%entity, "w") as writer:
- writer.write(LICENSE)
- writer.write(code)
-
-if __name__=='__main__':
- entities = get_actionable_entities()
- write_entity_classes(entities)