diff options
Diffstat (limited to 'smoketest/scripts/cli/test_protocols_ospfv3.py')
| -rwxr-xr-x | smoketest/scripts/cli/test_protocols_ospfv3.py | 41 | 
1 files changed, 22 insertions, 19 deletions
| diff --git a/smoketest/scripts/cli/test_protocols_ospfv3.py b/smoketest/scripts/cli/test_protocols_ospfv3.py index 989e1552d..d961a4fdc 100755 --- a/smoketest/scripts/cli/test_protocols_ospfv3.py +++ b/smoketest/scripts/cli/test_protocols_ospfv3.py @@ -20,9 +20,9 @@ from base_vyostest_shim import VyOSUnitTestSHIM  from vyos.configsession import ConfigSessionError  from vyos.ifconfig import Section +from vyos.frrender import ospf6_daemon  from vyos.utils.process import process_named_running -PROCESS_NAME = 'ospf6d'  base_path = ['protocols', 'ospfv3']  route_map = 'foo-bar-baz-0815' @@ -36,7 +36,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          super(TestProtocolsOSPFv3, cls).setUpClass()          # Retrieve FRR daemon PID - it is not allowed to crash, thus PID must remain the same -        cls.daemon_pid = process_named_running(PROCESS_NAME) +        cls.daemon_pid = process_named_running(ospf6_daemon)          cls.cli_set(cls, ['policy', 'route-map', route_map, 'rule', '10', 'action', 'permit'])          cls.cli_set(cls, ['policy', 'route-map', route_map, 'rule', '20', 'action', 'permit']) @@ -54,8 +54,11 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_delete(base_path)          self.cli_commit() +        frrconfig = self.getFRRconfig('router ospf6', endsection='^exit', daemon=ospf6_daemon) +        self.assertNotIn(f'router ospf6', frrconfig) +          # check process health and continuity -        self.assertEqual(self.daemon_pid, process_named_running(PROCESS_NAME)) +        self.assertEqual(self.daemon_pid, process_named_running(ospf6_daemon))      def test_ospfv3_01_basic(self):          seq = '10' @@ -78,7 +81,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          # Verify FRR ospfd configuration -        frrconfig = self.getFRRconfig('router ospf6', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig('router ospf6', endsection='^exit', daemon=ospf6_daemon)          self.assertIn(f'router ospf6', frrconfig)          self.assertIn(f' area {default_area} range {prefix}', frrconfig)          self.assertIn(f' ospf6 router-id {router_id}', frrconfig) @@ -86,7 +89,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.assertIn(f' area {default_area} export-list {acl_name}', frrconfig)          for interface in interfaces: -            if_config = self.getFRRconfig(f'interface {interface}', daemon=PROCESS_NAME) +            if_config = self.getFRRconfig(f'interface {interface}', daemon=ospf6_daemon)              self.assertIn(f'ipv6 ospf6 area {default_area}', if_config)          self.cli_delete(['policy', 'access-list6', acl_name]) @@ -107,7 +110,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          # Verify FRR ospfd configuration -        frrconfig = self.getFRRconfig('router ospf6', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig('router ospf6', endsection='^exit', daemon=ospf6_daemon)          self.assertIn(f'router ospf6', frrconfig)          self.assertIn(f' distance {dist_global}', frrconfig)          self.assertIn(f' distance ospf6 intra-area {dist_intra_area} inter-area {dist_inter_area} external {dist_external}', frrconfig) @@ -131,7 +134,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          # Verify FRR ospfd configuration -        frrconfig = self.getFRRconfig('router ospf6', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig('router ospf6', endsection='^exit', daemon=ospf6_daemon)          self.assertIn(f'router ospf6', frrconfig)          for protocol in redistribute:              self.assertIn(f' redistribute {protocol} metric {metric} metric-type {metric_type} route-map {route_map}', frrconfig) @@ -162,13 +165,13 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          # Verify FRR ospfd configuration -        frrconfig = self.getFRRconfig('router ospf6', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig('router ospf6', endsection='^exit', daemon=ospf6_daemon)          self.assertIn(f'router ospf6', frrconfig)          cost = '100'          priority = '10'          for interface in interfaces: -            if_config = self.getFRRconfig(f'interface {interface}', daemon=PROCESS_NAME) +            if_config = self.getFRRconfig(f'interface {interface}', daemon=ospf6_daemon)              self.assertIn(f'interface {interface}', if_config)              self.assertIn(f' ipv6 ospf6 bfd', if_config)              self.assertIn(f' ipv6 ospf6 bfd profile {bfd_profile}', if_config) @@ -185,7 +188,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          for interface in interfaces: -            if_config = self.getFRRconfig(f'interface {interface}', daemon=PROCESS_NAME) +            if_config = self.getFRRconfig(f'interface {interface}', daemon=ospf6_daemon)              # There should be no OSPF6 configuration at all after interface removal              self.assertNotIn(f' ipv6 ospf6', if_config) @@ -201,7 +204,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          # Verify FRR ospfd configuration -        frrconfig = self.getFRRconfig('router ospf6', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig('router ospf6', endsection='^exit', daemon=ospf6_daemon)          self.assertIn(f'router ospf6', frrconfig)          self.assertIn(f' area {area_stub} stub', frrconfig)          self.assertIn(f' area {area_stub_nosum} stub no-summary', frrconfig) @@ -227,7 +230,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          # Verify FRR ospfd configuration -        frrconfig = self.getFRRconfig('router ospf6', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig('router ospf6', endsection='^exit', daemon=ospf6_daemon)          self.assertIn(f'router ospf6', frrconfig)          self.assertIn(f' area {area_nssa} nssa', frrconfig)          self.assertIn(f' area {area_nssa_nosum} nssa default-information-originate no-summary', frrconfig) @@ -247,7 +250,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          # Verify FRR ospfd configuration -        frrconfig = self.getFRRconfig('router ospf6', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig('router ospf6', endsection='^exit', daemon=ospf6_daemon)          self.assertIn(f'router ospf6', frrconfig)          self.assertIn(f' default-information originate metric {metric} metric-type {metric_type} route-map {route_map}', frrconfig) @@ -256,7 +259,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          # Verify FRR ospfd configuration -        frrconfig = self.getFRRconfig('router ospf6', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig('router ospf6', endsection='^exit', daemon=ospf6_daemon)          self.assertIn(f' default-information originate always metric {metric} metric-type {metric_type} route-map {route_map}', frrconfig) @@ -282,15 +285,15 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          # Verify FRR ospfd configuration -        frrconfig = self.getFRRconfig('router ospf6', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig('router ospf6', endsection='^exit', daemon=ospf6_daemon)          self.assertIn(f'router ospf6', frrconfig)          self.assertIn(f' ospf6 router-id {router_id}', frrconfig) -        frrconfig = self.getFRRconfig(f'interface {vrf_iface}', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig(f'interface {vrf_iface}', daemon=ospf6_daemon)          self.assertIn(f'interface {vrf_iface}', frrconfig)          self.assertIn(f' ipv6 ospf6 bfd', frrconfig) -        frrconfig = self.getFRRconfig(f'router ospf6 vrf {vrf}', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig(f'router ospf6 vrf {vrf}', daemon=ospf6_daemon)          self.assertIn(f'router ospf6 vrf {vrf}', frrconfig)          self.assertIn(f' ospf6 router-id {router_id_vrf}', frrconfig) @@ -300,7 +303,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          # T5467: It must also be removed from FRR config -        frrconfig = self.getFRRconfig(f'interface {vrf_iface}', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig(f'interface {vrf_iface}', daemon=ospf6_daemon)          self.assertNotIn(f'interface {vrf_iface}', frrconfig)          # There should be no OSPF related command at all under the interface          self.assertNotIn(f' ipv6 ospf6', frrconfig) @@ -326,7 +329,7 @@ class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):          self.cli_commit()          # Verify FRR ospfd configuration -        frrconfig = self.getFRRconfig('router ospf6', daemon=PROCESS_NAME) +        frrconfig = self.getFRRconfig('router ospf6', endsection='^exit', daemon=ospf6_daemon)          self.assertIn(f'router ospf6', frrconfig)          self.assertIn(f' graceful-restart grace-period {period}', frrconfig)          self.assertIn(f' graceful-restart helper planned-only', frrconfig) | 
