summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authoryedg <yedg@wangsu.com>2020-05-14 10:51:53 +0800
committerAndrew Yourtchenko <ayourtch@gmail.com>2020-05-20 16:34:42 +0000
commitd3088e94ec7b8745686af0ca838fd1048b0837a8 (patch)
tree4a5c4e92069539d3246a93f79d29027c01b2f334 /test
parentd6572034438a984a9d8cb2f74124d526041b93f3 (diff)
ip: fix interface ip address del sw_if_index check
Type: fix Signed-off-by: Ye donggang <yedg@wangsu.com> Change-Id: Ia9f72ff2be455ecd4ff3d16e884c5a50f9df69fe (cherry picked from commit dbd366b239c0506b0d9984e7481967e038f10a23)
Diffstat (limited to 'test')
-rw-r--r--test/test_ip4.py18
-rw-r--r--test/test_ip6.py18
2 files changed, 36 insertions, 0 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 43804c7c40a..8c6f8c04c0c 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -411,6 +411,24 @@ class TestIPv4IfAddrRoute(VppTestCase):
fib4_dump = self.vapi.ip_route_dump(0)
self.assertTrue(lo_if.is_ip4_entry_in_fib_dump(fib4_dump))
+ def test_ipv4_ifaddr_del(self):
+ """ Delete an interface address that does not exist """
+
+ loopbacks = self.create_loopback_interfaces(1)
+ lo = self.lo_interfaces[0]
+
+ lo.config_ip4()
+ lo.admin_up()
+
+ #
+ # try and remove pg0's subnet from lo
+ #
+ with self.vapi.assert_negative_api_retval():
+ self.vapi.sw_interface_add_del_address(
+ sw_if_index=lo.sw_if_index,
+ prefix=self.pg0.local_ip4_prefix,
+ is_add=0)
+
class TestICMPEcho(VppTestCase):
""" ICMP Echo Test Case """
diff --git a/test/test_ip6.py b/test/test_ip6.py
index 87346c2964f..f8a2dc24e42 100644
--- a/test/test_ip6.py
+++ b/test/test_ip6.py
@@ -1125,6 +1125,24 @@ class TestIPv6IfAddrRoute(VppTestCase):
self.assertFalse(find_route(self, addr1, 128))
self.assertFalse(find_route(self, addr2, 128))
+ def test_ipv6_ifaddr_del(self):
+ """ Delete an interface address that does not exist """
+
+ loopbacks = self.create_loopback_interfaces(1)
+ lo = self.lo_interfaces[0]
+
+ lo.config_ip6()
+ lo.admin_up()
+
+ #
+ # try and remove pg0's subnet from lo
+ #
+ with self.vapi.assert_negative_api_retval():
+ self.vapi.sw_interface_add_del_address(
+ sw_if_index=lo.sw_if_index,
+ prefix=self.pg0.local_ip6_prefix,
+ is_add=0)
+
class TestICMPv6Echo(VppTestCase):
""" ICMPv6 Echo Test Case """