aboutsummaryrefslogtreecommitdiffstats
path: root/test/vpp_qemu_utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'test/vpp_qemu_utils.py')
-rw-r--r--test/vpp_qemu_utils.py20
1 files changed, 20 insertions, 0 deletions
diff --git a/test/vpp_qemu_utils.py b/test/vpp_qemu_utils.py
new file mode 100644
index 00000000000..50fc1c865a6
--- /dev/null
+++ b/test/vpp_qemu_utils.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+
+# Utility functions for QEMU tests ##
+
+import subprocess
+
+
+def create_namespace(ns):
+ try:
+ subprocess.run(["ip", "netns", "add", ns])
+ except subprocess.CalledProcessError as e:
+ raise Exception("Error creating namespace:", e.output)
+
+
+def list_namespace(ns):
+ """List the IP address of a namespace"""
+ try:
+ subprocess.run(["ip", "netns", "exec", ns, "ip", "addr"])
+ except subprocess.CalledProcessError as e:
+ raise Exception("Error listing namespace IP:", e.output)