diff --git a/neutron/tests/tempest/api/test_bgp_speaker_extensions.py b/neutron/tests/tempest/api/test_bgp_speaker_extensions.py
deleted file mode 100644
index 123f43f..0000000
--- a/neutron/tests/tempest/api/test_bgp_speaker_extensions.py
+++ /dev/null
@@ -1,286 +0,0 @@
-# Copyright 2016 Hewlett Packard Enterprise Development Company LP
-#
-#    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 netaddr
-from tempest import config
-from tempest.lib import exceptions as lib_exc
-from tempest import test
-import testtools
-
-from neutron.tests.tempest.api import base
-from neutron.tests.tempest.common import tempest_fixtures as fixtures
-
-CONF = config.CONF
-
-
-class BgpSpeakerTestJSONBase(base.BaseAdminNetworkTest):
-
-    default_bgp_speaker_args = {'local_as': '1234',
-                                'ip_version': 4,
-                                'name': 'my-bgp-speaker',
-                                'advertise_floating_ip_host_routes': True,
-                                'advertise_tenant_networks': True}
-    default_bgp_peer_args = {'remote_as': '4321',
-                             'name': 'my-bgp-peer',
-                             'peer_ip': '192.168.1.1',
-                             'auth_type': 'md5', 'password': 'my-secret'}
-
-    @classmethod
-    @test.requires_ext(extension="bgp_speaker", service="network")
-    def resource_setup(cls):
-        super(BgpSpeakerTestJSONBase, cls).resource_setup()
-
-        cls.admin_routerports = []
-        cls.admin_floatingips = []
-        cls.admin_routers = []
-        cls.ext_net_id = CONF.network.public_network_id
-
-    @classmethod
-    def resource_cleanup(cls):
-        for floatingip in cls.admin_floatingips:
-            cls._try_delete_resource(cls.admin_client.delete_floatingip,
-                                     floatingip['id'])
-        for routerport in cls.admin_routerports:
-            cls._try_delete_resource(
-                      cls.admin_client.remove_router_interface_with_subnet_id,
-                      routerport['router_id'], routerport['subnet_id'])
-        for router in cls.admin_routers:
-            cls._try_delete_resource(cls.admin_client.delete_router,
-                                     router['id'])
-        super(BgpSpeakerTestJSONBase, cls).resource_cleanup()
-
-    def create_bgp_speaker(self, auto_delete=True, **args):
-        data = {'bgp_speaker': args}
-        bgp_speaker = self.admin_client.create_bgp_speaker(data)
-        bgp_speaker_id = bgp_speaker['bgp-speaker']['id']
-        if auto_delete:
-            self.addCleanup(self.delete_bgp_speaker, bgp_speaker_id)
-        return bgp_speaker
-
-    def create_bgp_peer(self, **args):
-        bgp_peer = self.admin_client.create_bgp_peer({'bgp_peer': args})
-        bgp_peer_id = bgp_peer['bgp-peer']['id']
-        self.addCleanup(self.delete_bgp_peer, bgp_peer_id)
-        return bgp_peer
-
-    def update_bgp_speaker(self, id, **args):
-        data = {'bgp_speaker': args}
-        return self.admin_client.update_bgp_speaker(id, data)
-
-    def delete_bgp_speaker(self, id):
-        return self.admin_client.delete_bgp_speaker(id)
-
-    def get_bgp_speaker(self, id):
-        return self.admin_client.get_bgp_speaker(id)
-
-    def create_bgp_speaker_and_peer(self):
-        bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
-        bgp_peer = self.create_bgp_peer(**self.default_bgp_peer_args)
-        return (bgp_speaker, bgp_peer)
-
-    def delete_bgp_peer(self, id):
-        return self.admin_client.delete_bgp_peer(id)
-
-    def add_bgp_peer(self, bgp_speaker_id, bgp_peer_id):
-        return self.admin_client.add_bgp_peer_with_id(bgp_speaker_id,
-                                                      bgp_peer_id)
-
-    def remove_bgp_peer(self, bgp_speaker_id, bgp_peer_id):
-        return self.admin_client.remove_bgp_peer_with_id(bgp_speaker_id,
-                                                         bgp_peer_id)
-
-    def delete_address_scope(self, id):
-        return self.admin_client.delete_address_scope(id)
-
-
-class BgpSpeakerTestJSON(BgpSpeakerTestJSONBase):
-
-    """
-    Tests the following operations in the Neutron API using the REST client for
-    Neutron:
-
-        Create bgp-speaker
-        Delete bgp-speaker
-        Create bgp-peer
-        Update bgp-peer
-        Delete bgp-peer
-    """
-
-    @test.idempotent_id('df259771-7104-4ffa-b77f-bd183600d7f9')
-    def test_delete_bgp_speaker(self):
-        bgp_speaker = self.create_bgp_speaker(auto_delete=False,
-                                              **self.default_bgp_speaker_args)
-        bgp_speaker_id = bgp_speaker['bgp-speaker']['id']
-        self.delete_bgp_speaker(bgp_speaker_id)
-        self.assertRaises(lib_exc.NotFound,
-                          self.get_bgp_speaker,
-                          bgp_speaker_id)
-
-    @test.idempotent_id('81d9dc45-19f8-4c6e-88b8-401d965cd1b0')
-    def test_create_bgp_peer(self):
-        self.create_bgp_peer(**self.default_bgp_peer_args)
-
-    @test.idempotent_id('6ade0319-1ee2-493c-ac4b-5eb230ff3a77')
-    def test_add_bgp_peer(self):
-        bgp_speaker, bgp_peer = self.create_bgp_speaker_and_peer()
-        bgp_speaker_id = bgp_speaker['bgp-speaker']['id']
-        bgp_peer_id = bgp_peer['bgp-peer']['id']
-
-        self.add_bgp_peer(bgp_speaker_id, bgp_peer_id)
-        bgp_speaker = self.admin_client.get_bgp_speaker(bgp_speaker_id)
-        bgp_peers_list = bgp_speaker['bgp-speaker']['peers']
-        self.assertEqual(1, len(bgp_peers_list))
-        self.assertTrue(bgp_peer_id in bgp_peers_list)
-
-    @test.idempotent_id('f9737708-1d79-440b-8350-779f97d882ee')
-    def test_remove_bgp_peer(self):
-        bgp_peer = self.create_bgp_peer(**self.default_bgp_peer_args)
-        bgp_peer_id = bgp_peer['bgp-peer']['id']
-        bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
-        bgp_speaker_id = bgp_speaker['bgp-speaker']['id']
-        self.add_bgp_peer(bgp_speaker_id, bgp_peer_id)
-        bgp_speaker = self.admin_client.get_bgp_speaker(bgp_speaker_id)
-        bgp_peers_list = bgp_speaker['bgp-speaker']['peers']
-        self.assertTrue(bgp_peer_id in bgp_peers_list)
-
-        bgp_speaker = self.remove_bgp_peer(bgp_speaker_id, bgp_peer_id)
-        bgp_speaker = self.admin_client.get_bgp_speaker(bgp_speaker_id)
-        bgp_peers_list = bgp_speaker['bgp-speaker']['peers']
-        self.assertTrue(not bgp_peers_list)
-
-    @testtools.skip('bug/1553374')
-    @test.idempotent_id('23c8eb37-d10d-4f43-b2e7-6542cb6a4405')
-    def test_add_gateway_network(self):
-        self.useFixture(fixtures.LockFixture('gateway_network_binding'))
-        bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
-        bgp_speaker_id = bgp_speaker['bgp-speaker']['id']
-
-        self.admin_client.add_bgp_gateway_network(bgp_speaker_id,
-                                                  self.ext_net_id)
-        bgp_speaker = self.admin_client.get_bgp_speaker(bgp_speaker_id)
-        network_list = bgp_speaker['bgp-speaker']['networks']
-        self.assertEqual(1, len(network_list))
-        self.assertTrue(self.ext_net_id in network_list)
-
-    @testtools.skip('bug/1553374')
-    @test.idempotent_id('6cfc7137-0d99-4a3d-826c-9d1a3a1767b0')
-    def test_remove_gateway_network(self):
-        self.useFixture(fixtures.LockFixture('gateway_network_binding'))
-        bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
-        bgp_speaker_id = bgp_speaker['bgp-speaker']['id']
-        self.admin_client.add_bgp_gateway_network(bgp_speaker_id,
-                                                  self.ext_net_id)
-        bgp_speaker = self.admin_client.get_bgp_speaker(bgp_speaker_id)
-        networks = bgp_speaker['bgp-speaker']['networks']
-
-        self.assertTrue(self.ext_net_id in networks)
-        self.admin_client.remove_bgp_gateway_network(bgp_speaker_id,
-                                                     self.ext_net_id)
-        bgp_speaker = self.admin_client.get_bgp_speaker(bgp_speaker_id)
-        network_list = bgp_speaker['bgp-speaker']['networks']
-        self.assertTrue(not network_list)
-
-    @testtools.skip('bug/1553374')
-    @test.idempotent_id('5bef22ad-5e70-4f7b-937a-dc1944642996')
-    def test_get_advertised_routes_null_address_scope(self):
-        self.useFixture(fixtures.LockFixture('gateway_network_binding'))
-        bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
-        bgp_speaker_id = bgp_speaker['bgp-speaker']['id']
-        self.admin_client.add_bgp_gateway_network(bgp_speaker_id,
-                                                  self.ext_net_id)
-        routes = self.admin_client.get_bgp_advertised_routes(bgp_speaker_id)
-        self.assertEqual(0, len(routes['advertised_routes']))
-
-    @testtools.skip('bug/1553374')
-    @test.idempotent_id('cae9cdb1-ad65-423c-9604-d4cd0073616e')
-    def test_get_advertised_routes_floating_ips(self):
-        self.useFixture(fixtures.LockFixture('gateway_network_binding'))
-        bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
-        bgp_speaker_id = bgp_speaker['bgp-speaker']['id']
-        self.admin_client.add_bgp_gateway_network(bgp_speaker_id,
-                                                  self.ext_net_id)
-        tenant_net = self.create_network()
-        tenant_subnet = self.create_subnet(tenant_net)
-        ext_gw_info = {'network_id': self.ext_net_id}
-        router = self.admin_client.create_router(
-                                            'my-router',
-                                            external_gateway_info=ext_gw_info,
-                                            admin_state_up=True,
-                                            distributed=False)
-        self.admin_routers.append(router['router'])
-        self.admin_client.add_router_interface_with_subnet_id(
-                                                       router['router']['id'],
-                                                       tenant_subnet['id'])
-        self.admin_routerports.append({'router_id': router['router']['id'],
-                                       'subnet_id': tenant_subnet['id']})
-        tenant_port = self.create_port(tenant_net)
-        floatingip = self.create_floatingip(self.ext_net_id)
-        self.admin_floatingips.append(floatingip)
-        self.client.update_floatingip(floatingip['id'],
-                                      port_id=tenant_port['id'])
-        routes = self.admin_client.get_bgp_advertised_routes(bgp_speaker_id)
-        self.assertEqual(1, len(routes['advertised_routes']))
-        self.assertEqual(floatingip['floating_ip_address'] + '/32',
-                         routes['advertised_routes'][0]['destination'])
-
-    @testtools.skip('bug/1553374')
-    @test.idempotent_id('c9ad566e-fe8f-4559-8303-bbad9062a30c')
-    def test_get_advertised_routes_tenant_networks(self):
-        self.useFixture(fixtures.LockFixture('gateway_network_binding'))
-        addr_scope = self.create_address_scope('my-scope', ip_version=4)
-        ext_net = self.create_shared_network(**{'router:external': True})
-        tenant_net = self.create_network()
-        ext_subnetpool = self.create_subnetpool(
-                                            'test-pool-ext',
-                                            is_admin=True,
-                                            default_prefixlen=24,
-                                            address_scope_id=addr_scope['id'],
-                                            prefixes=['8.0.0.0/8'])
-        tenant_subnetpool = self.create_subnetpool(
-                                            'tenant-test-pool',
-                                            default_prefixlen=25,
-                                            address_scope_id=addr_scope['id'],
-                                            prefixes=['10.10.0.0/16'])
-        self.create_subnet({'id': ext_net['id']},
-                           cidr=netaddr.IPNetwork('8.0.0.0/24'),
-                           ip_version=4,
-                           client=self.admin_client,
-                           subnetpool_id=ext_subnetpool['id'])
-        tenant_subnet = self.create_subnet(
-                                       {'id': tenant_net['id']},
-                                       cidr=netaddr.IPNetwork('10.10.0.0/24'),
-                                       ip_version=4,
-                                       subnetpool_id=tenant_subnetpool['id'])
-        ext_gw_info = {'network_id': ext_net['id']}
-        router = self.admin_client.create_router(
-                                            'my-router',
-                                            external_gateway_info=ext_gw_info,
-                                            distributed=False)['router']
-        self.admin_routers.append(router)
-        self.admin_client.add_router_interface_with_subnet_id(
-                                                       router['id'],
-                                                       tenant_subnet['id'])
-        self.admin_routerports.append({'router_id': router['id'],
-                                       'subnet_id': tenant_subnet['id']})
-        bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
-        bgp_speaker_id = bgp_speaker['bgp-speaker']['id']
-        self.admin_client.add_bgp_gateway_network(bgp_speaker_id,
-                                                  ext_net['id'])
-        routes = self.admin_client.get_bgp_advertised_routes(bgp_speaker_id)
-        self.assertEqual(1, len(routes['advertised_routes']))
-        self.assertEqual(tenant_subnet['cidr'],
-                         routes['advertised_routes'][0]['destination'])
-        fixed_ip = router['external_gateway_info']['external_fixed_ips'][0]
-        self.assertEqual(fixed_ip['ip_address'],
-                         routes['advertised_routes'][0]['next_hop'])
diff --git a/neutron/tests/tempest/api/test_bgp_speaker_extensions_negative.py b/neutron/tests/tempest/api/test_bgp_speaker_extensions_negative.py
deleted file mode 100644
index 19c1a02..0000000
--- a/neutron/tests/tempest/api/test_bgp_speaker_extensions_negative.py
+++ /dev/null
@@ -1,120 +0,0 @@
-# Copyright 2016 Hewlett Packard Enterprise Development Company LP
-#
-#    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 netaddr
-from tempest.lib import exceptions as lib_exc
-
-from neutron.tests.tempest.api import test_bgp_speaker_extensions as test_base
-from tempest import test
-
-
-class BgpSpeakerTestJSONNegative(test_base.BgpSpeakerTestJSONBase):
-
-    """Negative test cases asserting proper behavior of BGP API extension"""
-
-    @test.attr(type='negative')
-    @test.idempotent_id('75e9ee2f-6efd-4320-bff7-ae24741c8b06')
-    def test_create_bgp_speaker_illegal_local_asn(self):
-        self.assertRaises(lib_exc.BadRequest,
-                          self.create_bgp_speaker,
-                          local_as='65537')
-
-    @test.attr(type='negative')
-    @test.idempotent_id('6742ec2e-382a-4453-8791-13a19b47cd13')
-    def test_create_bgp_speaker_non_admin(self):
-        self.assertRaises(lib_exc.Forbidden,
-                          self.client.create_bgp_speaker,
-                          {'bgp_speaker': self.default_bgp_speaker_args})
-
-    @test.attr(type='negative')
-    @test.idempotent_id('33f7aaf0-9786-478b-b2d1-a51086a50eb4')
-    def test_create_bgp_peer_non_admin(self):
-        self.assertRaises(lib_exc.Forbidden,
-                          self.client.create_bgp_peer,
-                          {'bgp_peer': self.default_bgp_peer_args})
-
-    @test.attr(type='negative')
-    @test.idempotent_id('39435932-0266-4358-899b-0e9b1e53c3e9')
-    def test_update_bgp_speaker_local_asn(self):
-        bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
-        bgp_speaker_id = bgp_speaker['bgp-speaker']['id']
-
-        self.assertRaises(lib_exc.BadRequest, self.update_bgp_speaker,
-                          bgp_speaker_id, local_as='4321')
-
-    @test.idempotent_id('9cc33701-51e5-421f-a5d5-fd7b330e550f')
-    def test_get_advertised_routes_tenant_networks(self):
-        addr_scope1 = self.create_address_scope('my-scope1', ip_version=4)
-        addr_scope2 = self.create_address_scope('my-scope2', ip_version=4)
-        ext_net = self.create_shared_network(**{'router:external': True})
-        tenant_net1 = self.create_network()
-        tenant_net2 = self.create_network()
-        ext_subnetpool = self.create_subnetpool(
-                                           'test-pool-ext',
-                                           is_admin=True,
-                                           default_prefixlen=24,
-                                           address_scope_id=addr_scope1['id'],
-                                           prefixes=['8.0.0.0/8'])
-        tenant_subnetpool1 = self.create_subnetpool(
-                                           'tenant-test-pool',
-                                           default_prefixlen=25,
-                                           address_scope_id=addr_scope1['id'],
-                                           prefixes=['10.10.0.0/16'])
-        tenant_subnetpool2 = self.create_subnetpool(
-                                           'tenant-test-pool',
-                                           default_prefixlen=25,
-                                           address_scope_id=addr_scope2['id'],
-                                           prefixes=['11.10.0.0/16'])
-        self.create_subnet({'id': ext_net['id']},
-                           cidr=netaddr.IPNetwork('8.0.0.0/24'),
-                           ip_version=4,
-                           client=self.admin_client,
-                           subnetpool_id=ext_subnetpool['id'])
-        tenant_subnet1 = self.create_subnet(
-                                       {'id': tenant_net1['id']},
-                                       cidr=netaddr.IPNetwork('10.10.0.0/24'),
-                                       ip_version=4,
-                                       subnetpool_id=tenant_subnetpool1['id'])
-        tenant_subnet2 = self.create_subnet(
-                                       {'id': tenant_net2['id']},
-                                       cidr=netaddr.IPNetwork('11.10.0.0/24'),
-                                       ip_version=4,
-                                       subnetpool_id=tenant_subnetpool2['id'])
-        ext_gw_info = {'network_id': ext_net['id']}
-        router = self.admin_client.create_router(
-                                  'my-router',
-                                  distributed=False,
-                                  external_gateway_info=ext_gw_info)['router']
-        self.admin_routers.append(router)
-        self.admin_client.add_router_interface_with_subnet_id(
-                                                       router['id'],
-                                                       tenant_subnet1['id'])
-        self.admin_routerports.append({'router_id': router['id'],
-                                       'subnet_id': tenant_subnet1['id']})
-        self.admin_client.add_router_interface_with_subnet_id(
-                                                       router['id'],
-                                                       tenant_subnet2['id'])
-        self.admin_routerports.append({'router_id': router['id'],
-                                       'subnet_id': tenant_subnet2['id']})
-        bgp_speaker = self.create_bgp_speaker(**self.default_bgp_speaker_args)
-        bgp_speaker_id = bgp_speaker['bgp-speaker']['id']
-        self.admin_client.add_bgp_gateway_network(bgp_speaker_id,
-                                                  ext_net['id'])
-        routes = self.admin_client.get_bgp_advertised_routes(bgp_speaker_id)
-        self.assertEqual(1, len(routes['advertised_routes']))
-        self.assertEqual(tenant_subnet1['cidr'],
-                         routes['advertised_routes'][0]['destination'])
-        fixed_ip = router['external_gateway_info']['external_fixed_ips'][0]
-        self.assertEqual(fixed_ip['ip_address'],
-                         routes['advertised_routes'][0]['next_hop'])
diff --git a/neutron/tests/tempest/services/network/json/network_client.py b/neutron/tests/tempest/services/network/json/network_client.py
index e273f55..4a89ad5 100644
--- a/neutron/tests/tempest/services/network/json/network_client.py
+++ b/neutron/tests/tempest/services/network/json/network_client.py
@@ -47,8 +47,6 @@
         # the following map is used to construct proper URI
         # for the given neutron resource
         service_resource_prefix_map = {
-            'bgp-peers': '',
-            'bgp-speakers': '',
             'networks': '',
             'subnets': '',
             'subnetpools': '',
@@ -212,125 +210,6 @@
         self.expected_success(200, resp.status)
         return service_client.ResponseBody(resp, body)
 
-    # BGP speaker methods
-    def create_bgp_speaker(self, post_data):
-        body = self.serialize_list(post_data, "bgp-speakers", "bgp-speaker")
-        uri = self.get_uri("bgp-speakers")
-        resp, body = self.post(uri, body)
-        body = {'bgp-speaker': self.deserialize_list(body)}
-        self.expected_success(201, resp.status)
-        return service_client.ResponseBody(resp, body)
-
-    def get_bgp_speaker(self, id):
-        uri = self.get_uri("bgp-speakers")
-        bgp_speaker_uri = '%s/%s' % (uri, id)
-        resp, body = self.get(bgp_speaker_uri)
-        body = {'bgp-speaker': self.deserialize_list(body)}
-        self.expected_success(200, resp.status)
-        return service_client.ResponseBody(resp, body)
-
-    def get_bgp_speakers(self):
-        uri = self.get_uri("bgp-speakers")
-        resp, body = self.get(uri)
-        body = {'bgp-speakers': self.deserialize_list(body)}
-        self.expected_success(200, resp.status)
-        return service_client.ResponseBody(resp, body)
-
-    def update_bgp_speaker(self, id, put_data):
-        body = self.serialize_list(put_data, "bgp-speakers", "bgp-speaker")
-        uri = self.get_uri("bgp-speakers")
-        bgp_speaker_uri = '%s/%s' % (uri, id)
-        resp, body = self.put(bgp_speaker_uri, body)
-        body = {'bgp-speaker': self.deserialize_list(body)}
-        self.expected_success(200, resp.status)
-        return service_client.ResponseBody(resp, body)
-
-    def delete_bgp_speaker(self, id):
-        uri = self.get_uri("bgp-speakers")
-        bgp_speaker_uri = '%s/%s' % (uri, id)
-        resp, body = self.delete(bgp_speaker_uri)
-        self.expected_success(204, resp.status)
-        return service_client.ResponseBody(resp, body)
-
-    def create_bgp_peer(self, post_data):
-        body = self.serialize_list(post_data, "bgp-peers", "bgp-peer")
-        uri = self.get_uri("bgp-peers")
-        resp, body = self.post(uri, body)
-        body = {'bgp-peer': self.deserialize_list(body)}
-        self.expected_success(201, resp.status)
-        return service_client.ResponseBody(resp, body)
-
-    def get_bgp_peer(self, id):
-        uri = self.get_uri("bgp-peers")
-        bgp_speaker_uri = '%s/%s' % (uri, id)
-        resp, body = self.get(bgp_speaker_uri)
-        body = {'bgp-peer': self.deserialize_list(body)}
-        self.expected_success(200, resp.status)
-        return service_client.ResponseBody(resp, body)
-
-    def delete_bgp_peer(self, id):
-        uri = self.get_uri("bgp-peers")
-        bgp_speaker_uri = '%s/%s' % (uri, id)
-        resp, body = self.delete(bgp_speaker_uri)
-        self.expected_success(204, resp.status)
-        return service_client.ResponseBody(resp, body)
-
-    def add_bgp_peer_with_id(self, bgp_speaker_id, bgp_peer_id):
-        uri = '%s/bgp-speakers/%s/add_bgp_peer' % (self.uri_prefix,
-                                                   bgp_speaker_id)
-        update_body = {"bgp_peer_id": bgp_peer_id}
-        update_body = jsonutils.dumps(update_body)
-        resp, body = self.put(uri, update_body)
-        self.expected_success(200, resp.status)
-        body = jsonutils.loads(body)
-        return service_client.ResponseBody(resp, body)
-
-    def remove_bgp_peer_with_id(self, bgp_speaker_id, bgp_peer_id):
-        uri = '%s/bgp-speakers/%s/remove_bgp_peer' % (self.uri_prefix,
-                                                      bgp_speaker_id)
-        update_body = {"bgp_peer_id": bgp_peer_id}
-        update_body = jsonutils.dumps(update_body)
-        resp, body = self.put(uri, update_body)
-        self.expected_success(200, resp.status)
-        body = jsonutils.loads(body)
-        return service_client.ResponseBody(resp, body)
-
-    def add_bgp_gateway_network(self, bgp_speaker_id, network_id):
-        uri = '%s/bgp-speakers/%s/add_gateway_network' % (self.uri_prefix,
-                                                        bgp_speaker_id)
-        update_body = {"network_id": network_id}
-        update_body = jsonutils.dumps(update_body)
-        resp, body = self.put(uri, update_body)
-        self.expected_success(200, resp.status)
-        body = jsonutils.loads(body)
-        return service_client.ResponseBody(resp, body)
-
-    def remove_bgp_gateway_network(self, bgp_speaker_id, network_id):
-        uri = '%s/bgp-speakers/%s/remove_gateway_network'
-        uri = uri % (self.uri_prefix, bgp_speaker_id)
-        update_body = {"network_id": network_id}
-        update_body = jsonutils.dumps(update_body)
-        resp, body = self.put(uri, update_body)
-        self.expected_success(200, resp.status)
-        body = jsonutils.loads(body)
-        return service_client.ResponseBody(resp, body)
-
-    def get_bgp_advertised_routes(self, bgp_speaker_id):
-        base_uri = '%s/bgp-speakers/%s/get_advertised_routes'
-        uri = base_uri % (self.uri_prefix, bgp_speaker_id)
-        resp, body = self.get(uri)
-        body = {'advertised_routes': self.deserialize_list(body)}
-        self.expected_success(200, resp.status)
-        return service_client.ResponseBody(resp, body)
-
-    def get_bgp_router_routes(self, router_id):
-        base_uri = '%s/router-routes/%s'
-        uri = base_uri % (self.uri_prefix, router_id)
-        resp, body = self.get(uri)
-        body = self.deserialize_list(body)
-        self.expected_success(200, resp.status)
-        return service_client.ResponseBody(resp, body)
-
     # Common methods that are hard to automate
     def create_bulk_network(self, names, shared=False):
         network_list = [{'name': name, 'shared': shared} for name in names]
