cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From t..@apache.org
Subject [41/50] [abbrv] actions on entity object require id for performing the action
Date Tue, 09 Apr 2013 13:21:18 GMT
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 bc84761..c0bad62 100644
--- a/tools/marvin/marvin/integration/lib/base/User.py
+++ b/tools/marvin/marvin/integration/lib/base/User.py
@@ -33,23 +33,29 @@ class User(CloudStackEntity.CloudStackEntity):
 
     def enable(self, apiclient, id, **kwargs):
         cmd = enableUser.enableUserCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         user = apiclient.enableUser(cmd)
+        return user
 
 
     def get(self, apiclient, userapikey, **kwargs):
         cmd = getUser.getUserCmd()
+        cmd.id = self.id
         cmd.userapikey = userapikey
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         user = apiclient.getUser(cmd)
+        return user
 
 
     def lock(self, apiclient, id, **kwargs):
         cmd = lockUser.lockUserCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         user = apiclient.lockUser(cmd)
+        return user
 
 
     @classmethod
@@ -64,28 +70,34 @@ class User(CloudStackEntity.CloudStackEntity):
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listUsers.listUsersCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         user = apiclient.listUsers(cmd)
         return map(lambda e: User(e.__dict__), user)
 
 
     def update(self, apiclient, id, **kwargs):
         cmd = updateUser.updateUserCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         user = apiclient.updateUser(cmd)
+        return user
 
 
     def disable(self, apiclient, id, **kwargs):
         cmd = disableUser.disableUserCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         user = apiclient.disableUser(cmd)
+        return user
 
 
     def delete(self, apiclient, id, **kwargs):
         cmd = deleteUser.deleteUserCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         user = apiclient.deleteUser(cmd)
+        return user
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 429062b..a42b65b 100644
--- a/tools/marvin/marvin/integration/lib/base/UserKeys.py
+++ b/tools/marvin/marvin/integration/lib/base/UserKeys.py
@@ -24,13 +24,11 @@ class UserKeys(CloudStackEntity.CloudStackEntity):
         self.__dict__.update(items)
 
 
-    def __init__(self, items):
-        self.__dict__.update(items)
-
-
     def register(self, apiclient, id, **kwargs):
         cmd = registerUserKeys.registerUserKeysCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         userkeys = apiclient.registerUserKeys(cmd)
+        return userkeys
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 7cc271d..c938d31 100644
--- a/tools/marvin/marvin/integration/lib/base/VMPassword.py
+++ b/tools/marvin/marvin/integration/lib/base/VMPassword.py
@@ -24,13 +24,11 @@ class VMPassword(CloudStackEntity.CloudStackEntity):
         self.__dict__.update(items)
 
 
-    def __init__(self, items):
-        self.__dict__.update(items)
-
-
     def get(self, apiclient, id, **kwargs):
         cmd = getVMPassword.getVMPasswordCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vmpassword = apiclient.getVMPassword(cmd)
+        return vmpassword
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/tools/marvin/marvin/integration/lib/base/VMSnapshot.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base/VMSnapshot.py b/tools/marvin/marvin/integration/lib/base/VMSnapshot.py
index ccc915b..e7f2e9a 100644
--- a/tools/marvin/marvin/integration/lib/base/VMSnapshot.py
+++ b/tools/marvin/marvin/integration/lib/base/VMSnapshot.py
@@ -38,13 +38,16 @@ class VMSnapshot(CloudStackEntity.CloudStackEntity):
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listVMSnapshot.listVMSnapshotCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vmsnapshot = apiclient.listVMSnapshot(cmd)
         return map(lambda e: VMSnapshot(e.__dict__), vmsnapshot)
 
 
     def delete(self, apiclient, vmsnapshotid, **kwargs):
         cmd = deleteVMSnapshot.deleteVMSnapshotCmd()
