mirror of
https://github.com/apache/cloudstack.git
synced 2025-10-26 08:42:29 +01:00
CLOUDSTACK-8336: Adding test for shared network restart, with and without cleanup
Signed-off-by: SrikanteswaraRao Talluri <talluri@apache.org>
This commit is contained in:
parent
694b723899
commit
02c7bc0201
@ -29,15 +29,17 @@ from marvin.lib.base import (Account,
|
|||||||
StaticNATRule,
|
StaticNATRule,
|
||||||
FireWallRule,
|
FireWallRule,
|
||||||
ServiceOffering,
|
ServiceOffering,
|
||||||
PublicIPAddress)
|
PublicIPAddress,
|
||||||
|
Router)
|
||||||
from marvin.lib.utils import (cleanup_resources,
|
from marvin.lib.utils import (cleanup_resources,
|
||||||
validateList)
|
validateList)
|
||||||
from marvin.lib.common import (get_domain,
|
from marvin.lib.common import (get_domain,
|
||||||
get_zone,
|
get_zone,
|
||||||
get_template,
|
get_template,
|
||||||
wait_for_cleanup,
|
get_free_vlan,
|
||||||
get_free_vlan)
|
wait_for_cleanup)
|
||||||
from marvin.codes import PASS
|
from marvin.codes import PASS
|
||||||
|
from ddt import ddt, data
|
||||||
import random
|
import random
|
||||||
import netaddr
|
import netaddr
|
||||||
|
|
||||||
@ -152,6 +154,7 @@ class Services:
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ddt
|
||||||
class TestSharedNetworks(cloudstackTestCase):
|
class TestSharedNetworks(cloudstackTestCase):
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
@ -293,10 +296,12 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
# 5. delete the admin account
|
# 5. delete the admin account
|
||||||
# Validations,
|
# Validations,
|
||||||
# 1. listAccounts name=admin-XABU1, state=enabled returns your account
|
# 1. listAccounts name=admin-XABU1, state=enabled returns your account
|
||||||
# 2. listPhysicalNetworks should return at least one active physical network
|
# 2. listPhysicalNetworks should return at least one active physical
|
||||||
# 3. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
|
# network
|
||||||
# 4. listNetworkOfferings - name=mysharedoffering, should list enabled
|
# 3. listNetworkOfferings - name=mysharedoffering , should list
|
||||||
# offering
|
# offering in disabled state
|
||||||
|
# 4. listNetworkOfferings - name=mysharedoffering, should list
|
||||||
|
# enabled offering
|
||||||
|
|
||||||
# Create an account
|
# Create an account
|
||||||
self.account = Account.create(
|
self.account = Account.create(
|
||||||
@ -432,9 +437,10 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
# 4. delete the admin account
|
# 4. delete the admin account
|
||||||
# Validations,
|
# Validations,
|
||||||
# 1. listAccounts name=admin-XABU1, state=enabled returns your account
|
# 1. listAccounts name=admin-XABU1, state=enabled returns your account
|
||||||
# 2. listPhysicalNetworks should return at least one active physical network
|
# 2. listPhysicalNetworks should return at least one active physical
|
||||||
# 3. createNetworkOffering fails - vlan should be specified in advanced
|
# network
|
||||||
# zone
|
# 3. createNetworkOffering fails - vlan should be specified in
|
||||||
|
# advanced zone
|
||||||
|
|
||||||
# Create an account
|
# Create an account
|
||||||
self.account = Account.create(
|
self.account = Account.create(
|
||||||
@ -502,10 +508,12 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
conservemode=False
|
conservemode=False
|
||||||
)
|
)
|
||||||
self.fail(
|
self.fail(
|
||||||
"Network offering got created with vlan as False in advance mode and shared guest type, which is invalid case.")
|
"Network offering got created with vlan as False in advance\
|
||||||
|
mode and shared guest type, which is invalid case.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Network Offering creation failed with vlan as False in advance mode and shared guest type. Exception: %s" %
|
"Network Offering creation failed with vlan as False\
|
||||||
|
in advance mode and shared guest type. Exception: %s" %
|
||||||
e)
|
e)
|
||||||
|
|
||||||
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
||||||
@ -525,9 +533,10 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
# 4. delete the admin account
|
# 4. delete the admin account
|
||||||
# Validations,
|
# Validations,
|
||||||
# 1. listAccounts name=admin-XABU1, state=enabled returns your account
|
# 1. listAccounts name=admin-XABU1, state=enabled returns your account
|
||||||
# 2. listPhysicalNetworks should return at least one active physical network
|
# 2. listPhysicalNetworks should return at least one active physical
|
||||||
# 3. createNetworkOffering fails - ip ranges should be specified when
|
# network
|
||||||
# creating shared network offering
|
# 3. createNetworkOffering fails - ip ranges should be specified when
|
||||||
|
# creating shared network offering
|
||||||
|
|
||||||
# Create an account
|
# Create an account
|
||||||
self.account = Account.create(
|
self.account = Account.create(
|
||||||
@ -595,12 +604,14 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
conservemode=False
|
conservemode=False
|
||||||
)
|
)
|
||||||
self.fail(
|
self.fail(
|
||||||
"Network offering got created with vlan as True and ip ranges as False in advance mode and with shared guest type, which is invalid case.")
|
"Network offering got created with vlan as True and ip ranges\
|
||||||
|
as False in advance mode and with shared guest type,\
|
||||||
|
which is invalid case.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Network Offering creation failed with vlan as true and ip ranges as False in advance mode and with shared guest type.\
|
"Network Offering creation failed with vlan as true and ip\
|
||||||
Exception : %s" %
|
ranges as False in advance mode and with shared guest type.\
|
||||||
e)
|
Exception : %s" % e)
|
||||||
|
|
||||||
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
||||||
def test_createSharedNetwork_All(self):
|
def test_createSharedNetwork_All(self):
|
||||||
@ -621,19 +632,27 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
# - name = mysharednetwork, displaytext = mysharednetwork
|
# - name = mysharednetwork, displaytext = mysharednetwork
|
||||||
# - vlan = 123 (say)
|
# - vlan = 123 (say)
|
||||||
# - networkofferingid = <mysharedoffering>
|
# - networkofferingid = <mysharedoffering>
|
||||||
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
|
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200
|
||||||
|
# - netmask=255.255.255.0
|
||||||
# - scope = all
|
# - scope = all
|
||||||
# 6. create User account - user-ASJDK
|
# 6. create User account - user-ASJDK
|
||||||
# 7. deployVirtualMachine in this account and in admin account & within networkid = <mysharednetwork>
|
# 7. deployVirtualMachine in this account and in admin account &
|
||||||
|
# within networkid = <mysharednetwork>
|
||||||
# 8. delete the admin account and the user account
|
# 8. delete the admin account and the user account
|
||||||
# Validations,
|
# Validations,
|
||||||
# 1. listAccounts name=admin-XABU1, state=enabled returns your account
|
# 1. listAccounts name=admin-XABU1, state=enabled returns account
|
||||||
# 2. listPhysicalNetworks should return at least one active physical network
|
# 2. listPhysicalNetworks should return at least one active
|
||||||
# 3. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
|
# physical network
|
||||||
# 4. listNetworkOfferings - name=mysharedoffering, should list enabled offering
|
# 3. listNetworkOfferings - name=mysharedoffering , should list
|
||||||
# 5. listNetworks - name = mysharednetwork should list the successfully created network, verify the guestIp ranges and CIDR are as given in the createNetwork call
|
# offering in disabled state
|
||||||
|
# 4. listNetworkOfferings - name=mysharedoffering, should list
|
||||||
|
# enabled offering
|
||||||
|
# 5. listNetworks - name = mysharednetwork should list the
|
||||||
|
# successfully created network, verify the guestIp ranges and
|
||||||
|
# CIDR are as given in the createNetwork call
|
||||||
# 6. No checks reqd
|
# 6. No checks reqd
|
||||||
# 7. a. listVirtualMachines should show both VMs in running state in the user account and the admin account
|
# 7. a. listVirtualMachines should show both VMs in running state
|
||||||
|
# in the user account and the admin account
|
||||||
# b. VM's IPs shoud be in the range of the shared network ip ranges
|
# b. VM's IPs shoud be in the range of the shared network ip ranges
|
||||||
|
|
||||||
# Create admin account
|
# Create admin account
|
||||||
@ -808,7 +827,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_networks_response[0].specifyipranges,
|
list_networks_response[0].specifyipranges,
|
||||||
True,
|
True,
|
||||||
"The network is created with ip range but the flag is set to False.")
|
"The network is created with ip range but the flag is\
|
||||||
|
set to False.")
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Shared Network created for scope domain: %s" %
|
"Shared Network created for scope domain: %s" %
|
||||||
@ -850,7 +870,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.services["network"]["endip"])))
|
self.services["network"]["endip"])))
|
||||||
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
||||||
self.fail(
|
self.fail(
|
||||||
"Virtual machine ip should be from the ip range assigned to network created.")
|
"Virtual machine ip should be from the ip range assigned to\
|
||||||
|
network created.")
|
||||||
|
|
||||||
self.user_account_virtual_machine = VirtualMachine.create(
|
self.user_account_virtual_machine = VirtualMachine.create(
|
||||||
self.api_client,
|
self.api_client,
|
||||||
@ -887,7 +908,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.services["network"]["endip"])))
|
self.services["network"]["endip"])))
|
||||||
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
||||||
self.fail(
|
self.fail(
|
||||||
"Virtual machine ip should be from the ip range assigned to network created.")
|
"Virtual machine ip should be from the ip range assigned to\
|
||||||
|
network created.")
|
||||||
|
|
||||||
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
||||||
def test_createSharedNetwork_accountSpecific(self):
|
def test_createSharedNetwork_accountSpecific(self):
|
||||||
@ -909,16 +931,24 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
# - name = mysharednetwork, displaytext = mysharednetwork
|
# - name = mysharednetwork, displaytext = mysharednetwork
|
||||||
# - vlan = 123 (say)
|
# - vlan = 123 (say)
|
||||||
# - networkofferingid = <mysharedoffering>
|
# - networkofferingid = <mysharedoffering>
|
||||||
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
|
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200
|
||||||
|
# - netmask=255.255.255.0
|
||||||
# - scope = account, account = user-SOPJD, domain = ROOT
|
# - scope = account, account = user-SOPJD, domain = ROOT
|
||||||
# 6. deployVirtualMachine in this account and in admin account & within networkid = <mysharednetwork>
|
# 6. deployVirtualMachine in this account and in admin account
|
||||||
|
# & within networkid = <mysharednetwork>
|
||||||
# 7. delete the admin account and the user account
|
# 7. delete the admin account and the user account
|
||||||
# Validations,
|
# Validations,
|
||||||
# 1. listAccounts name=admin-XABU1 and user-SOPJD, state=enabled returns your account
|
# 1. listAccounts name=admin-XABU1 and user-SOPJD, state=enabled
|
||||||
# 2. listPhysicalNetworks should return at least one active physical network
|
# returns your account
|
||||||
# 3. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
|
# 2. listPhysicalNetworks should return at least one active
|
||||||
# 4. listNetworkOfferings - name=mysharedoffering, should list enabled offering
|
# physical network
|
||||||
# 5. listNetworks - name = mysharednetwork should list the successfully created network, verify the guestIp ranges and CIDR are as given in the createNetwork call
|
# 3. listNetworkOfferings - name=mysharedoffering , should list
|
||||||
|
# offering in disabled state
|
||||||
|
# 4. listNetworkOfferings - name=mysharedoffering, should list
|
||||||
|
# enabled offering
|
||||||
|
# 5. listNetworks - name = mysharednetwork should list the
|
||||||
|
# successfully created network, verify the guestIp ranges and CIDR
|
||||||
|
# are as given in the createNetwork call
|
||||||
# 6. VM deployed in admin account should FAIL to deploy
|
# 6. VM deployed in admin account should FAIL to deploy
|
||||||
# VM should be deployed in user account only
|
# VM should be deployed in user account only
|
||||||
# verify VM's IP is within shared network range
|
# verify VM's IP is within shared network range
|
||||||
@ -1096,7 +1126,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_networks_response[0].specifyipranges,
|
list_networks_response[0].specifyipranges,
|
||||||
True,
|
True,
|
||||||
"The network is created with ip range but the flag is set to False.")
|
"The network is created with ip range but the flag is\
|
||||||
|
set to False.")
|
||||||
|
|
||||||
self.debug("Network created: %s" % self.network.id)
|
self.debug("Network created: %s" % self.network.id)
|
||||||
|
|
||||||
@ -1110,11 +1141,13 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
serviceofferingid=self.service_offering.id
|
serviceofferingid=self.service_offering.id
|
||||||
)
|
)
|
||||||
self.fail(
|
self.fail(
|
||||||
"Virtual Machine got created in admin account with network created but the network used is of scope account and for user account.")
|
"Virtual Machine got created in admin account with network\
|
||||||
|
created but the network used is of scope account and for\
|
||||||
|
user account.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Virtual Machine creation failed as network used have scoped only for user account. Exception: %s" %
|
"Virtual Machine creation failed as network used have scoped\
|
||||||
e)
|
only for user account. Exception: %s" % e)
|
||||||
|
|
||||||
self.user_account_virtual_machine = VirtualMachine.create(
|
self.user_account_virtual_machine = VirtualMachine.create(
|
||||||
self.api_client,
|
self.api_client,
|
||||||
@ -1147,7 +1180,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.services["network"]["endip"])))
|
self.services["network"]["endip"])))
|
||||||
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
||||||
self.fail(
|
self.fail(
|
||||||
"Virtual machine ip should be from the ip range assigned to network created.")
|
"Virtual machine ip should be from the ip range assigned\
|
||||||
|
to network created.")
|
||||||
|
|
||||||
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
||||||
def test_createSharedNetwork_domainSpecific(self):
|
def test_createSharedNetwork_domainSpecific(self):
|
||||||
@ -1171,16 +1205,24 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
# - name = mysharednetwork, displaytext = mysharednetwork
|
# - name = mysharednetwork, displaytext = mysharednetwork
|
||||||
# - vlan = 123 (say)
|
# - vlan = 123 (say)
|
||||||
# - networkofferingid = <mysharedoffering>
|
# - networkofferingid = <mysharedoffering>
|
||||||
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
|
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200
|
||||||
|
# - netmask=255.255.255.0
|
||||||
# - scope = domain, domain = DOM
|
# - scope = domain, domain = DOM
|
||||||
# 6. deployVirtualMachine in this admin, domainadmin and user account & within networkid = <mysharednetwork>
|
# 6. deployVirtualMachine in this admin, domainadmin and user account
|
||||||
|
# & within networkid = <mysharednetwork>
|
||||||
# 7. delete all the accounts
|
# 7. delete all the accounts
|
||||||
# Validations,
|
# Validations,
|
||||||
# 1. listAccounts state=enabled returns your accounts, listDomains - DOM should be created
|
# 1. listAccounts state=enabled returns your accounts,
|
||||||
# 2. listPhysicalNetworks should return at least one active physical network
|
# listDomains - DOM should be created
|
||||||
# 3. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
|
# 2. listPhysicalNetworks should return at least one
|
||||||
# 4. listNetworkOfferings - name=mysharedoffering, should list enabled offering
|
# active physical network
|
||||||
# 5. listNetworks - name = mysharednetwork should list the successfully created network, verify the guestIp ranges and CIDR are as given in the createNetwork call
|
# 3. listNetworkOfferings - name=mysharedoffering , should list
|
||||||
|
# offering in disabled state
|
||||||
|
# 4. listNetworkOfferings - name=mysharedoffering, should list
|
||||||
|
# enabled offering
|
||||||
|
# 5. listNetworks - name = mysharednetwork should list the
|
||||||
|
# successfully created network, verify the guestIp ranges and
|
||||||
|
# CIDR are as given in the createNetwork call
|
||||||
# 6. VM should NOT be deployed in admin account
|
# 6. VM should NOT be deployed in admin account
|
||||||
# VM should be deployed in user account and domain admin account
|
# VM should be deployed in user account and domain admin account
|
||||||
# verify VM's IP are within shared network range
|
# verify VM's IP are within shared network range
|
||||||
@ -1424,7 +1466,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_networks_response[0].specifyipranges,
|
list_networks_response[0].specifyipranges,
|
||||||
True,
|
True,
|
||||||
"The network is created with ip range but the flag is set to False.")
|
"The network is created with ip range but the flag is\
|
||||||
|
set to False.")
|
||||||
|
|
||||||
self.debug("Shared Network created: %s" % self.network.id)
|
self.debug("Shared Network created: %s" % self.network.id)
|
||||||
|
|
||||||
@ -1438,11 +1481,13 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
serviceofferingid=self.service_offering.id
|
serviceofferingid=self.service_offering.id
|
||||||
)
|
)
|
||||||
self.fail(
|
self.fail(
|
||||||
"Virtual Machine got created in admin account with network specified but the network used is of scope domain and admin account is not part of this domain.")
|
"Virtual Machine got created in admin account with network\
|
||||||
|
specified but the network used is of scope domain and admin\
|
||||||
|
account is not part of this domain.")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Virtual Machine creation failed as network used have scoped only for DOM domain. Exception: %s" %
|
"Virtual Machine creation failed as network used have scoped\
|
||||||
e)
|
only for DOM domain. Exception: %s" % e)
|
||||||
|
|
||||||
self.domain_user_account_virtual_machine = VirtualMachine.create(
|
self.domain_user_account_virtual_machine = VirtualMachine.create(
|
||||||
self.api_client,
|
self.api_client,
|
||||||
@ -1476,7 +1521,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.services["network"]["endip"])))
|
self.services["network"]["endip"])))
|
||||||
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
||||||
self.fail(
|
self.fail(
|
||||||
"Virtual machine ip should be from the ip range assigned to network created.")
|
"Virtual machine ip should be from the ip range\
|
||||||
|
assigned to network created.")
|
||||||
|
|
||||||
self.domain_admin_account_virtual_machine = VirtualMachine.create(
|
self.domain_admin_account_virtual_machine = VirtualMachine.create(
|
||||||
self.api_client,
|
self.api_client,
|
||||||
@ -1510,7 +1556,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.services["network"]["endip"])))
|
self.services["network"]["endip"])))
|
||||||
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
||||||
self.fail(
|
self.fail(
|
||||||
"Virtual machine ip should be from the ip range assigned to network created.")
|
"Virtual machine ip should be from the ip range assigne\
|
||||||
|
to network created.")
|
||||||
|
|
||||||
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
||||||
def test_createSharedNetwork_projectSpecific(self):
|
def test_createSharedNetwork_projectSpecific(self):
|
||||||
@ -1533,16 +1580,24 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
# - name = mysharednetwork, displaytext = mysharednetwork
|
# - name = mysharednetwork, displaytext = mysharednetwork
|
||||||
# - vlan = 123 (say)
|
# - vlan = 123 (say)
|
||||||
# - networkofferingid = <mysharedoffering>
|
# - networkofferingid = <mysharedoffering>
|
||||||
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
|
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200
|
||||||
|
# - netmask=255.255.255.0
|
||||||
# - scope = project, project = proj-SLDJK
|
# - scope = project, project = proj-SLDJK
|
||||||
# 6. deployVirtualMachine in admin, project and user account & within networkid = <mysharednetwork>
|
# 6. deployVirtualMachine in admin, project and user account & within
|
||||||
|
# networkid = <mysharednetwork>
|
||||||
# 7. delete all the accounts
|
# 7. delete all the accounts
|
||||||
# Validations,
|
# Validations,
|
||||||
# 1. listAccounts state=enabled returns your accounts, listDomains - DOM should be created
|
# 1. listAccounts state=enabled returns your accounts, listDomains
|
||||||
# 2. listPhysicalNetworks should return at least one active physical network
|
# - DOM should be created
|
||||||
# 3. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
|
# 2. listPhysicalNetworks should return at least one active physical
|
||||||
# 4. listNetworkOfferings - name=mysharedoffering, should list enabled offering
|
# network
|
||||||
# 5. listNetworks - name = mysharednetwork should list the successfully created network, verify the guestIp ranges and CIDR are as given in the createNetwork call
|
# 3. listNetworkOfferings - name=mysharedoffering , should list
|
||||||
|
# offering in disabled state
|
||||||
|
# 4. listNetworkOfferings - name=mysharedoffering, should list
|
||||||
|
# enabled offering
|
||||||
|
# 5. listNetworks - name = mysharednetwork should list the
|
||||||
|
# successfully created network, verify the guestIp ranges
|
||||||
|
# and CIDR are as given in the createNetwork call
|
||||||
# 6. VM should NOT be deployed in admin account and user account
|
# 6. VM should NOT be deployed in admin account and user account
|
||||||
# VM should be deployed in project account only
|
# VM should be deployed in project account only
|
||||||
# verify VM's IP are within shared network range
|
# verify VM's IP are within shared network range
|
||||||
@ -1748,17 +1803,19 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_networks_response[0].specifyipranges,
|
list_networks_response[0].specifyipranges,
|
||||||
True,
|
True,
|
||||||
"The network is created with ip range but the flag is set to False.")
|
"The network is created with ip range but the flag is\
|
||||||
|
set to False")
|
||||||
|
|
||||||
self.debug("Shared Network created: %s" % self.network.id)
|
self.debug("Shared Network created: %s" % self.network.id)
|
||||||
|
|
||||||
with self.assertRaises(Exception):
|
with self.assertRaises(Exception):
|
||||||
self.project2_admin_account_virtual_machine = VirtualMachine.create(
|
self.project2_admin_account_virtual_machine =\
|
||||||
self.api_client,
|
VirtualMachine.create(
|
||||||
self.services["virtual_machine"],
|
self.api_client,
|
||||||
networkids=self.network.id,
|
self.services["virtual_machine"],
|
||||||
projectid=self.project2.id,
|
networkids=self.network.id,
|
||||||
serviceofferingid=self.service_offering.id)
|
projectid=self.project2.id,
|
||||||
|
serviceofferingid=self.service_offering.id)
|
||||||
self.debug("Deploying a vm to project other than the one in which \
|
self.debug("Deploying a vm to project other than the one in which \
|
||||||
network is created raised an Exception as expected")
|
network is created raised an Exception as expected")
|
||||||
self.project1_admin_account_virtual_machine = VirtualMachine.create(
|
self.project1_admin_account_virtual_machine = VirtualMachine.create(
|
||||||
@ -1791,10 +1848,12 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.services["network"]["endip"])))
|
self.services["network"]["endip"])))
|
||||||
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
if netaddr.IPAddress(unicode(vms[0].nic[0].ipaddress)) not in ip_range:
|
||||||
self.fail(
|
self.fail(
|
||||||
"Virtual machine ip should be from the ip range assigned to network created.")
|
"Virtual machine ip should be from the ip range assigned\
|
||||||
|
to network created.")
|
||||||
|
|
||||||
@unittest.skip(
|
@unittest.skip(
|
||||||
"skipped - This is a redundant case and also this is causing issue for rest fo the cases ")
|
"skipped - This is a redundant case and also this\
|
||||||
|
is causing issue for rest fo the cases ")
|
||||||
@attr(tags=["advanced", "advancedns", "NA"])
|
@attr(tags=["advanced", "advancedns", "NA"])
|
||||||
def test_createSharedNetwork_usedVlan(self):
|
def test_createSharedNetwork_usedVlan(self):
|
||||||
""" Test Shared Network with used vlan 01 """
|
""" Test Shared Network with used vlan 01 """
|
||||||
@ -1809,15 +1868,20 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
# - name = mysharednetwork, displaytext = mysharednetwork
|
# - name = mysharednetwork, displaytext = mysharednetwork
|
||||||
# - vlan = any vlan between 10-90
|
# - vlan = any vlan between 10-90
|
||||||
# - networkofferingid = <mysharedoffering>
|
# - networkofferingid = <mysharedoffering>
|
||||||
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
|
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200
|
||||||
|
# - netmask=255.255.255.0
|
||||||
# - scope = all
|
# - scope = all
|
||||||
# 6. delete admin account
|
# 6. delete admin account
|
||||||
# Validations,
|
# Validations,
|
||||||
# 1. listAccounts state=enabled returns your account
|
# 1. listAccounts state=enabled returns your account
|
||||||
# 2. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
|
# 2. listNetworkOfferings - name=mysharedoffering , should list
|
||||||
# 3. listNetworkOfferings - name=mysharedoffering, should list enabled offering
|
# offering in disabled state
|
||||||
# 4. listPhysicalNetworks should return at least one active physical network
|
# 3. listNetworkOfferings - name=mysharedoffering, should list
|
||||||
# 5. network creation should FAIL since VLAN is used for guest networks
|
# enabled offering
|
||||||
|
# 4. listPhysicalNetworks should return at least one active
|
||||||
|
# physical network
|
||||||
|
# 5. network creation should FAIL since VLAN is used for
|
||||||
|
# guest networks
|
||||||
|
|
||||||
# Create admin account
|
# Create admin account
|
||||||
self.admin_account = Account.create(
|
self.admin_account = Account.create(
|
||||||
@ -1943,8 +2007,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
shared_vlan)
|
shared_vlan)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Network creation failed because the valn id being used by another network. Exception: %s" %
|
"Network creation failed because the valn id being used by\
|
||||||
e)
|
another network. Exception: %s" % e)
|
||||||
|
|
||||||
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
||||||
def test_createSharedNetwork_usedVlan2(self):
|
def test_createSharedNetwork_usedVlan2(self):
|
||||||
@ -1960,18 +2024,23 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
# - name = mysharednetwork, displaytext = mysharednetwork
|
# - name = mysharednetwork, displaytext = mysharednetwork
|
||||||
# - vlan = any vlan beyond 10-90 (123 for eg)
|
# - vlan = any vlan beyond 10-90 (123 for eg)
|
||||||
# - networkofferingid = <mysharedoffering>
|
# - networkofferingid = <mysharedoffering>
|
||||||
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200, netmask=255.255.255.0
|
# - gw = 172.16.15.1, startip = 172.16.15.2 , endip = 172.16.15.200
|
||||||
|
# - netmask=255.255.255.0
|
||||||
# - scope = all
|
# - scope = all
|
||||||
# 6. createNetwork again with same VLAN but different IP ranges and gw
|
# 6. createNetwork again with same VLAN but different IP ranges and
|
||||||
|
# gateway
|
||||||
# 7. delete admin account
|
# 7. delete admin account
|
||||||
# Validations,
|
# Validations,
|
||||||
# 1. listAccounts state=enabled returns your account
|
# 1. listAccounts state=enabled returns your account
|
||||||
# 2. listNetworkOfferings - name=mysharedoffering , should list offering in disabled state
|
# 2. listNetworkOfferings - name=mysharedoffering , should list
|
||||||
# 3. listNetworkOfferings - name=mysharedoffering, should list enabled offering
|
# offering in disabled state
|
||||||
# 4. listPhysicalNetworks should return at least one active physical network
|
# 3. listNetworkOfferings - name=mysharedoffering, should list
|
||||||
|
# enabled offering
|
||||||
|
# 4. listPhysicalNetworks should return at least one active
|
||||||
|
# physical network
|
||||||
# 5. network creation shoud PASS
|
# 5. network creation shoud PASS
|
||||||
# 6. network creation should FAIL since VLAN is already used by
|
# 6. network creation should FAIL since VLAN is already used by
|
||||||
# previously created network
|
# previously created network
|
||||||
|
|
||||||
# Create admin account
|
# Create admin account
|
||||||
self.admin_account = Account.create(
|
self.admin_account = Account.create(
|
||||||
@ -2112,7 +2181,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_networks_response[0].specifyipranges,
|
list_networks_response[0].specifyipranges,
|
||||||
True,
|
True,
|
||||||
"The network is created with ip range but the flag is set to False.")
|
"The network is created with ip range but the flag is\
|
||||||
|
set to False.")
|
||||||
|
|
||||||
self.debug("Network created: %s" % self.network.id)
|
self.debug("Network created: %s" % self.network.id)
|
||||||
|
|
||||||
@ -2134,8 +2204,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
"Network got created with used vlan id, which is invalid")
|
"Network got created with used vlan id, which is invalid")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Network creation failed because the valn id being used by another network. Exception: %s" %
|
"Network creation failed because the valn id being used by\
|
||||||
e)
|
another network. Exception: %s" % e)
|
||||||
|
|
||||||
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
||||||
def test_deployVM_multipleSharedNetwork(self):
|
def test_deployVM_multipleSharedNetwork(self):
|
||||||
@ -2144,7 +2214,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
# Steps,
|
# Steps,
|
||||||
# 0. create a user account
|
# 0. create a user account
|
||||||
# 1. Create two shared Networks (scope=ALL, different IP ranges)
|
# 1. Create two shared Networks (scope=ALL, different IP ranges)
|
||||||
# 2. deployVirtualMachine in both the above networkids within the user account
|
# 2. deployVirtualMachine in both the above networkids within the
|
||||||
|
# user account
|
||||||
# 3. delete the user account
|
# 3. delete the user account
|
||||||
# Validations,
|
# Validations,
|
||||||
# 1. shared networks should be created successfully
|
# 1. shared networks should be created successfully
|
||||||
@ -2290,7 +2361,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_networks_response[0].specifyipranges,
|
list_networks_response[0].specifyipranges,
|
||||||
True,
|
True,
|
||||||
"The network is created with ip range but the flag is set to False.")
|
"The network is created with ip range but the flag is\
|
||||||
|
set to False.")
|
||||||
|
|
||||||
self.debug("Shared Network created: %s" % self.network.id)
|
self.debug("Shared Network created: %s" % self.network.id)
|
||||||
|
|
||||||
@ -2331,7 +2403,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_networks_response[0].specifyipranges,
|
list_networks_response[0].specifyipranges,
|
||||||
True,
|
True,
|
||||||
"The network is created with ip range but the flag is set to False.")
|
"The network is created with ip range but the flag is\
|
||||||
|
set to False.")
|
||||||
|
|
||||||
self.debug("Network created: %s" % self.network1.id)
|
self.debug("Network created: %s" % self.network1.id)
|
||||||
|
|
||||||
@ -2364,7 +2437,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.network_admin_account_virtual_machine.id)
|
self.network_admin_account_virtual_machine.id)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
self.network_admin_account_virtual_machine.nic[0].ipaddress is not None,
|
self.network_admin_account_virtual_machine.nic[0].ipaddress
|
||||||
|
is not None,
|
||||||
"ip should be assigned to running virtual machine")
|
"ip should be assigned to running virtual machine")
|
||||||
|
|
||||||
self.network1_admin_account_virtual_machine = VirtualMachine.create(
|
self.network1_admin_account_virtual_machine = VirtualMachine.create(
|
||||||
@ -2395,7 +2469,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.network1_admin_account_virtual_machine.id)
|
self.network1_admin_account_virtual_machine.id)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
self.network1_admin_account_virtual_machine.nic[0].ipaddress is not None,
|
self.network1_admin_account_virtual_machine.nic[0].ipaddress
|
||||||
|
is not None,
|
||||||
"ip should be assigned to running virtual machine")
|
"ip should be assigned to running virtual machine")
|
||||||
|
|
||||||
@attr(tags=["advanced", "advancedns"], required_hardware="true")
|
@attr(tags=["advanced", "advancedns"], required_hardware="true")
|
||||||
@ -2406,15 +2481,18 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
# 0. create a user account
|
# 0. create a user account
|
||||||
# 1. Create one shared Network (scope=ALL, different IP ranges)
|
# 1. Create one shared Network (scope=ALL, different IP ranges)
|
||||||
# 2. Create one Isolated Network
|
# 2. Create one Isolated Network
|
||||||
# 3. deployVirtualMachine in both the above networkids within the user account
|
# 3. deployVirtualMachine in both the above networkids within
|
||||||
# 4. apply FW rule and enable PF for port 22 for guest VM on isolated network
|
# the user account
|
||||||
|
# 4. apply FW rule and enable PF for port 22 for guest VM on
|
||||||
|
# isolated network
|
||||||
# 5. delete the user account
|
# 5. delete the user account
|
||||||
# Validations,
|
# Validations,
|
||||||
# 1. shared network should be created successfully
|
# 1. shared network should be created successfully
|
||||||
# 2. isolated network should be created successfully
|
# 2. isolated network should be created successfully
|
||||||
# 3.
|
# 3.
|
||||||
# a. VM should deploy successfully
|
# a. VM should deploy successfully
|
||||||
# b. VM should be deployed in both networks and have IP in both the networks
|
# b. VM should be deployed in both networks and have IP in both
|
||||||
|
# the networks
|
||||||
# 4. FW and PF should apply successfully, ssh into the VM should work
|
# 4. FW and PF should apply successfully, ssh into the VM should work
|
||||||
# over isolated network
|
# over isolated network
|
||||||
|
|
||||||
@ -2548,7 +2626,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_network_offerings_response[0].state,
|
list_network_offerings_response[0].state,
|
||||||
"Enabled",
|
"Enabled",
|
||||||
"The isolated network offering state should get updated to Enabled.")
|
"The isolated network offering state should get\
|
||||||
|
updated to Enabled.")
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
"Isolated Network Offering created: %s" %
|
"Isolated Network Offering created: %s" %
|
||||||
@ -2594,7 +2673,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_networks_response[0].specifyipranges,
|
list_networks_response[0].specifyipranges,
|
||||||
True,
|
True,
|
||||||
"The network is created with ip range but the flag is set to False.")
|
"The network is created with ip range but the flag is\
|
||||||
|
set to False.")
|
||||||
|
|
||||||
self.debug("Shared Network created: %s" % self.shared_network.id)
|
self.debug("Shared Network created: %s" % self.shared_network.id)
|
||||||
|
|
||||||
@ -2655,7 +2735,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.shared_network_admin_account_virtual_machine.id)
|
self.shared_network_admin_account_virtual_machine.id)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
self.shared_network_admin_account_virtual_machine.nic[0].ipaddress is not None,
|
self.shared_network_admin_account_virtual_machine.nic[0].ipaddress
|
||||||
|
is not None,
|
||||||
"ip should be assigned to running virtual machine")
|
"ip should be assigned to running virtual machine")
|
||||||
|
|
||||||
self.isolated_network_admin_account_virtual_machine = \
|
self.isolated_network_admin_account_virtual_machine = \
|
||||||
@ -2688,7 +2769,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.isolated_network_admin_account_virtual_machine.id)
|
self.isolated_network_admin_account_virtual_machine.id)
|
||||||
|
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
self.isolated_network_admin_account_virtual_machine.nic[0].ipaddress is not None,
|
self.isolated_network_admin_account_virtual_machine.nic[0].ipaddress
|
||||||
|
is not None,
|
||||||
"ip should be assigned to running virtual machine")
|
"ip should be assigned to running virtual machine")
|
||||||
|
|
||||||
self.debug(
|
self.debug(
|
||||||
@ -2756,16 +2838,19 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.fail(
|
self.fail(
|
||||||
"SSH Access failed for %s: %s" %
|
"SSH Access failed for %s: %s" %
|
||||||
(self.isolated_network_admin_account_virtual_machine.ipaddress, e))
|
(self.isolated_network_admin_account_virtual_machine.ipaddress,
|
||||||
|
e))
|
||||||
|
|
||||||
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
||||||
def test_networkWithsubdomainaccessTrue(self):
|
def test_networkWithsubdomainaccessTrue(self):
|
||||||
""" Test Shared Network with subdomainaccess=True """
|
""" Test Shared Network with subdomainaccess=True """
|
||||||
|
|
||||||
# Steps,
|
# Steps,
|
||||||
# 1. create Network using shared network offering for scope=Account and subdomainaccess=true.
|
# 1. create Network using shared network offering for scope=Account
|
||||||
|
# and subdomainaccess=true.
|
||||||
# Validations,
|
# Validations,
|
||||||
# (Expected) API should fail saying that subdomainaccess cannot be given when scope is Account
|
# (Expected) API should fail saying that subdomainaccess cannot be
|
||||||
|
# given when scope is Account
|
||||||
|
|
||||||
# Create admin account
|
# Create admin account
|
||||||
self.admin_account = Account.create(
|
self.admin_account = Account.create(
|
||||||
@ -2891,16 +2976,19 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.fail("Network creation should fail.")
|
self.fail("Network creation should fail.")
|
||||||
except:
|
except:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Network creation failed because subdomainaccess parameter was passed when scope was account.")
|
"Network creation failed because subdomainaccess parameter was\
|
||||||
|
passed when scope was account.")
|
||||||
|
|
||||||
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
@attr(tags=["advanced", "advancedns"], required_hardware="false")
|
||||||
def test_networkWithsubdomainaccessFalse(self):
|
def test_networkWithsubdomainaccessFalse(self):
|
||||||
""" Test shared Network with subdomainaccess=False """
|
""" Test shared Network with subdomainaccess=False """
|
||||||
|
|
||||||
# Steps,
|
# Steps,
|
||||||
# 1. create Network using shared network offering for scope=Account and subdomainaccess=false
|
# 1. create Network using shared network offering for scope=Account
|
||||||
# Validations,
|
# and subdomainaccess=false
|
||||||
# (Expected) API should fail saying that subdomainaccess cannot be given when scope is Account
|
# Validations,
|
||||||
|
# (Expected) API should fail saying that subdomainaccess cannot be
|
||||||
|
# given when scope is Account
|
||||||
|
|
||||||
# Create admin account
|
# Create admin account
|
||||||
self.admin_account = Account.create(
|
self.admin_account = Account.create(
|
||||||
@ -3026,7 +3114,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.fail("Network creation should fail.")
|
self.fail("Network creation should fail.")
|
||||||
except:
|
except:
|
||||||
self.debug(
|
self.debug(
|
||||||
"Network creation failed because subdomainaccess parameter was passed when scope was account.")
|
"Network creation failed because subdomainaccess parameter\
|
||||||
|
was passed when scope was account.")
|
||||||
|
|
||||||
@attr(tags=["advanced"], required_hardware="false")
|
@attr(tags=["advanced"], required_hardware="false")
|
||||||
def test_escalation_ES1621(self):
|
def test_escalation_ES1621(self):
|
||||||
@ -3039,12 +3128,17 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
Step3: Update the network offering to Enabled state
|
Step3: Update the network offering to Enabled state
|
||||||
Step4: list network offering
|
Step4: list network offering
|
||||||
Step5: Create network with above offering
|
Step5: Create network with above offering
|
||||||
Step6: List netwokrs and verify the network created in step5 in the response
|
Step6: List netwokrs and verify the network created in
|
||||||
Step7: Create another network with offering,vlan and ip range same as in step6
|
step5 in the response
|
||||||
|
Step7: Create another network with offering,vlan and ip range
|
||||||
|
same as in step6
|
||||||
Step8: Verify that network creationin Step7 should fail
|
Step8: Verify that network creationin Step7 should fail
|
||||||
Step9: Repeat step6 with diff vlan but same ip range and network offering
|
Step9: Repeat step6 with diff vlan but same ip range and network
|
||||||
Step10: List netwokrs and verify the network created in step9 in the response
|
offering
|
||||||
Step11: Dislable network offering for the cleanup to delete at the end of the test
|
Step10: List netwokrs and verify the network created in step9
|
||||||
|
in the response
|
||||||
|
Step11: Dislable network offering for the cleanup to delete at
|
||||||
|
the end of the test
|
||||||
"""
|
"""
|
||||||
# Creating Admin account
|
# Creating Admin account
|
||||||
self.admin_account = Account.create(
|
self.admin_account = Account.create(
|
||||||
@ -3120,7 +3214,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
PASS,
|
PASS,
|
||||||
status[0],
|
status[0],
|
||||||
"listNetworkOfferings returned invalid object in response after enabling it."
|
"listNetworkOfferings returned invalid object in\
|
||||||
|
response after enabling it."
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_network_offerings_response[0].state,
|
list_network_offerings_response[0].state,
|
||||||
@ -3153,7 +3248,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_networks_response[0].specifyipranges,
|
list_networks_response[0].specifyipranges,
|
||||||
True,
|
True,
|
||||||
"The network is created with ip range but the flag is set to False.")
|
"The network is created with ip range but the flag is\
|
||||||
|
set to False.")
|
||||||
self.debug(
|
self.debug(
|
||||||
"Shared Network created for scope domain: %s" %
|
"Shared Network created for scope domain: %s" %
|
||||||
self.network.id)
|
self.network.id)
|
||||||
@ -3167,7 +3263,8 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
self.cleanup_networks.append(self.network1)
|
self.cleanup_networks.append(self.network1)
|
||||||
self.fail(
|
self.fail(
|
||||||
"CS is allowing to create shared network with ip range and vlan same as used by another shared network")
|
"CS is allowing to create shared network with ip range and\
|
||||||
|
vlan same as used by another shared network")
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
self.debug("Network Creation Exception Raised: %s" % e)
|
self.debug("Network Creation Exception Raised: %s" % e)
|
||||||
# Create another shared network with overlapped ip range but different
|
# Create another shared network with overlapped ip range but different
|
||||||
@ -3192,13 +3289,14 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
self.assertEquals(
|
self.assertEquals(
|
||||||
PASS,
|
PASS,
|
||||||
status[0],
|
status[0],
|
||||||
"listNetworks returned invalid object in response after creating with overlapped ip range in diff vlan."
|
"listNetworks returned invalid object in response after\
|
||||||
|
creating with overlapped ip range in diff vlan."
|
||||||
)
|
)
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
list_networks_response[0].specifyipranges,
|
list_networks_response[0].specifyipranges,
|
||||||
True,
|
True,
|
||||||
"The network is created with ip range but the flag is set to False after creating with overlapped ip range in diff vlan."
|
"The network is created with ip range but the flag is set to\
|
||||||
)
|
False after creating with overlapped ip range in diff vlan")
|
||||||
self.debug(
|
self.debug(
|
||||||
"Shared Network created for scope domain: %s" %
|
"Shared Network created for scope domain: %s" %
|
||||||
self.network2.id)
|
self.network2.id)
|
||||||
@ -3211,3 +3309,113 @@ class TestSharedNetworks(cloudstackTestCase):
|
|||||||
)
|
)
|
||||||
self.cleanup_networks.append(self.shared_network_offering)
|
self.cleanup_networks.append(self.shared_network_offering)
|
||||||
return
|
return
|
||||||
|
|
||||||
|
@data(True, False)
|
||||||
|
@attr(tags=["advanced", "advancedns", "dvs"], required_hardware="false")
|
||||||
|
def test_restart_network(self, cleanup):
|
||||||
|
""" Test restart shared Network
|
||||||
|
|
||||||
|
# Steps
|
||||||
|
# 1. Create a shared network in an account
|
||||||
|
# 2. Deploy a VM in the network
|
||||||
|
# 3. Restart the network with cleanup true and false
|
||||||
|
# 4. List the router for the network and verify that publicip of
|
||||||
|
the router remain the same
|
||||||
|
"""
|
||||||
|
|
||||||
|
# Create admin account
|
||||||
|
account = Account.create(
|
||||||
|
self.api_client,
|
||||||
|
self.services["account"],
|
||||||
|
domainid=self.domain.id
|
||||||
|
)
|
||||||
|
self.cleanup_accounts.append(account)
|
||||||
|
|
||||||
|
physical_network, shared_vlan = get_free_vlan(
|
||||||
|
self.api_client, self.zone.id)
|
||||||
|
if shared_vlan is None:
|
||||||
|
self.fail("Failed to get free vlan id for shared network")
|
||||||
|
|
||||||
|
self.debug("Physical network found: %s" % physical_network.id)
|
||||||
|
|
||||||
|
self.services["network_offering"]["specifyVlan"] = "True"
|
||||||
|
self.services["network_offering"]["specifyIpRanges"] = "True"
|
||||||
|
|
||||||
|
# Create Network Offering
|
||||||
|
shared_network_offering = NetworkOffering.create(
|
||||||
|
self.api_client,
|
||||||
|
self.services["network_offering"],
|
||||||
|
conservemode=False
|
||||||
|
)
|
||||||
|
|
||||||
|
# Update network offering state from disabled to enabled.
|
||||||
|
NetworkOffering.update(
|
||||||
|
shared_network_offering,
|
||||||
|
self.api_client,
|
||||||
|
id=shared_network_offering.id,
|
||||||
|
state="enabled"
|
||||||
|
)
|
||||||
|
#self._cleanup.append(shared_network_offering)
|
||||||
|
|
||||||
|
# create network using the shared network offering created
|
||||||
|
self.services["network"]["acltype"] = "Domain"
|
||||||
|
self.services["network"][
|
||||||
|
"networkofferingid"] = shared_network_offering.id
|
||||||
|
self.services["network"]["physicalnetworkid"] = physical_network.id
|
||||||
|
self.services["network"]["vlan"] = shared_vlan
|
||||||
|
|
||||||
|
shared_network = Network.create(
|
||||||
|
self.api_client,
|
||||||
|
self.services["network"],
|
||||||
|
networkofferingid=shared_network_offering.id,
|
||||||
|
zoneid=self.zone.id,
|
||||||
|
)
|
||||||
|
|
||||||
|
self.cleanup_networks.append(shared_network)
|
||||||
|
|
||||||
|
self.debug(
|
||||||
|
"Shared Network created for scope domain: %s" %
|
||||||
|
shared_network.id)
|
||||||
|
|
||||||
|
VirtualMachine.create(
|
||||||
|
self.api_client,
|
||||||
|
self.services["virtual_machine"],
|
||||||
|
networkids=shared_network.id,
|
||||||
|
serviceofferingid=self.service_offering.id
|
||||||
|
)
|
||||||
|
|
||||||
|
list_router_response = Router.list(
|
||||||
|
self.api_client,
|
||||||
|
networkid=shared_network.id,
|
||||||
|
listall=True
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
validateList(list_router_response)[0],
|
||||||
|
PASS,
|
||||||
|
"Router list validation failed"
|
||||||
|
)
|
||||||
|
router = list_router_response[0]
|
||||||
|
# Store old values before restart
|
||||||
|
old_publicip = router.publicip
|
||||||
|
|
||||||
|
shared_network.restart(self.api_client, cleanup=cleanup)
|
||||||
|
|
||||||
|
# Get router details after restart
|
||||||
|
list_router_response = Router.list(
|
||||||
|
self.api_client,
|
||||||
|
networkid=shared_network.id,
|
||||||
|
listall=True
|
||||||
|
)
|
||||||
|
self.assertEqual(
|
||||||
|
validateList(list_router_response)[0],
|
||||||
|
PASS,
|
||||||
|
"Router list validation failed"
|
||||||
|
)
|
||||||
|
router = list_router_response[0]
|
||||||
|
|
||||||
|
self.assertEqual(
|
||||||
|
router.publicip,
|
||||||
|
old_publicip,
|
||||||
|
"Public IP of the router should remain same after network restart"
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user