NAT44: asymmetrical static mapping and one-armed NAT (VPP-1138)
[vpp.git] / test / test_bier.py
index 48d0a29..03ae52a 100644 (file)
@@ -66,21 +66,6 @@ class TestBier(VppTestCase):
             i.admin_down()
         super(TestBier, self).tearDown()
 
-    def send_and_assert_no_replies(self, intf, pkts, remark):
-        intf.add_stream(pkts)
-        self.pg_enable_capture(self.pg_interfaces)
-        self.pg_start()
-        for i in self.pg_interfaces:
-            i.assert_nothing_captured(remark=remark)
-
-    def send_and_expect(self, input, pkts, output):
-        self.vapi.cli("trace add bier-mpls-lookup 10")
-        input.add_stream(pkts)
-        self.pg_enable_capture(self.pg_interfaces)
-        self.pg_start()
-        rx = output.get_capture(len(pkts))
-        return rx
-
     def test_bier_midpoint(self):
         """BIER midpoint"""
 
@@ -335,6 +320,31 @@ class TestBier(VppTestCase):
 
         self.send_and_expect(self.pg0, [p], self.pg1)
 
+        #
+        # A packet that does not match the Disposition entry gets dropped
+        #
+        p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
+             MPLS(label=77, ttl=255) /
+             BIER(length=BIERLength.BIER_LEN_256, BFRID=77) /
+             IP(src="1.1.1.1", dst="232.1.1.1") /
+             UDP(sport=1234, dport=1234) /
+             Raw())
+        self.send_and_assert_no_replies(self.pg0, p*2,
+                                        "no matching disposition entry")
+
+        #
+        # Add the default route to the disposition table
+        #
+        bier_de_2 = VppBierDispEntry(self, bdt.id, 0,
+                                     BIER_HDR_PAYLOAD.BIER_HDR_PROTO_IPV4,
+                                     "0.0.0.0", 0, rpf_id=8192)
+        bier_de_2.add_vpp_config()
+
+        #
+        # now the previous packet is forwarded
+        #
+        self.send_and_expect(self.pg0, [p], self.pg1)
+
     def test_bier_e2e(self):
         """ BIER end-to-end """
 
@@ -460,10 +470,14 @@ class TestBier(VppTestCase):
         bier_route.add_vpp_config()
 
         #
-        # An imposition object with all bit-positions set
+        # An 2 imposition objects with all bit-positions set
+        # only use the second, but creating 2 tests with a non-zero
+        # value index in the route add
         #
         bi = VppBierImp(self, bti, 333, chr(0xff) * 32)
         bi.add_vpp_config()
+        bi2 = VppBierImp(self, bti, 334, chr(0xff) * 32)
+        bi2.add_vpp_config()
 
         #
         # Add a multicast route that will forward into the BIER doamin
@@ -478,7 +492,7 @@ class TestBier(VppTestCase):
                    VppMRoutePath(0xffffffff,
                                  MRouteItfFlags.MFIB_ITF_FLAG_FORWARD,
                                  proto=DpoProto.DPO_PROTO_BIER,
-                                 bier_imp=bi.bi_index)])
+                                 bier_imp=bi2.bi_index)])
         route_ing_232_1_1_1.add_vpp_config()
 
         #