Skip to content

Commit 37ec095

Browse files
authored
Merge pull request #4373 from aapostoliuk/T7158-circinus
policy: T7158: Added match source-vrf to route-map
2 parents 92ad401 + 757fb7c commit 37ec095

File tree

3 files changed

+32
-0
lines changed

3 files changed

+32
-0
lines changed

data/templates/frr/policy.frr.j2

+3
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ route-map {{ route_map }} {{ rule_config.action }} {{ rule }}
252252
{% if rule_config.match.rpki is vyos_defined %}
253253
match rpki {{ rule_config.match.rpki }}
254254
{% endif %}
255+
{% if rule_config.match.source_vrf is vyos_defined %}
256+
match source-vrf {{ rule_config.match.source_vrf }}
257+
{% endif %}
255258
{% if rule_config.match.tag is vyos_defined %}
256259
match tag {{ rule_config.match.tag }}
257260
{% endif %}

interface-definitions/policy.xml.in

+14
Original file line numberDiff line numberDiff line change
@@ -1096,6 +1096,20 @@
10961096
</constraint>
10971097
</properties>
10981098
</leafNode>
1099+
<leafNode name="source-vrf">
1100+
<properties>
1101+
<help>Source vrf</help>
1102+
#include <include/constraint/vrf.xml.i>
1103+
<valueHelp>
1104+
<format>txt</format>
1105+
<description>VRF instance name</description>
1106+
</valueHelp>
1107+
<completionHelp>
1108+
<path>vrf name</path>
1109+
<list>default</list>
1110+
</completionHelp>
1111+
</properties>
1112+
</leafNode>
10991113
#include <include/policy/tag.xml.i>
11001114
</children>
11011115
</node>

smoketest/scripts/cli/test_policy.py

+15
Original file line numberDiff line numberDiff line change
@@ -1149,6 +1149,16 @@ def test_route_map(self):
11491149
},
11501150
},
11511151
},
1152+
'vrf-match': {
1153+
'rule': {
1154+
'10': {
1155+
'action': 'permit',
1156+
'match': {
1157+
'source-vrf': 'TEST',
1158+
},
1159+
},
1160+
},
1161+
},
11521162
}
11531163

11541164
self.cli_set(['policy', 'access-list', access_list, 'rule', '10', 'action', 'permit'])
@@ -1260,6 +1270,8 @@ def test_route_map(self):
12601270
self.cli_set(path + ['rule', rule, 'match', 'rpki', 'valid'])
12611271
if 'protocol' in rule_config['match']:
12621272
self.cli_set(path + ['rule', rule, 'match', 'protocol', rule_config['match']['protocol']])
1273+
if 'source-vrf' in rule_config['match']:
1274+
self.cli_set(path + ['rule', rule, 'match', 'source-vrf', rule_config['match']['source-vrf']])
12631275
if 'tag' in rule_config['match']:
12641276
self.cli_set(path + ['rule', rule, 'match', 'tag', rule_config['match']['tag']])
12651277

@@ -1438,6 +1450,9 @@ def test_route_map(self):
14381450
if 'rpki-valid' in rule_config['match']:
14391451
tmp = f'match rpki valid'
14401452
self.assertIn(tmp, config)
1453+
if 'source-vrf' in rule_config['match']:
1454+
tmp = f'match source-vrf {rule_config["match"]["source-vrf"]}'
1455+
self.assertIn(tmp, config)
14411456
if 'tag' in rule_config['match']:
14421457
tmp = f'match tag {rule_config["match"]["tag"]}'
14431458
self.assertIn(tmp, config)

0 commit comments

Comments
 (0)