cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gir...@apache.org
Subject [1/3] CLOUDSTACK-2237: Automation - Adding new test cases for security group in advanced zone feature
Date Fri, 27 Dec 2013 10:31:57 GMT
Updated Branches:
  refs/heads/4.3 f908a1575 -> 029f4e36a


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/029f4e36/tools/marvin/marvin/config/config.cfg
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/config.cfg b/tools/marvin/marvin/config/config.cfg
new file mode 100644
index 0000000..5849fe8
--- /dev/null
+++ b/tools/marvin/marvin/config/config.cfg
@@ -0,0 +1,159 @@
+# Licensed to the Apache Software Foundation (ASF) under one
+# or more contributor license agreements.  See the NOTICE file
+# distributed with this work for additional information
+# regarding copyright ownership.  The ASF licenses this file
+# to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance
+# with the License.  You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing,
+# software distributed under the License is distributed on an
+# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+# KIND, either express or implied.  See the License for the
+# specific language governing permissions and limitations
+# under the License.
+#
+# Use the common configs added such as account, network_offerings, domain, project,
+# or add your own data if required separately for any test case
+{
+        "domain":
+                    {
+                        "name": "domain"
+                    }
+                  ,
+        "project":
+        {
+                    "name": "Project",
+                    "displaytext": "Test project"
+                   },
+        "account": {
+                    "email": "test-account@test.com",
+                    "firstname": "test",
+                    "lastname": "test",
+                    "username": "test-account",
+                    "password": "password"
+                    },
+        "service_offering": {
+                             "name": "Tiny Instance",
+                             "displaytext": "Tiny Instance",
+                             "cpunumber": 1,
+                             "cpuspeed": 100,
+                             "memory": 128
+                            },
+        "isolated_network_offering": {
+                                      "name": "Network offering-DA services",
+                                      "displaytext": "Network offering-DA services",
+                                      "guestiptype": "Isolated",
+                                      "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat",
+                                      "traffictype": "GUEST",
+                                      "availability": "Optional'",
+                                      "serviceProviderList": {
+                                            "Dhcp": "VirtualRouter",
+                                            "Dns": "VirtualRouter",
+                                            "SourceNat": "VirtualRouter",
+                                            "PortForwarding": "VirtualRouter",
+                                            "Vpn": "VirtualRouter",
+                                            "Firewall": "VirtualRouter",
+                                            "Lb": "VirtualRouter",
+                                            "UserData": "VirtualRouter",
+                                            "StaticNat": "VirtualRouter"
+                                        }
+                                    },
+        "isolated_network": {
+                             "name": "Isolated Network",
+                             "displaytext": "Isolated Network"
+                            },
+        "virtual_machine": {
+                            "displayname": "Test VM",
+                            "username": "root",
+                            "password": "password",
+                            "ssh_port": 22,
+                            "privateport": 22,
+                            "publicport": 22,
+                            "protocol": "TCP"
+                            },
+        "shared_network": {
+                           "name": "MySharedNetwork - Test",
+                           "displaytext": "MySharedNetwork",
+                           "vlan" : "",
+                           "gateway" :"",
+                           "netmask" :"",
+                           "startip" :"",
+                           "endip" :"",
+                           "acltype" : "Domain",
+                           "scope":"all"
+                          },
+        "shared_network_offering_sg": {
+                                    "name": "MySharedOffering-sg",
+                                    "displaytext": "MySharedOffering-sg",
+                                    "guestiptype": "Shared",
+                                    "supportedservices": "Dhcp,Dns,UserData,SecurityGroup",
+                                    "specifyVlan" : "False",
+                                    "specifyIpRanges" : "False",
+                                    "traffictype": "GUEST",
+                                    "serviceProviderList" : {
+                                            "Dhcp": "VirtualRouter",
+                                            "Dns": "VirtualRouter",
+                                            "UserData": "VirtualRouter",
+                                            "SecurityGroup": "SecurityGroupProvider"
+                                        }
+                                },
+        "shared_network_sg": {
+                                  "name": "Shared-Network-SG-Test",
+                                  "displaytext": "Shared-Network_SG-Test",
+                                  "networkofferingid":"1",
+                                  "vlan" : "",
+                                  "gateway" :"",
+                                  "netmask" :"255.255.255.0",
+                                  "startip" :"",
+                                  "endip" :"",
+                                  "acltype" : "Domain",
+                                  "scope":"all"
+                                },
+        "vpc_offering": {
+                         "name": "VPC off",
+                         "displaytext": "VPC off",
+                         "supportedservices": "Dhcp,Dns,SourceNat,PortForwarding,Vpn,Lb,UserData,StaticNat,NetworkACL"
+                        },
+        "vpc": {
+                "name": "TestVPC",
+                "displaytext": "TestVPC",
+                "cidr": "10.0.0.1/24"
+                },
+        "shared_network_offering": {
+                                    "name": "MySharedOffering",
+                                    "displaytext": "MySharedOffering",
+                                    "guestiptype": "Shared",
+                                    "supportedservices": "Dhcp,Dns,UserData",
+                                    "specifyVlan" : "False",
+                                    "specifyIpRanges" : "False",
+                                    "traffictype": "GUEST",
+                                    "serviceProviderList" : {
+                                            "Dhcp": "VirtualRouter",
+                                            "Dns": "VirtualRouter",
+                                            "UserData": "VirtualRouter"
+                                        }
+                                },
+        "security_group" : { "name": "custom_Sec_Grp" },
+        "ingress_rule": {
+                         "protocol": "TCP",
+                         "startport": "22",
+                         "endport": "22",
+                         "cidrlist": "0.0.0.0/0"
+                        },
+        "ostype": "CentOS 5.3 (64-bit)",
+        "sleep": 90,
+        "timeout": 10,
+        "advanced_sg": {
+                         "zone": {
+                                    "name": "",
+                                    "dns1": "8.8.8.8",
+                                    "internaldns1": "192.168.100.1",
+                                    "networktype": "Advanced",
+                                    "securitygroupenabled": "true"
+                                },
+                         "securitygroupenabled": "true"
+                       }
+}

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/029f4e36/tools/marvin/marvin/configGenerator.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/configGenerator.py b/tools/marvin/marvin/configGenerator.py
index 6d5b70d..0d79e8e 100644
--- a/tools/marvin/marvin/configGenerator.py
+++ b/tools/marvin/marvin/configGenerator.py
@@ -330,7 +330,10 @@ class ConfigManager(object):
     '''
 
     def __init__(self):
-        self.filePath = "config/config.cfg"
+        # Joining path with current directory will avoid relative path issue
+        # It will take correct path irrespective of from where the test case is run
+        dirPath = os.path.dirname(__file__)
+        self.filePath = os.path.join(dirPath, 'config/config.cfg')
         self.parsedDict = None
         if self.__verifyFile(self.filePath) is not False:
             self.parsedDict = self.__parseConfig(self.filePath)

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/029f4e36/tools/marvin/marvin/integration/lib/base.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/base.py b/tools/marvin/marvin/integration/lib/base.py
index b43af33..aa23029 100755
--- a/tools/marvin/marvin/integration/lib/base.py
+++ b/tools/marvin/marvin/integration/lib/base.py
@@ -2262,6 +2262,8 @@ class Zone:
             cmd.internaldns2 = services["internaldns2"]
         if domainid:
             cmd.domainid = domainid
+        if "securitygroupenabled" in services:
+            cmd.securitygroupenabled = services["securitygroupenabled"]
 
         return Zone(apiclient.createZone(cmd).__dict__)
 

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/029f4e36/tools/marvin/marvin/integration/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/integration/lib/common.py b/tools/marvin/marvin/integration/lib/common.py
index c1ae31b..c524675 100644
--- a/tools/marvin/marvin/integration/lib/common.py
+++ b/tools/marvin/marvin/integration/lib/common.py
@@ -799,35 +799,45 @@ def get_free_vlan(apiclient, zoneid):
     assert len(list_physical_networks_response) > 0, "No physical networks found in zone
%s" % zoneid
 
     physical_network = list_physical_networks_response[0]
-    vlans = xsplit(physical_network.vlan, ['-', ','])
 
-    assert len(vlans) > 0
-    assert int(vlans[0]) < int(vlans[-1]), "VLAN range  %s was improperly split" % physical_network.vlan
-
-    usedVlanIds = []
     networks = list_networks(apiclient, zoneid= zoneid, type='Shared')
+    usedVlanIds = []
+
     if isinstance(networks, list) and len(networks) > 0:
-        usedVlanIds = [int(nw.vlan) for nw in networks]
+        usedVlanIds = [int(nw.vlan) for nw in networks if nw.vlan!="untagged"]
+
+    if hasattr(physical_network, "vlan") is False:
+        while True:
+            shared_ntwk_vlan = random.randrange(1,4095)
+            if shared_ntwk_vlan in usedVlanIds:
+                continue
+            else:
+                break
+    else:
+        vlans = xsplit(physical_network.vlan, ['-', ','])
+
+        assert len(vlans) > 0
+        assert int(vlans[0]) < int(vlans[-1]), "VLAN range  %s was improperly split" %
physical_network.vlan
 
-    retriesCount = 20 #Assuming random function will give different integer each time
+        retriesCount = 20 #Assuming random function will give different integer each time
 
-    shared_ntwk_vlan = None
+        shared_ntwk_vlan = None
 
-    while True:
+        while True:
 
-        if retriesCount == 0:
-           break
+            if retriesCount == 0:
+                break
 
-        free_vlan = int(vlans[-1]) + random.randrange(1, 20)
+            free_vlan = int(vlans[-1]) + random.randrange(1, 20)
 
-        if free_vlan > 4095:
-            free_vlan = int(vlans[0]) - random.randrange(1, 20)
-        if free_vlan < 0 or (free_vlan in usedVlanIds):
-            retriesCount -= 1
-            continue
-        else:
-            shared_ntwk_vlan = free_vlan
-            break
+            if free_vlan > 4095:
+                free_vlan = int(vlans[0]) - random.randrange(1, 20)
+            if free_vlan < 0 or (free_vlan in usedVlanIds):
+                retriesCount -= 1
+                continue
+            else:
+                shared_ntwk_vlan = free_vlan
+                break
 
     return physical_network, shared_ntwk_vlan
 


Mime
View raw message