Check connection between VMs with BGPVPN after live migration

Related-prod: PRODX-26006
Related-prod: PRODX-28007
Change-Id: I066c34d57ba4a0cd8f6d62c9e75671fc930eb75b
(cherry picked from commit 2a34038b4963c3b74012ed9124f87acbf54eedf5)
(cherry picked from commit 7eac3a8ac9b8e99c9aa2e8d660d290de445c3738)
diff --git a/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py b/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py
index 597bfc8..1b0d6cc 100644
--- a/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py
+++ b/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_basic.py
@@ -20,12 +20,8 @@
 from neutron_lib.utils import test
 from oslo_concurrency import lockutils
 from oslo_log import log as logging
-from tempest.common import compute
 from tempest.common import utils
-from tempest.common import waiters
 from tempest import config
-from tempest.lib.common.utils import data_utils
-from tempest.lib.common.utils import test_utils
 from tempest.lib import decorators
 
 from neutron_tempest_plugin.bgpvpn import base
@@ -108,20 +104,6 @@
         self.RT3 = self.new_rt()
         self.RT4 = self.new_rt()
 
-    @classmethod
-    def setup_clients(cls):
-        """This setup the service clients for the tests"""
-        super(TestBGPVPNBasic, cls).setup_clients()
-        cls.admin_security_group_client = cls.os_admin.security_groups_client
-        cls.admin_security_group_rule_client = (
-            cls.os_admin.security_group_rules_client)
-        cls.admin_routers_client = cls.os_admin.routers_client
-        cls.admin_ports_client = cls.os_admin.ports_client
-        cls.admin_networks_client = cls.os_admin.networks_client
-        cls.admin_subnets_client = cls.os_admin.subnets_client
-        cls.admin_fips_client = cls.os_admin.floating_ips_client
-        cls.admin_keys_client = cls.os_admin.keypairs_client
-
     @decorators.idempotent_id('afdd6cad-871a-4343-b97b-6319c76c815d')
     @utils.services('compute', 'network')
     def test_bgpvpn_basic(self):
@@ -178,7 +160,6 @@
         self._create_networks_and_subnets()
         self._create_servers()
         self.router_b = self._create_fip_router(
-            client=self.admin_routers_client,
             subnet_id=self.subnets[NET_B][0]['id'])
         self._create_l3_bgpvpn()
         self._associate_all_nets_to_bgpvpn()
@@ -202,13 +183,10 @@
         self._create_networks_and_subnets()
         self._create_servers()
         self.router_b = self._create_fip_router(
-            client=self.admin_routers_client,
             subnet_id=self.subnets[NET_B][0]['id'])
         self._create_l3_bgpvpn()
         self._associate_all_nets_to_bgpvpn()
-        self._delete_router(self.router_b,
-                            routers_client=self.admin_routers_client,
-                            ports_client=self.admin_ports_client)
+        self.delete_router(self.router_b)
         self._associate_fip_and_check_l3_bgpvpn()
 
     @decorators.idempotent_id('973ab26d-c7d8-4a32-9aa9-2d7e6f406135')
@@ -230,7 +208,6 @@
         self._create_l3_bgpvpn()
         self._associate_all_nets_to_bgpvpn()
         self.router_b = self._create_fip_router(
-            client=self.admin_routers_client,
             subnet_id=self.subnets[NET_B][0]['id'])
         self._associate_fip_and_check_l3_bgpvpn()
 
