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 251e7c0d..bea521d2 100644 --- a/tests/integration/targets/vyos_config/tests/cli/check_config.yaml +++ b/tests/integration/targets/vyos_config/tests/cli/check_config.yaml @@ -1,109 +1,166 @@ --- - 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: setup- ensure test login accounts are not present vyos.vyos.vyos_config: lines: - delete system login user testesa - delete system login user testadmin - delete system login user testjohn match: none +# - 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' + +# - assert: +# that: +# - result.filtered|length == 2 + +# - 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' + +# - assert: +# that: +# - result.filtered|length == 3 + +# - 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 '$6$llOWht9DOol0aAwg$RAgpwGh5h/7vRaijwc5wtGpDqLEUFbrOZ/qwBcfiuwx0st43/1cnFMfbNA3YjedmJ4XPO5hA/1.h5cWHcsCVQ1' +# - set system login user testadmin full-name 'Test admin' +# - set system login user testadmin authentication encrypted-password '$6$yK6mHEsH2JNjw.zd$Y1S0jm1Q0HDuCyMb2le8NlzrpXCylkCI/wSwgMCJ8FZW5ZczpU7UnjtkyFDA0aBdEh.p0YmHYsu1CRRYzJ7MA/' +# - 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 + - 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' - assert: that: - result.filtered|length == 2 - 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' - assert: that: - result.filtered|length == 3 - 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 '$6$llOWht9DOol0aAwg$RAgpwGh5h/7vRaijwc5wtGpDqLEUFbrOZ/qwBcfiuwx0st43/1cnFMfbNA3YjedmJ4XPO5hA/1.h5cWHcsCVQ1' + - 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 '$6$yK6mHEsH2JNjw.zd$Y1S0jm1Q0HDuCyMb2le8NlzrpXCylkCI/wSwgMCJ8FZW5ZczpU7UnjtkyFDA0aBdEh.p0YmHYsu1CRRYzJ7MA/' + - 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 }}"