Return-Path: X-Original-To: apmail-cloudstack-commits-archive@www.apache.org Delivered-To: apmail-cloudstack-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id 3299610ED0 for ; Tue, 25 Nov 2014 12:57:16 +0000 (UTC) Received: (qmail 46619 invoked by uid 500); 25 Nov 2014 12:57:15 -0000 Delivered-To: apmail-cloudstack-commits-archive@cloudstack.apache.org Received: (qmail 46499 invoked by uid 500); 25 Nov 2014 12:57:15 -0000 Mailing-List: contact commits-help@cloudstack.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@cloudstack.apache.org Delivered-To: mailing list commits@cloudstack.apache.org Received: (qmail 46307 invoked by uid 99); 25 Nov 2014 12:57:15 -0000 Received: from tyr.zones.apache.org (HELO tyr.zones.apache.org) (140.211.11.114) by apache.org (qpsmtpd/0.29) with ESMTP; Tue, 25 Nov 2014 12:57:15 +0000 Received: by tyr.zones.apache.org (Postfix, from userid 65534) id 2A490A19367; Tue, 25 Nov 2014 12:57:15 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: talluri@apache.org To: commits@cloudstack.apache.org Date: Tue, 25 Nov 2014 12:57:16 -0000 Message-Id: <4b08feb04a814158b10dcf99799355b3@git.apache.org> In-Reply-To: <66fe47fa4efa4df9a6ce83efb7af847d@git.apache.org> References: <66fe47fa4efa4df9a6ce83efb7af847d@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [2/4] git commit: updated refs/heads/4.5 to d7940cc http://git-wip-us.apache.org/repos/asf/cloudstack/blob/d7940cca/test/integration/component/test_netscaler_lb_algo.py ---------------------------------------------------------------------- diff --git a/test/integration/component/test_netscaler_lb_algo.py b/test/integration/component/test_netscaler_lb_algo.py index 0d571b4..bafecd0 100644 --- a/test/integration/component/test_netscaler_lb_algo.py +++ b/test/integration/component/test_netscaler_lb_algo.py @@ -31,83 +31,8 @@ from marvin.lib.base import (Account, from marvin.lib.common import (get_zone, get_domain, get_template, - list_configurations, - GetNetscalerInfoFromConfig, add_netscaler) from marvin.sshClient import SshClient -import time - - -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": "leastconn", - # 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 TestLbWithRoundRobin(cloudstackTestCase): @@ -118,40 +43,37 @@ class TestLbWithRoundRobin(cloudstackTestCase): cls.testClient = super(TestLbWithRoundRobin, 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 cls._cleanup = [] try: - cls.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.services["netscaler"]) + cls.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.testdata["configurableData"]["netscaler"]) cls._cleanup.append(cls.netscaler) + cls.network_offering = NetworkOffering.create( cls.api_client, - cls.services["network_offering"], - conservemode=True + 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"] ) except Exception as e: cls.tearDownClass() @@ -172,7 +94,7 @@ class TestLbWithRoundRobin(cloudstackTestCase): self.dbclient = self.testClient.getDbConnection() self.account = Account.create( self.apiclient, - self.services["account"], + self.testdata["account"], admin=True, domainid=self.domain.id ) @@ -184,17 +106,6 @@ class TestLbWithRoundRobin(cloudstackTestCase): self.debug("Cleaning up the resources") # Clean up, terminate the created network offerings cleanup_resources(self.apiclient, self.cleanup) - interval = list_configurations( - self.apiclient, - name='network.gc.interval' - ) - wait = list_configurations( - self.apiclient, - name='network.gc.wait' - ) - # Sleep to ensure that all resources are deleted - time.sleep(int(interval[0].value) + int(wait[0].value)) - self.debug("Cleanup complete!") except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) return @@ -217,7 +128,7 @@ class TestLbWithRoundRobin(cloudstackTestCase): self.network_offering.id) 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, @@ -230,7 +141,7 @@ class TestLbWithRoundRobin(cloudstackTestCase): # Spawn an instance in that network self.virtual_machine = VirtualMachine.create( self.apiclient, - self.services["virtual_machine"], + self.testdata["small"], accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, @@ -277,10 +188,10 @@ class TestLbWithRoundRobin(cloudstackTestCase): "Creating LB rule for IP address: %s with round robin algo" % ip_with_lb_rule.ipaddress.ipaddress) - self.services["lbrule"]["alg"] = 'roundrobin' + self.testdata["lbrule"]["alg"] = 'roundrobin' lb_rule = LoadBalancerRule.create( self.apiclient, - self.services["lbrule"], + self.testdata["lbrule"], ipaddressid=ip_with_lb_rule.ipaddress.id, accountid=self.account.name, networkid=self.network.id @@ -304,13 +215,13 @@ class TestLbWithRoundRobin(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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" % ( ip_with_lb_rule.ipaddress.ipaddress, @@ -328,7 +239,7 @@ class TestLbWithRoundRobin(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 @@ -340,41 +251,37 @@ class TestLbWithLeastConn(cloudstackTestCase): cls.testClient = super(TestLbWithLeastConn, 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.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.testdata["configurableData"]["netscaler"]) cls._cleanup.append(cls.netscaler) cls.network_offering = NetworkOffering.create( cls.api_client, - cls.services["network_offering"], - conservemode=True + cls.testdata["nw_off_isolated_netscaler"], + conservemode="True" ) cls._cleanup.append(cls.network_offering) # 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._cleanup.append(cls.service_offering) except Exception as e: @@ -397,7 +304,7 @@ class TestLbWithLeastConn(cloudstackTestCase): self.dbclient = self.testClient.getDbConnection() self.account = Account.create( self.apiclient, - self.services["account"], + self.testdata["account"], admin=True, domainid=self.domain.id ) @@ -409,17 +316,6 @@ class TestLbWithLeastConn(cloudstackTestCase): self.debug("Cleaning up the resources") # Clean up, terminate the created network offerings cleanup_resources(self.apiclient, self.cleanup) - interval = list_configurations( - self.apiclient, - name='network.gc.interval' - ) - wait = list_configurations( - self.apiclient, - name='network.gc.wait' - ) - # Sleep to ensure that all resources are deleted - time.sleep(int(interval[0].value) + int(wait[0].value)) - self.debug("Cleanup complete!") except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) return @@ -442,7 +338,7 @@ class TestLbWithLeastConn(cloudstackTestCase): self.network_offering.id) 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, @@ -455,7 +351,7 @@ class TestLbWithLeastConn(cloudstackTestCase): # Spawn an instance in that network self.virtual_machine = VirtualMachine.create( self.apiclient, - self.services["virtual_machine"], + self.testdata["small"], accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, @@ -509,10 +405,10 @@ class TestLbWithLeastConn(cloudstackTestCase): "Creating LB rule for IP address: %s with round robin algo" % ip_with_lb_rule.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=ip_with_lb_rule.ipaddress.id, accountid=self.account.name, networkid=self.network.id @@ -537,13 +433,13 @@ class TestLbWithLeastConn(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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" % ( ip_with_lb_rule.ipaddress.ipaddress, @@ -561,7 +457,7 @@ class TestLbWithLeastConn(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 @@ -572,41 +468,37 @@ class TestLbWithSourceIp(cloudstackTestCase): cls.testClient = super(TestLbWithSourceIp, 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 cls._cleanup = [] try: - cls.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.services["netscaler"]) + cls.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.testdata["configurableData"]["netscaler"]) cls._cleanup.append(cls.netscaler) cls.network_offering = NetworkOffering.create( cls.api_client, - cls.services["network_offering"], - conservemode=True + cls.testdata["nw_off_isolated_netscaler"], + conservemode="True" ) cls._cleanup.append(cls.network_offering) # 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._cleanup.append(cls.service_offering) except Exception as e: @@ -628,7 +520,7 @@ class TestLbWithSourceIp(cloudstackTestCase): self.dbclient = self.testClient.getDbConnection() self.account = Account.create( self.apiclient, - self.services["account"], + self.testdata["account"], admin=True, domainid=self.domain.id ) @@ -640,17 +532,6 @@ class TestLbWithSourceIp(cloudstackTestCase): self.debug("Cleaning up the resources") # Clean up, terminate the created network offerings cleanup_resources(self.apiclient, self.cleanup) - interval = list_configurations( - self.apiclient, - name='network.gc.interval' - ) - wait = list_configurations( - self.apiclient, - name='network.gc.wait' - ) - # Sleep to ensure that all resources are deleted - time.sleep(int(interval[0].value) + int(wait[0].value)) - self.debug("Cleanup complete!") except Exception as e: raise Exception("Warning: Exception during cleanup : %s" % e) return @@ -673,7 +554,7 @@ class TestLbWithSourceIp(cloudstackTestCase): self.network_offering.id) 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, @@ -686,7 +567,7 @@ class TestLbWithSourceIp(cloudstackTestCase): # Spawn an instance in that network self.virtual_machine = VirtualMachine.create( self.apiclient, - self.services["virtual_machine"], + self.testdata["small"], accountid=self.account.name, domainid=self.account.domainid, serviceofferingid=self.service_offering.id, @@ -733,10 +614,10 @@ class TestLbWithSourceIp(cloudstackTestCase): "Creating LB rule for IP address: %s with round robin algo" % ip_with_lb_rule.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=ip_with_lb_rule.ipaddress.id, accountid=self.account.name, networkid=self.network.id @@ -761,13 +642,13 @@ class TestLbWithSourceIp(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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" % ( ip_with_lb_rule.ipaddress.ipaddress, @@ -785,7 +666,7 @@ class TestLbWithSourceIp(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 @@ -797,62 +678,58 @@ class TestLbAlgoRrLc(cloudstackTestCase): cls.testClient = super(TestLbAlgoRrLc, 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.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.testdata["configurableData"]["netscaler"]) cls._cleanup.append(cls.netscaler) cls.network_offering = NetworkOffering.create( cls.api_client, - cls.services["network_offering"], - conservemode=True + cls.testdata["nw_off_isolated_netscaler"], + conservemode="True" ) cls._cleanup.append(cls.network_offering) # Enable Network offering cls.network_offering.update(cls.api_client, state='Enabled') cls.account = Account.create( cls.api_client, - cls.services["account"], + cls.testdata["account"], admin=True, domainid=cls.domain.id ) cls._cleanup.insert(0, cls.account) 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, zoneid=cls.zone.id ) - 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._cleanup.append(cls.service_offering) # 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, @@ -914,10 +791,10 @@ class TestLbAlgoRrLc(cloudstackTestCase): "Creating LB rule for IP address: %s with round robin algo" % self.public_ip.ipaddress.ipaddress) - self.services["lbrule"]["alg"] = 'roundrobin' + self.testdata["lbrule"]["alg"] = 'roundrobin' 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 @@ -944,13 +821,13 @@ class TestLbAlgoRrLc(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -967,7 +844,7 @@ class TestLbAlgoRrLc(cloudstackTestCase): ) except Exception as e: self.fail("SSH Access failed for %s: %s" % - (self.services["netscaler"]["ipaddress"], e)) + (self.testdata["configurableData"]["netscaler"]["ipaddress"], e)) self.debug( "Updating LB rule: %s with new algorithm: %s" % ( @@ -978,13 +855,13 @@ class TestLbAlgoRrLc(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -1001,7 +878,7 @@ class TestLbAlgoRrLc(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 @@ -1013,62 +890,58 @@ class TestLbAlgoLcRr(cloudstackTestCase): cls.testClient = super(TestLbAlgoLcRr, 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.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.testdata["configurableData"]["netscaler"]) cls._cleanup.append(cls.netscaler) cls.network_offering = NetworkOffering.create( cls.api_client, - cls.services["network_offering"], - conservemode=True + cls.testdata["nw_off_isolated_netscaler"], + conservemode="True" ) cls._cleanup.append(cls.network_offering) # Enable Network offering cls.network_offering.update(cls.api_client, state='Enabled') cls.account = Account.create( cls.api_client, - cls.services["account"], + cls.testdata["account"], admin=True, domainid=cls.domain.id ) cls._cleanup.insert(0, cls.account) 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, zoneid=cls.zone.id ) - 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._cleanup.append(cls.service_offering) # 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, @@ -1106,7 +979,6 @@ class TestLbAlgoLcRr(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 @@ -1130,10 +1002,10 @@ class TestLbAlgoLcRr(cloudstackTestCase): "Creating LB rule for IP address: %s with least conn 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 @@ -1158,13 +1030,13 @@ class TestLbAlgoLcRr(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -1181,7 +1053,7 @@ class TestLbAlgoLcRr(cloudstackTestCase): ) except Exception as e: self.fail("SSH Access failed for %s: %s" % - (self.services["netscaler"]["ipaddress"], e)) + (self.testdata["configurableData"]["netscaler"]["ipaddress"], e)) self.debug( "Updating LB rule: %s with new algorithm: %s" % ( @@ -1191,13 +1063,13 @@ class TestLbAlgoLcRr(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -1214,7 +1086,7 @@ class TestLbAlgoLcRr(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 @@ -1226,62 +1098,58 @@ class TestLbAlgoRrSb(cloudstackTestCase): cls.testClient = super(TestLbAlgoRrSb, 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.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.testdata["configurableData"]["netscaler"]) cls._cleanup.append(cls.netscaler) cls.network_offering = NetworkOffering.create( cls.api_client, - cls.services["network_offering"], - conservemode=True + cls.testdata["nw_off_isolated_netscaler"], + conservemode="True" ) cls._cleanup.append(cls.network_offering) # Enable Network offering cls.network_offering.update(cls.api_client, state='Enabled') cls.account = Account.create( cls.api_client, - cls.services["account"], + cls.testdata["account"], admin=True, domainid=cls.domain.id ) cls._cleanup.insert(0, cls.account) 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, zoneid=cls.zone.id ) - 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._cleanup.append(cls.service_offering) # 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, @@ -1320,7 +1188,6 @@ class TestLbAlgoRrSb(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 @@ -1344,10 +1211,10 @@ class TestLbAlgoRrSb(cloudstackTestCase): "Creating LB rule for IP address: %s with round robin algo" % self.public_ip.ipaddress.ipaddress) - self.services["lbrule"]["alg"] = 'roundrobin' + self.testdata["lbrule"]["alg"] = 'roundrobin' 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 @@ -1372,13 +1239,13 @@ class TestLbAlgoRrSb(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -1395,7 +1262,7 @@ class TestLbAlgoRrSb(cloudstackTestCase): ) except Exception as e: self.fail("SSH Access failed for %s: %s" % - (self.services["netscaler"]["ipaddress"], e)) + (self.testdata["configurableData"]["netscaler"]["ipaddress"], e)) self.debug( "Updating LB rule: %s with new algorithm: %s" % ( @@ -1406,13 +1273,13 @@ class TestLbAlgoRrSb(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -1430,7 +1297,7 @@ class TestLbAlgoRrSb(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 @@ -1442,30 +1309,28 @@ class TestLbAlgoSbRr(cloudstackTestCase): cls.testClient = super(TestLbAlgoSbRr, 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 + # 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.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.testdata["configurableData"]["netscaler"]) cls._cleanup.append(cls.netscaler) cls.network_offering = NetworkOffering.create( cls.api_client, - cls.services["network_offering"], - conservemode=True + cls.testdata["nw_off_isolated_netscaler"], + conservemode="True" ) cls._cleanup.append(cls.network_offering) # Enable Network offering @@ -1473,32 +1338,32 @@ class TestLbAlgoSbRr(cloudstackTestCase): cls.account = Account.create( cls.api_client, - cls.services["account"], + cls.testdata["account"], admin=True, domainid=cls.domain.id ) cls._cleanup.insert(0, cls.account) 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, zoneid=cls.zone.id ) - 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._cleanup.append(cls.service_offering) # 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, @@ -1537,7 +1402,6 @@ class TestLbAlgoSbRr(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 @@ -1561,10 +1425,10 @@ class TestLbAlgoSbRr(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 @@ -1591,13 +1455,13 @@ class TestLbAlgoSbRr(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -1615,7 +1479,7 @@ class TestLbAlgoSbRr(cloudstackTestCase): except Exception as e: self.fail("SSH Access failed for %s: %s" % - (self.services["netscaler"]["ipaddress"], e)) + (self.testdata["configurableData"]["netscaler"]["ipaddress"], e)) self.debug( "Updating LB rule: %s with new algorithm: %s" % ( @@ -1626,13 +1490,13 @@ class TestLbAlgoSbRr(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -1649,7 +1513,7 @@ class TestLbAlgoSbRr(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 @@ -1661,30 +1525,26 @@ class TestLbAlgoSbLc(cloudstackTestCase): cls.testClient = super(TestLbAlgoSbLc, 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.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.testdata["configurableData"]["netscaler"]) cls._cleanup.append(cls.netscaler) cls.network_offering = NetworkOffering.create( cls.api_client, - cls.services["network_offering"], - conservemode=True + cls.testdata["nw_off_isolated_netscaler"], + conservemode="True" ) cls._cleanup.append(cls.network_offering) # Enable Network offering @@ -1692,32 +1552,32 @@ class TestLbAlgoSbLc(cloudstackTestCase): cls.account = Account.create( cls.api_client, - cls.services["account"], + cls.testdata["account"], admin=True, domainid=cls.domain.id ) cls._cleanup.insert(0, cls.account) 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, zoneid=cls.zone.id ) - 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._cleanup.append(cls.service_offering) # 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, @@ -1756,7 +1616,6 @@ class TestLbAlgoSbLc(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 @@ -1780,10 +1639,10 @@ class TestLbAlgoSbLc(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 @@ -1810,13 +1669,13 @@ class TestLbAlgoSbLc(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -1834,7 +1693,7 @@ class TestLbAlgoSbLc(cloudstackTestCase): except Exception as e: self.fail("SSH Access failed for %s: %s" % - (self.services["netscaler"]["ipaddress"], e)) + (self.testdata["configurableData"]["netscaler"]["ipaddress"], e)) self.debug( "Updating LB rule: %s with new algorithm: %s" % ( lb_rule.name, @@ -1844,13 +1703,13 @@ class TestLbAlgoSbLc(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -1867,7 +1726,7 @@ class TestLbAlgoSbLc(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 @@ -1879,30 +1738,28 @@ class TestLbAlgoLcSb(cloudstackTestCase): cls.testClient = super(TestLbAlgoLcSb, 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 + # 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.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.testdata["configurableData"]["netscaler"]) cls._cleanup.append(cls.netscaler) cls.network_offering = NetworkOffering.create( cls.api_client, - cls.services["network_offering"], - conservemode=True + cls.testdata["nw_off_isolated_netscaler"], + conservemode="True" ) cls._cleanup.append(cls.network_offering) # Enable Network offering @@ -1910,32 +1767,32 @@ class TestLbAlgoLcSb(cloudstackTestCase): cls.account = Account.create( cls.api_client, - cls.services["account"], + cls.testdata["account"], admin=True, domainid=cls.domain.id ) cls._cleanup.insert(0, cls.account) 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, zoneid=cls.zone.id ) - 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._cleanup.append(cls.service_offering) # 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, @@ -1973,7 +1830,6 @@ class TestLbAlgoLcSb(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 @@ -1997,10 +1853,10 @@ class TestLbAlgoLcSb(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 @@ -2026,13 +1882,13 @@ class TestLbAlgoLcSb(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -2049,7 +1905,7 @@ class TestLbAlgoLcSb(cloudstackTestCase): ) except Exception as e: self.fail("SSH Access failed for %s: %s" % - (self.services["netscaler"]["ipaddress"], e)) + (self.testdata["configurableData"]["netscaler"]["ipaddress"], e)) self.debug( "Updating LB rule: %s with new algorithm: %s" % ( @@ -2060,13 +1916,13 @@ class TestLbAlgoLcSb(cloudstackTestCase): self.debug( "SSH into Netscaler to check whether algorithm is 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, @@ -2084,5 +1940,5 @@ class TestLbAlgoLcSb(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