You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by bh...@apache.org on 2014/11/28 19:03:29 UTC
[15/51] [abbrv] git commit: updated
refs/heads/useraccount-refactoring to 1e25886
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/684268f4/test/integration/component/test_netscaler_lb_sticky.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_netscaler_lb_sticky.py b/test/integration/component/test_netscaler_lb_sticky.py
index a5f55a8..3494eae 100644
--- a/test/integration/component/test_netscaler_lb_sticky.py
+++ b/test/integration/component/test_netscaler_lb_sticky.py
@@ -31,83 +31,10 @@ from marvin.lib.base import (Account,
from marvin.lib.common import (get_domain,
get_zone,
get_template,
- add_netscaler,
- GetNetscalerInfoFromConfig)
+ add_netscaler)
from marvin.sshClient import SshClient
-class Services:
-
- """Test netscaler services
- """
-
- def __init__(self):
- self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 100, # in MHz
- "memory": 128, # In MBs
- },
- "virtual_machine": {
- "displayname": "TestVM",
- "username": "root",
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "network_offering": {
- "name": 'Netscaler',
- "displaytext": 'Netscaler',
- "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": 'Netscaler',
- "UserData": 'VirtualRouter',
- "StaticNat": 'VirtualRouter',
- },
- },
- "network": {
- "name": "Netscaler",
- "displaytext": "Netscaler",
- },
- "lbrule": {
- "name": "SSH",
- "alg": "roundrobin",
- # Algorithm used for load balancing
- "privateport": 22,
- "publicport": 22,
- "openfirewall": False,
- },
- "ostype": 'CentOS 5.3 (64-bit)',
- # Cent OS 5.3 (64 bit)
- "sleep": 60,
- "timeout": 10,
- "mode": 'advanced'
- }
-
-
class TestLbStickyPolicy(cloudstackTestCase):
@classmethod
@@ -116,46 +43,42 @@ class TestLbStickyPolicy(cloudstackTestCase):
cls.testClient = super(TestLbStickyPolicy, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
- cls.services = Services().services
+ # Fill testdata from the external config file
+ cls.testdata = cls.testClient.getParsedTestDataConfig()
# Get Zone, Domain and templates
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.template = get_template(
cls.api_client,
cls.zone.id,
- cls.services["ostype"]
+ cls.testdata["ostype"]
)
- response = GetNetscalerInfoFromConfig(
- cls.config
- )
- assert response[0] is not None, response[1]
- cls.services["netscaler"] = response[0]
- cls.services["netscaler"]["lbdevicededicated"] = False
+ cls.testdata["configurableData"]["netscaler"]["lbdevicededicated"] = False
try:
cls.netscaler = add_netscaler(
cls.api_client,
cls.zone.id,
- cls.services["netscaler"])
+ cls.testdata["configurableData"]["netscaler"])
cls._cleanup.append(cls.netscaler)
cls.network_offering = NetworkOffering.create(
cls.api_client,
- cls.services["network_offering"],
+ cls.testdata["nw_off_isolated_netscaler"],
conservemode=True
)
# Enable Network offering
cls.network_offering.update(cls.api_client, state='Enabled')
- cls.services["virtual_machine"]["zoneid"] = cls.zone.id
- cls.services["virtual_machine"]["template"] = cls.template.id
+ cls.testdata["small"]["zoneid"] = cls.zone.id
+ cls.testdata["small"]["template"] = cls.template.id
cls.service_offering = ServiceOffering.create(
cls.api_client,
- cls.services["service_offering"]
+ cls.testdata["service_offering"]
)
cls.account = Account.create(
cls.api_client,
- cls.services["account"],
+ cls.testdata["account"],
admin=True,
domainid=cls.domain.id
)
@@ -163,7 +86,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
# Creating network using the network offering created
cls.network = Network.create(
cls.api_client,
- cls.services["network"],
+ cls.testdata["network"],
accountid=cls.account.name,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
@@ -173,7 +96,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
# Spawn an instance in that network
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
- cls.services["virtual_machine"],
+ cls.testdata["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
@@ -211,7 +134,6 @@ class TestLbStickyPolicy(cloudstackTestCase):
self.debug("Cleaning up the resources")
# Clean up, terminate the created network offerings
cleanup_resources(self.apiclient, self.cleanup)
- self.debug("Cleanup complete!")
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
return
@@ -238,7 +160,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
lb_rule = LoadBalancerRule.create(
self.apiclient,
- self.services["lbrule"],
+ self.testdata["lbrule"],
ipaddressid=self.public_ip.ipaddress.id,
accountid=self.account.name,
networkid=self.network.id
@@ -274,13 +196,13 @@ class TestLbStickyPolicy(cloudstackTestCase):
"SSH into Netscaler to check whether sticky policy configured\
properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.testdata["configurableData"]["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
+ self.testdata["configurableData"]["netscaler"]["ipaddress"],
+ self.testdata["configurableData"]["netscaler"]["port"],
+ self.testdata["configurableData"]["netscaler"]["username"],
+ self.testdata["configurableData"]["netscaler"]["password"],
)
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
self.public_ip.ipaddress.ipaddress,
@@ -304,7 +226,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
except Exception as e:
self.fail("SSH Access failed for %s: %s" %
- (self.services["netscaler"]["ipaddress"], e))
+ (self.testdata["configurableData"]["netscaler"]["ipaddress"], e))
return
@attr(tags=["advancedns"])
@@ -327,10 +249,10 @@ class TestLbStickyPolicy(cloudstackTestCase):
"Creating LB rule for IP address: %s with source algo" %
self.public_ip.ipaddress.ipaddress)
- self.services["lbrule"]["alg"] = 'source'
+ self.testdata["lbrule"]["alg"] = 'source'
lb_rule = LoadBalancerRule.create(
self.apiclient,
- self.services["lbrule"],
+ self.testdata["lbrule"],
ipaddressid=self.public_ip.ipaddress.id,
accountid=self.account.name,
networkid=self.network.id
@@ -366,13 +288,13 @@ class TestLbStickyPolicy(cloudstackTestCase):
"SSH into Netscaler to check whether sticky policy\
configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.testdata["configurableData"]["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
+ self.testdata["configurableData"]["netscaler"]["ipaddress"],
+ self.testdata["configurableData"]["netscaler"]["port"],
+ self.testdata["configurableData"]["netscaler"]["username"],
+ self.testdata["configurableData"]["netscaler"]["password"],
)
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
self.public_ip.ipaddress.ipaddress,
@@ -396,7 +318,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
except Exception as e:
self.fail("SSH Access failed for %s: %s" %
- (self.services["netscaler"]["ipaddress"], e))
+ (self.testdata["configurableData"]["netscaler"]["ipaddress"], e))
return
@attr(tags=["advancedns"])
@@ -418,10 +340,10 @@ class TestLbStickyPolicy(cloudstackTestCase):
"Creating LB rule for IP address: %s with leastconn algo" %
self.public_ip.ipaddress.ipaddress)
- self.services["lbrule"]["alg"] = 'leastconn'
+ self.testdata["lbrule"]["alg"] = 'leastconn'
lb_rule = LoadBalancerRule.create(
self.apiclient,
- self.services["lbrule"],
+ self.testdata["lbrule"],
ipaddressid=self.public_ip.ipaddress.id,
accountid=self.account.name,
networkid=self.network.id
@@ -457,13 +379,13 @@ class TestLbStickyPolicy(cloudstackTestCase):
"SSH into Netscaler to check whether sticky policy configured\
properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.testdata["configurableData"]["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
+ self.testdata["configurableData"]["netscaler"]["ipaddress"],
+ self.testdata["configurableData"]["netscaler"]["port"],
+ self.testdata["configurableData"]["netscaler"]["username"],
+ self.testdata["configurableData"]["netscaler"]["password"],
)
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
self.public_ip.ipaddress.ipaddress,
@@ -487,7 +409,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
except Exception as e:
self.fail("SSH Access failed for %s: %s" %
- (self.services["netscaler"]["ipaddress"], e))
+ (self.testdata["configurableData"]["netscaler"]["ipaddress"], e))
return
@attr(tags=["advancedns"])
@@ -509,12 +431,12 @@ class TestLbStickyPolicy(cloudstackTestCase):
"Creating LB rule for IP address: %s with roundrobin algo" %
self.public_ip.ipaddress.ipaddress)
- self.services["lbrule"]["alg"] = 'roundrobin'
- self.services["lbrule"]["publicport"] = 80
- self.services["lbrule"]["privateport"] = 80
+ self.testdata["lbrule"]["alg"] = 'roundrobin'
+ self.testdata["lbrule"]["publicport"] = 80
+ self.testdata["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
self.apiclient,
- self.services["lbrule"],
+ self.testdata["lbrule"],
ipaddressid=self.public_ip.ipaddress.id,
accountid=self.account.name,
networkid=self.network.id
@@ -550,13 +472,13 @@ class TestLbStickyPolicy(cloudstackTestCase):
"SSH into Netscaler to check whether sticky policy\
configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.testdata["configurableData"]["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
+ self.testdata["configurableData"]["netscaler"]["ipaddress"],
+ self.testdata["configurableData"]["netscaler"]["port"],
+ self.testdata["configurableData"]["netscaler"]["username"],
+ self.testdata["configurableData"]["netscaler"]["password"],
)
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
self.public_ip.ipaddress.ipaddress,
@@ -580,7 +502,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
except Exception as e:
self.fail("SSH Access failed for %s: %s" %
- (self.services["netscaler"]["ipaddress"], e))
+ (self.testdata["configurableData"]["netscaler"]["ipaddress"], e))
return
@attr(tags=["advancedns"])
@@ -602,12 +524,12 @@ class TestLbStickyPolicy(cloudstackTestCase):
"Creating LB rule for IP address: %s with source algo" %
self.public_ip.ipaddress.ipaddress)
- self.services["lbrule"]["alg"] = 'source'
- self.services["lbrule"]["publicport"] = 80
- self.services["lbrule"]["privateport"] = 80
+ self.testdata["lbrule"]["alg"] = 'source'
+ self.testdata["lbrule"]["publicport"] = 80
+ self.testdata["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
self.apiclient,
- self.services["lbrule"],
+ self.testdata["lbrule"],
ipaddressid=self.public_ip.ipaddress.id,
accountid=self.account.name,
networkid=self.network.id
@@ -643,13 +565,13 @@ class TestLbStickyPolicy(cloudstackTestCase):
"SSH into Netscaler to check whether sticky policy\
configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.testdata["configurableData"]["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
+ self.testdata["configurableData"]["netscaler"]["ipaddress"],
+ self.testdata["configurableData"]["netscaler"]["port"],
+ self.testdata["configurableData"]["netscaler"]["username"],
+ self.testdata["configurableData"]["netscaler"]["password"],
)
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
self.public_ip.ipaddress.ipaddress,
@@ -673,7 +595,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
except Exception as e:
self.fail("SSH Access failed for %s: %s" %
- (self.services["netscaler"]["ipaddress"], e))
+ (self.testdata["configurableData"]["netscaler"]["ipaddress"], e))
return
@attr(tags=["advancedns"])
@@ -695,12 +617,12 @@ class TestLbStickyPolicy(cloudstackTestCase):
"Creating LB rule for IP address: %s with leastconn algo" %
self.public_ip.ipaddress.ipaddress)
- self.services["lbrule"]["alg"] = 'leastconn'
- self.services["lbrule"]["publicport"] = 80
- self.services["lbrule"]["privateport"] = 80
+ self.testdata["lbrule"]["alg"] = 'leastconn'
+ self.testdata["lbrule"]["publicport"] = 80
+ self.testdata["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
self.apiclient,
- self.services["lbrule"],
+ self.testdata["lbrule"],
ipaddressid=self.public_ip.ipaddress.id,
accountid=self.account.name,
networkid=self.network.id
@@ -736,13 +658,13 @@ class TestLbStickyPolicy(cloudstackTestCase):
"SSH into Netscaler to check whether sticky policy\
configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.testdata["configurableData"]["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
+ self.testdata["configurableData"]["netscaler"]["ipaddress"],
+ self.testdata["configurableData"]["netscaler"]["port"],
+ self.testdata["configurableData"]["netscaler"]["username"],
+ self.testdata["configurableData"]["netscaler"]["password"],
)
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
self.public_ip.ipaddress.ipaddress,
@@ -766,7 +688,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
except Exception as e:
self.fail("SSH Access failed for %s: %s" %
- (self.services["netscaler"]["ipaddress"], e))
+ (self.testdata["configurableData"]["netscaler"]["ipaddress"], e))
return
@attr(tags=["advancedns"])
@@ -788,12 +710,12 @@ class TestLbStickyPolicy(cloudstackTestCase):
"Creating LB rule for IP address: %s with roundrobin algo" %
self.public_ip.ipaddress.ipaddress)
- self.services["lbrule"]["alg"] = 'roundrobin'
- self.services["lbrule"]["publicport"] = 80
- self.services["lbrule"]["privateport"] = 80
+ self.testdata["lbrule"]["alg"] = 'roundrobin'
+ self.testdata["lbrule"]["publicport"] = 80
+ self.testdata["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
self.apiclient,
- self.services["lbrule"],
+ self.testdata["lbrule"],
ipaddressid=self.public_ip.ipaddress.id,
accountid=self.account.name,
networkid=self.network.id
@@ -829,13 +751,13 @@ class TestLbStickyPolicy(cloudstackTestCase):
"SSH into Netscaler to check whether sticky policy\
configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.testdata["configurableData"]["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
+ self.testdata["configurableData"]["netscaler"]["ipaddress"],
+ self.testdata["configurableData"]["netscaler"]["port"],
+ self.testdata["configurableData"]["netscaler"]["username"],
+ self.testdata["configurableData"]["netscaler"]["password"],
)
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
self.public_ip.ipaddress.ipaddress,
@@ -859,7 +781,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
except Exception as e:
self.fail("SSH Access failed for %s: %s" %
- (self.services["netscaler"]["ipaddress"], e))
+ (self.testdata["configurableData"]["netscaler"]["ipaddress"], e))
return
@attr(tags=["advancedns"])
@@ -881,12 +803,12 @@ class TestLbStickyPolicy(cloudstackTestCase):
"Creating LB rule for IP address: %s with source algo" %
self.public_ip.ipaddress.ipaddress)
- self.services["lbrule"]["alg"] = 'source'
- self.services["lbrule"]["publicport"] = 80
- self.services["lbrule"]["privateport"] = 80
+ self.testdata["lbrule"]["alg"] = 'source'
+ self.testdata["lbrule"]["publicport"] = 80
+ self.testdata["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
self.apiclient,
- self.services["lbrule"],
+ self.testdata["lbrule"],
ipaddressid=self.public_ip.ipaddress.id,
accountid=self.account.name,
networkid=self.network.id
@@ -922,13 +844,13 @@ class TestLbStickyPolicy(cloudstackTestCase):
"SSH into Netscaler to check whether sticky policy\
configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.testdata["configurableData"]["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
+ self.testdata["configurableData"]["netscaler"]["ipaddress"],
+ self.testdata["configurableData"]["netscaler"]["port"],
+ self.testdata["configurableData"]["netscaler"]["username"],
+ self.testdata["configurableData"]["netscaler"]["password"],
)
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
self.public_ip.ipaddress.ipaddress,
@@ -952,7 +874,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
except Exception as e:
self.fail("SSH Access failed for %s: %s" %
- (self.services["netscaler"]["ipaddress"], e))
+ (self.testdata["configurableData"]["netscaler"]["ipaddress"], e))
return
@attr(tags=["advancedns"])
@@ -974,12 +896,12 @@ class TestLbStickyPolicy(cloudstackTestCase):
"Creating LB rule for IP address: %s with leastconn algo" %
self.public_ip.ipaddress.ipaddress)
- self.services["lbrule"]["alg"] = 'leastconn'
- self.services["lbrule"]["publicport"] = 80
- self.services["lbrule"]["privateport"] = 80
+ self.testdata["lbrule"]["alg"] = 'leastconn'
+ self.testdata["lbrule"]["publicport"] = 80
+ self.testdata["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
self.apiclient,
- self.services["lbrule"],
+ self.testdata["lbrule"],
ipaddressid=self.public_ip.ipaddress.id,
accountid=self.account.name,
networkid=self.network.id
@@ -1015,13 +937,13 @@ class TestLbStickyPolicy(cloudstackTestCase):
"SSH into Netscaler to check whether sticky policy\
configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.testdata["configurableData"]["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
+ self.testdata["configurableData"]["netscaler"]["ipaddress"],
+ self.testdata["configurableData"]["netscaler"]["port"],
+ self.testdata["configurableData"]["netscaler"]["username"],
+ self.testdata["configurableData"]["netscaler"]["password"],
)
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
self.public_ip.ipaddress.ipaddress,
@@ -1045,5 +967,5 @@ class TestLbStickyPolicy(cloudstackTestCase):
except Exception as e:
self.fail("SSH Access failed for %s: %s" %
- (self.services["netscaler"]["ipaddress"], e))
+ (self.testdata["configurableData"]["netscaler"]["ipaddress"], e))
return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/684268f4/test/integration/component/test_persistent_networks.py
----------------------------------------------------------------------
diff --git a/test/integration/component/test_persistent_networks.py b/test/integration/component/test_persistent_networks.py
index ff563df..4b1bc7a 100644
--- a/test/integration/component/test_persistent_networks.py
+++ b/test/integration/component/test_persistent_networks.py
@@ -40,8 +40,7 @@ from marvin.lib.common import (get_domain,
get_template,
verifyNetworkState,
add_netscaler,
- wait_for_cleanup,
- GetNetscalerInfoFromConfig)
+ wait_for_cleanup)
from nose.plugins.attrib import attr
from marvin.codes import PASS, FAIL, FAILED
from marvin.sshClient import SshClient
@@ -98,12 +97,7 @@ class TestPersistentNetworks(cloudstackTestCase):
cls.isolated_network_offering_netscaler = cls.createNetworkOffering(
"nw_off_isolated_netscaler")
- response = GetNetscalerInfoFromConfig(
- cls.config
- )
- assert response[0] is not None, response[1]
- cls.services["netscaler"] = response[0]
- cls.services["netscaler"]["lbdevicededicated"] = False
+ cls.services["configurableData"]["netscaler"]["lbdevicededicated"] = False
# Configure Netscaler device
# If configuration succeeds, set ns_configured to True so that
@@ -113,7 +107,7 @@ class TestPersistentNetworks(cloudstackTestCase):
cls.netscaler = add_netscaler(
cls.api_client,
cls.zone.id,
- cls.services["netscaler"])
+ cls.services["configurableData"]["netscaler"])
cls._cleanup.append(cls.netscaler)
cls.ns_configured = True
except Exception:
@@ -1508,12 +1502,7 @@ class TestAssignVirtualMachine(cloudstackTestCase):
cls.persistent_network_offering_netscaler = cls.createNetworkOffering(
"nw_off_isolated_persistent_netscaler")
- response = GetNetscalerInfoFromConfig(
- cls.config
- )
- assert response[0] is not None, response[1]
- cls.services["netscaler"] = response[0]
- cls.services["netscaler"]["lbdevicededicated"] = False
+ cls.services["configurableData"]["netscaler"]["lbdevicededicated"] = False
# Configure Netscaler device
# If configuration succeeds, set ns_configured to True so that
@@ -1523,7 +1512,7 @@ class TestAssignVirtualMachine(cloudstackTestCase):
cls.netscaler = add_netscaler(
cls.api_client,
cls.zone.id,
- cls.services["netscaler"])
+ cls.services["configurableData"]["netscaler"])
cls._cleanup.append(cls.netscaler)
cls.ns_configured = True
except Exception:
@@ -1979,12 +1968,7 @@ class TestRestartPersistentNetwork(cloudstackTestCase):
cls.api_client,
state="enabled")
- response = GetNetscalerInfoFromConfig(
- cls.config
- )
- assert response[0] is not None, response[1]
- cls.services["netscaler"] = response[0]
- cls.services["netscaler"]["lbdevicededicated"] = False
+ cls.services["configurableData"]["netscaler"]["lbdevicededicated"] = False
# Configure Netscaler device
# If configuration succeeds, set ns_configured to True so that
@@ -1994,7 +1978,7 @@ class TestRestartPersistentNetwork(cloudstackTestCase):
cls.netscaler = add_netscaler(
cls.api_client,
cls.zone.id,
- cls.services["netscaler"])
+ cls.services["configurableData"]["netscaler"])
cls._cleanup.append(cls.netscaler)
cls.ns_configured = True
except Exception:
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/684268f4/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 cf0cb3b..6bdc61a 100644
--- a/test/integration/component/test_portable_ip.py
+++ b/test/integration/component/test_portable_ip.py
@@ -37,115 +37,11 @@ from marvin.lib.common import (get_zone,
get_domain,
get_region,
get_pod,
- isIpInDesiredState,
- getPortableIpRangeServices)
+ isIpInDesiredState)
from netaddr import IPAddress
from marvin.sshClient import SshClient
-from marvin.codes import FAILED
from nose.plugins.attrib import attr
-class Services:
- """Test Multiple IP Ranges
- """
- def __init__(self):
- self.services = {
- "account": {
- "email": "test@test.com",
- "firstname": "Test",
- "lastname": "User",
- "username": "test",
- # Random characters are appended for unique
- # username
- "password": "password",
- },
- "service_offering": {
- "name": "Tiny Instance",
- "displaytext": "Tiny Instance",
- "cpunumber": 1,
- "cpuspeed": 200, # in MHz
- "memory": 256, # In MBs
- },
- "network_offering": {
- "name": 'Network offering portable ip',
- "displaytext": 'Network offering-VR 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',
- },
- },
- "network": {
- "name": "Test Network - Portable IP",
- "displaytext": "Test Network - Portable IP",
- },
- "network1": {
- "name": "Test Network 1 - Portable IP",
- "displaytext": "Test Network 1 - Portable IP",
- },
- "network2": {
- "name": "Test Network 2 - Portable IP",
- "displaytext": "Test Network 2 - Portable IP",
- },
- "disk_offering": {
- "displaytext": "Small Disk",
- "name": "Small Disk",
- "disksize": 1
- },
- "natrule": {
- "privateport": 22,
- "publicport": 22,
- "protocol": "TCP",
- "cidr" : '0.0.0.0/0',
- },
- "small":
- # Create a small virtual machine instance with disk offering
- {
- "displayname": "testserver",
- "username": "root", # VM creds for SSH
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "vm1":
- # Create a small virtual machine instance with disk offering
- {
- "displayname": "vm1",
- "username": "root", # VM creds for SSH
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "vm2":
- # Create a small virtual machine instance with disk offering
- {
- "displayname": "vm2",
- "username": "root", # VM creds for SSH
- "password": "password",
- "ssh_port": 22,
- "hypervisor": 'XenServer',
- "privateport": 22,
- "publicport": 22,
- "protocol": 'TCP',
- },
- "ostype": 'CentOS 5.3 (64-bit)'
- }
-
class TestCreatePortablePublicIpRanges(cloudstackTestCase):
"""Test Create Portable IP Ranges
"""
@@ -156,16 +52,16 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
cls.testClient = super(TestCreatePortablePublicIpRanges, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
- cls.services = Services().services
+ # Fill testdata from the external config file
+ cls.testdata = cls.testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
- cls.services['mode'] = cls.zone.networktype
- cls.services["domainid"] = cls.domain.id
- cls.services["zoneid"] = cls.zone.id
- cls.services["regionid"] = cls.region.id
+ cls.testdata['mode'] = cls.zone.networktype
+ cls.testdata["regionid"] = cls.region.id
cls._cleanup = []
return
@@ -201,16 +97,12 @@ 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 = 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
+ self.testdata["configurableData"]["portableIpRange"]["regionid"] = self.region.id
try:
#create new portable ip range
new_portable_ip_range = PortablePublicIpRange.create(self.apiclient,
- portable_ip_range_services)
+ self.testdata["configurableData"]["portableIpRange"])
self.cleanup.append(new_portable_ip_range)
except Exception as e:
@@ -224,15 +116,10 @@ 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 = getPortableIpRangeServices(self.config)
-
- if portable_ip_range_services is FAILED:
- self.skipTest('Failed to read config values related to portable ip range')
-
try:
self.account = Account.create(
self.apiclient,
- self.services["account"],
+ self.testdata["account"],
domainid=self.domain.id
)
self.cleanup.append(self.account)
@@ -242,12 +129,12 @@ class TestCreatePortablePublicIpRanges(cloudstackTestCase):
DomainName=self.account.domain
)
- portable_ip_range_services["regionid"] = self.region.id
+ self.testdata["configurableData"]["portableIpRange"]["regionid"] = self.region.id
self.debug("Trying to create portable ip range with non root-admin api client, should raise exception")
with self.assertRaises(Exception):
portable_ip_range = PortablePublicIpRange.create(self.api_client_user,
- portable_ip_range_services)
+ self.testdata["configurableData"]["portableIpRange"])
self.cleanup.append(portable_ip_range)
except Exception as e:
self.fail(e)
@@ -260,20 +147,14 @@ 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 = 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"] = -1
+ self.testdata["configurableData"]["portableIpRange"]["regionid"] = -1
#create new portable ip range
self.debug("Trying to create portable ip range with wrong region id")
with self.assertRaises(Exception):
portable_ip_range = PortablePublicIpRange.create(self.apiclient,
- portable_ip_range_services)
+ self.testdata["configurableData"]["portableIpRange"])
self.cleanup.append(portable_ip_range)
return
@@ -288,16 +169,16 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
cls.testClient = super(TestDeletePortablePublicIpRanges, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
- cls.services = Services().services
+ # Fill testdata from the external config file
+ cls.testdata = cls.testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
- cls.services['mode'] = cls.zone.networktype
- cls.services["domainid"] = cls.domain.id
- cls.services["zoneid"] = cls.zone.id
- cls.services["regionid"] = cls.region.id
+ cls.testdata['mode'] = cls.zone.networktype
+ cls.testdata["regionid"] = cls.region.id
cls._cleanup = []
return
@@ -315,16 +196,11 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
- 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
+ self.testdata["configurableData"]["portableIpRange"]["regionid"] = self.region.id
#create new portable ip range
self.portable_ip_range = PortablePublicIpRange.create(self.apiclient,
- portable_ip_range_services)
+ self.testdata["configurableData"]["portableIpRange"])
self.cleanup = []
return
@@ -357,7 +233,7 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
try:
self.account = Account.create(
self.apiclient,
- self.services["account"],
+ self.testdata["account"],
domainid=self.domain.id
)
@@ -390,14 +266,14 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
try:
self.account = Account.create(
self.apiclient,
- self.services["account"],
+ self.testdata["account"],
domainid=self.domain.id
)
self.cleanup.append(self.account)
self.network_offering = NetworkOffering.create(
self.apiclient,
- self.services["network_offering"],
+ self.testdata["isolated_network_offering"],
conservemode=False
)
# Enable Network offering
@@ -405,7 +281,7 @@ class TestDeletePortablePublicIpRanges(cloudstackTestCase):
self.network = Network.create(
self.apiclient,
- self.services["network"],
+ self.testdata["network"],
accountid=self.account.name,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
@@ -446,16 +322,16 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
cls.testClient = super(TestListPortablePublicIpRanges, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
- cls.services = Services().services
+ # Fill testdata from the external config file
+ cls.testdata = cls.testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
- cls.services['mode'] = cls.zone.networktype
- cls.services["domainid"] = cls.domain.id
- cls.services["zoneid"] = cls.zone.id
- cls.services["regionid"] = cls.region.id
+ cls.testdata['mode'] = cls.zone.networktype
+ cls.testdata["regionid"] = cls.region.id
cls._cleanup = []
return
@@ -473,21 +349,15 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
- #create new portable ip range
- self.portable_ip_range_services = getPortableIpRangeServices(self.config)
-
- 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
+ self.testdata["configurableData"]["portableIpRange"]["regionid"] = self.region.id
self.debug("Creating new portable IP range with startip:%s and endip:%s" %
- (str(self.portable_ip_range_services["startip"]),
- str(self.portable_ip_range_services["endip"])))
+ (str(self.testdata["configurableData"]["portableIpRange"]["startip"]),
+ str(self.testdata["configurableData"]["portableIpRange"]["endip"])))
#create new portable ip range
self.portable_ip_range = PortablePublicIpRange.create(self.apiclient,
- self.portable_ip_range_services)
+ self.testdata["configurableData"]["portableIpRange"])
self.debug("Created new portable IP range with startip:%s and endip:%s and id:%s" %
(self.portable_ip_range.startip,
@@ -524,16 +394,16 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
portable_ip_range = list_portable_ip_range[0]
- self.assertEqual(str(portable_ip_range.startip), str(self.portable_ip_range_services["startip"]),
+ self.assertEqual(str(portable_ip_range.startip), str(self.testdata["configurableData"]["portableIpRange"]["startip"]),
"Listed startip not matching with the startip of created public ip range")
- self.assertEqual(str(portable_ip_range.endip), str(self.portable_ip_range_services["endip"]),
+ self.assertEqual(str(portable_ip_range.endip), str(self.testdata["configurableData"]["portableIpRange"]["endip"]),
"Listed endip not matching with the endip of created public ip range")
- self.assertEqual(str(portable_ip_range.gateway), str(self.portable_ip_range_services["gateway"]),
+ self.assertEqual(str(portable_ip_range.gateway), str(self.testdata["configurableData"]["portableIpRange"]["gateway"]),
"Listed gateway not matching with the gateway of created public ip range")
- self.assertEqual(str(portable_ip_range.netmask), str(self.portable_ip_range_services["netmask"]),
+ self.assertEqual(str(portable_ip_range.netmask), str(self.testdata["configurableData"]["portableIpRange"]["netmask"]),
"Listed netmask not matching with the netmask of created public ip range")
return
@@ -547,7 +417,7 @@ class TestListPortablePublicIpRanges(cloudstackTestCase):
self.account = Account.create(
self.apiclient,
- self.services["account"],
+ self.testdata["account"],
domainid=self.domain.id
)
@@ -572,29 +442,29 @@ class TestAssociatePublicIp(cloudstackTestCase):
cls.testClient = super(TestAssociatePublicIp, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
- cls.services = Services().services
+ # Fill testdata from the external config file
+ cls.testdata = cls.testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
- cls.services['mode'] = cls.zone.networktype
- cls.services["domainid"] = cls.domain.id
- cls.services["zoneid"] = cls.zone.id
- cls.services["regionid"] = cls.region.id
+ cls.testdata['mode'] = cls.zone.networktype
+ cls.testdata["regionid"] = cls.region.id
template = get_template(
cls.api_client,
cls.zone.id,
- cls.services["ostype"]
+ cls.testdata["ostype"]
)
# Set Zones and disk offerings
- cls.services["small"]["zoneid"] = cls.zone.id
- cls.services["small"]["template"] = template.id
+ cls.testdata["small"]["zoneid"] = cls.zone.id
+ cls.testdata["small"]["template"] = template.id
cls.account = Account.create(
cls.api_client,
- cls.services["account"],
+ cls.testdata["account"],
domainid=cls.domain.id,
admin=True
)
@@ -602,7 +472,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
cls.network_offering = NetworkOffering.create(
cls.api_client,
- cls.services["network_offering"],
+ cls.testdata["isolated_network_offering"],
conservemode=False
)
@@ -611,7 +481,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
cls.network = Network.create(
cls.api_client,
- cls.services["network"],
+ cls.testdata["network"],
accountid=cls.account.name,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
@@ -635,17 +505,10 @@ class TestAssociatePublicIp(cloudstackTestCase):
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
-
- 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
-
+ self.testdata["configurableData"]["portableIpRange"]["regionid"] = self.region.id
#create new portable ip range
self.portable_ip_range = PortablePublicIpRange.create(self.apiclient,
- portable_ip_range_services)
+ self.testdata["configurableData"]["portableIpRange"])
self.cleanup.append(self.portable_ip_range)
return
@@ -741,7 +604,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
self.service_offering = ServiceOffering.create(
self.apiclient,
- self.services["service_offering"]
+ self.testdata["service_offering"]
)
self.cleanup.append(self.service_offering)
@@ -751,12 +614,12 @@ class TestAssociatePublicIp(cloudstackTestCase):
self.debug("DeployingVirtual Machine")
self.virtual_machine = VirtualMachine.create(
self.apiclient,
- self.services["small"],
+ self.testdata["small"],
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
networkids = [self.network.id],
- mode=self.services['mode']
+ mode=self.testdata['mode']
)
self.debug("Created virtual machine instance: %s with ssh_ip: %s" %
(self.virtual_machine.id, self.virtual_machine.ssh_ip))
@@ -788,10 +651,10 @@ class TestAssociatePublicIp(cloudstackTestCase):
fw_rule = FireWallRule.create(
self.apiclient,
ipaddressid=portableip.ipaddress.id,
- protocol=self.services["natrule"]["protocol"],
- cidrlist=[self.services["natrule"]["cidr"]],
- startport=self.services["natrule"]["publicport"],
- endport=self.services["natrule"]["publicport"]
+ protocol=self.testdata["natrule"]["protocol"],
+ cidrlist=["0.0.0.0/0"],
+ startport=self.testdata["natrule"]["publicport"],
+ endport=self.testdata["natrule"]["publicport"]
)
#Create NAT rule
@@ -799,7 +662,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
nat_rule = NATRule.create(
self.apiclient,
self.virtual_machine,
- self.services["natrule"],
+ self.testdata["natrule"],
portableip.ipaddress.id
)
except Exception as e:
@@ -810,7 +673,7 @@ class TestAssociatePublicIp(cloudstackTestCase):
self.debug("Trying to SSH to ip: %s" % portableip.ipaddress.ipaddress)
SshClient(portableip.ipaddress.ipaddress,
- self.services['natrule']["publicport"],
+ self.testdata['natrule']["publicport"],
self.virtual_machine.username,
self.virtual_machine.password
)
@@ -888,30 +751,30 @@ class TestDisassociatePublicIp(cloudstackTestCase):
cls.testClient = super(TestDisassociatePublicIp, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
- cls.services = Services().services
+ # Fill testdata from the external config file
+ cls.testdata = cls.testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
- cls.services['mode'] = cls.zone.networktype
- cls.services["domainid"] = cls.domain.id
- cls.services["zoneid"] = cls.zone.id
- cls.services["regionid"] = cls.region.id
+ cls.testdata['mode'] = cls.zone.networktype
+ cls.testdata["regionid"] = cls.region.id
template = get_template(
cls.api_client,
cls.zone.id,
- cls.services["ostype"]
+ cls.testdata["ostype"]
)
# Set Zones and disk offerings
- cls.services["small"]["zoneid"] = cls.zone.id
- cls.services["small"]["template"] = template.id
+ cls.testdata["small"]["zoneid"] = cls.zone.id
+ cls.testdata["small"]["template"] = template.id
cls._cleanup = []
cls.account = Account.create(
cls.api_client,
- cls.services["account"],
+ cls.testdata["account"],
domainid=cls.domain.id,
admin=True
)
@@ -919,13 +782,13 @@ class TestDisassociatePublicIp(cloudstackTestCase):
cls.service_offering = ServiceOffering.create(
cls.api_client,
- cls.services["service_offering"]
+ cls.testdata["service_offering"]
)
cls._cleanup.append(cls.service_offering)
cls.network_offering = NetworkOffering.create(
cls.api_client,
- cls.services["network_offering"],
+ cls.testdata["isolated_network_offering"],
conservemode=False
)
@@ -935,7 +798,7 @@ class TestDisassociatePublicIp(cloudstackTestCase):
cls.network = Network.create(
cls.api_client,
- cls.services["network"],
+ cls.testdata["network"],
accountid=cls.account.name,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
@@ -944,12 +807,12 @@ class TestDisassociatePublicIp(cloudstackTestCase):
cls.virtual_machine = VirtualMachine.create(
cls.api_client,
- cls.services["small"],
+ cls.testdata["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
networkids = [cls.network.id],
- mode=cls.services['mode']
+ mode=cls.testdata['mode']
)
return
@@ -969,16 +832,11 @@ class TestDisassociatePublicIp(cloudstackTestCase):
self.dbclient = self.testClient.getDbConnection()
self.cleanup = []
- 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
+ self.testdata["configurableData"]["portableIpRange"]["regionid"] = self.region.id
#create new portable ip range
new_portable_ip_range = PortablePublicIpRange.create(self.apiclient,
- portable_ip_range_services)
+ self.testdata["configurableData"]["portableIpRange"])
self.cleanup.append(new_portable_ip_range)
return
@@ -1047,10 +905,10 @@ class TestDisassociatePublicIp(cloudstackTestCase):
FireWallRule.create(
self.apiclient,
ipaddressid=portableip.ipaddress.id,
- protocol=self.services["natrule"]["protocol"],
- cidrlist=[self.services["natrule"]["cidr"]],
- startport=self.services["natrule"]["publicport"],
- endport=self.services["natrule"]["publicport"]
+ protocol=self.testdata["natrule"]["protocol"],
+ cidrlist=["0.0.0.0/0"],
+ startport=self.testdata["natrule"]["publicport"],
+ endport=self.testdata["natrule"]["publicport"]
)
#Create NAT rule
@@ -1058,7 +916,7 @@ class TestDisassociatePublicIp(cloudstackTestCase):
NATRule.create(
self.apiclient,
self.virtual_machine,
- self.services["natrule"],
+ self.testdata["natrule"],
portableip.ipaddress.id
)
except Exception as e:
@@ -1096,7 +954,7 @@ class TestDisassociatePublicIp(cloudstackTestCase):
try:
self.otherAccount = Account.create(
self.apiclient,
- self.services["account"],
+ self.testdata["account"],
domainid=self.domain.id
)
self.cleanup.append(self.otherAccount)
@@ -1127,25 +985,24 @@ class TestDeleteAccount(cloudstackTestCase):
cls.testClient = super(TestDeleteAccount, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
- cls.services = Services().services
+ # Fill testdata from the external config file
+ cls.testdata = cls.testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
- cls.services['mode'] = cls.zone.networktype
cls.pod = get_pod(cls.api_client, cls.zone.id)
- cls.services['mode'] = cls.zone.networktype
- cls.services["domainid"] = cls.domain.id
- cls.services["zoneid"] = cls.zone.id
- cls.services["regionid"] = cls.region.id
+ cls.testdata['mode'] = cls.zone.networktype
+ cls.testdata["regionid"] = cls.region.id
template = get_template(
cls.api_client,
cls.zone.id,
- cls.services["ostype"]
+ cls.testdata["ostype"]
)
# Set Zones and disk offerings
- cls.services["small"]["zoneid"] = cls.zone.id
- cls.services["small"]["template"] = template.id
+ cls.testdata["small"]["zoneid"] = cls.zone.id
+ cls.testdata["small"]["template"] = template.id
cls._cleanup = []
return
@@ -1163,27 +1020,23 @@ class TestDeleteAccount(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
- 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 = []
try:
self.account = Account.create(
self.apiclient,
- self.services["account"],
+ self.testdata["account"],
domainid=self.domain.id,
admin=True
)
self.cleanup.append(self.account)
- portable_ip_range_services["regionid"] = self.region.id
+ self.testdata["configurableData"]["portableIpRange"]["regionid"] = self.region.id
#create new portable ip range
new_portable_ip_range = PortablePublicIpRange.create(self.apiclient,
- portable_ip_range_services)
+ self.testdata["configurableData"]["portableIpRange"])
self.cleanup.append(new_portable_ip_range)
self.network_offering = NetworkOffering.create(
self.apiclient,
- self.services["network_offering"],
+ self.testdata["isolated_network_offering"],
conservemode=False
)
# Enable Network offering
@@ -1191,7 +1044,7 @@ class TestDeleteAccount(cloudstackTestCase):
self.network = Network.create(
self.apiclient,
- self.services["network"],
+ self.testdata["network"],
accountid=self.account.name,
domainid=self.account.domainid,
networkofferingid=self.network_offering.id,
@@ -1243,7 +1096,7 @@ class TestDeleteAccount(cloudstackTestCase):
self.service_offering = ServiceOffering.create(
self.apiclient,
- self.services["service_offering"]
+ self.testdata["service_offering"]
)
self.cleanup.append(self.service_offering)
@@ -1251,11 +1104,11 @@ class TestDeleteAccount(cloudstackTestCase):
self.debug("Deploying Virtual Machine")
self.virtual_machine = VirtualMachine.create(
self.apiclient,
- self.services["small"],
+ self.testdata["small"],
accountid=self.account.name,
domainid=self.account.domainid,
serviceofferingid=self.service_offering.id,
- mode=self.services['mode']
+ mode=self.testdata['mode']
)
self.debug("Created virtual machine instance: %s" % self.virtual_machine.id)
@@ -1284,10 +1137,10 @@ class TestDeleteAccount(cloudstackTestCase):
FireWallRule.create(
self.apiclient,
ipaddressid=portableip.ipaddress.id,
- protocol=self.services["natrule"]["protocol"],
- cidrlist=[self.services["natrule"]["cidr"]],
- startport=self.services["natrule"]["publicport"],
- endport=self.services["natrule"]["publicport"]
+ protocol=self.testdata["natrule"]["protocol"],
+ cidrlist=["0.0.0.0/0"],
+ startport=self.testdata["natrule"]["publicport"],
+ endport=self.testdata["natrule"]["publicport"]
)
#Create NAT rule
@@ -1295,7 +1148,7 @@ class TestDeleteAccount(cloudstackTestCase):
NATRule.create(
self.apiclient,
self.virtual_machine,
- self.services["natrule"],
+ self.testdata["natrule"],
portableip.ipaddress.id
)
except Exception as e:
@@ -1325,34 +1178,32 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
cls.testClient = super(TestPortableIpTransferAcrossNetworks, cls).getClsTestClient()
cls.api_client = cls.testClient.getApiClient()
- cls.services = Services().services
+ # Fill testdata from the external config file
+ cls.testdata = cls.testClient.getParsedTestDataConfig()
+
# Get Zone, Domain and templates
cls.region = get_region(cls.api_client)
cls.domain = get_domain(cls.api_client)
cls.zone = get_zone(cls.api_client, cls.testClient.getZoneForTests())
cls.pod = get_pod(cls.api_client, cls.zone.id)
- cls.services['mode'] = cls.zone.networktype
- cls.services["domainid"] = cls.domain.id
- cls.services["zoneid"] = cls.zone.id
- cls.services["regionid"] = cls.region.id
+ cls.testdata['mode'] = cls.zone.networktype
+ cls.testdata["regionid"] = cls.region.id
template = get_template(
cls.api_client,
cls.zone.id,
- cls.services["ostype"]
+ cls.testdata["ostype"]
)
# Set Zones and disk offerings
- cls.services["vm1"]["zoneid"] = cls.zone.id
- cls.services["vm1"]["template"] = template.id
- cls.services["vm2"]["zoneid"] = cls.zone.id
- cls.services["vm2"]["template"] = template.id
+ cls.testdata["small"]["zoneid"] = cls.zone.id
+ cls.testdata["small"]["template"] = template.id
cls._cleanup = []
# Set Zones and Network offerings
cls.account = Account.create(
cls.api_client,
- cls.services["account"],
+ cls.testdata["account"],
domainid=cls.domain.id,
admin=True
)
@@ -1360,7 +1211,7 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
cls.network_offering = NetworkOffering.create(
cls.api_client,
- cls.services["network_offering"],
+ cls.testdata["isolated_network_offering"],
conservemode=False
)
cls._cleanup.append(cls.network_offering)
@@ -1369,12 +1220,12 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
cls.network_offering.update(cls.api_client, state='Enabled')
cls.service_offering = ServiceOffering.create(
cls.api_client,
- cls.services["service_offering"]
+ cls.testdata["service_offering"]
)
cls.network1 = Network.create(
cls.api_client,
- cls.services["network1"],
+ cls.testdata["network"],
accountid=cls.account.name,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
@@ -1383,7 +1234,7 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
cls.virtual_machine1 = VirtualMachine.create(
cls.api_client,
- cls.services["vm1"],
+ cls.testdata["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
@@ -1391,7 +1242,7 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
)
cls.network2 = Network.create(
cls.api_client,
- cls.services["network2"],
+ cls.testdata["network"],
accountid=cls.account.name,
domainid=cls.account.domainid,
networkofferingid=cls.network_offering.id,
@@ -1399,7 +1250,7 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
)
cls.virtual_machine2 = VirtualMachine.create(
cls.api_client,
- cls.services["vm2"],
+ cls.testdata["small"],
accountid=cls.account.name,
domainid=cls.account.domainid,
serviceofferingid=cls.service_offering.id,
@@ -1420,17 +1271,11 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
self.apiclient = self.testClient.getApiClient()
self.dbclient = self.testClient.getDbConnection()
- #create new portable ip range
- self.portable_ip_range_services = getPortableIpRangeServices(self.config)
-
- 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
+ self.testdata["configurableData"]["portableIpRange"]["regionid"] = self.region.id
#create new portable ip range
self.portable_ip_range = PortablePublicIpRange.create(self.apiclient,
- self.portable_ip_range_services)
+ self.testdata["configurableData"]["portableIpRange"])
self.cleanup = [self.portable_ip_range, ]
return
@@ -1488,10 +1333,10 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
FireWallRule.create(
self.apiclient,
ipaddressid=portableip.ipaddress.id,
- protocol=self.services["natrule"]["protocol"],
- cidrlist=[self.services["natrule"]["cidr"]],
- startport=self.services["natrule"]["publicport"],
- endport=self.services["natrule"]["publicport"]
+ protocol=self.testdata["natrule"]["protocol"],
+ cidrlist=["0.0.0.0/0"],
+ startport=self.testdata["natrule"]["publicport"],
+ endport=self.testdata["natrule"]["publicport"]
)
except Exception as e:
portableip.delete(self.apiclient)
@@ -1517,7 +1362,7 @@ class TestPortableIpTransferAcrossNetworks(cloudstackTestCase):
self.debug("Trying to SSH to ip: %s" % portableip.ipaddress.ipaddress)
SshClient(portableip.ipaddress.ipaddress,
- self.services['natrule']["publicport"],
+ self.testdata['natrule']["publicport"],
self.virtual_machine2.username,
self.virtual_machine2.password
)
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/684268f4/test/integration/smoke/test_primary_storage.py
----------------------------------------------------------------------
diff --git a/test/integration/smoke/test_primary_storage.py b/test/integration/smoke/test_primary_storage.py
index 310afca..8221225 100644
--- a/test/integration/smoke/test_primary_storage.py
+++ b/test/integration/smoke/test_primary_storage.py
@@ -190,7 +190,7 @@ class TestPrimaryStorageServices(cloudstackTestCase):
storage = StoragePool.create(self.apiclient,
- self.services["iscsi"],
+ self.services["configurableData"]["iscsi"],
clusterid=cluster.id,
zoneid=self.zone.id,
podid=self.pod.id
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/684268f4/tools/marvin/marvin/config/test_data.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/config/test_data.py b/tools/marvin/marvin/config/test_data.py
index 2f97d5f..f0802a5 100644
--- a/tools/marvin/marvin/config/test_data.py
+++ b/tools/marvin/marvin/config/test_data.py
@@ -190,24 +190,23 @@ test_data = {
},
},
"nw_off_isolated_netscaler": {
- "name": "Network offering-ns services",
- "displaytext": "Network offering-ns 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": "NetScaler",
- "UserData": "VirtualRouter",
- "StaticNat": "VirtualRouter"
- }
+ "name": 'Netscaler',
+ "displaytext": 'Netscaler',
+ "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": 'Netscaler',
+ "UserData": 'VirtualRouter',
+ "StaticNat": 'VirtualRouter',
+ },
},
"nw_off_isolated_persistent": {
"name": 'Test Nw off isolated persistent',
@@ -1419,4 +1418,30 @@ test_data = {
}
]
},
+ "configurableData":
+ {
+ "portableIpRange": {
+ "gateway": "",
+ "netmask": "",
+ "startip": "",
+ "endip": "",
+ "vlan": ""
+ },
+ "netscaler": {
+ "ipaddress": "",
+ "username": "",
+ "password": "",
+ "networkdevicetype": "",
+ "publicinterface": "",
+ "privateinterface": "",
+ "numretries": "",
+ "lbdevicededicated": "False",
+ "lbdevicecapacity": 2,
+ "port": 22
+ },
+ "iscsi": {
+ "url": "",
+ "name": "Primary iSCSI"
+ },
+ }
}
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/684268f4/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index 63662b9..9e3d40c 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -1376,21 +1376,3 @@ def isNetworkDeleted(apiclient, networkid, timeout=600):
time.sleep(60)
#end while
return networkDeleted
-
-def GetNetscalerInfoFromConfig(config):
- """ Read netscaler data from config file and
- return it
-
- Input: Config
- Output: [netscalerInfoDict, isExceptionOccured]
- """
- try:
- netscalerInfo = config.__dict__[
- "netscalerDevice"].__dict__
- return [netscalerInfo, None]
- except KeyError:
- exceptionMessage = "Please make sure you have included netscalerDevice\
- dict in your config file"
- return [None, exceptionMessage]
- except Exception as e:
- return [None, e]