diff options
author | Klement Sekera <ksekera@cisco.com> | 2020-07-06 09:20:01 +0000 |
---|---|---|
committer | Matthew Smith <mgsmith@netgate.com> | 2020-08-31 21:52:42 +0000 |
commit | edc816355a999df476074881ae8ed927cad88532 (patch) | |
tree | 76845b254e8801593a7ca2e53b6bc489b66aa810 /src/plugins/nat/test/test_nat.py | |
parent | b59095f830fbacbe2631dbbaa92f8e9606184015 (diff) |
nat: fix type in api message
Translation memory size is internally a uword, but in api it was u32,
resulting in the returned value being 0 all the time.
Fix the "incorrect" API reply to return a u32 capped to 0xffffffff if
the u64 is larger than that, introduce the message with
the correct type, deprecate the message with the incorrect type.
Also, while we are updating the message definition,
add the max translations / max users per worker thread
into the new message.
Type: fix
Signed-off-by: Klement Sekera <ksekera@cisco.com>
Change-Id: I92e38a6a2bcb70fc8d1b129bbe416bf7f9e54280
Signed-off-by: Andrew Yourtchenko <ayourtch@gmail.com>
Diffstat (limited to 'src/plugins/nat/test/test_nat.py')
-rw-r--r-- | src/plugins/nat/test/test_nat.py | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/src/plugins/nat/test/test_nat.py b/src/plugins/nat/test/test_nat.py index 6b673b0a143..a305b7aa9f4 100644 --- a/src/plugins/nat/test/test_nat.py +++ b/src/plugins/nat/test/test_nat.py @@ -1386,6 +1386,49 @@ class MethodHolder(VppTestCase): self.assertEqual(data, p[Raw].load) +class TestNATMisc(MethodHolder): + """ NAT misc Test Cases """ + + max_translations = 10240 + max_users = 10240 + + @classmethod + def setUpConstants(cls): + super(TestNATMisc, cls).setUpConstants() + cls.vpp_cmdline.extend([ + "nat", "{", + "max translations per thread %d" % cls.max_translations, + "max users per thread %d" % cls.max_users, + "}" + ]) + + @classmethod + def tearDownClass(cls): + super(TestNATMisc, cls).tearDownClass() + + def test_show_config(self): + """ NAT config translation memory """ + + nat_config = self.vapi.nat_show_config() + mem = nat_config.translation_memory_size + self.assertTrue(mem > 0) + self.logger.info("max translation memory: %d" % mem) + + def test_show_config_2(self): + """ NAT config2 translation memory """ + + nat_config = self.vapi.nat_show_config_2() + mem = nat_config.translation_memory_size + self.assertTrue(mem > 0) + self.logger.info("max translation memory: %d" % mem) + + def test_show_max_translations(self): + """ API test - max translations per thread """ + nat_config = self.vapi.nat_show_config_2() + self.assertEqual(self.max_translations, + nat_config.max_translations_per_thread) + + class TestNAT44(MethodHolder): """ NAT44 Test Cases """ |