[bgpvpn] Extend delete scenarious
* Add bgpvpn delete port association
* Add delete bgpvpn with port association
Related-Prod: PRODX-25126
Change-Id: If5669d805eae70f122c71fa709824285f82b1ee4
diff --git a/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py b/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py
index 9a7ac4e..f14018b 100644
--- a/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py
+++ b/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py
@@ -27,6 +27,7 @@
from tempest.lib.common.utils import data_utils
from tempest.lib.common.utils import test_utils
from tempest.lib import decorators
+import testtools
from neutron_tempest_plugin.bgpvpn import base
from neutron_tempest_plugin.bgpvpn.scenario import manager
@@ -741,6 +742,101 @@
self._check_l3_bgpvpn_by_specific_ip(
should_succeed=False, to_server_ip=ip)
+ @decorators.idempotent_id('910e6d89-5703-4a5e-a5c7-0743ddffbeb7')
+ @utils.services('compute', 'network')
+ @utils.requires_ext(extension='bgpvpn-routes-control', service='network')
+ def test_bgpvpn_port_association_create_and_delete_association(self):
+ """This test checks port association in BGPVPN.
+
+ 1. Create networks A and B with their respective subnets
+ 2. Create L3 BGPVPN
+ 3. Create router and connect it to network A
+ 5. Start up server 1 in network A
+ 6. Start up server 2 in network B
+ 7. Give a FIP to server 1
+ LOG.debug("Check that server 1 cannot ping server's 2")
+ LOG.debug("Check that server 1 can ping server's 2")
+ import rpdb; rpdb.set_trace()
+ LOG.debug("Check that server 1 cannot ping server's 2")
+ 8. Check that server 1 cannot ping server's 2
+ 10. Associate network A to a given L3 BGPVPN
+ 11. Associate port of server 2 to a given L3 BGPVPN
+ 12. Check that server 1 can ping server's 2
+ 13. Remove created before port association
+ 14. Check that server 1 cannot ping server's 2
+ """
+ self._create_networks_and_subnets(port_security=False)
+ self._create_l3_bgpvpn()
+ self._create_servers([[self.networks[NET_A], IP_A_S1_1],
+ [self.networks[NET_B], IP_B_S1_1]],
+ port_security=False)
+ self._create_fip_router(subnet_id=self.subnets[NET_A][0]['id'])
+ self._associate_fip(0)
+
+ # preliminary check that no connectivity to 192.168.0.1 initially
+ # exists
+ self._check_l3_bgpvpn_by_specific_ip(
+ should_succeed=False, to_server_ip=IP_B_S1_1)
+ self.bgpvpn_client.create_network_association(
+ self.bgpvpn['id'], self.networks[NET_A]['id'])
+ port_id = self.ports[self.servers[1]['id']]['id']
+ body = self.bgpvpn_client.create_port_association(self.bgpvpn['id'],
+ port_id=port_id)
+ port_association = body['port_association']
+ self._check_l3_bgpvpn_by_specific_ip(
+ should_succeed=True, to_server_ip=IP_B_S1_1)
+ self.bgpvpn_client.delete_port_association(
+ self.bgpvpn['id'], port_association['id'])
+ self._check_l3_bgpvpn_by_specific_ip(
+ should_succeed=False, to_server_ip=IP_B_S1_1)
+
+ @decorators.idempotent_id('8de130c1-778a-4d86-913b-ff41be3c2f0b')
+ @utils.services('compute', 'network')
+ @utils.requires_ext(extension='bgpvpn-routes-control', service='network')
+ @testtools.skipUnless(False, "Skip unless PRODX-25126 is fixed")
+ def test_bgpvpn_port_association_create_and_delete_bgpvpn(self):
+ """This test checks port association in BGPVPN.
+
+ 1. Create networks A and B with their respective subnets
+ 2. Create L3 BGPVPN
+ 3. Create router and connect it to network A
+ 5. Start up server 1 in network A
+ 6. Start up server 2 in network B
+ 7. Give a FIP to server 1
+ LOG.debug("Check that server 1 cannot ping server's 2")
+ LOG.debug("Check that server 1 can ping server's 2")
+ import rpdb; rpdb.set_trace()
+ LOG.debug("Check that server 1 cannot ping server's 2")
+ 8. Check that server 1 cannot ping server's 2
+ 10. Associate network A to a given L3 BGPVPN
+ 11. Associate port of server 2 to a given L3 BGPVPN
+ 12. Check that server 1 can ping server's 2
+ 13. Remove created before bgpvpn
+ 14. Check that server 1 cannot ping server's 2
+ """
+ self._create_networks_and_subnets(port_security=False)
+ self._create_l3_bgpvpn()
+ self._create_servers([[self.networks[NET_A], IP_A_S1_1],
+ [self.networks[NET_B], IP_B_S1_1]],
+ port_security=False)
+ self._create_fip_router(subnet_id=self.subnets[NET_A][0]['id'])
+ self._associate_fip(0)
+
+ # preliminary check that no connectivity to 192.168.0.1 initially
+ # exists
+ self._check_l3_bgpvpn_by_specific_ip(
+ should_succeed=False, to_server_ip=IP_B_S1_1)
+ self.bgpvpn_client.create_network_association(
+ self.bgpvpn['id'], self.networks[NET_A]['id'])
+ port_id = self.ports[self.servers[1]['id']]['id']
+ self.bgpvpn_client.create_port_association(self.bgpvpn['id'],
+ port_id=port_id)
+ self._check_l3_bgpvpn_by_specific_ip(
+ should_succeed=True, to_server_ip=IP_B_S1_1)
+ self.delete_bgpvpn(self.bgpvpn_admin_client, self.bgpvpn)
+ self._check_l3_bgpvpn_by_specific_ip(
+ should_succeed=False, to_server_ip=IP_B_S1_1)
+
@decorators.idempotent_id('9c3280b5-0b32-4562-800c-0b50d9d52bfd')
@utils.services('compute', 'network')
@utils.requires_ext(extension='bgpvpn-routes-control', service='network')