summaryrefslogtreecommitdiff
path: root/python
diff options
context:
space:
mode:
authorChristian Breunig <christian@breunig.cc>2024-05-02 21:04:30 +0200
committerChristian Breunig <christian@breunig.cc>2024-05-02 21:04:30 +0200
commitdd40ed58b9e50d40cd395e67be3e9bccfb89e1f6 (patch)
tree65912073e72ab37fabd79346a5acdbd0dfd29ac9 /python
parentdd92f14b9d70956c6604f8fbbce0950f6d6c8a1d (diff)
downloadvyos-1x-dd40ed58b9e50d40cd395e67be3e9bccfb89e1f6.tar.gz
vyos-1x-dd40ed58b9e50d40cd395e67be3e9bccfb89e1f6.zip
netns: T6295: disable incomplete support in VyOS 1.4 sagitta
The netns support currently available on the VyOS CLI is only a proof-of-technology, we have no real support for any service behind it. In order to not confuse anyone on the LTS branch we decided to remove the netns option for interfaces until there is a proper usecase and implementation available.
Diffstat (limited to 'python')
-rw-r--r--python/vyos/ifconfig/interface.py43
-rw-r--r--python/vyos/utils/network.py26
2 files changed, 0 insertions, 69 deletions
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index f295c1066..fbbc04532 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -36,7 +36,6 @@ from vyos.template import render
from vyos.utils.network import mac2eui64
from vyos.utils.dict import dict_search
from vyos.utils.network import get_interface_config
-from vyos.utils.network import get_interface_namespace
from vyos.utils.process import is_systemd_service_active
from vyos.template import is_ipv4
from vyos.template import is_ipv6
@@ -137,9 +136,6 @@ class Interface(Control):
'validate': assert_mtu,
'shellcmd': 'ip link set dev {ifname} mtu {value}',
},
- 'netns': {
- 'shellcmd': 'ip link set dev {ifname} netns {value}',
- },
'vrf': {
'convert': lambda v: f'master {v}' if v else 'nomaster',
'shellcmd': 'ip link set dev {ifname} {value}',
@@ -538,35 +534,6 @@ class Interface(Control):
if prev_state == 'up':
self.set_admin_state('up')
- def del_netns(self, netns):
- """
- Remove interface from given NETNS.
- """
-
- # If NETNS does not exist then there is nothing to delete
- if not os.path.exists(f'/run/netns/{netns}'):
- return None
-
- # As a PoC we only allow 'dummy' interfaces
- if 'dum' not in self.ifname:
- return None
-
- # Check if interface realy exists in namespace
- if get_interface_namespace(self.ifname) != None:
- self._cmd(f'ip netns exec {get_interface_namespace(self.ifname)} ip link del dev {self.ifname}')
- return
-
- def set_netns(self, netns):
- """
- Add interface from given NETNS.
-
- Example:
- >>> from vyos.ifconfig import Interface
- >>> Interface('dum0').set_netns('foo')
- """
-
- self.set_interface('netns', netns)
-
def get_vrf(self):
"""
Get VRF from interface
@@ -1489,16 +1456,6 @@ class Interface(Control):
if mac:
self.set_mac(mac)
- # If interface is connected to NETNS we don't have to check all other
- # settings like MTU/IPv6/sysctl values, etc.
- # Since the interface is pushed onto a separate logical stack
- # Configure NETNS
- if dict_search('netns', config) != None:
- self.set_netns(config.get('netns', ''))
- return
- else:
- self.del_netns(config.get('netns', ''))
-
# Update interface description
self.set_alias(config.get('description', ''))
diff --git a/python/vyos/utils/network.py b/python/vyos/utils/network.py
index 63c9e263d..a3bd5c58f 100644
--- a/python/vyos/utils/network.py
+++ b/python/vyos/utils/network.py
@@ -40,13 +40,6 @@ def interface_exists(interface) -> bool:
import os
return os.path.exists(f'/sys/class/net/{interface}')
-def interface_exists_in_netns(interface_name, netns):
- from vyos.utils.process import rc_cmd
- rc, out = rc_cmd(f'ip netns exec {netns} ip link show dev {interface_name}')
- if rc == 0:
- return True
- return False
-
def get_vrf_members(vrf: str) -> list:
"""
Get list of interface VRF members
@@ -101,25 +94,6 @@ def get_interface_address(interface):
tmp = loads(cmd(f'ip --detail --json addr show dev {interface}'))[0]
return tmp
-def get_interface_namespace(iface):
- """
- Returns wich netns the interface belongs to
- """
- from json import loads
- from vyos.utils.process import cmd
- # Check if netns exist
- tmp = loads(cmd(f'ip --json netns ls'))
- if len(tmp) == 0:
- return None
-
- for ns in tmp:
- netns = f'{ns["name"]}'
- # Search interface in each netns
- data = loads(cmd(f'ip netns exec {netns} ip --json link show'))
- for tmp in data:
- if iface == tmp["ifname"]:
- return netns
-
def is_ipv6_tentative(iface: str, ipv6_address: str) -> bool:
"""Check if IPv6 address is in tentative state.