Merge "Remove redundant OCP nodes interfaces discover"

This commit is contained in:
Zuul 2024-07-28 17:39:48 +00:00 committed by Gerrit Code Review
commit 9842cc2393
2 changed files with 9 additions and 31 deletions

View File

@ -121,9 +121,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'

View File

@ -14,7 +14,6 @@
# under the License.
import base64
from functools import partial
import json
from multiprocessing import Process
import os
import random
@ -70,7 +69,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':
@ -122,16 +120,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,
@ -1048,22 +1036,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