Page Menu
Home
VyOS Platform
Search
Configure Global Search
Log In
Files
F117521369
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Flag For Later
Award Token
Size
7 KB
Referenced Files
None
Subscribers
None
View Options
diff --git a/changelogs/fragments/t9053_vyos_module_bugfix.yml b/changelogs/fragments/t9053_vyos_module_bugfix.yml
new file mode 100644
index 00000000..b8d0a3d9
--- /dev/null
+++ b/changelogs/fragments/t9053_vyos_module_bugfix.yml
@@ -0,0 +1,3 @@
+---
+bugfixes:
+ - vyos_config.py - Fixing test case
diff --git a/tests/integration/targets/vyos_config/tests/cli/check_config.yaml b/tests/integration/targets/vyos_config/tests/cli/check_config.yaml
index 83a62197..57317754 100644
--- a/tests/integration/targets/vyos_config/tests/cli/check_config.yaml
+++ b/tests/integration/targets/vyos_config/tests/cli/check_config.yaml
@@ -1,91 +1,109 @@
---
- debug: msg="START cli/config_check.yaml on connection={{ ansible_connection }}"
- name: setup- ensure interface is not present
vyos.vyos.vyos_config:
lines: delete interfaces loopback lo
- name: setup- create interface
register: result
vyos.vyos.vyos_config:
lines:
- interfaces
- interfaces loopback lo
- interfaces loopback lo description test
- name: Check that multiple duplicate lines collapse into a single commands
assert:
that:
- result.commands|length == 1
- name: Check that set is correctly prepended
assert:
that:
- result.commands[0] == 'set interfaces loopback lo description test'
- name: configure config_check config command
register: result
vyos.vyos.vyos_config:
lines: delete interfaces loopback lo
- assert:
that:
- result.changed == true
- name: check config_check config command idempontent
register: result
vyos.vyos.vyos_config:
lines: delete interfaces loopback lo
- assert:
that:
- result.changed == false
-- name: check multiple line config filter is working
- register: result
+- name: setup- ensure test login accounts are not present
vyos.vyos.vyos_config:
lines:
- - set system login user esa full-name 'ESA admin'
- - set system login user esa authentication encrypted-password '!abc!'
- - set system login user vyos full-name 'VyOS admin'
- - set system login user vyos authentication encrypted-password 'abc'
- - set system login user john full-name 'John'
- - set system login user john authentication plaintext-password 'xyz'
+ - delete system login user testesa
+ - delete system login user testadmin
+ - delete system login user testjohn
+ match: none
-- assert:
- that:
- - result.filtered|length == 2
+- block:
+ - name: check multiple line config filter is working
+ register: result
+ vyos.vyos.vyos_config:
+ lines:
+ - set system login user testesa full-name 'ESA admin'
+ - set system login user testesa authentication encrypted-password '!abc!'
+ - set system login user testadmin full-name 'Test admin'
+ - set system login user testadmin authentication encrypted-password 'abc'
+ - set system login user testjohn full-name 'John'
+ - set system login user testjohn authentication plaintext-password 'xyz'
-- name: check multiple line config filter is working
- register: result
- vyos.vyos.vyos_config:
- allow_password_change: none
- lines:
- - set system login user esa full-name 'ESA admin'
- - set system login user esa authentication encrypted-password '!abc!'
- - set system login user vyos full-name 'VyOS admin'
- - set system login user vyos authentication encrypted-password 'abc'
- - set system login user john full-name 'John'
- - set system login user john authentication plaintext-password 'xyz'
+ - assert:
+ that:
+ - result.filtered|length == 2
-- assert:
- that:
- - result.filtered|length == 3
+ - name: check multiple line config filter is working
+ register: result
+ vyos.vyos.vyos_config:
+ allow_password_change: none
+ lines:
+ - set system login user testesa full-name 'ESA admin'
+ - set system login user testesa authentication encrypted-password '!abc!'
+ - set system login user testadmin full-name 'Test admin'
+ - set system login user testadmin authentication encrypted-password 'abc'
+ - set system login user testjohn full-name 'John'
+ - set system login user testjohn authentication plaintext-password 'xyz'
-- name: check multiple line config filter is working
- register: result
- vyos.vyos.vyos_config:
- allow_password_change: all
- lines:
- - set system login user esa full-name 'ESA admin'
- - set system login user esa authentication encrypted-password '!abc!'
- - set system login user vyos full-name 'VyOS admin'
- - set system login user vyos authentication encrypted-password 'abc'
- - set system login user john full-name 'John'
- - set system login user john authentication plaintext-password 'xyz'
+ - assert:
+ that:
+ - result.filtered|length == 3
-- assert:
- that:
- - result.filtered|length == 0
+ - name: check multiple line config filter is working
+ register: result
+ vyos.vyos.vyos_config:
+ allow_password_change: all
+ lines:
+ - set system login user testesa full-name 'ESA admin'
+ - set system login user testesa authentication encrypted-password '$5$jR0jeXg3jHzSN7k3$33fO1qz3CVzsWJhxksLE7.KTIizYWGAMsd6LH9ItJmB'
+ - set system login user testadmin full-name 'Test admin'
+ - set system login user testadmin authentication encrypted-password '$5$YVhfNdmQbKQpDROb$N1b2nKh69wvrtQu7JwiIp/IsWlLHU8QCDcNGVaRWh6.'
+ - set system login user testjohn full-name 'John'
+ - set system login user testjohn authentication plaintext-password 'xyz'
+
+ - assert:
+ that:
+ - result.filtered|length == 0
+
+ always:
+ - name: cleanup test login accounts created by password filter checks
+ vyos.vyos.vyos_config:
+ lines:
+ - delete system login user testesa
+ - delete system login user testadmin
+ - delete system login user testjohn
+ match: none
- debug: msg="END cli/config_check.yaml on connection={{ ansible_connection }}"
diff --git a/tests/integration/targets/vyos_config/tests/cli/confirm.yaml b/tests/integration/targets/vyos_config/tests/cli/confirm.yaml
index 73674a17..a7a3cff4 100644
--- a/tests/integration/targets/vyos_config/tests/cli/confirm.yaml
+++ b/tests/integration/targets/vyos_config/tests/cli/confirm.yaml
@@ -1,44 +1,55 @@
---
- debug: msg="START cli/confirm.yaml on connection={{ ansible_connection }}"
- name: setup
vyos.vyos.vyos_config:
lines: set system host-name {{ inventory_hostname_short }}
match: none
- name: configure with confirm (manual)
register: result
vyos.vyos.vyos_config:
lines: set system host-name foo
comment: confirm manual test
confirm: manual
confirm_timeout: 1
- assert:
that:
- result.changed == true
- "'set system host-name foo' in result.commands"
- name: verify hostname changed to foo
register: hostname_after
vyos.vyos.vyos_command:
commands: show host name
- assert:
that:
- "'foo' in hostname_after.stdout[0]"
+- name: pause to allow confirm timeout to elapse and device to revert/reboot
+ pause:
+ seconds: 75
+
+- name: reset connection to avoid stale ssh channel after device reboot
+ meta: reset_connection
+
- name: wait until config auto-reverts (no confirmation)
register: hostname_reverted
vyos.vyos.vyos_command:
commands: show host name
retries: 18
- delay: 5
- until: inventory_hostname_short in hostname_reverted.stdout[0]
+ delay: 10
+ until: hostname_reverted is succeeded and inventory_hostname_short in hostname_reverted.stdout[0]
+ ignore_unreachable: true
+
+- name: reset connection after device reboot recovery
+ meta: reset_connection
- name: teardown
vyos.vyos.vyos_config:
lines: set system host-name {{ inventory_hostname_short }}
match: none
- debug: msg="END cli/confirm.yaml on connection={{ ansible_connection }}"
File Metadata
Details
Attached
Mime Type
text/x-diff
Expires
Sat, Sep 26, 2:53 PM (1 d, 9 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4272377
Default Alt Text
(7 KB)
Attached To
Mode
R52 VyOS Ansible Collection
Attached
Detach File
Event Timeline
Log In to Comment