summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/test_protocols_rip.py
diff options
context:
space:
mode:
Diffstat (limited to 'smoketest/scripts/cli/test_protocols_rip.py')
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_rip.py85
1 files changed, 42 insertions, 43 deletions
diff --git a/smoketest/scripts/cli/test_protocols_rip.py b/smoketest/scripts/cli/test_protocols_rip.py
index 4b3674960..6f2028f2b 100755
--- a/smoketest/scripts/cli/test_protocols_rip.py
+++ b/smoketest/scripts/cli/test_protocols_rip.py
@@ -17,6 +17,8 @@
import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.ifconfig import Section
from vyos.util import cmd
@@ -34,32 +36,29 @@ base_path = ['protocols', 'rip']
def getFRRconfig():
return cmd('vtysh -c "show run" | sed -n "/router rip/,/^!/p"')
-class TestProtocolsRIP(unittest.TestCase):
+class TestProtocolsRIP(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
-
- self.session.set(['policy', 'access-list', acl_in, 'rule', '10', 'action', 'permit'])
- self.session.set(['policy', 'access-list', acl_in, 'rule', '10', 'source', 'any'])
- self.session.set(['policy', 'access-list', acl_in, 'rule', '10', 'destination', 'any'])
- self.session.set(['policy', 'access-list', acl_out, 'rule', '20', 'action', 'deny'])
- self.session.set(['policy', 'access-list', acl_out, 'rule', '20', 'source', 'any'])
- self.session.set(['policy', 'access-list', acl_out, 'rule', '20', 'destination', 'any'])
- self.session.set(['policy', 'prefix-list', prefix_list_in, 'rule', '100', 'action', 'permit'])
- self.session.set(['policy', 'prefix-list', prefix_list_in, 'rule', '100', 'prefix', '192.0.2.0/24'])
- self.session.set(['policy', 'prefix-list', prefix_list_out, 'rule', '200', 'action', 'deny'])
- self.session.set(['policy', 'prefix-list', prefix_list_out, 'rule', '200', 'prefix', '192.0.2.0/24'])
- self.session.set(['policy', 'route-map', route_map, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'access-list', acl_in, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'access-list', acl_in, 'rule', '10', 'source', 'any'])
+ self.cli_set(['policy', 'access-list', acl_in, 'rule', '10', 'destination', 'any'])
+ self.cli_set(['policy', 'access-list', acl_out, 'rule', '20', 'action', 'deny'])
+ self.cli_set(['policy', 'access-list', acl_out, 'rule', '20', 'source', 'any'])
+ self.cli_set(['policy', 'access-list', acl_out, 'rule', '20', 'destination', 'any'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_in, 'rule', '100', 'action', 'permit'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_in, 'rule', '100', 'prefix', '192.0.2.0/24'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_out, 'rule', '200', 'action', 'deny'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_out, 'rule', '200', 'prefix', '192.0.2.0/24'])
+ self.cli_set(['policy', 'route-map', route_map, 'rule', '10', 'action', 'permit'])
def tearDown(self):
- self.session.delete(base_path)
- self.session.delete(['policy', 'access-list', acl_in])
- self.session.delete(['policy', 'access-list', acl_out])
- self.session.delete(['policy', 'prefix-list', prefix_list_in])
- self.session.delete(['policy', 'prefix-list', prefix_list_out])
- self.session.delete(['policy', 'route-map', route_map])
+ self.cli_delete(base_path)
+ self.cli_delete(['policy', 'access-list', acl_in])
+ self.cli_delete(['policy', 'access-list', acl_out])
+ self.cli_delete(['policy', 'prefix-list', prefix_list_in])
+ self.cli_delete(['policy', 'prefix-list', prefix_list_out])
+ self.cli_delete(['policy', 'route-map', route_map])
- self.session.commit()
- del self.session
+ self.cli_commit()
# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))
@@ -76,34 +75,34 @@ class TestProtocolsRIP(unittest.TestCase):
timer_timeout = '1000'
timer_update = '90'
- self.session.set(base_path + ['default-distance', distance])
- self.session.set(base_path + ['default-information', 'originate'])
- self.session.set(base_path + ['default-metric', metric])
- self.session.set(base_path + ['distribute-list', 'access-list', 'in', acl_in])
- self.session.set(base_path + ['distribute-list', 'access-list', 'out', acl_out])
- self.session.set(base_path + ['distribute-list', 'prefix-list', 'in', prefix_list_in])
- self.session.set(base_path + ['distribute-list', 'prefix-list', 'out', prefix_list_out])
- self.session.set(base_path + ['passive-interface', 'default'])
- self.session.set(base_path + ['timers', 'garbage-collection', timer_garbage])
- self.session.set(base_path + ['timers', 'timeout', timer_timeout])
- self.session.set(base_path + ['timers', 'update', timer_update])
+ self.cli_set(base_path + ['default-distance', distance])
+ self.cli_set(base_path + ['default-information', 'originate'])
+ self.cli_set(base_path + ['default-metric', metric])
+ self.cli_set(base_path + ['distribute-list', 'access-list', 'in', acl_in])
+ self.cli_set(base_path + ['distribute-list', 'access-list', 'out', acl_out])
+ self.cli_set(base_path + ['distribute-list', 'prefix-list', 'in', prefix_list_in])
+ self.cli_set(base_path + ['distribute-list', 'prefix-list', 'out', prefix_list_out])
+ self.cli_set(base_path + ['passive-interface', 'default'])
+ self.cli_set(base_path + ['timers', 'garbage-collection', timer_garbage])
+ self.cli_set(base_path + ['timers', 'timeout', timer_timeout])
+ self.cli_set(base_path + ['timers', 'update', timer_update])
for interface in interfaces:
- self.session.set(base_path + ['interface', interface])
- self.session.set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'in', acl_in])
- self.session.set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'out', acl_out])
+ self.cli_set(base_path + ['interface', interface])
+ self.cli_set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'in', acl_in])
+ self.cli_set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'out', acl_out])
for neighbor in neighbors:
- self.session.set(base_path + ['neighbor', neighbor])
+ self.cli_set(base_path + ['neighbor', neighbor])
for network in networks:
- self.session.set(base_path + ['network', network])
- self.session.set(base_path + ['network-distance', network, 'distance', network_distance])
- self.session.set(base_path + ['route', network])
+ self.cli_set(base_path + ['network', network])
+ self.cli_set(base_path + ['network-distance', network, 'distance', network_distance])
+ self.cli_set(base_path + ['route', network])
for proto in redistribute:
- self.session.set(base_path + ['redistribute', proto, 'metric', metric])
- self.session.set(base_path + ['redistribute', proto, 'route-map', route_map])
+ self.cli_set(base_path + ['redistribute', proto, 'metric', metric])
+ self.cli_set(base_path + ['redistribute', proto, 'route-map', route_map])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
frrconfig = getFRRconfig()