diff options
author | Martin <magalik@cisco.com> | 2017-03-08 05:53:20 -0800 |
---|---|---|
committer | Florin Coras <florin.coras@gmail.com> | 2017-03-08 23:43:44 +0000 |
commit | 17a75cb2728900a51f9fa2531ea0142d829ea664 (patch) | |
tree | 4254adeba362aaff8f9ad1b5a523b8d0b3bdb4af /test/test_snat.py | |
parent | 2ef5d014d6beb45aa5ca4557e1fac6c1b5abfeeb (diff) |
SNAT: deterministic map dump
Change-Id: Iead6dc6a0fe15a0b8e148e780c3aeadd0b378824
Signed-off-by: Martin <magalik@cisco.com>
Diffstat (limited to 'test/test_snat.py')
-rw-r--r-- | test/test_snat.py | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/test/test_snat.py b/test/test_snat.py index 78919a026ed..7084f00208f 100644 --- a/test/test_snat.py +++ b/test/test_snat.py @@ -1322,11 +1322,31 @@ class TestDeterministicNAT(VppTestCase): rep2 = self.vapi.snat_det_reverse(out_addr_n, rep1.out_port_hi) self.assertEqual(rep2.in_addr[:4], in_addr_t_n) + deterministic_mappings = self.vapi.snat_det_map_dump() + self.assertEqual(len(deterministic_mappings), 1) + dsm = deterministic_mappings[0] + self.assertEqual(in_addr_n, dsm.in_addr[:4]) + self.assertEqual(in_plen, dsm.in_plen) + self.assertEqual(out_addr_n, dsm.out_addr[:4]) + self.assertEqual(out_plen, dsm.out_plen) + + def clear_snat(self): + """ + Clear SNAT configuration. + """ + deterministic_mappings = self.vapi.snat_det_map_dump() + for dsm in deterministic_mappings: + self.vapi.snat_add_det_map(dsm.in_addr, + dsm.in_plen, + dsm.out_addr, + dsm.out_plen, + is_add=0) + def tearDown(self): super(TestDeterministicNAT, self).tearDown() if not self.vpp_dead: self.logger.info(self.vapi.cli("show snat detail")) - + self.clear_snat() if __name__ == '__main__': unittest.main(testRunner=VppTestRunner) |