From fb4efdb9252b965be5c2ceaa0c969c179cf3f7cd Mon Sep 17 00:00:00 2001 From: Yuriy Andamasov Date: Fri, 21 Aug 2026 12:26:57 +0300 Subject: T8516: add vyos_l3_interfaces unit tests; delete only L3 attributes in deleted/overridden (#458) * T8516: add unit tests for vyos_l3_interfaces module * T8516: fix copyright header to use VyOS Networks attribution Co-Authored-By: Claude Sonnet 4.6 * Changelog * Misc fixes * Misc changes * T8516: bugfixes * T8516: changelog - bugfixes added * T8516: Update changelog Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * T8516: Docstring fix Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * T8516: docstring fix Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> * T8516: restore _state_deleted docstring, align test docstring and fixture - restore the _state_deleted docstring lost in the L2-safeguard change, now documenting the address-only delete semantics - overridden test docstring said "delete interface stanzas" but the module now emits address-only deletes; align wording - quote loopback interface name in fixture for consistency with vyos_interfaces_config.cfg * T8516: drop out-of-scope config and generated-docs changes Reviewer request (gaige): top-level instruction files (.coderabbit.yaml, AGENTS.md) belong in separate PRs. Also revert unrelated generated-docs drift in vyos_config / vyos_bgp_global rst files. All four files are now identical to main. --------- Co-authored-by: Claude Sonnet 4.6 Co-authored-by: omnom62 <75066712+omnom62@users.noreply.github.com> Co-authored-by: omnom62 Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com> --- .../targets/vyos_l3_interfaces/tests/cli/deleted.yaml | 4 ++-- .../targets/vyos_l3_interfaces/vars/main.yaml | 18 ++++++++++++++++-- 2 files changed, 18 insertions(+), 4 deletions(-) (limited to 'tests/integration') diff --git a/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml b/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml index 000d55e0..3af51209 100644 --- a/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/tests/cli/deleted.yaml @@ -71,12 +71,12 @@ - name: Assert that the correct set of commands were generated (SLAAC) assert: that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" + - "{{ deleted['commands_slaac'] | symmetric_difference(result['commands']) |length == 0 }}" - name: Assert that the after dicts were correctly generated (SLAAC) assert: that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" + - "{{ deleted['after_slaac'] | symmetric_difference(result['after']) |length == 0 }}" always: - include_tasks: _remove_config.yaml diff --git a/tests/integration/targets/vyos_l3_interfaces/vars/main.yaml b/tests/integration/targets/vyos_l3_interfaces/vars/main.yaml index 84f1c637..16a3d821 100644 --- a/tests/integration/targets/vyos_l3_interfaces/vars/main.yaml +++ b/tests/integration/targets/vyos_l3_interfaces/vars/main.yaml @@ -161,8 +161,12 @@ rendered: deleted: commands: - - delete interfaces ethernet eth1 - - delete interfaces ethernet eth2 + - delete interfaces ethernet eth1 address '192.0.2.14/24' + - delete interfaces ethernet eth2 address '192.0.2.10/24' + - delete interfaces ethernet eth2 address '192.0.2.11/24' + - delete interfaces ethernet eth2 address '2001:db8::10/32' + - delete interfaces ethernet eth2 address '2001:db8::12/32' + commands_slaac: - delete interfaces ethernet eth1 ipv6 address 'autoconf' - delete interfaces ethernet eth2 vif 101 ipv6 address 'autoconf' @@ -170,6 +174,8 @@ deleted: - name: eth0 ipv4: - address: dhcp + - name: eth1 + - name: eth2 before_slaac: - name: eth0 ipv4: @@ -182,3 +188,11 @@ deleted: - vlan_id: 101 ipv6: - address: auto-config + after_slaac: + - name: eth0 + ipv4: + - address: dhcp + - name: eth1 + - name: eth2 + vifs: + - vlan_id: 101 -- cgit v1.2.3