nat: simplify bihash buckets/mem config
[vpp.git] / src / plugins / nat / test / test_nat.py
index c2f5f51..6dee818 100644 (file)
@@ -7211,23 +7211,23 @@ class TestNAT44EndpointDependent(MethodHolder):
         self.logger.info(self.vapi.cli("show nat timeouts"))
 
 
-class TestNAT44EndpointDependent2(MethodHolder):
+class TestNAT44EndpointDependent3(MethodHolder):
     """ Endpoint-Dependent mapping and filtering extra test cases """
 
-    translation_buckets = 5
+    max_translations = 50
 
     @classmethod
     def setUpConstants(cls):
-        super(TestNAT44EndpointDependent2, cls).setUpConstants()
+        super(TestNAT44EndpointDependent3, cls).setUpConstants()
         cls.vpp_cmdline.extend([
             "nat", "{", "endpoint-dependent",
-            "translation hash buckets %d" % cls.translation_buckets,
+            "max translations per thread %d" % cls.max_translations,
             "}"
         ])
 
     @classmethod
     def setUpClass(cls):
-        super(TestNAT44EndpointDependent2, cls).setUpClass()
+        super(TestNAT44EndpointDependent3, cls).setUpClass()
         cls.vapi.cli("set log class nat level debug")
 
         cls.nat_addr = '10.0.0.3'
@@ -7240,7 +7240,7 @@ class TestNAT44EndpointDependent2(MethodHolder):
             i.resolve_arp()
 
     def setUp(self):
-        super(TestNAT44EndpointDependent2, self).setUp()
+        super(TestNAT44EndpointDependent3, self).setUp()
         self.vapi.nat_set_timeouts(
             udp=1, tcp_established=7440, tcp_transitory=30, icmp=1)
         self.nat44_add_address(self.nat_addr)
@@ -7252,7 +7252,7 @@ class TestNAT44EndpointDependent2(MethodHolder):
 
     @classmethod
     def tearDownClass(cls):
-        super(TestNAT44EndpointDependent2, cls).tearDownClass()
+        super(TestNAT44EndpointDependent3, cls).tearDownClass()
 
     def init_tcp_session(self, in_if, out_if, sport, ext_dport):
         # SYN packet in->out
@@ -7289,9 +7289,8 @@ class TestNAT44EndpointDependent2(MethodHolder):
     def test_lru_cleanup(self):
         """ LRU cleanup algorithm """
         tcp_port_out = self.init_tcp_session(self.pg0, self.pg1, 2000, 80)
-        max_translations = 10 * self.translation_buckets
         pkts = []
-        for i in range(0, max_translations - 1):
+        for i in range(0, self.max_translations - 1):
             p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
                  IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4, ttl=64) /
                  UDP(sport=7000+i, dport=80))
@@ -7304,7 +7303,7 @@ class TestNAT44EndpointDependent2(MethodHolder):
         self.sleep(1.5, "wait for timeouts")
 
         pkts = []
-        for i in range(0, max_translations - 1):
+        for i in range(0, self.max_translations - 1):
             p = (Ether(dst=self.pg0.local_mac, src=self.pg0.remote_mac) /
                  IP(src=self.pg0.remote_ip4, dst=self.pg1.remote_ip4, ttl=64) /
                  ICMP(id=8000+i, type='echo-request'))