You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cloudstack.apache.org by ta...@apache.org on 2014/11/17 11:00:44 UTC
[2/5] git commit: updated refs/heads/master to 91ffaaa
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91ffaaa5/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 c333f60..a5f55a8 100644
--- a/test/integration/component/test_netscaler_lb_sticky.py
+++ b/test/integration/component/test_netscaler_lb_sticky.py
@@ -17,99 +17,95 @@
""" P1 tests for netscaler load balancing sticky policy
"""
-#Import Local Modules
-import marvin
+# Import Local Modules
from nose.plugins.attrib import attr
-from marvin.cloudstackTestCase import *
-from marvin.cloudstackAPI import *
-from marvin.lib.utils import *
-from marvin.lib.base import *
-from marvin.lib.common import *
+from marvin.cloudstackTestCase import cloudstackTestCase
+from marvin.lib.utils import cleanup_resources
+from marvin.lib.base import (Account,
+ LoadBalancerRule,
+ PublicIPAddress,
+ Network,
+ NetworkOffering,
+ ServiceOffering,
+ VirtualMachine)
+from marvin.lib.common import (get_domain,
+ get_zone,
+ get_template,
+ add_netscaler,
+ GetNetscalerInfoFromConfig)
from marvin.sshClient import SshClient
-import datetime
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',
- },
- "netscaler": {
- "ipaddress": '10.147.60.27',
- "username": 'nsroot',
- "password": 'nsroot',
- "networkdevicetype": 'NetscalerVPXLoadBalancer',
- "publicinterface": '1/1',
- "privateinterface": '1/1',
- "numretries": 2,
- "lbdevicededicated": False,
- "lbdevicecapacity": 50,
- "port": 22,
- },
- "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'
- }
+ "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):
@@ -125,69 +121,80 @@ class TestLbStickyPolicy(cloudstackTestCase):
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.api_client,
+ cls.zone.id,
+ cls.services["ostype"]
+ )
+
+ response = GetNetscalerInfoFromConfig(
+ cls.config
+ )
+ assert response[0] is not None, response[1]
+ cls.services["netscaler"] = response[0]
+ cls.services["netscaler"]["lbdevicededicated"] = False
+
try:
- cls.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.services["netscaler"])
- cls._cleanup.append(cls.netscaler)
- cls.network_offering = NetworkOffering.create(
- cls.api_client,
- cls.services["network_offering"],
- 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.service_offering = ServiceOffering.create(
- cls.api_client,
- cls.services["service_offering"]
- )
- cls.account = Account.create(
- cls.api_client,
- cls.services["account"],
- admin=True,
- domainid=cls.domain.id
- )
- cls._cleanup.insert(0,cls.account)
- # Creating network using the network offering created
- cls.network = Network.create(
- cls.api_client,
- cls.services["network"],
- accountid=cls.account.name,
- domainid=cls.account.domainid,
- networkofferingid=cls.network_offering.id,
- zoneid=cls.zone.id
- )
-
- # Spawn an instance in that network
- cls.virtual_machine = VirtualMachine.create(
- cls.api_client,
- cls.services["virtual_machine"],
- accountid=cls.account.name,
- domainid=cls.account.domainid,
- serviceofferingid=cls.service_offering.id,
- networkids=[str(cls.network.id)]
- )
- cls.public_ip = PublicIPAddress.create(
- cls.api_client,
- accountid=cls.account.name,
- zoneid=cls.zone.id,
- domainid=cls.account.domainid,
- networkid=cls.network.id
- )
+ cls.netscaler = add_netscaler(
+ cls.api_client,
+ cls.zone.id,
+ cls.services["netscaler"])
+ cls._cleanup.append(cls.netscaler)
+ cls.network_offering = NetworkOffering.create(
+ cls.api_client,
+ cls.services["network_offering"],
+ 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.service_offering = ServiceOffering.create(
+ cls.api_client,
+ cls.services["service_offering"]
+ )
+ cls.account = Account.create(
+ cls.api_client,
+ cls.services["account"],
+ admin=True,
+ domainid=cls.domain.id
+ )
+ cls._cleanup.insert(0, cls.account)
+ # Creating network using the network offering created
+ cls.network = Network.create(
+ cls.api_client,
+ cls.services["network"],
+ accountid=cls.account.name,
+ domainid=cls.account.domainid,
+ networkofferingid=cls.network_offering.id,
+ zoneid=cls.zone.id
+ )
+
+ # Spawn an instance in that network
+ cls.virtual_machine = VirtualMachine.create(
+ cls.api_client,
+ cls.services["virtual_machine"],
+ accountid=cls.account.name,
+ domainid=cls.account.domainid,
+ serviceofferingid=cls.service_offering.id,
+ networkids=[str(cls.network.id)]
+ )
+ cls.public_ip = PublicIPAddress.create(
+ cls.api_client,
+ accountid=cls.account.name,
+ zoneid=cls.zone.id,
+ domainid=cls.account.domainid,
+ networkid=cls.network.id
+ )
except Exception as e:
- cls.tearDownClass()
- raise Exception ("Warning: Exception in setUpClass: %s" % e)
+ cls.tearDownClass()
+ raise Exception("Warning: Exception in setUpClass: %s" % e)
return
@classmethod
def tearDownClass(cls):
try:
- #Cleanup resources used
+ # Cleanup resources used
cleanup_resources(cls.api_client, cls._cleanup)
except Exception as e:
raise Exception("Warning: Exception during cleanup : %s" % e)
@@ -202,16 +209,17 @@ class TestLbStickyPolicy(cloudstackTestCase):
def tearDown(self):
try:
self.debug("Cleaning up the resources")
- #Clean up, terminate the created network offerings
+ # 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
- @attr(tags = ["advancedns"])
+ @attr(tags=["advancedns"])
def test_01_source_based_roundrobin(self):
- """Test Create a "SourceBased" stick policy for a Lb rule with "RoundRobin" algorithm
+ """Test Create a "SourceBased" stick policy for a Lb rule with
+ "RoundRobin" algorithm
"""
# Validate the following
@@ -226,80 +234,83 @@ class TestLbStickyPolicy(cloudstackTestCase):
self.debug(
"Creating LB rule for IP address: %s with round robin algo" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
lb_rule = LoadBalancerRule.create(
- self.apiclient,
- self.services["lbrule"],
- ipaddressid=self.public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=self.network.id
- )
+ self.apiclient,
+ self.services["lbrule"],
+ ipaddressid=self.public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=self.network.id
+ )
self.cleanup.append(lb_rule)
self.debug("Created the load balancing rule for public IP: %s" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.debug("Assigning VM instance: %s to LB rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
lb_rule.assign(self.apiclient, [self.virtual_machine])
self.debug("Assigned VM instance: %s to lb rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
self.debug(
"Configuring 'SourceBased' Sticky policy on lb rule: %s" %
- lb_rule.name)
+ lb_rule.name)
try:
result = lb_rule.createSticky(
- self.apiclient,
- methodname='SourceBased',
- name='SourceBasedRR',
- param={"holdtime": 20}
- )
+ self.apiclient,
+ methodname='SourceBased',
+ name='SourceBasedRR',
+ param={"holdtime": 20}
+ )
self.debug("Response: %s" % result)
except Exception as e:
self.fail("Configure sticky policy failed with exception: %s" % e)
- self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+ self.debug(
+ "SSH into Netscaler to check whether sticky policy configured\
+ properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.services["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
- )
+ self.services["netscaler"]["ipaddress"],
+ self.services["netscaler"]["port"],
+ self.services["netscaler"]["username"],
+ self.services["netscaler"]["password"],
+ )
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
- self.public_ip.ipaddress.ipaddress,
- lb_rule.publicport)
+ self.public_ip.ipaddress.ipaddress,
+ lb_rule.publicport)
self.debug("command: %s" % cmd)
res = ssh_client.execute(cmd)
result = str(res)
self.debug("Output: %s" % result)
self.assertEqual(
- result.count("Persistence: SOURCEIP"),
- 1,
- "'SourceBased' sticky policy should be configured on NS"
- )
+ result.count("Persistence: SOURCEIP"),
+ 1,
+ "'SourceBased' sticky policy should be configured on NS"
+ )
self.assertEqual(
- result.count("Configured Method: ROUNDROBIN"),
- 1,
- "'ROUNDROBIN' algorithm should be configured on NS"
- )
+ result.count("Configured Method: ROUNDROBIN"),
+ 1,
+ "'ROUNDROBIN' algorithm should be configured on NS"
+ )
except Exception as e:
- self.fail("SSH Access failed for %s: %s" % \
+ self.fail("SSH Access failed for %s: %s" %
(self.services["netscaler"]["ipaddress"], e))
return
- @attr(tags = ["advancedns"])
+ @attr(tags=["advancedns"])
def test_02_source_based_source_algo(self):
- """Test Create a "SourceBased" stick policy for a Lb rule with "Source" algorithm
+ """Test Create a "SourceBased" stick policy for a Lb rule
+ with "Source" algorithm
"""
# Validate the following
@@ -314,79 +325,81 @@ class TestLbStickyPolicy(cloudstackTestCase):
self.debug(
"Creating LB rule for IP address: %s with source algo" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.services["lbrule"]["alg"] = 'source'
lb_rule = LoadBalancerRule.create(
- self.apiclient,
- self.services["lbrule"],
- ipaddressid=self.public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=self.network.id
- )
+ self.apiclient,
+ self.services["lbrule"],
+ ipaddressid=self.public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=self.network.id
+ )
self.cleanup.append(lb_rule)
self.debug("Created the load balancing rule for public IP: %s" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.debug("Assigning VM instance: %s to LB rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
lb_rule.assign(self.apiclient, [self.virtual_machine])
self.debug("Assigned VM instance: %s to lb rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
self.debug(
"Configuring 'SourceBased' Sticky policy on lb rule: %s" %
- lb_rule.name)
+ lb_rule.name)
try:
result = lb_rule.createSticky(
- self.apiclient,
- methodname='SourceBased',
- name='SourceBasedSource',
- param={"holdtime": 20}
- )
+ self.apiclient,
+ methodname='SourceBased',
+ name='SourceBasedSource',
+ param={"holdtime": 20}
+ )
self.debug("Response: %s" % result)
except Exception as e:
self.fail("Configure sticky policy failed with exception: %s" % e)
- self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+ self.debug(
+ "SSH into Netscaler to check whether sticky policy\
+ configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.services["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
- )
+ self.services["netscaler"]["ipaddress"],
+ self.services["netscaler"]["port"],
+ self.services["netscaler"]["username"],
+ self.services["netscaler"]["password"],
+ )
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
- self.public_ip.ipaddress.ipaddress,
- lb_rule.publicport)
+ self.public_ip.ipaddress.ipaddress,
+ lb_rule.publicport)
self.debug("command: %s" % cmd)
res = ssh_client.execute(cmd)
result = str(res)
self.debug("Output: %s" % result)
self.assertEqual(
- result.count("Persistence: SOURCEIP"),
- 1,
- "'SourceBased' sticky policy should be configured on NS"
- )
+ result.count("Persistence: SOURCEIP"),
+ 1,
+ "'SourceBased' sticky policy should be configured on NS"
+ )
self.assertEqual(
- result.count("Configured Method: SOURCEIPHASH"),
- 1,
- "'SOURCE' algorithm should be configured on NS"
- )
+ result.count("Configured Method: SOURCEIPHASH"),
+ 1,
+ "'SOURCE' algorithm should be configured on NS"
+ )
except Exception as e:
- self.fail("SSH Access failed for %s: %s" % \
+ self.fail("SSH Access failed for %s: %s" %
(self.services["netscaler"]["ipaddress"], e))
return
- @attr(tags = ["advancedns"])
+ @attr(tags=["advancedns"])
def test_03_source_based_leastconn(self):
"""Test Create a "SourceBased" stick policy for a Lb rule with leastconn algo
"""
@@ -403,79 +416,81 @@ class TestLbStickyPolicy(cloudstackTestCase):
self.debug(
"Creating LB rule for IP address: %s with leastconn algo" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.services["lbrule"]["alg"] = 'leastconn'
lb_rule = LoadBalancerRule.create(
- self.apiclient,
- self.services["lbrule"],
- ipaddressid=self.public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=self.network.id
- )
+ self.apiclient,
+ self.services["lbrule"],
+ ipaddressid=self.public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=self.network.id
+ )
self.cleanup.append(lb_rule)
self.debug("Created the load balancing rule for public IP: %s" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.debug("Assigning VM instance: %s to LB rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
lb_rule.assign(self.apiclient, [self.virtual_machine])
self.debug("Assigned VM instance: %s to lb rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
self.debug(
"Configuring 'SourceBased' Sticky policy on lb rule: %s" %
- lb_rule.name)
+ lb_rule.name)
try:
result = lb_rule.createSticky(
- self.apiclient,
- methodname='SourceBased',
- name='SourceBasedLeast',
- param={"holdtime": 20}
- )
+ self.apiclient,
+ methodname='SourceBased',
+ name='SourceBasedLeast',
+ param={"holdtime": 20}
+ )
self.debug("Response: %s" % result)
except Exception as e:
self.fail("Configure sticky policy failed with exception: %s" % e)
- self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+ self.debug(
+ "SSH into Netscaler to check whether sticky policy configured\
+ properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.services["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
- )
+ self.services["netscaler"]["ipaddress"],
+ self.services["netscaler"]["port"],
+ self.services["netscaler"]["username"],
+ self.services["netscaler"]["password"],
+ )
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
- self.public_ip.ipaddress.ipaddress,
- lb_rule.publicport)
+ self.public_ip.ipaddress.ipaddress,
+ lb_rule.publicport)
self.debug("command: %s" % cmd)
res = ssh_client.execute(cmd)
result = str(res)
self.debug("Output: %s" % result)
self.assertEqual(
- result.count("Persistence: SOURCEIP"),
- 1,
- "'SourceBased' sticky policy should be configured on NS"
- )
+ result.count("Persistence: SOURCEIP"),
+ 1,
+ "'SourceBased' sticky policy should be configured on NS"
+ )
self.assertEqual(
- result.count("Configured Method: LEASTCONNECTION"),
- 1,
- "'leastconn' algorithm should be configured on NS"
- )
+ result.count("Configured Method: LEASTCONNECTION"),
+ 1,
+ "'leastconn' algorithm should be configured on NS"
+ )
except Exception as e:
- self.fail("SSH Access failed for %s: %s" % \
+ self.fail("SSH Access failed for %s: %s" %
(self.services["netscaler"]["ipaddress"], e))
return
- @attr(tags = ["advancedns"])
+ @attr(tags=["advancedns"])
def test_04_lbcookie_based_roundrobin(self):
"""Test Create a "LBCookie" stick policy for a Lb rule with roundrobin algo
"""
@@ -492,81 +507,83 @@ class TestLbStickyPolicy(cloudstackTestCase):
self.debug(
"Creating LB rule for IP address: %s with roundrobin algo" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.services["lbrule"]["alg"] = 'roundrobin'
self.services["lbrule"]["publicport"] = 80
self.services["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
- self.apiclient,
- self.services["lbrule"],
- ipaddressid=self.public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=self.network.id
- )
+ self.apiclient,
+ self.services["lbrule"],
+ ipaddressid=self.public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=self.network.id
+ )
self.cleanup.append(lb_rule)
self.debug("Created the load balancing rule for public IP: %s" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.debug("Assigning VM instance: %s to LB rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
lb_rule.assign(self.apiclient, [self.virtual_machine])
self.debug("Assigned VM instance: %s to lb rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
self.debug(
"Configuring 'SourceBased' Sticky policy on lb rule: %s" %
- lb_rule.name)
+ lb_rule.name)
try:
result = lb_rule.createSticky(
- self.apiclient,
- methodname='LbCookie',
- name='LbCookieRR',
- param={"holdtime": 20}
- )
+ self.apiclient,
+ methodname='LbCookie',
+ name='LbCookieRR',
+ param={"holdtime": 20}
+ )
self.debug("Response: %s" % result)
except Exception as e:
self.fail("Configure sticky policy failed with exception: %s" % e)
- self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+ self.debug(
+ "SSH into Netscaler to check whether sticky policy\
+ configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.services["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
- )
+ self.services["netscaler"]["ipaddress"],
+ self.services["netscaler"]["port"],
+ self.services["netscaler"]["username"],
+ self.services["netscaler"]["password"],
+ )
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
- self.public_ip.ipaddress.ipaddress,
- lb_rule.publicport)
+ self.public_ip.ipaddress.ipaddress,
+ lb_rule.publicport)
self.debug("command: %s" % cmd)
res = ssh_client.execute(cmd)
result = str(res)
self.debug("Output: %s" % result)
self.assertEqual(
- result.count("Persistence: COOKIEINSERT"),
- 1,
- "'LBCookie' sticky policy should be configured on NS"
- )
+ result.count("Persistence: COOKIEINSERT"),
+ 1,
+ "'LBCookie' sticky policy should be configured on NS"
+ )
self.assertEqual(
- result.count("Configured Method: ROUNDROBIN"),
- 1,
- "'ROUNDROBIN' algorithm should be configured on NS"
- )
+ result.count("Configured Method: ROUNDROBIN"),
+ 1,
+ "'ROUNDROBIN' algorithm should be configured on NS"
+ )
except Exception as e:
- self.fail("SSH Access failed for %s: %s" % \
+ self.fail("SSH Access failed for %s: %s" %
(self.services["netscaler"]["ipaddress"], e))
return
- @attr(tags = ["advancedns"])
+ @attr(tags=["advancedns"])
def test_05_lbcookie_source_algo(self):
"""Test Create a "LBCookie" stick policy for a Lb rule with "Source" algorithm
"""
@@ -583,81 +600,83 @@ class TestLbStickyPolicy(cloudstackTestCase):
self.debug(
"Creating LB rule for IP address: %s with source algo" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.services["lbrule"]["alg"] = 'source'
self.services["lbrule"]["publicport"] = 80
self.services["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
- self.apiclient,
- self.services["lbrule"],
- ipaddressid=self.public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=self.network.id
- )
+ self.apiclient,
+ self.services["lbrule"],
+ ipaddressid=self.public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=self.network.id
+ )
self.cleanup.append(lb_rule)
self.debug("Created the load balancing rule for public IP: %s" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.debug("Assigning VM instance: %s to LB rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
lb_rule.assign(self.apiclient, [self.virtual_machine])
self.debug("Assigned VM instance: %s to lb rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
self.debug(
"Configuring 'SourceBased' Sticky policy on lb rule: %s" %
- lb_rule.name)
+ lb_rule.name)
try:
result = lb_rule.createSticky(
- self.apiclient,
- methodname='LbCookie',
- name='LbCookieSource',
- param={"holdtime": 20}
- )
+ self.apiclient,
+ methodname='LbCookie',
+ name='LbCookieSource',
+ param={"holdtime": 20}
+ )
self.debug("Response: %s" % result)
except Exception as e:
self.fail("Configure sticky policy failed with exception: %s" % e)
- self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+ self.debug(
+ "SSH into Netscaler to check whether sticky policy\
+ configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.services["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
- )
+ self.services["netscaler"]["ipaddress"],
+ self.services["netscaler"]["port"],
+ self.services["netscaler"]["username"],
+ self.services["netscaler"]["password"],
+ )
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
- self.public_ip.ipaddress.ipaddress,
- lb_rule.publicport)
+ self.public_ip.ipaddress.ipaddress,
+ lb_rule.publicport)
self.debug("command: %s" % cmd)
res = ssh_client.execute(cmd)
result = str(res)
self.debug("Output: %s" % result)
self.assertEqual(
- result.count("Persistence: COOKIEINSERT"),
- 1,
- "'LbCookie' sticky policy should be configured on NS"
- )
+ result.count("Persistence: COOKIEINSERT"),
+ 1,
+ "'LbCookie' sticky policy should be configured on NS"
+ )
self.assertEqual(
- result.count("Configured Method: SOURCEIPHASH"),
- 1,
- "'SOURCE' algorithm should be configured on NS"
- )
+ result.count("Configured Method: SOURCEIPHASH"),
+ 1,
+ "'SOURCE' algorithm should be configured on NS"
+ )
except Exception as e:
- self.fail("SSH Access failed for %s: %s" % \
+ self.fail("SSH Access failed for %s: %s" %
(self.services["netscaler"]["ipaddress"], e))
return
- @attr(tags = ["advancedns"])
+ @attr(tags=["advancedns"])
def test_06_lbcookie_leastconn(self):
"""Test Create a "LBCookie" stick policy for a Lb rule with leastconn algo
"""
@@ -674,81 +693,83 @@ class TestLbStickyPolicy(cloudstackTestCase):
self.debug(
"Creating LB rule for IP address: %s with leastconn algo" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.services["lbrule"]["alg"] = 'leastconn'
self.services["lbrule"]["publicport"] = 80
self.services["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
- self.apiclient,
- self.services["lbrule"],
- ipaddressid=self.public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=self.network.id
- )
+ self.apiclient,
+ self.services["lbrule"],
+ ipaddressid=self.public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=self.network.id
+ )
self.cleanup.append(lb_rule)
self.debug("Created the load balancing rule for public IP: %s" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.debug("Assigning VM instance: %s to LB rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
lb_rule.assign(self.apiclient, [self.virtual_machine])
self.debug("Assigned VM instance: %s to lb rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
self.debug(
"Configuring 'SourceBased' Sticky policy on lb rule: %s" %
- lb_rule.name)
+ lb_rule.name)
try:
result = lb_rule.createSticky(
- self.apiclient,
- methodname='LBCookie',
- name='LbcookieLeastConn',
- param={"holdtime": 20}
- )
+ self.apiclient,
+ methodname='LBCookie',
+ name='LbcookieLeastConn',
+ param={"holdtime": 20}
+ )
self.debug("Response: %s" % result)
except Exception as e:
self.fail("Configure sticky policy failed with exception: %s" % e)
- self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+ self.debug(
+ "SSH into Netscaler to check whether sticky policy\
+ configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.services["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
- )
+ self.services["netscaler"]["ipaddress"],
+ self.services["netscaler"]["port"],
+ self.services["netscaler"]["username"],
+ self.services["netscaler"]["password"],
+ )
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
- self.public_ip.ipaddress.ipaddress,
- lb_rule.publicport)
+ self.public_ip.ipaddress.ipaddress,
+ lb_rule.publicport)
self.debug("command: %s" % cmd)
res = ssh_client.execute(cmd)
result = str(res)
self.debug("Output: %s" % result)
self.assertEqual(
- result.count("Persistence: COOKIEINSERT"),
- 1,
- "'LbCookie' sticky policy should be configured on NS"
- )
+ result.count("Persistence: COOKIEINSERT"),
+ 1,
+ "'LbCookie' sticky policy should be configured on NS"
+ )
self.assertEqual(
- result.count("Configured Method: LEASTCONNECTION"),
- 1,
- "'leastconn' algorithm should be configured on NS"
- )
+ result.count("Configured Method: LEASTCONNECTION"),
+ 1,
+ "'leastconn' algorithm should be configured on NS"
+ )
except Exception as e:
- self.fail("SSH Access failed for %s: %s" % \
+ self.fail("SSH Access failed for %s: %s" %
(self.services["netscaler"]["ipaddress"], e))
return
- @attr(tags = ["advancedns"])
+ @attr(tags=["advancedns"])
def test_07_appcookie_based_roundrobin(self):
"""Test Create a "AppCookie" stick policy for a Lb rule with roundrobin algo
"""
@@ -765,81 +786,83 @@ class TestLbStickyPolicy(cloudstackTestCase):
self.debug(
"Creating LB rule for IP address: %s with roundrobin algo" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.services["lbrule"]["alg"] = 'roundrobin'
self.services["lbrule"]["publicport"] = 80
self.services["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
- self.apiclient,
- self.services["lbrule"],
- ipaddressid=self.public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=self.network.id
- )
+ self.apiclient,
+ self.services["lbrule"],
+ ipaddressid=self.public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=self.network.id
+ )
self.cleanup.append(lb_rule)
self.debug("Created the load balancing rule for public IP: %s" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.debug("Assigning VM instance: %s to LB rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
lb_rule.assign(self.apiclient, [self.virtual_machine])
self.debug("Assigned VM instance: %s to lb rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
self.debug(
"Configuring 'SourceBased' Sticky policy on lb rule: %s" %
- lb_rule.name)
+ lb_rule.name)
try:
result = lb_rule.createSticky(
- self.apiclient,
- methodname='AppCookie',
- name='AppCookieRR',
- param={"name": 20}
- )
+ self.apiclient,
+ methodname='AppCookie',
+ name='AppCookieRR',
+ param={"name": 20}
+ )
self.debug("Response: %s" % result)
except Exception as e:
self.fail("Configure sticky policy failed with exception: %s" % e)
- self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+ self.debug(
+ "SSH into Netscaler to check whether sticky policy\
+ configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.services["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
- )
+ self.services["netscaler"]["ipaddress"],
+ self.services["netscaler"]["port"],
+ self.services["netscaler"]["username"],
+ self.services["netscaler"]["password"],
+ )
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
- self.public_ip.ipaddress.ipaddress,
- lb_rule.publicport)
+ self.public_ip.ipaddress.ipaddress,
+ lb_rule.publicport)
self.debug("command: %s" % cmd)
res = ssh_client.execute(cmd)
result = str(res)
self.debug("Output: %s" % result)
self.assertEqual(
- result.count("Persistence: RULE"),
- 1,
- "'AppCookie' sticky policy should be configured on NS"
- )
+ result.count("Persistence: RULE"),
+ 1,
+ "'AppCookie' sticky policy should be configured on NS"
+ )
self.assertEqual(
- result.count("Configured Method: ROUNDROBIN"),
- 1,
- "'ROUNDROBIN' algorithm should be configured on NS"
- )
+ result.count("Configured Method: ROUNDROBIN"),
+ 1,
+ "'ROUNDROBIN' algorithm should be configured on NS"
+ )
except Exception as e:
- self.fail("SSH Access failed for %s: %s" % \
+ self.fail("SSH Access failed for %s: %s" %
(self.services["netscaler"]["ipaddress"], e))
return
- @attr(tags = ["advancedns"])
+ @attr(tags=["advancedns"])
def test_08_appcookie_source_algo(self):
"""Test Create a "AppCookie" stick policy for a Lb rule with "Source"
"""
@@ -856,81 +879,83 @@ class TestLbStickyPolicy(cloudstackTestCase):
self.debug(
"Creating LB rule for IP address: %s with source algo" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.services["lbrule"]["alg"] = 'source'
self.services["lbrule"]["publicport"] = 80
self.services["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
- self.apiclient,
- self.services["lbrule"],
- ipaddressid=self.public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=self.network.id
- )
+ self.apiclient,
+ self.services["lbrule"],
+ ipaddressid=self.public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=self.network.id
+ )
self.cleanup.append(lb_rule)
self.debug("Created the load balancing rule for public IP: %s" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.debug("Assigning VM instance: %s to LB rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
lb_rule.assign(self.apiclient, [self.virtual_machine])
self.debug("Assigned VM instance: %s to lb rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
self.debug(
"Configuring 'SourceBased' Sticky policy on lb rule: %s" %
- lb_rule.name)
+ lb_rule.name)
try:
result = lb_rule.createSticky(
- self.apiclient,
- methodname='AppCookie',
- name='AppCookieSource',
- param={"name": 20}
- )
+ self.apiclient,
+ methodname='AppCookie',
+ name='AppCookieSource',
+ param={"name": 20}
+ )
self.debug("Response: %s" % result)
except Exception as e:
self.fail("Configure sticky policy failed with exception: %s" % e)
- self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+ self.debug(
+ "SSH into Netscaler to check whether sticky policy\
+ configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.services["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
- )
+ self.services["netscaler"]["ipaddress"],
+ self.services["netscaler"]["port"],
+ self.services["netscaler"]["username"],
+ self.services["netscaler"]["password"],
+ )
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
- self.public_ip.ipaddress.ipaddress,
- lb_rule.publicport)
+ self.public_ip.ipaddress.ipaddress,
+ lb_rule.publicport)
self.debug("command: %s" % cmd)
res = ssh_client.execute(cmd)
result = str(res)
self.debug("Output: %s" % result)
self.assertEqual(
- result.count("Persistence: RULE"),
- 1,
- "'AppCookie' sticky policy should be configured on NS"
- )
+ result.count("Persistence: RULE"),
+ 1,
+ "'AppCookie' sticky policy should be configured on NS"
+ )
self.assertEqual(
- result.count("Configured Method: SOURCEIPHASH"),
- 1,
- "'SOURCE' algorithm should be configured on NS"
- )
+ result.count("Configured Method: SOURCEIPHASH"),
+ 1,
+ "'SOURCE' algorithm should be configured on NS"
+ )
except Exception as e:
- self.fail("SSH Access failed for %s: %s" % \
+ self.fail("SSH Access failed for %s: %s" %
(self.services["netscaler"]["ipaddress"], e))
return
- @attr(tags = ["advancedns"])
+ @attr(tags=["advancedns"])
def test_09_appcookie_leastconn(self):
"""Test Create a "AppCookie" stick policy for a Lb rule with leastconn
"""
@@ -947,76 +972,78 @@ class TestLbStickyPolicy(cloudstackTestCase):
self.debug(
"Creating LB rule for IP address: %s with leastconn algo" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.services["lbrule"]["alg"] = 'leastconn'
self.services["lbrule"]["publicport"] = 80
self.services["lbrule"]["privateport"] = 80
lb_rule = LoadBalancerRule.create(
- self.apiclient,
- self.services["lbrule"],
- ipaddressid=self.public_ip.ipaddress.id,
- accountid=self.account.name,
- networkid=self.network.id
- )
+ self.apiclient,
+ self.services["lbrule"],
+ ipaddressid=self.public_ip.ipaddress.id,
+ accountid=self.account.name,
+ networkid=self.network.id
+ )
self.cleanup.append(lb_rule)
self.debug("Created the load balancing rule for public IP: %s" %
- self.public_ip.ipaddress.ipaddress)
+ self.public_ip.ipaddress.ipaddress)
self.debug("Assigning VM instance: %s to LB rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
lb_rule.assign(self.apiclient, [self.virtual_machine])
self.debug("Assigned VM instance: %s to lb rule: %s" % (
- self.virtual_machine.name,
- lb_rule.name
- ))
+ self.virtual_machine.name,
+ lb_rule.name
+ ))
self.debug(
"Configuring 'SourceBased' Sticky policy on lb rule: %s" %
- lb_rule.name)
+ lb_rule.name)
try:
result = lb_rule.createSticky(
- self.apiclient,
- methodname='AppCookie',
- name='AppCookieLeastConn',
- param={"name": 20}
- )
+ self.apiclient,
+ methodname='AppCookie',
+ name='AppCookieLeastConn',
+ param={"name": 20}
+ )
self.debug("Response: %s" % result)
except Exception as e:
self.fail("Configure sticky policy failed with exception: %s" % e)
- self.debug("SSH into Netscaler to check whether sticky policy configured properly or not?")
+ self.debug(
+ "SSH into Netscaler to check whether sticky policy\
+ configured properly or not?")
self.debug("SSH into netscaler: %s" %
- self.services["netscaler"]["ipaddress"])
+ self.services["netscaler"]["ipaddress"])
try:
ssh_client = SshClient(
- self.services["netscaler"]["ipaddress"],
- self.services["netscaler"]["port"],
- self.services["netscaler"]["username"],
- self.services["netscaler"]["password"],
- )
+ self.services["netscaler"]["ipaddress"],
+ self.services["netscaler"]["port"],
+ self.services["netscaler"]["username"],
+ self.services["netscaler"]["password"],
+ )
cmd = "show lb vserver Cloud-VirtualServer-%s-%s" % (
- self.public_ip.ipaddress.ipaddress,
- lb_rule.publicport)
+ self.public_ip.ipaddress.ipaddress,
+ lb_rule.publicport)
self.debug("command: %s" % cmd)
res = ssh_client.execute(cmd)
result = str(res)
self.debug("Output: %s" % result)
self.assertEqual(
- result.count("Persistence: RULE"),
- 1,
- "'AppCookie' sticky policy should be configured on NS"
- )
+ result.count("Persistence: RULE"),
+ 1,
+ "'AppCookie' sticky policy should be configured on NS"
+ )
self.assertEqual(
- result.count("Configured Method: LEASTCONNECTION"),
- 1,
- "'leastconn' algorithm should be configured on NS"
- )
+ result.count("Configured Method: LEASTCONNECTION"),
+ 1,
+ "'leastconn' algorithm should be configured on NS"
+ )
except Exception as e:
- self.fail("SSH Access failed for %s: %s" % \
+ self.fail("SSH Access failed for %s: %s" %
(self.services["netscaler"]["ipaddress"], e))
return
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91ffaaa5/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 4cd0aa8..f782700 100644
--- a/test/integration/component/test_persistent_networks.py
+++ b/test/integration/component/test_persistent_networks.py
@@ -40,7 +40,8 @@ from marvin.lib.common import (get_domain,
get_template,
verifyNetworkState,
add_netscaler,
- wait_for_cleanup)
+ wait_for_cleanup,
+ GetNetscalerInfoFromConfig)
from nose.plugins.attrib import attr
from marvin.codes import PASS, FAIL, FAILED
from marvin.sshClient import SshClient
@@ -97,6 +98,13 @@ 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
+
# Configure Netscaler device
# If configuration succeeds, set ns_configured to True so that
# Netscaler tests are executed
@@ -105,7 +113,7 @@ class TestPersistentNetworks(cloudstackTestCase):
cls.netscaler = add_netscaler(
cls.api_client,
cls.zone.id,
- cls.services["netscaler_VPX"])
+ cls.services["netscaler"])
cls._cleanup.append(cls.netscaler)
cls.ns_configured = True
except Exception:
@@ -1500,6 +1508,13 @@ 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
+
# Configure Netscaler device
# If configuration succeeds, set ns_configured to True so that
# Netscaler tests are executed
@@ -1508,7 +1523,7 @@ class TestAssignVirtualMachine(cloudstackTestCase):
cls.netscaler = add_netscaler(
cls.api_client,
cls.zone.id,
- cls.services["netscaler_VPX"])
+ cls.services["netscaler"])
cls._cleanup.append(cls.netscaler)
cls.ns_configured = True
except Exception:
@@ -1964,6 +1979,13 @@ 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
+
# Configure Netscaler device
# If configuration succeeds, set ns_configured to True so that
# Netscaler tests are executed
@@ -1972,7 +1994,7 @@ class TestRestartPersistentNetwork(cloudstackTestCase):
cls.netscaler = add_netscaler(
cls.api_client,
cls.zone.id,
- cls.services["netscaler_VPX"])
+ cls.services["netscaler"])
cls._cleanup.append(cls.netscaler)
cls.ns_configured = True
except Exception:
http://git-wip-us.apache.org/repos/asf/cloudstack/blob/91ffaaa5/tools/marvin/marvin/lib/common.py
----------------------------------------------------------------------
diff --git a/tools/marvin/marvin/lib/common.py b/tools/marvin/marvin/lib/common.py
index 9e3d40c..63662b9 100644
--- a/tools/marvin/marvin/lib/common.py
+++ b/tools/marvin/marvin/lib/common.py
@@ -1376,3 +1376,21 @@ 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]