Browse Source

DHCPv6 cases

Change-Id: I3e33222180e256fc309c76750a659e4da598cbef
changes/33/734133/3
pbharathbhu 1 month ago
parent
commit
e11ed7ebd3
1 changed files with 217 additions and 45 deletions
  1. +217
    -45
      vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_router.py

+ 217
- 45
vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_router.py View File

@@ -49,19 +49,25 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
def resource_setup(cls):
super(IPv6RoutersTest, cls).resource_setup()

def _create_ipv6_subnet(self, network, cidr, router_id=None, slaac=False):
def _create_ipv6_subnet(self, network, cidr, ipv6_ra_mode,
ipv6_address_mode,
router_id=None, slaac=False, enable_dhcp=False):
subnet_client = self.cmgr_adm.subnets_client
subnet_name = network['name'] + 'sub'
if slaac:
subnet = self.create_topology_subnet(subnet_name, network,
subnet = self.create_topology_subnet(
subnet_name, network,
subnets_client=subnet_client,
ip_version=6, ipv6_ra_mode='slaac',
ipv6_address_mode='slaac',
cidr=cidr, router_id=router_id)
else:
subnet = self.create_topology_subnet(subnet_name, network,
subnet = self.create_topology_subnet(
subnet_name, network,
subnets_client=subnet_client,
ip_version=6, enable_dhcp=False,
ipv6_address_mode=ipv6_address_mode,
ipv6_ra_mode=ipv6_ra_mode,
ip_version=6, enable_dhcp=True,
cidr=cidr, router_id=router_id)
return subnet

@@ -106,8 +112,8 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
"""
name = data_utils.rand_name("ipv6-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(name,
networks_client=networks_client)
network = self.create_topology_network(
name, networks_client=networks_client)
subnet = self._create_ipv6_subnet(network, cidr="5200::/64")
rtr_name = data_utils.rand_name("ipv6-rtr")
router = self.create_topology_router(
@@ -125,11 +131,12 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
"""
name = data_utils.rand_name("ipv6-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(name,
networks_client=networks_client)
network = self.create_topology_network(
name, networks_client=networks_client)
subnet_client = self.cmgr_adm.subnets_client
subnet_name = network['name'] + 'ipv4-sub'
subnet_ipv4 = self.create_topology_subnet(subnet_name, network,
subnet_ipv4 = self.create_topology_subnet(
subnet_name, network,
subnets_client=subnet_client,
cidr='20.20.0.0/16')
subnet = self._create_ipv6_subnet(network, cidr="5201::/64")
@@ -153,10 +160,10 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
"""
name = data_utils.rand_name("ipv6-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(name,
networks_client=networks_client)
network = self.create_topology_network(
name, networks_client=networks_client)
subnet = self._create_ipv6_subnet(network, cidr="4010::/64",
slaac=True)
slaac=True)
rtr_name = data_utils.rand_name("ipv6-rtr")
router = self.create_topology_router(
rtr_name, routers_client=self.cmgr_adm.routers_client)
@@ -173,15 +180,15 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
"""
name = data_utils.rand_name("ipv6-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(name,
networks_client=networks_client)
network = self.create_topology_network(
name, networks_client=networks_client)
subnet_client = self.cmgr_adm.subnets_client
subnet_name = network['name'] + 'ipv4-sub'
subnet_ipv4 = self.create_topology_subnet(subnet_name, network,
subnets_client=subnet_client,
subnet_ipv4 = self.create_topology_subnet(
subnet_name, network, subnets_client=subnet_client,
cidr='20.20.0.0/16')
subnet = self._create_ipv6_subnet(network, cidr="4011::/64",
slaac=True)
slaac=True)
rtr_name = data_utils.rand_name("ipv6-rtr")
router = self.create_topology_router(
rtr_name, routers_client=self.cmgr_adm.routers_client)
@@ -202,14 +209,14 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
"""
name = data_utils.rand_name("ipv6-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(name,
networks_client=networks_client)
network = self.create_topology_network(
name, networks_client=networks_client)
subnet = self._create_ipv6_subnet(network, cidr="4012::/64",
slaac=True)
network_1 = self.create_topology_network(name,
networks_client=networks_client)
slaac=True)
network_1 = self.create_topology_network(
name, networks_client=networks_client)
subnet_1 = self._create_ipv6_subnet(network_1, cidr="4013::/64",
slaac=True)
slaac=True)
rtr_name = data_utils.rand_name("ipv6-rtr")
router = self.create_topology_router(
rtr_name, routers_client=self.cmgr_adm.routers_client)
@@ -230,18 +237,18 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
"""
name = data_utils.rand_name("ipv6-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(name,
networks_client=networks_client)
network = self.create_topology_network(
name, networks_client=networks_client)
subnet_client = self.cmgr_adm.subnets_client
subnet_name = network['name'] + 'ipv4-sub'
subnet_ipv4 = self.create_topology_subnet(subnet_name, network,
subnets_client=subnet_client,
subnet_ipv4 = self.create_topology_subnet(
subnet_name, network, subnets_client=subnet_client,
cidr='20.21.0.0/16')
subnet = self._create_ipv6_subnet(network, cidr="4200::/64")
network_1 = self.create_topology_network(name,
networks_client=networks_client)
subnet_ipv4_1 = self.create_topology_subnet(subnet_name, network_1,
subnets_client=subnet_client,
network_1 = self.create_topology_network(
name, networks_client=networks_client)
subnet_ipv4_1 = self.create_topology_subnet(
subnet_name, network_1, subnets_client=subnet_client,
cidr='20.22.0.0/16')
subnet_1 = self._create_ipv6_subnet(network_1, cidr="4201::/64")
rtr_name = data_utils.rand_name("ipv6-rtr")
@@ -272,22 +279,22 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
"""
name = data_utils.rand_name("dual-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(name,
networks_client=networks_client)
network = self.create_topology_network(
name, networks_client=networks_client)
subnet_client = self.cmgr_adm.subnets_client
subnet_name = network['name'] + 'ipv4-sub'
subnet_ipv4 = self.create_topology_subnet(subnet_name, network,
subnets_client=subnet_client,
subnet_ipv4 = self.create_topology_subnet(
subnet_name, network, subnets_client=subnet_client,
cidr='20.21.0.0/16')
subnet = self._create_ipv6_subnet(network, cidr="4012::/64",
slaac=True)
network_1 = self.create_topology_network(name,
networks_client=networks_client)
subnet_ipv4_1 = self.create_topology_subnet(subnet_name, network_1,
subnets_client=subnet_client,
slaac=True)
network_1 = self.create_topology_network(
name, networks_client=networks_client)
subnet_ipv4_1 = self.create_topology_subnet(
subnet_name, network_1, subnets_client=subnet_client,
cidr='20.22.0.0/16')
subnet_1 = self._create_ipv6_subnet(network_1, cidr="4013::/64",
slaac=True)
slaac=True)
rtr_name = data_utils.rand_name("ipv6-rtr")
router = self.create_topology_router(
rtr_name, routers_client=self.cmgr_adm.routers_client)
@@ -350,8 +357,8 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
"nexthop": next_hop
}]
router_id = router_state['id']
router = self.cmgr_adm.routers_client.update_router(router_id,
routes=routes)['router']
router = self.cmgr_adm.routers_client.update_router(
router_id, routes=routes)['router']
self.assertEqual(router['routes'][0]['nexthop'], next_hop)
self.assertEqual(router['routes'][0]['destination'], dest)
self.cmgr_adm.routers_client.update_router(router_id, routes=[])
@@ -376,8 +383,8 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
"nexthop": next_hop
}]
router_id = router_state['id']
router = self.cmgr_adm.routers_client.update_router(router_id,
routes=routes)['router']
router = self.cmgr_adm.routers_client.update_router(
router_id, routes=routes)['router']
self.assertEqual(router['routes'][0]['nexthop'], next_hop)
self.assertEqual(router['routes'][0]['destination'], dest)
self.cmgr_adm.routers_client.update_router(router_id, routes=[])
@@ -470,3 +477,168 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
self.assertRaises(exceptions.Conflict,
self.cmgr_adm.routers_client.delete_router,
router['id'])

@decorators.attr(type=['nsxv3', 'positive'])
@decorators.idempotent_id('85235d0f-89b5-48a0-a3ed-d1bd21be6b94')
def test_multiple_dhcpv6_stateful_downlink_interface_rtr(self):
"""Test creating multiple dhcpv6 subnets attached
to router downlink interface
"""
name = data_utils.rand_name("ipv6-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(
name, networks_client=networks_client)
subnet = self._create_ipv6_subnet(
network, ipv6_ra_mode="dhcpv6-stateful",
ipv6_address_mode="dhcpv6-stateful", enable_dhcp=True,
cidr="4012::/64")
network_1 = self.create_topology_network(
name, networks_client=networks_client)
subnet_1 = self._create_ipv6_subnet(
network_1, ipv6_ra_mode="dhcpv6-stateful",
ipv6_address_mode="dhcpv6-stateful", enable_dhcp=True,
cidr="4013::/64")
rtr_name = data_utils.rand_name("ipv6-rtr")
router = self.create_topology_router(
rtr_name, routers_client=self.cmgr_adm.routers_client)
interface = self.add_router_interface(
router_client=self.cmgr_adm.routers_client,
router_id=router['id'], subnet_id=subnet['id'])
self.assertEqual(subnet['id'], interface['subnet_id'])
interface = self.add_router_interface(
router_client=self.cmgr_adm.routers_client,
router_id=router['id'], subnet_id=subnet_1['id'])
self.assertEqual(subnet_1['id'], interface['subnet_id'])

@decorators.attr(type=['nsxv3', 'positive'])
@decorators.idempotent_id('85235d0f-89b5-48a0-a3ed-d1bd21be6b94')
def test_multiple_dhcpv6_stateless_downlink_interface_rtr(self):
"""Test creating multiple dhcpv6 subnets attached
to router downlink interface
"""
name = data_utils.rand_name("ipv6-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(
name, networks_client=networks_client)
mode = "dhcpv6-stateless"
subnet = self._create_ipv6_subnet(network,
ipv6_ra_mode=mode,
ipv6_address_mode=mode,
enable_dhcp=True,
cidr="4012::/64")
network_1 = self.create_topology_network(
name, networks_client=networks_client)
mode = "dhcpv6-stateless"
subnet_1 = self._create_ipv6_subnet(network_1,
ipv6_ra_mode=mode,
ipv6_address_mode=mode,
enable_dhcp=True,
cidr="4013::/64")
rtr_name = data_utils.rand_name("ipv6-rtr")
router = self.create_topology_router(
rtr_name, routers_client=self.cmgr_adm.routers_client)
interface = self.add_router_interface(
router_client=self.cmgr_adm.routers_client,
router_id=router['id'], subnet_id=subnet['id'])
self.assertEqual(subnet['id'], interface['subnet_id'])
interface = self.add_router_interface(
router_client=self.cmgr_adm.routers_client,
router_id=router['id'], subnet_id=subnet_1['id'])
self.assertEqual(subnet_1['id'], interface['subnet_id'])

@decorators.attr(type=['nsxv3', 'positive'])
@decorators.idempotent_id('85235d0f-89b5-48a0-a3ed-d1bd21be6b94')
def test_multiple_dhcpv6_heterogeneous_downlink_interface_rtr(self):
"""Test creating multiple dhcpv6 subnets attached
to router downlink interface
"""
name = data_utils.rand_name("ipv6-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(
name, networks_client=networks_client)
subnet = self._create_ipv6_subnet(network,
ipv6_ra_mode="dhcpv6-stateful",
ipv6_address_mode="dhcpv6-stateful",
enable_dhcp=True,
cidr="4012::/64")
network_1 = self.create_topology_network(
name, networks_client=networks_client)
mode = "dhcpv6-stateless"
subnet_1 = self._create_ipv6_subnet(network_1,
ipv6_ra_mode=mode,
ipv6_address_mode=mode,
enable_dhcp=True,
cidr="4013::/64")
rtr_name = data_utils.rand_name("ipv6-rtr")
router = self.create_topology_router(
rtr_name, routers_client=self.cmgr_adm.routers_client)
interface = self.add_router_interface(
router_client=self.cmgr_adm.routers_client,
router_id=router['id'], subnet_id=subnet['id'])
self.assertEqual(subnet['id'], interface['subnet_id'])
self.assertRaises(exceptions.BadRequest,
self.add_router_interface,
router_client=self.cmgr_adm.routers_client,
router_id=router['id'],
subnet_id=subnet_1['id'])

@decorators.attr(type=['nsxv3', 'positive'])
@decorators.idempotent_id('8e7b1e28-e50e-458e-beb4-49ce5663c561')
def test_dhcpv6_stateful_ipv4_ipv6_downlink_interface_rtr(self):
"""Test creating ipv4 and ipv6 slaac subnets attached
to router downlink interface
"""
name = data_utils.rand_name("ipv6-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(name,
networks_client=networks_client)
subnet_client = self.cmgr_adm.subnets_client
subnet_name = network['name'] + 'ipv4-sub'
subnet_ipv4 = self.create_topology_subnet(subnet_name, network,
subnets_client=subnet_client,
cidr='20.20.0.0/16')
subnet = self._create_ipv6_subnet(network, cidr="4011::/64",
ipv6_ra_mode="dhcpv6-stateful",
ipv6_address_mode="dhcpv6-stateful")
rtr_name = data_utils.rand_name("ipv6-rtr")
router = self.create_topology_router(
rtr_name, routers_client=self.cmgr_adm.routers_client)
interface = self.add_router_interface(
router_client=self.cmgr_adm.routers_client,
router_id=router['id'], subnet_id=subnet_ipv4['id'])
self.assertEqual(subnet_ipv4['id'], interface['subnet_id'])
interface = self.add_router_interface(
router_client=self.cmgr_adm.routers_client,
router_id=router['id'], subnet_id=subnet['id'])
self.assertEqual(subnet['id'], interface['subnet_id'])

@decorators.attr(type=['nsxv3', 'positive'])
@decorators.idempotent_id('8e7b1e28-e50e-458e-beb4-49ce5663c561')
def test_dhcpv6_stateless_ipv4_ipv6_downlink_interface_rtr(self):
"""Test creating ipv4 and ipv6 slaac subnets attached
to router downlink interface
"""
name = data_utils.rand_name("ipv6-net")
networks_client = self.cmgr_adm.networks_client
network = self.create_topology_network(name,
networks_client=networks_client)
subnet_client = self.cmgr_adm.subnets_client
subnet_name = network['name'] + 'ipv4-sub'
subnet_ipv4 = self.create_topology_subnet(subnet_name, network,
subnets_client=subnet_client,
cidr='20.20.0.0/16')
mode = "dhcpv6-stateless"
subnet = self._create_ipv6_subnet(network, cidr="4011::/64",
ipv6_ra_mode=mode,
ipv6_address_mode=mode)
rtr_name = data_utils.rand_name("ipv6-rtr")
router = self.create_topology_router(
rtr_name, routers_client=self.cmgr_adm.routers_client)
interface = self.add_router_interface(
router_client=self.cmgr_adm.routers_client,
router_id=router['id'], subnet_id=subnet_ipv4['id'])
self.assertEqual(subnet_ipv4['id'], interface['subnet_id'])
interface = self.add_router_interface(
router_client=self.cmgr_adm.routers_client,
router_id=router['id'], subnet_id=subnet['id'])
self.assertEqual(subnet['id'], interface['subnet_id'])

Loading…
Cancel
Save