Commit f51da402 authored by Brenden Blanco's avatar Brenden Blanco

Fix python3 incompatible code in tests

Signed-off-by: default avatarBrenden Blanco <bblanco@plumgrid.com>
parent d6197f30
...@@ -65,7 +65,7 @@ ...@@ -65,7 +65,7 @@
# 8: OK # 8: OK
from ctypes import c_ubyte, c_ushort, c_uint, c_ulonglong, Structure from ctypes import c_ubyte, c_ushort, c_uint, c_ulonglong, Structure
from netaddr import IPAddress from netaddr import IPAddress, EUI
from bpf import BPF from bpf import BPF
from pyroute2 import IPRoute from pyroute2 import IPRoute
from socket import socket, AF_INET, SOCK_DGRAM from socket import socket, AF_INET, SOCK_DGRAM
...@@ -160,7 +160,7 @@ class TestBPFSocket(TestCase): ...@@ -160,7 +160,7 @@ class TestBPFSocket(TestCase):
ifindex = ip.link_lookup(ifname=ns_eth_out)[0] ifindex = ip.link_lookup(ifname=ns_eth_out)[0]
self.pem_port.update(c_uint(curr_pem_pid), c_uint(ifindex)) self.pem_port.update(c_uint(curr_pem_pid), c_uint(ifindex))
self.pem_ifindex.update(c_uint(ifindex), c_uint(curr_pem_pid)) self.pem_ifindex.update(c_uint(ifindex), c_uint(curr_pem_pid))
mac_addr = Eth_Addr(struct.unpack('!Q', "\0\0" + vm_mac.replace(':', '').decode('hex'))[0]) mac_addr = Eth_Addr(int(EUI(vm_mac.decode())))
br_mac_map.update(mac_addr, c_uint(curr_br_pid)) br_mac_map.update(mac_addr, c_uint(curr_br_pid))
def attach_filter(self, ip, ifname, fd, name): def attach_filter(self, ip, ifname, fd, name):
...@@ -232,9 +232,9 @@ class TestBPFSocket(TestCase): ...@@ -232,9 +232,9 @@ class TestBPFSocket(TestCase):
# get vm mac address # get vm mac address
self.vm1_mac = subprocess.check_output(["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.vm1_mac = self.vm1_mac.strip() 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 = subprocess.check_output(["ip", "netns", "exec", self.ns2, "cat", "/sys/class/net/eth0/address"])
self.vm2_mac = self.vm2_mac.strip() 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()
......
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