diff options
Diffstat (limited to 'test/integration/targets/junos_config')
18 files changed, 0 insertions, 721 deletions
diff --git a/test/integration/targets/junos_config/defaults/main.yaml b/test/integration/targets/junos_config/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/junos_config/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/junos_config/meta/main.yml b/test/integration/targets/junos_config/meta/main.yml deleted file mode 100644 index 191a0f2ea1..0000000000 --- a/test/integration/targets/junos_config/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_junos_tests diff --git a/test/integration/targets/junos_config/tasks/cli_config.yaml b/test/integration/targets/junos_config/tasks/cli_config.yaml deleted file mode 100644 index a12f077120..0000000000 --- a/test/integration/targets/junos_config/tasks/cli_config.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli_config" - patterns: "{{ testcase }}.yaml" - register: test_cases - delegate_to: localhost - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test case (connection=network_cli) - include: "{{ test_case_to_run }} ansible_connection=network_cli" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/junos_config/tasks/main.yaml b/test/integration/targets/junos_config/tasks/main.yaml deleted file mode 100644 index 31f5504714..0000000000 --- a/test/integration/targets/junos_config/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: netconf.yaml, tags: ['netconf'] } -- { include: cli_config.yaml, tags: ['cli_config'] } diff --git a/test/integration/targets/junos_config/tasks/netconf.yaml b/test/integration/targets/junos_config/tasks/netconf.yaml deleted file mode 100644 index 59ef55adcd..0000000000 --- a/test/integration/targets/junos_config/tasks/netconf.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -- name: collect netconf test cases - find: - paths: "{{ role_path }}/tests/netconf" - patterns: "{{ testcase }}.yaml" - connection: local - register: test_cases - -- name: set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - -- name: run test case (connection=netconf) - include: "{{ test_case_to_run }} ansible_connection=netconf" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/junos_config/templates/basic/config.j2 b/test/integration/targets/junos_config/templates/basic/config.j2 deleted file mode 100644 index 5301504220..0000000000 --- a/test/integration/targets/junos_config/templates/basic/config.j2 +++ /dev/null @@ -1,10 +0,0 @@ -interfaces { - lo0 { - unit 0 { - family inet { - address 192.0.2.1/32; - } - } - } -} - diff --git a/test/integration/targets/junos_config/templates/basic/config.set b/test/integration/targets/junos_config/templates/basic/config.set deleted file mode 100644 index df436bba95..0000000000 --- a/test/integration/targets/junos_config/templates/basic/config.set +++ /dev/null @@ -1 +0,0 @@ -set interfaces lo0 unit 0 family inet address 192.0.2.1/32 diff --git a/test/integration/targets/junos_config/templates/basic/config.xml b/test/integration/targets/junos_config/templates/basic/config.xml deleted file mode 100644 index a120d4bc4b..0000000000 --- a/test/integration/targets/junos_config/templates/basic/config.xml +++ /dev/null @@ -1,15 +0,0 @@ -<interfaces> - <interface> - <name>lo0</name> - <unit> - <name>0</name> - <family> - <inet> - <address> - <name>192.0.2.1/32</name> - </address> - </inet> - </family> - </unit> - </interface> -</interfaces> diff --git a/test/integration/targets/junos_config/tests/cli_config/cli_backup.yaml b/test/integration/targets/junos_config/tests/cli_config/cli_backup.yaml deleted file mode 100644 index 1d43ba8198..0000000000 --- a/test/integration/targets/junos_config/tests/cli_config/cli_backup.yaml +++ /dev/null @@ -1,109 +0,0 @@ -- debug: msg="END cli_config/backup.yaml on connection={{ ansible_connection }}" - -- name: delete configurable backup file path - file: - path: "{{ item }}" - state: absent - with_items: - - "{{ role_path }}/backup_test_dir/" - - "{{ role_path }}/backup/backup.cfg" - -- name: collect any backup files - find: - paths: "{{ role_path }}/backup" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_files - connection: local - -- name: delete backup files - file: - path: "{{ item.path }}" - state: absent - with_items: "{{backup_files.files|default([])}}" - -- name: take config backup - cli_config: - backup: yes - register: result - -- assert: - that: - - "result.changed == true" - -- name: collect any backup files - find: - paths: "{{ role_path }}/backup" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_files - connection: local - -- assert: - that: - - "backup_files.files is defined" - -- name: take configuration backup in custom filename and directory path - cli_config: - backup: yes - backup_options: - filename: backup.cfg - dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-1 exist - find: - paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup.cfg" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- name: take configuration backup in custom filename - cli_config: - backup: yes - backup_options: - filename: backup.cfg - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-2 exist - find: - paths: "{{ role_path }}/backup/backup.cfg" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- name: take configuration backup in custom path and default filename - cli_config: - backup: yes - backup_options: - dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-3 exist - find: - paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- debug: msg="END cli_config/backup.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/junos_config/tests/cli_config/cli_basic.yaml b/test/integration/targets/junos_config/tests/cli_config/cli_basic.yaml deleted file mode 100644 index 1aa64b6812..0000000000 --- a/test/integration/targets/junos_config/tests/cli_config/cli_basic.yaml +++ /dev/null @@ -1,61 +0,0 @@ ---- -- debug: msg="START cli_config/cli_basic.yaml on connection={{ ansible_connection }}" - -- name: setup - cli_config: &rm1 - config: delete interfaces ge-0/0/1 - -- name: setup - cli_config: &rm2 - config: delete interfaces ge-0/0/2 - -- name: configure device with config - cli_config: &conf1 - config: set interfaces ge-0/0/1 description 'test-interface' - register: result - -- assert: - that: - - "result.changed == true" - -- name: Idempotence - cli_config: *conf1 - register: result - -- assert: - that: - - "result.changed == false" - -- name: configure device with config - cli_config: &conf2 - config: set interfaces ge-0/0/2 description 'test-interface' - register: result - -- name: test rollabck - cli_config: - rollback: 1 - register: result - -- assert: - that: - - "result.changed == true" - - "'ge-0/0/2' in result.diff.prepared" - -- name: remove root-authethication (test error scenario) - cli_config: - config: "delete system root-authentication" - ignore_errors: True - register: result - -- assert: - that: - - "result.failed == true" - - "'Missing mandatory statement' in result.msg" - -- name: teardown - cli_config: *rm1 - -- name: teardown - cli_config: *rm2 - -- debug: msg="END cli_config/cli_basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/junos_config/tests/cli_config/cli_replace.yaml b/test/integration/targets/junos_config/tests/cli_config/cli_replace.yaml deleted file mode 100644 index d395804650..0000000000 --- a/test/integration/targets/junos_config/tests/cli_config/cli_replace.yaml +++ /dev/null @@ -1,60 +0,0 @@ ---- -- debug: msg="START cli_config/cli_replace.yaml on connection={{ ansible_connection }}" - -- name: set interface config - cli_config: - config: "{{ item }}" - loop: - - "delete interfaces ge-0/0/11" - - set interfaces ge-0/0/11 description "test cli_config" - -- name: get running configuration - cli_command: - command: show configuration - register: result - -- name: copy configuration to file - copy: - content: "{{ result['stdout'] }}" - dest: /tmp/junos01.cfg - -- name: "modify interface ge-0/0/11 configuration" - replace: - path: /tmp/junos01.cfg - regexp: 'test cli_config' - replace: 'test cli_config replaced' - -- name: copy config file to remote host - net_put: - src: /tmp/junos01.cfg - dest: /var/home/{{ ansible_user }}/junos01.cfg - -- name: replace syslog test file configuration - cli_config: - replace: "/var/home/{{ ansible_user }}/junos01.cfg" - -- name: get interface configuration - cli_command: - command: show configuration interfaces ge-0/0/11 - register: result - -- name: assert that interface config change is reflected on device - assert: - that: - - "'test cli_config replaced' in result.stdout" - -- name: replace interface configuration (idempotent) - cli_config: - replace: "/var/home/{{ ansible_user }}/junos01.cfg" - register: result - -- name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - -- name: delete interface config - cli_config: - config: "delete interfaces ge-0/0/11" - -- debug: msg="END cli_config/cli_replace.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/junos_config/tests/netconf/backup.yaml b/test/integration/targets/junos_config/tests/netconf/backup.yaml deleted file mode 100644 index a0d6bf9efe..0000000000 --- a/test/integration/targets/junos_config/tests/netconf/backup.yaml +++ /dev/null @@ -1,121 +0,0 @@ ---- -- debug: msg="START netconf/backup.yaml on connection={{ ansible_connection }}" - -- name: setup - junos_config: - lines: - - set system host-name {{ inventory_hostname_short }} - - delete interfaces lo0 - provider: "{{ netconf }}" - -- name: collect any backup files - find: - paths: "{{ role_path }}/backup" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_files - connection: local - -- name: delete backup files - file: - path: "{{ item.path }}" - state: absent - connection: local - with_items: "{{backup_files.files|default([])}}" - -- name: configure device with config - junos_config: - src: basic/config.j2 - backup: yes - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == true" - - "result.updates is not defined" - -- name: collect any backup files - find: - paths: "{{ role_path }}/backup" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_files - connection: local - -- assert: - that: - - "backup_files.files is defined" - -- name: delete configurable backup file path - file: - path: "{{ item }}" - state: absent - with_items: - - "{{ role_path }}/backup_test_dir/" - - "{{ role_path }}/backup/backup.cfg" - -- name: take configuration backup in custom filename and directory path - junos_config: - backup: yes - backup_options: - filename: backup.cfg - dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-1 exist - find: - paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}/backup.cfg" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- name: take configuration backup in custom filename - junos_config: - backup: yes - backup_options: - filename: backup.cfg - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-2 exist - find: - paths: "{{ role_path }}/backup/backup.cfg" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- name: take configuration backup in custom path and default filename - junos_config: - backup: yes - backup_options: - dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: check if the backup file-3 exist - find: - paths: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - pattern: "{{ inventory_hostname_short }}_config*" - register: backup_file - connection: local - -- assert: - that: - - "backup_file.files is defined" - -- debug: msg="END netconf/backup.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/junos_config/tests/netconf/bad_action.yaml b/test/integration/targets/junos_config/tests/netconf/bad_action.yaml deleted file mode 100644 index 9012f3c846..0000000000 --- a/test/integration/targets/junos_config/tests/netconf/bad_action.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- debug: msg="START netconf/bad_action.yaml on connection={{ ansible_connection }}" - -- name: configure single bad_action command - junos_config: - lines: - - 'invalid system foo' - provider: "{{ netconf }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - -- debug: msg="END netconf/bad_action.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/junos_config/tests/netconf/invalid.yaml b/test/integration/targets/junos_config/tests/netconf/invalid.yaml deleted file mode 100644 index 26a2346422..0000000000 --- a/test/integration/targets/junos_config/tests/netconf/invalid.yaml +++ /dev/null @@ -1,29 +0,0 @@ ---- -- debug: msg="START netconf/invalid.yaml on connection={{ ansible_connection }}" - -- name: configure single invalid command - junos_config: - lines: - - 'set system foo' - provider: "{{ netconf }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - -- name: configure multiple invalid command - junos_config: - lines: - - 'set system host-name {{ inventory_hostname_short }}' - - 'set system foo' - provider: "{{ netconf }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - -- debug: msg="END netconf/invalid.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/junos_config/tests/netconf/multiple.yaml b/test/integration/targets/junos_config/tests/netconf/multiple.yaml deleted file mode 100644 index 1b59e580c3..0000000000 --- a/test/integration/targets/junos_config/tests/netconf/multiple.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- debug: msg="START netconf/multiple.yaml on connection={{ ansible_connection }}" - -- name: setup - junos_config: - lines: - - "set system host-name {{ inventory_hostname_short }}" - - "delete interfaces lo0" - provider: "{{ netconf }}" - register: test - -- name: configure multiple commands - junos_config: - lines: - - 'set system host-name {{ inventory_hostname_short }}' - - 'set interfaces lo0 unit 0 family inet address 192.0.2.1/32' - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == true" - # Ensure host-name *hasn't* been updated - - "'host-name;' not in result.diff.prepared" - # Ensure interface has *been* updated - - "'address 192.0.2.1/32' in result.diff.prepared" - -- name: check multiple commands idempotent - junos_config: - lines: - - 'set system host-name {{ inventory_hostname_short }}' - - 'set interfaces lo0 unit 0 family inet address 192.0.2.1/32' - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.diff is not defined" - -- name: teardown - junos_config: - lines: - - "set system host-name {{ inventory_hostname_short }}" - - "delete interfaces lo0" - provider: "{{ netconf }}" - register: test - -- debug: msg="END netconf/multiple.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/junos_config/tests/netconf/single.yaml b/test/integration/targets/junos_config/tests/netconf/single.yaml deleted file mode 100644 index 70eccfe372..0000000000 --- a/test/integration/targets/junos_config/tests/netconf/single.yaml +++ /dev/null @@ -1,82 +0,0 @@ ---- -- debug: msg="START netconf/single.yaml on connection={{ ansible_connection }}" - -# Ensure that when we change the hostname to `localhost` we cause a change -- name: setup - junos_config: - lines: - - set system host-name {{ inventory_hostname_short }} - provider: "{{ netconf }}" - -- name: configure single command - junos_config: - lines: - - set system host-name localhost - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == true" - - "'+ host-name localhost;' in result.diff.prepared" - -- name: check single command idempotent - junos_config: - lines: - - set system host-name localhost - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == false" - -- name: confirm previous commit - junos_config: - confirm_commit: yes - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: teardown for rollback test - junos_config: - lines: - - delete system syslog file test1 - provider: "{{ netconf }}" - -- name: Configure syslog file - junos_config: - lines: - - set system syslog file test1 any any - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == true" - - result.diff.prepared is search("\+ *file test1") - - result.diff.prepared is search("\+ *any any") - -- name: Rollback junos config - junos_config: - rollback: 1 - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == true" - - result.diff.prepared is search("\+ *file test1") - - result.diff.prepared is search("\+ *any any") - -- name: teardown - junos_config: - lines: - - set system host-name {{ inventory_hostname_short }} - provider: "{{ netconf }}" - - -- debug: msg="END netconf/single.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/junos_config/tests/netconf/src_basic.yaml b/test/integration/targets/junos_config/tests/netconf/src_basic.yaml deleted file mode 100644 index 59a80890b6..0000000000 --- a/test/integration/targets/junos_config/tests/netconf/src_basic.yaml +++ /dev/null @@ -1,104 +0,0 @@ ---- -- debug: msg="START netconf/src_basic.yaml on connection={{ ansible_connection }}" - -- name: setup - junos_config: - lines: - - set system host-name {{ inventory_hostname_short }} - - delete interfaces lo0 - provider: "{{ netconf }}" - -- name: configure device with text config - junos_config: - src: basic/config.j2 - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: check device with config - junos_config: - src: basic/config.j2 - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - junos_config: - lines: - - delete interfaces lo0 - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: configure device with set config - junos_config: - src: basic/config.set - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == true" - - "'address 192.0.2.1/32' in result.diff.prepared" - -- name: check device with config - junos_config: - src: basic/config.set - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - junos_config: - lines: - - delete interfaces lo0 - provider: "{{ netconf }}" - register: result -- assert: - that: - - "result.changed == true" - -- name: configure device with xml config - junos_config: - src: basic/config.xml - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == true" - - "'address 192.0.2.1/32' in result.diff.prepared" - -- name: check device with config - junos_config: - src: basic/config.xml - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - junos_config: - lines: - - delete interfaces lo0 - provider: "{{ netconf }}" - register: result -- assert: - that: - - "result.changed == true" - -- debug: msg="END netconf/src_basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/junos_config/tests/netconf/src_invalid.yaml b/test/integration/targets/junos_config/tests/netconf/src_invalid.yaml deleted file mode 100644 index f3ae2270ff..0000000000 --- a/test/integration/targets/junos_config/tests/netconf/src_invalid.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- debug: msg="START netconf/src_invalid.yaml on connection={{ ansible_connection }}" - - -# Defend https://github.com/ansible/ansible-modules-core/issues/4797 -- name: configure with invalid src - junos_config: - src: basic/foobar.j2 - provider: "{{ netconf }}" - register: result - ignore_errors: yes - -- assert: - that: - - "result.changed == false" - - "result.failed == true" - - "result.msg == 'path specified in src not found'" - -- debug: msg="END netconf/src_invalid.yaml on connection={{ ansible_connection }}" |