Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ clean:
.PHONY: test
test: generate-configd-include-json
set -e; python3 -m compileall -q -x '/vmware-tools/scripts/' .
PYTHONPATH=python/ python3 -m "nose" --with-xunit src --with-coverage --cover-erase --cover-xml --cover-package src/conf_mode,src/op_mode,src/completion,src/helpers,src/validators,src/tests --verbose
PYTHONPATH=python/ python3 -m nose2 -v

.PHONY: check_migration_scripts_executable
.ONESHELL:
Expand Down
8 changes: 8 additions & 0 deletions data/templates/container/quadlet-network.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
### Autogenerated by container.py ###
[Unit]
Description=VyOS Network {{ name }}

[Network]
{% for opt in opts %}
{{ opt }}
{% endfor %}
11 changes: 11 additions & 0 deletions data/templates/container/quadlet-unit.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
### Autogenerated by container.py ###
[Unit]
Description=VyOS Container {{ name }}

[Container]
{% for opt in opts %}
{{ opt }}
{% endfor %}

[Service]
Restart={{ restart }}
17 changes: 0 additions & 17 deletions data/templates/container/systemd-unit.j2

This file was deleted.

2 changes: 1 addition & 1 deletion data/templates/dns-forwarding/override.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ After=vyos-router.service
[Service]
RuntimeDirectoryPreserve=yes
ExecStart=
ExecStart=/usr/sbin/pdns_recursor --daemon=no --write-pid=no --disable-syslog --log-timestamp=no --config-dir={{ config_dir }}
ExecStart=/usr/sbin/pdns_recursor --daemon=no --write-pid=no --disable-syslog --log-timestamp=no --config-dir={{ config_dir }} --enable-old-settings

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this warrants a comment to explain what the old settings in question are. Or can we change the scripts to make this no longer necessary?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PowerDNS changed the settings format to YAML from legacy config files.

This argument enables our legacy .conf templates to work, pending rewrite to YAML.

4 changes: 3 additions & 1 deletion data/templates/dns-forwarding/recursor.conf.lua.j2
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@
-- Do not edit, your changes will get overwritten --

-- Load DNSSEC root keys from dns-root-data package.
dofile("/usr/share/pdns-recursor/lua-config/rootkeys.lua")
-- dofile("/usr/share/pdns-recursor/lua-config/rootkeys.lua")
-- lua-config no longer present, copying line from file
readTrustAnchorsFromFile("/usr/share/dns/root.key")

-- Load lua from vyos-hostsd --
dofile("{{ config_dir }}/recursor.vyos-hostsd.conf.lua")
Expand Down
1 change: 0 additions & 1 deletion data/templates/ssh/sshd_config.j2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
#
Protocol 2
HostKey /etc/ssh/ssh_host_rsa_key
HostKey /etc/ssh/ssh_host_dsa_key
HostKey /etc/ssh/ssh_host_ecdsa_key
HostKey /etc/ssh/ssh_host_ed25519_key
SyslogFacility AUTH
Expand Down
4 changes: 3 additions & 1 deletion debian/control
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Build-Depends:
python3-hurry.filesize,
python3-netaddr,
python3-netifaces,
python3-nose,
python3-nose2,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

python3-nose2 exists in Bookworm — can we update these dependencies separately right now?

python3-jinja2,
python3-paramiko,
python3-passlib,
Expand Down Expand Up @@ -132,6 +132,7 @@ Depends:
mokutil,
shim-signed [amd64],
sbsigntool [amd64],
e2fsprogs,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add it right now.

# Image signature verification tool
minisign,
# Live filesystem tools
Expand Down Expand Up @@ -404,6 +405,7 @@ Description: VyOS configuration scripts and data for AWS Gateway Load Balancer
Package: vyos-1x-smoketest
Architecture: all
Depends:
python3-systemd,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We could add it right now, in a PR to upgrade dependencies.

