summaryrefslogtreecommitdiffstats
path: root/test/test_ip4.py
diff options
context:
space:
mode:
authorNeale Ranns <nranns@cisco.com>2019-06-04 13:31:23 +0000
committerDave Barach <openvpp@barachs.net>2019-06-04 15:55:31 +0000
commit68577d2982a345537e300e99a8c0e0311fe08ce1 (patch)
treeca3f73d63d9e833412a108d6bee587365667ad05 /test/test_ip4.py
parentdf3ca23f17820389fc625bbc0e7f468fce550aa9 (diff)
punt: fix the set_punt API/CLI which was rejecting valid ports
add a UT for the API Change-Id: I93fb6ec2c5f74b991bf7f229250a30c0395b8e24 Signed-off-by: Neale Ranns <nranns@cisco.com>
Diffstat (limited to 'test/test_ip4.py')
-rw-r--r--test/test_ip4.py21
1 files changed, 20 insertions, 1 deletions
diff --git a/test/test_ip4.py b/test/test_ip4.py
index 346904ab981..6d6aeb0a5d9 100644
--- a/test/test_ip4.py
+++ b/test/test_ip4.py
@@ -17,6 +17,7 @@ from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpMRoute, \
VppMRoutePath, MRouteItfFlags, MRouteEntryFlags, VppMplsIpBind, \
VppMplsTable, VppIpTable
from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint
+from vpp_papi import VppEnum
NUM_PKTS = 67
@@ -1281,10 +1282,28 @@ class TestIPPunt(VppTestCase):
def test_ip_punt(self):
""" IP punt police and redirect """
+ # use UDP packet that have a port we need to explicitly
+ # register to get punted.
+ pt_l4 = VppEnum.vl_api_punt_type_t.PUNT_API_TYPE_L4
+ af_ip4 = VppEnum.vl_api_address_family_t.ADDRESS_IP4
+ udp_proto = VppEnum.vl_api_ip_proto_t.IP_API_PROTO_UDP
+ punt_udp = {
+ 'type': pt_l4,
+ 'punt': {
+ 'l4': {
+ 'af': af_ip4,
+ 'protocol': udp_proto,
+ 'port': 1234,
+ }
+ }
+ }
+
+ self.vapi.set_punt(is_add=1, punt=punt_udp)
+
p = (Ether(src=self.pg0.remote_mac,
dst=self.pg0.local_mac) /
IP(src=self.pg0.remote_ip4, dst=self.pg0.local_ip4) /
- TCP(sport=1234, dport=1234) /
+ UDP(sport=1234, dport=1234) /
Raw('\xa5' * 100))
pkts = p * 1025