+        cmd.id = self.id
         cmd.vmsnapshotid = vmsnapshotid
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vmsnapshot = apiclient.deleteVMSnapshot(cmd)
+        return vmsnapshot
+

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 770a737..43c22ba 100644
--- a/tools/marvin/marvin/integration/lib/base/VPC.py
+++ b/tools/marvin/marvin/integration/lib/base/VPC.py
@@ -40,26 +40,32 @@ class VPC(CloudStackEntity.CloudStackEntity):
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listVPCs.listVPCsCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpc = apiclient.listVPCs(cmd)
         return map(lambda e: VPC(e.__dict__), vpc)
 
 
     def update(self, apiclient, **kwargs):
         cmd = updateVPC.updateVPCCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpc = apiclient.updateVPC(cmd)
+        return vpc
 
 
     def restart(self, apiclient, **kwargs):
         cmd = restartVPC.restartVPCCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpc = apiclient.restartVPC(cmd)
+        return vpc
 
 
     def delete(self, apiclient, id, **kwargs):
         cmd = deleteVPC.deleteVPCCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpc = apiclient.deleteVPC(cmd)
+        return vpc
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 71557f7..1197dcc 100644
--- a/tools/marvin/marvin/integration/lib/base/VPCOffering.py
+++ b/tools/marvin/marvin/integration/lib/base/VPCOffering.py
@@ -39,20 +39,24 @@ class VPCOffering(CloudStackEntity.CloudStackEntity):
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listVPCOfferings.listVPCOfferingsCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpcoffering = apiclient.listVPCOfferings(cmd)
         return map(lambda e: VPCOffering(e.__dict__), vpcoffering)
 
 
     def update(self, apiclient, **kwargs):
         cmd = updateVPCOffering.updateVPCOfferingCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpcoffering = apiclient.updateVPCOffering(cmd)
+        return vpcoffering
 
 
     def delete(self, apiclient, id, **kwargs):
         cmd = deleteVPCOffering.deleteVPCOfferingCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpcoffering = apiclient.deleteVPCOffering(cmd)
+        return vpcoffering
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 ba79d33..4a08454 100644
--- a/tools/marvin/marvin/integration/lib/base/VirtualMachine.py
+++ b/tools/marvin/marvin/integration/lib/base/VirtualMachine.py
@@ -16,6 +16,7 @@
 # under the License.
 from marvin.integration.lib.base import CloudStackEntity
 from marvin.cloudstackAPI import restoreVirtualMachine
+from marvin.cloudstackAPI import scaleVirtualMachine
 from marvin.cloudstackAPI import deployVirtualMachine
 from marvin.cloudstackAPI import migrateVirtualMachine
 from marvin.cloudstackAPI import listVirtualMachines
@@ -35,9 +36,21 @@ class VirtualMachine(CloudStackEntity.CloudStackEntity):
 
     def restore(self, apiclient, virtualmachineid, **kwargs):
         cmd = restoreVirtualMachine.restoreVirtualMachineCmd()
+        cmd.id = self.id
         cmd.virtualmachineid = virtualmachineid
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         virtualmachine = apiclient.restoreVirtualMachine(cmd)
+        return virtualmachine
+
+
+    def scale(self, apiclient, id, serviceofferingid, **kwargs):
+        cmd = scaleVirtualMachine.scaleVirtualMachineCmd()
+        cmd.id = self.id
+        cmd.id = id
+        cmd.serviceofferingid = serviceofferingid
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
+        virtualmachine = apiclient.scaleVirtualMachine(cmd)
+        return virtualmachine
 
 
     @classmethod
@@ -51,59 +64,73 @@ class VirtualMachine(CloudStackEntity.CloudStackEntity):
 
     def migrate(self, apiclient, virtualmachineid, **kwargs):
         cmd = migrateVirtualMachine.migrateVirtualMachineCmd()
+        cmd.id = self.id
         cmd.virtualmachineid = virtualmachineid
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         virtualmachine = apiclient.migrateVirtualMachine(cmd)
+        return virtualmachine
 
 
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listVirtualMachines.listVirtualMachinesCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         virtualmachine = apiclient.listVirtualMachines(cmd)
         return map(lambda e: VirtualMachine(e.__dict__), virtualmachine)
 
 
     def stop(self, apiclient, id, **kwargs):
         cmd = stopVirtualMachine.stopVirtualMachineCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         virtualmachine = apiclient.stopVirtualMachine(cmd)
