incubator-cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [35/42] marvin-refactor: add body to all the entities in base
Date Fri, 01 Mar 2013 10:06:29 GMT
http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/TrafficType.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/TrafficType.py b/tools/marvin/marvin/integration/lib/base/TrafficType.py
index bc4ac2e..16aa0ba 100644
--- a/tools/marvin/marvin/integration/lib/base/TrafficType.py
+++ b/tools/marvin/marvin/integration/lib/base/TrafficType.py
@@ -14,23 +14,46 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import addTrafficType
+from marvin.cloudstackAPI import listTrafficTypes
+from marvin.cloudstackAPI import updateTrafficType
+from marvin.cloudstackAPI import deleteTrafficType
+
 class TrafficType(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     def add(self, apiclient, traffictype, physicalnetworkid, **kwargs):
-        pass
+        cmd = addTrafficType.addTrafficTypeCmd()
+        cmd.physicalnetworkid = physicalnetworkid
+        cmd.traffictype = traffictype
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        traffictype = apiclient.addTrafficType(cmd)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, physicalnetworkid, **kwargs):
+        cmd = listTrafficTypes.listTrafficTypesCmd()
+        cmd.physicalnetworkid = physicalnetworkid
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        traffictype = apiclient.listTrafficTypes(cmd)
+        return map(lambda e: TrafficType(e.__dict__), traffictype)
+
 
     def update(self, apiclient, id, **kwargs):
-        pass
+        cmd = updateTrafficType.updateTrafficTypeCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        traffictype = apiclient.updateTrafficType(cmd)
+
 
     def delete(self, apiclient, id, **kwargs):
