Revert "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"

This reverts commit dfee7b1456e9490889f93060023555d898bf5ae5.
This commit is contained in:
Girish Shilamkar 2014-08-04 11:01:31 +05:30
parent 98e2a0444f
commit 2231fc8920
2 changed files with 21 additions and 29 deletions

View File

@ -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,14 +143,6 @@ 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)'
}
@ -163,8 +155,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)
@ -295,8 +287,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)
@ -453,8 +445,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)
@ -545,7 +537,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
"""
@ -579,8 +571,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)
@ -895,8 +887,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)
@ -1134,8 +1126,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)
@ -1336,8 +1328,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)
@ -1455,7 +1447,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
"""
@ -1522,7 +1514,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:

View File

@ -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