blob: 50fc1c865a6a53e675a12f6332c3a351e91b9ca3 [file] [log] [blame]
#!/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)