From bab6dd6de2b778372e9531f2eea94e3fe947f568 Mon Sep 17 00:00:00 2001 From: Vasyl Saienko Date: Fri, 22 Sep 2017 18:43:40 +0300 Subject: [PATCH] Fix API VIF tests when using flat network Instead of creating new network, pick one that is specified in config when using shared network. Change-Id: I927fe55de77956427916dba682f6927c4a8d9882 --- .../tests/api/admin/test_nodes.py | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/ironic_tempest_plugin/tests/api/admin/test_nodes.py b/ironic_tempest_plugin/tests/api/admin/test_nodes.py index 0500f4f0b8..08a57e0525 100644 --- a/ironic_tempest_plugin/tests/api/admin/test_nodes.py +++ b/ironic_tempest_plugin/tests/api/admin/test_nodes.py @@ -299,16 +299,19 @@ class TestNodesVif(base.BaseBaremetalTest): _, self.chassis = self.create_chassis() _, self.node = self.create_node(self.chassis['uuid']) - self.net = self.admin_manager.networks_client.create_network() + if CONF.network.shared_physical_network: + self.net = self.os_admin.networks_client.list_networks( + name=CONF.compute.fixed_network_name)['networks'][0] + else: + self.net = self.os_admin.networks_client.\ + create_network()['network'] + self.addCleanup(self.os_admin.networks_client.delete_network, + self.net['id']) - self.nport_id = self.admin_manager.ports_client.create_port( - network_id=self.net['network']['id'])['port']['id'] - - def tearDown(self): - super(TestNodesVif, self).tearDown() - self.admin_manager.ports_client.delete_port(self.nport_id) - self.admin_manager.networks_client.delete_network( - self.net['network']['id']) + self.nport_id = self.os_admin.ports_client.create_port( + network_id=self.net['id'])['port']['id'] + self.addCleanup(self.os_admin.ports_client.delete_port, + self.nport_id) @decorators.idempotent_id('a3d319d0-cacb-4e55-a3dc-3fa8b74880f1') def test_vif_on_port(self):