skopeo,
snmp,
vyos-1x
Expand Down
2 changes: 1 addition & 1 deletion interface-definitions/include/version/ssh-version.xml.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- include start from include/version/ssh-version.xml.i -->
<syntaxVersion component='ssh' version='2'></syntaxVersion>
<syntaxVersion component='ssh' version='3'></syntaxVersion>
<!-- include end -->
2 changes: 1 addition & 1 deletion interface-definitions/include/version/system-version.xml.i
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<!-- include start from include/version/system-version.xml.i -->
<syntaxVersion component='system' version='29'></syntaxVersion>
<syntaxVersion component='system' version='30'></syntaxVersion>
<!-- include end -->
8 changes: 4 additions & 4 deletions interface-definitions/service_ssh.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@
<help>Allowed host key signature algorithms</help>
<completionHelp>
<!-- generated by ssh -Q HostKeyAlgorithms | tr '\n' ' ' as this will not change dynamically -->
<list>ssh-ed25519 ssh-ed25519-cert-v01@openssh.com sk-ssh-ed25519@openssh.com sk-ssh-ed25519-cert-v01@openssh.com ssh-rsa rsa-sha2-256 rsa-sha2-512 ssh-dss ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 sk-ecdsa-sha2-nistp256@openssh.com webauthn-sk-ecdsa-sha2-nistp256@openssh.com ssh-rsa-cert-v01@openssh.com rsa-sha2-256-cert-v01@openssh.com rsa-sha2-512-cert-v01@openssh.com ssh-dss-cert-v01@openssh.com ecdsa-sha2-nistp256-cert-v01@openssh.com ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com sk-ecdsa-sha2-nistp256-cert-v01@openssh.com</list>
<list>ssh-ed25519 ssh-ed25519-cert-v01@openssh.com sk-ssh-ed25519@openssh.com sk-ssh-ed25519-cert-v01@openssh.com ssh-rsa rsa-sha2-256 rsa-sha2-512 ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 sk-ecdsa-sha2-nistp256@openssh.com webauthn-sk-ecdsa-sha2-nistp256@openssh.com ssh-rsa-cert-v01@openssh.com rsa-sha2-256-cert-v01@openssh.com rsa-sha2-512-cert-v01@openssh.com ecdsa-sha2-nistp256-cert-v01@openssh.com ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521-cert-v01@openssh.com sk-ecdsa-sha2-nistp256-cert-v01@openssh.com</list>
</completionHelp>
<multi/>
<constraint>
<regex>(ssh-ed25519|ssh-ed25519-cert-v01@openssh.com|sk-ssh-ed25519@openssh.com|sk-ssh-ed25519-cert-v01@openssh.com|ssh-rsa|rsa-sha2-256|rsa-sha2-512|ssh-dss|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|sk-ecdsa-sha2-nistp256@openssh.com|webauthn-sk-ecdsa-sha2-nistp256@openssh.com|ssh-rsa-cert-v01@openssh.com|rsa-sha2-256-cert-v01@openssh.com|rsa-sha2-512-cert-v01@openssh.com|ssh-dss-cert-v01@openssh.com|ecdsa-sha2-nistp256-cert-v01@openssh.com|ecdsa-sha2-nistp384-cert-v01@openssh.com|ecdsa-sha2-nistp521-cert-v01@openssh.com|sk-ecdsa-sha2-nistp256-cert-v01@openssh.com)</regex>
<regex>(ssh-ed25519|ssh-ed25519-cert-v01@openssh.com|sk-ssh-ed25519@openssh.com|sk-ssh-ed25519-cert-v01@openssh.com|ssh-rsa|rsa-sha2-256|rsa-sha2-512|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|sk-ecdsa-sha2-nistp256@openssh.com|webauthn-sk-ecdsa-sha2-nistp256@openssh.com|ssh-rsa-cert-v01@openssh.com|rsa-sha2-256-cert-v01@openssh.com|rsa-sha2-512-cert-v01@openssh.com|ecdsa-sha2-nistp256-cert-v01@openssh.com|ecdsa-sha2-nistp384-cert-v01@openssh.com|ecdsa-sha2-nistp521-cert-v01@openssh.com|sk-ecdsa-sha2-nistp256-cert-v01@openssh.com)</regex>
</constraint>
</properties>
</leafNode>
Expand All @@ -151,11 +151,11 @@
<help>Allowed pubkey signature algorithms</help>
<completionHelp>
<!-- generated by ssh -Q PubkeyAcceptedAlgorithms | tr '\n' ' ' as this will not change dynamically -->
<list>ssh-ed25519 ssh-ed25519-cert-v01@openssh.com sk-ssh-ed25519@openssh.com sk-ssh-ed25519-cert-v01@openssh.com ecdsa-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com ecdsa-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com sk-ecdsa-sha2-nistp256@openssh.com sk-ecdsa-sha2-nistp256-cert-v01@openssh.com webauthn-sk-ecdsa-sha2-nistp256@openssh.com ssh-dss ssh-dss-cert-v01@openssh.com ssh-rsa ssh-rsa-cert-v01@openssh.com rsa-sha2-256 rsa-sha2-256-cert-v01@openssh.com rsa-sha2-512 rsa-sha2-512-cert-v01@openssh.com</list>
<list>ssh-ed25519 ssh-ed25519-cert-v01@openssh.com sk-ssh-ed25519@openssh.com sk-ssh-ed25519-cert-v01@openssh.com ecdsa-sha2-nistp256 ecdsa-sha2-nistp256-cert-v01@openssh.com ecdsa-sha2-nistp384 ecdsa-sha2-nistp384-cert-v01@openssh.com ecdsa-sha2-nistp521 ecdsa-sha2-nistp521-cert-v01@openssh.com sk-ecdsa-sha2-nistp256@openssh.com sk-ecdsa-sha2-nistp256-cert-v01@openssh.com webauthn-sk-ecdsa-sha2-nistp256@openssh.com ssh-rsa ssh-rsa-cert-v01@openssh.com rsa-sha2-256 rsa-sha2-256-cert-v01@openssh.com rsa-sha2-512 rsa-sha2-512-cert-v01@openssh.com</list>
</completionHelp>
<multi/>
<constraint>
<regex>(ssh-ed25519|ssh-ed25519-cert-v01@openssh.com|sk-ssh-ed25519@openssh.com|sk-ssh-ed25519-cert-v01@openssh.com|ecdsa-sha2-nistp256|ecdsa-sha2-nistp256-cert-v01@openssh.com|ecdsa-sha2-nistp384|ecdsa-sha2-nistp384-cert-v01@openssh.com|ecdsa-sha2-nistp521|ecdsa-sha2-nistp521-cert-v01@openssh.com|sk-ecdsa-sha2-nistp256@openssh.com|sk-ecdsa-sha2-nistp256-cert-v01@openssh.com|webauthn-sk-ecdsa-sha2-nistp256@openssh.com|ssh-dss|ssh-dss-cert-v01@openssh.com|ssh-rsa|ssh-rsa-cert-v01@openssh.com|rsa-sha2-256|rsa-sha2-256-cert-v01@openssh.com|rsa-sha2-512|rsa-sha2-512-cert-v01@openssh.com)</regex>
<regex>(ssh-ed25519|ssh-ed25519-cert-v01@openssh.com|sk-ssh-ed25519@openssh.com|sk-ssh-ed25519-cert-v01@openssh.com|ecdsa-sha2-nistp256|ecdsa-sha2-nistp256-cert-v01@openssh.com|ecdsa-sha2-nistp384|ecdsa-sha2-nistp384-cert-v01@openssh.com|ecdsa-sha2-nistp521|ecdsa-sha2-nistp521-cert-v01@openssh.com|sk-ecdsa-sha2-nistp256@openssh.com|sk-ecdsa-sha2-nistp256-cert-v01@openssh.com|webauthn-sk-ecdsa-sha2-nistp256@openssh.com|ssh-rsa|ssh-rsa-cert-v01@openssh.com|rsa-sha2-256|rsa-sha2-256-cert-v01@openssh.com|rsa-sha2-512|rsa-sha2-512-cert-v01@openssh.com)</regex>
</constraint>
</properties>
</leafNode>
Expand Down
8 changes: 2 additions & 6 deletions interface-definitions/system_login.xml.in
Original file line number Diff line number Diff line change
Expand Up @@ -138,12 +138,8 @@
<properties>
<help>SSH public key type</help>
<completionHelp>
<list>ssh-dss ssh-rsa ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519 sk-ecdsa-sha2-nistp256@openssh.com sk-ssh-ed25519@openssh.com</list>
<list>ssh-rsa ecdsa-sha2-nistp256 ecdsa-sha2-nistp384 ecdsa-sha2-nistp521 ssh-ed25519 sk-ecdsa-sha2-nistp256@openssh.com sk-ssh-ed25519@openssh.com</list>
</completionHelp>
<valueHelp>
<format>ssh-dss</format>
<description>Digital Signature Algorithm (DSA) key support</description>
</valueHelp>
<valueHelp>
<format>ssh-rsa</format>
<description>Key pair based on RSA algorithm</description>
Expand Down Expand Up @@ -173,7 +169,7 @@
<description>Elliptic curve 25519 security key</description>
</valueHelp>
<constraint>
<regex>(ssh-dss|ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ssh-ed25519|sk-ecdsa-sha2-nistp256@openssh.com|sk-ssh-ed25519@openssh.com)</regex>
<regex>(ssh-rsa|ecdsa-sha2-nistp256|ecdsa-sha2-nistp384|ecdsa-sha2-nistp521|ssh-ed25519|sk-ecdsa-sha2-nistp256@openssh.com|sk-ssh-ed25519@openssh.com)</regex>
</constraint>
</properties>
</leafNode>
Expand Down
9 changes: 9 additions & 0 deletions nose2.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[unittest]
start-dir = src
code-directories = conf_mode
op_mode
completion
validators
tests
test-file-pattern = test_*.py
test-method-prefix = test
4 changes: 3 additions & 1 deletion python/vyos/airbag.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@


