summaryrefslogtreecommitdiff
path: root/smoketest/scripts/cli/base_interfaces_test.py
AgeCommit message (Collapse)Author
11 dayssmoketest: T9048: keep VRF and cmdline assertions on the same PIDYuriy Andamasov
Adversarial review findings on the previous head: * get_process_cmdline() could re-resolve a NEW PID after the 'ip vrf pids' membership assertion had already run against the old one, so the two assertions could validate different processes. The helper now returns the (pid, cmdline) pair it actually validated and the VRF checks moved after it, targeting the returned PID. * The one-shot retry left a residual double-race window. The helper now polls PID discovery and the /proc read together under the same PROCESS_WAIT_TIMEOUT deadline. 🤖 Generated by [robots](https://vyos.io)
11 dayssmoketest: T9048: guard the retry read in get_process_cmdline() tooYuriy Andamasov
The re-resolve path read /proc/<pid>/cmdline without defaultonfailure, so a repeated PID race raised an unhandled exception (test ERROR) instead of failing with a clear assertion message. 🤖 Generated by [robots](https://vyos.io)
11 dayssmoketest: T9048: harden DHCP client process checks against CI timing racesYuriy Andamasov
Interface smoketests fail intermittently in CI on DHCP-related assertions (test_interfaces_cli job pass rate 42-55% over the last 30 workflow runs). Three timing hazards in the interface test base class: * process_named_running() was polled with a 10 second window at all dhclient/dhcp6c call sites - too short on a loaded runner. Raise to a shared PROCESS_WAIT_TIMEOUT of 60 seconds; the poll returns as soon as the process appears, so this only delays the failure path. * /proc/<pid>/cmdline was read unguarded after PID discovery. dhclient re-executes itself while daemonizing, so the discovered PID can be gone by the time /proc is read - read_file() then raises and the test errors out instead of failing cleanly. New get_process_cmdline() helper re-resolves the PID once when the read fails. * tearDown() asserted daemon absence immediately after the config was removed, reporting daemons still in their shutdown path as leaks. Use the existing wait_for_result() shim helper with the same 60s bound to grant a grace period before declaring a leak; the poll returns on first observation of a clean state, so passing runs pay no extra wall clock. 🤖 Generated by [robots](https://vyos.io)
2026-06-16T8923: normalize "can not" to "cannot"Christian Breunig
Replace two-word "can not" / "Can not" with "cannot" across comments, ConfigError messages, CLI help text, and op-mode output. Standard SNMP MIB files under mibs/ are left unchanged.
2026-03-27T8410: Fix typos and mistakes for comments and messagesViacheslav Hletenko
Fix typos and mistakes No functional changes
2026-03-10vyos.ifconfig: T8358: clear qdiscs when deleting mirror CLI nodeChristian Breunig
When removing the mirror CLI node to stop mirroring or redirecting traffic to another interface, the egress configuration was not cleared. This caused traffic to continue being sent out the SPAN port even after the node was removed. Fix by properly clearing all tc(8) qdiscs. Update smoketests to verify nothing remains after mirror deletion.
2025-11-21smoketest: T8023: adjust base interface test for Vlan MTUsChristian Breunig
Some drivers are limited to an MTU of 1500 byte - e.g. when VyOS runs on PROXMOX with default bridge settings. We use lower values for the testcase test_vif_8021q_mtu_limits which will fit for almost every NIC, but keep the testcase logic intact.
2025-10-21T7948: always call setUp() and tearDown() base class methodsChristian Breunig
While working on task T7664 (FRR 10.4 upgrade), I identified the need for additional validation and safeguards around the FRR management daemon. The most appropriate place for this logic is in the setUp() and tearDown() methods of the smoketest base class, VyOSUnitTestSHIM. However, during implementation, it became apparent that test cases do not consistently invoke the base class's setup and teardown methods. This inconsistency complicates the process of capturing the FRR mgmtd PID at the start of a test and verifying that it remains unchanged by the end - a key step in detecting crashes or unexpected terminations (e.g., SIGSEGV) of the FRR management daemon during tests.
2025-10-16frr: T7664: remove CSTORE_GUARD_TIME from smoketestsChristian Breunig
2025-09-30smoketest: T7858: use pylint for our testcasesChristian Breunig
2025-09-13T7682: incorrect sla-len in DHCPv6 client prefix delegation (DHCPv6-PD)Christian Breunig
The current template has an overly optimistic logic for sla-len calculation, relying on an assumption that a server always provides a prefix with the exact length requested by the client. This is incorrect. According to RFC8415 and RFC7084, the prefix length in a request is only a hint for the server, which may decide to provide a different prefix size. The big issue here is that wide-dhcpv6-client uses the sla-len value from the configuration regardless of the received prefix size. This seems to be the known issue. The good news is that we have already inherited a patch from Debian to mitigate the issue [1]. It accomplishes exactly what we are doing in the configuration template, but with the advantage of using the actual prefix length from the received prefix, rather than the one configured in the configuration file. If we simply remove sla-len from the template, everything appears to function normally. Before - server sending /56 set interfaces ethernet eth1 address 'dhcpv6' set interfaces ethernet eth1 dhcpv6-options pd 1 interface eth2 address '1' set interfaces ethernet eth1 dhcpv6-options pd 1 interface eth2 sla-id '0' set interfaces ethernet eth1 dhcpv6-options pd 1 length '60' Resulted in: vyos@vyos# run show interfaces Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down Interface IP Address MAC VRF MTU S/L Description ----------- ------------------- ----------------- ------- ----- ----- ------------- eth1 fc00:0:0:1::200/128 0c:67:94:67:00:01 default 1500 u/u eth2 fc00:0:2:ff00::1/60 0c:67:94:67:00:02 default 1500 u/u Whereas IPv6 PD should always use a /64 prefix on the interface we assign a dynamic DHCPv6 prefix to. After the fix: vyos@vyos:~$ show interfaces Codes: S - State, L - Link, u - Up, D - Down, A - Admin Down Interface IP Address MAC VRF MTU S/L Description ----------- ------------------- ----------------- ------- ----- ----- ------------- eth1 fc00:0:0:1::200/128 0c:67:94:67:00:01 default 1500 u/u eth2 fc00:0:2:ff00::1/64 0c:67:94:67:00:02 default 1500 u/u If a DHCPv6 server (e.g. VyOS itself) even provides multiple PD prefixes, the right one is choosen. Assume the following server configuration: set service dhcpv6-server shared-network-name dhcpv6-1 subnet fc00:0:0:1::/64 address-range start fc00:0:0:1::100 stop 'fc00:0:0:1::200' set service dhcpv6-server shared-network-name dhcpv6-1 subnet fc00:0:0:1::/64 lease-time default '120' set service dhcpv6-server shared-network-name dhcpv6-1 subnet fc00:0:0:1::/64 prefix-delegation start fc00:0:2:: prefix-length '56' set service dhcpv6-server shared-network-name dhcpv6-1 subnet fc00:0:0:1::/64 prefix-delegation start fc00:0:2:: stop 'fc00:0:2:ff00::' set service dhcpv6-server shared-network-name dhcpv6-1 subnet fc00:0:0:1::/64 prefix-delegation start fc00:0:3:: prefix-length '60' set service dhcpv6-server shared-network-name dhcpv6-1 subnet fc00:0:0:1::/64 prefix-delegation start fc00:0:3:: stop 'fc00:0:3:ff00::' If a /56 is requested ("dhcpv6-options pd 1 length 56") - we will get a per interface /64 from the original /56 prefix-delegation from the DHCPv6 server. If the user suddently requests a /60 ("dhcpv6-options pd 1 length 60") the delegated prefix will be from the above fc00:0:3:: pool. 1: https://salsa.debian.org/debian/wide-dhcpv6/-/blob/debian/20080615-23/debian/patches/0021-Make-sla-len-config-optional.patch
2025-06-28T7591: remove copyright years from source filesChristian Breunig
The legal team says years are not necessary so we can go ahead with it, since it will simplify backporting. Automatically removed using: git ls-files | grep -v libvyosconfig | xargs sed -i -E \ 's/^# Copyright (19|20)[0-9]{2}(-[0-9]{4})? VyOS maintainers.*/# Copyright VyOS maintainers and contributors <maintainers@vyos.io>/g' In addition we will error-out during "make" if someone re-adds a legacy copyright notice
2025-04-18interface: T4627: support IPv6 Interface Identifier (token) for SLAACYoshiaki Suyama
Add common IPv6 CLI option (use ethernet as example): set interfaces ethernet eth0 ipv6 address interface-identifier Co-authored-by: Christian Breunig <christian@breunig.cc>
2025-04-06smoketest: T7325: add common "unsupported on interface family" constantChristian Breunig
2025-03-29virtual-ethernet: T7293: add support to define interface MTUChristian Breunig
2025-03-15smoketest: T7248: ensure there is no Yacc/Bison error in wide-dhcpv6-clientChristian Breunig
T7050 revealed an issue in the CI system where VyOS CLI was rendering a configuration for wide-dhcpv6-client that was not working due to a missing patch of the wide-dhcpv6-client source code. This can be prevented by checking the daemon logs after startup for any config linguistic (Yacc/Bison) issues.
2025-03-15smoketest: T7248: use python f'ormat string in test_dhcpv6_client_optionsChristian Breunig
2025-02-05vyos.ifconfig: T7135: only restart DHCPv6 client if neededChristian Breunig
Previously the DHCPv6 client was restarted on any change to the interface, including changes only to the interface description. Re-use pattern from IPv4 DHCP to only restart the DHCP client if necessary.
2025-02-05vyos.ifconfig: T5103: force dhclient restart on VRF changeChristian Breunig
Moving an interface in, out or between VRFs will not re-install the received default route. This is because the dhclient binary is not restarted in the new VRF. Dhclient itself will report an error like: "receive_packet failed on eth0.10: Network is down". Take the return value of vyos.ifconfig.Interface().set_vrf() into account to forcefully restart the DHCP client process and optain a proper lease.
2025-01-06configd: T6747: use one long-lived instance of FRRender (#4274)Christian Breunig
* smoketest: T6747: call wait after commit() only for FRR related tests Commit 702a60a8de28 ("smoketest: T6746: wait after commit() until frr-reload is no longer running") added a guard timeout for every commit executed via CLI smoketests. This commit changes the bahavior to only add the guard timeout for FRR related testscases. This improves the overall smoketest time. * configd: T6747: use one long-lived instance of FRRender Previously there was one FRRender() instance per config session. This resulted in re-rendering the FRR configuration every time a new config session was created. Example: vyos@vyos:~$ configure vyos@vyos# set interfaces dummy dum0 description foo vyos@vyos# commit vyos@vyos# exit vyos@vyos:~$ configure vyos@vyos# set interfaces dummy dum0 description bar vyos@vyos# commit vyos@vyos# exit In the past this caused a re-render of the FRR configuration as the delta check added in commit ec80c75d6776 ("frrender: T6746: only re-render FRR config if config_dict did change") evaluated to false, as it operated on a new instance of the FRRender class. With this change there is no FRR re-render, as there is nothing to update in FRR.
2024-09-15bond: T6709: add EAPoL supportChristian Breunig
2024-09-14ethernet: T6709: move EAPoL support to common frameworkChristian Breunig
Instead of having EAPoL (Extensible Authentication Protocol over Local Area Network) support only available for ethernet interfaces, move this to common ground at vyos.ifconfig.interface making it available for all sorts of interfaces by simply including the XML portion #include <include/interface/eapol.xml.i>
2024-07-25Merge pull request #3857 from c-po/vrf-interface-part-2Christian Breunig
interface: T6592: remove interface from conntrack ct_iface_map on deletion
2024-07-24smoketest: T6592: verify no interface stalls in conntrack ct_iface_map on ↵Christian Breunig
deletion Now that interfaces are deleted from ct_iface_map during deletion it's time to also add a smoketest ensuring there is no entry in the ct_iface_map once an interface was deleted from the CLI.
2024-07-23vrf: T6602: verify supplied VRF name on all interface typesChristian Breunig
Only some (e.g. ethernet or wireguard) interfaces validate if the supplied VRF actually exists. If this is not validated, one can pass an invalid VRF to the system which generates an OSError exception. To reproduce set interfaces vxlan vxlan1 vni 1000 set interfaces vxlan vxlan1 remote 1.2.3.4 set interfaces vxlan vxlan1 vrf smoketest results in OSError: [Errno 255] failed to run command: ip link set dev vxlan1 master smoketest_mgmt This commit adds the missing verify_vrf() call to the missing interface types and an appropriate smoketest for all interfaces supporting VRF assignment.
2024-07-20interfaces: T6592: moving an interface between VRF instances failedChristian Breunig
To reproduce: set vrf name mgmt table '150' set vrf name no-mgmt table '151' set interfaces ethernet eth2 vrf 'mgmt' commit set interfaces ethernet eth2 vrf no-mgmt commit This resulted in an error while interacting with nftables: [Errno 1] failed to run command: nft add element inet vrf_zones ct_iface_map { "eth2" : 151 } The reason is that the old mapping entry still exists and was not removed. This commit adds a new utility function get_vrf_tableid() and compares the current and new VRF table IDs assigned to an interface. If the IDs do not match, the nftables ct_iface_map entry is removed before the new entry is added.
2024-04-06ethernet: T5862: default MTU is not acceptable in some environmentsChristian Breunig
There are cloud environments available where the maximum supported ethernet MTU is e.g. 1450 bytes, thus we clamp this to the adapters maximum MTU value or 1500 bytes - whatever is lower.
2024-04-03T6199: drop unused Python importsChristian Breunig
found using "git ls-files *.py | xargs pylint | grep W0611"
2024-03-10xml: T5738: lower maximum description to 255 charactersChristian Breunig
e.g. Linux Kernel only supports 255 and not 256 characters for the ifalias field.
2024-01-07smoketest: T5195: fix BasicInterfaceTest tearDown() timeout penaltyChristian Breunig
Commit ad9bdfc24 ("T5195: add timeout argument to process_named_running()") added a 2*10 seconds penalty for every interface test (dhcp and dhcpv6). This leads to long runs of "make test" after an ISO build. There is no need to wait 10 seconds for a test that checks for a process not running. The timeout is there to give the process some time to startup.
2024-01-06T5195: add timeout argument to process_named_running()Christian Breunig
Smoketests heavily rely on process_named_running() so in order to "relax" system constraints during a test we will add a timeout of 10 seconds for every testcase provided by base_interfaces_test.py
2023-11-22vxlan: T5759: change default MTU from 1450 -> 1500 bytesChristian Breunig
Found an odd behavior on Linux and the VyOS CLI implementation. If adding VXLAN interfaces using iproute2 the MTU differs depending on the creation syntax: ip -4 link add vxlan100 type vxlan dstport 4789 external df unset tos inherit \ ttl 16 nolearning vnifilter local 172.16.33.201 ip -4 link add vxlan200 type vxlan id 200 dstport 4789 local 172.16.33.201 dev eth0 ip -6 link add vxlan300 type vxlan id 300 dstport 4789 local 2001:db8:1::1 dev eth0 132: vxlan300: <BROADCAST,MULTICAST> mtu 1430 qdisc noop state DOWN group default qlen 1000 link/ether 4e:fb:e3:f5:d9:59 brd ff:ff:ff:ff:ff:ff 133: vxlan200: <BROADCAST,MULTICAST> mtu 1450 qdisc noop state DOWN group default qlen 1000 link/ether 0e:4e:f4:76:59:3f brd ff:ff:ff:ff:ff:ff 134: vxlan100: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000 link/ether ba:b6:b7:0c:b1:37 brd ff:ff:ff:ff:ff:ff VyOS always sets a default MTU of 1450 bytes which is correct for IPv4 p2p links or multicast, but invalid for IPv6 p2p. Also this will break EVPN deployments as ethernet bridges with MTU < 1500 bytes are less fun. Increase default MTU to 1500 bytes. Migrate old configurations to use 1450 bytes if not specified otherwise on the CLI.
2023-11-19dhcp-client: T5760: add CLI option to pass user-class parameterChristian Breunig
Example: set interfaces ethernet eth0 dhcp-options user-class VyOS or set interfaces ethernet eth0 dhcp-options user-class 56:79:4f:53
2023-11-19dhcp-client: T5760: add constraints for dhclient string optionsChristian Breunig
The string data type specifies either an NVT ASCII string enclosed in double quotes, or a series of octets specified in hexadecimal, separated by colons. For example: set interfaces ethernet eth0 dhcp-options client-id CLIENT-FOO or set interfaces ethernet eth0 dhcp-options client-id 43:4c:49:45:54:2d:46:4f:4f As of now there was no input validation performed.
2023-11-13pim: T5733: add missing FRR PIM related featuresChristian Breunig
Migrate CLI configuration retrival to common get_config_dict(). In addition add new functionality to VyOS that is PIM related and already available in FRR.
2023-09-05interface: T5550: Interface source-validation priority over global valuesarthurdev
- Migrate IPv4 source-validation to nftables - Interface source-validation value takes priority, fallback to global value
2023-08-25interface: T3509: Add per-interface IPv6 source validationsarthurdev
2023-08-11ipv6: T5464: add support for per-interface dad (duplicate address detection) ↵Christian Breunig
setting
2023-08-07smoketest: remove duplicate CLI option for base interface testChristian Breunig
2023-08-06smoketest: T5428: check for process running in designated VRFChristian Breunig
Start IPv4/IPv6 DHCP clients on an interface bound to a given VRF. Verify that the client process runs in the VRF context.
2023-08-06T5195: move helpers from vyos.validate to vyos.utils packageChristian Breunig
2023-08-05smoketest: T5428: remove hardcoded dhcp6c config pathsChristian Breunig
2023-07-31smoketest: interfaces: T5387: test dhcpv6-pd no-release flag1vivy
2023-07-14T5195: vyos.util -> vyos.utils package refactoring (#2093)Christian Breunig
* T5195: move run, cmd, call, rc_cmd helper to vyos.utils.process * T5195: use read_file and write_file implementation from vyos.utils.file Changed code automatically using: find . -type f -not -path '*/\.*' -exec sed -i 's/^from vyos.util import read_file$/from vyos.utils.file import read_file/g' {} + find . -type f -not -path '*/\.*' -exec sed -i 's/^from vyos.util import write_file$/from vyos.utils.file import write_file/g' {} + * T5195: move chmod* helpers to vyos.utils.permission * T5195: use colon_separated_to_dict from vyos.utils.dict * T5195: move is_systemd_service_* to vyos.utils.process * T5195: fix boot issues with missing imports * T5195: move dict_search_* helpers to vyos.utils.dict * T5195: move network helpers to vyos.utils.network * T5195: move commit_* helpers to vyos.utils.commit * T5195: move user I/O helpers to vyos.utils.io
2023-05-29smoketest: T5242: fix precondition check for VLAN MTU testcaseChristian Breunig
2023-05-28smoketest: T5242: improve base class test cases for virtual-ethernet interfacesChristian Breunig
2023-05-27smoketest: T5242: automatically detect interface "capabilities"Christian Breunig
Current state of vyos-1x smoketests have hardcoded features to test. The feature support is inside the base class BasicInterfaceTest class BasicInterfaceTest: class TestCase(VyOSUnitTestSHIM.TestCase): _test_dhcp = False _test_ip = False _test_mtu = False _test_vlan = False _test_qinq = False _test_ipv6 = False _test_ipv6_pd = False _test_ipv6_dhcpc6 = False _test_mirror = False All derived classes need to enable the tests that are supported on this interface type. Adding new feature to a given interface (like vif support in T5237) require manually enabling those tests for the given interface. It would make much more sense, if we can query the config backend for supported interface options - or in other words - is there a CLI node available that corresponds to set interfaces ethernet <name> vif - if that's the case, _test_vlan = True.
2023-05-26T5242: example use of cli_definedJohn Estabrook
2023-02-12T5001: Replace links to the phabricator siteChristian Breunig
Replace links to the phabricator site from https://phabricator.vyos.net to https://vyos.dev
2022-07-09ip: T4517: add option to enable directed broadcast forwardingYuxiang Zhu
Directed broadcast is described in rfc1812#section-5.3.5.2 and rfc2644. By default Linux kernel doesn't forward directed broadcast packets unless both of `/proc/sys/net/ipv4/conf/all/bc_forwarding` and `/proc/sys/net/ipv4/conf/$iface/bc_forwarding` are set to 1.