diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/test_bier.py | 64 | ||||
-rw-r--r-- | test/test_ip4.py | 23 | ||||
-rw-r--r-- | test/test_ip6.py | 23 | ||||
-rw-r--r-- | test/test_ip_mcast.py | 172 | ||||
-rw-r--r-- | test/test_mpls.py | 26 | ||||
-rw-r--r-- | test/vpp_ip_route.py | 17 |
6 files changed, 185 insertions, 140 deletions
diff --git a/test/test_bier.py b/test/test_bier.py index 1c58ee58bd3..2f649bbde53 100644 --- a/test/test_bier.py +++ b/test/test_bier.py @@ -6,11 +6,12 @@ from framework import VppTestCase, VppTestRunner, running_extended_tests from vpp_ip import DpoProto from vpp_ip_route import VppIpRoute, VppRoutePath, \ VppMplsTable, VppIpMRoute, VppMRoutePath, VppIpTable, \ - MRouteEntryFlags, MRouteItfFlags, MPLS_LABEL_INVALID, \ + MPLS_LABEL_INVALID, \ VppMplsLabel, FibPathProto, FibPathType from vpp_bier import BIER_HDR_PAYLOAD, VppBierImp, VppBierDispEntry, \ VppBierDispTable, VppBierTable, VppBierTableID, VppBierRoute from vpp_udp_encap import VppUdpEncap +from vpp_papi import VppEnum import scapy.compat from scapy.packet import Raw @@ -304,6 +305,9 @@ class TestBier(VppTestCase): def test_bier_head(self): """BIER head""" + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # Add a BIER table for sub-domain 0, set 0, and BSL 256 # @@ -349,11 +353,11 @@ class TestBier(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, paths=[VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(0xffffffff, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_BIER, type=FibPathType.FIB_PATH_TYPE_BIER_IMP, bier_imp=bi.bi_index)]) @@ -400,6 +404,9 @@ class TestBier(VppTestCase): def test_bier_tail(self): """BIER Tail""" + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # Add a BIER table for sub-domain 0, set 0, and BSL 256 # @@ -440,9 +447,9 @@ class TestBier(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, paths=[VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_eg_232_1_1_1.add_vpp_config() route_eg_232_1_1_1.update_rpf_id(8192) @@ -499,14 +506,14 @@ class TestBier(VppTestCase): self, "0.0.0.0", "232.1.1.2", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, paths=[VppMRoutePath(0xffffffff, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=DpoProto.DPO_PROTO_BIER, type=FibPathType.FIB_PATH_TYPE_BIER_IMP, bier_imp=bi.bi_index), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_eg_232_1_1_2.add_vpp_config() route_eg_232_1_1_2.update_rpf_id(8192) @@ -523,6 +530,9 @@ class TestBier(VppTestCase): def bier_e2e(self, hdr_len_id, n_bytes, max_bp): """ BIER end-to-end""" + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # Add a BIER table for sub-domain 0, set 0, and BSL 256 # @@ -550,11 +560,11 @@ class TestBier(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, paths=[VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(0xffffffff, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_BIER, type=FibPathType.FIB_PATH_TYPE_BIER_IMP, bier_imp=bi_low.bi_index)]) @@ -563,11 +573,11 @@ class TestBier(VppTestCase): self, "0.0.0.0", "232.1.1.2", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, paths=[VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(0xffffffff, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_BIER, type=FibPathType.FIB_PATH_TYPE_BIER_IMP, bier_imp=bi_high.bi_index)]) @@ -621,20 +631,20 @@ class TestBier(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, table_id=10, paths=[VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_eg_232_1_1_1.add_vpp_config() route_eg_232_1_1_1.update_rpf_id(8192) route_eg_232_1_1_2 = VppIpMRoute( self, "0.0.0.0", "232.1.1.2", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, table_id=10, paths=[VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_eg_232_1_1_2.add_vpp_config() route_eg_232_1_1_2.update_rpf_id(8193) @@ -691,6 +701,9 @@ class TestBier(VppTestCase): def test_bier_head_o_udp(self): """BIER head over UDP""" + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # Add a BIER table for sub-domain 1, set 0, and BSL 256 # @@ -739,11 +752,11 @@ class TestBier(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, paths=[VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(0xffffffff, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_BIER, type=FibPathType.FIB_PATH_TYPE_BIER_IMP, bier_imp=bi2.bi_index)]) @@ -779,6 +792,9 @@ class TestBier(VppTestCase): def test_bier_tail_o_udp(self): """BIER Tail over UDP""" + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # Add a BIER table for sub-domain 0, set 0, and BSL 256 # @@ -819,9 +835,9 @@ class TestBier(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, paths=[VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_eg_232_1_1_1.add_vpp_config() route_eg_232_1_1_1.update_rpf_id(8192) diff --git a/test/test_ip4.py b/test/test_ip4.py index 8c6f8c04c0c..2592f584656 100644 --- a/test/test_ip4.py +++ b/test/test_ip4.py @@ -14,7 +14,7 @@ from six import moves from framework import VppTestCase, VppTestRunner from util import ppp from vpp_ip_route import VppIpRoute, VppRoutePath, VppIpMRoute, \ - VppMRoutePath, MRouteItfFlags, MRouteEntryFlags, VppMplsIpBind, \ + VppMRoutePath, VppMplsIpBind, \ VppMplsTable, VppIpTable, FibPathType, find_route, \ VppIpInterfaceAddress, find_route_in_dump, find_mroute_in_dump from vpp_sub_interface import VppSubInterface, VppDot1QSubint, VppDot1ADSubint @@ -896,6 +896,9 @@ class TestIPDisabled(VppTestCase): def test_ip_disabled(self): """ IP Disabled """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # An (S,G). # one accepting interface, pg0, 2 forwarding interfaces @@ -904,11 +907,11 @@ class TestIPDisabled(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_232_1_1_1.add_vpp_config() pu = (Ether(src=self.pg1.remote_mac, @@ -2090,6 +2093,8 @@ class TestIPReplace(VppTestCase): def test_replace(self): """ IP Table Replace """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t N_ROUTES = 20 links = [self.pg0, self.pg1, self.pg2, self.pg3] routes = [[], [], [], []] @@ -2107,15 +2112,15 @@ class TestIPReplace(VppTestCase): multi = VppIpMRoute( self, "0.0.0.0", "239.0.0.%d" % jj, 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg2.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg3.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)], + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)], table_id=t.table_id).add_vpp_config() routes[ii].append({'uni': uni, 'multi': multi}) diff --git a/test/test_ip6.py b/test/test_ip6.py index 36ef5777207..740e2e28510 100644 --- a/test/test_ip6.py +++ b/test/test_ip6.py @@ -21,9 +21,10 @@ from six import moves from framework import VppTestCase, VppTestRunner from util import ppp, ip6_normalize, mk_ll_addr +from vpp_papi import VppEnum from vpp_ip import DpoProto from vpp_ip_route import VppIpRoute, VppRoutePath, find_route, VppIpMRoute, \ - VppMRoutePath, MRouteItfFlags, MRouteEntryFlags, VppMplsIpBind, \ + VppMRoutePath, VppMplsIpBind, \ VppMplsRoute, VppMplsTable, VppIpTable, FibPathType, FibPathProto, \ VppIpInterfaceAddress, find_route_in_dump, find_mroute_in_dump, \ VppIp6LinkLocalAddress @@ -1845,6 +1846,8 @@ class TestIPDisabled(VppTestCase): def test_ip_disabled(self): """ IP Disabled """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t # # An (S,G). # one accepting interface, pg0, 2 forwarding interfaces @@ -1853,11 +1856,11 @@ class TestIPDisabled(VppTestCase): self, "::", "ffef::1", 128, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_ff_01.add_vpp_config() pu = (Ether(src=self.pg1.remote_mac, @@ -2553,6 +2556,8 @@ class TestIPReplace(VppTestCase): def test_replace(self): """ IP Table Replace """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t N_ROUTES = 20 links = [self.pg0, self.pg1, self.pg2, self.pg3] routes = [[], [], [], []] @@ -2575,18 +2580,18 @@ class TestIPReplace(VppTestCase): multi = VppIpMRoute( self, "::", "ff:2001::%d" % jj, 128, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT, + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6), VppMRoutePath(self.pg2.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6), VppMRoutePath(self.pg3.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6)], table_id=t.table_id).add_vpp_config() routes[ii].append({'uni': uni, diff --git a/test/test_ip_mcast.py b/test/test_ip_mcast.py index 64d37060d43..de5251a3ec2 100644 --- a/test/test_ip_mcast.py +++ b/test/test_ip_mcast.py @@ -5,8 +5,9 @@ import unittest from framework import VppTestCase, VppTestRunner from vpp_ip import DpoProto from vpp_ip_route import VppIpMRoute, VppMRoutePath, VppMFibSignal, \ - MRouteItfFlags, MRouteEntryFlags, VppIpTable, FibPathProto + VppIpTable, FibPathProto from vpp_gre_interface import VppGreInterface +from vpp_papi import VppEnum from scapy.packet import Raw from scapy.layers.l2 import Ether, GRE @@ -185,6 +186,9 @@ class TestIPMcast(VppTestCase): def test_ip_mcast(self): """ IP Multicast Replication """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # a stream that matches the default route. gets dropped. # @@ -216,23 +220,23 @@ class TestIPMcast(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg2.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg3.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg4.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg5.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg6.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg7.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_232_1_1_1.add_vpp_config() # @@ -243,13 +247,13 @@ class TestIPMcast(VppTestCase): self, "1.1.1.1", "232.1.1.1", 27, # any grp-len is ok when src is set - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg2.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_1_1_1_1_232_1_1_1.add_vpp_config() # @@ -261,14 +265,14 @@ class TestIPMcast(VppTestCase): self, "1.1.1.1", "232.1.1.2", 64, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, nh=self.pg1.remote_ip4), VppMRoutePath(self.pg2.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, nh=self.pg2.remote_ip4)]) route_1_1_1_1_232_1_1_2.add_vpp_config() @@ -280,11 +284,11 @@ class TestIPMcast(VppTestCase): self, "0.0.0.0", "232.0.0.0", 8, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_232.add_vpp_config() # @@ -414,6 +418,9 @@ class TestIPMcast(VppTestCase): def test_ip6_mcast(self): """ IPv6 Multicast Replication """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + self.vapi.cli("packet mac-filter pg0 on") self.vapi.cli("packet mac-filter pg1 on") self.vapi.cli("packet mac-filter pg2 on") @@ -442,18 +449,18 @@ class TestIPMcast(VppTestCase): self, "::", "ff01::1", 128, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT, + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6), VppMRoutePath(self.pg2.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6), VppMRoutePath(self.pg3.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6)]) route_ff01_1.add_vpp_config() @@ -465,15 +472,15 @@ class TestIPMcast(VppTestCase): self, "2001::1", "ff01::1", 0, # any grp-len is ok when src is set - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT, + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6), VppMRoutePath(self.pg2.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6)]) route_2001_ff01_1.add_vpp_config() @@ -485,12 +492,12 @@ class TestIPMcast(VppTestCase): self, "::", "ff01::", 16, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT, + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6)]) route_ff01.add_vpp_config() @@ -605,6 +612,9 @@ class TestIPMcast(VppTestCase): def test_ip_mcast_connected(self): """ IP Multicast Connected Source check """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # A (*,G). # one accepting interface, pg0, 1 forwarding interfaces @@ -613,15 +623,15 @@ class TestIPMcast(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_232_1_1_1.add_vpp_config() route_232_1_1_1.update_entry_flags( - MRouteEntryFlags.MFIB_ENTRY_FLAG_CONNECTED) + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_CONNECTED) # # Now the (*,G) is present, send from connected source @@ -663,15 +673,15 @@ class TestIPMcast(VppTestCase): self, "0.0.0.0", "232.1.1.2", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_232_1_1_2.add_vpp_config() route_232_1_1_2.update_entry_flags( - MRouteEntryFlags.MFIB_ENTRY_FLAG_CONNECTED) + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_CONNECTED) # # Send traffic to both entries. One read should net us two signals @@ -694,13 +704,16 @@ class TestIPMcast(VppTestCase): signal_232_1_1_2_itf_0.compare(signals[0]) route_232_1_1_1.update_entry_flags( - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE) + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE) route_232_1_1_2.update_entry_flags( - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE) + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE) def test_ip_mcast_signal(self): """ IP Multicast Signal """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # A (*,G). # one accepting interface, pg0, 1 forwarding interfaces @@ -709,16 +722,16 @@ class TestIPMcast(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_232_1_1_1.add_vpp_config() route_232_1_1_1.update_entry_flags( - MRouteEntryFlags.MFIB_ENTRY_FLAG_SIGNAL) + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_SIGNAL) # # Now the (*,G) is present, send from connected source @@ -758,8 +771,8 @@ class TestIPMcast(VppTestCase): # route_232_1_1_1.update_path_flags( self.pg0.sw_if_index, - (MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT | - MRouteItfFlags.MFIB_ITF_FLAG_NEGATE_SIGNAL)) + (MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT | + MRouteItfFlags.MFIB_API_ITF_FLAG_NEGATE_SIGNAL)) self.vapi.cli("clear trace") tx = self._mcast_connected_send_stream("232.1.1.1") @@ -772,7 +785,7 @@ class TestIPMcast(VppTestCase): # come back since the interface is still NEGATE-SIGNAL # route_232_1_1_1.update_entry_flags( - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE) + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE) tx = self._mcast_connected_send_stream("232.1.1.1") @@ -784,8 +797,9 @@ class TestIPMcast(VppTestCase): # Lastly remove the NEGATE-SIGNAL from the interface and the # signals should stop # - route_232_1_1_1.update_path_flags(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT) + route_232_1_1_1.update_path_flags( + self.pg0.sw_if_index, + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT) tx = self._mcast_connected_send_stream("232.1.1.1") signals = self.vapi.mfib_signal_dump() @@ -794,6 +808,9 @@ class TestIPMcast(VppTestCase): def test_ip_mcast_vrf(self): """ IP Multicast Replication in non-default table""" + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # An (S,G). # one accepting interface, pg0, 2 forwarding interfaces @@ -802,13 +819,13 @@ class TestIPMcast(VppTestCase): self, "1.1.1.1", "232.1.1.1", 64, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg8.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg2.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)], + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)], table_id=10) route_1_1_1_1_232_1_1_1.add_vpp_config() @@ -830,6 +847,9 @@ class TestIPMcast(VppTestCase): def test_ip_mcast_gre(self): """ IP Multicast Replication over GRE""" + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + gre_if_1 = VppGreInterface( self, self.pg1.local_ip4, @@ -858,13 +878,13 @@ class TestIPMcast(VppTestCase): self, "1.1.1.1", "232.2.2.2", 64, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(gre_if_1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(gre_if_2.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(gre_if_3.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_1_1_1_1_232_1_1_1.add_vpp_config() # @@ -903,6 +923,9 @@ class TestIPMcast(VppTestCase): def test_ip6_mcast_vrf(self): """ IPv6 Multicast Replication in non-default table""" + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # An (S,G). # one accepting interface, pg0, 2 forwarding interfaces @@ -911,15 +934,15 @@ class TestIPMcast(VppTestCase): self, "2001::1", "ff01::1", 256, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg8.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT, + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6), VppMRoutePath(self.pg2.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6)], table_id=10) route_2001_ff01_1.add_vpp_config() @@ -941,6 +964,9 @@ class TestIPMcast(VppTestCase): def test_bidir(self): """ IP Multicast Bi-directional """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # A (*,G). The set of accepting interfaces matching the forwarding # @@ -948,19 +974,19 @@ class TestIPMcast(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT | - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT | + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT | - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT | + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg2.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT | - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT | + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD), VppMRoutePath(self.pg3.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT | - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT | + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_232_1_1_1.add_vpp_config() tx = self.create_stream_ip4(self.pg0, "1.1.1.1", "232.1.1.1") diff --git a/test/test_mpls.py b/test/test_mpls.py index 038ffd34f6c..0f3c617fcc7 100644 --- a/test/test_mpls.py +++ b/test/test_mpls.py @@ -7,10 +7,11 @@ from framework import VppTestCase, VppTestRunner from vpp_ip import DpoProto, INVALID_INDEX from vpp_ip_route import VppIpRoute, VppRoutePath, VppMplsRoute, \ VppMplsIpBind, VppIpMRoute, VppMRoutePath, \ - MRouteItfFlags, MRouteEntryFlags, VppIpTable, VppMplsTable, \ + VppIpTable, VppMplsTable, \ VppMplsLabel, MplsLspMode, find_mpls_route, \ FibPathProto, FibPathType, FibPathFlags, VppMplsLabel, MplsLspMode from vpp_mpls_tunnel_interface import VppMPLSTunnelInterface +from vpp_papi import VppEnum import scapy.compat from scapy.packet import Raw @@ -1282,6 +1283,9 @@ class TestMPLS(VppTestCase): def test_mcast_head(self): """ MPLS Multicast Head-end """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # Create a multicast tunnel with two replications # @@ -1326,11 +1330,11 @@ class TestMPLS(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, [VppMRoutePath(self.pg0.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_ACCEPT), + MRouteItfFlags.MFIB_API_ITF_FLAG_ACCEPT), VppMRoutePath(mpls_tun._sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_232_1_1_1.add_vpp_config() self.logger.info(self.vapi.cli("sh ip mfib index 0")) @@ -1349,6 +1353,9 @@ class TestMPLS(VppTestCase): def test_mcast_ip4_tail(self): """ MPLS IPv4 Multicast Tail """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # Add a multicast route that will forward the traffic # post-disposition @@ -1357,10 +1364,10 @@ class TestMPLS(VppTestCase): self, "0.0.0.0", "232.1.1.1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, table_id=1, paths=[VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD)]) + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD)]) route_232_1_1_1.add_vpp_config() # @@ -1420,6 +1427,9 @@ class TestMPLS(VppTestCase): def test_mcast_ip6_tail(self): """ MPLS IPv6 Multicast Tail """ + MRouteItfFlags = VppEnum.vl_api_mfib_itf_flags_t + MRouteEntryFlags = VppEnum.vl_api_mfib_entry_flags_t + # # Add a multicast route that will forward the traffic # post-disposition @@ -1428,10 +1438,10 @@ class TestMPLS(VppTestCase): self, "::", "ff01::1", 32, - MRouteEntryFlags.MFIB_ENTRY_FLAG_NONE, + MRouteEntryFlags.MFIB_API_ENTRY_FLAG_NONE, table_id=1, paths=[VppMRoutePath(self.pg1.sw_if_index, - MRouteItfFlags.MFIB_ITF_FLAG_FORWARD, + MRouteItfFlags.MFIB_API_ITF_FLAG_FORWARD, proto=FibPathProto.FIB_PATH_NH_PROTO_IP6)]) route_ff.add_vpp_config() diff --git a/test/vpp_ip_route.py b/test/vpp_ip_route.py index 4675db5c5a6..c64ad5fb921 100644 --- a/test/vpp_ip_route.py +++ b/test/vpp_ip_route.py @@ -20,23 +20,6 @@ except NameError: text_type = str -class MRouteItfFlags: - MFIB_ITF_FLAG_NONE = 0 - MFIB_ITF_FLAG_NEGATE_SIGNAL = 1 - MFIB_ITF_FLAG_ACCEPT = 2 - MFIB_ITF_FLAG_FORWARD = 4 - MFIB_ITF_FLAG_SIGNAL_PRESENT = 8 - MFIB_ITF_FLAG_INTERNAL_COPY = 16 - - -class MRouteEntryFlags: - MFIB_ENTRY_FLAG_NONE = 0 - MFIB_ENTRY_FLAG_SIGNAL = 1 - MFIB_ENTRY_FLAG_DROP = 2 - MFIB_ENTRY_FLAG_CONNECTED = 4 - MFIB_ENTRY_FLAG_INHERIT_ACCEPT = 8 - - class FibPathProto: FIB_PATH_NH_PROTO_IP4 = 0 FIB_PATH_NH_PROTO_IP6 = 1 |