ipsec: input: drop by default for non-matching pkts
[vpp.git] / test / template_ipsec.py
index 725cec5..c2a14e3 100644 (file)
@@ -1605,19 +1605,14 @@ class IpsecTun46Tests(IpsecTun4Tests, IpsecTun6Tests):
     pass
 
 
-class SpdFlowCacheTemplate(VppTestCase):
+class IPSecIPv4Fwd(VppTestCase):
+    """ Test IPSec by capturing and verifying IPv4 forwarded pkts """
     @classmethod
     def setUpConstants(cls):
-        super(SpdFlowCacheTemplate, cls).setUpConstants()
-        # Override this method with required cmdline parameters e.g.
-        # cls.vpp_cmdline.extend(["ipsec", "{",
-        #                         "ipv4-outbound-spd-flow-cache on",
-        #                         "}"])
-        # cls.logger.info("VPP modified cmdline is %s" % " "
-        #                 .join(cls.vpp_cmdline))
+        super(IPSecIPv4Fwd, cls).setUpConstants()
 
     def setUp(self):
-        super(SpdFlowCacheTemplate, self).setUp()
+        super(IPSecIPv4Fwd, self).setUp()
         # store SPD objects so we can remove configs on tear down
         self.spd_objs = []
         self.spd_policies = []
@@ -1635,7 +1630,7 @@ class SpdFlowCacheTemplate(VppTestCase):
         for pg in self.pg_interfaces:
             pg.unconfig_ip4()
             pg.admin_down()
-        super(SpdFlowCacheTemplate, self).tearDown()
+        super(IPSecIPv4Fwd, self).tearDown()
 
     def create_interfaces(self, num_ifs=2):
         # create interfaces pg0 ... pg<num_ifs>
@@ -1772,6 +1767,24 @@ class SpdFlowCacheTemplate(VppTestCase):
             "Policy %s matched: %d pkts", str(spdEntry), matched_pkts)
         self.assert_equal(pkt_count, matched_pkts)
 
+
+class SpdFlowCacheTemplate(IPSecIPv4Fwd):
+    @classmethod
+    def setUpConstants(cls):
+        super(SpdFlowCacheTemplate, cls).setUpConstants()
+        # Override this method with required cmdline parameters e.g.
+        # cls.vpp_cmdline.extend(["ipsec", "{",
+        #                         "ipv4-outbound-spd-flow-cache on",
+        #                         "}"])
+        # cls.logger.info("VPP modified cmdline is %s" % " "
+        #                 .join(cls.vpp_cmdline))
+
+    def setUp(self):
+        super(SpdFlowCacheTemplate, self).setUp()
+
+    def tearDown(self):
+        super(SpdFlowCacheTemplate, self).tearDown()
+
     def get_spd_flow_cache_entries(self):
         """ 'show ipsec spd' output:
         ip4-outbound-spd-flow-cache-entries: 0
@@ -1809,6 +1822,5 @@ class SpdFlowCacheTemplate(VppTestCase):
             self.logger.info("\ncrc32 NOT supported:\n" + cpu_info)
             return False
 
-
 if __name__ == '__main__':
     unittest.main(testRunner=VppTestRunner)