+        return virtualmachine
 
 
     def reboot(self, apiclient, id, **kwargs):
         cmd = rebootVirtualMachine.rebootVirtualMachineCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         virtualmachine = apiclient.rebootVirtualMachine(cmd)
+        return virtualmachine
 
 
     def update(self, apiclient, id, **kwargs):
         cmd = updateVirtualMachine.updateVirtualMachineCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         virtualmachine = apiclient.updateVirtualMachine(cmd)
+        return virtualmachine
 
 
     def start(self, apiclient, id, **kwargs):
         cmd = startVirtualMachine.startVirtualMachineCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         virtualmachine = apiclient.startVirtualMachine(cmd)
+        return virtualmachine
 
 
     def destroy(self, apiclient, id, **kwargs):
         cmd = destroyVirtualMachine.destroyVirtualMachineCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         virtualmachine = apiclient.destroyVirtualMachine(cmd)
+        return virtualmachine
 
 
     def assign(self, apiclient, account, domainid, virtualmachineid, **kwargs):
         cmd = assignVirtualMachine.assignVirtualMachineCmd()
+        cmd.id = self.id
         cmd.account = account
         cmd.domainid = domainid
         cmd.virtualmachineid = virtualmachineid
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         virtualmachine = apiclient.assignVirtualMachine(cmd)
+        return virtualmachine
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 325d669..9faf355 100644
--- a/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py
+++ b/tools/marvin/marvin/integration/lib/base/VirtualRouterElement.py
@@ -38,15 +38,17 @@ class VirtualRouterElement(CloudStackEntity.CloudStackEntity):
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listVirtualRouterElements.listVirtualRouterElementsCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         virtualrouterelement = apiclient.listVirtualRouterElements(cmd)
         return map(lambda e: VirtualRouterElement(e.__dict__), virtualrouterelement)
 
 
     def configure(self, apiclient, enabled, id, **kwargs):
         cmd = configureVirtualRouterElement.configureVirtualRouterElementCmd()
+        cmd.id = self.id
         cmd.id = id
         cmd.enabled = enabled
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         virtualrouterelement = apiclient.configureVirtualRouterElement(cmd)
+        return virtualrouterelement
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 8e134f3..f38e71b 100644
--- a/tools/marvin/marvin/integration/lib/base/VlanIpRange.py
+++ b/tools/marvin/marvin/integration/lib/base/VlanIpRange.py
@@ -38,14 +38,16 @@ class VlanIpRange(CloudStackEntity.CloudStackEntity):
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listVlanIpRanges.listVlanIpRangesCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vlaniprange = apiclient.listVlanIpRanges(cmd)
         return map(lambda e: VlanIpRange(e.__dict__), vlaniprange)
 
 
     def delete(self, apiclient, id, **kwargs):
         cmd = deleteVlanIpRange.deleteVlanIpRangeCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vlaniprange = apiclient.deleteVlanIpRange(cmd)
+        return vlaniprange
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 be9731a..d28e0a5 100644
--- a/tools/marvin/marvin/integration/lib/base/Volume.py
+++ b/tools/marvin/marvin/integration/lib/base/Volume.py
@@ -33,10 +33,12 @@ class Volume(CloudStackEntity.CloudStackEntity):
 
     def migrate(self, apiclient, storageid, volumeid, **kwargs):
         cmd = migrateVolume.migrateVolumeCmd()
+        cmd.id = self.id
         cmd.storageid = storageid
         cmd.volumeid = volumeid
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         volume = apiclient.migrateVolume(cmd)
+        return volume
 
 
     @classmethod
@@ -51,47 +53,57 @@ class Volume(CloudStackEntity.CloudStackEntity):
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listVolumes.listVolumesCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         volume = apiclient.listVolumes(cmd)
         return map(lambda e: Volume(e.__dict__), volume)
 
 
     def upload(self, apiclient, url, zoneid, name, format, **kwargs):
         cmd = uploadVolume.uploadVolumeCmd()
