You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by da...@apache.org on 2014/07/28 23:13:42 UTC

[14/50] [abbrv] CLOUDSTACK-6282-Added Automated testes for Networks and VPC API's

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19cad0d9/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 9df3f2f..44ef8d5 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -41,6 +41,14 @@ test_data = {
             "name": "Project",
         "displaytext": "Test project"
     },
+    "private_gateway": {
+       "ipaddress": "172.16.1.2",
+       "gateway": "172.16.1.1",
+       "netmask": "255.255.255.0",
+       "vlan":"10",
+       "name":"test_private_gateway"
+        
+    },
     "account": {
         "email": "test-account@test.com",
         "firstname": "test",
@@ -214,6 +222,34 @@ test_data = {
             "StaticNat": "VirtualRouter"
         }
     },
+	"network_offering_vlan": {
+		    "name": 'Test Network offering',
+		    "displaytext": 'Test Network offering',
+		    "guestiptype": 'Isolated',
+		    "supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding',
+		    "traffictype": 'GUEST',
+		    "specifyvlan": 'False',
+		    "availability": 'Optional',
+		    "serviceProviderList" : {
+								   "Dhcp": 'VirtualRouter',
+								   "Dns": 'VirtualRouter',
+								   "SourceNat": 'VirtualRouter',
+								   "PortForwarding": 'VirtualRouter',
+			                     },
+	},
+	"network_offering_without_sourcenat": {
+	   "name": 'Test Network offering',
+	   "displaytext": 'Test Network offering',
+	   "guestiptype": 'Isolated',
+	   "supportedservices": 'Dhcp,Dns,UserData',
+	   "traffictype": 'GUEST',
+	   "availability": 'Optional',
+	   "serviceProviderList" : {
+							   "Dhcp": 'VirtualRouter',
+							   "Dns": 'VirtualRouter',
+							   "UserData": 'VirtualRouter',
+		},
+	},
     "isolated_network": {
         "name": "Isolated Network",
         "displaytext": "Isolated Network"
@@ -230,6 +266,10 @@ test_data = {
         "lbdevicecapacity": 2,
         "port": 22
     },
+	"network_without_acl": {
+		"name": "TestNetwork",
+		"displaytext": "TestNetwork",
+	},
     "virtual_machine": {
         "displayname": "Test VM",
         "username": "root",
@@ -345,6 +385,12 @@ test_data = {
         "displaytext": "TestVPC",
         "cidr": "10.0.0.1/24"
     },
+	"vpc_network_domain": {
+		"name": "TestVPC",
+		"displaytext": "TestVPC",
+		"cidr": '10.0.0.1/24',
+		"network_domain": "TestVPC"
+	},
     "clusters": {
         0: {
             "clustername": "Xen Cluster",
@@ -592,6 +638,13 @@ test_data = {
         },
 
     },
+	"network_acl_rule": {
+		   "protocol":"TCP", 
+		   "traffictype":"ingress", 
+		   "cidrlist":"0.0.0.0/0",
+		   "startport":"1",
+		   "endport":"1"
+	},
     "network_offering_internal_lb": {
         "name": "Network offering for internal lb service",
         "displaytext": "Network offering for internal lb service",

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/19cad0d9/tools/marvin/marvin/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/base.py b/tools/marvin/marvin/lib/base.py
index 2783805..53c7a98 100644
--- a/tools/marvin/marvin/lib/base.py
+++ b/tools/marvin/marvin/lib/base.py
@@ -2710,6 +2710,52 @@ class Vpn:
         if openfirewall:
             cmd.openfirewall = openfirewall
         return Vpn(apiclient.createRemoteAccessVpn(cmd).__dict__)
+    
+    @classmethod
+    def createVpnGateway(cls, apiclient, vpcid):
+        """Create VPN Gateway """
+        cmd = createVpnGateway.createVpnGatewayCmd()
+        cmd.vpcid = vpcid
+        return (apiclient.createVpnGateway(cmd).__dict__)
+    
+    @classmethod
+    def createVpnConnection(cls, apiclient, s2scustomergatewayid,s2svpngatewayid):
+        """Create VPN Connection """
+        cmd = createVpnConnection.createVpnConnectionCmd()
+        cmd.s2scustomergatewayid = s2scustomergatewayid
+        cmd.s2svpngatewayid = s2svpngatewayid
+        return (apiclient.createVpnGateway(cmd).__dict__)
+    
+    @classmethod
+    def resetVpnConnection(cls, apiclient,id):
+        """Reset VPN Connection """
+        cmd = resetVpnConnection.resetVpnConnectionCmd()
+        cmd.id = id
+        return (apiclient.resetVpnConnection(cmd).__dict__)
+    
+    @classmethod
+    def deleteVpnConnection(cls, apiclient,id):
+        """Delete VPN Connection """
+        cmd = deleteVpnConnection.deleteVpnConnectionCmd()
+        cmd.id = id
+        return (apiclient.deleteVpnConnection(cmd).__dict__)
+
+    @classmethod
+    def listVpnGateway(cls, apiclient, **kwargs):
+        """List all VPN Gateways matching criteria"""
+
+        cmd = listVpnGateways.listVpnGatewaysCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listVpnGateways(cmd))
+    
+    @classmethod
+    def listVpnConnection(cls, apiclient, **kwargs):
+        """List all VPN Connections matching criteria"""
+
+        cmd = listVpnConnections.listVpnConnectionsCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listVpnConnections(cmd))
+
 
     def delete(self, apiclient):
         """Delete remote VPN access"""
@@ -3473,7 +3519,14 @@ class Configurations:
         if 'account' in kwargs.keys() and 'domainid' in kwargs.keys():
             cmd.listall=True
         return(apiclient.listConfigurations(cmd))
+    
+    @classmethod
+    def listCapabilities(cls, apiclient, **kwargs):
+        """Lists capabilities"""
 
+        cmd = listCapabilities.listCapabilitiesCmd()
+        [setattr(cmd, k, v) for k, v in kwargs.items()]
+        return(apiclient.listCapabilities(cmd))
 
 class NetScaler:
 
@@ -3840,7 +3893,7 @@ class PrivateGateway:
 
     @classmethod
     def create(cls, apiclient, gateway, ipaddress, netmask, vlan, vpcid,
-               physicalnetworkid=None):
+               physicalnetworkid=None, ,aclid=None):
         """Create private gateway"""
 
         cmd = createPrivateGateway.createPrivateGatewayCmd()
@@ -3851,6 +3904,8 @@ class PrivateGateway:
         cmd.vpcid = vpcid
         if physicalnetworkid:
             cmd.physicalnetworkid = physicalnetworkid
+        if aclid:
+            cmd.aclid = aclid
 
         return PrivateGateway(apiclient.createPrivateGateway(cmd).__dict__)