summaryrefslogtreecommitdiff
path: root/scripts/cli/base_interfaces_test.py
diff options
context:
space:
mode:
authorThomas Mangin <thomas.mangin@exa.net.uk>2020-03-22 20:55:19 +0000
committerThomas Mangin <thomas.mangin@exa.net.uk>2020-03-22 20:55:19 +0000
commit442dd75b3635428824f1e0921846b0a2a7012b14 (patch)
tree5142729efef58d4604a639082b47c8b235e92417 /scripts/cli/base_interfaces_test.py
parentfc44f25ea39deff5953933e821fb9d47cd6c603a (diff)
downloadvyos-1x-442dd75b3635428824f1e0921846b0a2a7012b14.tar.gz
vyos-1x-442dd75b3635428824f1e0921846b0a2a7012b14.zip
vxlan: add basic testing
Diffstat (limited to 'scripts/cli/base_interfaces_test.py')
-rw-r--r--scripts/cli/base_interfaces_test.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/scripts/cli/base_interfaces_test.py b/scripts/cli/base_interfaces_test.py
index 11a7031ef..9fa0fb49e 100644
--- a/scripts/cli/base_interfaces_test.py
+++ b/scripts/cli/base_interfaces_test.py
@@ -22,12 +22,18 @@ from vyos.interfaces import list_interfaces_of_type
class BasicInterfaceTest:
class BaseTest(unittest.TestCase):
+ _test_mtu = False
+ _base_path = []
+ _options = {}
+ _interfaces = []
+
def setUp(self):
self.session = ConfigSession(os.getpid())
self._test_addr = ['192.0.2.1/26', '192.0.2.255/31', '192.0.2.64/32',
'2001:db8:1::ffff/64', '2001:db8:101::1/112']
self._test_mtu = False
+ self._options = {}
def tearDown(self):
# we should not remove ethernet from the overall CLI
@@ -48,6 +54,9 @@ class BasicInterfaceTest:
for intf in self._interfaces:
test_string='Description-Test-{}'.format(intf)
self.session.set(self._base_path + [intf, 'description', test_string])
+ for option in self._options.get(intf, []):
+ self.session.set(self._base_path + [intf] + option.split())
+
self.session.commit()
# Validate interface description
@@ -66,6 +75,9 @@ class BasicInterfaceTest:
for intf in self._interfaces:
for addr in self._test_addr:
self.session.set(self._base_path + [intf, 'address', addr])
+ for option in self._options.get(intf, []):
+ self.session.set(self._base_path + [intf] + option.split())
+
self.session.commit()
# Validate address
@@ -91,6 +103,8 @@ class BasicInterfaceTest:
mtu = '1400'
for intf in self._interfaces:
self.session.set(self._base_path + [intf, 'mtu', mtu])
+ for option in self._options.get(intf, []):
+ self.session.set(self._base_path + [intf] + option.split())
self.session.commit()