+        cmd.id = self.id
         cmd.format = format
         cmd.name = name
         cmd.url = url
         cmd.zoneid = zoneid
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         volume = apiclient.uploadVolume(cmd)
+        return volume
 
 
     def attach(self, apiclient, id, virtualmachineid, **kwargs):
         cmd = attachVolume.attachVolumeCmd()
+        cmd.id = self.id
         cmd.id = id
         cmd.virtualmachineid = virtualmachineid
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         volume = apiclient.attachVolume(cmd)
+        return volume
 
 
     def detach(self, apiclient, **kwargs):
         cmd = detachVolume.detachVolumeCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        cmd.id = self.id
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         volume = apiclient.detachVolume(cmd)
+        return volume
 
 
     def extract(self, apiclient, zoneid, id, mode, **kwargs):
         cmd = extractVolume.extractVolumeCmd()
+        cmd.id = self.id
         cmd.id = id
         cmd.mode = mode
         cmd.zoneid = zoneid
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         volume = apiclient.extractVolume(cmd)
+        return volume
 
 
     def delete(self, apiclient, id, **kwargs):
         cmd = deleteVolume.deleteVolumeCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         volume = apiclient.deleteVolume(cmd)
+        return volume
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 d43c27b..33d6571 100644
--- a/tools/marvin/marvin/integration/lib/base/VpnConnection.py
+++ b/tools/marvin/marvin/integration/lib/base/VpnConnection.py
@@ -29,9 +29,11 @@ class VpnConnection(CloudStackEntity.CloudStackEntity):
 
     def reset(self, apiclient, id, **kwargs):
         cmd = resetVpnConnection.resetVpnConnectionCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpnconnection = apiclient.resetVpnConnection(cmd)
+        return vpnconnection
 
 
     @classmethod
@@ -46,14 +48,16 @@ class VpnConnection(CloudStackEntity.CloudStackEntity):
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listVpnConnections.listVpnConnectionsCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpnconnection = apiclient.listVpnConnections(cmd)
         return map(lambda e: VpnConnection(e.__dict__), vpnconnection)
 
 
     def delete(self, apiclient, id, **kwargs):
         cmd = deleteVpnConnection.deleteVpnConnectionCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpnconnection = apiclient.deleteVpnConnection(cmd)
+        return vpnconnection
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 49d746c..24324fc 100644
--- a/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py
+++ b/tools/marvin/marvin/integration/lib/base/VpnCustomerGateway.py
@@ -39,26 +39,30 @@ class VpnCustomerGateway(CloudStackEntity.CloudStackEntity):
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listVpnCustomerGateways.listVpnCustomerGatewaysCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpncustomergateway = apiclient.listVpnCustomerGateways(cmd)
         return map(lambda e: VpnCustomerGateway(e.__dict__), vpncustomergateway)
 
 
     def update(self, apiclient, ikepolicy, cidrlist, gateway, ipsecpsk, esppolicy, id, **kwargs):
         cmd = updateVpnCustomerGateway.updateVpnCustomerGatewayCmd()
+        cmd.id = self.id
         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]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpncustomergateway = apiclient.updateVpnCustomerGateway(cmd)
+        return vpncustomergateway
 
 
     def delete(self, apiclient, id, **kwargs):
         cmd = deleteVpnCustomerGateway.deleteVpnCustomerGatewayCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpncustomergateway = apiclient.deleteVpnCustomerGateway(cmd)
+        return vpncustomergateway
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 e929937..0cbc68f 100644
--- a/tools/marvin/marvin/integration/lib/base/VpnGateway.py
+++ b/tools/marvin/marvin/integration/lib/base/VpnGateway.py
@@ -38,14 +38,16 @@ class VpnGateway(CloudStackEntity.CloudStackEntity):
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listVpnGateways.listVpnGatewaysCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpngateway = apiclient.listVpnGateways(cmd)
         return map(lambda e: VpnGateway(e.__dict__), vpngateway)
 
 
     def delete(self, apiclient, id, **kwargs):
         cmd = deleteVpnGateway.deleteVpnGatewayCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpngateway = apiclient.deleteVpnGateway(cmd)
