Browse Source

testcases to check static routes with dhcpv6 routers

Change-Id: I9e70353d8e5c27f80827cd14dcb896f7cbadcef0
changes/69/736469/1
pbharathbhu 2 weeks ago
parent
commit
7ee046b944
1 changed files with 84 additions and 2 deletions
  1. +84
    -2
      vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_router.py

+ 84
- 2
vmware_nsx_tempest_plugin/tests/nsxv3/scenario/test_ipv6_router.py View File

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

def _create_ipv6_subnet(self, network, cidr, ipv6_ra_mode,
ipv6_address_mode,
def _create_ipv6_subnet(self, network, cidr, ipv6_ra_mode=None,
ipv6_address_mode=None,
router_id=None, slaac=False, enable_dhcp=False):
subnet_client = self.cmgr_adm.subnets_client
subnet_name = network['name'] + 'sub'
@@ -104,6 +104,44 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
subnet_v6=subnet_v6)
return topology_dict

def create_topo_single_dhcpv6_network(
self, namestart, ipv6_address_mode,
ipv6_ra_mode, create_instance=True,
set_gateway=True, slaac=False,
**kwargs):
"""
Create Topo where 1 logical switches which is
connected via tier-1 router.
"""
rtr_name = data_utils.rand_name(name='tempest-router')
network_name = data_utils.rand_name(name='tempest-net')
subnet_name = data_utils.rand_name(name='tempest-subnet')
router_state = self.create_topology_router(rtr_name,
set_gateway=set_gateway,
**kwargs)
network_state = self.create_topology_network(network_name)
subnet_state = self.create_topology_subnet(subnet_name, network_state,
router_id=router_state["id"]
)
subnet_v6 = self._create_ipv6_subnet(
network_state, cidr="5200::/64", slaac=slaac,
ipv6_address_mode=ipv6_address_mode,
ipv6_ra_mode=ipv6_ra_mode,
router_id=router_state["id"])
if create_instance:
image_id = self.get_glance_image_id(["cirros", "esx"])
self.create_topology_instance(
"state_vm_1", [network_state],
create_floating_ip=True, image_id=image_id)
self.create_topology_instance(
"state_vm_2", [network_state],
create_floating_ip=True, image_id=image_id)
topology_dict = dict(router_state=router_state,
network_state=network_state,
subnet_state=subnet_state,
subnet_v6=subnet_v6)
return topology_dict

@decorators.attr(type=['nsxv3', 'positive'])
@decorators.idempotent_id('6526db57-c523-4879-b8ae-f50f0190f960')
def test_single_ipv6_downlink_interface_rtr(self):
@@ -642,3 +680,47 @@ class IPv6RoutersTest(feature_manager.FeatureManager):
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', 'negative'])
@decorators.idempotent_id('8cc317db-4bcd-4f56-821a-9040b4a9c740')
def test_update_router_nsxv3_with_dhcpv6_static_route_via_0_0(self):
"""
Check it should not allow to add static route on router with
::/0 next hop.
"""
kwargs = {"admin_state_up": "True"}
mode = "dhcpv6-stateless"
topology_dict = self.create_topo_single_dhcpv6_network(
"rtr_update", create_instance=False, set_gateway=False,
ipv6_ra_mode=mode, ipv6_address_mode=mode, **kwargs)
router_state = topology_dict['router_state']
routes = [{
"destination": "3700::/64",
"nexthop": "::/0"
}]
router_id = router_state['id']
self.assertRaises(exceptions.BadRequest,
self.cmgr_adm.routers_client.update_router,
router_id, routes=routes)

@decorators.attr(type=['nsxv3', 'negative'])
@decorators.idempotent_id('8cc317db-4bcd-4f56-821a-9040b4a9c740')
def test_update_router_nsxv3_with_dhcpv6_stateful_static_via_0_0(self):
"""
Check it should not allow to add static route on router with
::/0 next hop.
"""
kwargs = {"admin_state_up": "True"}
mode = "dhcpv6-stateful"
topology_dict = self.create_topo_single_dhcpv6_network(
"rtr_update", create_instance=False, set_gateway=False,
ipv6_ra_mode=mode, ipv6_address_mode=mode, **kwargs)
router_state = topology_dict['router_state']
routes = [{
"destination": "3700::/64",
"nexthop": "::/0"
}]
router_id = router_state['id']
self.assertRaises(exceptions.BadRequest,
self.cmgr_adm.routers_client.update_router,
router_id, routes=routes)

Loading…
Cancel
Save