-        pass
+        cmd = deleteTrafficType.deleteTrafficTypeCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        traffictype = apiclient.deleteTrafficType(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/TrafficTypeImplementors.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/TrafficTypeImplementors.py b/tools/marvin/marvin/integration/lib/base/TrafficTypeImplementors.py
index 24d6bfe..3aa9c76 100644
--- a/tools/marvin/marvin/integration/lib/base/TrafficTypeImplementors.py
+++ b/tools/marvin/marvin/integration/lib/base/TrafficTypeImplementors.py
@@ -14,14 +14,20 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import listTrafficTypeImplementors
+
 class TrafficTypeImplementors(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listTrafficTypeImplementors.listTrafficTypeImplementorsCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        traffictypeimplementors = apiclient.listTrafficTypeImplementors(cmd)
+        return map(lambda e: TrafficTypeImplementors(e.__dict__), traffictypeimplementors)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/UsageRecords.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/UsageRecords.py b/tools/marvin/marvin/integration/lib/base/UsageRecords.py
index f7800e2..1fd1e1c 100644
--- a/tools/marvin/marvin/integration/lib/base/UsageRecords.py
+++ b/tools/marvin/marvin/integration/lib/base/UsageRecords.py
@@ -14,17 +14,31 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import listUsageRecords
+from marvin.cloudstackAPI import generateUsageRecords
+
 class UsageRecords(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, startdate, enddate, **kwargs):
+        cmd = listUsageRecords.listUsageRecordsCmd()
+        cmd.enddate = enddate
+        cmd.startdate = startdate
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        usagerecords = apiclient.listUsageRecords(cmd)
+        return map(lambda e: UsageRecords(e.__dict__), usagerecords)
+
 
     def generate(self, apiclient, startdate, enddate, **kwargs):
-        pass
+        cmd = generateUsageRecords.generateUsageRecordsCmd()
+        cmd.enddate = enddate
+        cmd.startdate = startdate
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        usagerecords = apiclient.generateUsageRecords(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/UsageTypes.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/UsageTypes.py b/tools/marvin/marvin/integration/lib/base/UsageTypes.py
index c6585fc..e0118b7 100644
--- a/tools/marvin/marvin/integration/lib/base/UsageTypes.py
+++ b/tools/marvin/marvin/integration/lib/base/UsageTypes.py
@@ -14,14 +14,20 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import listUsageTypes
+
 class UsageTypes(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     @classmethod
-    def list(cls, apiclient):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listUsageTypes.listUsageTypesCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        usagetypes = apiclient.listUsageTypes(cmd)
+        return map(lambda e: UsageTypes(e.__dict__), usagetypes)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/User.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/User.py b/tools/marvin/marvin/integration/lib/base/User.py
index 7b1dcb5..a89969b 100644
--- a/tools/marvin/marvin/integration/lib/base/User.py
+++ b/tools/marvin/marvin/integration/lib/base/User.py
@@ -14,36 +14,78 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import enableUser
+from marvin.cloudstackAPI import getUser
+from marvin.cloudstackAPI import lockUser
+from marvin.cloudstackAPI import createUser
+from marvin.cloudstackAPI import listUsers
+from marvin.cloudstackAPI import updateUser
+from marvin.cloudstackAPI import disableUser
+from marvin.cloudstackAPI import deleteUser
+
 class User(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     def enable(self, apiclient, id, **kwargs):
-        pass
+        cmd = enableUser.enableUserCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        user = apiclient.enableUser(cmd)
+
 
     def get(self, apiclient, userapikey, **kwargs):
-        pass
+        cmd = getUser.getUserCmd()
+        cmd.userapikey = userapikey
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        user = apiclient.getUser(cmd)
+
 
     def lock(self, apiclient, id, **kwargs):
-        pass
+        cmd = lockUser.lockUserCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        user = apiclient.lockUser(cmd)
+
 
     @classmethod
     def create(cls, apiclient, UserFactory, **kwargs):
-        pass
+        cmd = createUser.createUserCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in UserFactory.attributes()]
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        user = apiclient.createUser(cmd)
+        return User(user.__dict__)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listUsers.listUsersCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        user = apiclient.listUsers(cmd)
+        return map(lambda e: User(e.__dict__), user)
+
 
     def update(self, apiclient, id, **kwargs):
-        pass
+        cmd = updateUser.updateUserCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        user = apiclient.updateUser(cmd)
+
 
     def disable(self, apiclient, id, **kwargs):
-        pass
+        cmd = disableUser.disableUserCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        user = apiclient.disableUser(cmd)
+
 
     def delete(self, apiclient, id, **kwargs):
-        pass
+        cmd = deleteUser.deleteUserCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        user = apiclient.deleteUser(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/UserKeys.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/UserKeys.py b/tools/marvin/marvin/integration/lib/base/UserKeys.py
index 560d65b..254aec8 100644
--- a/tools/marvin/marvin/integration/lib/base/UserKeys.py
+++ b/tools/marvin/marvin/integration/lib/base/UserKeys.py
@@ -14,13 +14,19 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import registerUserKeys
+
 class UserKeys(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     def register(self, apiclient, id, **kwargs):
-        pass
+        cmd = registerUserKeys.registerUserKeysCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        userkeys = apiclient.registerUserKeys(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/VMPassword.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/VMPassword.py b/tools/marvin/marvin/integration/lib/base/VMPassword.py
index 854d309..da83d4c 100644
--- a/tools/marvin/marvin/integration/lib/base/VMPassword.py
+++ b/tools/marvin/marvin/integration/lib/base/VMPassword.py
@@ -14,13 +14,19 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import getVMPassword
+
 class VMPassword(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     def get(self, apiclient, id, **kwargs):
-        pass
+        cmd = getVMPassword.getVMPasswordCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vmpassword = apiclient.getVMPassword(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/VPC.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/VPC.py b/tools/marvin/marvin/integration/lib/base/VPC.py
index ef6a470..4e1b59a 100644
--- a/tools/marvin/marvin/integration/lib/base/VPC.py
+++ b/tools/marvin/marvin/integration/lib/base/VPC.py
@@ -14,27 +14,52 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import createVPC
+from marvin.cloudstackAPI import listVPCs
+from marvin.cloudstackAPI import updateVPC
+from marvin.cloudstackAPI import restartVPC
+from marvin.cloudstackAPI import deleteVPC
+
 class VPC(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     @classmethod
     def create(cls, apiclient, VPCFactory, **kwargs):
-        pass
+        cmd = createVPC.createVPCCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VPCFactory.attributes()]
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpc = apiclient.createVPC(cmd)
+        return VPC(vpc.__dict__)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listVPCs.listVPCsCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpc = apiclient.listVPCs(cmd)
+        return map(lambda e: VPC(e.__dict__), vpc)
+
 
     def update(self, apiclient, **kwargs):
-        pass
+        cmd = updateVPC.updateVPCCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpc = apiclient.updateVPC(cmd)
+
 
     def restart(self, apiclient, **kwargs):
-        pass
+        cmd = restartVPC.restartVPCCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpc = apiclient.restartVPC(cmd)
+
 
     def delete(self, apiclient, id, **kwargs):
-        pass
+        cmd = deleteVPC.deleteVPCCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpc = apiclient.deleteVPC(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/VPCOffering.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/VPCOffering.py b/tools/marvin/marvin/integration/lib/base/VPCOffering.py
index 52af1f6..557b94e 100644
--- a/tools/marvin/marvin/integration/lib/base/VPCOffering.py
+++ b/tools/marvin/marvin/integration/lib/base/VPCOffering.py
@@ -14,24 +14,45 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import createVPCOffering
+from marvin.cloudstackAPI import listVPCOfferings
+from marvin.cloudstackAPI import updateVPCOffering
+from marvin.cloudstackAPI import deleteVPCOffering
+
 class VPCOffering(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     @classmethod
     def create(cls, apiclient, VPCOfferingFactory, **kwargs):
-        pass
+        cmd = createVPCOffering.createVPCOfferingCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VPCOfferingFactory.attributes()]
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpcoffering = apiclient.createVPCOffering(cmd)
+        return VPCOffering(vpcoffering.__dict__)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listVPCOfferings.listVPCOfferingsCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpcoffering = apiclient.listVPCOfferings(cmd)
+        return map(lambda e: VPCOffering(e.__dict__), vpcoffering)
+
 
     def update(self, apiclient, **kwargs):
-        pass
+        cmd = updateVPCOffering.updateVPCOfferingCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpcoffering = apiclient.updateVPCOffering(cmd)
+
 
     def delete(self, apiclient, id, **kwargs):
-        pass
+        cmd = deleteVPCOffering.deleteVPCOfferingCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpcoffering = apiclient.deleteVPCOffering(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/VirtualMachine.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/VirtualMachine.py b/tools/marvin/marvin/integration/lib/base/VirtualMachine.py
index 5479a7e..804729e 100644
--- a/tools/marvin/marvin/integration/lib/base/VirtualMachine.py
+++ b/tools/marvin/marvin/integration/lib/base/VirtualMachine.py
@@ -14,42 +14,96 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import restoreVirtualMachine
+from marvin.cloudstackAPI import deployVirtualMachine
+from marvin.cloudstackAPI import migrateVirtualMachine
+from marvin.cloudstackAPI import listVirtualMachines
+from marvin.cloudstackAPI import stopVirtualMachine
+from marvin.cloudstackAPI import rebootVirtualMachine
+from marvin.cloudstackAPI import updateVirtualMachine
+from marvin.cloudstackAPI import startVirtualMachine
+from marvin.cloudstackAPI import destroyVirtualMachine
+from marvin.cloudstackAPI import assignVirtualMachine
+
 class VirtualMachine(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     def restore(self, apiclient, virtualmachineid, **kwargs):
-        pass
+        cmd = restoreVirtualMachine.restoreVirtualMachineCmd()
+        cmd.virtualmachineid = virtualmachineid
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualmachine = apiclient.restoreVirtualMachine(cmd)
+
 
     @classmethod
     def deploy(cls, apiclient, VirtualMachineFactory, **kwargs):
-        pass
+        cmd = deployVirtualMachine.deployVirtualMachineCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VirtualMachineFactory.attributes()]
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualmachine = apiclient.deployVirtualMachine(cmd)
+        return VirtualMachine(virtualmachine.__dict__)
+
 
     def migrate(self, apiclient, virtualmachineid, **kwargs):
-        pass
+        cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
+        cmd.virtualmachineid = virtualmachineid
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualmachine = apiclient.migrateVirtualMachine(cmd)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listVirtualMachines.listVirtualMachinesCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualmachine = apiclient.listVirtualMachines(cmd)
+        return map(lambda e: VirtualMachine(e.__dict__), virtualmachine)
+
 
     def stop(self, apiclient, id, **kwargs):
-        pass
+        cmd = stopVirtualMachine.stopVirtualMachineCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualmachine = apiclient.stopVirtualMachine(cmd)
+
 
     def reboot(self, apiclient, id, **kwargs):
-        pass
+        cmd = rebootVirtualMachine.rebootVirtualMachineCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualmachine = apiclient.rebootVirtualMachine(cmd)
+
 
     def update(self, apiclient, id, **kwargs):
-        pass
+        cmd = updateVirtualMachine.updateVirtualMachineCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualmachine = apiclient.updateVirtualMachine(cmd)
+
 
     def start(self, apiclient, id, **kwargs):
-        pass
+        cmd = startVirtualMachine.startVirtualMachineCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualmachine = apiclient.startVirtualMachine(cmd)
+
 
     def destroy(self, apiclient, id, **kwargs):
-        pass
+        cmd = destroyVirtualMachine.destroyVirtualMachineCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualmachine = apiclient.destroyVirtualMachine(cmd)
+
 
     def assign(self, apiclient, account, domainid, virtualmachineid, **kwargs):
-        pass
+        cmd = assignVirtualMachine.assignVirtualMachineCmd()
+        cmd.account = account
+        cmd.domainid = domainid
+        cmd.virtualmachineid = virtualmachineid
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualmachine = apiclient.assignVirtualMachine(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py b/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py
index 1012f0d..45b77db 100644
--- a/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py
+++ b/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py
@@ -14,21 +14,39 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import createVirtualRouterElement
+from marvin.cloudstackAPI import listVirtualRouterElements
+from marvin.cloudstackAPI import configureVirtualRouterElement
+
 class VirtualRouterElement(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     @classmethod
     def create(cls, apiclient, VirtualRouterElementFactory, **kwargs):
-        pass
+        cmd = createVirtualRouterElement.createVirtualRouterElementCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VirtualRouterElementFactory.attributes()]
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualrouterelement = apiclient.createVirtualRouterElement(cmd)
+        return VirtualRouterElement(virtualrouterelement.__dict__)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listVirtualRouterElements.listVirtualRouterElementsCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualrouterelement = apiclient.listVirtualRouterElements(cmd)
+        return map(lambda e: VirtualRouterElement(e.__dict__), virtualrouterelement)
+
 
     def configure(self, apiclient, enabled, id, **kwargs):
-        pass
+        cmd = configureVirtualRouterElement.configureVirtualRouterElementCmd()
+        cmd.id = id
+        cmd.enabled = enabled
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        virtualrouterelement = apiclient.configureVirtualRouterElement(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/VlanIpRange.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/VlanIpRange.py b/tools/marvin/marvin/integration/lib/base/VlanIpRange.py
index 5cfb622..17eb7da 100644
--- a/tools/marvin/marvin/integration/lib/base/VlanIpRange.py
+++ b/tools/marvin/marvin/integration/lib/base/VlanIpRange.py
@@ -14,21 +14,38 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import createVlanIpRange
+from marvin.cloudstackAPI import listVlanIpRanges
+from marvin.cloudstackAPI import deleteVlanIpRange
+
 class VlanIpRange(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     @classmethod
     def create(cls, apiclient, VlanIpRangeFactory, **kwargs):
-        pass
+        cmd = createVlanIpRange.createVlanIpRangeCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VlanIpRangeFactory.attributes()]
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vlaniprange = apiclient.createVlanIpRange(cmd)
+        return VlanIpRange(vlaniprange.__dict__)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listVlanIpRanges.listVlanIpRangesCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vlaniprange = apiclient.listVlanIpRanges(cmd)
+        return map(lambda e: VlanIpRange(e.__dict__), vlaniprange)
+
 
     def delete(self, apiclient, id, **kwargs):
-        pass
+        cmd = deleteVlanIpRange.deleteVlanIpRangeCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vlaniprange = apiclient.deleteVlanIpRange(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/Volume.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/Volume.py b/tools/marvin/marvin/integration/lib/base/Volume.py
index 0a4fb4d..797113a 100644
--- a/tools/marvin/marvin/integration/lib/base/Volume.py
+++ b/tools/marvin/marvin/integration/lib/base/Volume.py
@@ -14,36 +14,84 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import migrateVolume
+from marvin.cloudstackAPI import createVolume
+from marvin.cloudstackAPI import listVolumes
+from marvin.cloudstackAPI import uploadVolume
+from marvin.cloudstackAPI import attachVolume
+from marvin.cloudstackAPI import detachVolume
+from marvin.cloudstackAPI import extractVolume
+from marvin.cloudstackAPI import deleteVolume
+
 class Volume(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     def migrate(self, apiclient, storageid, volumeid, **kwargs):
-        pass
+        cmd = migrateVolume.migrateVolumeCmd()
+        cmd.storageid = storageid
+        cmd.volumeid = volumeid
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        volume = apiclient.migrateVolume(cmd)
+
 
     @classmethod
     def create(cls, apiclient, VolumeFactory, **kwargs):
-        pass
+        cmd = createVolume.createVolumeCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VolumeFactory.attributes()]
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        volume = apiclient.createVolume(cmd)
+        return Volume(volume.__dict__)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listVolumes.listVolumesCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        volume = apiclient.listVolumes(cmd)
+        return map(lambda e: Volume(e.__dict__), volume)
+
 
     def upload(self, apiclient, url, zoneid, name, format, **kwargs):
-        pass
+        cmd = uploadVolume.uploadVolumeCmd()
+        cmd.format = format
+        cmd.name = name
+        cmd.url = url
+        cmd.zoneid = zoneid
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        volume = apiclient.uploadVolume(cmd)
+
 
     def attach(self, apiclient, id, virtualmachineid, **kwargs):
-        pass
+        cmd = attachVolume.attachVolumeCmd()
+        cmd.id = id
+        cmd.virtualmachineid = virtualmachineid
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        volume = apiclient.attachVolume(cmd)
+
 
     def detach(self, apiclient, **kwargs):
-        pass
+        cmd = detachVolume.detachVolumeCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        volume = apiclient.detachVolume(cmd)
+
 
     def extract(self, apiclient, zoneid, id, mode, **kwargs):
-        pass
+        cmd = extractVolume.extractVolumeCmd()
+        cmd.id = id
+        cmd.mode = mode
+        cmd.zoneid = zoneid
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        volume = apiclient.extractVolume(cmd)
+
 
     def delete(self, apiclient, id, **kwargs):
-        pass
+        cmd = deleteVolume.deleteVolumeCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        volume = apiclient.deleteVolume(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/VpnConnection.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/VpnConnection.py b/tools/marvin/marvin/integration/lib/base/VpnConnection.py
index 0bf2df4..8b90ae1 100644
--- a/tools/marvin/marvin/integration/lib/base/VpnConnection.py
+++ b/tools/marvin/marvin/integration/lib/base/VpnConnection.py
@@ -14,24 +14,46 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import resetVpnConnection
+from marvin.cloudstackAPI import createVpnConnection
+from marvin.cloudstackAPI import listVpnConnections
+from marvin.cloudstackAPI import deleteVpnConnection
+
 class VpnConnection(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     def reset(self, apiclient, id, **kwargs):
-        pass
+        cmd = resetVpnConnection.resetVpnConnectionCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpnconnection = apiclient.resetVpnConnection(cmd)
+
 
     @classmethod
     def create(cls, apiclient, VpnConnectionFactory, **kwargs):
-        pass
+        cmd = createVpnConnection.createVpnConnectionCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnConnectionFactory.attributes()]
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpnconnection = apiclient.createVpnConnection(cmd)
+        return VpnConnection(vpnconnection.__dict__)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listVpnConnections.listVpnConnectionsCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpnconnection = apiclient.listVpnConnections(cmd)
+        return map(lambda e: VpnConnection(e.__dict__), vpnconnection)
+
 
     def delete(self, apiclient, id, **kwargs):
-        pass
+        cmd = deleteVpnConnection.deleteVpnConnectionCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpnconnection = apiclient.deleteVpnConnection(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py b/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py
index ad76f8c..562fccb 100644
--- a/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py
+++ b/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py
@@ -14,24 +14,51 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import createVpnCustomerGateway
+from marvin.cloudstackAPI import listVpnCustomerGateways
+from marvin.cloudstackAPI import updateVpnCustomerGateway
+from marvin.cloudstackAPI import deleteVpnCustomerGateway
+
 class VpnCustomerGateway(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     @classmethod
     def create(cls, apiclient, VpnCustomerGatewayFactory, **kwargs):
-        pass
+        cmd = createVpnCustomerGateway.createVpnCustomerGatewayCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnCustomerGatewayFactory.attributes()]
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpncustomergateway = apiclient.createVpnCustomerGateway(cmd)
+        return VpnCustomerGateway(vpncustomergateway.__dict__)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listVpnCustomerGateways.listVpnCustomerGatewaysCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpncustomergateway = apiclient.listVpnCustomerGateways(cmd)
+        return map(lambda e: VpnCustomerGateway(e.__dict__), vpncustomergateway)
+
 
     def update(self, apiclient, ikepolicy, cidrlist, gateway, ipsecpsk, esppolicy, id, **kwargs):
-        pass
+        cmd = updateVpnCustomerGateway.updateVpnCustomerGatewayCmd()
+        cmd.id = id
+        cmd.cidrlist = cidrlist
+        cmd.esppolicy = esppolicy
+        cmd.gateway = gateway
+        cmd.ikepolicy = ikepolicy
+        cmd.ipsecpsk = ipsecpsk
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpncustomergateway = apiclient.updateVpnCustomerGateway(cmd)
+
 
     def delete(self, apiclient, id, **kwargs):
-        pass
+        cmd = deleteVpnCustomerGateway.deleteVpnCustomerGatewayCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpncustomergateway = apiclient.deleteVpnCustomerGateway(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/VpnGateway.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/VpnGateway.py b/tools/marvin/marvin/integration/lib/base/VpnGateway.py
index 974a3da..d5cd0df 100644
--- a/tools/marvin/marvin/integration/lib/base/VpnGateway.py
+++ b/tools/marvin/marvin/integration/lib/base/VpnGateway.py
@@ -14,21 +14,38 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import createVpnGateway
+from marvin.cloudstackAPI import listVpnGateways
+from marvin.cloudstackAPI import deleteVpnGateway
+
 class VpnGateway(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     @classmethod
     def create(cls, apiclient, VpnGatewayFactory, **kwargs):
-        pass
+        cmd = createVpnGateway.createVpnGatewayCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in VpnGatewayFactory.attributes()]
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpngateway = apiclient.createVpnGateway(cmd)
+        return VpnGateway(vpngateway.__dict__)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listVpnGateways.listVpnGatewaysCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpngateway = apiclient.listVpnGateways(cmd)
+        return map(lambda e: VpnGateway(e.__dict__), vpngateway)
+
 
     def delete(self, apiclient, id, **kwargs):
-        pass
+        cmd = deleteVpnGateway.deleteVpnGatewayCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpngateway = apiclient.deleteVpnGateway(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/VpnUser.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/VpnUser.py b/tools/marvin/marvin/integration/lib/base/VpnUser.py
index a277ab0..915396c 100644
--- a/tools/marvin/marvin/integration/lib/base/VpnUser.py
+++ b/tools/marvin/marvin/integration/lib/base/VpnUser.py
@@ -14,20 +14,37 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import addVpnUser
+from marvin.cloudstackAPI import listVpnUsers
+from marvin.cloudstackAPI import removeVpnUser
+
 class VpnUser(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     def add(self, apiclient, username, password, **kwargs):
-        pass
+        cmd = addVpnUser.addVpnUserCmd()
+        cmd.password = password
+        cmd.username = username
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpnuser = apiclient.addVpnUser(cmd)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listVpnUsers.listVpnUsersCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpnuser = apiclient.listVpnUsers(cmd)
+        return map(lambda e: VpnUser(e.__dict__), vpnuser)
+
 
     def remove(self, apiclient, username, **kwargs):
-        pass
+        cmd = removeVpnUser.removeVpnUserCmd()
+        cmd.username = username
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        vpnuser = apiclient.removeVpnUser(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/base/Zone.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/Zone.py b/tools/marvin/marvin/integration/lib/base/Zone.py
index 530c5b6..f84e454 100644
--- a/tools/marvin/marvin/integration/lib/base/Zone.py
+++ b/tools/marvin/marvin/integration/lib/base/Zone.py
@@ -14,24 +14,46 @@
 # KIND, either express or implied.  See the License for the
 # specific language governing permissions and limitations
 # under the License.
-from . import CloudStackEntity
+from marvin.integration.lib.base import CloudStackEntity
+from marvin.cloudstackAPI import createZone
+from marvin.cloudstackAPI import listZones
+from marvin.cloudstackAPI import updateZone
+from marvin.cloudstackAPI import deleteZone
+
 class Zone(CloudStackEntity):
 
+
     def __init__(self, items):
         self.__dict__.update(items)
 
 
     @classmethod
     def create(cls, apiclient, ZoneFactory, **kwargs):
-        pass
+        cmd = createZone.createZoneCmd()
+        [setattr(cmd, factoryKey, factoryValue) for factoryKey, factoryValue in ZoneFactory.attributes()]
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        zone = apiclient.createZone(cmd)
+        return Zone(zone.__dict__)
+
 
     @classmethod
-    def list(cls, apiclient, **kwargs):
-        pass
+    def list(self, apiclient, **kwargs):
+        cmd = listZones.listZonesCmd()
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        zone = apiclient.listZones(cmd)
+        return map(lambda e: Zone(e.__dict__), zone)
+
 
     def update(self, apiclient, id, **kwargs):
-        pass
+        cmd = updateZone.updateZoneCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        zone = apiclient.updateZone(cmd)
+
 
     def delete(self, apiclient, id, **kwargs):
-        pass
+        cmd = deleteZone.deleteZoneCmd()
+        cmd.id = id
+        [setattr(cmd, key, value) for key,value in kwargs.items]
+        zone = apiclient.deleteZone(cmd)
 

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/tools/marvin/marvin/integration/lib/factory/AccountFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/AccountFactory.py b/tools/marvin/marvin/integration/lib/factory/AccountFactory.py
index 0e5428f..acb93dc 100644
--- a/tools/marvin/marvin/integration/lib/factory/AccountFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/AccountFactory.py
@@ -15,15 +15,14 @@
 # specific language governing permissions and limitations
 # under the License.
 import factory
-import hashlib
 from marvin.integration.lib.base import Account
+import hashlib
 from marvin.integration.lib.utils import random_gen
 
 class AccountFactory(factory.Factory):
 
     FACTORY_FOR = Account
 
-    #0 - User, 1 - Root Admin, 2 - Domain Admin
     accounttype = 0
     email = factory.LazyAttribute(lambda e: '{0}.{1}@cloudstack.org'.format(e.firstname,
e.lastname)).lower()
     firstname = 'fname-'+random_gen()
@@ -35,11 +34,15 @@ class AccountFactory(factory.Factory):
     mdf.update('password')
     password = mdf.hexdigest()
 
-
 class AdminAccountFactory(AccountFactory):
     accounttype = 1
 
 
 class DomainAdminFactory(AccountFactory):
     accounttype = 2
-    domainid = None
+    domainid = None    accounttype = None
+    email = None
+    firstname = None
+    lastname = None
+    password = None
+    username = None

http://git-wip-us.apache.org/repos/asf/incubator-cloudstack/blob/d5b82b31/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
index d4f718c..4919adf 100644
--- a/tools/marvin/marvin/integration/lib/generateBase.py
+++ b/tools/marvin/marvin/integration/lib/generateBase.py
@@ -100,7 +100,10 @@ def get_actionable_entities():
                 entity = entity[:-2]
             if entity not in entities:
                 entities[entity] = { }
-            entities[entity][verb] = [requireds,optionals]
+            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):
@@ -108,31 +111,43 @@ def write_entity_classes(entities):
     entitydict = {}
     #TODO: Add license header for ASLv2
     for entity, actions in entities.iteritems():
-        code = 'from . import CloudStackEntity\n'
-        code += 'class %s(CloudStackEntity):'%entity
-        code += '\n\n'
-        code += tabspace + 'def __init__(self, items):\n'
-        code += tabspace*2 + 'self.__dict__.update(items)\n'
-        for action, args in actions.iteritems():
-            code += '\n\n'
+        body = []
+        imports = []
+        imports.append('from marvin.integration.lib.base import CloudStackEntity')
+        body.append('class %s(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']:
-                code += tabspace + '@classmethod\n'
-            code += tabspace
+                body.append(tabspace + '@classmethod')
             if action in ['create', 'deploy']:
-                code += 'def %s(cls, apiclient, %sFactory'%(action, entity)
-            elif action in ['list']:
-                code += 'def %s(cls, apiclient'%(action)
-            else:
-                code += 'def %s(self, apiclient'%(action)
-                if len(args[0]) > 0:
-                    code += ', ' + ', '.join(list(set(args[0])))
-            if len(args[1]) > 0:
-                code += ', **kwargs):\n'
+                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.attributes()]'%entity)
+                body.append(tabspace*2 + '[setattr(cmd, key, value) for key,value in kwargs.items]')
+                body.append(tabspace*2 + '%s = apiclient.%s(cmd)'%(entity.lower(), details['apimodule']))
+                body.append(tabspace*2 + 'return %s(%s.__dict__)'%(entity, entity.lower()))
             else:
-                code += '):\n'
-            code += tabspace*2
-            code += 'pass'
-        code += '\n\n'
+                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"]})
+                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.items]')
+                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()))
+            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:
@@ -146,18 +161,18 @@ def write_entity_factory(entity, actions):
     code = ''
     factory_defaults = []
     if 'create' in actions:
-        factory_defaults.extend(actions['create'])
+        factory_defaults.extend(actions['create']['args'])
     elif 'deploy' in actions:
-        factory_defaults.extend(actions['deploy'])
+        factory_defaults.extend(actions['deploy']['args'])
     elif 'associate' in actions:
-        factory_defaults.extend(actions['associate'])
+        factory_defaults.extend(actions['associate']['args'])
     elif 'register' in actions:
-        factory_defaults.extend(actions['register'])
+        factory_defaults.extend(actions['register']['args'])
     else:
         return
 
     if os.path.exists("./factory/%sFactory.py"%entity):
-        for arg in factory_defaults[0]:
+        for arg in factory_defaults:
             code += tabspace + '%s = None\n'%arg
         with open("./factory/%sFactory.py"%entity, "r") as reader:
             rcode = reader.read()
@@ -171,7 +186,7 @@ def write_entity_factory(entity, actions):
         code += 'class %sFactory(factory.Factory):'%entity
         code += '\n\n'
         code += tabspace + 'FACTORY_FOR = %s\n\n'%entity
-        for arg in factory_defaults[0]:
+        for arg in factory_defaults:
             code += tabspace + '%s = None\n'%arg
         with open("./factory/%sFactory.py"%entity, "w") as writer:
             writer.write(LICENSE)


Mime
View raw message