-
Notifications
You must be signed in to change notification settings - Fork 97
Draft: OSPF stub plugin #2360
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Draft: OSPF stub plugin #2360
Changes from 11 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
f428624
Create x99-unnumbered-static-gw
jbemmel 0f423ea
Create plugin.py
jbemmel 6f75ee8
Create dellos10.j2
jbemmel b1ab2e8
Create defaults.yml
jbemmel 223e004
Create 01-ospf-stub.yml
jbemmel 1fedd13
Update plugin.py
jbemmel 65c7f78
Add support for FRR and Cumulus NVUE, update docs
jbemmel 5885fb5
Update paragraph title
jbemmel 2785e4e
Remove
jbemmel 7cefc59
Indent
jbemmel a6df61c
Support none device
jbemmel f4969ce
- add 'range' (only applies to 'normal' area kind)
jbemmel dcd7791
No return value
jbemmel f0b0d0c
Filter areas not in use on each node
jbemmel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| (plugin-ospf-stub)= | ||
| # Fine-grained Control Over OSPF Area Route Propagation | ||
|
|
||
| The **ospf.stub** plugin extends OSPF topology modeling by adding native support for stub, totally stubby, NSSA, | ||
| and totally NSSA areas. These specialized OSPF area types are commonly used to simplify routing in enterprise networks | ||
| by reducing the number of LSAs exchanged and minimizing routing table size in remote or branch locations. With this | ||
| plugin, Netlab will automatically generate the correct configurations on all routers in the area, including the | ||
| appropriate ABR settings. This makes it easy to model and validate optimized OSPF designs in your lab topologies. | ||
|
|
||
| ```eval_rst | ||
| .. contents:: Table of Contents | ||
| :depth: 2 | ||
| :local: | ||
| :backlinks: none | ||
| ``` | ||
|
|
||
| ## Platform support | ||
|
|
||
| | Operating system | Stub areas | | ||
| |---------------------|:----------:| | ||
| | Cumulus 5.x NVUE | ✅ | | ||
| | Dell OS10 | ✅ | | ||
| | FRR | ✅ | | ||
|
|
||
| ## Using the Plugin | ||
|
|
||
| To use the plugin, add it to the **plugin** list in the lab topology: | ||
|
|
||
| ``` | ||
| plugin: [ ...., ospf.stub ] | ||
| ``` | ||
|
|
||
| This enables support for ospf.areas: | ||
|
|
||
| ``` | ||
| module: [ ospf ] | ||
|
|
||
| ospf.areas: | ||
| 1: | ||
| kind: stub | ||
| no_summarize: True | ||
| ``` | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,10 @@ | ||
| {% for id,area in ospf.areas.items() %} | ||
| - set: | ||
| vrf: | ||
| default: | ||
| router: | ||
| ospf: | ||
| area: | ||
| {{ id | ipv4 }}: | ||
| type: {{ 'totally-' if area.get('no_summary') else '' }}{{ area.kind }} | ||
| {% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| --- | ||
| devices: | ||
| cumulus_nvue.features.ospf: | ||
| stub: True | ||
| dellos10.features.ospf: | ||
| stub: True | ||
| frr.features.ospf: | ||
| stub: True | ||
| none.features.ospf: | ||
| stub: True | ||
|
|
||
| ospf: | ||
| attributes: | ||
| global: | ||
| areas: | ||
| type: dict | ||
| _requires: [ ospf ] | ||
| _keytype: int | ||
| _subtype: | ||
| kind: { 'type': str, 'valid_values': [ stub, nssa ] } | ||
| no_summary: bool | ||
| node: | ||
| areas: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| {% set pid = ospf.process|default(1) %} | ||
|
|
||
| router ospf {{ pid }} | ||
| {% for id,area in ospf.areas.items() %} | ||
| area {{ id }} {{ area.kind }}{{ ' no-summary' if area.get('no_summary') else '' }} | ||
| {% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| router ospf | ||
| {% for id,area in ospf.areas.items() %} | ||
| area {{ id }} {{ area.kind }}{{ ' no-summary' if area.get('no_summary') else '' }} | ||
| {% endfor %} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| import typing | ||
| from box import Box | ||
| from netsim import api | ||
| from netsim.augment import devices | ||
| from netsim.utils import log | ||
|
|
||
| _config_name = "ospf.stub" | ||
| _require = [ "ospf" ] | ||
|
|
||
| def post_transform(topology: Box) -> None: | ||
| for ndata in topology.nodes.values(): | ||
| if not 'ospf' in ndata.get('module',[]): | ||
| continue | ||
| ospf_areas = ndata.get('ospf.areas',{}) | ||
| if not ospf_areas: | ||
| continue | ||
| features = devices.get_device_features(ndata,topology.defaults) | ||
| if 'stub' not in features.ospf: | ||
| log.error(f"Node {ndata.name} (device {ndata.device}) not supported by the ospf.stub plugin") | ||
| continue | ||
| if ndata.get('ospf.area','0.0.0.0') != '0.0.0.0': # Check if node is an ABR | ||
| for _,area in ospf_areas.items(): | ||
| area.pop('no_summary',None) | ||
| global _config_name | ||
| api.node_config(ndata,_config_name) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,22 @@ | ||
| --- | ||
| plugin: [ ospf.stub ] | ||
|
|
||
| module: [ ospf ] | ||
|
|
||
| ospf.areas: | ||
| 1: | ||
| kind: stub | ||
| no_summary: True | ||
|
|
||
| nodes: | ||
| r1: | ||
| r2: | ||
| ospf.area: 1 | ||
| r3: | ||
|
|
||
| links: | ||
| - r1: | ||
| r2: | ||
| ospf.area: 1 | ||
|
|
||
| - r1-r3 |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest to add also the param
rangeas an array of subnets for area range config - to be applied only on ABR