Commit ad44963c authored by Yonghong Song's avatar Yonghong Song

python commands module is removed in python 3, use subprocess

Signed-off-by: default avatarYonghong Song <yhs@plumgrid.com>
parent a5c3c707
...@@ -73,7 +73,6 @@ import sys ...@@ -73,7 +73,6 @@ import sys
from time import sleep from time import sleep
from unittest import main, TestCase from unittest import main, TestCase
import subprocess import subprocess
import commands
import struct import struct
arg1 = sys.argv.pop(1) arg1 = sys.argv.pop(1)
...@@ -232,8 +231,10 @@ class TestBPFSocket(TestCase): ...@@ -232,8 +231,10 @@ class TestBPFSocket(TestCase):
self.config_router_ns(self.ns_router, self.vm1_rtr_ip, self.vm2_rtr_ip) self.config_router_ns(self.ns_router, self.vm1_rtr_ip, self.vm2_rtr_ip)
# get vm mac address # get vm mac address
self.vm1_mac = commands.getoutput('ip netns exec ' + self.ns1 + ' cat /sys/class/net/eth0/address') self.vm1_mac = subprocess.check_output(["ip", "netns", "exec", self.ns1, "cat", "/sys/class/net/eth0/address"])
self.vm2_mac = commands.getoutput('ip netns exec ' + self.ns2 + ' cat /sys/class/net/eth0/address') self.vm1_mac = self.vm1_mac.strip()
self.vm2_mac = subprocess.check_output(["ip", "netns", "exec", self.ns2, "cat", "/sys/class/net/eth0/address"])
self.vm2_mac = self.vm2_mac.strip()
# load the program and configure maps # load the program and configure maps
self.config_maps() self.config_maps()
......
...@@ -66,7 +66,6 @@ import sys ...@@ -66,7 +66,6 @@ import sys
from time import sleep from time import sleep
from unittest import main, TestCase from unittest import main, TestCase
import subprocess import subprocess
import commands
arg1 = sys.argv.pop(1) arg1 = sys.argv.pop(1)
......
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