From 0d7b2a93bc8dcd94ab4098e3053dc1106e25f631 Mon Sep 17 00:00:00 2001 From: Roman Safronov Date: Thu, 25 Jul 2024 17:08:19 +0300 Subject: [PATCH] Remove redundant OCP nodes interfaces discover After code was changed for capture traffic on ovn-controller-ovs container rather than on OCP nodes bridges there is no longer need to discover OCP nodes interfaces. Change-Id: I7ef62a2e46758345034c61c06222f8845c6f71f8 --- whitebox_neutron_tempest_plugin/config.py | 6 ++-- .../tests/scenario/base.py | 34 ++++--------------- 2 files changed, 9 insertions(+), 31 deletions(-) diff --git a/whitebox_neutron_tempest_plugin/config.py b/whitebox_neutron_tempest_plugin/config.py index 287b4e7..cd0ad71 100644 --- a/whitebox_neutron_tempest_plugin/config.py +++ b/whitebox_neutron_tempest_plugin/config.py @@ -115,9 +115,9 @@ WhiteboxNeutronPluginOptions = [ default='/etc/neutron/plugins/ml2/ml2_conf.ini', help='Path to ml2 plugin config.'), cfg.StrOpt('ext_bridge', - default='{"default": "ospbr", "alt": "br-ex"}', - help="Bridge dedicated for external network. Dict with values " - "for default node and alternative node (if exist)."), + default='br-ex', + help="Bridge dedicated for external network. It is used for " + "capturing traffic for routing tests."), cfg.StrOpt('node_ext_interface', default=None, help='Physical interface of a node that is connected to the' diff --git a/whitebox_neutron_tempest_plugin/tests/scenario/base.py b/whitebox_neutron_tempest_plugin/tests/scenario/base.py index b82bf8a..0b4d17e 100644 --- a/whitebox_neutron_tempest_plugin/tests/scenario/base.py +++ b/whitebox_neutron_tempest_plugin/tests/scenario/base.py @@ -14,7 +14,6 @@ # under the License. import base64 from functools import partial -import json from multiprocessing import Process import os import random @@ -69,7 +68,6 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase): sriov_agents = [ agent for agent in agents if 'sriov' in agent['binary']] cls.has_sriov_support = True if sriov_agents else False - cls.ext_bridge = json.loads(WB_CONF.ext_bridge) cls.neutron_conf = local_constants.NEUTRON_CONF[WB_CONF.openstack_type] # deployer tool dependent variables if WB_CONF.openstack_type == 'devstack': @@ -121,16 +119,6 @@ class BaseTempestWhiteboxTestCase(base.BaseTempestTestCase): subnet['ip_version'] == constants.IP_VERSION_4): return subnet['gateway_ip'] - def get_external_bridge(self, client): - commands = [ - "sudo ip -o link show type bridge | cut -d ' ' -f 2 | tr -d ':'", - "sudo ovs-vsctl list-br"] - for cmd in commands: - result = client.exec_command(cmd).strip().split() - if self.ext_bridge['default'] in result: - return self.ext_bridge['default'] - return self.ext_bridge['alt'] - @staticmethod def get_node_client( host, username=WB_CONF.overcloud_ssh_user, pkey=None, @@ -1090,22 +1078,12 @@ class TrafficFlowTest(BaseTempestWhiteboxTestCase): def _start_captures(self, filters, interface=None): def get_interface(client): - # (rsafrono) discover interfaces, useful when capturing on - # nodes and different types of nodes have different interfaces, - # e.g. on podified environment ocp and compute have different - # names of interfaces connected to external network - bridge = self.get_external_bridge(client) - filters = [r"| grep 'eth\|enp\|ens' | grep -v veth ", - "| cut -f2 -d ' ' | tr -d ':'"] - commands = [ - "sudo ovs-vsctl list-ports " + bridge + filters[0], - "sudo ip -o link show master " + bridge + filters[0] + - filters[1]] - for cmd in commands: - interfaces = client.exec_command( - cmd + " || true").strip().split() - if interfaces: - return ','.join(interfaces) + interfaces = client.exec_command( + "sudo ovs-vsctl list-ports " + WB_CONF.ext_bridge + + r"| grep 'eth\|enp\|ens' | grep -v veth " + + "|| true").strip().split() + if interfaces: + return ','.join(interfaces) for node in self.nodes: if not(node['is_controller'] or