@@ -250,7 +227,6 @@
         """
         self._create_networks_and_subnets()
         self.router_b = self._create_fip_router(
-            client=self.admin_routers_client,
             subnet_id=self.subnets[NET_B][0]['id'])
         self._create_l3_bgpvpn()
         self._associate_all_nets_to_bgpvpn()
@@ -275,7 +251,6 @@
         self._create_l3_bgpvpn()
         self._associate_all_nets_to_bgpvpn()
         self.router_b = self._create_fip_router(
-            client=self.admin_routers_client,
             subnet_id=self.subnets[NET_B][0]['id'])
         self._create_servers()
         self._associate_fip_and_check_l3_bgpvpn()
@@ -365,10 +340,10 @@
             0, self.subnets[NET_A][0])
         self._create_l3_bgpvpn(rts=[], export_rts=[self.RT1],
                                import_rts=[self.RT2])
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_A]['id'])
         self._check_l3_bgpvpn(should_succeed=False)
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_B]['id'])
         self._check_l3_bgpvpn(should_succeed=False)
         self._update_l3_bgpvpn(rts=[self.RT1], import_rts=[], export_rts=[])
@@ -409,13 +384,13 @@
                              [self.networks[NET_B], IP_B_S1_1],
                              [self.networks[NET_A], IP_A_S1_2],
                              [self.networks[NET_B], IP_B_S1_2]])
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_A]['id'])
         self.router_a = self._create_router_and_associate_fip(
             0, self.subnets[NET_A][0])
         self._check_l3_bgpvpn(should_succeed=False)
         self._check_l3_bgpvpn(self.servers[0], self.servers[2])
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_B]['id'])
         self.router_b = self._create_router_and_associate_fip(
             1, self.subnets[NET_B][0])
@@ -465,11 +440,11 @@
             0, self.subnets[NET_A][0])
         router_b = self._create_router_and_associate_fip(
             3, self.subnets[NET_B][0])
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_A]['id'])
         self._check_l3_bgpvpn(should_succeed=False)
         self._check_l3_bgpvpn(self.servers[0], self.servers[2])
-        self.bgpvpn_admin_client.create_router_association(self.bgpvpn['id'],
+        self.bgpvpn_client.create_router_association(self.bgpvpn['id'],
                                                      router_b['id'])
         self._check_l3_bgpvpn(should_succeed=False)
         self._check_l3_bgpvpn(self.servers[3], self.servers[1])
@@ -534,16 +509,16 @@
                                   'local_pref': 100,
                                   'prefix': NET_C_S1}]
 
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_A]['id'])
 
         port_id_1 = self.ports[self.servers[1]['id']]['id']
-        body = self.bgpvpn_admin_client.create_port_association(
+        body = self.bgpvpn_client.create_port_association(
             self.bgpvpn['id'], port_id=port_id_1, routes=primary_port_routes)
         port_association_1 = body['port_association']
 
         port_id_2 = self.ports[self.servers[2]['id']]['id']
-        body = self.bgpvpn_admin_client.create_port_association(
+        body = self.bgpvpn_client.create_port_association(
             self.bgpvpn['id'], port_id=port_id_2, routes=alternate_port_routes)
         port_association_2 = body['port_association']
 
@@ -556,10 +531,10 @@
             to_server_ip=IP_C_S1_1,
             validate_server=destination_srv_1)
 
-        self.bgpvpn_admin_client.update_port_association(
+        self.bgpvpn_client.update_port_association(
             self.bgpvpn['id'], port_association_1['id'],
             routes=alternate_port_routes)
-        self.bgpvpn_admin_client.update_port_association(
+        self.bgpvpn_client.update_port_association(
             self.bgpvpn['id'], port_association_2['id'],
             routes=primary_port_routes)
 
@@ -602,9 +577,9 @@
                                           rts=[self.RT1])
         bgpvpn_a_bis = self._create_l3_bgpvpn(name='test-l3-bgpvpn-a-bis',
                                               rts=[self.RT2])
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             bgpvpn_a['id'], self.networks[NET_A]['id'])
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             bgpvpn_a_bis['id'], self.networks[NET_A_BIS]['id'])
         self._create_servers([[self.networks[NET_A], IP_A_S1_1],
                              [self.networks[NET_A_BIS], IP_A_BIS_S1_2],
@@ -673,17 +648,18 @@
 
         self._setup_ip_forwarding(1)
         self._setup_ip_address(1, IP_C_S1_1)
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_A]['id'])
         port_id = self.ports[self.servers[1]['id']]['id']
         port_routes = [{'type': 'prefix',
                         'prefix': NET_C_S1}]
-        body = self.bgpvpn_admin_client.create_port_association(
-            self.bgpvpn['id'], port_id=port_id, routes=port_routes)
+        body = self.bgpvpn_client.create_port_association(self.bgpvpn['id'],
+                                                          port_id=port_id,
+                                                          routes=port_routes)
         port_association = body['port_association']
         self._check_l3_bgpvpn_by_specific_ip(
             to_server_ip=IP_C_S1_1)
-        self.bgpvpn_admin_client.update_port_association(
+        self.bgpvpn_client.update_port_association(
             self.bgpvpn['id'], port_association['id'], routes=[])
         self._check_l3_bgpvpn_by_specific_ip(
             should_succeed=False, to_server_ip=IP_C_S1_1)
@@ -737,15 +713,16 @@
 
         self._setup_range_ip_address(1, LOOPBACKS)
 
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_A]['id'])
         port_id = self.ports[self.servers[1]['id']]['id']
         port_routes = [{'type': 'prefix',
                         'prefix': ip + "/32"}
                        for ip in LOOPBACKS]
 
-        body = self.bgpvpn_admin_client.create_port_association(
-            self.bgpvpn['id'], port_id=port_id, routes=port_routes)
+        body = self.bgpvpn_client.create_port_association(self.bgpvpn['id'],
+                                                          port_id=port_id,
+                                                          routes=port_routes)
         port_association = body['port_association']
 
         for ip in random.sample(LOOPBACKS, SAMPLE_SIZE):
@@ -754,7 +731,7 @@
             self._check_l3_bgpvpn_by_specific_ip(
                 to_server_ip=ip)
 
-        self.bgpvpn_admin_client.update_port_association(
+        self.bgpvpn_client.update_port_association(
             self.bgpvpn['id'], port_association['id'], routes=[])
 
         for ip in SUB_LOOPBACKS:
@@ -895,17 +872,18 @@
 
         self._setup_ip_forwarding(1)
         self._setup_ip_address(1, IP_C_S1_1)
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_A]['id'])
         port_id = self.ports[self.servers[1]['id']]['id']
         port_routes = [{'type': 'prefix',
                         'prefix': NET_C_S1}]
-        body = self.bgpvpn_admin_client.create_port_association(
-            self.bgpvpn['id'], port_id=port_id, routes=port_routes)
+        body = self.bgpvpn_client.create_port_association(self.bgpvpn['id'],
+                                                          port_id=port_id,
+                                                          routes=port_routes)
         port_association = body['port_association']
         self._check_l3_bgpvpn_by_specific_ip(
             to_server_ip=IP_C_S1_1)
-        self.bgpvpn_admin_client.delete_port_association(
+        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_C_S1_1)
@@ -978,21 +956,21 @@
         self._setup_ip_forwarding(0)
 
         # connect network A to its BGPVPN
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             bgpvpn_a['id'], self.networks[NET_A]['id'])
 
         # connect network B to its BGPVPN
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             bgpvpn_b['id'], self.networks[NET_B]['id'])
 
         # connect network C to its BGPVPN
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             bgpvpn_c['id'], self.networks[NET_C]['id'])
 
         # create port associations for A->C traffic
         # (leak routes imported by BGPVPN B -- which happen to include the
         # routes net C -- into net A)
-        self.bgpvpn_admin_client.create_port_association(
+        self.bgpvpn_client.create_port_association(
             bgpvpn_to_a['id'],
             port_id=self.ports[vm2['id']]['id'],
             routes=[{'type': 'bgpvpn',
@@ -1002,7 +980,7 @@
         # create port associations for C->A traffic
         # (leak routes imported by BGPVPN B -- which happen to include the
         # routes from net A -- into net C)
-        body = self.bgpvpn_admin_client.create_port_association(
+        body = self.bgpvpn_client.create_port_association(
             bgpvpn_to_c['id'],
             port_id=self.ports[vm2['id']]['id'],
             routes=[{'type': 'bgpvpn',
@@ -1026,7 +1004,7 @@
                                              should_succeed=True)
 
         # remove port association 1
-        self.bgpvpn_admin_client.delete_port_association(self.bgpvpn['id'],
+        self.bgpvpn_client.delete_port_association(self.bgpvpn['id'],
                                                    port_association['id'])
 
         # check that connectivity is actually interrupted
@@ -1050,7 +1028,7 @@
         """
         self._create_networks_and_subnets()
         self._create_l3_bgpvpn()
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_A]['id'])
         self._create_servers()
         self._associate_fip_and_check_l3_bgpvpn(should_succeed=False)
