mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-7912: Remove hardcoded netscaler info and read it from config file
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
parent
d8d60f0172
commit
91ffaaa5a2
@ -49,7 +49,8 @@ from marvin.lib.common import (get_domain,
|
|||||||
get_template,
|
get_template,
|
||||||
verifyNetworkState,
|
verifyNetworkState,
|
||||||
wait_for_cleanup,
|
wait_for_cleanup,
|
||||||
add_netscaler
|
add_netscaler,
|
||||||
|
GetNetscalerInfoFromConfig
|
||||||
)
|
)
|
||||||
|
|
||||||
from marvin.lib.utils import (validateList,
|
from marvin.lib.utils import (validateList,
|
||||||
@ -1775,11 +1776,18 @@ class TestExternalLoadBalancer(cloudstackTestCase):
|
|||||||
cls.testdata["virtual_machine"]["template"] = template.id
|
cls.testdata["virtual_machine"]["template"] = template.id
|
||||||
cls._cleanup = []
|
cls._cleanup = []
|
||||||
|
|
||||||
|
response = GetNetscalerInfoFromConfig(
|
||||||
|
cls.config
|
||||||
|
)
|
||||||
|
assert response[0] is not None, response[1]
|
||||||
|
cls.testdata["netscaler"] = response[0]
|
||||||
|
cls.testdata["netscaler"]["lbdevicededicated"] = False
|
||||||
|
|
||||||
try:
|
try:
|
||||||
cls.netscaler = add_netscaler(
|
cls.netscaler = add_netscaler(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.testdata["netscaler_VPX"])
|
cls.testdata["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise unittest.SkipTest("Failed to add netscaler device: %s" % e)
|
raise unittest.SkipTest("Failed to add netscaler device: %s" % e)
|
||||||
|
|||||||
@ -17,7 +17,7 @@
|
|||||||
|
|
||||||
""" P1 tests for netscaler load balancing
|
""" P1 tests for netscaler load balancing
|
||||||
"""
|
"""
|
||||||
#Import Local Modules
|
# Import Local Modules
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import cloudstackTestCase
|
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||||
from marvin.cloudstackAPI import migrateVirtualMachine
|
from marvin.cloudstackAPI import migrateVirtualMachine
|
||||||
@ -36,12 +36,14 @@ from marvin.lib.base import (Account,
|
|||||||
from marvin.lib.common import (get_domain,
|
from marvin.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
|
GetNetscalerInfoFromConfig,
|
||||||
add_netscaler)
|
add_netscaler)
|
||||||
from marvin.sshClient import SshClient
|
from marvin.sshClient import SshClient
|
||||||
import time
|
import time
|
||||||
|
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
|
|
||||||
"""Test netscaler services
|
"""Test netscaler services
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -73,18 +75,6 @@ class Services:
|
|||||||
"publicport": 22,
|
"publicport": 22,
|
||||||
"protocol": 'TCP',
|
"protocol": 'TCP',
|
||||||
},
|
},
|
||||||
"netscaler": {
|
|
||||||
"ipaddress": '10.147.40.100',
|
|
||||||
"username": 'nsroot',
|
|
||||||
"password": 'nsroot',
|
|
||||||
"networkdevicetype": 'NetscalerVPXLoadBalancer',
|
|
||||||
"publicinterface": '1/1',
|
|
||||||
"privateinterface": '1/1',
|
|
||||||
"numretries": 2,
|
|
||||||
"lbdevicededicated": False,
|
|
||||||
"lbdevicecapacity": 50,
|
|
||||||
"port": 22,
|
|
||||||
},
|
|
||||||
"network_offering_dedicated": {
|
"network_offering_dedicated": {
|
||||||
"name": 'Netscaler',
|
"name": 'Netscaler',
|
||||||
"displaytext": 'Netscaler',
|
"displaytext": 'Netscaler',
|
||||||
@ -157,6 +147,7 @@ class Services:
|
|||||||
"mode": 'advanced'
|
"mode": 'advanced'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
class TestLbSourceNat(cloudstackTestCase):
|
class TestLbSourceNat(cloudstackTestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -174,6 +165,14 @@ class TestLbSourceNat(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -192,13 +191,13 @@ class TestLbSourceNat(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -219,7 +218,7 @@ class TestLbSourceNat(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
interval = Configurations.list(
|
interval = Configurations.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -236,12 +235,11 @@ class TestLbSourceNat(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_add_lb_on_source_nat(self):
|
def test_add_lb_on_source_nat(self):
|
||||||
"""Test Create LB rule for sourceNat IP address
|
"""Test Create LB rule for sourceNat IP address
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Deploy the first VM using a network from the above created
|
# 1. Deploy the first VM using a network from the above created
|
||||||
# Network offering.
|
# Network offering.
|
||||||
@ -280,7 +278,7 @@ class TestLbSourceNat(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_1.id
|
% virtual_machine_1.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -316,7 +314,7 @@ class TestLbSourceNat(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_2.id
|
% virtual_machine_2.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -365,6 +363,7 @@ class TestLbSourceNat(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class TestLbOnIpWithPf(cloudstackTestCase):
|
class TestLbOnIpWithPf(cloudstackTestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -382,6 +381,14 @@ class TestLbOnIpWithPf(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -401,13 +408,13 @@ class TestLbOnIpWithPf(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -428,7 +435,7 @@ class TestLbOnIpWithPf(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
interval = Configurations.list(
|
interval = Configurations.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -445,12 +452,11 @@ class TestLbOnIpWithPf(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_lb_on_ip_with_pf(self):
|
def test_lb_on_ip_with_pf(self):
|
||||||
"""Test Create LB rule for sourceNat IP address
|
"""Test Create LB rule for sourceNat IP address
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Deploy the first VM using a network from the above created
|
# 1. Deploy the first VM using a network from the above created
|
||||||
# Network offering.
|
# Network offering.
|
||||||
@ -489,7 +495,7 @@ class TestLbOnIpWithPf(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_1.id
|
% virtual_machine_1.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -525,7 +531,7 @@ class TestLbOnIpWithPf(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_2.id
|
% virtual_machine_2.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -594,6 +600,14 @@ class TestPfOnIpWithLb(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -613,13 +627,13 @@ class TestPfOnIpWithLb(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -640,7 +654,7 @@ class TestPfOnIpWithLb(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
interval = Configurations.list(
|
interval = Configurations.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -657,12 +671,12 @@ class TestPfOnIpWithLb(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_pf_on_ip_with_lb(self):
|
def test_pf_on_ip_with_lb(self):
|
||||||
"""Test Create a port forwarding rule on an Ip address that already has a LB rule.
|
"""Test Create a port forwarding rule on an Ip address
|
||||||
|
that already has a LB rule.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Deploy the first VM using a network from the above created
|
# 1. Deploy the first VM using a network from the above created
|
||||||
# Network offering.
|
# Network offering.
|
||||||
@ -701,7 +715,7 @@ class TestPfOnIpWithLb(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_1.id
|
% virtual_machine_1.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -737,7 +751,7 @@ class TestPfOnIpWithLb(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_2.id
|
% virtual_machine_2.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -807,6 +821,14 @@ class TestLbOnNonSourceNat(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -826,13 +848,13 @@ class TestLbOnNonSourceNat(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -853,7 +875,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
interval = Configurations.list(
|
interval = Configurations.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -870,12 +892,11 @@ class TestLbOnNonSourceNat(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_lb_on_non_source_nat(self):
|
def test_lb_on_non_source_nat(self):
|
||||||
"""Test Create LB rule for non-sourceNat IP address
|
"""Test Create LB rule for non-sourceNat IP address
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Deploy the first VM using a network from the above created
|
# 1. Deploy the first VM using a network from the above created
|
||||||
# Network offering.
|
# Network offering.
|
||||||
@ -914,7 +935,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_1.id
|
% virtual_machine_1.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -950,7 +971,7 @@ class TestLbOnNonSourceNat(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_2.id
|
% virtual_machine_2.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1023,6 +1044,14 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -1042,13 +1071,13 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -1069,7 +1098,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
interval = Configurations.list(
|
interval = Configurations.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -1086,12 +1115,11 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_add_multiple_vms_lb(self):
|
def test_add_multiple_vms_lb(self):
|
||||||
"""Test Add multiple Vms to an existing LB rule.
|
"""Test Add multiple Vms to an existing LB rule.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Deploy the first VM using a network from the above created
|
# 1. Deploy the first VM using a network from the above created
|
||||||
# Network offering.
|
# Network offering.
|
||||||
@ -1135,7 +1163,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_1.id
|
% virtual_machine_1.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1171,7 +1199,7 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_2.id
|
% virtual_machine_2.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1280,10 +1308,11 @@ class TestAddMultipleVmsLb(cloudstackTestCase):
|
|||||||
"virtual server must be configured for public IP address"
|
"virtual server must be configured for public IP address"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
|
|
||||||
class TestMultipleLbRules(cloudstackTestCase):
|
class TestMultipleLbRules(cloudstackTestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -1301,6 +1330,14 @@ class TestMultipleLbRules(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -1320,14 +1357,14 @@ class TestMultipleLbRules(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -1348,7 +1385,7 @@ class TestMultipleLbRules(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
interval = Configurations.list(
|
interval = Configurations.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -1365,12 +1402,11 @@ class TestMultipleLbRules(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_multiple_lb_publicip(self):
|
def test_multiple_lb_publicip(self):
|
||||||
"""Test Create multiple LB rules using different public Ips acquired
|
"""Test Create multiple LB rules using different public Ips acquired
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Deploy the first VM using a network from the above created
|
# 1. Deploy the first VM using a network from the above created
|
||||||
# Network offering.
|
# Network offering.
|
||||||
@ -1410,7 +1446,7 @@ class TestMultipleLbRules(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_1.id
|
% virtual_machine_1.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1446,7 +1482,7 @@ class TestMultipleLbRules(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_2.id
|
% virtual_machine_2.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1607,7 +1643,9 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
|
|||||||
@classmethod
|
@classmethod
|
||||||
def setUpClass(cls):
|
def setUpClass(cls):
|
||||||
cls._cleanup = []
|
cls._cleanup = []
|
||||||
cls.testClient = super(TestMultipleLbRulesSameIp, cls).getClsTestClient()
|
cls.testClient = super(
|
||||||
|
TestMultipleLbRulesSameIp,
|
||||||
|
cls).getClsTestClient()
|
||||||
cls.api_client = cls.testClient.getApiClient()
|
cls.api_client = cls.testClient.getApiClient()
|
||||||
|
|
||||||
cls.services = Services().services
|
cls.services = Services().services
|
||||||
@ -1620,6 +1658,13 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
|
|||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -1639,13 +1684,13 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -1666,7 +1711,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
interval = Configurations.list(
|
interval = Configurations.list(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -1683,12 +1728,11 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_multiple_lb_same_publicip(self):
|
def test_multiple_lb_same_publicip(self):
|
||||||
"""Test Create multiple LB rules using same public Ips on diff ports
|
"""Test Create multiple LB rules using same public Ips on diff ports
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Deploy the first VM using a network from the above created
|
# 1. Deploy the first VM using a network from the above created
|
||||||
# Network offering.
|
# Network offering.
|
||||||
@ -1729,7 +1773,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_1.id
|
% virtual_machine_1.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1765,7 +1809,7 @@ class TestMultipleLbRulesSameIp(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% virtual_machine_2.id
|
% virtual_machine_2.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -1943,6 +1987,14 @@ class TestLoadBalancingRule(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -1966,7 +2018,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
|
|||||||
admin=True,
|
admin=True,
|
||||||
domainid=cls.domain.id
|
domainid=cls.domain.id
|
||||||
)
|
)
|
||||||
cls._cleanup.insert(0,cls.account)
|
cls._cleanup.insert(0, cls.account)
|
||||||
# Creating network using the network offering created
|
# Creating network using the network offering created
|
||||||
cls.network = Network.create(
|
cls.network = Network.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
@ -2002,13 +2054,13 @@ class TestLoadBalancingRule(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -2023,19 +2075,18 @@ class TestLoadBalancingRule(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
self.debug("Cleanup complete!")
|
self.debug("Cleanup complete!")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_01_edit_name_lb_rule(self):
|
def test_01_edit_name_lb_rule(self):
|
||||||
"""Test edit name of LB rule
|
"""Test edit name of LB rule
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Create an Lb rule for couple of Vms .
|
# 1. Create an Lb rule for couple of Vms .
|
||||||
# 2. Edit the name of the existing LB rule. When all the existing
|
# 2. Edit the name of the existing LB rule. When all the existing
|
||||||
@ -2064,34 +2115,36 @@ class TestLoadBalancingRule(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_02_edit_lb_ports(self):
|
def test_02_edit_lb_ports(self):
|
||||||
"""Test edit public port of LB rule
|
"""Test edit public port of LB rule
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Create an Lb rule for couple of Vms .
|
# 1. Create an Lb rule for couple of Vms .
|
||||||
# 2. Edit the public/private of the existing LB rule. When all the
|
# 2. Edit the public/private of the existing LB rule. When all the
|
||||||
# existing Lbrules are listed, this should not be allowed.
|
# existing Lbrules are listed, this should not be allowed.
|
||||||
|
|
||||||
self.debug("Editing public port of the LB rule: %s" % self.lb_rule.name)
|
self.debug(
|
||||||
|
"Editing public port of the LB rule: %s" %
|
||||||
|
self.lb_rule.name)
|
||||||
port = 8888
|
port = 8888
|
||||||
with self.assertRaises(Exception):
|
with self.assertRaises(Exception):
|
||||||
self.lb_rule.update(self.apiclient, publicport=port)
|
self.lb_rule.update(self.apiclient, publicport=port)
|
||||||
|
|
||||||
self.debug("Editing private port of the LB rule: %s" % self.lb_rule.name)
|
self.debug(
|
||||||
|
"Editing private port of the LB rule: %s" %
|
||||||
|
self.lb_rule.name)
|
||||||
with self.assertRaises(Exception):
|
with self.assertRaises(Exception):
|
||||||
self.lb_rule.update(self.apiclient, privateport=port)
|
self.lb_rule.update(self.apiclient, privateport=port)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_03_delete_lb_rule(self):
|
def test_03_delete_lb_rule(self):
|
||||||
"""Test delete LB rule
|
"""Test delete LB rule
|
||||||
"""
|
"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Delete existing load balancing rule
|
# 1. Delete existing load balancing rule
|
||||||
# 2. In netscaler service and port corresponding to LB rule should get
|
# 2. In netscaler service and port corresponding to LB rule should get
|
||||||
@ -2134,7 +2187,7 @@ class TestLoadBalancingRule(cloudstackTestCase):
|
|||||||
"Virtual server should get deleted after removing LB rule"
|
"Virtual server should get deleted after removing LB rule"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -2156,6 +2209,14 @@ class TestDeleteCreateLBRule(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -2178,7 +2239,7 @@ class TestDeleteCreateLBRule(cloudstackTestCase):
|
|||||||
admin=True,
|
admin=True,
|
||||||
domainid=cls.domain.id
|
domainid=cls.domain.id
|
||||||
)
|
)
|
||||||
cls._cleanup.insert(0,cls.account)
|
cls._cleanup.insert(0, cls.account)
|
||||||
# Creating network using the network offering created
|
# Creating network using the network offering created
|
||||||
cls.network = Network.create(
|
cls.network = Network.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
@ -2207,13 +2268,13 @@ class TestDeleteCreateLBRule(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -2235,18 +2296,17 @@ class TestDeleteCreateLBRule(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
self.debug("Cleanup complete!")
|
self.debug("Cleanup complete!")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_01_create_with_same_public_port(self):
|
def test_01_create_with_same_public_port(self):
|
||||||
"""Test create LB rule with same public port after deleting rule"""
|
"""Test create LB rule with same public port after deleting rule"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Delete existing rule and create exactly same rule with different
|
# 1. Delete existing rule and create exactly same rule with different
|
||||||
# public port
|
# public port
|
||||||
@ -2284,6 +2344,14 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -2307,7 +2375,7 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
admin=True,
|
admin=True,
|
||||||
domainid=cls.domain.id
|
domainid=cls.domain.id
|
||||||
)
|
)
|
||||||
cls._cleanup.insert(0,cls.account)
|
cls._cleanup.insert(0, cls.account)
|
||||||
# Creating network using the network offering created
|
# Creating network using the network offering created
|
||||||
cls.network = Network.create(
|
cls.network = Network.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
@ -2365,13 +2433,13 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -2386,18 +2454,17 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
self.debug("Cleanup complete!")
|
self.debug("Cleanup complete!")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_01_delete_public_ip(self):
|
def test_01_delete_public_ip(self):
|
||||||
"""Test delete one public Ip with LB rules"""
|
"""Test delete one public Ip with LB rules"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Associate 2 public Ips and create load balancing rules in it
|
# 1. Associate 2 public Ips and create load balancing rules in it
|
||||||
# 2. Delete one of the public Ip
|
# 2. Delete one of the public Ip
|
||||||
@ -2458,15 +2525,14 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
"Virtual server should get deleted after removing LB rule"
|
"Virtual server should get deleted after removing LB rule"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_02_stop_user_vm(self):
|
def test_02_stop_user_vm(self):
|
||||||
"""Test stop user VM with LB"""
|
"""Test stop user VM with LB"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Create 2 instances and add these two for load balancing
|
# 1. Create 2 instances and add these two for load balancing
|
||||||
# 2. Stop one of the user VM
|
# 2. Stop one of the user VM
|
||||||
@ -2531,15 +2597,14 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
"The server should be present in netscaler after VM stop"
|
"The server should be present in netscaler after VM stop"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_03_start_user_vm(self):
|
def test_03_start_user_vm(self):
|
||||||
"""Test start user VM with LB"""
|
"""Test start user VM with LB"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Create 2 instances and add these two for load balancing
|
# 1. Create 2 instances and add these two for load balancing
|
||||||
# 2. Stop one of the user VM
|
# 2. Stop one of the user VM
|
||||||
@ -2551,7 +2616,7 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
self.vm_2.start(self.apiclient)
|
self.vm_2.start(self.apiclient)
|
||||||
self.debug("Starting VM: %s" % self.vm_2.name)
|
self.debug("Starting VM: %s" % self.vm_2.name)
|
||||||
self.debug("Sleeping for netscaler to recognize service is up")
|
self.debug("Sleeping for netscaler to recognize service is up")
|
||||||
time.sleep( 120 )
|
time.sleep(120)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.debug(
|
self.debug(
|
||||||
@ -2604,15 +2669,14 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
"The server should be present in netscaler after VM stop"
|
"The server should be present in netscaler after VM stop"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns", "multihost"])
|
@attr(tags=["advancedns", "multihost"])
|
||||||
def test_04_migrate_user_vm(self):
|
def test_04_migrate_user_vm(self):
|
||||||
"""Test migrate user VM with LB"""
|
"""Test migrate user VM with LB"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Create 2 instances and add these two for load balancing
|
# 1. Create 2 instances and add these two for load balancing
|
||||||
# 2. migrate one Vm to another host.
|
# 2. migrate one Vm to another host.
|
||||||
@ -2717,15 +2781,14 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
"The server should be present in netscaler after migrate"
|
"The server should be present in netscaler after migrate"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_05_reboot_user_vm(self):
|
def test_05_reboot_user_vm(self):
|
||||||
"""Test reboot user VM with LB"""
|
"""Test reboot user VM with LB"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Create 2 instances and add these two for load balancing
|
# 1. Create 2 instances and add these two for load balancing
|
||||||
# 2. Reboot one of the user VM
|
# 2. Reboot one of the user VM
|
||||||
@ -2736,7 +2799,7 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
self.vm_2.reboot(self.apiclient)
|
self.vm_2.reboot(self.apiclient)
|
||||||
self.debug("Rebooting VM: %s" % self.vm_2.name)
|
self.debug("Rebooting VM: %s" % self.vm_2.name)
|
||||||
self.debug("Waiting for Netscaler to get the service up")
|
self.debug("Waiting for Netscaler to get the service up")
|
||||||
time.sleep( 120 )
|
time.sleep(120)
|
||||||
|
|
||||||
try:
|
try:
|
||||||
self.debug(
|
self.debug(
|
||||||
@ -2805,15 +2868,14 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
"The server should be present in netscaler after reboot"
|
"The server should be present in netscaler after reboot"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_06_destroy_user_vm(self):
|
def test_06_destroy_user_vm(self):
|
||||||
"""Test destroy user VM with LB"""
|
"""Test destroy user VM with LB"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Create 2 instances and add these two for load balancing
|
# 1. Create 2 instances and add these two for load balancing
|
||||||
# 2. Destroy one of the user VM
|
# 2. Destroy one of the user VM
|
||||||
@ -2888,15 +2950,14 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
"The server should not be present in netscaler after destroy"
|
"The server should not be present in netscaler after destroy"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_07_delete_all_public_ip(self):
|
def test_07_delete_all_public_ip(self):
|
||||||
"""Test delete all public Ip with LB rules"""
|
"""Test delete all public Ip with LB rules"""
|
||||||
|
|
||||||
|
|
||||||
# Validate the following
|
# Validate the following
|
||||||
# 1. Associate 2 public Ips and create load balancing rules in it
|
# 1. Associate 2 public Ips and create load balancing rules in it
|
||||||
# 2. Delete all of the public Ip
|
# 2. Delete all of the public Ip
|
||||||
@ -2957,6 +3018,6 @@ class TestVmWithLb(cloudstackTestCase):
|
|||||||
"Virtual server should get deleted after removing LB rule"
|
"Virtual server should get deleted after removing LB rule"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|||||||
@ -17,18 +17,29 @@
|
|||||||
|
|
||||||
""" P1 tests for netscaler load balancing
|
""" P1 tests for netscaler load balancing
|
||||||
"""
|
"""
|
||||||
#Import Local Modules
|
# Import Local Modules
|
||||||
import marvin
|
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import *
|
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||||
from marvin.cloudstackAPI import *
|
from marvin.lib.utils import (cleanup_resources)
|
||||||
from marvin.lib.utils import *
|
from marvin.lib.base import (Account,
|
||||||
from marvin.lib.base import *
|
Network,
|
||||||
from marvin.lib.common import *
|
VirtualMachine,
|
||||||
|
ServiceOffering,
|
||||||
|
NetworkOffering,
|
||||||
|
PublicIPAddress,
|
||||||
|
LoadBalancerRule)
|
||||||
|
from marvin.lib.common import (get_zone,
|
||||||
|
get_domain,
|
||||||
|
get_template,
|
||||||
|
list_configurations,
|
||||||
|
GetNetscalerInfoFromConfig,
|
||||||
|
add_netscaler)
|
||||||
from marvin.sshClient import SshClient
|
from marvin.sshClient import SshClient
|
||||||
|
import time
|
||||||
|
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
|
|
||||||
"""Test netscaler services
|
"""Test netscaler services
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -60,18 +71,6 @@ class Services:
|
|||||||
"publicport": 22,
|
"publicport": 22,
|
||||||
"protocol": 'TCP',
|
"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": {
|
"network_offering": {
|
||||||
"name": 'Netscaler',
|
"name": 'Netscaler',
|
||||||
"displaytext": 'Netscaler',
|
"displaytext": 'Netscaler',
|
||||||
@ -93,7 +92,7 @@ class Services:
|
|||||||
},
|
},
|
||||||
"network": {
|
"network": {
|
||||||
"name": "Netscaler",
|
"name": "Netscaler",
|
||||||
"displaytext": "Netscaler",
|
"displaytext": "Netscaler"
|
||||||
},
|
},
|
||||||
"lbrule": {
|
"lbrule": {
|
||||||
"name": "SSH",
|
"name": "SSH",
|
||||||
@ -128,6 +127,15 @@ class TestLbWithRoundRobin(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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
|
||||||
|
|
||||||
|
cls._cleanup = []
|
||||||
try:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -147,13 +155,13 @@ class TestLbWithRoundRobin(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -174,7 +182,7 @@ class TestLbWithRoundRobin(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
interval = list_configurations(
|
interval = list_configurations(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -191,7 +199,7 @@ class TestLbWithRoundRobin(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_lb_with_round_robin(self):
|
def test_lb_with_round_robin(self):
|
||||||
"""Test Create LB rule with round robin algorithm
|
"""Test Create LB rule with round robin algorithm
|
||||||
"""
|
"""
|
||||||
@ -235,7 +243,7 @@ class TestLbWithRoundRobin(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% self.virtual_machine.id
|
% self.virtual_machine.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -293,7 +301,8 @@ class TestLbWithRoundRobin(cloudstackTestCase):
|
|||||||
lb_rule.name
|
lb_rule.name
|
||||||
))
|
))
|
||||||
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -318,7 +327,7 @@ class TestLbWithRoundRobin(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -340,6 +349,14 @@ class TestLbWithLeastConn(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -348,6 +365,7 @@ class TestLbWithLeastConn(cloudstackTestCase):
|
|||||||
cls.services["network_offering"],
|
cls.services["network_offering"],
|
||||||
conservemode=True
|
conservemode=True
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.network_offering)
|
||||||
# Enable Network offering
|
# Enable Network offering
|
||||||
cls.network_offering.update(cls.api_client, state='Enabled')
|
cls.network_offering.update(cls.api_client, state='Enabled')
|
||||||
|
|
||||||
@ -358,16 +376,17 @@ class TestLbWithLeastConn(cloudstackTestCase):
|
|||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["service_offering"]
|
cls.services["service_offering"]
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.service_offering)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
|
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -388,7 +407,7 @@ class TestLbWithLeastConn(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
interval = list_configurations(
|
interval = list_configurations(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -405,7 +424,7 @@ class TestLbWithLeastConn(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_lb_with_least_conn(self):
|
def test_lb_with_least_conn(self):
|
||||||
"""Test Create LB rule with least connection algorithm
|
"""Test Create LB rule with least connection algorithm
|
||||||
"""
|
"""
|
||||||
@ -449,7 +468,7 @@ class TestLbWithLeastConn(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% self.virtual_machine.id
|
% self.virtual_machine.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -515,7 +534,8 @@ class TestLbWithLeastConn(cloudstackTestCase):
|
|||||||
))
|
))
|
||||||
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
||||||
|
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -540,7 +560,7 @@ class TestLbWithLeastConn(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -561,16 +581,24 @@ class TestLbWithSourceIp(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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
|
||||||
|
|
||||||
|
cls._cleanup = []
|
||||||
try:
|
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.services["netscaler"])
|
||||||
cls._cleanup = [
|
cls._cleanup.append(cls.netscaler)
|
||||||
cls.netscaler
|
|
||||||
]
|
|
||||||
cls.network_offering = NetworkOffering.create(
|
cls.network_offering = NetworkOffering.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["network_offering"],
|
cls.services["network_offering"],
|
||||||
conservemode=True
|
conservemode=True
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.network_offering)
|
||||||
# Enable Network offering
|
# Enable Network offering
|
||||||
cls.network_offering.update(cls.api_client, state='Enabled')
|
cls.network_offering.update(cls.api_client, state='Enabled')
|
||||||
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
cls.services["virtual_machine"]["zoneid"] = cls.zone.id
|
||||||
@ -580,15 +608,16 @@ class TestLbWithSourceIp(cloudstackTestCase):
|
|||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["service_offering"]
|
cls.services["service_offering"]
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.service_offering)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -609,7 +638,7 @@ class TestLbWithSourceIp(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
interval = list_configurations(
|
interval = list_configurations(
|
||||||
self.apiclient,
|
self.apiclient,
|
||||||
@ -626,7 +655,7 @@ class TestLbWithSourceIp(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_lb_with_source_ip(self):
|
def test_lb_with_source_ip(self):
|
||||||
"""Test Create LB rule with source Ip algorithm
|
"""Test Create LB rule with source Ip algorithm
|
||||||
"""
|
"""
|
||||||
@ -670,7 +699,7 @@ class TestLbWithSourceIp(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Verify listVirtualMachines response for virtual machine: %s" \
|
"Verify listVirtualMachines response for virtual machine: %s"
|
||||||
% self.virtual_machine.id
|
% self.virtual_machine.id
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -729,7 +758,8 @@ class TestLbWithSourceIp(cloudstackTestCase):
|
|||||||
lb_rule.name
|
lb_rule.name
|
||||||
))
|
))
|
||||||
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -754,7 +784,7 @@ class TestLbWithSourceIp(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -776,6 +806,14 @@ class TestLbAlgoRrLc(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -784,6 +822,7 @@ class TestLbAlgoRrLc(cloudstackTestCase):
|
|||||||
cls.services["network_offering"],
|
cls.services["network_offering"],
|
||||||
conservemode=True
|
conservemode=True
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.network_offering)
|
||||||
# Enable Network offering
|
# Enable Network offering
|
||||||
cls.network_offering.update(cls.api_client, state='Enabled')
|
cls.network_offering.update(cls.api_client, state='Enabled')
|
||||||
cls.account = Account.create(
|
cls.account = Account.create(
|
||||||
@ -792,7 +831,7 @@ class TestLbAlgoRrLc(cloudstackTestCase):
|
|||||||
admin=True,
|
admin=True,
|
||||||
domainid=cls.domain.id
|
domainid=cls.domain.id
|
||||||
)
|
)
|
||||||
cls._cleanup.insert(0,cls.account)
|
cls._cleanup.insert(0, cls.account)
|
||||||
cls.network = Network.create(
|
cls.network = Network.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["network"],
|
cls.services["network"],
|
||||||
@ -808,6 +847,7 @@ class TestLbAlgoRrLc(cloudstackTestCase):
|
|||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["service_offering"]
|
cls.services["service_offering"]
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.service_offering)
|
||||||
|
|
||||||
# Spawn an instance in that network
|
# Spawn an instance in that network
|
||||||
cls.virtual_machine = VirtualMachine.create(
|
cls.virtual_machine = VirtualMachine.create(
|
||||||
@ -827,7 +867,7 @@ class TestLbAlgoRrLc(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -855,7 +895,7 @@ class TestLbAlgoRrLc(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_lb_round_robin_to_least_conn(self):
|
def test_lb_round_robin_to_least_conn(self):
|
||||||
"""Test edit LB rule from round robin to least connection algo
|
"""Test edit LB rule from round robin to least connection algo
|
||||||
"""
|
"""
|
||||||
@ -901,7 +941,8 @@ class TestLbAlgoRrLc(cloudstackTestCase):
|
|||||||
))
|
))
|
||||||
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
||||||
|
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -925,7 +966,7 @@ class TestLbAlgoRrLc(cloudstackTestCase):
|
|||||||
"'ROUNDROBIN' algorithm should be configured on NS"
|
"'ROUNDROBIN' algorithm should be configured on NS"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
@ -934,7 +975,8 @@ class TestLbAlgoRrLc(cloudstackTestCase):
|
|||||||
'leastconn'))
|
'leastconn'))
|
||||||
lb_rule.update(self.apiclient, algorithm='leastconn')
|
lb_rule.update(self.apiclient, algorithm='leastconn')
|
||||||
|
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -958,7 +1000,7 @@ class TestLbAlgoRrLc(cloudstackTestCase):
|
|||||||
"'LEASTCONNECTION' algorithm should be configured on NS"
|
"'LEASTCONNECTION' algorithm should be configured on NS"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -980,6 +1022,14 @@ class TestLbAlgoLcRr(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -988,6 +1038,7 @@ class TestLbAlgoLcRr(cloudstackTestCase):
|
|||||||
cls.services["network_offering"],
|
cls.services["network_offering"],
|
||||||
conservemode=True
|
conservemode=True
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.network_offering)
|
||||||
# Enable Network offering
|
# Enable Network offering
|
||||||
cls.network_offering.update(cls.api_client, state='Enabled')
|
cls.network_offering.update(cls.api_client, state='Enabled')
|
||||||
cls.account = Account.create(
|
cls.account = Account.create(
|
||||||
@ -996,7 +1047,7 @@ class TestLbAlgoLcRr(cloudstackTestCase):
|
|||||||
admin=True,
|
admin=True,
|
||||||
domainid=cls.domain.id
|
domainid=cls.domain.id
|
||||||
)
|
)
|
||||||
cls._cleanup.insert(0,cls.account)
|
cls._cleanup.insert(0, cls.account)
|
||||||
cls.network = Network.create(
|
cls.network = Network.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["network"],
|
cls.services["network"],
|
||||||
@ -1012,6 +1063,7 @@ class TestLbAlgoLcRr(cloudstackTestCase):
|
|||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["service_offering"]
|
cls.services["service_offering"]
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.service_offering)
|
||||||
|
|
||||||
# Spawn an instance in that network
|
# Spawn an instance in that network
|
||||||
cls.virtual_machine = VirtualMachine.create(
|
cls.virtual_machine = VirtualMachine.create(
|
||||||
@ -1031,7 +1083,7 @@ class TestLbAlgoLcRr(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -1059,7 +1111,7 @@ class TestLbAlgoLcRr(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_lb_least_conn_to_round_robin(self):
|
def test_lb_least_conn_to_round_robin(self):
|
||||||
"""Test edit LB rule from least conn to round robin algo
|
"""Test edit LB rule from least conn to round robin algo
|
||||||
"""
|
"""
|
||||||
@ -1103,7 +1155,8 @@ class TestLbAlgoLcRr(cloudstackTestCase):
|
|||||||
lb_rule.name
|
lb_rule.name
|
||||||
))
|
))
|
||||||
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -1127,7 +1180,7 @@ class TestLbAlgoLcRr(cloudstackTestCase):
|
|||||||
"'LEASTCONNECTION' algorithm should be configured on NS"
|
"'LEASTCONNECTION' algorithm should be configured on NS"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
@ -1135,7 +1188,8 @@ class TestLbAlgoLcRr(cloudstackTestCase):
|
|||||||
lb_rule.name,
|
lb_rule.name,
|
||||||
'roundrobin'))
|
'roundrobin'))
|
||||||
lb_rule.update(self.apiclient, algorithm='roundrobin')
|
lb_rule.update(self.apiclient, algorithm='roundrobin')
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -1159,7 +1213,7 @@ class TestLbAlgoLcRr(cloudstackTestCase):
|
|||||||
"'ROUNDROBIN' algorithm should be configured on NS"
|
"'ROUNDROBIN' algorithm should be configured on NS"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1181,6 +1235,14 @@ class TestLbAlgoRrSb(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -1189,6 +1251,7 @@ class TestLbAlgoRrSb(cloudstackTestCase):
|
|||||||
cls.services["network_offering"],
|
cls.services["network_offering"],
|
||||||
conservemode=True
|
conservemode=True
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.network_offering)
|
||||||
# Enable Network offering
|
# Enable Network offering
|
||||||
cls.network_offering.update(cls.api_client, state='Enabled')
|
cls.network_offering.update(cls.api_client, state='Enabled')
|
||||||
cls.account = Account.create(
|
cls.account = Account.create(
|
||||||
@ -1197,7 +1260,7 @@ class TestLbAlgoRrSb(cloudstackTestCase):
|
|||||||
admin=True,
|
admin=True,
|
||||||
domainid=cls.domain.id
|
domainid=cls.domain.id
|
||||||
)
|
)
|
||||||
cls._cleanup.insert(0,cls.account)
|
cls._cleanup.insert(0, cls.account)
|
||||||
cls.network = Network.create(
|
cls.network = Network.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["network"],
|
cls.services["network"],
|
||||||
@ -1213,6 +1276,7 @@ class TestLbAlgoRrSb(cloudstackTestCase):
|
|||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["service_offering"]
|
cls.services["service_offering"]
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.service_offering)
|
||||||
|
|
||||||
# Spawn an instance in that network
|
# Spawn an instance in that network
|
||||||
cls.virtual_machine = VirtualMachine.create(
|
cls.virtual_machine = VirtualMachine.create(
|
||||||
@ -1233,7 +1297,7 @@ class TestLbAlgoRrSb(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -1261,7 +1325,7 @@ class TestLbAlgoRrSb(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_lb_round_robin_to_source(self):
|
def test_lb_round_robin_to_source(self):
|
||||||
"""Test edit LB rule from round robin to source algo
|
"""Test edit LB rule from round robin to source algo
|
||||||
"""
|
"""
|
||||||
@ -1305,7 +1369,8 @@ class TestLbAlgoRrSb(cloudstackTestCase):
|
|||||||
lb_rule.name
|
lb_rule.name
|
||||||
))
|
))
|
||||||
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -1329,7 +1394,7 @@ class TestLbAlgoRrSb(cloudstackTestCase):
|
|||||||
"'ROUNDROBIN' algorithm should be configured on NS"
|
"'ROUNDROBIN' algorithm should be configured on NS"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
@ -1338,7 +1403,8 @@ class TestLbAlgoRrSb(cloudstackTestCase):
|
|||||||
'source'))
|
'source'))
|
||||||
lb_rule.update(self.apiclient, algorithm='source')
|
lb_rule.update(self.apiclient, algorithm='source')
|
||||||
|
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -1363,7 +1429,7 @@ class TestLbAlgoRrSb(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1385,6 +1451,14 @@ class TestLbAlgoSbRr(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -1393,6 +1467,7 @@ class TestLbAlgoSbRr(cloudstackTestCase):
|
|||||||
cls.services["network_offering"],
|
cls.services["network_offering"],
|
||||||
conservemode=True
|
conservemode=True
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.network_offering)
|
||||||
# Enable Network offering
|
# Enable Network offering
|
||||||
cls.network_offering.update(cls.api_client, state='Enabled')
|
cls.network_offering.update(cls.api_client, state='Enabled')
|
||||||
|
|
||||||
@ -1402,7 +1477,7 @@ class TestLbAlgoSbRr(cloudstackTestCase):
|
|||||||
admin=True,
|
admin=True,
|
||||||
domainid=cls.domain.id
|
domainid=cls.domain.id
|
||||||
)
|
)
|
||||||
cls._cleanup.insert(0,cls.account)
|
cls._cleanup.insert(0, cls.account)
|
||||||
cls.network = Network.create(
|
cls.network = Network.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["network"],
|
cls.services["network"],
|
||||||
@ -1418,6 +1493,7 @@ class TestLbAlgoSbRr(cloudstackTestCase):
|
|||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["service_offering"]
|
cls.services["service_offering"]
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.service_offering)
|
||||||
|
|
||||||
# Spawn an instance in that network
|
# Spawn an instance in that network
|
||||||
cls.virtual_machine = VirtualMachine.create(
|
cls.virtual_machine = VirtualMachine.create(
|
||||||
@ -1438,7 +1514,7 @@ class TestLbAlgoSbRr(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -1466,7 +1542,7 @@ class TestLbAlgoSbRr(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_lb_source_to_round_robin(self):
|
def test_lb_source_to_round_robin(self):
|
||||||
"""Test edit LB rule from source to round robin algo
|
"""Test edit LB rule from source to round robin algo
|
||||||
"""
|
"""
|
||||||
@ -1512,7 +1588,8 @@ class TestLbAlgoSbRr(cloudstackTestCase):
|
|||||||
))
|
))
|
||||||
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
||||||
|
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -1537,7 +1614,7 @@ class TestLbAlgoSbRr(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
@ -1546,7 +1623,8 @@ class TestLbAlgoSbRr(cloudstackTestCase):
|
|||||||
'roundrobin'))
|
'roundrobin'))
|
||||||
lb_rule.update(self.apiclient, algorithm='roundrobin')
|
lb_rule.update(self.apiclient, algorithm='roundrobin')
|
||||||
|
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -1570,7 +1648,7 @@ class TestLbAlgoSbRr(cloudstackTestCase):
|
|||||||
"'ROUNDROBIN' algorithm should be configured on NS"
|
"'ROUNDROBIN' algorithm should be configured on NS"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1592,6 +1670,14 @@ class TestLbAlgoSbLc(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -1600,6 +1686,7 @@ class TestLbAlgoSbLc(cloudstackTestCase):
|
|||||||
cls.services["network_offering"],
|
cls.services["network_offering"],
|
||||||
conservemode=True
|
conservemode=True
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.network_offering)
|
||||||
# Enable Network offering
|
# Enable Network offering
|
||||||
cls.network_offering.update(cls.api_client, state='Enabled')
|
cls.network_offering.update(cls.api_client, state='Enabled')
|
||||||
|
|
||||||
@ -1609,7 +1696,7 @@ class TestLbAlgoSbLc(cloudstackTestCase):
|
|||||||
admin=True,
|
admin=True,
|
||||||
domainid=cls.domain.id
|
domainid=cls.domain.id
|
||||||
)
|
)
|
||||||
cls._cleanup.insert(0,cls.account)
|
cls._cleanup.insert(0, cls.account)
|
||||||
cls.network = Network.create(
|
cls.network = Network.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["network"],
|
cls.services["network"],
|
||||||
@ -1625,6 +1712,7 @@ class TestLbAlgoSbLc(cloudstackTestCase):
|
|||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["service_offering"]
|
cls.services["service_offering"]
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.service_offering)
|
||||||
|
|
||||||
# Spawn an instance in that network
|
# Spawn an instance in that network
|
||||||
cls.virtual_machine = VirtualMachine.create(
|
cls.virtual_machine = VirtualMachine.create(
|
||||||
@ -1645,7 +1733,7 @@ class TestLbAlgoSbLc(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -1673,7 +1761,7 @@ class TestLbAlgoSbLc(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_lb_source_to_least_conn(self):
|
def test_lb_source_to_least_conn(self):
|
||||||
"""Test edit LB rule from source to least conn algo
|
"""Test edit LB rule from source to least conn algo
|
||||||
"""
|
"""
|
||||||
@ -1719,7 +1807,8 @@ class TestLbAlgoSbLc(cloudstackTestCase):
|
|||||||
))
|
))
|
||||||
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
||||||
|
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -1744,7 +1833,7 @@ class TestLbAlgoSbLc(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
self.debug(
|
self.debug(
|
||||||
"Updating LB rule: %s with new algorithm: %s" % (
|
"Updating LB rule: %s with new algorithm: %s" % (
|
||||||
@ -1752,7 +1841,8 @@ class TestLbAlgoSbLc(cloudstackTestCase):
|
|||||||
'leastconn'))
|
'leastconn'))
|
||||||
lb_rule.update(self.apiclient, algorithm='leastconn')
|
lb_rule.update(self.apiclient, algorithm='leastconn')
|
||||||
|
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -1776,7 +1866,7 @@ class TestLbAlgoSbLc(cloudstackTestCase):
|
|||||||
"'LEASTCONNECTION' algorithm should be configured on NS"
|
"'LEASTCONNECTION' algorithm should be configured on NS"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -1798,6 +1888,14 @@ class TestLbAlgoLcSb(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
@ -1806,6 +1904,7 @@ class TestLbAlgoLcSb(cloudstackTestCase):
|
|||||||
cls.services["network_offering"],
|
cls.services["network_offering"],
|
||||||
conservemode=True
|
conservemode=True
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.network_offering)
|
||||||
# Enable Network offering
|
# Enable Network offering
|
||||||
cls.network_offering.update(cls.api_client, state='Enabled')
|
cls.network_offering.update(cls.api_client, state='Enabled')
|
||||||
|
|
||||||
@ -1815,7 +1914,7 @@ class TestLbAlgoLcSb(cloudstackTestCase):
|
|||||||
admin=True,
|
admin=True,
|
||||||
domainid=cls.domain.id
|
domainid=cls.domain.id
|
||||||
)
|
)
|
||||||
cls._cleanup.insert(0,cls.account)
|
cls._cleanup.insert(0, cls.account)
|
||||||
cls.network = Network.create(
|
cls.network = Network.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["network"],
|
cls.services["network"],
|
||||||
@ -1831,6 +1930,7 @@ class TestLbAlgoLcSb(cloudstackTestCase):
|
|||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.services["service_offering"]
|
cls.services["service_offering"]
|
||||||
)
|
)
|
||||||
|
cls._cleanup.append(cls.service_offering)
|
||||||
|
|
||||||
# Spawn an instance in that network
|
# Spawn an instance in that network
|
||||||
cls.virtual_machine = VirtualMachine.create(
|
cls.virtual_machine = VirtualMachine.create(
|
||||||
@ -1850,7 +1950,7 @@ class TestLbAlgoLcSb(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -1878,7 +1978,7 @@ class TestLbAlgoLcSb(cloudstackTestCase):
|
|||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_lb_leastconn_to_source(self):
|
def test_lb_leastconn_to_source(self):
|
||||||
"""Test edit LB rule from round robin to source algo
|
"""Test edit LB rule from round robin to source algo
|
||||||
"""
|
"""
|
||||||
@ -1923,7 +2023,8 @@ class TestLbAlgoLcSb(cloudstackTestCase):
|
|||||||
))
|
))
|
||||||
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
lb_rule.assign(self.apiclient, [self.virtual_machine])
|
||||||
|
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -1947,7 +2048,7 @@ class TestLbAlgoLcSb(cloudstackTestCase):
|
|||||||
"'LEASTCONNECTION' algorithm should be configured on NS"
|
"'LEASTCONNECTION' algorithm should be configured on NS"
|
||||||
)
|
)
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
@ -1956,7 +2057,8 @@ class TestLbAlgoLcSb(cloudstackTestCase):
|
|||||||
'source'))
|
'source'))
|
||||||
lb_rule.update(self.apiclient, algorithm='source')
|
lb_rule.update(self.apiclient, algorithm='source')
|
||||||
|
|
||||||
self.debug("SSH into Netscaler to check whether algorithm is configured properly or not?")
|
self.debug(
|
||||||
|
"SSH into Netscaler to check whether algorithm is configured properly or not?")
|
||||||
self.debug("SSH into netscaler: %s" %
|
self.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -1981,6 +2083,6 @@ class TestLbAlgoLcSb(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|||||||
@ -17,19 +17,27 @@
|
|||||||
|
|
||||||
""" P1 tests for netscaler load balancing sticky policy
|
""" P1 tests for netscaler load balancing sticky policy
|
||||||
"""
|
"""
|
||||||
#Import Local Modules
|
# Import Local Modules
|
||||||
import marvin
|
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.cloudstackTestCase import *
|
from marvin.cloudstackTestCase import cloudstackTestCase
|
||||||
from marvin.cloudstackAPI import *
|
from marvin.lib.utils import cleanup_resources
|
||||||
from marvin.lib.utils import *
|
from marvin.lib.base import (Account,
|
||||||
from marvin.lib.base import *
|
LoadBalancerRule,
|
||||||
from marvin.lib.common import *
|
PublicIPAddress,
|
||||||
|
Network,
|
||||||
|
NetworkOffering,
|
||||||
|
ServiceOffering,
|
||||||
|
VirtualMachine)
|
||||||
|
from marvin.lib.common import (get_domain,
|
||||||
|
get_zone,
|
||||||
|
get_template,
|
||||||
|
add_netscaler,
|
||||||
|
GetNetscalerInfoFromConfig)
|
||||||
from marvin.sshClient import SshClient
|
from marvin.sshClient import SshClient
|
||||||
import datetime
|
|
||||||
|
|
||||||
|
|
||||||
class Services:
|
class Services:
|
||||||
|
|
||||||
"""Test netscaler services
|
"""Test netscaler services
|
||||||
"""
|
"""
|
||||||
|
|
||||||
@ -61,18 +69,6 @@ class Services:
|
|||||||
"publicport": 22,
|
"publicport": 22,
|
||||||
"protocol": 'TCP',
|
"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": {
|
"network_offering": {
|
||||||
"name": 'Netscaler',
|
"name": 'Netscaler',
|
||||||
"displaytext": 'Netscaler',
|
"displaytext": 'Netscaler',
|
||||||
@ -80,7 +76,7 @@ class Services:
|
|||||||
"supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
|
"supportedservices": 'Dhcp,Dns,SourceNat,PortForwarding,Vpn,Firewall,Lb,UserData,StaticNat',
|
||||||
"traffictype": 'GUEST',
|
"traffictype": 'GUEST',
|
||||||
"availability": 'Optional',
|
"availability": 'Optional',
|
||||||
"serviceProviderList" : {
|
"serviceProviderList": {
|
||||||
"Dhcp": 'VirtualRouter',
|
"Dhcp": 'VirtualRouter',
|
||||||
"Dns": 'VirtualRouter',
|
"Dns": 'VirtualRouter',
|
||||||
"SourceNat": 'VirtualRouter',
|
"SourceNat": 'VirtualRouter',
|
||||||
@ -108,7 +104,7 @@ class Services:
|
|||||||
# Cent OS 5.3 (64 bit)
|
# Cent OS 5.3 (64 bit)
|
||||||
"sleep": 60,
|
"sleep": 60,
|
||||||
"timeout": 10,
|
"timeout": 10,
|
||||||
"mode":'advanced'
|
"mode": 'advanced'
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -129,8 +125,19 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["ostype"]
|
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:
|
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.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
cls.network_offering = NetworkOffering.create(
|
cls.network_offering = NetworkOffering.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
@ -152,7 +159,7 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
admin=True,
|
admin=True,
|
||||||
domainid=cls.domain.id
|
domainid=cls.domain.id
|
||||||
)
|
)
|
||||||
cls._cleanup.insert(0,cls.account)
|
cls._cleanup.insert(0, cls.account)
|
||||||
# Creating network using the network offering created
|
# Creating network using the network offering created
|
||||||
cls.network = Network.create(
|
cls.network = Network.create(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
@ -181,13 +188,13 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
cls.tearDownClass()
|
cls.tearDownClass()
|
||||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
raise Exception("Warning: Exception in setUpClass: %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def tearDownClass(cls):
|
def tearDownClass(cls):
|
||||||
try:
|
try:
|
||||||
#Cleanup resources used
|
# Cleanup resources used
|
||||||
cleanup_resources(cls.api_client, cls._cleanup)
|
cleanup_resources(cls.api_client, cls._cleanup)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
@ -202,16 +209,17 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
def tearDown(self):
|
def tearDown(self):
|
||||||
try:
|
try:
|
||||||
self.debug("Cleaning up the resources")
|
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)
|
cleanup_resources(self.apiclient, self.cleanup)
|
||||||
self.debug("Cleanup complete!")
|
self.debug("Cleanup complete!")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise Exception("Warning: Exception during cleanup : %s" % e)
|
raise Exception("Warning: Exception during cleanup : %s" % e)
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_01_source_based_roundrobin(self):
|
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
|
# Validate the following
|
||||||
@ -262,7 +270,9 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Configure sticky policy failed with exception: %s" % 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.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -293,13 +303,14 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_02_source_based_source_algo(self):
|
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
|
# Validate the following
|
||||||
@ -351,7 +362,9 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Configure sticky policy failed with exception: %s" % 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.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -382,11 +395,11 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_03_source_based_leastconn(self):
|
def test_03_source_based_leastconn(self):
|
||||||
"""Test Create a "SourceBased" stick policy for a Lb rule with leastconn algo
|
"""Test Create a "SourceBased" stick policy for a Lb rule with leastconn algo
|
||||||
"""
|
"""
|
||||||
@ -440,7 +453,9 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Configure sticky policy failed with exception: %s" % 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.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -471,11 +486,11 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_04_lbcookie_based_roundrobin(self):
|
def test_04_lbcookie_based_roundrobin(self):
|
||||||
"""Test Create a "LBCookie" stick policy for a Lb rule with roundrobin algo
|
"""Test Create a "LBCookie" stick policy for a Lb rule with roundrobin algo
|
||||||
"""
|
"""
|
||||||
@ -531,7 +546,9 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Configure sticky policy failed with exception: %s" % 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.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -562,11 +579,11 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_05_lbcookie_source_algo(self):
|
def test_05_lbcookie_source_algo(self):
|
||||||
"""Test Create a "LBCookie" stick policy for a Lb rule with "Source" algorithm
|
"""Test Create a "LBCookie" stick policy for a Lb rule with "Source" algorithm
|
||||||
"""
|
"""
|
||||||
@ -622,7 +639,9 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Configure sticky policy failed with exception: %s" % 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.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -653,11 +672,11 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_06_lbcookie_leastconn(self):
|
def test_06_lbcookie_leastconn(self):
|
||||||
"""Test Create a "LBCookie" stick policy for a Lb rule with leastconn algo
|
"""Test Create a "LBCookie" stick policy for a Lb rule with leastconn algo
|
||||||
"""
|
"""
|
||||||
@ -713,7 +732,9 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Configure sticky policy failed with exception: %s" % 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.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -744,11 +765,11 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_07_appcookie_based_roundrobin(self):
|
def test_07_appcookie_based_roundrobin(self):
|
||||||
"""Test Create a "AppCookie" stick policy for a Lb rule with roundrobin algo
|
"""Test Create a "AppCookie" stick policy for a Lb rule with roundrobin algo
|
||||||
"""
|
"""
|
||||||
@ -804,7 +825,9 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Configure sticky policy failed with exception: %s" % 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.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -835,11 +858,11 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_08_appcookie_source_algo(self):
|
def test_08_appcookie_source_algo(self):
|
||||||
"""Test Create a "AppCookie" stick policy for a Lb rule with "Source"
|
"""Test Create a "AppCookie" stick policy for a Lb rule with "Source"
|
||||||
"""
|
"""
|
||||||
@ -895,7 +918,9 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Configure sticky policy failed with exception: %s" % 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.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -926,11 +951,11 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|
||||||
@attr(tags = ["advancedns"])
|
@attr(tags=["advancedns"])
|
||||||
def test_09_appcookie_leastconn(self):
|
def test_09_appcookie_leastconn(self):
|
||||||
"""Test Create a "AppCookie" stick policy for a Lb rule with leastconn
|
"""Test Create a "AppCookie" stick policy for a Lb rule with leastconn
|
||||||
"""
|
"""
|
||||||
@ -986,7 +1011,9 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail("Configure sticky policy failed with exception: %s" % 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.debug("SSH into netscaler: %s" %
|
||||||
self.services["netscaler"]["ipaddress"])
|
self.services["netscaler"]["ipaddress"])
|
||||||
try:
|
try:
|
||||||
@ -1017,6 +1044,6 @@ class TestLbStickyPolicy(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
|
|
||||||
except Exception as e:
|
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))
|
(self.services["netscaler"]["ipaddress"], e))
|
||||||
return
|
return
|
||||||
|
|||||||
@ -40,7 +40,8 @@ from marvin.lib.common import (get_domain,
|
|||||||
get_template,
|
get_template,
|
||||||
verifyNetworkState,
|
verifyNetworkState,
|
||||||
add_netscaler,
|
add_netscaler,
|
||||||
wait_for_cleanup)
|
wait_for_cleanup,
|
||||||
|
GetNetscalerInfoFromConfig)
|
||||||
from nose.plugins.attrib import attr
|
from nose.plugins.attrib import attr
|
||||||
from marvin.codes import PASS, FAIL, FAILED
|
from marvin.codes import PASS, FAIL, FAILED
|
||||||
from marvin.sshClient import SshClient
|
from marvin.sshClient import SshClient
|
||||||
@ -97,6 +98,13 @@ class TestPersistentNetworks(cloudstackTestCase):
|
|||||||
cls.isolated_network_offering_netscaler = cls.createNetworkOffering(
|
cls.isolated_network_offering_netscaler = cls.createNetworkOffering(
|
||||||
"nw_off_isolated_netscaler")
|
"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
|
# Configure Netscaler device
|
||||||
# If configuration succeeds, set ns_configured to True so that
|
# If configuration succeeds, set ns_configured to True so that
|
||||||
# Netscaler tests are executed
|
# Netscaler tests are executed
|
||||||
@ -105,7 +113,7 @@ class TestPersistentNetworks(cloudstackTestCase):
|
|||||||
cls.netscaler = add_netscaler(
|
cls.netscaler = add_netscaler(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["netscaler_VPX"])
|
cls.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
cls.ns_configured = True
|
cls.ns_configured = True
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -1500,6 +1508,13 @@ class TestAssignVirtualMachine(cloudstackTestCase):
|
|||||||
cls.persistent_network_offering_netscaler = cls.createNetworkOffering(
|
cls.persistent_network_offering_netscaler = cls.createNetworkOffering(
|
||||||
"nw_off_isolated_persistent_netscaler")
|
"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
|
# Configure Netscaler device
|
||||||
# If configuration succeeds, set ns_configured to True so that
|
# If configuration succeeds, set ns_configured to True so that
|
||||||
# Netscaler tests are executed
|
# Netscaler tests are executed
|
||||||
@ -1508,7 +1523,7 @@ class TestAssignVirtualMachine(cloudstackTestCase):
|
|||||||
cls.netscaler = add_netscaler(
|
cls.netscaler = add_netscaler(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["netscaler_VPX"])
|
cls.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
cls.ns_configured = True
|
cls.ns_configured = True
|
||||||
except Exception:
|
except Exception:
|
||||||
@ -1964,6 +1979,13 @@ class TestRestartPersistentNetwork(cloudstackTestCase):
|
|||||||
cls.api_client,
|
cls.api_client,
|
||||||
state="enabled")
|
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
|
# Configure Netscaler device
|
||||||
# If configuration succeeds, set ns_configured to True so that
|
# If configuration succeeds, set ns_configured to True so that
|
||||||
# Netscaler tests are executed
|
# Netscaler tests are executed
|
||||||
@ -1972,7 +1994,7 @@ class TestRestartPersistentNetwork(cloudstackTestCase):
|
|||||||
cls.netscaler = add_netscaler(
|
cls.netscaler = add_netscaler(
|
||||||
cls.api_client,
|
cls.api_client,
|
||||||
cls.zone.id,
|
cls.zone.id,
|
||||||
cls.services["netscaler_VPX"])
|
cls.services["netscaler"])
|
||||||
cls._cleanup.append(cls.netscaler)
|
cls._cleanup.append(cls.netscaler)
|
||||||
cls.ns_configured = True
|
cls.ns_configured = True
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|||||||
@ -1376,3 +1376,21 @@ def isNetworkDeleted(apiclient, networkid, timeout=600):
|
|||||||
time.sleep(60)
|
time.sleep(60)
|
||||||
#end while
|
#end while
|
||||||
return networkDeleted
|
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]
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user