diff options
| author | John Estabrook <jestabro@vyos.io> | 2025-09-11 09:29:36 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-09-11 09:29:36 -0500 |
| commit | b3daa156d016b57b65a4b5f2fb93fd0c3b168217 (patch) | |
| tree | 994ea586ff5f47c571c5dfe52781de26427580c4 | |
| parent | 7a1f2e22c2460299ce75d41b21baff92ba1d96a5 (diff) | |
| parent | cb91488db79634f7c1759a841defdf60c3dcf42c (diff) | |
| download | vyos-1x-b3daa156d016b57b65a4b5f2fb93fd0c3b168217.tar.gz vyos-1x-b3daa156d016b57b65a4b5f2fb93fd0c3b168217.zip | |
Merge pull request #4704 from hedrok/T7297-fix-ospf-redistribute-table
ospf: T7297: fix redistribute-table
| -rw-r--r-- | data/templates/frr/ospfd.frr.j2 | 2 | ||||
| -rwxr-xr-x | smoketest/scripts/cli/test_protocols_ospf.py | 31 |
2 files changed, 27 insertions, 6 deletions
diff --git a/data/templates/frr/ospfd.frr.j2 b/data/templates/frr/ospfd.frr.j2 index 79824fb64..7277597e7 100644 --- a/data/templates/frr/ospfd.frr.j2 +++ b/data/templates/frr/ospfd.frr.j2 @@ -220,7 +220,7 @@ router ospf {{ 'vrf ' ~ vrf if vrf is vyos_defined }} {% for protocol, options in redistribute.items() %} {% if protocol == 'table' %} {% for table, table_options in options.items() %} - redistribute {{ protocol }} {{ table }} {{ 'metric ' ~ table_options.metric if table_options.metric is vyos_defined }} {{ 'metric-type ' ~ table_options.metric_type if table_options.metric_type is vyos_defined }} {{ 'route-map ' ~ table_options.route_map if table_options.route_map is vyos_defined }} + redistribute table-direct {{ table }} {{ 'metric ' ~ table_options.metric if table_options.metric is vyos_defined }} {{ 'metric-type ' ~ table_options.metric_type if table_options.metric_type is vyos_defined }} {{ 'route-map ' ~ table_options.route_map if table_options.route_map is vyos_defined }} {% endfor %} {% else %} redistribute {{ protocol }} {{ 'metric ' ~ options.metric if options.metric is vyos_defined }} {{ 'metric-type ' ~ options.metric_type if options.metric_type is vyos_defined }} {{ 'route-map ' ~ options.route_map if options.route_map is vyos_defined }} diff --git a/smoketest/scripts/cli/test_protocols_ospf.py b/smoketest/scripts/cli/test_protocols_ospf.py index 7a0f087e1..292625afc 100755 --- a/smoketest/scripts/cli/test_protocols_ospf.py +++ b/smoketest/scripts/cli/test_protocols_ospf.py @@ -255,12 +255,26 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase): def test_ospf_07_redistribute(self): metric = '15' metric_type = '1' - redistribute = ['babel', 'bgp', 'connected', 'isis', 'kernel', 'nhrp', 'rip', 'static'] + table_id = '21' + redistribute = [ + 'babel', + 'bgp', + 'connected', + 'isis', + 'kernel', + 'nhrp', + 'rip', + 'static', + 'table', + ] for protocol in redistribute: - self.cli_set(base_path + ['redistribute', protocol, 'metric', metric]) - self.cli_set(base_path + ['redistribute', protocol, 'route-map', route_map]) - self.cli_set(base_path + ['redistribute', protocol, 'metric-type', metric_type]) + redistr_base = base_path + ['redistribute', protocol] + if protocol == 'table': + redistr_base += [table_id] + self.cli_set(redistr_base + ['metric', metric]) + self.cli_set(redistr_base + ['route-map', route_map]) + self.cli_set(redistr_base + ['metric-type', metric_type]) # commit changes self.cli_commit() @@ -269,7 +283,14 @@ class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase): frrconfig = self.getFRRconfig('router ospf', endsection='^exit') self.assertIn(f'router ospf', frrconfig) for protocol in redistribute: - self.assertIn(f' redistribute {protocol} metric {metric} metric-type {metric_type} route-map {route_map}', frrconfig) + if protocol == 'table': + protocolstr = f'table-direct {table_id}' + else: + protocolstr = protocol + self.assertIn( + f' redistribute {protocolstr} metric {metric} metric-type {metric_type} route-map {route_map}', + frrconfig, + ) def test_ospf_08_virtual_link(self): networks = ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16'] |