+        return vpngateway
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 d060a9d..b6b62b2 100644
--- a/tools/marvin/marvin/integration/lib/base/VpnUser.py
+++ b/tools/marvin/marvin/integration/lib/base/VpnUser.py
@@ -28,23 +28,27 @@ class VpnUser(CloudStackEntity.CloudStackEntity):
 
     def add(self, apiclient, username, password, **kwargs):
         cmd = addVpnUser.addVpnUserCmd()
+        cmd.id = self.id
         cmd.password = password
         cmd.username = username
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpnuser = apiclient.addVpnUser(cmd)
+        return vpnuser
 
 
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listVpnUsers.listVpnUsersCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpnuser = apiclient.listVpnUsers(cmd)
         return map(lambda e: VpnUser(e.__dict__), vpnuser)
 
 
     def remove(self, apiclient, username, **kwargs):
         cmd = removeVpnUser.removeVpnUserCmd()
+        cmd.id = self.id
         cmd.username = username
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         vpnuser = apiclient.removeVpnUser(cmd)
+        return vpnuser
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 42a632c..77c314e 100644
--- a/tools/marvin/marvin/integration/lib/base/Zone.py
+++ b/tools/marvin/marvin/integration/lib/base/Zone.py
@@ -39,21 +39,25 @@ class Zone(CloudStackEntity.CloudStackEntity):
     @classmethod
     def list(self, apiclient, **kwargs):
         cmd = listZones.listZonesCmd()
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         zone = apiclient.listZones(cmd)
         return map(lambda e: Zone(e.__dict__), zone)
 
 
     def update(self, apiclient, id, **kwargs):
         cmd = updateZone.updateZoneCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         zone = apiclient.updateZone(cmd)
+        return zone
 
 
     def delete(self, apiclient, id, **kwargs):
         cmd = deleteZone.deleteZoneCmd()
+        cmd.id = self.id
         cmd.id = id
-        [setattr(cmd, key, value) for key,value in kwargs.items]
+        [setattr(cmd, key, value) for key,value in kwargs.iteritems()]
         zone = apiclient.deleteZone(cmd)
+        return zone
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/tools/marvin/marvin/integration/lib/factory/DiskOfferingFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/DiskOfferingFactory.py b/tools/marvin/marvin/integration/lib/factory/DiskOfferingFactory.py
index 11c4df8..0ca22df 100644
--- a/tools/marvin/marvin/integration/lib/factory/DiskOfferingFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/DiskOfferingFactory.py
@@ -15,12 +15,13 @@
 # specific language governing permissions and limitations
 # under the License.
 import factory
+from marvin.integration.lib.factory.CloudStackBaseFactory import *
 from marvin.integration.lib.base import DiskOffering
 from marvin.integration.lib.utils import random_gen
 
-class DiskOfferingFactory(factory.Factory):
+class DiskOfferingFactory(CloudStackBaseFactory):
 
-    FACTORY_FOR = DiskOffering
+    FACTORY_FOR = DiskOffering.DiskOffering
 
     displaytext = factory.Sequence(lambda n : "DiskOffering" + random_gen())
     name = factory.Sequence(lambda n : "DiskOffering" + random_gen())

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/tools/marvin/marvin/integration/lib/factory/NetworkOfferingFactory.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/factory/NetworkOfferingFactory.py b/tools/marvin/marvin/integration/lib/factory/NetworkOfferingFactory.py
index 5f876c8..3673828 100644
--- a/tools/marvin/marvin/integration/lib/factory/NetworkOfferingFactory.py
+++ b/tools/marvin/marvin/integration/lib/factory/NetworkOfferingFactory.py
@@ -15,16 +15,71 @@
 # specific language governing permissions and limitations
 # under the License.
 import factory
+from marvin.integration.lib.factory.CloudStackBaseFactory import *
 from marvin.integration.lib.base import NetworkOffering
-class NetworkOfferingFactory(factory.Factory):
+from marvin.integration.lib.utils import random_gen
 
