summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/frr/policy.frr.tmpl8
-rw-r--r--interface-definitions/policy.xml.in39
-rwxr-xr-xsmoketest/scripts/cli/test_policy.py10
3 files changed, 37 insertions, 20 deletions
diff --git a/data/templates/frr/policy.frr.tmpl b/data/templates/frr/policy.frr.tmpl
index 507ee2a14..a16eacdef 100644
--- a/data/templates/frr/policy.frr.tmpl
+++ b/data/templates/frr/policy.frr.tmpl
@@ -247,11 +247,11 @@ route-map {{ route_map }} {{ rule_config.action }} {{ rule }}
{% if rule_config.set.distance is defined and rule_config.set.distance is not none %}
set distance {{ rule_config.set.distance }}
{% endif %}
-{% if rule_config.set.extcommunity_rt is defined and rule_config.set.extcommunity_rt is not none %}
- set extcommunity rt {{ rule_config.set.extcommunity_rt }}
+{% if rule_config.set.extcommunity is defined and rule_config.set.extcommunity.rt is defined and rule_config.set.extcommunity.rt is not none %}
+ set extcommunity rt {{ rule_config.set.extcommunity.rt }}
{% endif %}
-{% if rule_config.set.extcommunity_soo is defined and rule_config.set.extcommunity_soo is not none %}
- set extcommunity soo {{ rule_config.set.extcommunity_soo }}
+{% if rule_config.set.extcommunity is defined and rule_config.set.extcommunity.soo is defined and rule_config.set.extcommunity.soo is not none %}
+ set extcommunity soo {{ rule_config.set.extcommunity.soo }}
{% endif %}
{% if rule_config.set.ip_next_hop is defined and rule_config.set.ip_next_hop is not none %}
set ip next-hop {{ rule_config.set.ip_next_hop }}
diff --git a/interface-definitions/policy.xml.in b/interface-definitions/policy.xml.in
index 195e074a3..1b37c93b0 100644
--- a/interface-definitions/policy.xml.in
+++ b/interface-definitions/policy.xml.in
@@ -1007,24 +1007,31 @@
</constraint>
</properties>
</leafNode>
- <leafNode name="extcommunity-rt">
+ <node name="extcommunity">
<properties>
- <help>Set route target value</help>
- <valueHelp>
- <format>txt</format>
- <description>ASN:nn_or_IP_address:nn VPN extended community</description>
- </valueHelp>
+ <help>BGP extended community attribute</help>
</properties>
- </leafNode>
- <leafNode name="extcommunity-soo">
- <properties>
- <help>Set Site of Origin value</help>
- <valueHelp>
- <format>txt</format>
- <description>ASN:nn_or_IP_address:nn VPN extended community</description>
- </valueHelp>
- </properties>
- </leafNode>
+ <children>
+ <leafNode name="rt">
+ <properties>
+ <help>Set route target value</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>ASN:nn_or_IP_address:nn VPN extended community</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="soo">
+ <properties>
+ <help>Set Site of Origin value</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>ASN:nn_or_IP_address:nn VPN extended community</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
<leafNode name="ip-next-hop">
<properties>
<help>Nexthop IP address</help>
diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py
index 59425b789..bfa44088e 100755
--- a/smoketest/scripts/cli/test_policy.py
+++ b/smoketest/scripts/cli/test_policy.py
@@ -773,6 +773,8 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
'as-path-prepend' : '1234567890 987654321',
'atomic-aggregate' : '',
'distance' : '110',
+ 'extcommunity-rt' : '123:456',
+ 'extcommunity-soo' : '456:789',
'ipv6-next-hop-global': '2001::1',
'ipv6-next-hop-local' : 'fe80::1',
'ip-next-hop' : '192.168.1.1',
@@ -896,6 +898,10 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
self.cli_set(path + ['rule', rule, 'set', 'atomic-aggregate'])
if 'distance' in rule_config['set']:
self.cli_set(path + ['rule', rule, 'set', 'distance', rule_config['set']['distance']])
+ if 'extcommunity-rt' in rule_config['set']:
+ self.cli_set(path + ['rule', rule, 'set', 'extcommunity', 'rt', rule_config['set']['extcommunity-rt']])
+ if 'extcommunity-soo' in rule_config['set']:
+ self.cli_set(path + ['rule', rule, 'set', 'extcommunity', 'soo', rule_config['set']['extcommunity-soo']])
if 'ipv6-next-hop-global' in rule_config['set']:
self.cli_set(path + ['rule', rule, 'set', 'ipv6-next-hop', 'global', rule_config['set']['ipv6-next-hop-global']])
if 'ipv6-next-hop-local' in rule_config['set']:
@@ -1035,6 +1041,10 @@ class TestPolicy(VyOSUnitTestSHIM.TestCase):
tmp += 'atomic-aggregate'
elif 'distance' in rule_config['set']:
tmp += 'distance ' + rule_config['set']['distance']
+ elif 'extcommunity-rt' in rule_config['set']:
+ tmp += 'extcommunity rt' + rule_config['set']['extcommunity-rt']
+ elif 'extcommunity-soo' in rule_config['set']:
+ tmp += 'extcommunity rt' + rule_config['set']['extcommunity-soo']
elif 'ip-next-hop' in rule_config['set']:
tmp += 'ip next-hop ' + rule_config['set']['ip-next-hop']
elif 'ipv6-next-hop-global' in rule_config['set']: