Skip to content

Commit 2879b9a

Browse files
omnom62Faten848Copilot
authored
Integration tests FDR (#416)
* clean-up for strreamlines e2e integration tests * 1.4+ fix for snmp_server * changes to integratio tests * changelog fix * fix ampty json on vyos.py get_config * fix vyos get_config * quick fix for teardwon in vyos_system test * Update plugins/module_utils/network/vyos/vyos.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * copilot recommendations incorporated * remove copilot mess --------- Co-authored-by: John Doe <johndoe@email.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
1 parent cd2f41d commit 2879b9a

File tree

6 files changed

+24
-6
lines changed

6 files changed

+24
-6
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
---
2+
trivial:
3+
- prepare_vyos_firewall - Remove IP address from eth1 for lag tests
4+
- vyos_snmp_server - add IP address for 1.4+ OS variants

plugins/module_utils/network/vyos/vyos.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,12 @@ def get_capabilities(module):
6868
def get_config(module, flags=None, format=None):
6969
flags = [] if flags is None else flags
7070
global _DEVICE_CONFIGS
71-
72-
if _DEVICE_CONFIGS != {} or module.params["match"] == "none":
71+
# If _DEVICE_CONFIGS is non-empty and module.params["match"] is "none",
72+
# return the cached device configurations. This avoids redundant calls
73+
# to the connection when no specific match criteria are provided.
74+
if _DEVICE_CONFIGS != {} and (
75+
module.params["match"] is not None and module.params["match"] == "none"
76+
):
7377
return to_text(_DEVICE_CONFIGS)
7478
else:
7579
connection = get_connection(module)

tests/integration/targets/prepare_vyos_tests/tasks/main.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
set interfaces ethernet eth0 address dhcp
66
set interfaces ethernet eth0 speed auto
77
set interfaces ethernet eth0 duplex auto
8-
set interfaces ethernet eth1 address 192.0.2.1/24
8+
set interfaces ethernet eth1
99
set interfaces ethernet eth2
1010
delete interfaces loopback lo
1111
vars:

tests/integration/targets/vyos_snmp_server/tests/cli/_populate_config.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
- name: setup
33
vyos.vyos.vyos_config:
44
lines:
5+
- set interface ethernet eth1 address 192.0.2.1/24
56
- set interface ethernet eth2 address 20.1.1.1/24
67
- set service snmp community switches authorization rw
78
- set service snmp community bridges client 1.1.1.1

tests/integration/targets/vyos_snmp_server/tests/cli/_remove_config.yaml

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,12 @@
66
ignore_errors: true
77
vars:
88
ansible_connection: ansible.netcommon.network_cli
9+
10+
- name: remove interfaces address
11+
vyos.vyos.vyos_config:
12+
lines:
13+
- delete interface ethernet eth1 address
14+
- delete interface ethernet eth2 address
15+
ignore_errors: true
16+
vars:
17+
ansible_connection: ansible.netcommon.network_cli

tests/integration/targets/vyos_system/tests/cli/basic.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,9 @@
5555
ignore_errors: true
5656
vyos.vyos.vyos_config:
5757
lines:
58-
- delete system name-server name-server 192.0.2.1
59-
- delete system name-server name-server 192.0.2.2
60-
- delete system name-server name-server 192.0.2.3
58+
- delete system name-server 192.0.2.1
59+
- delete system name-server 192.0.2.2
60+
- delete system name-server 192.0.2.3
6161
match: none
6262

6363
- debug: msg="END cli/basic.yaml on connection={{ ansible_connection }}"

0 commit comments

Comments
 (0)