http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ada8cdce/tools/marvin/marvin/config/test_data.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py index 1609860..45c6894 100644 --- a/tools/marvin/marvin/config/test_data.py +++ b/tools/marvin/marvin/config/test_data.py @@ -828,6 +828,11 @@ test_data = { "mode": "HTTP_DOWNLOAD", "templatefilter": "self" }, + "volume_from_snapshot": { + "diskname": 'Volume from snapshot', + "size": "1", + "zoneid": "" + }, "templatefilter": 'self', "templates": { "displaytext": 'Template', @@ -1512,7 +1517,8 @@ test_data = { "ldapPassword": "" }, "systemVmDelay": 120, - "vmware_cluster" : { + "setUsageConfigurationThroughTestCase": True + "vmware_cluster" : { "hypervisor": 'VMware', "clustertype": 'ExternalManaged', "username": '',
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ada8cdce/tools/marvin/marvin/dbConnection.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/dbConnection.py b/tools/marvin/marvin/dbConnection.py index 66c6cb1..e7758a7 100644 --- a/tools/marvin/marvin/dbConnection.py +++ b/tools/marvin/marvin/dbConnection.py @@ -35,7 +35,7 @@ class DbConnection(object): self.passwd = passwd self.database = db - def execute(self, sql=None, params=None): + def execute(self, sql=None, params=None, db=None): if sql is None: return None @@ -45,7 +45,7 @@ class DbConnection(object): port=int(self.port), user=str(self.user), password=str(self.passwd), - db=str(self.database))) as conn: + db=str(self.database) if not db else db)) as conn: conn.autocommit = True with contextlib.closing(conn.cursor(buffered=True)) as cursor: cursor.execute(sql, params) http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ada8cdce/tools/marvin/marvin/lib/base.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py index bc68630..5bad6b7 100755 --- a/tools/marvin/marvin/lib/base.py +++ b/tools/marvin/marvin/lib/base.py @@ -795,7 +795,7 @@ class Volume: domainid=None, diskofferingid=None, projectid=None): """Create Volume""" cmd = createVolume.createVolumeCmd() - cmd.name = services["diskname"] + cmd.name = "-".join([services["diskname"], random_gen()]) if diskofferingid: cmd.diskofferingid = diskofferingid @@ -1284,12 +1284,12 @@ class Iso: @classmethod def create(cls, apiclient, services, account=None, domainid=None, - projectid=None): + projectid=None, zoneid=None): """Create an ISO""" # Create ISO from URL cmd = registerIso.registerIsoCmd() cmd.displaytext = services["displaytext"] - cmd.name = services["name"] + cmd.name = "-".join([services["name"], random_gen()]) if "ostypeid" in services: cmd.ostypeid = services["ostypeid"] elif "ostype" in services: @@ -1308,7 +1308,11 @@ class Iso: "Unable to find Ostype is required for creating ISO") cmd.url = services["url"] - cmd.zoneid = services["zoneid"] + + if zoneid: + cmd.zoneid = zoneid + else: + cmd.zoneid = services["zoneid"] if "isextractable" in services: cmd.isextractable = services["isextractable"] @@ -1625,7 +1629,7 @@ class EgressFireWallRule: @classmethod def create(cls, apiclient, networkid, protocol, cidrlist=None, - startport=None, endport=None): + startport=None, endport=None, type=None, code=None): """Create Egress Firewall Rule""" cmd = createEgressFirewallRule.createEgressFirewallRuleCmd() cmd.networkid = networkid @@ -1636,6 +1640,10 @@ class EgressFireWallRule: cmd.startport = startport if endport: cmd.endport = endport + if type: + cmd.type = type + if code: + cmd.code = code return EgressFireWallRule( apiclient.createEgressFirewallRule(cmd).__dict__) @@ -4712,4 +4720,34 @@ class SimulatorMock: except Exception as e: raise e +class Usage: + """Manage Usage Generation""" + def __init__(self, items): + self.__dict__.update(items) + + @classmethod + def listRecords(cls, apiclient, **kwargs): + """Lists domains""" + cmd = listUsageRecords.listUsageRecordsCmd() + [setattr(cmd, k, v) for k, v in kwargs.items()] + if 'account' in kwargs.keys() and 'domainid' in kwargs.keys(): + cmd.listall = True + return(apiclient.listUsageRecords(cmd)) + + @classmethod + def listTypes(cls, apiclient, **kwargs): + """Lists domains""" + cmd = listUsageTypes.listUsageTypesCmd() + [setattr(cmd, k, v) for k, v in kwargs.items()] + if 'account' in kwargs.keys() and 'domainid' in kwargs.keys(): + cmd.listall = True + return(apiclient.listUsageTypes(cmd)) + + @classmethod + def generateRecords(cls, apiclient, **kwargs): + """Lists domains""" + cmd = generateUsageRecords.generateUsageRecordsCmd() + [setattr(cmd, k, v) for k, v in kwargs.items()] + return(apiclient.generateUsageRecords(cmd)) + http://git-wip-us.apache.org/repos/asf/cloudstack/blob/ada8cdce/tools/marvin/marvin/lib/utils.py ---------------------------------------------------------------------- diff --git a/tools/marvin/marvin/lib/utils.py b/tools/marvin/marvin/lib/utils.py index 8788b3b..4faced5 100644 --- a/tools/marvin/marvin/lib/utils.py +++ b/tools/marvin/marvin/lib/utils.py @@ -501,8 +501,8 @@ def verifyRouterState(apiclient, routerid, allowedstates): listvalidationresult = validateList(routers) if listvalidationresult[0] == FAIL: return [FAIL, listvalidationresult[2]] - if routers[0].redundantstate not in allowedstates: - return [FAIL, "Redundant state of the router should be in %s but is %s" % - (allowedstates, routers[0].redundantstate)] + if routers[0].state.lower() not in allowedstates: + return [FAIL, "state of the router should be in %s but is %s" % + (allowedstates, routers[0].state)] return [PASS, None]