cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From tall...@apache.org
Subject [1/3] CLOUDSTACK-6282: Added Automated tests to test_escalations.py for Security Groups, VPN Customer Gateways, Templates, ISO's CS API calls
Date Thu, 24 Apr 2014 12:09:02 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master baadf930f -> e9e8c65b4


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e9e8c65b/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 eb5ce26..1a29ed9 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -434,7 +434,14 @@ test_data = {
         "publicport": 2222,
         "protocol": 'TCP'
     },
-
+    "iso": {
+            "displaytext": "Test ISO",
+            "name": "ISO",
+            "url": "http://people.apache.org/~tsp/dummy.iso",
+            "bootable": False,
+            "ispublic": False,
+            "ostype": "CentOS 5.6 (64-bit)",
+    }, 
     "iso1": {
         "displaytext": "Test ISO 1",
         "name": "ISO 1",
@@ -489,6 +496,14 @@ test_data = {
         "endport": "22",
         "cidrlist": "0.0.0.0/0"
     },
+    "vpncustomergateway": {
+            "ipsecpsk": "secreatKey",
+            "ikepolicy": "aes128-sha1",
+            "ikelifetime": "86400",
+            "esppolicy": "aes128-sha1",
+            "epslifetime": "3600",
+            "dpd": "false"
+    },
     "ostype": "CentOS 5.6 (64-bit)",
     "sleep": 90,
     "timeout": 10,

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/e9e8c65b/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 1ac5737..d753098 100755
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -1086,6 +1086,25 @@ class Template:
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.updateTemplatePermissions(cmd))
 
+    def update(self, apiclient, **kwargs):
+        """Updates the template details"""
+
+        cmd = updateTemplate.updateTemplateCmd()
+        cmd.id = self.id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.updateTemplate(cmd))
+
+    @classmethod
+    def copy(cls, apiclient, id, sourcezoneid, destzoneid):
+        "Copy Template from source Zone to Destination Zone"
+
+        cmd = copyTemplate.copyTemplateCmd()
+        cmd.id = id
+        cmd.sourcezoneid = sourcezoneid
+        cmd.destzoneid = destzoneid
+
+        return apiclient.copyTemplate(cmd)
+
     @classmethod
     def list(cls, apiclient, **kwargs):
         """List all templates matching criteria"""
@@ -1186,6 +1205,36 @@ class Iso:
         return
 
     @classmethod
+    def extract(cls, apiclient, id, mode, zoneid=None):
+        "Extract ISO "
+
+        cmd = extractIso.extractIsoCmd()
+        cmd.id = id
+        cmd.mode = mode
+        cmd.zoneid = zoneid
+
+        return apiclient.extractIso(cmd)
+
+    def update(self, apiclient, **kwargs):
+        """Updates the ISO details"""
+
+        cmd = updateIso.updateIsoCmd()
+        cmd.id = self.id
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.updateIso(cmd))
+
+    @classmethod
+    def copy(cls, apiclient, id, sourcezoneid, destzoneid):
+        "Copy ISO from source Zone to Destination Zone"
+
+        cmd = copyIso.copyIsoCmd()
+        cmd.id = id
+        cmd.sourcezoneid = sourcezoneid
+        cmd.destzoneid = destzoneid
+
+        return apiclient.copyIso(cmd)
+
+    @classmethod
     def list(cls, apiclient, **kwargs):
         """Lists all available ISO files."""
 
@@ -1680,6 +1729,20 @@ class SnapshotPolicy:
         [setattr(cmd, k, v) for k, v in kwargs.items()]
         return(apiclient.listSnapshotPolicies(cmd))
 
+class Hypervisor:
+    """Manage Hypervisor"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """Lists hypervisors"""
+
+        cmd = listHypervisors.listHypervisorsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listHypervisors(cmd))
+
 
 class LoadBalancerRule:
     """Manage Load Balancer rule"""
@@ -2678,7 +2741,7 @@ class SecurityGroup:
         """Create security group"""
         cmd = createSecurityGroup.createSecurityGroupCmd()
 
-        cmd.name = services["name"]
+        cmd.name = "-".join([services["name"], random_gen()])
         if account:
             cmd.account = account
         if domainid:
@@ -2780,6 +2843,76 @@ class SecurityGroup:
         return(apiclient.listSecurityGroups(cmd))
 
 
+class VpnCustomerGateway:
+    """Manage VPN Customer Gateway"""
+
+    def __init__(self, items):
+        self.__dict__.update(items)
+
+    @classmethod
+    def create(cls, apiclient, services, name, gateway, cidrlist,
+                        account=None, domainid=None):
+        """Create VPN Customer Gateway"""
+        cmd = createVpnCustomerGateway.createVpnCustomerGatewayCmd()
+        cmd.name = name
+        cmd.gateway = gateway
+        cmd.cidrlist = cidrlist
+        if "ipsecpsk" in services:
+            cmd.ipsecpsk = services["ipsecpsk"]
+        if "ikepolicy" in services:
+            cmd.ikepolicy = services["ikepolicy"]
+        if "ikelifetime" in services:
+            cmd.ikelifetime = services["ikelifetime"]
+        if "esppolicy" in services:
+            cmd.esppolicy = services["esppolicy"]
+        if "esplifetime" in services:
+            cmd.esplifetime = services["esplifetime"]
+        if "dpd" in services:
+            cmd.dpd = services["dpd"]
+        if account:
+            cmd.account = account
+        if domainid:
+            cmd.domainid = domainid
+        return VpnCustomerGateway(apiclient.createVpnCustomerGateway(cmd).__dict__)
+
+    def update(self, apiclient, services, name, gateway, cidrlist):
+        """Updates VPN Customer Gateway"""
+
+        cmd = updateVpnCustomerGateway.updateVpnCustomerGatewayCmd()
+        cmd.id = self.id
+        cmd.name = name
+        cmd.gateway = gateway
+        cmd.cidrlist = cidrlist
+        if "ipsecpsk" in services:
+            cmd.ipsecpsk = services["ipsecpsk"]
+        if "ikepolicy" in services:
+            cmd.ikepolicy = services["ikepolicy"]
+        if "ikelifetime" in services:
+            cmd.ikelifetime = services["ikelifetime"]
+        if "esppolicy" in services:
+            cmd.esppolicy = services["esppolicy"]
+        if "esplifetime" in services:
+            cmd.esplifetime = services["esplifetime"]
+        if "dpd" in services:
+            cmd.dpd = services["dpd"]
+        return(apiclient.updateVpnCustomerGateway(cmd))
+
+    def delete(self, apiclient):
+        """Delete VPN Customer Gateway"""
+
+        cmd = deleteVpnCustomerGateway.deleteVpnCustomerGatewayCmd()
+        cmd.id = self.id
+        apiclient.deleteVpnCustomerGateway(cmd)
+
+    @classmethod
+    def list(cls, apiclient, **kwargs):
+        """List all VPN customer Gateway"""
+
+        cmd = listVpnCustomerGateways.listVpnCustomerGatewaysCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listVpnCustomerGateways(cmd))
+
+
 class Project:
     """Manage Project life cycle"""
 


Mime
View raw message