aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorKlement Sekera <ksekera@cisco.com>2021-11-22 21:25:57 +0100
committerOle Tr�an <otroan@employees.org>2021-12-16 15:08:20 +0000
commitfd1f56a770301bf116c0e248502f50ca88bff631 (patch)
tree031c8f7b961e0b9b23899ac1605ddb135798950d /test
parent31ed835b35b8cdfe2dc8cac8bd1de8e9a1d3e8b0 (diff)
ip: add tests for message size verification
Coverity complained that there is boundary checking in add_del_punt_redirect_v2 handler. This test proves that such boundary checking is not necessary as it is handled in the common path. Type: test Change-Id: Ibec054c01d4eb057accdc9d5732aba6fe6de51cc Signed-off-by: Klement Sekera <ksekera@cisco.com>
Diffstat (limited to 'test')
-rw-r--r--test/test_ip4.py29
1 files changed, 24 insertions, 5 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py
index b337e63a957..373505293f4 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -20,7 +20,7 @@ from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpMRoute, \
VppIpInterfaceAddress, find_route_in_dump, find_mroute_in_dump
from vpp_ip import VppIpPuntPolicer, VppIpPuntRedirect, VppIpPathMtu
from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint
-from vpp_papi import VppEnum
+from vpp_papi import vpp_papi, VppEnum
from vpp_neighbor import VppNeighbor
from vpp_lo_interface import VppLoInterface
from vpp_policer import VppPolicer, PolicerAction
@@ -1494,12 +1494,31 @@ class TestIPPunt(IPPuntSetup, VppTestCase):
""" IPv4 Punt Police/Redirect """
def setUp(self):
- super(TestIPPunt, self).setUp()
- super(TestIPPunt, self).punt_setup()
+ super().setUp()
+ super().punt_setup()
def tearDown(self):
- super(TestIPPunt, self).punt_teardown()
- super(TestIPPunt, self).tearDown()
+ super().punt_teardown()
+ super().tearDown()
+
+ def test_ip_punt_api_validation(self):
+ """ IP punt API parameter validation """
+
+ nh_addr = self.pg1.remote_ip4
+ punt = {"rx_sw_if_index": self.pg0.sw_if_index,
+ "af": VppEnum.vl_api_address_family_t.ADDRESS_IP4,
+ "n_paths": 1000000,
+ "paths": []}
+
+ with self.assertRaises(vpp_papi.VPPIOError):
+ self.vapi.add_del_ip_punt_redirect_v2(punt=punt, is_add=True)
+
+ punt = {"rx_sw_if_index": self.pg0.sw_if_index,
+ "af": VppEnum.vl_api_address_family_t.ADDRESS_IP4,
+ "n_paths": 0,
+ "paths": []}
+
+ self.vapi.add_del_ip_punt_redirect_v2(punt=punt, is_add=True)
def test_ip_punt(self):
""" IP punt police and redirect """