Skip to content

Commit

Permalink
T4934: ospf: Fix inter-area route summarization
Browse files Browse the repository at this point in the history
Setting something like `protocols ospf area 10 range 10.10.0.0/16` without sub options doesn't work. This is because no range commands are generated when there is no leaf nodes set under the `range` tag node.

```
edit protocols ospf
set area 16 network 10.10.0.0/16
set area 16 range 10.10.0.0/16
commit
```

```
$ vtysh -c 'show run'
!
router ospf
 auto-cost reference-bandwidth 100
 timers throttle spf 200 1000 10000
 network 10.10.0.0/16 area 16
exit
```

The generated FRR commands above is missing something like:

```
 area 16 range 10.10.0.0/16
```
  • Loading branch information
vfreex committed Jan 12, 2023
1 parent 68a0362 commit 20f448d
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 3 deletions.
8 changes: 5 additions & 3 deletions data/templates/frr/ospfd.frr.j2
Expand Up @@ -84,11 +84,13 @@ router ospf {{ 'vrf ' ~ vrf if vrf is vyos_defined }}
{% endfor %}
{% if area_config.range is vyos_defined %}
{% for range, range_config in area_config.range.items() %}
{% if range_config.cost is vyos_defined %}
area {{ area_id }} range {{ range }} cost {{ range_config.cost }}
{% endif %}
{% if range_config.not_advertise is vyos_defined %}
area {{ area_id }} range {{ range }} not-advertise
{% else %}
area {{ area_id }} range {{ range }}
{% endif %}
{% if range_config.cost is vyos_defined %}
area {{ area_id }} range {{ range }} cost {{ range_config.cost }}
{% endif %}
{% if range_config.substitute is vyos_defined %}
area {{ area_id }} range {{ range }} substitute {{ range_config.substitute }}
Expand Down
8 changes: 8 additions & 0 deletions smoketest/scripts/cli/test_protocols_ospf.py
Expand Up @@ -75,6 +75,9 @@ def test_ospf_02_simple(self):
self.cli_set(base_path + ['log-adjacency-changes', 'detail'])
self.cli_set(base_path + ['default-metric', metric])
self.cli_set(base_path + ['passive-interface', 'default'])
self.cli_set(base_path + ['area', '10', 'network', '10.0.0.0/16'])
self.cli_set(base_path + ['area', '10', 'range', '10.0.1.0/24'])
self.cli_set(base_path + ['area', '10', 'range', '10.0.2.0/24', 'not-advertise'])

# commit changes
self.cli_commit()
Expand All @@ -90,6 +93,11 @@ def test_ospf_02_simple(self):
self.assertIn(f' capability opaque', frrconfig)
self.assertIn(f' default-metric {metric}', frrconfig)
self.assertIn(f' passive-interface default', frrconfig)
self.assertIn(f' area 10 stub', frrconfig)
self.assertIn(f' area 10 network 10.0.0.0/16', frrconfig)
self.assertIn(f' area 10 range 10.0.1.0/24', frrconfig)
self.assertNotIn(f' area 10 range 10.0.1.0/24 not-advertise', frrconfig)
self.assertIn(f' area 10 range 10.0.2.0/24 not-advertise', frrconfig)


def test_ospf_03_access_list(self):
Expand Down

0 comments on commit 20f448d

Please sign in to comment.