@@ -1119,10 +1097,10 @@
         """
         self._create_networks_and_subnets()
         self._create_l3_bgpvpn()
-        body = self.bgpvpn_admin_client.create_network_association(
+        body = self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_A]['id'])
         assoc_b = body['network_association']
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_B]['id'])
         self._create_servers()
         self._associate_fip_and_check_l3_bgpvpn()
@@ -1152,10 +1130,10 @@
         router_b = self._create_fip_router(
             subnet_id=self.subnets[NET_B][0]['id'])
         self._create_l3_bgpvpn()
-        self.bgpvpn_admin_client.create_network_association(
+        self.bgpvpn_client.create_network_association(
             self.bgpvpn['id'], self.networks[NET_A]['id'])
-        body = self.bgpvpn_admin_client.create_router_association(
-            self.bgpvpn['id'], router_b['id'])
+        body = self.bgpvpn_client.create_router_association(self.bgpvpn['id'],
+                                                            router_b['id'])
         assoc_b = body['router_association']
         self._create_servers()
         self._associate_fip_and_check_l3_bgpvpn()
@@ -1213,285 +1191,3 @@
         self._associate_fip_and_check_l3_bgpvpn()
         self._update_l3_bgpvpn(rts=[], import_rts=[], export_rts=[])
         self._check_l3_bgpvpn(should_succeed=False)
-
-    def _create_security_group_for_test(self):
-        self.security_group = self.create_security_group(
-            project_id=self.bgpvpn_admin_client.project_id,
-            security_groups_client=self.admin_security_group_client,
-            security_group_rules_client=self.admin_security_group_rule_client)
-
-    def _create_networks_and_subnets(self, names=None, subnet_cidrs=None,
-                                     port_security=True):
-        if not names:
-            names = [NET_A, NET_B, NET_C]
-        if not subnet_cidrs:
-            subnet_cidrs = [[NET_A_S1], [NET_B_S1], [NET_C_S1]]
-        for (name, subnet_cidrs) in zip(names, subnet_cidrs):
-            network = super(manager.NetworkScenarioTest,
-                            self).create_network(namestart=name,
-                    port_security_enabled=port_security,
-                    networks_client=self.admin_networks_client)
-            self.networks[name] = network
-            self.subnets[name] = []
-            for (j, cidr) in enumerate(subnet_cidrs):
-                sub_name = "subnet-%s-%d" % (name, j + 1)
-                subnet = self._create_subnet_with_cidr(
-                    network, namestart=sub_name, cidr=cidr, ip_version=4,
-                    subnets_client=self.admin_subnets_client)
-                self.subnets[name].append(subnet)
-
-    def _create_subnet_with_cidr(self, network, subnets_client=None,
-                                 namestart='subnet-smoke', **kwargs):
-        if not subnets_client:
-            subnets_client = self.subnets_client
-        tenant_cidr = kwargs.get('cidr')
-        subnet = dict(
-            name=data_utils.rand_name(namestart),
-            network_id=network['id'],
-            tenant_id=network['tenant_id'],
-            **kwargs)
-        result = subnets_client.create_subnet(**subnet)
-        self.assertIsNotNone(result, 'Unable to allocate tenant network')
-        subnet = result['subnet']
-        self.assertEqual(subnet['cidr'], tenant_cidr)
-        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
-                        subnets_client.delete_subnet, subnet['id'])
-        return subnet
-
-    def _create_fip_router(self, client=None, public_network_id=None,
-                           subnet_id=None):
-        if not client:
-            client = self.admin_routers_client
-        router = self._create_router(client, namestart='router-')
-        router_id = router['id']
-        if public_network_id is None:
-            public_network_id = CONF.network.public_network_id
-        if client is None:
-            client = self.routers_client
-        kwargs = {'external_gateway_info': {'network_id': public_network_id}}
-        router = client.update_router(router_id, **kwargs)['router']
-        if subnet_id is not None:
-            client.add_router_interface(router_id, subnet_id=subnet_id)
-            self.addCleanup(test_utils.call_and_ignore_notfound_exc,
-                            client.remove_router_interface, router_id,
-                            subnet_id=subnet_id)
-        return router
-
-    def _associate_fip(self, server_index):
-        server = self.servers[server_index]
-        fip = self.create_floating_ip(
-            server, external_network_id=CONF.network.public_network_id,
-            port_id=self.ports[server['id']]['id'],
-            client=self.admin_fips_client)
-        self.server_fips[server['id']] = fip
-        return fip
-
-    def _create_router_and_associate_fip(self, server_index, subnet):
-        router = self._create_fip_router(client=self.admin_routers_client,
-                                         subnet_id=subnet['id'])
-        self._associate_fip(server_index)
-        return router
-
-    def _create_server(self, name, keypair, network, ip_address,
-                       security_group_ids, clients, port_security):
-        security_groups = []
-        if port_security:
-            security_groups = security_group_ids
-        create_port_body = {'fixed_ips': [{'ip_address': ip_address}],
-                            'namestart': 'port-smoke',
-                            'security_groups': security_groups}
-
-        port = super(manager.NetworkScenarioTest,
-                    self).create_port(network_id=network['id'],
-                                    client=self.admin_ports_client,
-                                    **create_port_body)
-
-        create_server_kwargs = {
-            'key_name': keypair['name'],
-            'networks': [{'uuid': network['id'], 'port': port['id']}]
-        }
-        body, servers = compute.create_test_server(
-            clients, wait_until='ACTIVE', name=name, **create_server_kwargs)
-        self.addCleanup(waiters.wait_for_server_termination,
-                        clients.servers_client, body['id'])
-        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
-                        clients.servers_client.delete_server, body['id'])
-        server = clients.servers_client.show_server(body['id'])['server']
-        LOG.debug('Created server: %s with status: %s', server['id'],
-                  server['status'])
-        self.ports[server['id']] = port
-        return server
-
-    def _create_servers(self, ports_config=None, port_security=True):
-        keypair = self.create_keypair(client=self.admin_keys_client)
-        security_group_ids = [self.security_group['id']]
-        if ports_config is None:
-            ports_config = [[self.networks[NET_A], IP_A_S1_1],
-                            [self.networks[NET_B], IP_B_S1_1]]
-        for (i, port_config) in enumerate(ports_config):
-            network = port_config[0]
-            server = self._create_server(
-                'server-' + str(i + 1), keypair, network, port_config[1],
-                security_group_ids, self.os_admin, port_security)
-            self.servers.append(server)
-            self.servers_keypairs[server['id']] = keypair
-            self.server_fixed_ips[server['id']] = (
-                server['addresses'][network['name']][0]['addr'])
-            self.assertTrue(self.servers_keypairs)
-
-    def _create_l3_bgpvpn(self, name='test-l3-bgpvpn', rts=None,
-                          import_rts=None, export_rts=None):
-        if rts is None and import_rts is None and export_rts is None:
-            rts = [self.RT1]
-        import_rts = import_rts or []
-        export_rts = export_rts or []
-        self.bgpvpn = self.create_bgpvpn(
-            self.bgpvpn_admin_client,
-            tenant_id=self.bgpvpn_admin_client.project_id,
-            name=name, route_targets=rts, export_targets=export_rts,
-            import_targets=import_rts)
-        self.addCleanup(test_utils.call_and_ignore_notfound_exc,
-                        self.bgpvpn_admin_client.delete_bgpvpn,
-                        self.bgpvpn['id'])
-        return self.bgpvpn
-
-    def _update_l3_bgpvpn(self, rts=None, import_rts=None, export_rts=None,
-                          bgpvpn=None):
-        bgpvpn = bgpvpn or self.bgpvpn
-        if rts is None:
-            rts = [self.RT1]
-        import_rts = import_rts or []
-        export_rts = export_rts or []
-        LOG.debug('Updating targets in BGPVPN %s', bgpvpn['id'])
-        self.bgpvpn_admin_client.update_bgpvpn(bgpvpn['id'],
-                                               route_targets=rts,
-                                               export_targets=export_rts,
-                                               import_targets=import_rts)
-
-    def _associate_all_nets_to_bgpvpn(self, bgpvpn=None):
-        bgpvpn = bgpvpn or self.bgpvpn
-        for network in self.networks.values():
-            self.bgpvpn_admin_client.create_network_association(
-                bgpvpn['id'], network['id'])
-        LOG.debug('BGPVPN network associations completed')
-
-    def _setup_ssh_client(self, server):
-        server_fip = self.server_fips[server['id']][
-            'floating_ip_address']
-        private_key = self.servers_keypairs[server['id']][
-            'private_key']
-        ssh_client = self.get_remote_client(server_fip,
-                                            private_key=private_key,
-                                            server=server)
-        return ssh_client
-
-    def _setup_http_server(self, server_index):
-        server = self.servers[server_index]
-        ssh_client = self._setup_ssh_client(server)
-        ssh_client.exec_command("sudo nc -kl -p 80 -e echo '%s:%s' &"
-                                % (server['name'], server['id']))
-
-    def _setup_ip_forwarding(self, server_index):
-        server = self.servers[server_index]
-        ssh_client = self._setup_ssh_client(server)
-        ssh_client.exec_command("sudo sysctl -w net.ipv4.ip_forward=1")
-
-    def _setup_ip_address(self, server_index, cidr, device=None):
-        self._setup_range_ip_address(server_index, [cidr], device=None)
-
-    def _setup_range_ip_address(self, server_index, cidrs, device=None):
-        MAX_CIDRS = 50
-        if device is None:
-            device = 'lo'
-        server = self.servers[server_index]
-        ssh_client = self._setup_ssh_client(server)
-        for i in range(0, len(cidrs), MAX_CIDRS):
-            ips = ' '.join(cidrs[i:i + MAX_CIDRS])
-            ssh_client.exec_command(
-                ("for ip in {ips}; do sudo ip addr add $ip "
-                 "dev {dev}; done").format(ips=ips, dev=device))
-
-    def _check_l3_bgpvpn(self, from_server=None, to_server=None,
-                         should_succeed=True, validate_server=False):
-        to_server = to_server or self.servers[1]
-        destination_srv = None
-        if validate_server:
-            destination_srv = '%s:%s' % (to_server['name'], to_server['id'])
-        destination_ip = self.server_fixed_ips[to_server['id']]
-        self._check_l3_bgpvpn_by_specific_ip(from_server=from_server,
-                                             to_server_ip=destination_ip,
-                                             should_succeed=should_succeed,
-                                             validate_server=destination_srv)
-
-    def _check_l3_bgpvpn_by_specific_ip(self, from_server=None,
-                                        to_server_ip=None,
-                                        should_succeed=True,
-                                        validate_server=None,
-                                        repeat_validate_server=10):
-        from_server = from_server or self.servers[0]
-        from_server_ip = self.server_fips[from_server['id']][
-            'floating_ip_address']
-        if to_server_ip is None:
-            to_server_ip = self.server_fixed_ips[self.servers[1]['id']]
-        ssh_client = self._setup_ssh_client(from_server)
-        check_reachable = should_succeed or validate_server
-        msg = ""
-        if check_reachable:
-            msg = "Timed out waiting for {ip} to become reachable".format(
-                ip=to_server_ip)
-        else:
-            msg = ("Unexpected ping response from VM with IP address "
-                   "{dest} originated from VM with IP address "
-                   "{src}").format(dest=to_server_ip, src=from_server_ip)
-        try:
-            result = self._check_remote_connectivity(ssh_client,
-                                                     to_server_ip,
-                                                     check_reachable)
-            # if a negative connectivity check was unsuccessful (unexpected
-            # ping reply) then try to know more:
-            if not check_reachable and not result:
-                try:
-                    content = ssh_client.exec_command(
-                        "nc %s 80" % to_server_ip).strip()
-                    LOG.warning("Can connect to %s: %s", to_server_ip, content)
-                except Exception:
-                    LOG.warning("Could ping %s, but no http", to_server_ip)
-
-            self.assertTrue(result, msg)
-
-            if validate_server and result:
-                # repeating multiple times gives increased odds of avoiding
-                # false positives in the case where the dataplane does
-                # equal-cost multipath
-                for i in range(0, repeat_validate_server):
-                    real_dest = ssh_client.exec_command(
-                        "nc %s 80" % to_server_ip).strip()
-                    result = real_dest == validate_server
-                    self.assertTrue(
-                        should_succeed == result,
-                        ("Destination server name is '%s', expected is '%s'" %
-                         (real_dest, validate_server)))
-                    LOG.info("nc server name check %d successful", i)
-        except Exception:
-            LOG.exception("Error validating connectivity to %s "
-                          "from VM with IP address %s: %s",
-                          to_server_ip, from_server_ip, msg)
-            raise
-
-    def _associate_fip_and_check_l3_bgpvpn(self, should_succeed=True):
-        subnet = self.subnets[NET_A][0]
-        self.router = self._create_router_and_associate_fip(0, subnet)
-        self._check_l3_bgpvpn(should_succeed=should_succeed)
-
-    def _delete_router(self, router, routers_client=None, ports_client=None):
-        if not routers_client:
-            routers_client = self.routers_client
-        if not ports_client:
-            ports_client = self.ports_client
-        ports_rsp = ports_client.list_ports(device_id=router['id'])
-        interfaces = ports_rsp['ports']
-        for i in interfaces:
-            test_utils.call_and_ignore_notfound_exc(
-                routers_client.remove_router_interface, router['id'],
-                subnet_id=i['fixed_ips'][0]['subnet_id'])
-        routers_client.delete_router(router['id'])
diff --git a/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_migration.py b/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_migration.py
new file mode 100644
index 0000000..24f99dd
--- /dev/null
+++ b/neutron_tempest_plugin/bgpvpn/scenario/test_bgpvpn_migration.py
@@ -0,0 +1,136 @@
+# Copyright 2016 Cisco Systems, Inc.
+# All rights reserved.
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may
+# not use this file except in compliance with the License. You may obtain
+# a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+import os
+
+import netaddr
+from oslo_concurrency import lockutils
+from oslo_log import log as logging
+import tempest.api.compute.base as base2
+from tempest.common import utils
+from tempest import config
+from tempest.lib import decorators
+
+from neutron_tempest_plugin.bgpvpn import base
+from neutron_tempest_plugin.bgpvpn.scenario import manager
+
+
+CONF = config.CONF
+LOG = logging.getLogger(__name__)
+
+NET_D = 'D'
+NET_E = 'E'
+NET_F = 'F'
+
+
+if "SUBNETPOOL_PREFIX_V4" in os.environ:
+    subnet_base = netaddr.IPNetwork(os.environ['SUBNETPOOL_PREFIX_V4'])
+    if subnet_base.prefixlen > 21:
+        raise Exception("if SUBNETPOOL_PREFIX_V4 is set, it needs to offer "
+                        "space for at least 8 /24 subnets")
+else:
+    subnet_base = netaddr.IPNetwork("10.200.0.0/16")
+
+
+def assign_24(idx):
+    # how many addresses in a /24:
+    range_size = 2 ** (32 - 24)
+    return netaddr.cidr_merge(
+        subnet_base[range_size * idx:range_size * (idx + 1)])[0]
+
+
+S1D = assign_24(1)
+S1E = assign_24(4)
+S1F = assign_24(6)
+NET_D_S1 = str(S1D)
+NET_E_S1 = str(S1E)
+NET_F_S1 = str(S1F)
+IP_D_S1_1 = str(S1D[10])
+IP_E_S1_1 = str(S1E[20])
+IP_F_S1_1 = str(S1F[30])
+
+
+class TestBGPVPNMigration(base.BaseBgpvpnTest, manager.NetworkScenarioTest,
+                          base2.BaseV2ComputeAdminTest):
+    block_migration = None
+
+    @classmethod
+    def setUpClass(cls):
+        super(TestBGPVPNMigration, cls).setUpClass()
+        cls._rt_index = 0
+        cls.admin_migration_client = cls.os_admin.migrations_client
+
+    @classmethod
+    @lockutils.synchronized('bgpvpn')
+    def new_rt(cls):
+        cls._rt_index += 1
+        return "64513:%d" % cls._rt_index
+
+    def setUp(self):
+        super(TestBGPVPNMigration, self).setUp()
+        self.servers_keypairs = {}
+        self.servers = []
+        self.server_fixed_ips = {}
+        self.ports = {}
+        self.networks = {}
+        self.subnets = {}
+        self.server_fips = {}
+        self._create_security_group_for_test()
+        self.RT1 = self.new_rt()
+
+    @decorators.idempotent_id('8a5a6fac-313c-464b-9c5c-77eca377ff1a')
+    @utils.services('compute', 'network')
+    def test_bgpvpn_livemigration(self):
+        """This test checks connection between VMs with BGPVPN
+
+         after live migration
+
+        1. Create networks D, E and F with their respective subnets
+        2. Associate network D, E and network F to a given L3 BGPVPN
+        3. Start up server 1 in network D
+        4. Start up server 2 in network E
+        5. Create router and connect it to network D
+        6. Give a FIP to server 1
+        7. Check that server 1 can ping server 2
+        8. Live migrate server 1
+        9. Check that server 1 can ping server 2
+        10. Live migrate server 2
+        11. Check that server 1 can ping server 2
+        """
+        self._create_networks_and_subnets(names=[NET_D, NET_E, NET_F],
+                                          subnet_cidrs=[[NET_D_S1], [NET_E_S1],
+                                                        [NET_F_S1]])
+        self._create_l3_bgpvpn()
+        self._associate_all_nets_to_bgpvpn()
+        self._create_servers(ports_config=[
+            [self.networks[NET_D], IP_D_S1_1],
+            [self.networks[NET_E], IP_E_S1_1],
+            [self.networks[NET_F], IP_F_S1_1]
+        ])
+        self._associate_fip_and_check_l3_bgpvpn(subnet=NET_D)
+        # Migrate both VMs one by one and check connection
+        for i in range(2):
+            source_host = self.get_host_for_server(self.servers[i]['id'])
+            if not CONF.compute_feature_enabled.can_migrate_between_any_hosts:
+                # not to specify a host so that the scheduler will pick one
+                destination_host = None
+            else:
+                destination_host = \
+                    self.get_host_other_than(self.servers[i]['id'])
+            LOG.info("Live migrate from source %s to destination %s",
+                     source_host, destination_host)
+            self._live_migrate(self.servers[i]['id'],
+                               destination_host, 'ACTIVE')
+            self._check_l3_bgpvpn()