summaryrefslogtreecommitdiffstats
path: root/test/test_bfd.py
diff options
context:
space:
mode:
authorPaul Vinciguerra <pvinci@vinciconsulting.com>2020-05-02 22:34:40 -0400
committerPaul Vinciguerra <pvinci@vinciconsulting.com>2020-05-03 15:21:42 -0400
commit2f1563129ad8d34d365f5ef8620ff76ff7b08e70 (patch)
tree43493a0b1a729d12e04af7c94ddfad86c1d75248 /test/test_bfd.py
parent0b0a84c403ba5fb1473f8d34745ad2ce0dbb2d45 (diff)
tests: vpp_interface remove deprecated packed properties
The api no longer requires packed ip addresses. Type: test Change-Id: If67365d86b7c3189f871a58234e99f9c8f875371 Signed-off-by: Paul Vinciguerra <pvinci@vinciconsulting.com>
Diffstat (limited to 'test/test_bfd.py')
-rw-r--r--test/test_bfd.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/test/test_bfd.py b/test/test_bfd.py
index e78ad0c4064..67b62766c21 100644
--- a/test/test_bfd.py
+++ b/test/test_bfd.py
@@ -5,6 +5,7 @@ from __future__ import division
import binascii
import hashlib
+import ipaddress
import time
import unittest
from random import randint, shuffle, getrandbits
@@ -283,8 +284,8 @@ class BFDAPITestCase(VppTestCase):
self.assertFalse(echo_source.have_usable_ip6)
self.loopback0.config_ip4()
- unpacked = unpack("!L", self.loopback0.local_ip4n)
- echo_ip4 = pack("!L", unpacked[0] ^ 1)
+ echo_ip4 = ipaddress.IPv4Address(int(ipaddress.IPv4Address(
+ self.loopback0.local_ip4)) ^ 1).packed
echo_source = self.vapi.bfd_udp_get_echo_source()
self.assertTrue(echo_source.is_set)
self.assertEqual(echo_source.sw_if_index, self.loopback0.sw_if_index)
@@ -293,9 +294,9 @@ class BFDAPITestCase(VppTestCase):
self.assertFalse(echo_source.have_usable_ip6)
self.loopback0.config_ip6()
- unpacked = unpack("!LLLL", self.loopback0.local_ip6n)
- echo_ip6 = pack("!LLLL", unpacked[0], unpacked[1], unpacked[2],
- unpacked[3] ^ 1)
+ echo_ip6 = ipaddress.IPv6Address(int(ipaddress.IPv6Address(
+ self.loopback0.local_ip6)) ^ 1).packed
+
echo_source = self.vapi.bfd_udp_get_echo_source()
self.assertTrue(echo_source.is_set)
self.assertEqual(echo_source.sw_if_index, self.loopback0.sw_if_index)
@@ -2728,16 +2729,15 @@ class BFDCLITestCase(VppTestCase):
"IPv6 address usable as echo source: none" %
self.loopback0.name)
self.loopback0.config_ip4()
- unpacked = unpack("!L", self.loopback0.local_ip4n)
- echo_ip4 = inet_ntop(AF_INET, pack("!L", unpacked[0] ^ 1))
+ echo_ip4 = str(ipaddress.IPv4Address(int(ipaddress.IPv4Address(
+ self.loopback0.local_ip4)) ^ 1))
self.cli_verify_response("show bfd echo-source",
"UDP echo source is: %s\n"
"IPv4 address usable as echo source: %s\n"
"IPv6 address usable as echo source: none" %
(self.loopback0.name, echo_ip4))
- unpacked = unpack("!LLLL", self.loopback0.local_ip6n)
- echo_ip6 = inet_ntop(AF_INET6, pack("!LLLL", unpacked[0], unpacked[1],
- unpacked[2], unpacked[3] ^ 1))
+ echo_ip6 = str(ipaddress.IPv6Address(int(ipaddress.IPv6Address(
+ self.loopback0.local_ip6)) ^ 1))
self.loopback0.config_ip6()
self.cli_verify_response("show bfd echo-source",
"UDP echo source is: %s\n"