tests: Remove the unrequired VPP IP address/prefix class wrappers

Type: refactor

Change-Id: I204f3f8eebc5f5d5a377e91262f91c615fd00168
Signed-off-by: Neale Ranns <nranns@cisco.com>
diff --git a/test/vpp_interface.py b/test/vpp_interface.py
index a5f6f45..9bfa880 100644
--- a/test/vpp_interface.py
+++ b/test/vpp_interface.py
@@ -7,8 +7,7 @@
 
 from util import Host, mk_ll_addr
 from vpp_papi import mac_ntop, VppEnum
-from vpp_ip import VppIpAddress, VppIpPrefix
-from ipaddress import IPv4Network
+from ipaddress import IPv4Network, IPv6Network
 
 try:
     text_type = unicode
@@ -46,31 +45,31 @@
     @property
     def local_ip4(self):
         """Local IPv4 address on VPP interface (string)."""
-        return self._local_ip4.address
+        return self._local_ip4
 
     @local_ip4.setter
     def local_ip4(self, value):
-        self._local_ip4.address = value
+        self._local_ip4 = value
 
     @property
     def local_ip4_prefix_len(self):
         """Local IPv4 prefix length """
-        return self._local_ip4.len
+        return self._local_ip4_len
 
     @local_ip4_prefix_len.setter
     def local_ip4_prefix_len(self, value):
-        self._local_ip4.len = value
+        self._local_ip4_len = value
 
     @property
     def local_ip4_prefix(self):
         """Local IPv4 prefix """
-        return self._local_ip4
+        return ("%s/%d" % (self._local_ip4, self._local_ip4_len))
 
     @property
     def local_ip4n(self):
         """DEPRECATED """
         """Local IPv4 address - raw, suitable as API parameter."""
-        return socket.inet_pton(socket.AF_INET, self._local_ip4.address)
+        return socket.inet_pton(socket.AF_INET, self._local_ip4)
 
     @property
     def remote_ip4(self):
@@ -86,31 +85,31 @@
     @property
     def local_ip6(self):
         """Local IPv6 address on VPP interface (string)."""
-        return self._local_ip6.address
+        return self._local_ip6
 
     @local_ip6.setter
     def local_ip6(self, value):
-        self._local_ip6.address = value
+        self._local_ip6
 
     @property
     def local_ip6_prefix_len(self):
         """Local IPv6 prefix length """
-        return self._local_ip6.len
+        return self._local_ip6_len
 
     @local_ip6_prefix_len.setter
     def local_ip6_prefix_len(self, value):
-        self._local_ip6.len = value
+        self._local_ip6_len = value
 
     @property
     def local_ip6_prefix(self):
-        """Local IPv6 prefix """
-        return self._local_ip6
+        """Local IPv4 prefix """
+        return ("%s/%d" % (self._local_ip6, self._local_ip6_len))
 
     @property
     def local_ip6n(self):
         """DEPRECATED """
         """Local IPv6 address - raw, suitable as API parameter."""
-        return socket.inet_pton(socket.AF_INET6, self._local_ip6.address)
+        return socket.inet_pton(socket.AF_INET6, self._local_ip6)
 
     @property
     def remote_ip6(self):
@@ -126,7 +125,7 @@
     @property
     def local_ip6_ll(self):
         """Local IPv6 link-local address on VPP interface (string)."""
-        return self._local_ip6_ll.address
+        return self._local_ip6_ll
 
     @property
     def local_ip6n_ll(self):
@@ -233,7 +232,7 @@
 
     def set_mac(self, mac):
         self._local_mac = str(mac)
-        self._local_ip6_ll = VppIpAddress(mk_ll_addr(self._local_mac))
+        self._local_ip6_ll = mk_ll_addr(self._local_mac)
         self.test.vapi.sw_interface_set_mac_address(
             self.sw_if_index, mac.packed)
 
@@ -242,13 +241,15 @@
 
         self.generate_remote_hosts()
 
-        self._local_ip4 = VppIpPrefix("172.16.%u.1" % self.sw_if_index, 24)
+        self._local_ip4 = "172.16.%u.1" % self.sw_if_index
+        self._local_ip4_len = 24
         self._local_ip4_subnet = "172.16.%u.0" % self.sw_if_index
         self._local_ip4_bcast = "172.16.%u.255" % self.sw_if_index
         self.has_ip4_config = False
         self.ip4_table_id = 0
 
-        self._local_ip6 = VppIpPrefix("fd01:%x::1" % self.sw_if_index, 64)
+        self._local_ip6 = "fd01:%x::1" % self.sw_if_index
+        self._local_ip6_len = 64
         self.has_ip6_config = False
         self.ip6_table_id = 0
 
@@ -269,13 +270,13 @@
                 "Could not find interface with sw_if_index %d "
                 "in interface dump %s" %
                 (self.sw_if_index, moves.reprlib.repr(r)))
-        self._local_ip6_ll = VppIpAddress(mk_ll_addr(self.local_mac))
+        self._local_ip6_ll = mk_ll_addr(self.local_mac)
         self._remote_ip6_ll = mk_ll_addr(self.remote_mac)
 
     def config_ip4(self):
         """Configure IPv4 address on the VPP interface."""
         self.test.vapi.sw_interface_add_del_address(
-            sw_if_index=self.sw_if_index, prefix=self._local_ip4.encode())
+            sw_if_index=self.sw_if_index, prefix=self.local_ip4_prefix)
         self.has_ip4_config = True
 
     def unconfig_ip4(self):
@@ -284,7 +285,7 @@
             if self.has_ip4_config:
                 self.test.vapi.sw_interface_add_del_address(
                     sw_if_index=self.sw_if_index,
-                    prefix=self._local_ip4.encode(), is_add=0)
+                    prefix=self.local_ip4_prefix, is_add=0)
         except AttributeError:
             self.has_ip4_config = False
         self.has_ip4_config = False
@@ -302,7 +303,7 @@
     def config_ip6(self):
         """Configure IPv6 address on the VPP interface."""
         self.test.vapi.sw_interface_add_del_address(
-            sw_if_index=self.sw_if_index, prefix=self._local_ip6.encode())
+            sw_if_index=self.sw_if_index, prefix=self.local_ip6_prefix)
         self.has_ip6_config = True
 
     def unconfig_ip6(self):
@@ -311,7 +312,7 @@
             if self.has_ip6_config:
                 self.test.vapi.sw_interface_add_del_address(
                     sw_if_index=self.sw_if_index,
-                    prefix=self._local_ip6.encode(), is_add=0)
+                    prefix=self.local_ip6_prefix, is_add=0)
         except AttributeError:
             self.has_ip6_config = False
         self.has_ip6_config = False