-    FACTORY_FOR = NetworkOffering
+class NetworkOfferingFactory(CloudStackBaseFactory):
+
+    FACTORY_FOR = NetworkOffering.NetworkOffering
 
     displaytext = "Network Offering"
     guestiptype = "Isolated"
     name = "Network Offering"
     supportedservices = "Dhcp,Dns,SourceNat,PortForwarding"
-    traffictype = "Guest"
+    traffictype = "GUEST"
+
+
+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
+            }
+        )
 
 
-class DefaultIsolatedNetworkOffering

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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
index d8afb03..1d18305 100644
--- a/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
+++ b/tools/marvin/marvin/integration/lib/factory/test/testFactories.py
@@ -16,12 +16,16 @@
 # under the License.
 
 import unittest
+from marvin.cloudstackTestClient import cloudstackTestClient
+
 from marvin.integration.lib.factory.AccountFactory import *
 from marvin.integration.lib.base.Account import *
 
 from marvin.integration.lib.factory.ServiceOfferingFactory import *
 from marvin.integration.lib.base.ServiceOffering import *
-from marvin.cloudstackTestClient import cloudstackTestClient
+
+from marvin.integration.lib.factory.NetworkOfferingFactory import *
+from marvin.integration.lib.base.NetworkOffering import *
 
 class AccountFactoryTest(unittest.TestCase):
     def setUp(self):
@@ -45,6 +49,14 @@ class AccountFactoryTest(unittest.TestCase):
         self.assertTrue(accnt is not None, msg="no account created by factory")
         self.assertEqual(accnt.name, af.username, msg="account names are not same")
 
+    @unittest.skip("Job Queue gets stuck on this")
+    def test_disableAccountPostFactoryGeneration(self):
+        af = DomainAdminFactory()
+        domadmin = Account.create(apiclient=self.apiClient, AccountFactory=af)
+        self.assertTrue(domadmin is not None, msg="no account was created")
+        self.assertEqual(domadmin.name, af.username, msg = "account names don't match")
+        domadmin.disable(self.apiClient, lock=True)
+
     def tearDown(self):
         pass
 
@@ -61,4 +73,17 @@ class ServiceOfferingFactoryTest(unittest.TestCase):
 
 
     def tearDown(self):
-        pass
\ No newline at end of file
+        pass
+
+
+class NetworkOfferingFactoryTest(unittest.TestCase):
+    def setUp(self):
+        self.apiClient = cloudstackTestClient(mgtSvr='localhost').getApiClient()
+
+    def test_defaultSourceNatOfferingFactory(self):
+        snatOfferingFactory = DefaultIsolatedNetworkOfferingWithSourceNatServiceFactory()
+        snatOffering = NetworkOffering.create(apiclient=self.apiClient, NetworkOfferingFactory=snatOfferingFactory)
+        self.assertTrue(snatOffering is not None, msg = "no network offering was created")
+        self.assertEqual(snatOffering.name, snatOfferingFactory.name, msg="error in network
offering factory creation")
+
+        snatOffering.update(self.apiClient, state='Enabled')

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/cef66347/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 c2955d9..2b213ff 100644
--- a/tools/marvin/marvin/integration/lib/generateBase.py
+++ b/tools/marvin/marvin/integration/lib/generateBase.py
@@ -27,7 +27,8 @@ grammar = ['create', 'list', 'delete', 'update',
            'start', 'restart', 'reboot', 'stop', 'reconnect',
            'cancel', 'destroy', 'revoke', 'mark', 'reset',
            'copy', 'extract', 'migrate', 'restore', 'suspend',
-           'get', 'query', 'prepare', 'deploy', 'upload', 'lock', 'disassociate']
+           '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
@@ -136,12 +137,15 @@ def write_entity_classes(entities):
                 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"]})
+                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.items]')
+                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)
@@ -149,7 +153,7 @@ def write_entity_classes(entities):
         code = imports + '\n\n' + body
 
         entitydict[entity] = code
-        write_entity_factory(entity, actions)
+        #write_entity_factory(entity, actions)
         with open("./base/%s.py"%entity, "w") as writer:
             writer.write(LICENSE)
             writer.write(code)


Mime
View raw message