tests: cli wrapper should return string

Python3 fixes.

Type: fix
Signed-off-by: Ole Troan <ot@cisco.com>
Change-Id: I648b2142d45dfab9146a02eeb1b12de11103ff9f
Signed-off-by: Ole Troan <ot@cisco.com>
diff --git a/test/framework.py b/test/framework.py
index fb14465..c1bfaa7 100644
--- a/test/framework.py
+++ b/test/framework.py
@@ -175,14 +175,16 @@
         if testclass.vpp.stderr.fileno() in readable:
             read = os.read(testclass.vpp.stderr.fileno(), 102400)
             if len(read) > 0:
-                split = read.splitlines(True)
+                split = read.decode('ascii',
+                                    errors='backslashreplace').splitlines(True)
                 if len(stderr_fragment) > 0:
                     split[0] = "%s%s" % (stderr_fragment, split[0])
-                if len(split) > 0 and split[-1].endswith(b"\n"):
+                if len(split) > 0 and split[-1].endswith("\n"):
                     limit = None
                 else:
                     limit = -1
                     stderr_fragment = split[-1]
+
                 testclass.vpp_stderr_deque.extend(split[:limit])
                 if not testclass.cache_vpp_output:
                     for line in split[:limit]:
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 60bc023..af0c319 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -100,7 +100,7 @@
         :param int packet_size: Required packet size.
         :param Scapy pkt: Packet to be modified.
         """
-        dst_if_idx = packet_size / 10 % 2
+        dst_if_idx = int(packet_size / 10 % 2)
         dst_if = self.flows[src_if][dst_if_idx]
         info = self.create_packet_info(src_if, dst_if)
         payload = self.info_to_payload(info)
@@ -377,7 +377,7 @@
 
         icmp_id = 0xb
         icmp_seq = 5
-        icmp_load = '\x0a' * 18
+        icmp_load = b'\x0a' * 18
         p_echo_request = (Ether(src=self.pg0.remote_mac,
                                 dst=self.pg0.local_mac) /
                           IP(src=self.pg0.remote_ip4, dst=self.pg0.local_ip4) /
@@ -1938,7 +1938,7 @@
         packets = self.dst_if.get_capture(3)
 
         # Assume VPP sends the fragments in order
-        payload = ''
+        payload = b''
         for p in packets:
             payload_offset = p.frag * 8
             if payload_offset > 0:
diff --git a/test/util.py b/test/util.py
index 96d3c60..ed6c409 100644
--- a/test/util.py
+++ b/test/util.py
@@ -58,7 +58,7 @@
 
 # wrapper around scapy library function.
 def mk_ll_addr(mac):
-    euid = in6_mactoifaceid(mac)
+    euid = in6_mactoifaceid(str(mac))
     addr = "fe80::" + euid
     return addr
 
diff --git a/test/vpp_interface.py b/test/vpp_interface.py
index 1e047f5..431a03a 100644
--- a/test/vpp_interface.py
+++ b/test/vpp_interface.py
@@ -33,7 +33,7 @@
     @property
     def local_mac(self):
         """MAC-address of the VPP interface."""
-        return self._local_mac
+        return str(self._local_mac)
 
     @property
     def local_addr(self):
@@ -260,9 +260,8 @@
         r = self.test.vapi.sw_interface_dump(sw_if_index=self.sw_if_index)
         for intf in r:
             if intf.sw_if_index == self.sw_if_index:
-                self._name = intf.interface_name.split(b'\0',
-                                                       1)[0].decode('utf8')
-                self._local_mac = bytes(intf.l2_address)
+                self._name = intf.interface_name
+                self._local_mac = intf.l2_address
                 self._dump = intf
                 break
         else:
diff --git a/test/vpp_papi_provider.py b/test/vpp_papi_provider.py
index d80f2ed..297c159 100644
--- a/test/vpp_papi_provider.py
+++ b/test/vpp_papi_provider.py
@@ -369,8 +369,7 @@
         :param cli: CLI to execute
         :returns: CLI output
         """
-        return cli + "\n" + self.cli(cli).encode('ascii',
-                                                 errors='backslashreplace')
+        return cli + "\n" + self.cli(cli)
 
     def want_ip4_arp_events(self, enable_disable=1, ip="0.0.0.0"):
         return self.api(self.papi.want_ip4_arp_events,