Remove support of nova-network

Since nova network feature is deprecated long time ago and was used
when neutron service is not enabled then nova lists the network and
set the compute.fixed_network_name in tempest.conf.

Since now networking is taken care by neutron, so it is no longer
needed.

nova network related client code is also removed.

Change-Id: I47c791e9257e262f6ac17fffaa2b4af6273a168e
Signed-off-by: Chandan Kumar (raukadah) <chkumar@redhat.com>
This commit is contained in:
Chandan Kumar (raukadah) 2020-01-16 18:08:35 +05:30
parent 4410537ebe
commit b4c1b01855
5 changed files with 11 additions and 50 deletions

View File

@ -16,7 +16,6 @@
from tempest.lib import exceptions from tempest.lib import exceptions
from tempest.lib.services.compute import flavors_client from tempest.lib.services.compute import flavors_client
from tempest.lib.services.compute import hosts_client from tempest.lib.services.compute import hosts_client
from tempest.lib.services.compute import networks_client as nova_net_client
from tempest.lib.services.compute import servers_client from tempest.lib.services.compute import servers_client
from tempest.lib.services.identity.v2 import identity_client from tempest.lib.services.identity.v2 import identity_client
from tempest.lib.services.identity.v2 import roles_client from tempest.lib.services.identity.v2 import roles_client
@ -158,12 +157,6 @@ class ClientManager(object):
self.networks = None self.networks = None
def create_nova_network_client():
if self.networks is None:
self.networks = nova_net_client.NetworksClient(
self.auth_provider, **compute_params)
return self.networks
def create_neutron_client(): def create_neutron_client():
if self.networks is None: if self.networks is None:
self.networks = networks_client.NetworksClient( self.networks = networks_client.NetworksClient(
@ -175,7 +168,6 @@ class ClientManager(object):
**default_params) **default_params)
return self.networks return self.networks
self.get_nova_net_client = create_nova_network_client
self.get_neutron_client = create_neutron_client self.get_neutron_client = create_neutron_client
# Set admin project id needed for keystone v3 tests. # Set admin project id needed for keystone v3 tests.

View File

@ -544,13 +544,9 @@ def config_tempest(**kwargs):
False)) False))
image.create_tempest_images(conf) image.create_tempest_images(conf)
# FIXME(chkumar246): Remove dead code of nova_network if services.is_service(**{"type": "network"}):
# as it is deprecated long time ago.
has_neutron = services.is_service(**{"type": "network"})
if has_neutron:
network = services.get_service("network") network = services.get_service("network")
network.create_tempest_networks(has_neutron, conf, network.create_tempest_networks(conf, kwargs.get('network_id'))
kwargs.get('network_id'))
services.post_configuration() services.post_configuration()
services.set_supported_api_versions() services.set_supported_api_versions()

View File

@ -25,15 +25,10 @@ class NetworkService(VersionedService):
body = json.loads(body) body = json.loads(body)
self.extensions = list(map(lambda x: x['alias'], body['extensions'])) self.extensions = list(map(lambda x: x['alias'], body['extensions']))
def create_tempest_networks(self, has_neutron, conf, network_id): def create_tempest_networks(self, conf, network_id):
LOG.info("Setting up network") LOG.info("Setting up network")
LOG.debug("Is neutron present: {0}".format(has_neutron)) self.client = self.client.get_neutron_client()
if has_neutron: self.create_tempest_networks_neutron(conf, network_id)
self.client = self.client.get_neutron_client()
self.create_tempest_networks_neutron(conf, network_id)
else:
self.client = self.client.get_nova_net_client()
self.create_tempest_networks_nova(conf)
def create_tempest_networks_neutron(self, conf, public_network_id): def create_tempest_networks_neutron(self, conf, public_network_id):
self._public_network_name = None self._public_network_name = None
@ -82,16 +77,6 @@ class NetworkService(VersionedService):
"Please note that any test that relies on external " "Please note that any test that relies on external "
"connectivity would most likely fail.") "connectivity would most likely fail.")
def create_tempest_networks_nova(self, conf):
networks = self.client.list_networks()
if networks:
label = networks['networks'][0]['label']
if label:
conf.set('compute', 'fixed_network_name', label)
else:
raise Exception('fixed_network_name could not be '
'discovered and must be specified')
@staticmethod @staticmethod
def get_service_type(): def get_service_type():
return ['network'] return ['network']

View File

@ -82,21 +82,3 @@ class TestNetworkService(BaseServiceTest):
self.Service._discover_network() self.Service._discover_network()
# check if LOG.error was called # check if LOG.error was called
self.assertTrue(mock_logging.error.called) self.assertTrue(mock_logging.error.called)
def test_network_not_discovered(self):
FAKE_NETWORK_LIST = {
'networks': [{
'label': ""
}]
}
exception = Exception
self.Service.client.return_value = FAKE_NETWORK_LIST
self.assertRaises(exception,
self.Service.create_tempest_networks_nova,
conf=self.conf)
def test_create_fixed_network(self):
self.Service.client.return_value = self.FAKE_NETWORK_LIST
self.Service.create_tempest_networks_nova(conf=self.conf)
self.assertEqual(self.conf.get('compute', 'fixed_network_name'),
'my_fake_label')

View File

@ -0,0 +1,6 @@
---
other:
- |
It removes the support of nova network.
It also removes the setting of following config in tempest.conf:
- compute.fixed_network_name