ip: convert u32 entry_flags to vl_api_mfib_entry_flags_t on mroute API 42/29542/3
authorNeale Ranns <nranns@cisco.com>
Tue, 20 Oct 2020 07:20:17 +0000 (07:20 +0000)
committerOle Tr�an <otroan@employees.org>
Wed, 21 Oct 2020 14:22:59 +0000 (14:22 +0000)
Type: fix

This is not an API change, it's the same values, just a different named
type.
also use VppEnum values in tests

Signed-off-by: Neale Ranns <nranns@cisco.com>
Change-Id: I3a18b529514f3cc9467ae4e8ac3e88d067fc776b

12 files changed:
src/vnet/fib/fib_api.h
src/vnet/ip/ip.api
src/vnet/ip/ip_api.c
src/vnet/mfib/mfib_api.c
src/vnet/mfib/mfib_api.h
src/vnet/mfib/mfib_types.api
test/test_bier.py
test/test_ip4.py
test/test_ip6.py
test/test_ip_mcast.py
test/test_mpls.py
test/vpp_ip_route.py

index 2492c89..caa993b 100644 (file)
@@ -30,8 +30,8 @@ struct _vl_api_fib_prefix;
  * Encode and decode functions from the API types to internal types
  */
 extern void fib_api_path_encode(const fib_route_path_t * api_rpath,
-                                struct _vl_api_fib_path *out);
-extern int fib_api_path_decode(struct _vl_api_fib_path *in,
+                                vl_api_fib_path_t *out);
+extern int fib_api_path_decode(vl_api_fib_path_t *in,
                                fib_route_path_t *out);
 
 extern int fib_api_table_id_decode(fib_protocol_t fproto,
index 42371c4..7ac9de7 100644 (file)
@@ -304,7 +304,7 @@ define ip_mtable_details
 typedef ip_mroute
 {
   u32 table_id;
-  u32 entry_flags;
+  vl_api_mfib_entry_flags_t entry_flags;
   u32 rpf_id;
   vl_api_mprefix_t prefix;
   u8 n_paths;
index 3f593c6..448b36c 100644 (file)
@@ -745,6 +745,7 @@ api_mroute_add_del_t_handler (vl_api_ip_mroute_add_del_t * mp,
 {
   fib_route_path_t *rpath, *rpaths = NULL;
   fib_node_index_t mfib_entry_index;
+  mfib_entry_flags_t eflags;
   mfib_prefix_t pfx;
   u32 fib_index;
   int rv;
@@ -769,10 +770,11 @@ api_mroute_add_del_t_handler (vl_api_ip_mroute_add_del_t * mp,
        goto out;
     }
 
+  eflags = mfib_api_path_entry_flags_decode (mp->route.entry_flags);
   mfib_entry_index = mroute_add_del_handler (mp->is_add,
                                             mp->is_add,
                                             fib_index, &pfx,
-                                            ntohl (mp->route.entry_flags),
+                                            eflags,
                                             ntohl (mp->route.rpf_id),
                                             rpaths);
 
index 1066a9d..4743d88 100644 (file)
@@ -92,6 +92,26 @@ mfib_api_path_itf_flags_decode (vl_api_mfib_itf_flags_t in,
         *out |= MFIB_ITF_FLAG_DONT_PRESERVE;
 }
 
+mfib_entry_flags_t
+mfib_api_path_entry_flags_decode (vl_api_mfib_entry_flags_t in)
+{
+    mfib_entry_flags_t out;
+
+    out = MFIB_ENTRY_FLAG_NONE;
+    in = clib_net_to_host_u32(in);
+
+    if (in & MFIB_API_ENTRY_FLAG_SIGNAL)
+        out |= MFIB_ENTRY_FLAG_SIGNAL;
+    if (in & MFIB_API_ENTRY_FLAG_DROP)
+        out |= MFIB_ENTRY_FLAG_DROP;
+    if (in & MFIB_API_ENTRY_FLAG_CONNECTED)
+        out |= MFIB_ENTRY_FLAG_CONNECTED;
+    if (in & MFIB_API_ENTRY_FLAG_ACCEPT_ALL_ITF)
+        out |= MFIB_ENTRY_FLAG_ACCEPT_ALL_ITF;
+
+    return (out);
+}
+
 int
 mfib_api_path_decode (vl_api_mfib_path_t *in,
                       fib_route_path_t *out)
index f9c0a74..dc802b6 100644 (file)
@@ -17,6 +17,7 @@
 #define __MFIB_API_H__
 
 #include <vnet/mfib/mfib_types.h>
+#include <vnet/ip/ip.api_types.h>
 
 /**
  * Forward declare the API type, no need to include the generated api headers
@@ -27,10 +28,12 @@ struct _vl_api_mfib_path;
  * Encode and decode functions from the API types to internal types
  */
 extern void mfib_api_path_encode(const fib_route_path_t *in,
-                                 struct _vl_api_mfib_path *out);
-extern int mfib_api_path_decode(struct _vl_api_mfib_path *in,
+                                 vl_api_mfib_path_t *out);
+extern int mfib_api_path_decode(vl_api_mfib_path_t *in,
                                 fib_route_path_t *out);
 
+extern mfib_entry_flags_t mfib_api_path_entry_flags_decode (vl_api_mfib_entry_flags_t in);
+
 extern int mfib_api_table_id_decode(fib_protocol_t fproto,
                                     u32 table_id,
                                     u32 *fib_index);
index 1182306..515b6de 100644 (file)
 import "vnet/fib/fib_types.api";
 import "vnet/ip/ip_types.api";
 
+enum mfib_entry_flags
+{
+    MFIB_API_ENTRY_FLAG_NONE = 0,
+    MFIB_API_ENTRY_FLAG_SIGNAL = 0x1,
+    MFIB_API_ENTRY_FLAG_DROP = 0x2,
+    MFIB_API_ENTRY_FLAG_CONNECTED = 0x4,
+    MFIB_API_ENTRY_FLAG_ACCEPT_ALL_ITF = 0x8,
+};
+
 enum mfib_itf_flags
 {
     MFIB_API_ITF_FLAG_NONE = 0,
index 1c58ee5..2f649bb 100644 (file)
@@ -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)
 
index 8c6f8c0..2592f58 100644 (file)
@@ -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})
index 36ef577..740e2e2 100644 (file)
@@ -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,
index 64d3706..de5251a 100644 (file)
@@ -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")
index 038ffd3..0f3c617 100644 (file)
@@ -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()
 
index 4675db5..c64ad5f 100644 (file)
@@ -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