diff options
| author | Christian Breunig <christian@breunig.cc> | 2026-03-02 14:22:18 +0100 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-03-02 14:22:18 +0100 |
| commit | 0c7a2b861abd4c897a2cbe4a5564effca8f9cc01 (patch) | |
| tree | 33a331c192ef66c35cf65501697bbacc8d09e7b7 | |
| parent | ffdf35b749433b6efb2b0d9edfd163dbe9d35ee7 (diff) | |
| parent | 5e4a09815db5f4c43e20c54d8961034739b28dee (diff) | |
| download | vyos-1x-0c7a2b861abd4c897a2cbe4a5564effca8f9cc01.tar.gz vyos-1x-0c7a2b861abd4c897a2cbe4a5564effca8f9cc01.zip | |
Merge pull request #5015 from natali-rs1985/T8314
vpp: T8314: Migrate ipip interface to 'interfaces vpp ipip'
| -rw-r--r-- | interface-definitions/vpp.xml.in | 21 | ||||
| -rw-r--r-- | interface-definitions/vpp_interface_ipip.xml.in | 33 | ||||
| -rw-r--r-- | python/vyos/ifconfig/vpp/__init__.py | 2 | ||||
| -rw-r--r-- | python/vyos/ifconfig/vpp/ipip.py | 109 | ||||
| -rw-r--r-- | python/vyos/vpp/interface/__init__.py | 2 | ||||
| -rw-r--r-- | python/vyos/vpp/interface/ipip.py | 94 | ||||
| -rw-r--r-- | smoketest/configs/assert/vpp | 4 | ||||
| -rwxr-xr-x | smoketest/scripts/cli/test_vpp.py | 95 | ||||
| -rw-r--r-- | src/conf_mode/vpp_interfaces_ipip.py | 124 | ||||
| -rw-r--r-- | src/migration-scripts/vpp/5-to-6 | 27 |
10 files changed, 211 insertions, 300 deletions
diff --git a/interface-definitions/vpp.xml.in b/interface-definitions/vpp.xml.in index cf947a29d..ca9838af0 100644 --- a/interface-definitions/vpp.xml.in +++ b/interface-definitions/vpp.xml.in @@ -146,27 +146,6 @@ #include <include/kernel-interface-tun.xml.i> </children> </tagNode> - <tagNode name="ipip" owner="${vyos_conf_scripts_dir}/vpp_interfaces_ipip.py"> - <properties> - <priority>325</priority> - <help>IP encapsulation tunnel interface</help> - <constraint> - <regex>ipip[0-9]+</regex> - </constraint> - <constraintErrorMessage>IPIP tunnel interface must be named ipipN</constraintErrorMessage> - <valueHelp> - <format>ipipN</format> - <description>IPIP tunnel interface name</description> - </valueHelp> - </properties> - <children> - #include <include/generic-description.xml.i> - #include <include/interface/disable.xml.i> - #include <include/source-address-ipv4-ipv6.xml.i> - #include <include/interface/tunnel-remote.xml.i> - #include <include/kernel-interface-tun.xml.i> - </children> - </tagNode> <tagNode name="loopback" owner="${vyos_conf_scripts_dir}/vpp_interfaces_loopback.py"> <properties> <priority>325</priority> diff --git a/interface-definitions/vpp_interface_ipip.xml.in b/interface-definitions/vpp_interface_ipip.xml.in new file mode 100644 index 000000000..c965c531c --- /dev/null +++ b/interface-definitions/vpp_interface_ipip.xml.in @@ -0,0 +1,33 @@ +<?xml version="1.0"?> +<interfaceDefinition> + <node name='interfaces'> + <children> + <node name='vpp'> + <children> + <tagNode name="ipip" owner="${vyos_conf_scripts_dir}/vpp_interfaces_ipip.py"> + <properties> + <priority>325</priority> + <help>IP encapsulation tunnel interface</help> + <constraint> + <regex>vppipip[0-9]+</regex> + </constraint> + <constraintErrorMessage>IPIP tunnel interface must be named vppipipN</constraintErrorMessage> + <valueHelp> + <format>vppipipN</format> + <description>IPIP tunnel interface name</description> + </valueHelp> + </properties> + <children> + #include <include/generic-description.xml.i> + #include <include/interface/disable.xml.i> + #include <include/source-address-ipv4-ipv6.xml.i> + #include <include/interface/tunnel-remote.xml.i> + #include <include/interface/address-ipv4-ipv6.xml.i> + #include <include/interface/mtu-68-16000.xml.i> + </children> + </tagNode> + </children> + </node> + </children> + </node> +</interfaceDefinition> diff --git a/python/vyos/ifconfig/vpp/__init__.py b/python/vyos/ifconfig/vpp/__init__.py index bda2f76c8..a7cfe79a4 100644 --- a/python/vyos/ifconfig/vpp/__init__.py +++ b/python/vyos/ifconfig/vpp/__init__.py @@ -17,10 +17,12 @@ from .bond import VPPBondInterface from .interface import VPPInterface +from .ipip import VPPIPIPInterface from .vxlan import VPPVXLANInterface __all__ = [ 'VPPBondInterface', 'VPPInterface', + 'VPPIPIPInterface', 'VPPVXLANInterface', ] diff --git a/python/vyos/ifconfig/vpp/ipip.py b/python/vyos/ifconfig/vpp/ipip.py new file mode 100644 index 000000000..fff79fd43 --- /dev/null +++ b/python/vyos/ifconfig/vpp/ipip.py @@ -0,0 +1,109 @@ +# VyOS implementation of VPP IPIP interface +# +# Copyright (C) VyOS Inc. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program 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 General Public License for more details. +# +# You should have received a copy of the GNU General Public License along +# with this program; if not, write to the Free Software Foundation, Inc., +# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +from vyos.ifconfig import Interface +from vyos.ifconfig.vpp.interface import VPPInterface + + +class VPPIPIPInterface(Interface, VPPInterface): + def __init__(self, ifname, config): + self.ifname = ifname + self.instance = int(ifname.removeprefix('vppipip')) + self.vpp_ifname = self.ifname.removeprefix('vpp') + + # Initialize Interface (kernel) and VPP part + super().__init__(ifname) + VPPInterface.__init__(self, self.vpp_ifname) + + self.index = self.vpp.get_sw_if_index(self.vpp_ifname) + self.src_address = config.get('source_address') + self.dst_address = config.get('remote') + self.state = 'up' if 'disable' not in config else 'down' + + def _create(self): + pass + + def add_ipip(self): + """Create IPIP interface + https://github.com/FDio/vpp/blob/stable/2310/src/vnet/ipip/ipip.api + Example: + from vyos.ifconfig.vpp import VPPIPIPInterface + a = VPPIPIPInterface(ifname='vppipip0', config) + a.add_ipip() + """ + self.vpp.api.ipip_add_tunnel( + tunnel={ + 'src': self.src_address, + 'dst': self.dst_address, + 'instance': self.instance, + }, + ) + # Add LCP pair (kernel) interface + self.kernel_add() + # Set interface state + self.set_state(self.state) + self.set_admin_state(self.state) + self.index = self.vpp.get_sw_if_index(self.vpp_ifname) + + def delete_ipip(self): + """Delete IPIP interface + Example: + from vyos.ifconfig.vpp import VPPIPIPInterface + a = VPPIPIPInterface(ifname='vppipip0', config) + a.delete_ipip() + """ + return self.vpp.api.ipip_del_tunnel(sw_if_index=self.index) + + def kernel_add(self): + """Add LCP pair + Example: + from vyos.ifconfig.vpp import VPPIPIPInterface + a = VPPIPIPInterface(ifname='vppipip0', config) + a.kernel_add() + """ + self.vpp.lcp_pair_add(self.vpp_ifname, self.ifname, 'tun') + + def kernel_delete(self): + """Delete LCP pair + Example: + from vyos.ifconfig.vpp import VPPIPIPInterface + a = VPPIPIPInterface(ifname='vppipip0', config) + a.kernel_delete() + """ + self.vpp.lcp_pair_del(self.vpp_ifname, self.ifname) + + def remove(self): + if self.index: + # Delete lcp pair interface + if self.vpp.lcp_pair_find(vpp_name_hw=self.vpp_ifname): + self.kernel_delete() + + # Delete ipip interface + self.delete_ipip() + + def update(self, config): + # Add ipip interface + self.add_ipip() + + # Set rx-mode + rx_mode = config.get('vpp_settings', {}).get('interface_rx_mode') + if rx_mode: + self.set_rx_mode(rx_mode) + + # Apply all settings to the lcp pair (kernel) interface + super().update(config) diff --git a/python/vyos/vpp/interface/__init__.py b/python/vyos/vpp/interface/__init__.py index f17a12d43..f970edb63 100644 --- a/python/vyos/vpp/interface/__init__.py +++ b/python/vyos/vpp/interface/__init__.py @@ -20,7 +20,6 @@ from .ethernet import EthernetInterface from .geneve import GeneveInterface from .gre import GREInterface from .interface import Interface -from .ipip import IPIPInterface from .loopback import LoopbackInterface from .wireguard import WireguardInterface from .xconnect import XconnectInterface @@ -31,7 +30,6 @@ __all__ = [ 'GeneveInterface', 'GREInterface', 'Interface', - 'IPIPInterface', 'LoopbackInterface', 'WireguardInterface', 'XconnectInterface', diff --git a/python/vyos/vpp/interface/ipip.py b/python/vyos/vpp/interface/ipip.py deleted file mode 100644 index e6ed44537..000000000 --- a/python/vyos/vpp/interface/ipip.py +++ /dev/null @@ -1,94 +0,0 @@ -# VyOS implementation of VPP IPIP interface -# -# Copyright (C) VyOS Inc. -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program 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 General Public License for more details. -# -# You should have received a copy of the GNU General Public License along -# with this program; if not, write to the Free Software Foundation, Inc., -# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. - -from vyos.vpp import VPPControl -from vyos.vpp.interface.interface import Interface - - -def show(): - """Show IPIP interface - Example: - from vyos.vpp.interface import ipip - ipip.show() - """ - vpp = VPPControl() - return vpp.api.ipip_tunnel_dump() - - -class IPIPInterface(Interface): - def __init__( - self, - ifname, - source_address, - remote, - kernel_interface: str = '', - state: str = 'up', - ): - super().__init__(ifname) - self.instance = int(ifname.removeprefix('ipip')) - self.ifname = ifname - self.src_address = source_address - self.dst_address = remote - self.kernel_interface = kernel_interface - self.initial_state = state - - def add(self): - """Create IPIP interface - https://github.com/FDio/vpp/blob/stable/2310/src/vnet/ipip/ipip.api - Example: - from vyos.vpp.interface import IPIPInterface - a = IPIPInterface(ifname='ipip0', source_address='192.0.2.1', remote='192.0.2.5') - a.add() - """ - self.vpp.api.ipip_add_tunnel( - tunnel={ - 'src': self.src_address, - 'dst': self.dst_address, - 'instance': self.instance, - }, - ) - # Set interface state - self.set_state(self.initial_state) - - def delete(self): - """Delete IPIP interface - Example: - from vyos.vpp.interface import IPIPInterface - a = IPIPInterface(ifname='ipip0', source_address='192.0.2.1', remote='192.0.2.5') - a.delete() - """ - ipip_if_index = self.vpp.get_sw_if_index(f'ipip{self.instance}') - return self.vpp.api.ipip_del_tunnel(sw_if_index=ipip_if_index) - - def kernel_add(self): - """Add LCP pair - Example: - from vyos.vpp.interface import IPIPInterface - a = IPIPInterface(ifname='ipip0', source_address='192.0.2.1', remote='192.0.2.5') - a.kernel_add() - """ - self.vpp.lcp_pair_add(self.ifname, self.kernel_interface, 'tun') - - def kernel_delete(self): - """Delete LCP pair - Example: - from vyos.vpp.interface import IPIPInterface - a = IPIPInterface(ifname='ipip0', source_address='192.0.2.1', remote='192.0.2.5') - a.kernel_delete() - """ - self.vpp.lcp_pair_del(self.ifname, self.kernel_interface) diff --git a/smoketest/configs/assert/vpp b/smoketest/configs/assert/vpp index 495b41f36..8a68852b7 100644 --- a/smoketest/configs/assert/vpp +++ b/smoketest/configs/assert/vpp @@ -36,8 +36,8 @@ set vpp interfaces gre gre12 mode 'point-to-multipoint' set vpp interfaces gre gre12 remote '0.0.0.0' set vpp interfaces gre gre12 source-address '192.0.2.21' set vpp interfaces gre gre12 tunnel-type 'l3' -set vpp interfaces ipip ipip20 remote '192.0.2.2' -set vpp interfaces ipip ipip20 source-address '192.0.2.1' +set interfaces vpp ipip vppipip20 remote '192.0.2.2' +set interfaces vpp ipip vppipip20 source-address '192.0.2.1' set vpp interfaces loopback lo12 description 'Loop12' set interfaces vpp vxlan vppvxlan10 remote '192.0.2.2' set interfaces vpp vxlan vppvxlan10 source-address '192.0.2.1' diff --git a/smoketest/scripts/cli/test_vpp.py b/smoketest/scripts/cli/test_vpp.py index c2a903229..20baed178 100755 --- a/smoketest/scripts/cli/test_vpp.py +++ b/smoketest/scripts/cli/test_vpp.py @@ -826,43 +826,24 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): self.assertRegex(out, r'\bloop23\s+\d+\s+\d+\s+\d+\s+\*\s+') def test_08_vpp_ipip(self): - interface_ipip = 'ipip12' - interface_kernel = 'vpptun12' - new_interface_kernel = 'vpptun123' + ipip_path = interfaces_path + ['ipip'] + interface_ipip = 'vppipip12' source_address = '192.0.2.1' new_source_address = '192.0.2.2' remote_address = '192.0.2.5' - kernel_address = '10.0.0.0' + address = '10.0.0.0' self.cli_set(['interfaces', 'ethernet', interface, 'address', '192.0.2.1/24']) - self.cli_set( - base_path - + ['interfaces', 'ipip', interface_ipip, 'source-address', source_address] - ) - self.cli_set( - base_path + ['interfaces', 'ipip', interface_ipip, 'remote', remote_address] - ) - self.cli_set( - base_path - + [ - 'interfaces', - 'ipip', - interface_ipip, - 'kernel-interface', - interface_kernel, - ] - ) - self.cli_set( - base_path - + ['kernel-interfaces', interface_kernel, 'address', f'{kernel_address}/31'] - ) + self.cli_set(ipip_path + [interface_ipip, 'source-address', source_address]) + self.cli_set(ipip_path + [interface_ipip, 'remote', remote_address]) + self.cli_set(ipip_path + [interface_ipip, 'address', f'{address}/31']) # commit changes self.cli_commit() - self.assertTrue(os.path.isdir(f'/sys/class/net/{interface_kernel}')) - current_address = get_address(interface_kernel) - self.assertEqual(kernel_address, current_address) + self.assertTrue(os.path.isdir(f'/sys/class/net/{interface_ipip}')) + current_address = get_address(interface_ipip) + self.assertEqual(address, current_address) # check ipip interface _, out = rc_cmd('sudo vppctl show ipip tunnel') @@ -870,16 +851,7 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): self.assertIn(required_str, out) # update ipip interface - self.cli_set( - base_path - + [ - 'interfaces', - 'ipip', - interface_ipip, - 'source-address', - new_source_address, - ] - ) + self.cli_set(ipip_path + [interface_ipip, 'source-address', new_source_address]) # source address of the tunnel interface should be configured # expect raise ConfigError @@ -895,52 +867,11 @@ class TestVPP(VyOSUnitTestSHIM.TestCase): _, out = rc_cmd('sudo vppctl show ipip tunnel') required_str = f'[0] instance 12 src {new_source_address} dst {remote_address}' self.assertIn(required_str, out) - self.assertTrue(os.path.isdir(f'/sys/class/net/{interface_kernel}')) - self.assertEqual(kernel_address, current_address) - - # delete ipip kernel-interface but do not delete 'vpp kernel-interface' - # expect raise ConfigError - self.cli_delete( - base_path - + [ - 'interfaces', - 'ipip', - interface_ipip, - 'kernel-interface', - interface_kernel, - ] - ) - with self.assertRaises(ConfigSessionError): - self.cli_commit() - - # update ipip kernel-interface but do not change 'vpp kernel-interface' - # expect raise ConfigError - self.cli_set( - base_path - + [ - 'interfaces', - 'ipip', - interface_ipip, - 'kernel-interface', - new_interface_kernel, - ] - ) - with self.assertRaises(ConfigSessionError): - self.cli_commit() - - # delete kernel interface - self.cli_delete(base_path + ['kernel-interfaces', interface_kernel]) - self.cli_commit() - - # delete ipip kernel-interface - self.cli_delete( - base_path + ['interfaces', 'ipip', interface_ipip, 'kernel-interface'] - ) - self.cli_commit() - self.assertFalse(os.path.isdir(f'/sys/class/net/{interface_kernel}')) + self.assertTrue(os.path.isdir(f'/sys/class/net/{interface_ipip}')) + self.assertEqual(address, current_address) # delete ipip interface - self.cli_delete(base_path + ['interfaces', 'ipip', interface_ipip]) + self.cli_delete(ipip_path + [interface_ipip]) self.cli_commit() def test_09_vpp_xconnect(self): diff --git a/src/conf_mode/vpp_interfaces_ipip.py b/src/conf_mode/vpp_interfaces_ipip.py index eae51f5a2..d029f3619 100644 --- a/src/conf_mode/vpp_interfaces_ipip.py +++ b/src/conf_mode/vpp_interfaces_ipip.py @@ -16,24 +16,20 @@ # with this program; if not, write to the Free Software Foundation, Inc., # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. -import os - from vyos import ConfigError from vyos.config import Config -from vyos.configdict import leaf_node_changed +from vyos.configdict import get_interface_dict from vyos.configdep import set_dependents, call_dependents +from vyos.utils.process import is_systemd_service_active -from vyos.vpp.interface import IPIPInterface +from vyos.ifconfig.vpp import VPPIPIPInterface from vyos.vpp.config_deps import deps_xconnect_dict from vyos.vpp.config_verify import ( - verify_vpp_remove_kernel_interface, - verify_vpp_change_kernel_interface, verify_vpp_remove_xconnect_interface, - verify_vpp_exists_kernel_interface, verify_vpp_tunnel_source_address, ) -from vyos.vpp.utils import cli_ifaces_lcp_kernel_list, cli_ethernet_with_vifs_ifaces +from vyos.vpp.utils import cli_ethernet_with_vifs_ifaces def get_config(config=None) -> dict: @@ -49,55 +45,14 @@ def get_config(config=None) -> dict: else: conf = Config() - base = ['vpp', 'interfaces', 'ipip'] - base_kernel_interfaces = ['vpp', 'kernel-interfaces'] + base = ['interfaces', 'vpp', 'ipip'] - ifname = os.environ['VYOS_TAGNODE_VALUE'] + ifname, config = get_interface_dict(conf, base) - # Get config_dict with default values - config = conf.get_config_dict( - base + [ifname], - key_mangling=('-', '_'), - get_first_key=True, - no_tag_node_value_mangle=True, - with_defaults=True, - with_recursive_defaults=True, - ) - - if not conf.exists(['vpp']): + if not conf.exists(['vpp']) and not conf.exists(base): config['remove_vpp'] = True return config - # Get effective config as we need full dicitonary per interface delete - effective_config = conf.get_config_dict( - base + [ifname], - key_mangling=('-', '_'), - effective=True, - get_first_key=True, - no_tag_node_value_mangle=True, - ) - - if not config: - config['remove'] = True - - if effective_config: - config.update({'effective': effective_config}) - - # Get global 'vpp kernel-interfaces' for verify - config['vpp_kernel_interfaces'] = conf.get_config_dict( - base_kernel_interfaces, - key_mangling=('-', '_'), - get_first_key=True, - no_tag_node_value_mangle=True, - ) - - tmp = leaf_node_changed(conf, base + [ifname, 'kernel-interface']) - if tmp: - config['kernel_interface_removed'] = tmp - - # list of all kernel interfaces `vpp interface xxx kernel-interface xxx` - config['candidate_kernel_interfaces'] = cli_ifaces_lcp_kernel_list(conf) - # list of all Ethernet interfaces with vifs config['vpp_ether_vif_ifaces'] = cli_ethernet_with_vifs_ifaces(conf) @@ -107,23 +62,13 @@ def get_config(config=None) -> dict: for xconn_iface in config['xconn_members'][ifname]: set_dependents('vpp_interfaces_xconnect', conf, xconn_iface) - if config.get('effective', {}).get('kernel_interface'): - iface = config.get('kernel_interface') - if iface: - if iface in config.get('vpp_kernel_interfaces'): - set_dependents('vpp_kernel_interface', conf, iface) - - # NAT dependency - if conf.exists(['vpp', 'nat', 'nat44']): - set_dependents('vpp_nat_nat44', conf) - if conf.exists(['vpp', 'nat', 'cgnat']): - set_dependents('vpp_nat_cgnat', conf) - - # ACL dependency - if conf.exists(['vpp', 'acl']): - set_dependents('vpp_acl', conf) - - config['ifname'] = ifname + # Get 'vpp settings' config with default values + config['vpp_settings'] = conf.get_config_dict( + ['vpp', 'settings'], + key_mangling=('-', '_'), + get_first_key=True, + no_tag_node_value_mangle=True, + ) return config @@ -133,17 +78,17 @@ def verify(config): if 'remove_vpp' in config: return None - # Verify that removed kernel interface is not used in 'vpp kernel-interfaces'. - # vpp interfaces ipip ipipX kernel-interface vpp-tunX - # vpp kernel-interface vpp-tunX - verify_vpp_remove_kernel_interface(config) - verify_vpp_remove_xconnect_interface(config) # config removed - if 'remove' in config: + if 'deleted' in config: return None + if not is_systemd_service_active('vpp.service'): + raise ConfigError( + 'Cannot configure VPP ipip interface: vpp.service is not running' + ) + # source-address and remote are mandatory options required_keys = {'source_address', 'remote'} if not all(key in config for key in required_keys): @@ -157,12 +102,6 @@ def verify(config): if config.get('source_address') == config.get('remote'): raise ConfigError('Remote address must not be the same as source address') - # Change 'vpp interfaces ipip ipipX kernel-interface vpp-tunX' - # => 'vpp interfaces ipip ipipX kernel-interface vpp-tunY' - # check if we have kernel interface config 'vpp kernel-interface vpp-tunX' - verify_vpp_change_kernel_interface(config) - verify_vpp_exists_kernel_interface(config) - def generate(config): pass @@ -174,26 +113,13 @@ def apply(config): ifname = config.get('ifname') # Delete interface - if 'effective' in config: - remove_config = config.get('effective') - src_addr = remove_config.get('source_address') - dst_addr = remove_config.get('remote') - i = IPIPInterface(ifname, src_addr, dst_addr) - i.delete() - - if 'remove' in config: - return None + ipip = VPPIPIPInterface(ifname, config) + ipip.remove() - # Add interface - src_addr = config.get('source_address') - dst_addr = config.get('remote') - kernel_interface = config.get('kernel_interface', '') - state = 'up' if 'disable' not in config else 'down' - i = IPIPInterface(ifname, src_addr, dst_addr, kernel_interface, state) - i.add() + if 'deleted' in config: + return None - if 'kernel_interface' in config: - i.kernel_add() + ipip.update(config) call_dependents() diff --git a/src/migration-scripts/vpp/5-to-6 b/src/migration-scripts/vpp/5-to-6 index 25529cf36..18f0f70d2 100644 --- a/src/migration-scripts/vpp/5-to-6 +++ b/src/migration-scripts/vpp/5-to-6 @@ -41,6 +41,8 @@ # # Move vxlan interface from vpp section to 'interfaces vpp vxlan' (T8296) # +# Move ipip interface from vpp section to 'interfaces vpp ipip' (T8314) +# from vyos.configtree import ConfigTree @@ -411,6 +413,30 @@ def _migrate_vpp_vxlan_interface(config: ConfigTree) -> None: config.delete(['vpp', 'interfaces']) +def _migrate_vpp_ipip_interface(config: ConfigTree) -> None: + base = ['vpp', 'interfaces', 'ipip'] + new_base = ['interfaces', 'vpp', 'ipip'] + kernel_interface_base = ['vpp', 'kernel-interfaces'] + + if not config.exists(base): + return + + config.set(new_base) + + for ifname in config.list_nodes(base): + _migrate_interface(config, 'ipip', ifname) + + _migrate_members_xconnect(config, ifname) + + config.delete(base) + + if config.exists(kernel_interface_base) and len(config.list_nodes(kernel_interface_base)) == 0: + config.delete(['vpp', 'kernel-interfaces']) + + if len(config.list_nodes(['vpp', 'interfaces'])) == 0: + config.delete(['vpp', 'interfaces']) + + def migrate(config: ConfigTree) -> None: if not config.exists(['vpp']): # Nothing to do @@ -428,3 +454,4 @@ def migrate(config: ConfigTree) -> None: _migrate_vpp_resources(config) _migrate_vpp_bonding_interface(config) _migrate_vpp_vxlan_interface(config) + _migrate_vpp_ipip_interface(config) |
