summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/frr/bgp.frr.tmpl8
-rw-r--r--interface-definitions/include/bgp-afi-l2vpn-common.xml.i14
-rw-r--r--interface-definitions/protocols-bgp.xml.in21
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py15
4 files changed, 38 insertions, 20 deletions
diff --git a/data/templates/frr/bgp.frr.tmpl b/data/templates/frr/bgp.frr.tmpl
index ab0f94c33..56a54ef38 100644
--- a/data/templates/frr/bgp.frr.tmpl
+++ b/data/templates/frr/bgp.frr.tmpl
@@ -245,8 +245,14 @@ router bgp {{ asn }}
{% endif %}
{% endif %}
{% if afi_config.vni is defined and afi_config.vni is not none %}
-{% for vni in afi_config.vni %}
+{% for vni, vni_config in afi_config.vni.items() %}
vni {{ vni }}
+{% if vni_config.advertise_default_gw is defined %}
+ advertise-default-gw
+{% endif %}
+{% if vni_config.advertise_svi_ip is defined %}
+ advertise-svi-ip
+{% endif %}
exit-vni
{% endfor %}
{% endif %}
diff --git a/interface-definitions/include/bgp-afi-l2vpn-common.xml.i b/interface-definitions/include/bgp-afi-l2vpn-common.xml.i
new file mode 100644
index 000000000..11b1cf6bf
--- /dev/null
+++ b/interface-definitions/include/bgp-afi-l2vpn-common.xml.i
@@ -0,0 +1,14 @@
+<!-- included start from bgp-afi-l2vpn-common.xml.i -->
+<leafNode name="advertise-default-gw">
+ <properties>
+ <help>Advertise All default g/w mac-ip routes in EVPN</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<leafNode name="advertise-svi-ip">
+ <properties>
+ <help>Advertise svi mac-ip routes in EVPN</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<!-- included end -->
diff --git a/interface-definitions/protocols-bgp.xml.in b/interface-definitions/protocols-bgp.xml.in
index 01463ed57..4af53acdc 100644
--- a/interface-definitions/protocols-bgp.xml.in
+++ b/interface-definitions/protocols-bgp.xml.in
@@ -228,12 +228,7 @@
<valueless/>
</properties>
</leafNode>
- <leafNode name="advertise-default-gw">
- <properties>
- <help>Advertise All default g/w mac-ip routes in EVPN</help>
- <valueless/>
- </properties>
- </leafNode>
+ #include <include/bgp-afi-l2vpn-common.xml.i>
<leafNode name="advertise-pip">
<properties>
<help>EVPN system primary IP</help>
@@ -246,12 +241,6 @@
</constraint>
</properties>
</leafNode>
- <leafNode name="advertise-svi-ip">
- <properties>
- <help>Advertise svi mac-ip routes in EVPN</help>
- <valueless/>
- </properties>
- </leafNode>
<leafNode name="rt-auto-derive">
<properties>
<help>Auto derivation of Route Target (RFC8365)</help>
@@ -332,7 +321,7 @@
</leafNode>
</children>
</node>
- <leafNode name="vni">
+ <tagNode name="vni">
<properties>
<help>VXLAN Network Identifier</help>
<valueHelp>
@@ -342,9 +331,11 @@
<constraint>
<validator name="numeric" argument="--range 1-16777215"/>
</constraint>
- <multi/>
</properties>
- </leafNode>
+ <children>
+ #include <include/bgp-afi-l2vpn-common.xml.i>
+ </children>
+ </tagNode>
</children>
</node>
</children>
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py
index 833ca8311..ce643a247 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -127,10 +127,13 @@ peer_group_config = {
}
def getFRRBGPconfig():
- return cmd(f'vtysh -c "show run" | sed -n "/router bgp {ASN}/,/^!/p"')
+ return cmd(f'vtysh -c "show run" | sed -n "/^router bgp {ASN}/,/^!/p"')
+
+def getFRRBGPVNIconfig(vni):
+ return cmd(f'vtysh -c "show run" | sed -n "/^ vni {vni}/,/^!/p"')
def getFRRRPKIconfig():
- return cmd(f'vtysh -c "show run" | sed -n "/rpki/,/^!/p"')
+ return cmd(f'vtysh -c "show run" | sed -n "/^rpki/,/^!/p"')
class TestProtocolsBGP(unittest.TestCase):
def setUp(self):
@@ -487,7 +490,8 @@ class TestProtocolsBGP(unittest.TestCase):
self.session.set(base_path + ['address-family', 'l2vpn-evpn', 'advertise-svi-ip'])
self.session.set(base_path + ['address-family', 'l2vpn-evpn', 'flooding', 'disable'])
for vni in vnis:
- self.session.set(base_path + ['address-family', 'l2vpn-evpn', 'vni', vni])
+ self.session.set(base_path + ['address-family', 'l2vpn-evpn', 'vni', vni, 'advertise-default-gw'])
+ self.session.set(base_path + ['address-family', 'l2vpn-evpn', 'vni', vni, 'advertise-svi-ip'])
# commit changes
self.session.commit()
@@ -501,7 +505,10 @@ class TestProtocolsBGP(unittest.TestCase):
self.assertIn(f' advertise-svi-ip', frrconfig)
self.assertIn(f' flooding disable', frrconfig)
for vni in vnis:
- self.assertIn(f' vni {vni}', frrconfig)
+ vniconfig = getFRRBGPVNIconfig(vni)
+ self.assertIn(f'vni {vni}', vniconfig)
+ self.assertIn(f' advertise-default-gw', vniconfig)
+ self.assertIn(f' advertise-svi-ip', vniconfig)
if __name__ == '__main__':
unittest.main(verbosity=2)