File size: 45,559 Bytes
5980447
1
2
{"repo": "faucetsdn/faucet", "pull_number": 469, "instance_id": "faucetsdn__faucet-469", "issue_numbers": "", "base_commit": "0e0ebac27ba98d0eaa88b24e645216489161305a", "patch": "diff --git a/src/ryu_faucet/org/onfsdn/faucet/config_parser.py b/src/ryu_faucet/org/onfsdn/faucet/config_parser.py\n--- a/src/ryu_faucet/org/onfsdn/faucet/config_parser.py\n+++ b/src/ryu_faucet/org/onfsdn/faucet/config_parser.py\n@@ -112,7 +112,7 @@ def _dp_parser_v2(logger, acls_conf, dps_conf, routers_conf, vlans_conf):\n         except AssertionError as err:\n             logger.exception('Error in config file: %s', err)\n             return None\n-        for port in ports.itervalues():\n+        for port in ports.values():\n             dp.add_port(port)\n         for acl_ident, acl in acls:\n             dp.add_acl(acl_ident, acl)\ndiff --git a/src/ryu_faucet/org/onfsdn/faucet/faucet.py b/src/ryu_faucet/org/onfsdn/faucet/faucet.py\n--- a/src/ryu_faucet/org/onfsdn/faucet/faucet.py\n+++ b/src/ryu_faucet/org/onfsdn/faucet/faucet.py\n@@ -22,7 +22,7 @@\n import random\n import signal\n \n-import ipaddr\n+import ipaddress\n \n from config_parser import dp_parser\n from config_parser_util import config_file_hash\n@@ -216,8 +216,8 @@ def _bgp_route_handler(self, path_change, vlan):\n             path_change (ryu.services.protocols.bgp.bgpspeaker.EventPrefix): path change\n             vlan (vlan): Valve VLAN this path change was received for.\n         \"\"\"\n-        prefix = ipaddr.IPNetwork(path_change.prefix)\n-        nexthop = ipaddr.IPAddress(path_change.nexthop)\n+        prefix = ipaddress.ip_network(unicode(path_change.prefix))\n+        nexthop = ipaddress.ip_address(unicode(path_change.nexthop))\n         withdraw = path_change.is_withdraw\n         flowmods = []\n         valve = self.valves[vlan.dp_id]\n@@ -235,8 +235,7 @@ def _bgp_route_handler(self, path_change, vlan):\n \n         if withdraw:\n             self.logger.info(\n-                'BGP withdraw %s nexthop %s',\n-                prefix, nexthop)\n+                'BGP withdraw %s nexthop %s', prefix, nexthop)\n             flowmods = valve.del_route(vlan, prefix)\n         else:\n             self.logger.info(\n@@ -260,9 +259,8 @@ def _create_bgp_speaker_for_vlan(self, vlan):\n             bgp_server_port=vlan.bgp_port,\n             best_path_change_handler=handler)\n         for faucet_vip in vlan.faucet_vips:\n-            prefix = ipaddr.IPNetwork(faucet_vip.exploded)\n             bgp_speaker.prefix_add(\n-                prefix=str(prefix), next_hop=str(faucet_vip.ip))\n+                prefix=str(faucet_vip), next_hop=str(faucet_vip.ip))\n         for route_table in (vlan.ipv4_routes, vlan.ipv6_routes):\n             for ip_dst, ip_gw in route_table.items():\n                 bgp_speaker.prefix_add(\n@@ -284,9 +282,9 @@ def _reset_bgp(self):\n             if dp_id not in self.dp_bgp_speakers:\n                 self.dp_bgp_speakers[dp_id] = {}\n             bgp_speakers = self.dp_bgp_speakers[dp_id]\n-            for bgp_speaker in bgp_speakers.itervalues():\n+            for bgp_speaker in bgp_speakers.values():\n                 bgp_speaker.shutdown()\n-            for vlan in valve.dp.vlans.itervalues():\n+            for vlan in valve.dp.vlans.values():\n                 if vlan.bgp_as:\n                     bgp_speakers[vlan] = self._create_bgp_speaker_for_vlan(vlan)\n \ndiff --git a/src/ryu_faucet/org/onfsdn/faucet/valve.py b/src/ryu_faucet/org/onfsdn/faucet/valve.py\n--- a/src/ryu_faucet/org/onfsdn/faucet/valve.py\n+++ b/src/ryu_faucet/org/onfsdn/faucet/valve.py\n@@ -514,7 +514,7 @@ def _add_ports_and_vlans(self, discovered_port_nums):\n             all_port_nums.add(port.number)\n \n         # add vlan ports\n-        for vlan in self.dp.vlans.itervalues():\n+        for vlan in self.dp.vlans.values():\n             ofmsgs.extend(self._add_vlan(vlan, all_port_nums))\n \n         # add any ports discovered but not configured\n@@ -955,7 +955,7 @@ def host_expire(self):\n         if not self.dp.running:\n             return\n         now = time.time()\n-        for vlan in self.dp.vlans.itervalues():\n+        for vlan in self.dp.vlans.values():\n             self.host_manager.expire_hosts_from_vlan(vlan, now)\n \n     def _get_config_changes(self, new_dp):\n@@ -1107,7 +1107,7 @@ def resolve_gateways(self):\n             return []\n         ofmsgs = []\n         now = time.time()\n-        for vlan in self.dp.vlans.itervalues():\n+        for vlan in self.dp.vlans.values():\n             ofmsgs.extend(self.ipv4_route_manager.resolve_gateways(vlan, now))\n             ofmsgs.extend(self.ipv6_route_manager.resolve_gateways(vlan, now))\n         return ofmsgs\n@@ -1122,7 +1122,7 @@ def get_config_dict(self):\n             self.dp.name: self.dp.to_conf()\n             }\n         vlans_dict = {}\n-        for vlan in self.dp.vlans.itervalues():\n+        for vlan in self.dp.vlans.values():\n             vlans_dict[vlan.name] = vlan.to_conf()\n         acls_dict = {}\n         for acl_id, acl in self.dp.acls.items():\ndiff --git a/src/ryu_faucet/org/onfsdn/faucet/valve_flood.py b/src/ryu_faucet/org/onfsdn/faucet/valve_flood.py\n--- a/src/ryu_faucet/org/onfsdn/faucet/valve_flood.py\n+++ b/src/ryu_faucet/org/onfsdn/faucet/valve_flood.py\n@@ -45,7 +45,7 @@ def __init__(self, flood_table, flood_priority,\n         self.stack = dp_stack\n         self.use_group_table = use_group_table\n         self.stack_ports = [\n-            port for port in dp_ports.itervalues() if port.stack is not None]\n+            port for port in dp_ports.values() if port.stack is not None]\n         self.towards_root_stack_ports = []\n         self.away_from_root_stack_ports = []\n         my_root_distance = dp_shortest_path_to_root()\ndiff --git a/src/ryu_faucet/org/onfsdn/faucet/valve_of.py b/src/ryu_faucet/org/onfsdn/faucet/valve_of.py\n--- a/src/ryu_faucet/org/onfsdn/faucet/valve_of.py\n+++ b/src/ryu_faucet/org/onfsdn/faucet/valve_of.py\n@@ -17,6 +17,7 @@\n # limitations under the License.\n \n from collections import namedtuple\n+import ipaddress\n \n from ryu.lib import ofctl_v1_3 as ofctl\n from ryu.ofproto import ether\n@@ -244,6 +245,13 @@ def match_from_dict(match_dict):\n     return acl_match\n \n \n+def _match_ip_masked(ip):\n+    if isinstance(ip, ipaddress.IPv4Network) or isinstance(ip, ipaddress.IPv6Network):\n+        return (str(ip.network_address), str(ip.netmask))\n+    else:\n+        return (str(ip.ip), str(ip.netmask))\n+\n+\n def build_match_dict(in_port=None, vlan=None,\n                      eth_type=None, eth_src=None,\n                      eth_dst=None, eth_dst_mask=None,\n@@ -270,13 +278,13 @@ def build_match_dict(in_port=None, vlan=None,\n     if nw_proto is not None:\n         match_dict['ip_proto'] = nw_proto\n     if nw_src is not None:\n-        match_dict['ipv4_src'] = (str(nw_src.ip), str(nw_src.netmask))\n+        match_dict['ipv4_src'] = _match_ip_masked(nw_src)\n     if icmpv6_type is not None:\n         match_dict['icmpv6_type'] = icmpv6_type\n     if ipv6_nd_target is not None:\n         match_dict['ipv6_nd_target'] = str(ipv6_nd_target.ip)\n     if nw_dst is not None:\n-        nw_dst_masked = (str(nw_dst.ip), str(nw_dst.netmask))\n+        nw_dst_masked = _match_ip_masked(nw_dst)\n         if eth_type == ether.ETH_TYPE_ARP:\n             match_dict['arp_tpa'] = nw_dst_masked\n         elif eth_type == ether.ETH_TYPE_IP:\ndiff --git a/src/ryu_faucet/org/onfsdn/faucet/valve_packet.py b/src/ryu_faucet/org/onfsdn/faucet/valve_packet.py\n--- a/src/ryu_faucet/org/onfsdn/faucet/valve_packet.py\n+++ b/src/ryu_faucet/org/onfsdn/faucet/valve_packet.py\n@@ -16,7 +16,7 @@\n # See the License for the specific language governing permissions and\n # limitations under the License.\n \n-import ipaddr\n+import ipaddress\n \n from ryu.lib import mac\n from ryu.lib.packet import arp, ethernet, icmp, icmpv6, ipv4, ipv6, packet, vlan\n@@ -78,8 +78,8 @@ def arp_request(eth_src, vid, src_ip, dst_ip):\n     Args:\n         eth_src (str): Ethernet source address.\n         vid (int or None): VLAN VID to use (or None).\n-        src_ip (ipaddr.IPv4Address): source IPv4 address.\n-        dst_ip (ipaddr.IPv4Address): requested IPv4 address.\n+        src_ip (ipaddress.IPv4Address): source IPv4 address.\n+        dst_ip (ipaddress.IPv4Address): requested IPv4 address.\n     Returns:\n         ryu.lib.packet.arp: serialized ARP request packet.\n     \"\"\"\n@@ -99,8 +99,8 @@ def arp_reply(eth_src, eth_dst, vid, src_ip, dst_ip):\n         eth_src (str): Ethernet source address.\n         eth_dst (str): destination Ethernet MAC address.\n         vid (int or None): VLAN VID to use (or None).\n-        src_ip (ipaddr.IPv4Address): source IPv4 address.\n-        dst_ip (ipaddr.IPv4Address): destination IPv4 address.\n+        src_ip (ipaddress.IPv4Address): source IPv4 address.\n+        dst_ip (ipaddress.IPv4Address): destination IPv4 address.\n     Returns:\n         ryu.lib.packet.arp: serialized ARP reply packet.\n     \"\"\"\n@@ -120,8 +120,8 @@ def echo_reply(eth_src, eth_dst, vid, src_ip, dst_ip, data):\n         eth_src (str): Ethernet source address.\n         eth_dst (str): destination Ethernet MAC address.\n         vid (int or None): VLAN VID to use (or None).\n-        src_ip (ipaddr.IPv4Address): source IPv4 address.\n-        dst_ip (ipaddr.IPv4Address): destination IPv4 address.\n+        src_ip (ipaddress.IPv4Address): source IPv4 address.\n+        dst_ip (ipaddress.IPv4Address): destination IPv4 address.\n     Returns:\n         ryu.lib.packet.icmp: serialized ICMP echo reply packet.\n     \"\"\"\n@@ -143,11 +143,11 @@ def ipv6_link_eth_mcast(dst_ip):\n     See RFC 2464 section 7.\n \n     Args:\n-        dst_ip (ipaddr.IPv6Address): IPv6 address.\n+        dst_ip (ipaddress.IPv6Address): IPv6 address.\n     Returns:\n         str: Ethernet multicast address.\n     \"\"\"\n-    mcast_mac_bytes = ipaddr.Bytes('\\x33\\x33') + dst_ip.packed[-4:]\n+    mcast_mac_bytes = b'\\x33\\x33' + dst_ip.packed[-4:]\n     mcast_mac = ':'.join(['%02X' % ord(x) for x in mcast_mac_bytes])\n     return mcast_mac\n \n@@ -158,14 +158,13 @@ def ipv6_solicited_node_from_ucast(ucast):\n     See RFC 3513 section 2.7.1.\n \n     Args:\n-       ucast (ipaddr.IPv6Address): IPv6 unicast address.\n+       ucast (ipaddress.IPv6Address): IPv6 unicast address.\n     Returns:\n-       ipaddr.IPv6Address: IPv6 solicited node multicast address.\n+       ipaddress.IPv6Address: IPv6 solicited node multicast address.\n     \"\"\"\n-    link_mcast_prefix = ipaddr.IPv6Network('ff02::1:ff00:0/104')\n-    mcast_bytes = ipaddr.Bytes(\n-        link_mcast_prefix.packed[:13] + ucast.packed[-3:])\n-    link_mcast = ipaddr.IPv6Address(mcast_bytes)\n+    link_mcast_prefix = ipaddress.ip_interface(u'ff02::1:ff00:0/104')\n+    mcast_bytes = link_mcast_prefix.packed[:13] + ucast.packed[-3:]\n+    link_mcast = ipaddress.IPv6Address(mcast_bytes)\n     return link_mcast\n \n \n@@ -175,8 +174,8 @@ def nd_request(eth_src, vid, src_ip, dst_ip):\n     Args:\n         eth_src (str): source Ethernet MAC address.\n         vid (int or None): VLAN VID to use (or None).\n-        src_ip (ipaddr.IPv6Address): source IPv6 address.\n-        dst_ip (ipaddr.IPv6Address): requested IPv6 address.\n+        src_ip (ipaddress.IPv6Address): source IPv6 address.\n+        dst_ip (ipaddress.IPv6Address): requested IPv6 address.\n     Returns:\n         ryu.lib.packet.ethernet: Serialized IPv6 neighbor discovery packet.\n     \"\"\"\n@@ -203,8 +202,8 @@ def nd_reply(eth_src, eth_dst, vid, src_ip, dst_ip, hop_limit):\n         eth_src (str): source Ethernet MAC address.\n         eth_dst (str): destination Ethernet MAC address.\n         vid (int or None): VLAN VID to use (or None).\n-        src_ip (ipaddr.IPv6Address): source IPv6 address.\n-        dst_ip (ipaddr.IPv6Address): destination IPv6 address.\n+        src_ip (ipaddress.IPv6Address): source IPv6 address.\n+        dst_ip (ipaddress.IPv6Address): destination IPv6 address.\n         hop_limit (int): IPv6 hop limit.\n     Returns:\n         ryu.lib.packet.ethernet: Serialized IPv6 neighbor discovery packet.\n@@ -235,8 +234,8 @@ def icmpv6_echo_reply(eth_src, eth_dst, vid, src_ip, dst_ip, hop_limit,\n         eth_src (str): source Ethernet MAC address.\n         eth_dst (str): destination Ethernet MAC address.\n         vid (int or None): VLAN VID to use (or None).\n-        src_ip (ipaddr.IPv6Address): source IPv6 address.\n-        dst_ip (ipaddr.IPv6Address): destination IPv6 address.\n+        src_ip (ipaddress.IPv6Address): source IPv6 address.\n+        dst_ip (ipaddress.IPv6Address): destination IPv6 address.\n         hop_limit (int): IPv6 hop limit.\n         id_ (int): identifier for echo reply.\n         seq (int): sequence number for echo reply.\ndiff --git a/src/ryu_faucet/org/onfsdn/faucet/valve_route.py b/src/ryu_faucet/org/onfsdn/faucet/valve_route.py\n--- a/src/ryu_faucet/org/onfsdn/faucet/valve_route.py\n+++ b/src/ryu_faucet/org/onfsdn/faucet/valve_route.py\n@@ -18,7 +18,7 @@\n \n import time\n \n-import ipaddr\n+import ipaddress\n \n from ryu.lib.packet import arp, icmp, icmpv6, ipv4, ipv6\n from ryu.ofproto import ether\n@@ -131,7 +131,7 @@ def _add_resolved_route(self, vlan, ip_gw, ip_dst, eth_dst, is_updated):\n             in_match = self.valve_in_match(\n                 self.fib_table, vlan=vlan,\n                 eth_type=self._eth_type(), nw_dst=ip_dst)\n-        prefixlen = ipaddr.IPNetwork(ip_dst).prefixlen\n+        prefixlen = ipaddress.ip_network(ip_dst).prefixlen\n         priority = self.route_priority + prefixlen\n         if is_updated:\n             self.logger.info(\n@@ -227,7 +227,7 @@ def _vlan_ip_gws(self, vlan):\n         ip_gws = []\n         for ip_gw in set(routes.values()):\n             for faucet_vip in vlan.faucet_vips:\n-                if ip_gw in faucet_vip:\n+                if ip_gw in faucet_vip.network:\n                     ip_gws.append((ip_gw, faucet_vip))\n         return ip_gws\n \n@@ -282,7 +282,7 @@ def _is_host_fib_route(self, vlan, host_ip):\n \n         Args:\n             vlan (vlan): VLAN containing this RIB/FIB.\n-            ip_gw (ipaddr.IPAddress): potential host FIB route.\n+            ip_gw (ipaddress.ip_address): potential host FIB route.\n         Returns:\n             True if a host FIB route (and not used as a gateway).\n         \"\"\"\n@@ -348,13 +348,18 @@ def _cached_nexthop_eth_dst(self, vlan, ip_gw):\n             return nexthop_cache_entry.eth_src\n         return None\n \n+    def _host_from_faucet_vip(self, faucet_vip):\n+        max_prefixlen = faucet_vip.ip.max_prefixlen\n+        return ipaddress.ip_interface(\n+            u'/'.join((faucet_vip.ip.exploded, str(max_prefixlen))))\n+\n     def add_route(self, vlan, ip_gw, ip_dst):\n         \"\"\"Add a route to the RIB.\n \n         Args:\n             vlan (vlan): VLAN containing this RIB.\n-            ip_gw (ipaddr.IPAddress): IP address of nexthop.\n-            ip_dst (ipaddr.IPNetwork): destination IP network.\n+            ip_gw (ipaddress.ip_address): IP address of nexthop.\n+            ip_dst (ipaddress.ip_network): destination IP network.\n         Returns:\n             list: OpenFlow messages.\n         \"\"\"\n@@ -376,11 +381,11 @@ def _add_host_fib_route(self, vlan, host_ip):\n \n         Args:\n             vlan (vlan): VLAN containing this RIB.\n-            host_ip (ipaddr.IPAddress): IP address of host.\n+            host_ip (ipaddress.ip_address): IP address of host.\n         Returns:\n             list: OpenFlow messages.\n         \"\"\"\n-        host_route = ipaddr.IPNetwork(host_ip.exploded)\n+        host_route = ipaddress.ip_network(host_ip.exploded)\n         return self.add_route(vlan, host_ip, host_route)\n \n     def _del_host_fib_route(self, vlan, host_ip):\n@@ -388,11 +393,11 @@ def _del_host_fib_route(self, vlan, host_ip):\n \n         Args:\n             vlan (vlan): VLAN containing this RIB.\n-            host_ip (ipaddr.IPAddress): IP address of host.\n+            host_ip (ipaddress.ip_address): IP address of host.\n         Returns:\n             list: OpenFlow messages.\n         \"\"\"\n-        host_route = ipaddr.IPNetwork(host_ip.exploded)\n+        host_route = ipaddress.ip_network(host_ip.exploded)\n         return self.del_route(vlan, host_route)\n \n     def _ip_pkt(self, pkt):\n@@ -426,7 +431,7 @@ def add_host_fib_route_from_pkt(self, pkt_meta):\n         ip_pkt = self._ip_pkt(pkt_meta.pkt)\n         ofmsgs = []\n         if ip_pkt:\n-            src_ip = ipaddr.IPAddress(ip_pkt.src)\n+            src_ip = ipaddress.ip_address(unicode(ip_pkt.src))\n             if src_ip and pkt_meta.vlan.ip_in_vip_subnet(src_ip):\n                 now = time.time()\n                 nexthop_fresh = self._nexthop_fresh(pkt_meta.vlan, src_ip, now)\n@@ -444,7 +449,7 @@ def del_route(self, vlan, ip_dst):\n \n         Args:\n             vlan (vlan): VLAN containing this RIB.\n-            ip_dst (ipaddr.IPNetwork): destination IP network.\n+            ip_dst (ipaddress.ip_network): destination IP network.\n         Returns:\n             list: OpenFlow messages.\n         \"\"\"\n@@ -485,9 +490,8 @@ def _ip_pkt(self, pkt):\n \n     def add_faucet_vip(self, vlan, faucet_vip):\n         ofmsgs = []\n-        faucet_vip_net = ipaddr.IPNetwork(faucet_vip.exploded)\n-        faucet_vip_host = ipaddr.IPNetwork(faucet_vip.ip)\n-        max_prefixlen = faucet_vip_host.prefixlen\n+        max_prefixlen = faucet_vip.ip.max_prefixlen\n+        faucet_vip_host = self._host_from_faucet_vip(faucet_vip)\n         priority = self.route_priority + max_prefixlen\n         ofmsgs.append(self.valve_flowmod(\n             self.eth_src_table,\n@@ -516,14 +520,14 @@ def add_faucet_vip(self, vlan, faucet_vip):\n                 vlan=vlan,\n                 eth_type=self._eth_type(),\n                 nw_proto=inet.IPPROTO_ICMP,\n-                nw_src=faucet_vip_net,\n+                nw_src=faucet_vip,\n                 nw_dst=faucet_vip_host),\n             priority=priority))\n         return ofmsgs\n \n     def _control_plane_arp_handler(self, pkt_meta, arp_pkt):\n-        src_ip = ipaddr.IPv4Address(arp_pkt.src_ip)\n-        dst_ip = ipaddr.IPv4Address(arp_pkt.dst_ip)\n+        src_ip = ipaddress.IPv4Address(unicode(arp_pkt.src_ip))\n+        dst_ip = ipaddress.IPv4Address(unicode(arp_pkt.dst_ip))\n         vlan = pkt_meta.vlan\n         opcode = arp_pkt.opcode\n         ofmsgs = []\n@@ -550,8 +554,8 @@ def _control_plane_arp_handler(self, pkt_meta, arp_pkt):\n         return ofmsgs\n \n     def _control_plane_icmp_handler(self, pkt_meta, ipv4_pkt, icmp_pkt):\n-        src_ip = ipaddr.IPv4Address(ipv4_pkt.src)\n-        dst_ip = ipaddr.IPv4Address(ipv4_pkt.dst)\n+        src_ip = ipaddress.IPv4Address(unicode(ipv4_pkt.src))\n+        dst_ip = ipaddress.IPv4Address(unicode(ipv4_pkt.dst))\n         vlan = pkt_meta.vlan\n         icmpv4_type = icmp_pkt.type\n         ofmsgs = []\n@@ -601,8 +605,8 @@ def _ip_pkt(self, pkt):\n \n     def add_faucet_vip(self, vlan, faucet_vip):\n         ofmsgs = []\n-        faucet_vip_host = ipaddr.IPNetwork(faucet_vip.ip)\n-        max_prefixlen = faucet_vip_host.prefixlen\n+        max_prefixlen = faucet_vip.ip.max_prefixlen\n+        faucet_vip_host = self._host_from_faucet_vip(faucet_vip)\n         priority = self.route_priority + max_prefixlen\n         ofmsgs.append(self.valve_flowmod(\n             self.eth_src_table,\n@@ -652,8 +656,8 @@ def add_faucet_vip(self, vlan, faucet_vip):\n \n     def _control_plane_icmpv6_handler(self, pkt_meta, ipv6_pkt, icmpv6_pkt):\n         vlan = pkt_meta.vlan\n-        src_ip = ipaddr.IPv6Address(ipv6_pkt.src)\n-        dst_ip = ipaddr.IPv6Address(ipv6_pkt.dst)\n+        src_ip = ipaddress.IPv6Address(unicode(ipv6_pkt.src))\n+        dst_ip = ipaddress.IPv6Address(unicode(ipv6_pkt.dst))\n         icmpv6_type = icmpv6_pkt.type_\n         ofmsgs = []\n         if vlan.ip_in_vip_subnet(src_ip):\n@@ -661,8 +665,8 @@ def _control_plane_icmpv6_handler(self, pkt_meta, ipv6_pkt, icmpv6_pkt):\n             vid = self._vlan_vid(vlan, in_port)\n             eth_src = pkt_meta.eth_src\n             if icmpv6_type == icmpv6.ND_NEIGHBOR_SOLICIT:\n-                solicited_ip = icmpv6_pkt.data.dst\n-                if vlan.is_faucet_vip(ipaddr.IPAddress(solicited_ip)):\n+                solicited_ip = unicode(icmpv6_pkt.data.dst)\n+                if vlan.is_faucet_vip(ipaddress.ip_address(solicited_ip)):\n                     ofmsgs.extend(\n                         self._add_host_fib_route(vlan, src_ip))\n                     nd_reply = valve_packet.nd_reply(\ndiff --git a/src/ryu_faucet/org/onfsdn/faucet/vlan.py b/src/ryu_faucet/org/onfsdn/faucet/vlan.py\n--- a/src/ryu_faucet/org/onfsdn/faucet/vlan.py\n+++ b/src/ryu_faucet/org/onfsdn/faucet/vlan.py\n@@ -13,7 +13,7 @@\n # See the License for the specific language governing permissions and\n # limitations under the License.\n \n-import ipaddr\n+import ipaddress\n \n from conf import Conf\n \n@@ -80,20 +80,20 @@ def __init__(self, _id, dp_id, conf=None):\n \n         if self.faucet_vips:\n             self.faucet_vips = [\n-                ipaddr.IPNetwork(ip) for ip in self.faucet_vips]\n+                ipaddress.ip_interface(unicode(ip)) for ip in self.faucet_vips]\n \n         if self.bgp_as:\n             assert self.bgp_port\n-            assert ipaddr.IPv4Address(self.bgp_routerid)\n+            assert ipaddress.IPv4Address(unicode(self.bgp_routerid))\n             for neighbor_ip in self.bgp_neighbor_addresses:\n-                assert ipaddr.IPAddress(neighbor_ip)\n+                assert ipaddress.ip_address(unicode(neighbor_ip))\n             assert self.bgp_neighbor_as\n \n         if self.routes:\n             self.routes = [route['route'] for route in self.routes]\n             for route in self.routes:\n-                ip_gw = ipaddr.IPAddress(route['ip_gw'])\n-                ip_dst = ipaddr.IPNetwork(route['ip_dst'])\n+                ip_gw = ipaddress.ip_address(unicode(route['ip_gw']))\n+                ip_dst = ipaddress.ip_network(unicode(route['ip_dst']))\n                 assert ip_gw.version == ip_dst.version\n                 if ip_gw.version == 4:\n                     self.ipv4_routes[ip_dst] = ip_gw\n@@ -201,7 +201,7 @@ def is_faucet_vip(self, ip):\n \n     def ip_in_vip_subnet(self, ip):\n         for faucet_vip in self.faucet_vips:\n-            if ip in faucet_vip:\n+            if ip in faucet_vip.network:\n                 return True\n         return False\n \n@@ -215,8 +215,8 @@ def from_connected_to_vip(self, src_ip, dst_ip):\n         \"\"\"Return True if src_ip in connected network and dst_ip is a VIP.\n \n         Args:\n-            src_ip (ipaddr.IPAddress): source IP.\n-            dst_ip (ipaddr.IPAddress): destination IP\n+            src_ip (ipaddress.ip_address): source IP.\n+            dst_ip (ipaddress.ip_address): destination IP\n         Returns:\n             True if local traffic for a VIP.\n         \"\"\"\n", "test_patch": "diff --git a/tests/faucet_mininet_test.py b/tests/faucet_mininet_test.py\n--- a/tests/faucet_mininet_test.py\n+++ b/tests/faucet_mininet_test.py\n@@ -43,7 +43,7 @@\n from SimpleHTTPServer import SimpleHTTPRequestHandler\n from BaseHTTPServer import HTTPServer\n \n-import ipaddr\n+import ipaddress\n import yaml\n \n from concurrencytest import ConcurrentTestSuite, fork_for_tests\n@@ -881,13 +881,13 @@ def test_untagged(self):\n         first_host, second_host = self.net.hosts[:2]\n         # wait until 10.0.0.1 has been resolved\n         self.wait_for_route_as_flow(\n-            first_host.MAC(), ipaddr.IPv4Network('10.99.99.0/24'))\n+            first_host.MAC(), ipaddress.IPv4Network(u'10.99.99.0/24'))\n         self.wait_bgp_up(self.exabgp_log)\n         self.wait_exabgp_sent_updates(self.exabgp_log)\n         self.verify_invalid_bgp_route('10.0.0.4/24 cannot be us')\n         self.verify_invalid_bgp_route('10.0.0.5/24 is not a connected network')\n         self.wait_for_route_as_flow(\n-            second_host.MAC(), ipaddr.IPv4Network('10.0.3.0/24'))\n+            second_host.MAC(), ipaddress.IPv4Network(u'10.0.3.0/24'))\n         self.verify_ipv4_routing_mesh()\n         self.flap_all_switch_ports()\n         self.verify_ipv4_routing_mesh()\n@@ -1600,8 +1600,8 @@ class FaucetTaggedIPv4RouteTest(FaucetTaggedTest):\n     def test_tagged(self):\n         host_pair = self.net.hosts[:2]\n         first_host, second_host = host_pair\n-        first_host_routed_ip = ipaddr.IPv4Network('10.0.1.1/24')\n-        second_host_routed_ip = ipaddr.IPv4Network('10.0.2.1/24')\n+        first_host_routed_ip = ipaddress.ip_interface(u'10.0.1.1/24')\n+        second_host_routed_ip = ipaddress.ip_interface(u'10.0.2.1/24')\n         for _ in range(3):\n             self.verify_ipv4_routing(\n                 first_host, first_host_routed_ip,\n@@ -1643,15 +1643,15 @@ class FaucetUntaggedIPv4InterVLANRouteTest(FaucetUntaggedTest):\n \"\"\"\n \n     def test_untagged(self):\n-        first_host_ip = ipaddr.IPv4Network('10.100.0.1/24')\n-        first_faucet_vip = ipaddr.IPv4Network('10.100.0.254/24')\n-        second_host_ip = ipaddr.IPv4Network('10.200.0.1/24')\n-        second_faucet_vip = ipaddr.IPv4Network('10.200.0.254/24')\n+        first_host_ip = ipaddress.ip_interface(u'10.100.0.1/24')\n+        first_faucet_vip = ipaddress.ip_interface(u'10.100.0.254/24')\n+        second_host_ip = ipaddress.ip_interface(u'10.200.0.1/24')\n+        second_faucet_vip = ipaddress.ip_interface(u'10.200.0.254/24')\n         first_host, second_host = self.net.hosts[:2]\n         first_host.setIP(str(first_host_ip.ip))\n         second_host.setIP(str(second_host_ip.ip))\n-        self.add_host_ipv4_route(first_host, second_host_ip, first_faucet_vip.ip)\n-        self.add_host_ipv4_route(second_host, first_host_ip, second_faucet_vip.ip)\n+        self.add_host_route(first_host, second_host_ip, first_faucet_vip.ip)\n+        self.add_host_route(second_host, first_host_ip, second_faucet_vip.ip)\n         self.one_ipv4_ping(first_host, first_faucet_vip.ip)\n         self.one_ipv4_ping(second_host, second_faucet_vip.ip)\n         self.one_ipv4_ping(first_host, second_host_ip.ip)\n@@ -1688,15 +1688,15 @@ class FaucetUntaggedMixedIPv4RouteTest(FaucetUntaggedTest):\n     def test_untagged(self):\n         host_pair = self.net.hosts[:2]\n         first_host, second_host = host_pair\n-        first_host_net = ipaddr.IPv4Network('10.0.0.1/24')\n-        second_host_net = ipaddr.IPv4Network('172.16.0.1/24')\n+        first_host_net = ipaddress.ip_interface(u'10.0.0.1/24')\n+        second_host_net = ipaddress.ip_interface(u'172.16.0.1/24')\n         second_host.setIP(str(second_host_net.ip))\n         self.one_ipv4_ping(first_host, self.FAUCET_VIPV4.ip)\n         self.one_ipv4_ping(second_host, self.FAUCET_VIPV4_2.ip)\n-        self.add_host_ipv4_route(\n-            first_host, second_host_net.masked(), self.FAUCET_VIPV4.ip)\n-        self.add_host_ipv4_route(\n-            second_host, first_host_net.masked(), self.FAUCET_VIPV4_2.ip)\n+        self.add_host_route(\n+            first_host, second_host_net, self.FAUCET_VIPV4.ip)\n+        self.add_host_route(\n+            second_host, first_host_net, self.FAUCET_VIPV4_2.ip)\n         self.one_ipv4_ping(first_host, second_host_net.ip)\n         self.one_ipv4_ping(second_host, first_host_net.ip)\n \n@@ -1731,16 +1731,16 @@ class FaucetUntaggedMixedIPv6RouteTest(FaucetUntaggedTest):\n     def test_untagged(self):\n         host_pair = self.net.hosts[:2]\n         first_host, second_host = host_pair\n-        first_host_net = ipaddr.IPv6Network('fc00::1:1/64')\n-        second_host_net = ipaddr.IPv6Network('fc01::1:1/64')\n+        first_host_net = ipaddress.ip_interface(u'fc00::1:1/64')\n+        second_host_net = ipaddress.ip_interface(u'fc01::1:1/64')\n         self.add_host_ipv6_address(first_host, first_host_net)\n         self.one_ipv6_ping(first_host, self.FAUCET_VIPV6.ip)\n         self.add_host_ipv6_address(second_host, second_host_net)\n         self.one_ipv6_ping(second_host, self.FAUCET_VIPV6_2.ip)\n-        self.add_host_ipv6_route(\n-            first_host, second_host_net.masked(), self.FAUCET_VIPV6.ip)\n-        self.add_host_ipv6_route(\n-            second_host, first_host_net.masked(), self.FAUCET_VIPV6_2.ip)\n+        self.add_host_route(\n+            first_host, second_host_net, self.FAUCET_VIPV6.ip)\n+        self.add_host_route(\n+            second_host, first_host_net, self.FAUCET_VIPV6_2.ip)\n         self.one_ipv6_ping(first_host, second_host_net.ip)\n         self.one_ipv6_ping(second_host, first_host_net.ip)\n \n@@ -1847,20 +1847,20 @@ class FaucetUntaggedSameVlanIPv6RouteTest(FaucetUntaggedTest):\n \n     def test_untagged(self):\n         first_host, second_host = self.net.hosts[:2]\n-        first_host_ip = ipaddr.IPv6Network('fc00::10:2/112')\n-        first_host_ctrl_ip = ipaddr.IPv6Address('fc00::10:1')\n-        second_host_ip = ipaddr.IPv6Network('fc00::20:2/112')\n-        second_host_ctrl_ip = ipaddr.IPv6Address('fc00::20:1')\n+        first_host_ip = ipaddress.ip_interface(u'fc00::10:2/112')\n+        first_host_ctrl_ip = ipaddress.ip_address(u'fc00::10:1')\n+        second_host_ip = ipaddress.ip_interface(u'fc00::20:2/112')\n+        second_host_ctrl_ip = ipaddress.ip_address(u'fc00::20:1')\n         self.add_host_ipv6_address(first_host, first_host_ip)\n         self.add_host_ipv6_address(second_host, second_host_ip)\n-        self.add_host_ipv6_route(\n+        self.add_host_route(\n             first_host, second_host_ip, first_host_ctrl_ip)\n-        self.add_host_ipv6_route(\n+        self.add_host_route(\n             second_host, first_host_ip, second_host_ctrl_ip)\n         self.wait_for_route_as_flow(\n-            first_host.MAC(), first_host_ip)\n+            first_host.MAC(), first_host_ip.network)\n         self.wait_for_route_as_flow(\n-            second_host.MAC(), second_host_ip)\n+            second_host.MAC(), second_host_ip.network)\n         self.one_ipv6_ping(first_host, second_host_ip.ip)\n         self.one_ipv6_ping(first_host, second_host_ctrl_ip)\n         self.one_ipv6_ping(second_host, first_host_ip.ip)\n@@ -1936,7 +1936,7 @@ def test_untagged(self):\n         second_host = self.net.hosts[1]\n         self.flap_all_switch_ports()\n         self.wait_for_route_as_flow(\n-            second_host.MAC(), ipaddr.IPv6Network('fc00::30:0/112'))\n+            second_host.MAC(), ipaddress.IPv6Network(u'fc00::30:0/112'))\n         self.verify_ipv6_routing_mesh()\n         self.wait_bgp_up(self.exabgp_log)\n         updates = self.exabgp_updates(self.exabgp_log)\n@@ -1986,10 +1986,10 @@ def test_tagged(self):\n         \"\"\"Test IPv6 routing works.\"\"\"\n         host_pair = self.net.hosts[:2]\n         first_host, second_host = host_pair\n-        first_host_ip = ipaddr.IPv6Network('fc00::1:1/112')\n-        second_host_ip = ipaddr.IPv6Network('fc00::1:2/112')\n-        first_host_routed_ip = ipaddr.IPv6Network('fc00::10:1/112')\n-        second_host_routed_ip = ipaddr.IPv6Network('fc00::20:1/112')\n+        first_host_ip = ipaddress.ip_interface(u'fc00::1:1/112')\n+        second_host_ip = ipaddress.ip_interface(u'fc00::1:2/112')\n+        first_host_routed_ip = ipaddress.ip_interface(u'fc00::10:1/112')\n+        second_host_routed_ip = ipaddress.ip_interface(u'fc00::20:1/112')\n         for _ in range(5):\n             self.verify_ipv6_routing_pair(\n                 first_host, first_host_ip, first_host_routed_ip,\n@@ -2484,8 +2484,8 @@ class FaucetSingleGroupTableUntaggedIPv4RouteTest(FaucetUntaggedTest):\n     def test_untagged(self):\n         host_pair = self.net.hosts[:2]\n         first_host, second_host = host_pair\n-        first_host_routed_ip = ipaddr.IPv4Network('10.0.1.1/24')\n-        second_host_routed_ip = ipaddr.IPv4Network('10.0.2.1/24')\n+        first_host_routed_ip = ipaddress.ip_interface(u'10.0.1.1/24')\n+        second_host_routed_ip = ipaddress.ip_interface(u'10.0.2.1/24')\n         self.verify_ipv4_routing(\n             first_host, first_host_routed_ip,\n             second_host, second_host_routed_ip,\n@@ -2538,10 +2538,10 @@ class FaucetSingleGroupUntaggedIPv6RouteTest(FaucetUntaggedTest):\n     def test_untagged(self):\n         host_pair = self.net.hosts[:2]\n         first_host, second_host = host_pair\n-        first_host_ip = ipaddr.IPv6Network('fc00::1:1/112')\n-        second_host_ip = ipaddr.IPv6Network('fc00::1:2/112')\n-        first_host_routed_ip = ipaddr.IPv6Network('fc00::10:1/112')\n-        second_host_routed_ip = ipaddr.IPv6Network('fc00::20:1/112')\n+        first_host_ip = ipaddress.ip_interface(u'fc00::1:1/112')\n+        second_host_ip = ipaddress.ip_interface(u'fc00::1:2/112')\n+        first_host_routed_ip = ipaddress.ip_interface(u'fc00::10:1/112')\n+        second_host_routed_ip = ipaddress.ip_interface(u'fc00::20:1/112')\n         self.verify_ipv6_routing_pair(\n             first_host, first_host_ip, first_host_routed_ip,\n             second_host, second_host_ip, second_host_routed_ip,\ndiff --git a/tests/faucet_mininet_test_base.py b/tests/faucet_mininet_test_base.py\n--- a/tests/faucet_mininet_test_base.py\n+++ b/tests/faucet_mininet_test_base.py\n@@ -11,7 +11,7 @@\n import unittest\n import yaml\n \n-import ipaddr\n+import ipaddress\n import requests\n \n from mininet.node import Controller\n@@ -207,10 +207,10 @@ class FaucetTestBase(unittest.TestCase):\n     \"\"\"Base class for all FAUCET unit tests.\"\"\"\n \n     ONE_GOOD_PING = '1 packets transmitted, 1 received, 0% packet loss'\n-    FAUCET_VIPV4 = ipaddr.IPv4Network('10.0.0.254/24')\n-    FAUCET_VIPV4_2 = ipaddr.IPv4Network('172.16.0.254/24')\n-    FAUCET_VIPV6 = ipaddr.IPv6Network('fc00::1:254/64')\n-    FAUCET_VIPV6_2 = ipaddr.IPv6Network('fc01::1:254/64')\n+    FAUCET_VIPV4 = ipaddress.ip_interface(u'10.0.0.254/24')\n+    FAUCET_VIPV4_2 = ipaddress.ip_interface(u'172.16.0.254/24')\n+    FAUCET_VIPV6 = ipaddress.ip_interface(u'fc00::1:254/64')\n+    FAUCET_VIPV6_2 = ipaddress.ip_interface(u'fc01::1:254/64')\n     OFCTL = 'ovs-ofctl -OOpenFlow13'\n     BOGUS_MAC = '01:02:03:04:05:06'\n     FAUCET_MAC = '0e:00:00:00:00:01'\n@@ -445,7 +445,7 @@ def require_host_learned(self, host, retries=3):\n         ping_cmd = 'ping'\n         if not host_ip_net:\n             host_ip_net = self.host_ipv6(host)\n-        broadcast = (ipaddr.IPNetwork(host_ip_net).broadcast)\n+        broadcast = (ipaddress.ip_interface(unicode(host_ip_net)).network.broadcast_address)\n         if broadcast.version == 6:\n             ping_cmd = 'ping6'\n         for _ in range(retries):\n@@ -521,19 +521,14 @@ def add_host_ipv6_address(self, host, ip_v6):\n             '',\n             host.cmd('ip -6 addr add %s dev %s' % (ip_v6, host.intf())))\n \n-    def add_host_ipv6_route(self, host, ip_dst, ip_gw):\n-        \"\"\"Add an IPv6 route to a Mininet host.\"\"\"\n-        host.cmd('ip -6 route del %s' % ip_dst.masked())\n+    def add_host_route(self, host, ip_dst, ip_gw):\n+        \"\"\"Add an IP route to a Mininet host.\"\"\"\n+        host.cmd('ip -%u route del %s' % (\n+            ip_dst.version, ip_dst.network.with_prefixlen))\n         self.assertEquals(\n             '',\n-            host.cmd('ip -6 route add %s via %s' % (ip_dst.masked(), ip_gw)))\n-\n-    def add_host_ipv4_route(self, host, ip_dst, ip_gw):\n-        \"\"\"Add an IPv4 route to a Mininet host.\"\"\"\n-        host.cmd('ip -4 route del %s' % ip_dst.masked())\n-        self.assertEquals(\n-            '',\n-            host.cmd('ip -4 route add %s via %s' % (ip_dst.masked(), ip_gw)))\n+            host.cmd('ip -%u route add %s via %s' % (\n+                ip_dst.version, ip_dst.network.with_prefixlen, ip_gw)))\n \n     def one_ipv4_ping(self, host, dst, retries=3, require_host_learned=True):\n         \"\"\"Ping an IPv4 destination from a host.\"\"\"\n@@ -679,12 +674,11 @@ def ping_all_when_learned(self, retries=3):\n     def wait_for_route_as_flow(self, nexthop, prefix, timeout=10,\n                                with_group_table=False):\n         \"\"\"Verify a route has been added as a flow.\"\"\"\n+        exp_prefix = '%s/%s' % (\n+            prefix.network_address, prefix.netmask)\n         if prefix.version == 6:\n-            exp_prefix = '/'.join(\n-                (str(prefix.masked().ip), str(prefix.netmask)))\n             nw_dst_match = '\"ipv6_dst\": \"%s\"' % exp_prefix\n         else:\n-            exp_prefix = prefix.masked().with_netmask\n             nw_dst_match = '\"nw_dst\": \"%s\"' % exp_prefix\n         if with_group_table:\n             group_id = self.get_group_id_for_matching_flow(nw_dst_match)\n@@ -697,17 +691,17 @@ def wait_for_route_as_flow(self, nexthop, prefix, timeout=10,\n \n     def host_ipv4_alias(self, host, alias_ip):\n         \"\"\"Add an IPv4 alias address to a host.\"\"\"\n-        del_cmd = 'ip addr del %s/%s dev %s' % (\n-            alias_ip.ip, alias_ip.prefixlen, host.intf())\n-        add_cmd = 'ip addr add %s/%s dev %s label %s:1' % (\n-            alias_ip.ip, alias_ip.prefixlen, host.intf(), host.intf())\n+        del_cmd = 'ip addr del %s dev %s' % (\n+            alias_ip.with_prefixlen, host.intf())\n+        add_cmd = 'ip addr add %s dev %s label %s:1' % (\n+            alias_ip.with_prefixlen, host.intf(), host.intf())\n         host.cmd(del_cmd)\n         self.assertEquals('', host.cmd(add_cmd))\n \n-    def verify_ipv4_host_learned_mac(self, host, ip, mac, retries=3):\n+    def _verify_host_learned_mac(self, host, ip, ip_ver, mac, retries):\n         for _ in range(retries):\n             learned_mac = host.cmd(\n-                \"arp -n %s | grep %s | awk '{ print $3 }'\" % (ip, ip)).strip()\n+                \"ip -%u neighbor show %s | awk '{ print $5 }'\" % (ip_ver, ip)).strip()\n             if learned_mac:\n                 break\n             time.sleep(1)\n@@ -716,24 +710,18 @@ def verify_ipv4_host_learned_mac(self, host, ip, mac, retries=3):\n             msg='MAC learned on host mismatch (expected %s found %s)' % (\n                 mac, learned_mac))\n \n+    def verify_ipv4_host_learned_mac(self, host, ip, mac, retries=3):\n+        self._verify_host_learned_mac(host, ip, 4, mac, retries)\n+\n     def verify_ipv4_host_learned_host(self, host, learned_host):\n-        learned_ip = ipaddr.IPNetwork(self.host_ipv4(learned_host))\n+        learned_ip = ipaddress.ip_interface(unicode(self.host_ipv4(learned_host)))\n         self.verify_ipv4_host_learned_mac(host, learned_ip.ip, learned_host.MAC())\n \n     def verify_ipv6_host_learned_mac(self, host, ip6, mac, retries=3):\n-        for _ in range(retries):\n-            learned_mac = host.cmd(\n-                \"ip -6 neighbor show %s | awk '{ print $5 }'\" % ip6).strip()\n-            if learned_mac:\n-                break\n-            time.sleep(1)\n-        self.assertEqual(\n-            mac, learned_mac,\n-            msg='MAC learned on host mismatch (expected %s found %s)' % (\n-                mac, learned_mac))\n+        self._verify_host_learned_mac(host, ip6, 6, mac, retries)\n \n     def verify_ipv6_host_learned_host(self, host, learned_host):\n-        learned_ip6 = ipaddr.IPNetwork(self.host_ipv6(learned_host))\n+        learned_ip6 = ipaddress.ip_interface(unicode(self.host_ipv6(learned_host)))\n         self.verify_ipv6_host_learned_mac(host, learned_ip6.ip, learned_host.MAC())\n \n     def verify_ipv4_routing(self, first_host, first_host_routed_ip,\n@@ -742,16 +730,16 @@ def verify_ipv4_routing(self, first_host, first_host_routed_ip,\n         \"\"\"Verify one host can IPV4 route to another via FAUCET.\"\"\"\n         self.host_ipv4_alias(first_host, first_host_routed_ip)\n         self.host_ipv4_alias(second_host, second_host_routed_ip)\n-        self.add_host_ipv4_route(\n+        self.add_host_route(\n             first_host, second_host_routed_ip, self.FAUCET_VIPV4.ip)\n-        self.add_host_ipv4_route(\n+        self.add_host_route(\n             second_host, first_host_routed_ip, self.FAUCET_VIPV4.ip)\n         self.net.ping(hosts=(first_host, second_host))\n         self.wait_for_route_as_flow(\n-            first_host.MAC(), first_host_routed_ip,\n+            first_host.MAC(), first_host_routed_ip.network,\n             with_group_table=with_group_table)\n         self.wait_for_route_as_flow(\n-            second_host.MAC(), second_host_routed_ip,\n+            second_host.MAC(), second_host_routed_ip.network,\n             with_group_table=with_group_table)\n         self.one_ipv4_ping(first_host, second_host_routed_ip.ip)\n         self.one_ipv4_ping(second_host, first_host_routed_ip.ip)\n@@ -762,9 +750,9 @@ def verify_ipv4_routing_mesh(self, with_group_table=False):\n         \"\"\"Verify hosts can route to each other via FAUCET.\"\"\"\n         host_pair = self.net.hosts[:2]\n         first_host, second_host = host_pair\n-        first_host_routed_ip = ipaddr.IPv4Network('10.0.1.1/24')\n-        second_host_routed_ip = ipaddr.IPv4Network('10.0.2.1/24')\n-        second_host_routed_ip2 = ipaddr.IPv4Network('10.0.3.1/24')\n+        first_host_routed_ip = ipaddress.ip_interface(u'10.0.1.1/24')\n+        second_host_routed_ip = ipaddress.ip_interface(u'10.0.2.1/24')\n+        second_host_routed_ip2 = ipaddress.ip_interface(u'10.0.3.1/24')\n         self.verify_ipv4_routing(\n             first_host, first_host_routed_ip,\n             second_host, second_host_routed_ip,\n@@ -803,15 +791,15 @@ def verify_ipv6_routing(self, first_host, first_host_ip,\n         \"\"\"Verify one host can IPV6 route to another via FAUCET.\"\"\"\n         self.one_ipv6_ping(first_host, second_host_ip.ip)\n         self.one_ipv6_ping(second_host, first_host_ip.ip)\n-        self.add_host_ipv6_route(\n+        self.add_host_route(\n             first_host, second_host_routed_ip, self.FAUCET_VIPV6.ip)\n-        self.add_host_ipv6_route(\n+        self.add_host_route(\n             second_host, first_host_routed_ip, self.FAUCET_VIPV6.ip)\n         self.wait_for_route_as_flow(\n-            first_host.MAC(), first_host_routed_ip,\n+            first_host.MAC(), first_host_routed_ip.network,\n             with_group_table=with_group_table)\n         self.wait_for_route_as_flow(\n-            second_host.MAC(), second_host_routed_ip,\n+            second_host.MAC(), second_host_routed_ip.network,\n             with_group_table=with_group_table)\n         self.one_ipv6_controller_ping(first_host)\n         self.one_ipv6_controller_ping(second_host)\n@@ -839,11 +827,11 @@ def verify_ipv6_routing_mesh(self, with_group_table=False):\n         \"\"\"Verify IPv6 routing between hosts and multiple subnets.\"\"\"\n         host_pair = self.net.hosts[:2]\n         first_host, second_host = host_pair\n-        first_host_ip = ipaddr.IPv6Network('fc00::1:1/112')\n-        second_host_ip = ipaddr.IPv6Network('fc00::1:2/112')\n-        first_host_routed_ip = ipaddr.IPv6Network('fc00::10:1/112')\n-        second_host_routed_ip = ipaddr.IPv6Network('fc00::20:1/112')\n-        second_host_routed_ip2 = ipaddr.IPv6Network('fc00::30:1/112')\n+        first_host_ip = ipaddress.ip_interface(u'fc00::1:1/112')\n+        second_host_ip = ipaddress.ip_interface(u'fc00::1:2/112')\n+        first_host_routed_ip = ipaddress.ip_interface(u'fc00::10:1/112')\n+        second_host_routed_ip = ipaddress.ip_interface(u'fc00::20:1/112')\n+        second_host_routed_ip2 = ipaddress.ip_interface(u'fc00::30:1/112')\n         self.verify_ipv6_routing_pair(\n             first_host, first_host_ip, first_host_routed_ip,\n             second_host, second_host_ip, second_host_routed_ip,\ndiff --git a/tests/test_api.py b/tests/test_api.py\n--- a/tests/test_api.py\n+++ b/tests/test_api.py\n@@ -1,6 +1,6 @@\n import os\n import sys\n-import ipaddr\n+import ipaddress\n \n from ryu.base import app_manager\n from ryu.lib import hub\ndiff --git a/tests/test_config.py b/tests/test_config.py\n--- a/tests/test_config.py\n+++ b/tests/test_config.py\n@@ -19,7 +19,7 @@\n import logging\n import sys\n import os\n-import ipaddr\n+import ipaddress\n \n testdir = os.path.dirname(__file__)\n srcdir = '../src/ryu_faucet/org/onfsdn/faucet'\n@@ -181,7 +181,7 @@ def test_routing(self):\n         for dp in (self.v2_dp,):\n             vlan = dp.vlans[41]\n             self.assertIn(\n-                ipaddr.IPNetwork('10.0.0.253/24'),\n+                ipaddress.ip_interface(u'10.0.0.253/24'),\n                 vlan.faucet_vips\n                 )\n             self.assertEquals(vlan.bgp_port, 9179)\n@@ -190,15 +190,15 @@ def test_routing(self):\n             self.assertIn('127.0.0.1', vlan.bgp_neighbor_addresses)\n             self.assertEquals(vlan.bgp_neighbor_as, 2)\n             self.assertIn(\n-                ipaddr.IPNetwork('10.0.1.0/24'),\n+                ipaddress.ip_network(u'10.0.1.0/24'),\n                 vlan.ipv4_routes\n                 )\n             self.assertIn(\n-                ipaddr.IPNetwork('10.0.2.0/24'),\n+                ipaddress.ip_network(u'10.0.2.0/24'),\n                 vlan.ipv4_routes\n                 )\n             self.assertIn(\n-                ipaddr.IPNetwork('10.0.3.0/24'),\n+                ipaddress.ip_network(u'10.0.3.0/24'),\n                 vlan.ipv4_routes\n                 )\n \n", "problem_statement": "", "hints_text": "", "created_at": "2017-03-15T09:44:02Z"}