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:51 UTC
[23/50] [abbrv] git commit: updated refs/heads/4.4 to 2025f35
CLOUDSTACK-6888: Read postable IP configuration from config
(cherry picked from commit 49467f295410f1f0e265e7ce5ee6dd849207c3e8)
Project: http://git-wip-us.apache.org/repos/asf/cloudstack/repo
Commit: http://git-wip-us.apache.org/repos/asf/cloudstack/commit/b518d612
Tree: http://git-wip-us.apache.org/repos/asf/cloudstack/tree/b518d612
Diff: http://git-wip-us.apache.org/repos/asf/cloudstack/diff/b518d612
Branch: refs/heads/4.4
Commit: b518d612034805593eecc6aa55715b600dc7d439
Parents: 92a9703
Author: Girish Shilamkar <gi...@clogeny.com>
Authored: Fri Jun 13 09:38:16 2014 +0530
Committer: Daan Hoogland <da...@onecht.net>
Committed: Mon Jul 28 23:12:47 2014 +0200
----------------------------------------------------------------------
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/b518d612/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/b518d612/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index 91fe053..7753385 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -61,7 +61,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 *
@@ -1187,3 +1187,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