http_static: misc bug fixes
[vpp.git] / test / vpp_qemu_utils.py
1 #!/usr/bin/env python
2
3 # Utility functions for QEMU tests ##
4
5 import subprocess
6
7
8 def create_namespace(ns):
9     try:
10         subprocess.run(["ip", "netns", "add", ns])
11     except subprocess.CalledProcessError as e:
12         raise Exception("Error creating namespace:", e.output)
13
14
15 def list_namespace(ns):
16     """List the IP address of a namespace"""
17     try:
18         subprocess.run(["ip", "netns", "exec", ns, "ip", "addr"])
19     except subprocess.CalledProcessError as e:
20         raise Exception("Error listing namespace IP:", e.output)