Commit 83f800f6 authored by Yonghong Song's avatar Yonghong Song

use pyroute2 IProute to remove the stale veth

Signed-off-by: default avatarYonghong Song <yhs@plumgrid.com>
parent 1bd744d5
......@@ -48,8 +48,8 @@ class Simulation(object):
v.net_ns_fd = ns_ipdb.nl.netns
else:
# delete the potentially leaf-over veth interfaces
subprocess.call(["ip", "link", "del", "%sa" % ifc_base_name],
stderr=open(os.devnull, 'w'))
ipr = IPRoute()
for i in ipr.link_lookup(ifname='%sa' % ifc_base_name): ipr.link_remove(i)
try:
out_ifc = self.ipdb.create(ifname="%sa" % ifc_base_name, kind="veth",
peer="%sb" % ifc_base_name).commit()
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment