summaryrefslogtreecommitdiff
path: root/src/migration-scripts/bgp
diff options
context:
space:
mode:
authorOleksandr Kuchmystyi <o.kuchmystyi@vyos.io>2026-06-26 10:23:54 +0300
committerOleksandr Kuchmystyi <o.kuchmystyi@vyos.io>2026-06-26 10:28:05 +0300
commit4e11adfb927c22e2f977c897d56a4d243860e877 (patch)
tree18123b28269b111c135b7488f0055081e27f5726 /src/migration-scripts/bgp
parent477b1b9137ef42407e18b68684485ae623834456 (diff)
downloadvyos-1x-4e11adfb927c22e2f977c897d56a4d243860e877.tar.gz
vyos-1x-4e11adfb927c22e2f977c897d56a4d243860e877.zip
bgp: T8865: Reject `vni` sub-block in VRF l2vpn-evpn when `advertise-all-vni` is globally active
When `advertise-all-vni` is configured in the global/default BGP instance, VyOS generated a `vni <id>` sub-block under each VRF BGP `address-family l2vpn evpn` context. This conflicts with advertise-all-vni: FRR already owns all kernel VNIs and returns `% Failed to create VNI` when frr-reload.py attempts to apply the VRF-level vni sub-block. FRR then performs an early exit from config processing, silently dropping the entire l2vpn evpn address-family for all subsequent VRF BGP instances.
Diffstat (limited to 'src/migration-scripts/bgp')
-rw-r--r--src/migration-scripts/bgp/7-to-845
1 files changed, 45 insertions, 0 deletions
diff --git a/src/migration-scripts/bgp/7-to-8 b/src/migration-scripts/bgp/7-to-8
new file mode 100644
index 000000000..4db4b3211
--- /dev/null
+++ b/src/migration-scripts/bgp/7-to-8
@@ -0,0 +1,45 @@
+# Copyright (C) VyOS Inc.
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+# T8865: When "address-family l2vpn-evpn advertise-all-vni" is
+# configured remove the conflicting "vni" sub-node from each affected VRF
+# because FRR returns "Failed to create VNI".
+
+from vyos.configtree import ConfigTree
+
+vrf_base = ['vrf', 'name']
+bgp_base = ['protocols', 'bgp']
+bgp_l2vpn_evpn = bgp_base + ['address-family', 'l2vpn-evpn']
+
+
+def migrate(config: ConfigTree) -> None:
+ if not config.exists(vrf_base):
+ return # Nothing to do
+
+ # Only act when advertise-all-vni is set in the default BGP instance
+ if not config.exists(bgp_l2vpn_evpn + ['advertise-all-vni']):
+ return
+
+ for vrf in config.list_nodes(vrf_base):
+ vni_path = vrf_base + [
+ vrf,
+ 'protocols',
+ 'bgp',
+ 'address-family',
+ 'l2vpn-evpn',
+ 'vni',
+ ]
+ if config.exists(vni_path):
+ config.delete(vni_path)