tests: tapv2, tunv2 and af_packet interface tests for vpp

Tests gso/gro-coalesce features on tapv2, tunv2 and af_packet
interfaces to ensure that packet transmission is enabled correctly
for various MTU sizes and interface combinations in bridged and
routed topologies for IPv4 and IPv6. Interface tests are
dynamically generated at run time from the config file
vm_test_config.py.

Type: test

Change-Id: I5f9d8cc80d20b4e34011fc8a87e35659bd9613bc
Signed-off-by: Naveen Joy <najoy@cisco.com>
This commit is contained in:
Naveen Joy
2022-10-04 14:22:05 -07:00
committed by Dave Wallace
parent d3ccb0c2fb
commit e416893a59
7 changed files with 1193 additions and 137 deletions

View File

@ -26,6 +26,7 @@ import sys
import time
import venv
import datetime
import re
# Required Std. Path Variables
@ -64,10 +65,15 @@ signal.signal(signal.SIGINT, handler)
signal.signal(signal.SIGTERM, handler)
def show_progress(stream):
def show_progress(stream, exclude_pattern=None):
"""
Read lines from a subprocess stdout/stderr streams and write
to sys.stdout & the logfile
arguments:
stream - subprocess stdout or stderr data stream
exclude_pattern - lines matching this reg-ex will be excluded
from stdout.
"""
while True:
s = stream.readline()
@ -77,7 +83,11 @@ def show_progress(stream):
# Filter the annoying SIGTERM signal from the output when VPP is
# terminated after a test run
if "SIGTERM" not in data:
sys.stdout.write(data)
if exclude_pattern is not None:
if bool(re.search(exclude_pattern, data)) is False:
sys.stdout.write(data)
else:
sys.stdout.write(data)
logging.debug(data)
sys.stdout.flush()
stream.close()
@ -222,10 +232,13 @@ def vm_test_runner(test_name, kernel_image, test_data_dir, cpu_mask, mem, jobs="
p = Popen(
[script, test_name, kernel_image, test_data_dir, cpu_mask, mem],
stdout=PIPE,
stderr=STDOUT,
cwd=ws_root,
)
show_progress(p.stdout)
# Show only the test result without clobbering the stdout.
# The VM console displays VPP stderr & Linux IPv6 netdev change
# messages, which is logged by default and can be excluded.
exclude_pattern = r"vpp\[\d+\]:|ADDRCONF\(NETDEV_CHANGE\):"
show_progress(p.stdout, exclude_pattern)
post_vm_test_run()
@ -304,6 +317,7 @@ def run_tests_in_venv(
f"--jobs={jobs}",
f"--log-dir={log_dir}",
f"--tmp-dir={log_dir}",
f"--cache-vpp-output",
]
if running_vpp:
args = args + [f"--use-running-vpp"]

View File

@ -159,14 +159,9 @@ mount -t tmpfs -o "noexec,nosuid,size=10%,mode=0755" tmpfs /run
mount -t 9p /dev/vpp9p ${WS_ROOT}
mount -t 9p tmp9p /tmp
modprobe -a vhost_net
env SOCKET=1 SANITY=no \
FAILED_DIR=${FAILED_DIR} RND_SEED=${RND_SEED} BR=${BR} \
VENV_PATH=${VENV_PATH} TEST=${TEST} TEST_JOBS=${TEST_JOBS} \
VPP_BUILD_DIR=${VPP_BUILD_DIR} VPP_BIN=${VPP_BIN} VPP_PLUGIN_PATH=${VPP_PLUGIN_PATH} \
VPP_TEST_PLUGIN_PATH=${VPP_TEST_PLUGIN_PATH} VPP_INSTALL_PATH=${VPP_INSTALL_PATH} \
LD_LIBRARY_PATH=${LD_LIBRARY_PATH} TEST_DATA_DIR=${TEST_DATA_DIR} INITRD=${INITRD} \
bash -c "${WS_ROOT}/test/scripts/run.sh --filter=${TEST} --jobs=${TEST_JOBS} --failed-dir=${FAILED_DIR} \
--venv-dir=${VENV_PATH} --vpp-ws-dir=${WS_ROOT} --extended"
${VENV_PATH}/bin/python3 ${WS_ROOT}/test/run_tests.py --filter=${TEST} --jobs=${TEST_JOBS} \
--failed-dir=${FAILED_DIR} --venv-dir=${VENV_PATH} --vpp-ws-dir=${WS_ROOT} --extended \
--vpp-tag=vpp_debug --cache-vpp-output
poweroff -f
_EOF_

View File

@ -1,102 +0,0 @@
#!/usr/bin/env python3
import unittest
from ipaddress import ip_interface
from vpp_qemu_utils import create_namespace
from vpp_iperf import VppIperf
from framework import VppTestCase, VppTestRunner
from config import config
class TestTapQemu(VppTestCase):
"""Test Tap interfaces inside a QEMU VM.
Start an iPerf connection stream between QEMU and VPP via
tap v2 interfaces.
Linux_ns1 -- iperf_client -- tap1 -- VPP-BD -- tap2 --
-- iperfServer -- Linux_ns2
"""
@classmethod
def setUpClass(cls):
super(TestTapQemu, cls).setUpClass()
@classmethod
def tearDownClass(cls):
super(TestTapQemu, cls).tearDownClass()
def setUp(self):
"""Perform test setup before running QEMU tests.
1. Create a namespace for the iPerf Server & Client.
2. Create 2 tap interfaces in VPP & add them to each namespace.
3. Add the tap interfaces to a bridge-domain.
"""
super(TestTapQemu, self).setUp()
self.client_namespace = "iprf_client_ns"
self.server_namespace = "iprf_server_ns"
self.client_ip4_prefix = "10.0.0.101/24"
self.server_ip4_prefix = "10.0.0.102/24"
create_namespace(self.client_namespace)
create_namespace(self.server_namespace)
tap1_if_idx = self.create_tap(
101, self.client_namespace, self.client_ip4_prefix
)
tap2_if_idx = self.create_tap(
102, self.server_namespace, self.server_ip4_prefix
)
self.l2_connect_interfaces(tap1_if_idx, tap2_if_idx)
def create_tap(self, id, host_namespace, host_ip4_prefix):
result = self.vapi.api(
self.vapi.papi.tap_create_v2,
{
"id": id,
"use_random_mac": True,
"host_namespace_set": True,
"host_namespace": host_namespace,
"host_if_name_set": False,
"host_bridge_set": False,
"host_mac_addr_set": False,
"host_ip4_prefix": ip_interface(host_ip4_prefix),
"host_ip4_prefix_set": True,
},
)
sw_if_index = result.sw_if_index
self.vapi.api(
self.vapi.papi.sw_interface_set_flags,
{"sw_if_index": sw_if_index, "flags": 1},
)
return sw_if_index
def dump_vpp_tap_interfaces(self):
return self.vapi.api(self.vapi.papi.sw_interface_tap_v2_dump, {})
def dump_bridge_domain_details(self):
return self.vapi.api(self.vapi.papi.bridge_domain_dump, {"bd_id": 1})
def l2_connect_interfaces(self, *sw_if_idxs):
for if_idx in sw_if_idxs:
self.vapi.api(
self.vapi.papi.sw_interface_set_l2_bridge,
{
"rx_sw_if_index": if_idx,
"bd_id": 1,
"shg": 0,
"port_type": 0,
"enable": True,
},
)
@unittest.skipUnless(config.extended, "part of extended tests")
def test_tap_iperf(self):
"""Start an iperf connection stream between QEMU & VPP via tap."""
iperf = VppIperf()
iperf.client_ns = self.client_namespace
iperf.server_ns = self.server_namespace
iperf.server_ip = str(ip_interface(self.server_ip4_prefix).ip)
iperf.start()
if __name__ == "__main__":
unittest.main(testRunner=VppTestRunner)

File diff suppressed because it is too large Load Diff

292
test/vm_test_config.py Normal file
View File

@ -0,0 +1,292 @@
#!/usr/bin/env python3
## Virtual Interface Test configuration for VM tests ##
test_config = {
"client_namespace": "iprf_client_ns",
"server_namespace": "iprf_server_ns",
"mtus": [9001, 9000, 2048, 2049, 1500, 512],
"ip_versions": [4, 6],
"af_packet": {
"iprf_client_interface_on_linux": "hostintclient",
"iprf_server_interface_on_linux": "hostintserver",
"iprf_client_interface_on_vpp": "vppclientout",
"iprf_server_interface_on_vpp": "vppserverout",
},
"L2": {
"client_ip4_prefix": "10.0.0.101/24",
"server_ip4_prefix": "10.0.0.102/24",
"client_ip6_prefix": "2001:1::1/64",
"server_ip6_prefix": "2001:1::2/64",
},
"L3": {
"client_ip4_prefix": "10.0.0.101/24",
"vpp_client_ip4_prefix": "10.0.0.102/24",
"server_ip4_prefix": "10.0.1.102/24",
"vpp_server_ip4_prefix": "10.0.1.101/24",
"ip4_vrf": 1,
"client_ip6_prefix": "2001:1::1/64",
"vpp_client_ip6_prefix": "2001:1::2/64",
"server_ip6_prefix": "2001:2::2/64",
"vpp_server_ip6_prefix": "2001:2::1/64",
"ip6_vrf": 2,
},
# Test Filter
# Comma separated test id's or range(s) of test id's to run (default=all)
# e.g. "1,3-4,19-23" runs tests with ID's 1, 3, 4, 19, 20, 21, 22 & 23 only
"tests_to_run": "",
"tests": [
{
"id": 1,
"client_if_type": "tap",
"client_if_version": 2,
"client_if_gso": 0,
"client_if_gro": 0,
"server_if_type": "tap",
"server_if_version": 2,
"server_if_gso": 0,
"server_if_gro": 0,
"x_connect_mode": "L2",
},
{
"id": 2,
"client_if_type": "tap",
"client_if_version": 2,
"client_if_gso": 1,
"client_if_gro": 0,
"server_if_type": "tap",
"server_if_version": 2,
"server_if_gso": 0,
"server_if_gro": 0,
"x_connect_mode": "L2",
},
{
"id": 3,
"client_if_type": "tap",
"client_if_version": 2,
"client_if_gso": 0,
"client_if_gro": 0,
"server_if_type": "tap",
"server_if_version": 2,
"server_if_gso": 1,
"server_if_gro": 0,
"x_connect_mode": "L2",
},
{
"id": 4,
"client_if_type": "tap",
"client_if_version": 2,
"client_if_gso": 0,
"client_if_gro": 1,
"server_if_type": "tap",
"server_if_version": 2,
"server_if_gso": 0,
"server_if_gro": 0,
"x_connect_mode": "L2",
},
{
"id": 5,
"client_if_type": "tap",
"client_if_version": 2,
"client_if_gso": 0,
"client_if_gro": 0,
"server_if_type": "tap",
"server_if_version": 2,
"server_if_gso": 0,
"server_if_gro": 1,
"x_connect_mode": "L2",
},
{
"id": 6,
"client_if_type": "tap",
"client_if_version": 2,
"client_if_gso": 1,
"client_if_gro": 0,
"server_if_type": "tap",
"server_if_version": 2,
"server_if_gso": 0,
"server_if_gro": 1,
"x_connect_mode": "L2",
},
{
"id": 7,
"client_if_type": "tap",
"client_if_version": 2,
"client_if_gso": 0,
"client_if_gro": 1,
"server_if_type": "tap",
"server_if_version": 2,
"server_if_gso": 1,
"server_if_gro": 0,
"x_connect_mode": "L2",
},
{
"id": 8,
"client_if_type": "tap",
"client_if_version": 2,
"client_if_gso": 1,
"client_if_gro": 0,
"server_if_type": "tap",
"server_if_version": 2,
"server_if_gso": 1,
"server_if_gro": 0,
"x_connect_mode": "L2",
},
{
"id": 9,
"client_if_type": "tap",
"client_if_version": 2,
"client_if_gso": 0,
"client_if_gro": 1,
"server_if_type": "tap",
"server_if_version": 2,
"server_if_gso": 0,
"server_if_gro": 1,
"x_connect_mode": "L2",
},
{
"id": 10,
"client_if_type": "tap",
"client_if_version": 2,
"client_if_gso": 0,
"client_if_gro": 0,
"server_if_type": "tun",
"server_if_version": 2,
"server_if_gso": 0,
"server_if_gro": 1,
"x_connect_mode": "L3",
},
{
"id": 11,
"client_if_type": "tun",
"client_if_version": 2,
"client_if_gso": 0,
"client_if_gro": 0,
"server_if_type": "tap",
"server_if_version": 2,
"server_if_gso": 0,
"server_if_gro": 1,
"x_connect_mode": "L3",
},
{
"id": 12,
"client_if_type": "af_packet",
"client_if_version": 3,
"client_if_gso": 0,
"server_if_type": "af_packet",
"server_if_version": 3,
"server_if_gso": 0,
"x_connect_mode": "L2",
},
{
"id": 13,
"client_if_type": "af_packet",
"client_if_version": 3,
"client_if_gso": 0,
"server_if_type": "af_packet",
"server_if_version": 3,
"server_if_gso": 0,
"x_connect_mode": "L3",
},
{
"id": 14,
"client_if_type": "af_packet",
"client_if_version": 3,
"client_if_gso": 1,
"server_if_type": "af_packet",
"server_if_version": 3,
"server_if_gso": 1,
"x_connect_mode": "L2",
},
{
"id": 15,
"client_if_type": "af_packet",
"client_if_version": 3,
"client_if_gso": 1,
"server_if_type": "af_packet",
"server_if_version": 3,
"server_if_gso": 1,
"x_connect_mode": "L3",
},
{
"id": 16,
"client_if_type": "af_packet",
"client_if_version": 3,
"client_if_gso": 1,
"server_if_type": "af_packet",
"server_if_version": 3,
"server_if_gso": 0,
"x_connect_mode": "L2",
},
{
"id": 17,
"client_if_type": "af_packet",
"client_if_version": 2,
"client_if_gso": 1,
"server_if_type": "tap",
"server_if_version": 2,
"server_if_gso": 0,
"x_connect_mode": "L2",
},
{
"id": 18,
"client_if_type": "af_packet",
"client_if_version": 2,
"client_if_gso": 1,
"server_if_type": "tun",
"server_if_version": 2,
"server_if_gso": 0,
"x_connect_mode": "L3",
},
{
"id": 19,
"client_if_type": "af_packet",
"client_if_version": 2,
"client_if_gso": 1,
"server_if_type": "af_packet",
"server_if_version": 2,
"server_if_gso": 1,
"x_connect_mode": "L3",
},
{
"id": 20,
"client_if_type": "af_packet",
"client_if_version": 2,
"client_if_gso": 0,
"server_if_type": "af_packet",
"server_if_version": 2,
"server_if_gso": 0,
"x_connect_mode": "L2",
},
{
"id": 21,
"client_if_type": "af_packet",
"client_if_version": 2,
"client_if_gso": 0,
"server_if_type": "tun",
"server_if_version": 2,
"server_if_gro": 1,
"x_connect_mode": "L3",
},
{
"id": 22,
"client_if_type": "af_packet",
"client_if_version": 3,
"client_if_gso": 0,
"server_if_type": "af_packet",
"server_if_version": 2,
"server_if_gso": 1,
"x_connect_mode": "L2",
},
{
"id": 23,
"client_if_type": "af_packet",
"client_if_version": 2,
"client_if_gso": 1,
"server_if_type": "af_packet",
"server_if_version": 2,
"server_if_gso": 1,
"x_connect_mode": "L2",
},
],
}

View File

@ -4,6 +4,7 @@
import subprocess
import os
import sys
class VppIperf:
@ -26,13 +27,14 @@ class VppIperf:
iperf.server_args='-p 5202'
"""
def __init__(self, server_ns=None, client_ns=None, server_ip=None):
def __init__(self, server_ns=None, client_ns=None, server_ip=None, logger=None):
self.server_ns = server_ns
self.client_ns = client_ns
self.server_ip = server_ip
self.duration = 10
self.client_args = ""
self.server_args = ""
self.logger = logger
# Set the iperf executable
self.iperf = os.path.join(os.getenv("TEST_DATA_DIR") or "/", "usr/bin/iperf")
@ -45,7 +47,6 @@ class VppIperf:
)
def start_iperf_server(self):
print("Starting iPerf Server Daemon in Namespace ", self.server_ns)
args = [
"ip",
"netns",
@ -54,22 +55,22 @@ class VppIperf:
self.iperf,
"-s",
"-D",
"-B",
self.server_ip,
]
args.extend(self.server_args.split())
args = " ".join(args)
try:
subprocess.run(
return subprocess.run(
args,
stderr=subprocess.STDOUT,
timeout=self.duration + 5,
encoding="utf-8",
shell=True,
stdout=subprocess.PIPE,
stderr=subprocess.STDOUT,
)
except subprocess.TimeoutExpired as e:
raise Exception("Error: Timeout expired for iPerf", e.output)
def start_iperf_client(self):
print("Starting iPerf Client in Namespace ", self.client_ns)
args = [
"ip",
"netns",
@ -82,30 +83,107 @@ class VppIperf:
str(self.duration),
]
args.extend(self.client_args.split())
args = " ".join(args)
try:
subprocess.run(
return subprocess.run(
args,
stderr=subprocess.STDOUT,
timeout=self.duration + 5,
encoding="utf-8",
capture_output=True,
shell=True,
)
except subprocess.TimeoutExpired as e:
raise Exception("Error: Timeout expired for iPerf", e.output)
def start(self):
"""Run iPerf and return True if successful"""
self.ensure_init()
try:
self.start_iperf_server()
except Exception as e:
subprocess.run(["pkill", "iperf"])
raise Exception("Error starting iPerf Server", e)
def start(self, server_only=False, client_only=False):
"""Runs iPerf.
try:
self.start_iperf_client()
except Exception as e:
raise Exception("Error starting iPerf Client", e)
subprocess.run(["pkill", "iperf"])
Starts the iperf server daemon & runs the iperf client.
arguments:-
server_only -- start the iperf server daemon only
client_only -- run the iperf client only
Return True if we have no errors in iPerf client, else False.
"""
self.ensure_init()
if not client_only:
self.start_iperf_server()
if not server_only:
result = self.start_iperf_client()
self.logger.debug(f"Iperf client args: {result.args}")
self.logger.debug(result.stdout)
if result.stderr:
self.logger.error(
f"Error starting Iperf Client in Namespace: {self.client_ns}"
)
self.logger.error(f"Iperf client args: {result.args}")
self.logger.error(f"Iperf client has errors: {result.stderr}")
return False
else:
return True
## Functions to start and stop iPerf using the iPerf object
def start_iperf(
ip_version,
client_ns="iprf_client_ns",
server_ns="iprf_server_ns",
server_ipv4_address="10.0.0.102",
server_ipv6_address="2001:1::2",
client_args="",
server_args="",
duration=10,
server_only=False,
client_only=False,
logger=None,
):
"""Start an iperf connection stream using the iPerf object.
Starts iPerf an connection stream between an iPerf client in the
client namespace (client_ns) and a server in another
namespace (server_ns).
Parameters:
ip_version - 4 or 6
client_ns - iPerf client namespace
server_ns - iPerf server namespace
server_ipv4_address - ipv4 address of the server, if ip_version=4
server_ipv6_address - ipv6 address of the server, if ip_version=6
client_args - Additonal iperf control arguments to be passed
to the iperf client from the test (str)
server_args - Additonal iperf control arguments to be passed
to the iperf server from the test (str)
duration - Iperf duration in seconds
server_only - start iperf server only
client_only - start the iperf client only
logger - test logger
"""
if ip_version == 4:
iperf_server_ip = server_ipv4_address
elif ip_version == 6:
iperf_server_ip = server_ipv6_address
client_args = "-V" + " " + client_args
server_args = "-V" + " " + server_args
iperf = VppIperf()
iperf.client_ns = client_ns
iperf.server_ns = server_ns
iperf.server_ip = iperf_server_ip
iperf.client_args = client_args
iperf.server_args = server_args
iperf.duration = duration
iperf.logger = logger
return iperf.start(server_only=server_only, client_only=client_only)
def stop_iperf():
args = ["pkill", "iperf"]
args = " ".join(args)
try:
return subprocess.run(
args,
encoding="utf-8",
shell=True,
)
except Exception:
pass
if __name__ == "__main__":

View File

@ -3,15 +3,215 @@
# Utility functions for QEMU tests ##
import subprocess
import sys
def create_namespace(ns):
"""create one or more namespaces.
arguments:
ns -- a string value or an iterable of namespace names
"""
if isinstance(ns, str):
namespaces = [ns]
else:
namespaces = ns
try:
subprocess.run(["ip", "netns", "add", ns])
for namespace in namespaces:
subprocess.run(["ip", "netns", "add", namespace])
except subprocess.CalledProcessError as e:
raise Exception("Error creating namespace:", e.output)
def add_namespace_route(ns, prefix, gw_ip):
"""Add a route to a namespace.
arguments:
ns -- namespace string value
prefix -- NETWORK/MASK or "default"
gw_ip -- Gateway IP
"""
try:
subprocess.run(
["ip", "netns", "exec", ns, "ip", "route", "add", prefix, "via", gw_ip],
capture_output=True,
)
except subprocess.CalledProcessError as e:
raise Exception("Error adding route to namespace:", e.output)
def delete_host_interfaces(*host_interface_names):
"""Delete host interfaces.
arguments:
host_interface_names - sequence of host interface names to be deleted
"""
for host_interface_name in host_interface_names:
try:
subprocess.run(
["ip", "link", "del", host_interface_name], capture_output=True
)
except subprocess.CalledProcessError as e:
raise Exception("Error deleting host interface:", e.output)
def create_host_interface(
host_interface_name, vpp_interface_name, host_namespace, *host_ip_prefixes
):
"""Create a host interface of type veth.
arguments:
host_interface_name -- name of the veth interface on the host side
vpp_interface_name -- name of the veth interface on the VPP side
host_namespace -- host namespace into which the host_interface needs to be set
host_ip_prefixes -- a sequence of ip/prefix-lengths to be set
on the host_interface
"""
try:
process = subprocess.run(
[
"ip",
"link",
"add",
"name",
vpp_interface_name,
"type",
"veth",
"peer",
"name",
host_interface_name,
],
capture_output=True,
)
if process.returncode != 0:
print(f"Error creating host interface: {process.stderr}")
sys.exit(1)
process = subprocess.run(
["ip", "link", "set", host_interface_name, "netns", host_namespace],
capture_output=True,
)
if process.returncode != 0:
print(f"Error setting host interface namespace: {process.stderr}")
sys.exit(1)
process = subprocess.run(
["ip", "link", "set", "dev", vpp_interface_name, "up"], capture_output=True
)
if process.returncode != 0:
print(f"Error bringing up the host interface: {process.stderr}")
sys.exit(1)
process = subprocess.run(
[
"ip",
"netns",
"exec",
host_namespace,
"ip",
"link",
"set",
"dev",
host_interface_name,
"up",
],
capture_output=True,
)
if process.returncode != 0:
print(
f"Error bringing up the host interface in namespace: "
f"{process.stderr}"
)
sys.exit(1)
for host_ip_prefix in host_ip_prefixes:
process = subprocess.run(
[
"ip",
"netns",
"exec",
host_namespace,
"ip",
"addr",
"add",
host_ip_prefix,
"dev",
host_interface_name,
],
capture_output=True,
)
if process.returncode != 0:
print(
f"Error setting ip prefix on the host interface: "
f"{process.stderr}"
)
sys.exit(1)
except subprocess.CalledProcessError as e:
raise Exception("Error adding route to namespace:", e.output)
def set_interface_mtu(namespace, interface, mtu, logger):
"""set an mtu number on a linux device interface."""
args = ["ip", "link", "set", "mtu", str(mtu), "dev", interface]
if namespace:
args = ["ip", "netns", "exec", namespace] + args
try:
logger.debug(
f"Setting mtu:{mtu} on linux interface:{interface} "
f"in namespace:{namespace}"
)
subprocess.run(args)
except subprocess.CalledProcessError as e:
raise Exception("Error updating mtu:", e.output)
def enable_interface_gso(namespace, interface):
"""enable gso offload on a linux device interface."""
args = ["ethtool", "-K", interface, "rx", "on", "tx", "on"]
if namespace:
args = ["ip", "netns", "exec", namespace] + args
try:
process = subprocess.run(args, capture_output=True)
if process.returncode != 0:
print(
f"Error enabling GSO offload on linux device interface: "
f"{process.stderr}"
)
sys.exit(1)
except subprocess.CalledProcessError as e:
raise Exception("Error enabling gso:", e.output)
def disable_interface_gso(namespace, interface):
"""disable gso offload on a linux device interface."""
args = ["ethtool", "-K", interface, "rx", "off", "tx", "off"]
if namespace:
args = ["ip", "netns", "exec", namespace] + args
try:
process = subprocess.run(args, capture_output=True)
if process.returncode != 0:
print(
f"Error disabling GSO offload on linux device interface: "
f"{process.stderr}"
)
sys.exit(1)
except subprocess.CalledProcessError as e:
raise Exception("Error disabling gso:", e.output)
def delete_namespace(namespaces):
"""delete one or more namespaces.
arguments:
namespaces -- a list of namespace names
"""
try:
for namespace in namespaces:
subprocess.run(["ip", "netns", "del", namespace], capture_output=True)
except subprocess.CalledProcessError as e:
raise Exception("Error deleting namespace:", e.output)
def list_namespace(ns):
"""List the IP address of a namespace"""
try: