summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--op-mode-definitions/force-netns.xml.in16
-rw-r--r--python/vyos/ifconfig/interface.py8
-rw-r--r--python/vyos/validate.py4
-rw-r--r--smoketest/scripts/cli/base_interfaces_test.py2
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_wireless.py4
-rwxr-xr-xsmoketest/scripts/cli/test_service_dns_dynamic.py19
-rwxr-xr-xsmoketest/scripts/cli/test_vpn_ipsec.py2
-rwxr-xr-xsrc/conf_mode/netns.py3
-rw-r--r--src/etc/skel/.bashrc4
9 files changed, 41 insertions, 21 deletions
diff --git a/op-mode-definitions/force-netns.xml.in b/op-mode-definitions/force-netns.xml.in
new file mode 100644
index 000000000..b9dc2c1e8
--- /dev/null
+++ b/op-mode-definitions/force-netns.xml.in
@@ -0,0 +1,16 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="force">
+ <children>
+ <tagNode name="netns">
+ <properties>
+ <help>Execute shell in given Network Namespace</help>
+ <completionHelp>
+ <path>netns name</path>
+ </completionHelp>
+ </properties>
+ <command>sudo ip netns exec $3 su - $(whoami)</command>
+ </tagNode>
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index f62b9f7d2..7754488c4 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -57,6 +57,8 @@ from vyos.ifconfig import Section
from netaddr import EUI
from netaddr import mac_unix_expanded
+link_local_prefix = 'fe80::/64'
+
class Interface(Control):
# This is the class which will be used to create
# self.operational, it allows subclasses, such as
@@ -1444,7 +1446,7 @@ class Interface(Control):
# we will delete all interface specific IP addresses if they are not
# explicitly configured on the CLI
if is_ipv6_link_local(addr):
- eui64 = mac2eui64(self.get_mac(), 'fe80::/64')
+ eui64 = mac2eui64(self.get_mac(), link_local_prefix)
if addr != f'{eui64}/64':
self.del_addr(addr)
else:
@@ -1571,9 +1573,9 @@ class Interface(Control):
# Manage IPv6 link-local addresses
if dict_search('ipv6.address.no_default_link_local', config) != None:
- self.del_ipv6_eui64_address('fe80::/64')
+ self.del_ipv6_eui64_address(link_local_prefix)
else:
- self.add_ipv6_eui64_address('fe80::/64')
+ self.add_ipv6_eui64_address(link_local_prefix)
# Add IPv6 EUI-based addresses
tmp = dict_search('ipv6.address.eui64', config)
diff --git a/python/vyos/validate.py b/python/vyos/validate.py
index a83193363..d18785aaf 100644
--- a/python/vyos/validate.py
+++ b/python/vyos/validate.py
@@ -62,7 +62,7 @@ def is_intf_addr_assigned(intf, address) -> bool:
# 10: [{'addr': 'fe80::a00:27ff:fed9:5b04%eth0', 'netmask': 'ffff:ffff:ffff:ffff::'}]
# }
try:
- ifaces = ifaddresses(intf)
+ addresses = ifaddresses(intf)
except ValueError as e:
print(e)
return False
@@ -74,7 +74,7 @@ def is_intf_addr_assigned(intf, address) -> bool:
netmask = None
if '/' in address:
address, netmask = address.split('/')
- for ip in ifaces.get(addr_type,[]):
+ for ip in addresses.get(addr_type, []):
# ip can have the interface name in the 'addr' field, we need to remove it
# {'addr': 'fe80::a00:27ff:fec5:f821%eth2', 'netmask': 'ffff:ffff:ffff:ffff::'}
ip_addr = ip['addr'].split('%')[0]
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py
index 8cdf476d4..348741715 100644
--- a/smoketest/scripts/cli/base_interfaces_test.py
+++ b/smoketest/scripts/cli/base_interfaces_test.py
@@ -378,7 +378,7 @@ class BasicInterfaceTest:
# is the Wireless test will first load the wifi kernel hwsim module
# which creates a wlan0 and wlan1 interface which will fail the
# tearDown() test in the end that no interface is allowed to survive!
- if not self._test_vlan:
+ if not self._test_vlan or not self._test_mtu:
self.skipTest('not supported')
mtu_1500 = '1500'
diff --git a/smoketest/scripts/cli/test_interfaces_wireless.py b/smoketest/scripts/cli/test_interfaces_wireless.py
index 5d77454b5..85432cf04 100755
--- a/smoketest/scripts/cli/test_interfaces_wireless.py
+++ b/smoketest/scripts/cli/test_interfaces_wireless.py
@@ -49,6 +49,10 @@ class WirelessInterfaceTest(BasicInterfaceTest.TestCase):
# call base-classes classmethod
super(WirelessInterfaceTest, cls).setUpClass()
+ # T5245 - currently testcases are disabled
+ cls._test_ipv6 = False
+ cls._test_vlan = False
+
def test_wireless_add_single_ip_address(self):
# derived method to check if member interfaces are enslaved properly
super().test_add_single_ip_address()
diff --git a/smoketest/scripts/cli/test_service_dns_dynamic.py b/smoketest/scripts/cli/test_service_dns_dynamic.py
index a3aa41f94..4a3c05a36 100755
--- a/smoketest/scripts/cli/test_service_dns_dynamic.py
+++ b/smoketest/scripts/cli/test_service_dns_dynamic.py
@@ -22,11 +22,11 @@ from base_vyostest_shim import VyOSUnitTestSHIM
from vyos.configsession import ConfigSessionError
from vyos.util import cmd
-from vyos.util import process_named_running
+from vyos.util import process_running
from vyos.util import read_file
-PROCESS_NAME = 'ddclient'
DDCLIENT_CONF = '/run/ddclient/ddclient.conf'
+DDCLIENT_PID = '/run/ddclient/ddclient.pid'
base_path = ['service', 'dns', 'dynamic']
hostname = 'test.ddns.vyos.io'
@@ -40,10 +40,16 @@ def get_config_value(key):
class TestServiceDDNS(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
+ # Check for running process
+ self.assertTrue(process_running(DDCLIENT_PID))
+
# Delete DDNS configuration
self.cli_delete(base_path)
self.cli_commit()
+ # PID file must no londer exist after process exited
+ self.assertFalse(os.path.exists(DDCLIENT_PID))
+
def test_dyndns_service(self):
from itertools import product
ddns = ['interface', interface, 'service']
@@ -101,9 +107,6 @@ class TestServiceDDNS(VyOSUnitTestSHIM.TestCase):
self.assertTrue(login == user)
self.assertTrue(pwd == "'" + password + "'")
- # Check for running process
- self.assertTrue(process_named_running(PROCESS_NAME))
-
def test_dyndns_rfc2136(self):
# Check if DDNS service can be configured and runs
ddns = ['interface', interface, 'rfc2136', 'vyos']
@@ -131,9 +134,6 @@ class TestServiceDDNS(VyOSUnitTestSHIM.TestCase):
# TODO: inspect generated configuration file
- # Check for running process
- self.assertTrue(process_named_running(PROCESS_NAME))
-
def test_dyndns_ipv6(self):
ddns = ['interface', interface, 'service', 'dynv6']
proto = 'dyndns2'
@@ -151,9 +151,6 @@ class TestServiceDDNS(VyOSUnitTestSHIM.TestCase):
# commit changes
self.cli_commit()
- # Check for running process
- self.assertTrue(process_named_running(PROCESS_NAME))
-
protocol = get_config_value('protocol')
login = get_config_value('login')
pwd = get_config_value('password')
diff --git a/smoketest/scripts/cli/test_vpn_ipsec.py b/smoketest/scripts/cli/test_vpn_ipsec.py
index b677f0e45..acb41e410 100755
--- a/smoketest/scripts/cli/test_vpn_ipsec.py
+++ b/smoketest/scripts/cli/test_vpn_ipsec.py
@@ -41,7 +41,7 @@ vif = '100'
esp_group = 'MyESPGroup'
ike_group = 'MyIKEGroup'
secret = 'MYSECRETKEY'
-PROCESS_NAME = 'charon'
+PROCESS_NAME = 'charon-systemd'
regex_uuid4 = '[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}'
ca_pem = """
diff --git a/src/conf_mode/netns.py b/src/conf_mode/netns.py
index 0924eb616..20129ce65 100755
--- a/src/conf_mode/netns.py
+++ b/src/conf_mode/netns.py
@@ -82,7 +82,8 @@ def verify(netns):
if 'name' in netns:
for name, config in netns['name'].items():
- print(name)
+ # no tests (yet)
+ pass
return None
diff --git a/src/etc/skel/.bashrc b/src/etc/skel/.bashrc
index 6feb613af..ba7d50003 100644
--- a/src/etc/skel/.bashrc
+++ b/src/etc/skel/.bashrc
@@ -57,9 +57,9 @@ if [ -n "$force_color_prompt" ]; then
fi
if [ "$color_prompt" = yes ]; then
- PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\H\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
+ PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\H${VRF:+(vrf:$VRF)}${NETNS:+(ns:$NETNS)}\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
- PS1='${debian_chroot:+($debian_chroot)}\u@\H${VRF:+:$VRF}:\w\$ '
+ PS1='${debian_chroot:+($debian_chroot)}\u@\H${VRF:+:$VRF}${NETNS:+(ns:$NETNS)}:\w\$ '
fi
unset color_prompt force_color_prompt