feat(iosxr): Implement Route Policies - #467
Open
sven-rosenzweig wants to merge 1 commit into
Open
Conversation
sven-rosenzweig
force-pushed
the
feat/routing_policies
branch
2 times, most recently
from
July 27, 2026 10:07
2a2e616 to
49935ee
Compare
Compared with OpenConfig and Cisco NX-OS, IOS-XR-based route policies are more
powerful and feature-rich. However, we currently do not need most of these
advanced features. Instead, we adapt to the simpler route-map configuration
model (sequence, condition, action, and disposition).
Route maps work by iterating over each entry in order of their sequence number.
If a condition matches, the configured action is executed and processing stops
after a match is found. The default action when no match is found is to pass.
We assume the same behavior with route policies: after each condition check, we
set the policy result to "done" (which stops processing and accepts the route)
or "drop" (which stops processing and rejects the route). At the end, if no
match is found, the route is accepted by default.
Some key aspects that make Route Policies richer than route maps:
* Support for if/else control flow
* Referencing other RPLs within each other, creating nested blocks of
policy logic
* Boolean operators (and, not, or)
* Parameterized route policy configuration
* Wildcard support in setting values
Yang support for Cisco IOS XR route policy support also differs from other OS models.
It simply accepts one single policy string, being correctly formatted in
the way mentioned above:
```
route-policy <name>
if <sample statement> then
set <sample set action>
done
endif
end-policy
```
https://github.com/YangModels/yang/blob/ad7aa9d483c592661c1df3d38bdfc99dc01cba56/vendor/cisco/xr/2522/Cisco-IOS-XR-um-route-policy-cfg.yang#L81-L94
Signed-off-by: Sven Rosenzweig <sven.rosenzweig@sap.com>
sven-rosenzweig
force-pushed
the
feat/routing_policies
branch
from
July 27, 2026 10:17
49935ee to
a8eda25
Compare
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
sven-rosenzweig
marked this pull request as ready for review
July 27, 2026 10:24
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Compared with OpenConfig and Cisco NX-OS, IOS-XR-based route policies are more powerful and feature-rich. However, we currently do not need most of these advanced features. Instead, we adapt to the simpler route-map configuration model (sequence, condition, action, and disposition).
Route maps work by iterating over each entry in order of their sequence number. If a condition matches, the configured action is executed and processing stops after a match is found. The default action when no match is found is to pass.
We assume the same behavior with route policies: after each condition check, we set the policy result to "done" (which stops processing and accepts the route) or "drop" (which stops processing and rejects the route). At the end, if no match is found, the route is accepted by default.
Some key aspects that make Route Policies richer than route maps:
Yang support for Cisco IOS XR route policy support also differs from other OS models. It simply accepts one single policy string, being correctly formatted in the way mentioned above:
https://github.com/YangModels/yang/blob/ad7aa9d483c592661c1df3d38bdfc99dc01cba56/vendor/cisco/xr/2522/Cisco-IOS-XR-um-route-policy-cfg.yang#L81-L94