Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion data/templates/frr/ospfd.frr.j2
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
31 changes: 26 additions & 5 deletions smoketest/scripts/cli/test_protocols_ospf.py
Original file line number Diff line number Diff line change
Expand Up @@ -255,12 +255,26 @@ def test_ospf_06_neighbor(self):
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()
Expand All @@ -269,7 +283,14 @@ def test_ospf_07_redistribute(self):
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']
Expand Down
Loading