summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Poessinger <christian@poessinger.com>2020-10-11 13:15:45 +0200
committerChristian Poessinger <christian@poessinger.com>2020-10-11 13:15:45 +0200
commit5dac49f576b5cd89508b4e133e433041e0189c46 (patch)
tree292b995fc53b1909ae7744a2f318cb3cfbfd23a7
parentef76184ae3b220235467feda76678f75960396c5 (diff)
downloadvyos-1x-5dac49f576b5cd89508b4e133e433041e0189c46.tar.gz
vyos-1x-5dac49f576b5cd89508b4e133e433041e0189c46.zip
smoketest: nat: concentrate validation logic checks
-rwxr-xr-xsmoketest/scripts/cli/test_nat.py16
1 files changed, 10 insertions, 6 deletions
diff --git a/smoketest/scripts/cli/test_nat.py b/smoketest/scripts/cli/test_nat.py
index 5c7c66840..0bb4761ea 100755
--- a/smoketest/scripts/cli/test_nat.py
+++ b/smoketest/scripts/cli/test_nat.py
@@ -45,10 +45,6 @@ class TestNAT(unittest.TestCase):
self.session.set(source_path + ['rule', '1', 'destination', 'address', network])
self.session.set(source_path + ['rule', '1', 'exclude'])
- # check validate() - outbound-interface must be defined
- with self.assertRaises(ConfigSessionError):
- self.session.commit()
-
self.session.set(source_path + ['rule', '1', 'outbound-interface', 'any'])
self.session.commit()
@@ -60,14 +56,22 @@ class TestNAT(unittest.TestCase):
self.assertEqual(condensed_json['address']['network'], network.split('/')[0])
self.assertEqual(str(condensed_json['address']['prefix']), network.split('/')[1])
- def test_validation(self):
+ def test_validation_logic(self):
""" T2813: Ensure translation address is specified """
- self.session.set(source_path + ['rule', '100', 'outbound-interface', 'eth0'])
+ rule = '5'
+ self.session.set(source_path + ['rule', rule, 'source', 'address', '192.0.2.0/24'])
+
+ # check validate() - outbound-interface must be defined
+ with self.assertRaises(ConfigSessionError):
+ self.session.commit()
+ self.session.set(source_path + ['rule', rule, 'outbound-interface', 'eth0'])
# check validate() - translation address not specified
with self.assertRaises(ConfigSessionError):
self.session.commit()
+ self.session.set(source_path + ['rule', rule, 'translation', 'address', 'masquerade'])
+ self.session.commit()
if __name__ == '__main__':
unittest.main()