Skip to content
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

policy: T7158: Added match source-vrf to route-map #4373

Merged
merged 1 commit into from
Feb 27, 2025
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
3 changes: 3 additions & 0 deletions data/templates/frr/policy.frr.j2
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,9 @@ route-map {{ route_map }} {{ rule_config.action }} {{ rule }}
{% if rule_config.match.rpki is vyos_defined %}
match rpki {{ rule_config.match.rpki }}
{% endif %}
{% if rule_config.match.source_vrf is vyos_defined %}
match source-vrf {{ rule_config.match.source_vrf }}
{% endif %}
{% if rule_config.match.tag is vyos_defined %}
match tag {{ rule_config.match.tag }}
{% endif %}
Expand Down
14 changes: 14 additions & 0 deletions interface-definitions/policy.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -1096,6 +1096,20 @@
</constraint>
</properties>
</leafNode>
<leafNode name="source-vrf">
<properties>
<help>Source vrf</help>
#include <include/constraint/vrf.xml.i>
<valueHelp>
<format>txt</format>
<description>VRF instance name</description>
</valueHelp>
<completionHelp>
<path>vrf name</path>
<list>default</list>
</completionHelp>
</properties>
</leafNode>
#include <include/policy/tag.xml.i>
</children>
</node>
Expand Down
15 changes: 15 additions & 0 deletions smoketest/scripts/cli/test_policy.py
Original file line number Diff line number Diff line change
Expand Up @@ -1149,6 +1149,16 @@ def test_route_map(self):
},
},
},
'vrf-match': {
'rule': {
'10': {
'action': 'permit',
'match': {
'source-vrf': 'TEST',
},
},
},
},
}

self.cli_set(['policy', 'access-list', access_list, 'rule', '10', 'action', 'permit'])
Expand Down Expand Up @@ -1260,6 +1270,8 @@ def test_route_map(self):
self.cli_set(path + ['rule', rule, 'match', 'rpki', 'valid'])
if 'protocol' in rule_config['match']:
self.cli_set(path + ['rule', rule, 'match', 'protocol', rule_config['match']['protocol']])
if 'source-vrf' in rule_config['match']:
self.cli_set(path + ['rule', rule, 'match', 'source-vrf', rule_config['match']['source-vrf']])
if 'tag' in rule_config['match']:
self.cli_set(path + ['rule', rule, 'match', 'tag', rule_config['match']['tag']])

Expand Down Expand Up @@ -1438,6 +1450,9 @@ def test_route_map(self):
if 'rpki-valid' in rule_config['match']:
tmp = f'match rpki valid'
self.assertIn(tmp, config)
if 'source-vrf' in rule_config['match']:
tmp = f'match source-vrf {rule_config["match"]["source-vrf"]}'
self.assertIn(tmp, config)
if 'tag' in rule_config['match']:
tmp = f'match tag {rule_config["match"]["tag"]}'
self.assertIn(tmp, config)
Expand Down
Loading