cloudstack-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gir...@apache.org
Subject git commit: updated refs/heads/master to 8e0aba4
Date Fri, 13 Jun 2014 04:11:31 GMT
Repository: cloudstack
Updated Branches:
  refs/heads/master 887f027a9 -> 8e0aba460


CLOUDSTACK-6888: Read postable IP configuration from config


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

Branch: refs/heads/master
Commit: 8e0aba46098e3106ebf8bfe219377f9c8bf4ddfd
Parents: 887f027
Author: Girish Shilamkar <girish@clogeny.com>
Authored: Fri Jun 13 09:38:16 2014 +0530
Committer: Girish Shilamkar <girish@clogeny.com>
Committed: Fri Jun 13 09:41:20 2014 +0530

----------------------------------------------------------------------
 test/integration/component/test_portable_ip.py | 51 +++++++++------------
 tools/marvin/marvin/lib/common.py              | 37 ++++++++++++++-
 2 files changed, 58 insertions(+), 30 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8e0aba46/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 77a5ab6..538318d 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -37,10 +37,11 @@ from marvin.lib.common import (get_zone,
                                get_domain,
                                get_region,
                                get_pod,
-                               isIpInDesiredState)
+                               isIpInDesiredState,
+                               getPortableIpRangeServices)
 from netaddr import IPAddress
 from marvin.sshClient import SshClient
-
+from marvin.codes import FAILED
 from nose.plugins.attrib import attr
 
 class Services:
@@ -142,15 +143,7 @@ class Services:
                                   "publicport": 22,
                                   "protocol": 'TCP',
                         },
-                        "ostype": 'CentOS 5.3 (64-bit)',
-                        "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)'
           }
 
 class TestCreatePortablePublicIpRanges(cloudstackTestCase):
@@ -208,8 +201,8 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
         # 1. Create new portable ip range with root admin api
         # 2. Portable ip range should be created successfully
 
-        portable_ip_range_services = self.services["portableIpRange"]
-        if portable_ip_range_services is None:
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         portable_ip_range_services["regionid"] = self.region.id
@@ -231,9 +224,9 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
         # 1. Create new portable ip range with non root admin api client
         # 2. Portable ip range should not be created
 
-        portable_ip_range_services = self.services["portableIpRange"]
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if portable_ip_range_services is None:
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         try:
@@ -267,9 +260,9 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
         # 1. Try to create new portable ip range with invalid region id
         # 2. Portable ip range creation should fail
 
-        portable_ip_range_services = self.services["portableIpRange"]
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if portable_ip_range_services is None:
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         portable_ip_range_services["regionid"] = -1
@@ -321,9 +314,9 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
 
-        portable_ip_range_services = self.services["portableIpRange"]
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if portable_ip_range_services is None:
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         portable_ip_range_services["regionid"] = self.region.id
@@ -480,9 +473,9 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
         self.dbclient = self.testClient.getDbConnection()
 
         #create new portable ip range
-        self.portable_ip_range_services = self.services["portableIpRange"]
+        self.portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if self.portable_ip_range_services is None:
+        if self.portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         self.portable_ip_range_services["regionid"] = self.region.id
@@ -643,9 +636,9 @@ class TestAssociatePublicIp(cloudstackTestCase):
 
         self.cleanup = []
 
-        portable_ip_range_services = self.services["portableIpRange"]
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if portable_ip_range_services is None:
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         portable_ip_range_services["regionid"] = self.region.id
@@ -978,9 +971,9 @@ class TestDisassociatePublicIp(cloudstackTestCase):
         self.dbclient = self.testClient.getDbConnection()
         self.cleanup = []
 
-        portable_ip_range_services = self.services["portableIpRange"]
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if portable_ip_range_services is None:
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         portable_ip_range_services["regionid"] = self.region.id
@@ -1172,8 +1165,8 @@ class TestDeleteAccount(cloudstackTestCase):
         self.apiclient = self.testClient.getApiClient()
         self.dbclient = self.testClient.getDbConnection()
 
-        portable_ip_range_services = self.services["portableIpRange"]
-        if portable_ip_range_services is None:
+        portable_ip_range_services = getPortableIpRangeServices(self.config)
+        if portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         self.cleanup = []
@@ -1432,9 +1425,9 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
         self.dbclient = self.testClient.getDbConnection()
 
         #create new portable ip range
-        self.portable_ip_range_services = self.services["portableIpRange"]
+        self.portable_ip_range_services = getPortableIpRangeServices(self.config)
 
-        if self.portable_ip_range_services is None:
+        if self.portable_ip_range_services is FAILED:
             self.skipTest('Failed to read config values related to portable ip range')
 
         self.portable_ip_range_services["regionid"] = self.region.id

http://git-wip-us.apache.org/repos/asf/cloudstack/blob/8e0aba46/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index 8b170da..a2cb959 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -63,7 +63,7 @@ from marvin.cloudstackAPI import (listConfigurations,
 
 from marvin.sshClient import SshClient
 from marvin.codes import (PASS, ISOLATED_NETWORK, VPC_NETWORK,
-                          BASIC_ZONE, FAIL, NAT_RULE, STATIC_NAT_RULE)
+                          BASIC_ZONE, FAIL, NAT_RULE, STATIC_NAT_RULE, FAILED)
 import random
 from marvin.lib.utils import *
 from marvin.lib.base import *
@@ -1147,3 +1147,38 @@ def createNetworkRulesForVM(apiclient, virtualmachine, ruletype,
     except Exception as e:
         [FAIL, e]
     return [PASS, public_ip]
+
+def getPortableIpRangeServices(config):
+    """ Reads config values related to portable ip and fills up
+    services accordingly"""
+
+    services = {}
+    attributeError = False
+
+    if config.portableIpRange.startip:
+        services["startip"] = config.portableIpRange.startip
+    else:
+        attributeError = True
+
+    if config.portableIpRange.endip:
+        services["endip"] = config.portableIpRange.endip
+    else:
+        attributeError = True
+
+    if config.portableIpRange.netmask:
+        services["netmask"] = config.portableIpRange.netmask
+    else:
+        attributeError = True
+
+    if config.portableIpRange.gateway:
+        services["gateway"] = config.portableIpRange.gateway
+    else:
+        attributeError = True
+
+    if config.portableIpRange.vlan:
+        services["vlan"] = config.portableIpRange.vlan
+
+    if attributeError:
+        services = FAILED
+
+    return services


Mime
View raw message