mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-4776: New Tests for Netscaler as external LB provider in VPC
Signed-off-by: venkataswamybabu budumuru <venkataswamybabu.budumuru@citrix.com> (cherry picked from commit 76c85d0ce854aa7d868ba9e018382237c88fe42c)
This commit is contained in:
parent
3a999e70af
commit
2621602787
@ -27,7 +27,7 @@ from marvin.integration.lib.base import *
|
||||
from marvin.integration.lib.common import *
|
||||
from marvin.remoteSSHClient import remoteSSHClient
|
||||
import datetime
|
||||
|
||||
from ddt import ddt, data
|
||||
|
||||
class Services:
|
||||
"""Test VPC network services
|
||||
@ -96,6 +96,35 @@ class Services:
|
||||
"SourceNat": {"SupportedSourceNatTypes": "peraccount"},
|
||||
},
|
||||
},
|
||||
"network_offering_vpcNS": {
|
||||
"name": 'VPC Network offering',
|
||||
"displaytext": 'VPC Network off',
|
||||
"guestiptype": 'Isolated',
|
||||
"supportedservices": 'Vpn,Dhcp,Dns,SourceNat,PortForwarding,Lb,UserData,StaticNat,NetworkACL',
|
||||
"traffictype": 'GUEST',
|
||||
"availability": 'Optional',
|
||||
"useVpc": 'on',
|
||||
"serviceProviderList": {
|
||||
"Vpn": 'VpcVirtualRouter',
|
||||
"Dhcp": 'VpcVirtualRouter',
|
||||
"Dns": 'VpcVirtualRouter',
|
||||
"SourceNat": 'VpcVirtualRouter',
|
||||
"PortForwarding": 'VpcVirtualRouter',
|
||||
"Lb": 'Netscaler',
|
||||
"UserData": 'VpcVirtualRouter',
|
||||
"StaticNat": 'VpcVirtualRouter',
|
||||
"NetworkACL": 'VpcVirtualRouter'
|
||||
},
|
||||
"serviceCapabilityList": {
|
||||
"SourceNat": {
|
||||
"SupportedSourceNatTypes": "peraccount"
|
||||
},
|
||||
"lb": {
|
||||
"SupportedLbIsolation": "dedicated"
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
"network_off_shared": {
|
||||
"name": 'Shared Network offering',
|
||||
"displaytext": 'Shared Network offering',
|
||||
@ -116,6 +145,18 @@ class Services:
|
||||
"displaytext": "TestVPC",
|
||||
"cidr": '10.0.0.1/24'
|
||||
},
|
||||
"netscaler": {
|
||||
"ipaddress": '10.102.192.50',
|
||||
"username": 'nsroot',
|
||||
"password": 'nsroot',
|
||||
"networkdevicetype": 'NetscalerVPXLoadBalancer',
|
||||
"publicinterface": '1/3',
|
||||
"privateinterface": '1/4',
|
||||
"numretries": 2,
|
||||
"lbdevicededicated": True,
|
||||
"lbdevicecapacity": 50,
|
||||
"port": 22,
|
||||
},
|
||||
"network": {
|
||||
"name": "Test Network",
|
||||
"displaytext": "Test Network",
|
||||
@ -172,7 +213,7 @@ class Services:
|
||||
"timeout": 10,
|
||||
}
|
||||
|
||||
|
||||
@ddt
|
||||
class TestVPCNetwork(cloudstackTestCase):
|
||||
|
||||
@classmethod
|
||||
@ -199,12 +240,17 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
cls.services["service_offering"]
|
||||
)
|
||||
cls._cleanup.append(cls.service_offering)
|
||||
cls.vpc_off = VpcOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["vpc_offering"]
|
||||
)
|
||||
cls._cleanup.append(cls.vpc_off)
|
||||
cls.vpc_off.update(cls.api_client, state='Enabled')
|
||||
# Configure Netscaler device
|
||||
global NSconfigured
|
||||
|
||||
try:
|
||||
cls.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.services["netscaler"])
|
||||
cls._cleanup.append(cls.netscaler)
|
||||
NSconfigured = True
|
||||
except Exception as e:
|
||||
NSconfigured = False
|
||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
||||
|
||||
return
|
||||
|
||||
@classmethod
|
||||
@ -287,9 +333,10 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
)
|
||||
self.debug("VPC network validated - %s" % network.name)
|
||||
return
|
||||
|
||||
|
||||
@data("network_offering", "network_offering_vpcNS")
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
def test_01_create_network(self):
|
||||
def test_01_create_network(self, value):
|
||||
""" Test create network in VPC
|
||||
"""
|
||||
|
||||
@ -305,20 +352,26 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
# 5. Create a network using the network offering created in step2 as
|
||||
# part of this VPC.
|
||||
|
||||
self.debug("Creating a VPC offering..")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
if (value == "network_offering_vpcNS" and NSconfigured == False):
|
||||
self.skipTest('Netscaler not configured: skipping test')
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
if (value == "network_offering"):
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering',
|
||||
listall=True
|
||||
)
|
||||
else:
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering with Netscaler',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(vpc_off_list, list):
|
||||
vpc_off=vpc_off_list[0]
|
||||
self.debug("Creating a VPC with offering: %s" % vpc_off.id)
|
||||
|
||||
self.debug("creating a VPC network in the account: %s" %
|
||||
self.account.name)
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
vpc = VPC.create(
|
||||
self.apiclient,
|
||||
@ -332,7 +385,7 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
|
||||
self.network_offering = NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_offering"],
|
||||
self.services[value],
|
||||
conservemode=False
|
||||
)
|
||||
# Enable Network offering
|
||||
@ -380,11 +433,12 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
@data("network_offering", "network_offering_vpcNS")
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
def test_02_create_network_fail(self):
|
||||
def test_02_create_network_fail(self, value):
|
||||
""" Test create network in VPC mismatched services (Should fail)
|
||||
"""
|
||||
|
||||
|
||||
# Validate the following
|
||||
# 1. Create VPC Offering by specifying all supported Services
|
||||
# (Vpn,dhcpdns,UserData, SourceNat,Static NAT and PF,LB,NetworkAcl)
|
||||
@ -398,20 +452,26 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
# part of this VPC.
|
||||
# 6. Network creation should fail
|
||||
|
||||
self.debug("Creating a VPC offering..")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
if (value == "network_offering_vpcNS" and NSconfigured == False):
|
||||
self.skipTest('Netscaler not configured: skipping test')
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
|
||||
self.debug("creating a VPC network in the account: %s" %
|
||||
self.account.name)
|
||||
if (value == "network_offering"):
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering',
|
||||
listall=True
|
||||
)
|
||||
else:
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering with Netscaler',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(vpc_off_list, list):
|
||||
vpc_off=vpc_off_list[0]
|
||||
self.debug("Creating a VPC with offering: %s" % vpc_off.id)
|
||||
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
vpc = VPC.create(
|
||||
self.apiclient,
|
||||
@ -423,13 +483,13 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
)
|
||||
self.validate_vpc_network(vpc)
|
||||
|
||||
self.services["network_offering"]["supportedservices"] = 'SourceNat'
|
||||
self.services["network_offering"]["serviceProviderList"] = {
|
||||
#self.services[value]["supportedservices"] = 'SourceNat'
|
||||
self.services[value]["serviceProviderList"] = {
|
||||
"SourceNat": 'VirtualRouter', }
|
||||
|
||||
self.network_offering = NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_offering"],
|
||||
self.services[value],
|
||||
conservemode=False
|
||||
)
|
||||
# Enable Network offering
|
||||
@ -452,99 +512,9 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
@attr(tags=["netscaler", "intervlan"])
|
||||
def test_03_create_network_netscaler(self):
|
||||
""" Test create network using netscaler for LB
|
||||
"""
|
||||
|
||||
# Validate the following
|
||||
# 1. Create VPC Offering by specifying all supported Services
|
||||
# (Vpn,dhcpdns,UserData, SourceNat,Static NAT and PF,LB,NetworkAcl)
|
||||
# 2. Create a VPC using the above VPC offering
|
||||
# 3. Create a network offering with guest type="Isolated that has
|
||||
# LB services provided by Netscaler and all other services
|
||||
# provided by VPCVR and conserver mode is "ON"
|
||||
# 4. Create a VPC using the above VPC offering.
|
||||
# 5. Create a network using the network offering created in step2 as
|
||||
# part of this VPC
|
||||
|
||||
self.debug("Creating a VPC offering..")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
|
||||
self.debug("creating a VPC network in the account: %s" %
|
||||
self.account.name)
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
vpc = VPC.create(
|
||||
self.apiclient,
|
||||
self.services["vpc"],
|
||||
vpcofferingid=vpc_off.id,
|
||||
zoneid=self.zone.id,
|
||||
account=self.account.name,
|
||||
domainid=self.account.domainid
|
||||
)
|
||||
self.validate_vpc_network(vpc)
|
||||
|
||||
self.network_offering = NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_off_netscaler"],
|
||||
conservemode=False
|
||||
)
|
||||
# Enable Network offering
|
||||
self.network_offering.update(self.apiclient, state='Enabled')
|
||||
self.cleanup.append(self.network_offering)
|
||||
|
||||
# Creating network using the network offering created
|
||||
self.debug("Creating network with network offering: %s" %
|
||||
self.network_offering.id)
|
||||
network = Network.create(
|
||||
self.apiclient,
|
||||
self.services["network"],
|
||||
accountid=self.account.name,
|
||||
domainid=self.account.domainid,
|
||||
networkofferingid=self.network_offering.id,
|
||||
zoneid=self.zone.id,
|
||||
gateway='10.1.1.1',
|
||||
vpcid=vpc.id
|
||||
)
|
||||
self.debug("Created network with ID: %s" % network.id)
|
||||
self.debug(
|
||||
"Verifying list network response to check if network created?")
|
||||
networks = Network.list(
|
||||
self.apiclient,
|
||||
id=network.id,
|
||||
listall=True
|
||||
)
|
||||
self.assertEqual(
|
||||
isinstance(networks, list),
|
||||
True,
|
||||
"List networks should return a valid response"
|
||||
)
|
||||
nw = networks[0]
|
||||
|
||||
self.assertEqual(
|
||||
nw.networkofferingid,
|
||||
self.network_offering.id,
|
||||
"Network should be created from network offering - %s" %
|
||||
self.network_offering.id
|
||||
)
|
||||
self.assertEqual(
|
||||
nw.vpcid,
|
||||
vpc.id,
|
||||
"Network should be created in VPC: %s" % vpc.name
|
||||
)
|
||||
return
|
||||
|
||||
@data("network_offering", "network_offering_vpcNS")
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
def test_04_create_multiple_networks_with_lb(self):
|
||||
def test_04_create_multiple_networks_with_lb(self, value):
|
||||
""" Test create multiple networks with LB service (Should fail)
|
||||
"""
|
||||
|
||||
@ -559,20 +529,26 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
# 5. Create another network using the network offering created in
|
||||
# step3 as part of this VPC
|
||||
|
||||
self.debug("Creating a VPC offering..")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
if (value == "network_offering_vpcNS" and NSconfigured == False):
|
||||
self.skipTest('Netscaler not configured: skipping test')
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
if (value == "network_offering"):
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering',
|
||||
listall=True
|
||||
)
|
||||
else:
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering with Netscaler',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(vpc_off_list, list):
|
||||
vpc_off=vpc_off_list[0]
|
||||
self.debug("Creating a VPC with offering: %s" % vpc_off.id)
|
||||
|
||||
self.debug("creating a VPC network in the account: %s" %
|
||||
self.account.name)
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
vpc = VPC.create(
|
||||
self.apiclient,
|
||||
@ -586,7 +562,7 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
|
||||
self.network_offering = NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_offering"],
|
||||
self.services[value],
|
||||
conservemode=False
|
||||
)
|
||||
# Enable Network offering
|
||||
@ -664,20 +640,15 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
# 5. Create another network using the network offering created in
|
||||
# step3 as part of this VPC
|
||||
|
||||
self.debug("Creating a VPC offering..")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(vpc_off_list, list):
|
||||
vpc_off=vpc_off_list[0]
|
||||
self.debug("Creating a VPC with offering: %s" % vpc_off.id)
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
|
||||
self.debug("creating a VPC network in the account: %s" %
|
||||
self.account.name)
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
vpc = VPC.create(
|
||||
self.apiclient,
|
||||
@ -689,12 +660,30 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
)
|
||||
self.validate_vpc_network(vpc)
|
||||
|
||||
#with self.assertRaises(Exception):
|
||||
self.network_offering = NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_offering_vpcNS"],
|
||||
conservemode=False
|
||||
)
|
||||
# Enable Network offering
|
||||
self.network_offering.update(self.apiclient, state='Enabled')
|
||||
self.cleanup.append(self.network_offering)
|
||||
|
||||
# Creating network using the network offering created
|
||||
self.debug("Creating network with network offering: %s" %
|
||||
self.network_offering.id)
|
||||
with self.assertRaises(Exception):
|
||||
NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_off_netscaler"],
|
||||
conservemode=False
|
||||
)
|
||||
Network.create(
|
||||
self.apiclient,
|
||||
self.services["network"],
|
||||
accountid=self.account.name,
|
||||
domainid=self.account.domainid,
|
||||
networkofferingid=self.network_offering.id,
|
||||
zoneid=self.zone.id,
|
||||
gateway='10.1.1.1',
|
||||
vpcid=vpc.id
|
||||
)
|
||||
self.debug("Network creation failed")
|
||||
return
|
||||
|
||||
@ -907,9 +896,10 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
)
|
||||
self.debug("Network creation failed as VPC doesn't have LB service")
|
||||
return
|
||||
|
||||
|
||||
@data("network_off_shared", "network_offering_vpcNS")
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
def test_09_create_network_shared_nwoff(self):
|
||||
def test_09_create_network_shared_nwoff(self, value):
|
||||
""" Test create network with shared network offering
|
||||
"""
|
||||
|
||||
@ -923,20 +913,25 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
# 5. Create a network using the network offering created in step2
|
||||
# as part of this VPC
|
||||
|
||||
self.debug("Creating a VPC offering")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
if (value == "network_offering_vpcNS" and NSconfigured == False):
|
||||
self.skipTest('Netscaler not configured: skipping test')
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
if (value == "network_off_shared"):
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering',
|
||||
listall=True
|
||||
)
|
||||
else:
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering with Netscaler',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(vpc_off_list, list):
|
||||
vpc_off=vpc_off_list[0]
|
||||
self.debug("Creating a VPC with offering: %s" % vpc_off.id)
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
|
||||
self.debug("creating a VPC network in the account: %s" %
|
||||
self.account.name)
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
vpc = VPC.create(
|
||||
self.apiclient,
|
||||
@ -977,8 +972,9 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
self.debug("Network creation failed")
|
||||
return
|
||||
|
||||
@data("network_offering", "network_offering_vpcNS")
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
def test_10_create_network_with_conserve_mode(self):
|
||||
def test_10_create_network_with_conserve_mode(self, value):
|
||||
""" Test create network with conserve mode ON
|
||||
"""
|
||||
|
||||
@ -993,20 +989,25 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
# 5. Create a network using the network offering created in step2 as
|
||||
# part of this VPC
|
||||
|
||||
self.debug("Creating a VPC offering")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
if (value == "network_offering_vpcNS" and NSconfigured == False):
|
||||
self.skipTest('Netscaler not configured: skipping test')
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
if (value == "network_offering"):
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering',
|
||||
listall=True
|
||||
)
|
||||
else:
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering with Netscaler',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(vpc_off_list, list):
|
||||
vpc_off=vpc_off_list[0]
|
||||
self.debug("Creating a VPC with offering: %s" % vpc_off.id)
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
|
||||
self.debug("creating a VPC network in the account: %s" %
|
||||
self.account.name)
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
vpc = VPC.create(
|
||||
self.apiclient,
|
||||
@ -1023,13 +1024,14 @@ class TestVPCNetwork(cloudstackTestCase):
|
||||
with self.assertRaises(Exception):
|
||||
NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_offering"],
|
||||
self.services[value],
|
||||
conservemode=True
|
||||
)
|
||||
self.debug(
|
||||
"Network creation failed as VPC support nw with conserve mode OFF")
|
||||
return
|
||||
|
||||
@ddt
|
||||
class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
|
||||
@classmethod
|
||||
@ -1056,12 +1058,19 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
cls.services["service_offering"]
|
||||
)
|
||||
cls._cleanup.append(cls.service_offering)
|
||||
cls.vpc_off = VpcOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["vpc_offering"]
|
||||
)
|
||||
cls.vpc_off.update(cls.api_client, state='Enabled')
|
||||
cls._cleanup.append(cls.vpc_off)
|
||||
# Configure Netscaler device
|
||||
global NSconfigured
|
||||
|
||||
try:
|
||||
cls.netscaler = add_netscaler(cls.api_client, cls.zone.id, cls.services["netscaler"])
|
||||
cls._cleanup = [
|
||||
cls.netscaler
|
||||
]
|
||||
NSconfigured = True
|
||||
except Exception as e:
|
||||
NSconfigured = False
|
||||
raise Exception ("Warning: Exception in setUpClass: %s" % e)
|
||||
|
||||
return
|
||||
|
||||
@classmethod
|
||||
@ -1144,8 +1153,9 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
self.debug("VPC network validated - %s" % network.name)
|
||||
return
|
||||
|
||||
@data("network_offering", "network_offering_vpcNS")
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
def test_01_create_network_outside_range(self):
|
||||
def test_01_create_network_outside_range(self, value):
|
||||
""" Test create network outside cidr range of VPC
|
||||
"""
|
||||
|
||||
@ -1154,19 +1164,25 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
# 2. Add network1 with cidr - 10.2.1.1/24 to this VPC
|
||||
# 3. Network creation should fail.
|
||||
|
||||
self.debug("Creating a VPC offering")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
if (value == "network_offering_vpcNS" and NSconfigured == False):
|
||||
self.skipTest('Netscaler not configured: skipping test')
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
if (value == "network_offering"):
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering',
|
||||
listall=True
|
||||
)
|
||||
else:
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering with Netscaler',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(vpc_off_list, list):
|
||||
vpc_off=vpc_off_list[0]
|
||||
self.debug("Creating a VPC with offering: %s" % vpc_off.id)
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
|
||||
self.debug("creating a VPC network with cidr: 10.1.1.1/16")
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
vpc = VPC.create(
|
||||
self.apiclient,
|
||||
@ -1182,7 +1198,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
|
||||
self.network_offering = NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_offering"],
|
||||
self.services[value],
|
||||
conservemode=False
|
||||
)
|
||||
# Enable Network offering
|
||||
@ -1268,8 +1284,9 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
"Network creation failed as network cidr range is outside of vpc")
|
||||
return
|
||||
|
||||
@data("network_offering", "network_offering_vpcNS")
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
def test_03_create_network_inside_range(self):
|
||||
def test_03_create_network_inside_range(self, value):
|
||||
""" Test create network inside cidr range of VPC
|
||||
"""
|
||||
|
||||
@ -1278,17 +1295,24 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
# 2. Add network1 with cidr - 10.1.1.1/8 to this VPC
|
||||
# 3. Network creation should fail.
|
||||
|
||||
self.debug("Creating a VPC offering")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
if (value == "network_offering_vpcNS" and NSconfigured == False):
|
||||
self.skipTest('Netscaler not configured: skipping test')
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
if (value == "network_offering"):
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering',
|
||||
listall=True
|
||||
)
|
||||
else:
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering with Netscaler',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(vpc_off_list, list):
|
||||
vpc_off=vpc_off_list[0]
|
||||
self.debug("Creating a VPC with offering: %s" % vpc_off.id)
|
||||
|
||||
self.debug("creating a VPC network with cidr: 10.1.1.1/16")
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
@ -1306,7 +1330,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
|
||||
self.network_offering = NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_offering"],
|
||||
self.services[value],
|
||||
conservemode=False
|
||||
)
|
||||
# Enable Network offering
|
||||
@ -1333,8 +1357,9 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
"Network creation failed as network cidr range is inside of vpc")
|
||||
return
|
||||
|
||||
@data("network_offering", "network_offering_vpcNS")
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
def test_04_create_network_overlapping_range(self):
|
||||
def test_04_create_network_overlapping_range(self, value):
|
||||
""" Test create network overlapping cidr range of VPC
|
||||
"""
|
||||
|
||||
@ -1345,19 +1370,24 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
# 4. Add network3 with cidr - 10.1.1.1/26 to this VPC
|
||||
# 5. Network creation in step 3 & 4 should fail.
|
||||
self.services = Services().services
|
||||
if (value == "network_offering_vpcNS" and NSconfigured == False):
|
||||
self.skipTest('Netscaler not configured: skipping test')
|
||||
|
||||
self.debug("Creating a VPC offering")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
|
||||
if (value == "network_offering"):
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering',
|
||||
listall=True
|
||||
)
|
||||
else:
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering with Netscaler',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(vpc_off_list, list):
|
||||
vpc_off=vpc_off_list[0]
|
||||
self.debug("Creating a VPC with offering: %s" % vpc_off.id)
|
||||
self.debug("creating a VPC network with cidr: 10.1.1.1/16")
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
vpc = VPC.create(
|
||||
@ -1374,7 +1404,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
|
||||
self.network_offering = NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_offering"],
|
||||
self.services[value],
|
||||
conservemode=False
|
||||
)
|
||||
# Enable Network offering
|
||||
@ -1457,8 +1487,9 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
"Network creation failed as network range overlaps each other")
|
||||
return
|
||||
|
||||
@data("network_offering", "network_offering_vpcNS")
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
def test_05_create_network_diff_account(self):
|
||||
def test_05_create_network_diff_account(self, value):
|
||||
""" Test create network from different account in VPC
|
||||
"""
|
||||
|
||||
@ -1467,17 +1498,24 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
# 2. Add network1 with cidr - 10.1.1.1/24 to this VPC
|
||||
# 3. Network creation should fail.
|
||||
|
||||
self.debug("Creating a VPC offering")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
if (value == "network_offering_vpcNS" and NSconfigured == False):
|
||||
self.skipTest('Netscaler not configured: skipping test')
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
if (value == "network_offering"):
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering',
|
||||
listall=True
|
||||
)
|
||||
else:
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering with Netscaler',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(vpc_off_list, list):
|
||||
vpc_off=vpc_off_list[0]
|
||||
self.debug("Creating a VPC with offering: %s" % vpc_off.id)
|
||||
|
||||
self.debug("creating a VPC network with cidr: 10.1.1.1/16")
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
@ -1495,7 +1533,7 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
|
||||
self.network_offering = NetworkOffering.create(
|
||||
self.apiclient,
|
||||
self.services["network_offering"],
|
||||
self.services[value],
|
||||
conservemode=False
|
||||
)
|
||||
# Enable Network offering
|
||||
@ -1532,7 +1570,6 @@ class TestVPCNetworkRanges(cloudstackTestCase):
|
||||
"Network creation failed as VPC belongs to different account")
|
||||
return
|
||||
|
||||
|
||||
class TestVPCNetworkUpgrade(cloudstackTestCase):
|
||||
|
||||
@classmethod
|
||||
@ -1559,12 +1596,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
|
||||
cls.services["service_offering"]
|
||||
)
|
||||
cls._cleanup.append(cls.service_offering)
|
||||
cls.vpc_off = VpcOffering.create(
|
||||
cls.api_client,
|
||||
cls.services["vpc_offering"]
|
||||
)
|
||||
cls.vpc_off.update(cls.api_client, state='Enabled')
|
||||
cls._cleanup.append(cls.vpc_off)
|
||||
|
||||
return
|
||||
|
||||
@classmethod
|
||||
@ -1646,7 +1678,7 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
|
||||
)
|
||||
self.debug("VPC network validated - %s" % network.name)
|
||||
return
|
||||
|
||||
|
||||
@attr(tags=["advanced", "intervlan"])
|
||||
def test_01_network_services_upgrade(self):
|
||||
""" Test update Network that is part of a VPC to a network offering that has more services
|
||||
@ -1666,19 +1698,16 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
|
||||
# 8. Update network1 to NO2.
|
||||
|
||||
self.debug("Creating a VPC offering..")
|
||||
vpc_off = VpcOffering.create(
|
||||
self.apiclient,
|
||||
self.services["vpc_offering"]
|
||||
)
|
||||
|
||||
self.cleanup.append(vpc_off)
|
||||
self.validate_vpc_offering(vpc_off)
|
||||
vpc_off_list=VpcOffering.list(
|
||||
self.apiclient,
|
||||
name='Default VPC offering',
|
||||
listall=True
|
||||
)
|
||||
if isinstance(vpc_off_list, list):
|
||||
vpc_off=vpc_off_list[0]
|
||||
self.debug("Creating a VPC with offering: %s" % vpc_off.id)
|
||||
|
||||
self.debug("Enabling the VPC offering created")
|
||||
vpc_off.update(self.apiclient, state='Enabled')
|
||||
|
||||
self.debug("creating a VPC network in the account: %s" %
|
||||
self.account.name)
|
||||
self.services["vpc"]["cidr"] = '10.1.1.1/16'
|
||||
vpc = VPC.create(
|
||||
self.apiclient,
|
||||
@ -2112,7 +2141,6 @@ class TestVPCNetworkUpgrade(cloudstackTestCase):
|
||||
)
|
||||
return
|
||||
|
||||
|
||||
class TestVPCNetworkGc(cloudstackTestCase):
|
||||
|
||||
@classmethod
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user