CLOUDSTACK-6992 Test data was passed to test methods.Made code changes to get 
test data and pass it to test methods. Also reading portable ip config values 
was not proper in getPortableIpRangeServices method. So corrected it

CLOUDSTACK-6992: Incorporated review comments for patch request 23009

CLOUDSTACK-6992: Added portable ip range to services class

Signed-off-by: sanjeevneelarapu <[email protected]>
Signed-off-by: SrikanteswaraRao Talluri <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/dfee7b14
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/dfee7b14
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/dfee7b14

Branch: refs/heads/vpc-toolkit-hugo
Commit: dfee7b1456e9490889f93060023555d898bf5ae5
Parents: 854f6ce
Author: sanjeevneelarapu <[email protected]>
Authored: Thu Jun 26 22:27:57 2014 +0530
Committer: SrikanteswaraRao Talluri <[email protected]>
Committed: Wed Jul 16 13:05:56 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_portable_ip.py | 30 +++++++++++++--------
 tools/marvin/marvin/lib/common.py              | 20 +++++++-------
 2 files changed, 29 insertions(+), 21 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfee7b14/test/integration/component/test_portable_ip.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_portable_ip.py 
b/test/integration/component/test_portable_ip.py
index b9c9059..ce27dd8 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -105,7 +105,7 @@ class Services:
                                     "privateport": 22,
                                     "publicport": 22,
                                     "protocol": "TCP",
-                                    "cidr" : '0.0.0.0/0',
+                                    "cidr": '0.0.0.0/0',
                         },
                         "small":
                                 # Create a small virtual machine instance with 
disk offering
@@ -143,6 +143,14 @@ class Services:
                                   "publicport": 22,
                                   "protocol": 'TCP',
                         },
+                        "portableIpRange":
+                                {
+                                "gateway": "10.223.252.195",
+                                "netmask": "255.255.255.192",
+                                "startip": "10.223.252.196",
+                                "endip": "10.223.252.197",
+                                "vlan": "1001",
+                       },
                         "ostype": 'CentOS 5.3 (64-bit)'
           }
 
@@ -155,8 +163,8 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestCreatePortablePublicIpRanges, 
cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
         cls.services = Services().services
+        cls.config = cls.services
         # Get Zone, Domain and templates
         cls.region = get_region(cls.api_client)
         cls.domain = get_domain(cls.api_client)
@@ -287,8 +295,8 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestDeletePortablePublicIpRanges, 
cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
         cls.services = Services().services
+        cls.config = cls.services
         # Get Zone, Domain and templates
         cls.region = get_region(cls.api_client)
         cls.domain = get_domain(cls.api_client)
@@ -445,8 +453,8 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestListPortablePublicIpRanges, 
cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
         cls.services = Services().services
+        cls.config = cls.services
         # Get Zone, Domain and templates
         cls.region = get_region(cls.api_client)
         cls.domain = get_domain(cls.api_client)
@@ -537,7 +545,7 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
                          "Listed netmask not matching with the netmask of 
created public ip range")
         return
 
-    @attr(tags=["advanced","swamy", "selfservice"])
+    @attr(tags=["advanced", "swamy", "selfservice"])
     def test_list_portable_ip_range_non_root_admin(self):
         """Test list portable ip ranges with non admin root account
         """
@@ -571,8 +579,8 @@ class TestAssociatePublicIp(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestAssociatePublicIp, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
         cls.services = Services().services
+        cls.config = cls.services
         # Get Zone, Domain and templates
         cls.region = get_region(cls.api_client)
         cls.domain = get_domain(cls.api_client)
@@ -887,8 +895,8 @@ class TestDisassociatePublicIp(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestDisassociatePublicIp, 
cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
         cls.services = Services().services
+        cls.config = cls.services
         # Get Zone, Domain and templates
         cls.region = get_region(cls.api_client)
         cls.domain = get_domain(cls.api_client)
@@ -1126,8 +1134,8 @@ class TestDeleteAccount(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestDeleteAccount, cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
         cls.services = Services().services
+        cls.config = cls.services
         # Get Zone, Domain and templates
         cls.region = get_region(cls.api_client)
         cls.domain = get_domain(cls.api_client)
@@ -1328,8 +1336,8 @@ class 
TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
     def setUpClass(cls):
         cls.testClient = super(TestPortableIpTransferAcrossNetworks, 
cls).getClsTestClient()
         cls.api_client = cls.testClient.getApiClient()
-
         cls.services = Services().services
+        cls.config = cls.services
         # Get Zone, Domain and templates
         cls.region = get_region(cls.api_client)
         cls.domain = get_domain(cls.api_client)
@@ -1447,7 +1455,7 @@ class 
TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
             raise Exception("Warning: Exception during cleanup : %s" % e)
         return
 
-    @attr(tags=["advanced","swamy", "selfservice"])
+    @attr(tags=["advanced", "swamy", "selfservice"])
     def test_list_portable_ip_range_non_root_admin(self):
         """Test list portable ip ranges with non admin root account
         """
@@ -1514,7 +1522,7 @@ class 
TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
                          "List Public IP should return a valid static NAT info 
that was created on portable ip"
                          )
         self.assertTrue(
-                        static_nat_list[0].ipaddress == 
portableip.ipaddress.ipaddress and 
static_nat_list[0].virtualmachineid==self.virtual_machine2.id,
+                        static_nat_list[0].ipaddress == 
portableip.ipaddress.ipaddress and static_nat_list[0].virtualmachineid == 
self.virtual_machine2.id,
                         "There is some issue in transferring portable ip {} 
across networks".format(portableip.ipaddress.ipaddress)
                         )
         try:

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/dfee7b14/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py 
b/tools/marvin/marvin/lib/common.py
index 29677d3..bc6b9c7 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -1172,28 +1172,28 @@ def getPortableIpRangeServices(config):
     services = {}
     attributeError = False
 
-    if config.portableIpRange.startip:
-        services["startip"] = config.portableIpRange.startip
+    if config["portableIpRange"]["startip"]:
+        services["startip"] = config["portableIpRange"]["startip"]
     else:
         attributeError = True
 
-    if config.portableIpRange.endip:
-        services["endip"] = config.portableIpRange.endip
+    if config["portableIpRange"]["endip"]:
+        services["endip"] = config["portableIpRange"]["endip"]
     else:
         attributeError = True
 
-    if config.portableIpRange.netmask:
-        services["netmask"] = config.portableIpRange.netmask
+    if config["portableIpRange"]["netmask"]:
+        services["netmask"] = config["portableIpRange"]["netmask"]
     else:
         attributeError = True
 
-    if config.portableIpRange.gateway:
-        services["gateway"] = config.portableIpRange.gateway
+    if config["portableIpRange"]["gateway"]:
+        services["gateway"] = config["portableIpRange"]["gateway"]
     else:
         attributeError = True
 
-    if config.portableIpRange.vlan:
-        services["vlan"] = config.portableIpRange.vlan
+    if config["portableIpRange"]["vlan"]:
+        services["vlan"] = config["portableIpRange"]["vlan"]
 
     if attributeError:
         services = FAILED

Reply via email to