def enable(log=True):
if 'nose2' in sys.modules:
return
if log:
_intercepting_logger()
_intercepting_exceptions()
Expand Down Expand Up @@ -157,7 +159,7 @@ def _intercepting_exceptions(_singleton=[False]):
{instructions}

When reporting problems, please include as much information as possible:
- do not obfuscate any data (feel free to contact us privately if your
- do not obfuscate any data (feel free to contact us privately if your
business policy requires it)
- and include all the information presented below

Expand Down
2 changes: 1 addition & 1 deletion python/vyos/ifconfig/interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -1629,7 +1629,7 @@ def set_mirror_redirect(self):
if direction == 'ingress':
handle = 'ffff: ingress'
parent = 'ffff:'
elif direction == 'egress':
else: # egress
handle = '1: root prio'
parent = '1:'

Expand Down
4 changes: 2 additions & 2 deletions python/vyos/utils/auth.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,8 +104,8 @@ def split_ssh_public_key(key_string, defaultname=""):
else:
key_type, key_data, key_name = parts[0], parts[1], defaultname

if key_type not in ['ssh-rsa', 'ssh-dss', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519']:
raise ValueError("Bad key type \'{0}\', must be one of must be one of ssh-rsa, ssh-dss, ecdsa-sha2-nistp<256|384|521> or ssh-ed25519".format(key_type))
if key_type not in ['ssh-rsa', 'ecdsa-sha2-nistp256', 'ecdsa-sha2-nistp384', 'ecdsa-sha2-nistp521', 'ssh-ed25519']:
raise ValueError("Bad key type \'{0}\', must be one of must be one of ssh-rsa, ecdsa-sha2-nistp<256|384|521> or ssh-ed25519".format(key_type))

return({"type": key_type, "data": key_data, "name": key_name})

Expand Down
8 changes: 8 additions & 0 deletions python/vyos/utils/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -663,3 +663,11 @@ def is_valid_ipv6_address_or_range(addr: str) -> bool:
return ip_network(addr).version == 6
except:
return False

def is_carrier_up(ifname: str) -> bool | None:
try:
carrier_path = f'/sys/class/net/{ifname}/carrier'
with open(carrier_path, 'r') as f:
return f.read().strip() == '1'
except:
return None
9 changes: 4 additions & 5 deletions python/vyos/utils/serial.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
RE_GETTY_DEVICES = re.compile(r'.+@(.+).service$')

SD_UNIT_PATH = '/run/systemd/system'
UTMP_PATH = '/run/utmp'

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This certainly deserves a separate task.


def get_serial_units(include_devices=[]):
# Since we cannot depend on the current config for decommissioned ports,
Expand Down Expand Up @@ -60,10 +59,10 @@ def get_authenticated_ports(units):
#
# We can safely skip blank or LOGIN sessions with valid device names.
#
for line in cmd(f'utmpdump {UTMP_PATH}').splitlines():
row = line.split('] [')
user_name = row[3].strip()
user_term = row[4].strip()
for line in cmd(f'who').splitlines():
Comment thread
sarthurdev marked this conversation as resolved.
row = line.split()
user_name = row[0].strip()
user_term = row[1].strip()
if user_name and user_name != 'LOGIN' and user_term in ports:
connected.append(user_term)

Expand Down
2 changes: 2 additions & 0 deletions smoketest/config-tests/basic-vyos
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,14 @@ set service ssh ciphers 'aes192-ctr'
set service ssh ciphers 'aes256-ctr'
set service ssh ciphers 'chacha20-poly1305@openssh.com'
set service ssh ciphers 'rijndael-cbc@lysator.liu.se'
set service ssh hostkey-algorithm 'ssh-rsa'
set service ssh key-exchange 'curve25519-sha256@libssh.org'
set service ssh key-exchange 'diffie-hellman-group1-sha1'
set service ssh key-exchange 'diffie-hellman-group-exchange-sha1'
set service ssh key-exchange 'diffie-hellman-group-exchange-sha256'
set service ssh listen-address '192.168.0.1'
set service ssh port '22'
set service ssh pubkey-accepted-algorithm 'ssh-rsa'
set system config-management commit-revisions '100'
set system conntrack ignore ipv4 rule 1 destination address '192.0.2.2'
set system conntrack ignore ipv4 rule 1 source address '192.0.2.1'
Expand Down
4 changes: 4 additions & 0 deletions smoketest/configs/basic-vyos
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,10 @@ service {
key-exchange curve25519-sha256@libssh.org
key-exchange diffie-hellman-group1-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256
port 22
hostkey-algorithm ssh-rsa
hostkey-algorithm ssh-dss
pubkey-accepted-algorithm ssh-rsa
pubkey-accepted-algorithm ssh-dss
}
}
system {
Expand Down
23 changes: 9 additions & 14 deletions smoketest/scripts/cli/test_container.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@

base_path = ['container']
PROCESS_NAME = 'conmon'
PROCESS_PIDFILE = '/run/vyos-container-{0}.service.pid'

busybox_image = 'busybox:stable'
busybox_image_path = '/usr/share/vyos/busybox-stable.tar'
Expand Down Expand Up @@ -68,9 +67,13 @@ def tearDown(self):
self.assertIsNone(process_named_running(PROCESS_NAME))

# Ensure systemd units are removed
units = glob.glob('/run/systemd/system/vyos-container-*')
units = glob.glob('/run/containers/systemd/vyos*')

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm sure this also needs its own task.

self.assertEqual(units, [])

def is_running(self, name):
command = f'systemctl show vyos-{name} --property=ActiveState --value'
return cmd(command).strip() == 'active'

def test_basic(self):
cont_name = 'c1'

Expand Down Expand Up @@ -99,12 +102,7 @@ def test_basic(self):
# commit changes
self.cli_commit()

pid = 0
with open(PROCESS_PIDFILE.format(cont_name), 'r') as f:
pid = int(f.read())

# Check for running process
self.assertEqual(process_named_running(PROCESS_NAME), pid)
self.assertTrue(self.is_running(cont_name))

# verify
tmp = cmd(f'sudo podman exec -it {cont_name} sysctl kernel.msgmax')
Expand Down Expand Up @@ -143,6 +141,8 @@ def test_name_server(self):
self.cli_set(base_path + ['network', net_name, 'no-name-server'])
self.cli_commit()

self.assertTrue(self.is_running(cont_name))

n = cmd_to_json(f'sudo podman inspect {cont_name}')
self.assertEqual(n['HostConfig']['Dns'][0], name_server)

Expand All @@ -158,12 +158,7 @@ def test_cpu_limit(self):

self.cli_commit()

pid = 0
with open(PROCESS_PIDFILE.format(cont_name), 'r') as f:
pid = int(f.read())

# Check for running process
self.assertEqual(process_named_running(PROCESS_NAME), pid)
self.assertTrue(self.is_running(cont_name))

def test_ipv4_network(self):
prefix = '192.0.2.0/24'
Expand Down
7 changes: 2 additions & 5 deletions smoketest/scripts/cli/test_interfaces_bridge.py
Original file line number Diff line number Diff line change
Expand Up @@ -515,19 +515,16 @@ def test_bridge_root_bpdu_guard(self):
self.cli_set(['interfaces', 'bridge', 'br0', 'member', 'interface', 'eth0', 'root-guard'])
with self.assertRaises(ConfigSessionError):
self.cli_commit()
self.cli_discard()

# Test if bpdu_guard configured
self.cli_set(['interfaces', 'bridge', 'br0', 'stp'])
self.cli_set(['interfaces', 'bridge', 'br0', 'member', 'interface', 'eth0', 'bpdu-guard'])
self.cli_delete(['interfaces', 'bridge', 'br0', 'member', 'interface', 'eth0', 'root-guard'])
self.cli_commit()

tmp = read_file(f'/sys/class/net/eth0/brport/bpdu_guard')
self.assertEqual(tmp, '1')

# Test if root_guard configured
self.cli_delete(['interfaces', 'bridge', 'br0'])
self.cli_set(['interfaces', 'bridge', 'br0', 'stp'])
self.cli_delete(['interfaces', 'bridge', 'br0', 'member', 'interface', 'eth0', 'bpdu-guard'])
self.cli_set(['interfaces', 'bridge', 'br0', 'member', 'interface', 'eth0', 'root-guard'])
self.cli_commit()

Expand Down
24 changes: 15 additions & 9 deletions smoketest/scripts/cli/test_interfaces_pppoe.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.

import unittest
import psutil

from psutil import process_iter
from base_vyostest_shim import VyOSUnitTestSHIM

from vyos.configsession import ConfigSessionError
Expand Down Expand Up @@ -48,10 +48,13 @@ def tearDown(self):
# Validate PPPoE client process
for interface in self._interfaces:
running = False
for proc in process_iter():
if interface in proc.cmdline():
running = True
break
for proc in psutil.process_iter():
try:
if interface in proc.cmdline():
running = True
break
except psutil.ZombieProcess:
pass
self.assertTrue(running)

self.cli_delete(base_path)
Expand Down Expand Up @@ -110,10 +113,13 @@ def test_pppoe_client_disabled_interface(self):
# Validate PPPoE client process - must not run as interfaces are disabled
for interface in self._interfaces:
running = False
for proc in process_iter():
if interface in proc.cmdline():
running = True
break
for proc in psutil.process_iter():
try:
if interface in proc.cmdline():
running = True
break
except psutil.ZombieProcess:
pass
self.assertFalse(running)

# enable PPPoE interfaces
Expand Down
Loading
Loading