diff options
Diffstat (limited to 'test')
300 files changed, 0 insertions, 13767 deletions
diff --git a/test/integration/targets/iosxr_acl_interfaces/defaults/main.yaml b/test/integration/targets/iosxr_acl_interfaces/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/iosxr_acl_interfaces/tasks/cli.yaml b/test/integration/targets/iosxr_acl_interfaces/tasks/cli.yaml deleted file mode 100644 index 337e34133b..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tasks/cli.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: Set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - delegate_to: localhost - -- name: Run test case (connection=network_cli) - include: "{{ test_case_to_run }}" - vars: - ansible_connection: network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_acl_interfaces/tasks/main.yaml b/test/integration/targets/iosxr_acl_interfaces/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/_populate.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/_populate.yaml deleted file mode 100644 index ac996f685f..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/_populate.yaml +++ /dev/null @@ -1,31 +0,0 @@ ---- -- name: Populate the device with ACLs - iosxr_config: - lines: | - ipv4 access-list acl_1 - 10 permit ipv4 any any - ipv4 access-list acl_2 - 10 permit ipv4 any any - ipv4 access-list acl_3 - 10 permit ipv4 any any - ipv6 access-list acl6_1 - 10 permit ipv6 any any - ipv6 access-list acl6_2 - 10 permit ipv6 any any - ipv6 access-list acl6_3 - 10 permit ipv6 any any - -- name: Setup ACL interfaces configuration for GigabitEthernet0/0/0/0 - iosxr_config: - lines: | - ipv4 access-group acl_1 ingress - ipv4 access-group acl_2 egress - ipv6 access-group acl6_1 ingress - ipv6 access-group acl6_2 egress - parents: interface GigabitEthernet0/0/0/0 - -- name: Setup ACL interfaces configuration for GigabitEthernet0/0/0/1 - iosxr_config: - lines: ipv4 access-group acl_1 egress - parents: interface GigabitEthernet0/0/0/1 - diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml deleted file mode 100644 index 27d1b3f395..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- name: Remove/Default Resources - cli_config: - config: "{{ lines }}" - vars: - lines: | - default interface GigabitEthernet0/0/0/0 - default interface GigabitEthernet0/0/0/1 - no ipv4 access-list acl_1 - no ipv4 access-list acl_2 - no ipv6 access-list acl6_1 - no ipv6 access-list acl6_2 - no ipv6 access-list acl6_3 - -- name: Initialize interfaces - iosxr_config: - lines: shutdown - parents: "{{ item }}" - loop: - - interface GigabitEthernet0/0/0/0 - - interface GigabitEthernet0/0/0/1 - -# To make sure our assertions are not affected by -# spill overs from previous tests -- name: Remove unwanted interfaces from config - iosxr_config: - lines: - - "no interface GigabitEthernet{{ item }}" - loop: - - 0/0/0/2 - - 0/0/0/3 - - 0/0/0/4 - - 0/0/0/5 - ignore_errors: yes diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/deleted.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index 72daf5bf89..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,85 +0,0 @@ ---- -- debug: - msg: "Start iosxr_acl_interfaces deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Delete ACL attributes of GigabitEthernet0/0/0/1 - iosxr_acl_interfaces: &deleted - config: - - name: GigabitEthernet0/0/0/1 - state: deleted - register: result - - - assert: - that: - - "'interface GigabitEthernet0/0/0/1' in result.commands" - - "'no ipv4 access-group acl_1 egress' in result.commands" - - "result.commands|length == 2" - - - name: Delete ACL attributes of GigabitEthernet0/0/0/1 (IDEMPOTENT) - iosxr_acl_interfaces: *deleted - register: result - - - assert: - that: - - "result.changed == False" - - "result.commands|length == 0" - - - name: Delete a single ACL attached to GigabitEthernet0/0/0/0 - iosxr_acl_interfaces: &deleted_1 - config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv4 - acls: - - name: acl_2 - direction: out - state: deleted - register: result - - - assert: - that: - - "'interface GigabitEthernet0/0/0/0' in result.commands" - - "'no ipv4 access-group acl_2 egress' in result.commands" - - "result.commands|length == 2" - - - name: Delete a single ACL attached to GigabitEthernet0/0/0/0 (IDEMPOTENT) - iosxr_acl_interfaces: *deleted_1 - register: result - - - assert: - that: - - "result.changed == False" - - "result.commands|length == 0" - - - name: Delete all IPv6 ACLs attached to GigabitEthernet0/0/0/0 - iosxr_acl_interfaces: &deleted_2 - config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv6 - state: deleted - register: result - - - assert: - that: - - "'interface GigabitEthernet0/0/0/0' in result.commands" - - "'no ipv6 access-group acl6_1 ingress' in result.commands" - - "'no ipv6 access-group acl6_2 egress' in result.commands" - - "result.commands|length == 3" - - - name: Delete all IPv6 ACLs attached to GigabitEthernet0/0/0/0 (IDEMPOTENT) - iosxr_acl_interfaces: *deleted_2 - register: result - - - assert: - that: - - "result.changed == False" - - "result.commands|length == 0" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/deleted_all.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/deleted_all.yaml deleted file mode 100644 index c591affb9d..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/deleted_all.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- debug: - msg: "Start iosxr_acl_interfaces deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Delete all ACL interfaces configuration from the device - iosxr_acl_interfaces: &deleted_3 - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Delete ACL attributes of all interfaces (IDEMPOTENT) - iosxr_acl_interfaces: *deleted_3 - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/empty_config.yaml deleted file mode 100644 index 3ca3fd8673..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/empty_config.yaml +++ /dev/null @@ -1,58 +0,0 @@ ---- -- debug: - msg: "START iosxr_acl_interfaces empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - iosxr_acl_interfaces: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - iosxr_acl_interfaces: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' - -- name: Overridden with empty config should give appropriate error message - iosxr_acl_interfaces: - config: - state: overridden - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state overridden' - -- name: Rendered with empty config should give appropriate error message - iosxr_acl_interfaces: - config: - state: rendered - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state rendered' - -- name: Parsed with empty config should give appropriate error message - iosxr_acl_interfaces: - running_config: - state: parsed - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of running_config parameter must not be empty for state parsed' diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/fixtures/parsed.cfg b/test/integration/targets/iosxr_acl_interfaces/tests/cli/fixtures/parsed.cfg deleted file mode 100644 index 818233602c..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/fixtures/parsed.cfg +++ /dev/null @@ -1,14 +0,0 @@ -interface MgmtEth0/0/CPU0/0 - ipv4 address dhcp -! -interface GigabitEthernet0/0/0/0 - shutdown - ipv4 access-group acl_1 ingress - ipv4 access-group acl_2 egress - ipv6 access-group acl6_1 ingress - ipv6 access-group acl6_2 egress -! -interface GigabitEthernet0/0/0/1 - shutdown - ipv4 access-group acl_1 egress -!
\ No newline at end of file diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/gathered.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/gathered.yaml deleted file mode 100644 index 8d58622e6f..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/gathered.yaml +++ /dev/null @@ -1,57 +0,0 @@ ---- -- debug: - msg: "START iosxr_acl_interfaces gathered integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- name: Populate the device with ACLs - iosxr_config: - lines: | - ipv4 access-list acl_1 - 10 permit ipv4 any any - ipv4 access-list acl_2 - 10 permit ipv4 any any - ipv6 access-list acl6_1 - 10 permit ipv6 any any - ipv6 access-list acl6_2 - 10 permit ipv6 any any - -- block: - - name: Merge the provided configuration with the existing running configuration - iosxr_acl_interfaces: &merged - config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: in - - name: acl_2 - direction: out - - afi: ipv6 - acls: - - name: acl6_1 - direction: in - - name: acl6_2 - direction: out - - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: out - state: merged - register: result - - - name: Gather ACL interfaces facts using gathered state - iosxr_acl_interfaces: - state: gathered - register: result - - - name: Assert that facts were correctly generated - assert: - that: "{{ merged['after'] | symmetric_difference(result['gathered']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/merged.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/merged.yaml deleted file mode 100644 index 240243511a..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,115 +0,0 @@ ---- -- debug: - msg: "START iosxr_acl_interfaces merged integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- name: Populate the device with ACLs - iosxr_config: - lines: | - ipv4 access-list acl_1 - 10 permit ipv4 any any - ipv4 access-list acl_2 - 10 permit ipv4 any any - ipv6 access-list acl6_1 - 10 permit ipv6 any any - ipv6 access-list acl6_2 - 10 permit ipv6 any any - -- block: - - name: Merge the provided configuration with the existing running configuration - iosxr_acl_interfaces: &merged - config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: in - - name: acl_2 - direction: out - - afi: ipv6 - acls: - - name: acl6_1 - direction: in - - name: acl6_2 - direction: out - - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: out - state: merged - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts was correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - iosxr_acl_interfaces: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Update acl_interfaces configuration using merged - iosxr_acl_interfaces: &merged_update - config: - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_2 - direction: out - - name: acl_1 - direction: in - state: merged - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['update_before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['update_commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts was correctly generated - assert: - that: - - "{{ merged['update_after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Update acl_interfaces configuration using merged (IDEMPOTENT) - iosxr_acl_interfaces: *merged_update - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/overridden.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index 55f3d8a4e0..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- debug: - msg: "START iosxr_acl_interfaces overridden integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Overridde all interface ACL configuration with provided configuration - iosxr_acl_interfaces: &overridden - config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv6 - acls: - - name: acl6_3 - direction: in - - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_2 - direction: in - - afi: ipv6 - acls: - - name: acl6_3 - direction: out - state: overridden - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Overridde all interface LACP configuration with provided configuration (IDEMPOTENT) - iosxr_acl_interfaces: *overridden - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/parsed.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/parsed.yaml deleted file mode 100644 index 56ae51eeb4..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/parsed.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- debug: - msg: "START iosxr_acl_interfaces parsed integration tests on connection={{ ansible_connection }}" - -- name: Parse externally provided ACL interfaces config to agnostic model - iosxr_acl_interfaces: - running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" - state: parsed - register: result - -- name: Assert that config was correctly parsed - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['parsed']) |length == 0 }}"
\ No newline at end of file diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/rendered.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/rendered.yaml deleted file mode 100644 index 93a0480b45..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/rendered.yaml +++ /dev/null @@ -1,35 +0,0 @@ ---- -- debug: - msg: "START iosxr_acl_interfaces rendered integration tests on connection={{ ansible_connection }}" - -- name: Render platform specific commands from task input using rendered state - iosxr_acl_interfaces: - config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: in - - name: acl_2 - direction: out - - afi: ipv6 - acls: - - name: acl6_1 - direction: in - - name: acl6_2 - direction: out - - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: out - state: rendered - register: result - -- name: Assert that correct set of commands were rendered - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['rendered']) |length == 0 }}"
\ No newline at end of file diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/replaced.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index aeaadac44d..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -- debug: - msg: "START iosxr_acl_interfaces replaced integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Replace device configurations of listed interface with provided configurations - iosxr_acl_interfaces: &replaced - config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv6 - acls: - - name: acl6_3 - direction: in - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) - iosxr_acl_interfaces: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acl_interfaces/tests/cli/rtt.yaml b/test/integration/targets/iosxr_acl_interfaces/tests/cli/rtt.yaml deleted file mode 100644 index f3cc7f44af..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/tests/cli/rtt.yaml +++ /dev/null @@ -1,102 +0,0 @@ ---- -- debug: - msg: "START iosxr_acl_interfaces round trip integration tests on connection={{ ansible_connection }}" - -- block: - - include_tasks: _remove_config.yaml - - - name: Populate the device with ACLs - iosxr_config: - lines: | - ipv4 access-list acl_1 - 10 permit ipv4 any any - ipv4 access-list acl_2 - 10 permit ipv4 any any - ipv4 access-list acl_3 - 10 permit ipv4 any any - ipv6 access-list acl6_1 - 10 permit ipv6 any any - ipv6 access-list acl6_2 - 10 permit ipv6 any any - ipv6 access-list acl6_3 - 10 permit ipv6 any any - - - name: Apply the provided configuration (base config) - iosxr_acl_interfaces: - config: - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: in - - name: acl_2 - direction: out - - - afi: ipv6 - acls: - - name: acl6_1 - direction: in - - name: acl6_2 - direction: out - - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: out - state: merged - - - name: Gather interfaces facts - iosxr_facts: - gather_subset: - - "!all" - - "!min" - gather_network_resources: - - acl_interfaces - - - name: Apply the provided configuration (config to be reverted) - iosxr_acl_interfaces: - config: - - name: GigabitEthernet0/0/0/1 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: in - - name: acl_2 - direction: out - - - afi: ipv6 - acls: - - name: acl6_1 - direction: in - - name: acl6_2 - direction: out - - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv4 - acls: - - name: acl_1 - direction: out - state: overridden - register: result - - - name: Assert that changes were applied - assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Revert back to base config using facts round trip - iosxr_acl_interfaces: - config: "{{ ansible_facts['network_resources']['acl_interfaces'] }}" - state: overridden - register: revert - - - name: Assert that config was reverted - assert: - that: "{{ merged['after'] | symmetric_difference(revert['after']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acl_interfaces/vars/main.yaml b/test/integration/targets/iosxr_acl_interfaces/vars/main.yaml deleted file mode 100644 index e793363115..0000000000 --- a/test/integration/targets/iosxr_acl_interfaces/vars/main.yaml +++ /dev/null @@ -1,205 +0,0 @@ ---- -merged: - before: - - name: MgmtEth0/0/CPU0/0 - - - name: GigabitEthernet0/0/0/0 - - - name: GigabitEthernet0/0/0/1 - - commands: - - interface GigabitEthernet0/0/0/0 - - ipv4 access-group acl_1 ingress - - ipv4 access-group acl_2 egress - - ipv6 access-group acl6_1 ingress - - ipv6 access-group acl6_2 egress - - interface GigabitEthernet0/0/0/1 - - ipv4 access-group acl_1 egress - - update_commands: - - interface GigabitEthernet0/0/0/1 - - ipv4 access-group acl_2 egress - - ipv4 access-group acl_1 ingress - - after: - - name: MgmtEth0/0/CPU0/0 - - - name: GigabitEthernet0/0/0/0 - access_groups: - - acls: - - name: acl_1 - direction: in - - name: acl_2 - direction: out - afi: ipv4 - - - acls: - - name: acl6_1 - direction: in - - name: acl6_2 - direction: out - afi: ipv6 - - - name: GigabitEthernet0/0/0/1 - access_groups: - - acls: - - name: acl_1 - direction: out - afi: ipv4 - - update_before: - - name: MgmtEth0/0/CPU0/0 - - - access_groups: - - acls: - - direction: in - name: acl_1 - - direction: out - name: acl_2 - afi: ipv4 - - - acls: - - direction: in - name: acl6_1 - - direction: out - name: acl6_2 - afi: ipv6 - name: GigabitEthernet0/0/0/0 - - - access_groups: - - acls: - - direction: out - name: acl_1 - afi: ipv4 - name: GigabitEthernet0/0/0/1 - - update_after: - - name: MgmtEth0/0/CPU0/0 - - - access_groups: - - acls: - - direction: in - name: acl_1 - - direction: out - name: acl_2 - afi: ipv4 - - acls: - - direction: in - name: acl6_1 - - direction: out - name: acl6_2 - afi: ipv6 - name: GigabitEthernet0/0/0/0 - - - access_groups: - - acls: - - direction: in - name: acl_1 - - direction: out - name: acl_2 - afi: ipv4 - name: GigabitEthernet0/0/0/1 - - -replaced: - commands: - - interface GigabitEthernet0/0/0/0 - - no ipv4 access-group acl_1 ingress - - no ipv4 access-group acl_2 egress - - no ipv6 access-group acl6_1 ingress - - no ipv6 access-group acl6_2 egress - - ipv6 access-group acl6_3 ingress - - after: - - name: MgmtEth0/0/CPU0/0 - - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv6 - acls: - - name: acl6_3 - direction: in - - - name: GigabitEthernet0/0/0/1 - access_groups: - - acls: - - name: acl_1 - direction: out - afi: ipv4 - -overridden: - commands: - - interface GigabitEthernet0/0/0/0 - - no ipv4 access-group acl_1 ingress - - no ipv4 access-group acl_2 egress - - no ipv6 access-group acl6_1 ingress - - no ipv6 access-group acl6_2 egress - - ipv6 access-group acl6_3 ingress - - interface GigabitEthernet0/0/0/1 - - no ipv4 access-group acl_1 egress - - ipv4 access-group acl_2 ingress - - ipv6 access-group acl6_3 egress - - after: - - name: MgmtEth0/0/CPU0/0 - - - name: GigabitEthernet0/0/0/0 - access_groups: - - afi: ipv6 - acls: - - name: acl6_3 - direction: in - - - name: GigabitEthernet0/0/0/1 - access_groups: - - acls: - - name: acl_2 - direction: in - afi: ipv4 - - - acls: - - name: acl6_3 - direction: out - afi: ipv6 - - -deleted: - commands: - - interface GigabitEthernet0/0/0/0 - - no ipv4 access-group acl_1 ingress - - no ipv4 access-group acl_2 egress - - no ipv6 access-group acl6_1 ingress - - no ipv6 access-group acl6_2 egress - - interface GigabitEthernet0/0/0/1 - - no ipv4 access-group acl_1 egress - - after: - - name: MgmtEth0/0/CPU0/0 - - - name: GigabitEthernet0/0/0/0 - - - name: GigabitEthernet0/0/0/1 - -round_trip: - after: - - name: MgmtEth0/0/CPU0/0 - - access_groups: - - acls: - - direction: out - name: acl_1 - afi: ipv4 - name: GigabitEthernet0/0/0/0 - - access_groups: - - acls: - - direction: in - name: acl_1 - - direction: out - name: acl_2 - afi: ipv4 - - acls: - - direction: in - name: acl6_1 - - direction: out - name: acl6_2 - afi: ipv6 - name: GigabitEthernet0/0/0/1
\ No newline at end of file diff --git a/test/integration/targets/iosxr_acls/defaults/main.yaml b/test/integration/targets/iosxr_acls/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/iosxr_acls/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/iosxr_acls/tasks/cli.yaml b/test/integration/targets/iosxr_acls/tasks/cli.yaml deleted file mode 100644 index 337e34133b..0000000000 --- a/test/integration/targets/iosxr_acls/tasks/cli.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: Set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - delegate_to: localhost - -- name: Run test case (connection=network_cli) - include: "{{ test_case_to_run }}" - vars: - ansible_connection: network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_acls/tasks/main.yaml b/test/integration/targets/iosxr_acls/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_acls/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_acls/tests/cli/_populate_config.yaml b/test/integration/targets/iosxr_acls/tests/cli/_populate_config.yaml deleted file mode 100644 index 440943c864..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/_populate_config.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- name: Setup - iosxr_config: - lines: | - ipv6 access-list acl6_1 - 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 authen routing log - 20 permit icmpv6 any any router-advertisement precedence network destopts - ipv4 access-list acl_1 - 16 remark TEST_ACL_1_REMARK - 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst - 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 - ipv4 access-list acl_2 - 10 remark TEST_ACL_2_REMARK
\ No newline at end of file diff --git a/test/integration/targets/iosxr_acls/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_acls/tests/cli/_remove_config.yaml deleted file mode 100644 index 8ef7d1c3e5..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- name: Remove ACLs - cli_config: - config: "{{ lines }}" - vars: - lines: | - no ipv4 access-list acl_1 - no ipv4 access-list acl_2 - no ipv4 access-list acl_3 - no ipv4 access-list acl_3 - no ipv6 access-list acl6_1 - no ipv6 access-list acl6_2 - no ipv6 access-list acl6_3 - ignore_errors: yes diff --git a/test/integration/targets/iosxr_acls/tests/cli/deleted.yaml b/test/integration/targets/iosxr_acls/tests/cli/deleted.yaml deleted file mode 100644 index b3cc2d7a0b..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/deleted.yaml +++ /dev/null @@ -1,116 +0,0 @@ ---- -- debug: - msg: "Start iosxr_lag_interfaces deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Delete a single ACE - iosxr_acls: &deleted_1 - config: - - afi: ipv4 - acls: - - name: acl_1 - aces: - - sequence: 23 - state: deleted - register: result - - - assert: - that: - - '"ipv4 access-list acl_1" in result.commands' - - '"no 23" in result.commands' - - "result.commands|length == 2" - - - name: Delete a single ACE (IDEMPOTENT) - iosxr_acls: *deleted_1 - register: result - - - name: Assert that the previous task was idempotent - assert: &unchanged - that: - - "result.changed == false" - - "result.commands|length == 0" - - - name: Delete a single ACL - iosxr_acls: &deleted_2 - config: - - afi: ipv6 - acls: - - name: acl6_1 - state: deleted - register: result - - - assert: - that: - - '"no ipv6 access-list acl6_1" in result.commands' - - "result.commands|length == 1" - - - name: Delete a single ACL (IDEMPOTENT) - iosxr_acls: *deleted_2 - register: result - - - name: Assert that the previous task was idempotent - assert: *unchanged - - - name: Delete all ACLs under one AFI - iosxr_acls: &deleted_3 - config: - - afi: ipv4 - state: deleted - register: result - - - assert: - that: - - '"no ipv4 access-list acl_1" in result.commands' - - '"no ipv4 access-list acl_2" in result.commands' - - "result.commands|length == 2" - - - name: Delete all ACLs under one AFI (IDEMPOTENT) - iosxr_acls: *deleted_3 - register: result - - - name: Assert that the previous task was idempotent - assert: *unchanged - - - include_tasks: _populate_config.yaml - - - name: Delete all ACLs from the device - iosxr_acls: &deleted_4 - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Delete all ACLs from the device (IDEMPOTENT) - iosxr_lag_interfaces: *deleted_4 - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acls/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_acls/tests/cli/empty_config.yaml deleted file mode 100644 index 085a603fd8..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/empty_config.yaml +++ /dev/null @@ -1,57 +0,0 @@ -- debug: - msg: "START iosxr_acls empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - iosxr_acls: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - iosxr_acls: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' - -- name: Overridden with empty config should give appropriate error message - iosxr_acls: - config: - state: overridden - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state overridden' - -- name: Rendered with empty config should give appropriate error message - iosxr_acls: - config: - state: rendered - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state rendered' - -- name: Parsed with empty config should give appropriate error message - iosxr_acls: - running_config: - state: parsed - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of running_config parameter must not be empty for state parsed' diff --git a/test/integration/targets/iosxr_acls/tests/cli/fixtures/parsed.cfg b/test/integration/targets/iosxr_acls/tests/cli/fixtures/parsed.cfg deleted file mode 100644 index 31155e2378..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/fixtures/parsed.cfg +++ /dev/null @@ -1,8 +0,0 @@ -ipv4 access-list acl_1 - 10 remark TEST_ACL_2_REMARK -ipv4 access-list acl_2 - 11 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 authen routing log - 21 permit icmpv6 any any router-advertisement precedence network packet-length eq 576 destopts -ipv6 access-list acl6_1 - 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 routing authen log - 20 permit icmpv6 any any router-advertisement precedence network packet-length eq 576 destopts diff --git a/test/integration/targets/iosxr_acls/tests/cli/gathered.yaml b/test/integration/targets/iosxr_acls/tests/cli/gathered.yaml deleted file mode 100644 index 0c28772674..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/gathered.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- debug: - msg: "START iosxr_acls gathered integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Gather ACL interfaces facts using gathered state - iosxr_acls: - state: gathered - register: result - - - name: Assert that facts were correctly generated - assert: - that: "{{ merged['after'] | symmetric_difference(result['gathered']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acls/tests/cli/merged.yaml b/test/integration/targets/iosxr_acls/tests/cli/merged.yaml deleted file mode 100644 index 0462502cec..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/merged.yaml +++ /dev/null @@ -1,168 +0,0 @@ ---- -- debug: - msg: "START iosxr_acls merged integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Merge the provided configuration with the exisiting running configuration - iosxr_acls: &merged - config: - - afi: ipv6 - acls: - - name: acl6_1 - aces: - - sequence: 10 - grant: deny - protocol: tcp - source: - prefix: 2001:db8:1234::/48 - port_protocol: - range: - start: ftp - end: telnet - destination: - any: True - protocol_options: - tcp: - syn: True - ttl: - range: - start: 180 - end: 250 - routing: True - authen: True - log: True - - - sequence: 20 - grant: permit - protocol: icmpv6 - source: - any: True - destination: - any: True - protocol_options: - icmpv6: - router_advertisement: True - precedence: network - destopts: True - - - afi: ipv4 - acls: - - name: acl_1 - aces: - - sequence: 16 - remark: TEST_ACL_1_REMARK - - - sequence: 21 - grant: permit - protocol: tcp - source: - host: 192.0.2.10 - port_protocol: - range: - start: pop3 - end: 121 - destination: - address: 198.51.100.0 - wildcard_bits: 0.0.0.15 - protocol_options: - tcp: - rst: True - - - sequence: 23 - grant: deny - protocol: icmp - source: - any: True - destination: - prefix: 198.51.100.0/28 - protocol_options: - icmp: - reassembly_timeout: True - dscp: - lt: af12 - - - name: acl_2 - aces: - - sequence: 10 - remark: TEST_ACL_2_REMARK - state: merged - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts was correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - iosxr_acls: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Update existing ACEs - iosxr_acls: &update - config: - - afi: ipv4 - acls: - - name: acl_1 - aces: - - sequence: 21 - source: - prefix: 198.51.100.32/28 - port_protocol: - range: - start: pop3 - end: 121 - protocol_options: - tcp: - syn: True - - - sequence: 23 - protocol_options: - icmp: - router_advertisement: True - dscp: - eq: af23 - state: merged - register: result - - - name: Assert that the correct set of commands were generated - assert: - that: - - '"ipv4 access-list acl_1" in result.commands' - - '"21 permit tcp 198.51.100.32 0.0.0.15 range pop3 121 198.51.100.0 0.0.0.15 syn" in result.commands' - - '"23 deny icmp any 198.51.100.0 0.0.0.15 router-advertisement dscp eq af23" in result.commands' - - "result.commands|length == 3" - - - name: Update existing ACEs (IDEMPOTENT) - iosxr_acls: *update - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acls/tests/cli/overridden.yaml b/test/integration/targets/iosxr_acls/tests/cli/overridden.yaml deleted file mode 100644 index 2e4c3cc004..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/overridden.yaml +++ /dev/null @@ -1,68 +0,0 @@ ---- -- debug: - msg: "START iosxr_acls overridden integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Overridde all ACLs configuration with provided configuration - iosxr_acls: &overridden - config: - - afi: ipv4 - acls: - - name: acl_1 - aces: - - sequence: 10 - grant: permit - source: - any: True - destination: - any: True - protocol: tcp - - - name: acl_2 - aces: - - sequence: 20 - grant: permit - source: - any: True - destination: - any: True - protocol: igmp - state: overridden - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Overridde all interface LAG interface configuration with provided configuration (IDEMPOTENT) - iosxr_acls: *overridden - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acls/tests/cli/parsed.yaml b/test/integration/targets/iosxr_acls/tests/cli/parsed.yaml deleted file mode 100644 index 5e6b4609fa..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/parsed.yaml +++ /dev/null @@ -1,14 +0,0 @@ ---- -- debug: - msg: "START iosxr_acls parsed integration tests on connection={{ ansible_connection }}" - -- name: Parse externally provided ACL config to agnostic model - iosxr_acls: - running_config: "{{ lookup('file', './fixtures/parsed.cfg') }}" - state: parsed - register: result - -- name: Assert that config was correctly parsed - assert: - that: - - "{{ parsed | symmetric_difference(result['parsed']) |length == 0 }}" diff --git a/test/integration/targets/iosxr_acls/tests/cli/rendered.yaml b/test/integration/targets/iosxr_acls/tests/cli/rendered.yaml deleted file mode 100644 index d5dd00ce7b..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/rendered.yaml +++ /dev/null @@ -1,93 +0,0 @@ ---- -- debug: - msg: "START iosxr_acls rendered integration tests on connection={{ ansible_connection }}" - -- name: Render platform specific commands from task input using rendered state - iosxr_acls: - config: - - afi: ipv6 - acls: - - name: acl6_1 - aces: - - sequence: 10 - grant: deny - protocol: tcp - source: - prefix: 2001:db8:1234::/48 - port_protocol: - range: - start: ftp - end: telnet - destination: - any: True - protocol_options: - tcp: - syn: True - ttl: - range: - start: 180 - end: 250 - routing: True - authen: True - log: True - - - sequence: 20 - grant: permit - protocol: icmpv6 - source: - any: True - destination: - any: True - protocol_options: - icmpv6: - router_advertisement: True - precedence: network - destopts: True - - - afi: ipv4 - acls: - - name: acl_1 - aces: - - sequence: 16 - remark: TEST_ACL_1_REMARK - - - sequence: 21 - grant: permit - protocol: tcp - source: - host: 192.0.2.10 - port_protocol: - range: - start: pop3 - end: 121 - destination: - address: 198.51.100.0 - wildcard_bits: 0.0.0.15 - protocol_options: - tcp: - rst: True - - - sequence: 23 - grant: deny - protocol: icmp - source: - any: True - destination: - prefix: 198.51.100.0/28 - protocol_options: - icmp: - reassembly_timeout: True - dscp: - lt: af12 - - - name: acl_2 - aces: - - sequence: 10 - remark: TEST_ACL_2_REMARK - state: rendered - register: result - -- name: Assert that correct set of commands were rendered - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['rendered']) |length == 0 }}" diff --git a/test/integration/targets/iosxr_acls/tests/cli/replaced.yaml b/test/integration/targets/iosxr_acls/tests/cli/replaced.yaml deleted file mode 100644 index d9137908e4..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/replaced.yaml +++ /dev/null @@ -1,68 +0,0 @@ ---- -- debug: - msg: "START iosxr_acl_interfaces replaced integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Replace device configurations of listed ACL with provided configurations - iosxr_acls: &replaced - config: - - afi: ipv4 - acls: - - name: acl_2 - aces: - - sequence: 11 - grant: permit - protocol: igmp - source: - host: 198.51.100.130 - destination: - any: True - ttl: - eq: 100 - - - sequence: 12 - grant: deny - source: - any: True - destination: - any: True - protocol: icmp - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) - iosxr_acls: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acls/tests/cli/rtt.yaml b/test/integration/targets/iosxr_acls/tests/cli/rtt.yaml deleted file mode 100644 index dd3044dcba..0000000000 --- a/test/integration/targets/iosxr_acls/tests/cli/rtt.yaml +++ /dev/null @@ -1,85 +0,0 @@ ---- -- debug: - msg: "START iosxr_acls round trip integration tests on connection={{ ansible_connection }}" - -- block: - - include_tasks: _remove_config.yaml - - - name: Apply the provided configuration (base config) - iosxr_acls: - config: - - afi: ipv4 - acls: - - name: acl_2 - aces: - - sequence: 11 - grant: permit - protocol: igmp - source: - host: 198.51.100.130 - destination: - any: True - ttl: - eq: 100 - - - sequence: 12 - grant: deny - source: - any: True - destination: - any: True - protocol: icmp - state: merged - register: base_config - - - name: Gather interfaces facts - iosxr_facts: - gather_subset: - - "!all" - - "!min" - gather_network_resources: - - acls - - - name: Apply the provided configuration (config to be reverted) - iosxr_acls: - config: - - afi: ipv4 - acls: - - name: acl_1 - aces: - - sequence: 10 - grant: permit - source: - any: True - destination: - any: True - protocol: tcp - - - name: acl_2 - aces: - - sequence: 20 - grant: permit - source: - any: True - destination: - any: True - protocol: igmp - state: overridden - register: result - - - name: Assert that changes were applied - assert: - that: "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Revert back to base config using facts round trip - iosxr_acls: - config: "{{ ansible_facts['network_resources']['acls'] }}" - state: overridden - register: revert - - - name: Assert that config was reverted - assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_acls/vars/main.yaml b/test/integration/targets/iosxr_acls/vars/main.yaml deleted file mode 100644 index 651b1bc912..0000000000 --- a/test/integration/targets/iosxr_acls/vars/main.yaml +++ /dev/null @@ -1,338 +0,0 @@ ---- -merged: - before: [] - - commands: - - ipv6 access-list acl6_1 - - 10 deny tcp 2001:db8:1234::/48 range ftp telnet any syn ttl range 180 250 authen routing log - - 20 permit icmpv6 any any router-advertisement precedence network destopts - - ipv4 access-list acl_1 - - 16 remark TEST_ACL_1_REMARK - - 21 permit tcp host 192.0.2.10 range pop3 121 198.51.100.0 0.0.0.15 rst - - 23 deny icmp any 198.51.100.0 0.0.0.15 reassembly-timeout dscp lt af12 - - ipv4 access-list acl_2 - - 10 remark TEST_ACL_2_REMARK - - after: - - acls: - - aces: - - remark: TEST_ACL_1_REMARK - sequence: 16 - - - destination: - address: 198.51.100.0 - wildcard_bits: 0.0.0.15 - grant: permit - protocol: tcp - protocol_options: - tcp: - rst: true - sequence: 21 - source: - host: 192.0.2.10 - port_protocol: - range: - end: '121' - start: pop3 - - - destination: - address: 198.51.100.0 - wildcard_bits: 0.0.0.15 - dscp: - lt: af12 - grant: deny - protocol: icmp - protocol_options: - icmp: - reassembly_timeout: true - sequence: 23 - source: - any: true - name: acl_1 - - - aces: - - remark: TEST_ACL_2_REMARK - sequence: 10 - name: acl_2 - afi: ipv4 - - - acls: - - aces: - - authen: true - destination: - any: true - grant: deny - log: true - protocol: tcp - protocol_options: - tcp: - syn: true - routing: true - sequence: 10 - source: - port_protocol: - range: - end: telnet - start: ftp - prefix: 2001:db8:1234::/48 - ttl: - range: - end: 250 - start: 180 - - - destination: - any: true - destopts: true - grant: permit - precedence: network - protocol: icmpv6 - protocol_options: - icmpv6: - router_advertisement: true - sequence: 20 - source: - any: true - name: acl6_1 - afi: ipv6 - - -replaced: - commands: - - ipv4 access-list acl_2 - - no 10 - - 11 permit igmp host 198.51.100.130 any ttl eq 100 - - 12 deny icmp any any - - after: - - acls: - - aces: - - remark: TEST_ACL_1_REMARK - sequence: 16 - - destination: - address: 198.51.100.0 - wildcard_bits: 0.0.0.15 - grant: permit - protocol: tcp - protocol_options: - tcp: - rst: true - sequence: 21 - source: - host: 192.0.2.10 - port_protocol: - range: - end: '121' - start: pop3 - - destination: - address: 198.51.100.0 - wildcard_bits: 0.0.0.15 - dscp: - lt: af12 - grant: deny - protocol: icmp - protocol_options: - icmp: - reassembly_timeout: true - sequence: 23 - source: - any: true - name: acl_1 - - - aces: - - destination: - any: true - grant: permit - protocol: igmp - sequence: 11 - source: - host: 198.51.100.130 - ttl: - eq: 100 - - destination: - any: true - grant: deny - protocol: icmp - sequence: 12 - source: - any: true - name: acl_2 - afi: ipv4 - - - acls: - - aces: - - authen: true - destination: - any: true - grant: deny - log: true - protocol: tcp - protocol_options: - tcp: - syn: true - routing: true - sequence: 10 - source: - port_protocol: - range: - end: telnet - start: ftp - prefix: 2001:db8:1234::/48 - ttl: - range: - end: 250 - start: 180 - - - destination: - any: true - destopts: true - grant: permit - precedence: network - protocol: icmpv6 - protocol_options: - icmpv6: - router_advertisement: true - sequence: 20 - source: - any: true - name: acl6_1 - afi: ipv6 - -overridden: - commands: - - no ipv6 access-list acl6_1 - - ipv4 access-list acl_1 - - no 16 - - no 21 - - no 23 - - 10 permit tcp any any - - ipv4 access-list acl_2 - - no 10 - - 20 permit igmp any any - - after: - - acls: - - aces: - - destination: - any: true - grant: permit - protocol: tcp - sequence: 10 - source: - any: true - name: acl_1 - - - aces: - - destination: - any: true - grant: permit - protocol: igmp - sequence: 20 - source: - any: true - name: acl_2 - afi: ipv4 - -deleted: - commands: - - no ipv4 access-list acl_1 - - no ipv4 access-list acl_2 - - no ipv6 access-list acl6_1 - - after: [] - -parsed: - - acls: - - aces: - - remark: TEST_ACL_2_REMARK - sequence: 10 - name: acl_1 - - aces: - - authen: true - destination: - any: true - grant: deny - log: true - protocol: tcp - protocol_options: - tcp: - syn: true - routing: true - sequence: 11 - source: - port_protocol: - range: - end: telnet - start: ftp - prefix: 2001:db8:1234::/48 - ttl: - range: - end: 250 - start: 180 - - destination: - any: true - destopts: true - grant: permit - packet_length: - eq: 576 - precedence: network - protocol: icmpv6 - protocol_options: - icmpv6: - router_advertisement: true - sequence: 21 - source: - any: true - name: acl_2 - afi: ipv4 - - acls: - - aces: - - authen: true - destination: - any: true - grant: deny - log: true - protocol: tcp - protocol_options: - tcp: - syn: true - routing: true - sequence: 10 - source: - port_protocol: - range: - end: telnet - start: ftp - prefix: 2001:db8:1234::/48 - ttl: - range: - end: 250 - start: 180 - - destination: - any: true - destopts: true - grant: permit - packet_length: - eq: 576 - precedence: network - protocol: icmpv6 - protocol_options: - icmpv6: - router_advertisement: true - sequence: 20 - source: - any: true - name: acl6_1 - afi: ipv6 - -round_trip: - after: - - members: - - member: GigabitEthernet0/0/0/8 - mode: passive - - member: GigabitEthernet0/0/0/9 - mode: active - name: Bundle-Ether10 - - - mode: active - name: Bundle-Ether11 -
\ No newline at end of file diff --git a/test/integration/targets/iosxr_banner/defaults/main.yaml b/test/integration/targets/iosxr_banner/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/iosxr_banner/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/iosxr_banner/meta/main.yaml b/test/integration/targets/iosxr_banner/meta/main.yaml deleted file mode 100644 index d4da833dd5..0000000000 --- a/test/integration/targets/iosxr_banner/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_banner/tasks/cli.yaml b/test/integration/targets/iosxr_banner/tasks/cli.yaml deleted file mode 100644 index 3f93a4f369..0000000000 --- a/test/integration/targets/iosxr_banner/tasks/cli.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - 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/iosxr_banner/tasks/main.yaml b/test/integration/targets/iosxr_banner/tasks/main.yaml deleted file mode 100644 index af08869c92..0000000000 --- a/test/integration/targets/iosxr_banner/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: netconf.yaml, tags: ['netconf'] } diff --git a/test/integration/targets/iosxr_banner/tasks/netconf.yaml b/test/integration/targets/iosxr_banner/tasks/netconf.yaml deleted file mode 100644 index 904db03205..0000000000 --- a/test/integration/targets/iosxr_banner/tasks/netconf.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: collect all netconf test cases - find: - paths: "{{ role_path }}/tests/netconf" - 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 cases (connection=netconf) - include: "{{ test_case_to_run }} ansible_connection=netconf" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - -# Only one of the Testcase would be run to check if `connection: local` -# is established. Full suite is run with `connection:network_cli` or `connection:netconf` -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_first_found: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_banner/tests/cli/basic-login.yaml b/test/integration/targets/iosxr_banner/tests/cli/basic-login.yaml deleted file mode 100644 index 032fa1f4ea..0000000000 --- a/test/integration/targets/iosxr_banner/tests/cli/basic-login.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- name: setup - remove login - iosxr_banner: - banner: login - provider: "{{ cli }}" - state: absent - -- name: Set login - iosxr_banner: - banner: login - text: | - this is my login banner - that has a multiline - string - provider: "{{ cli }}" - state: present - register: result - -- debug: - msg: "{{ result }}" - -- assert: - that: - - "result.changed == true" - - "'this is my login banner' in result.commands[0]" - - "'that has a multiline' in result.commands[0]" - -- name: Set login again (idempotent) - iosxr_banner: - banner: login - text: | - this is my login banner - that has a multiline - string - provider: "{{ cli }}" - state: present - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - - -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" diff --git a/test/integration/targets/iosxr_banner/tests/cli/basic-motd.yaml b/test/integration/targets/iosxr_banner/tests/cli/basic-motd.yaml deleted file mode 100644 index 67b80eb023..0000000000 --- a/test/integration/targets/iosxr_banner/tests/cli/basic-motd.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- name: setup - remove motd - iosxr_banner: - banner: motd - state: absent - provider: "{{ cli }}" - -- name: Set motd - iosxr_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - provider: "{{ cli }}" - state: present - register: result - -- debug: - msg: "{{ result }}" - -- assert: - that: - - "result.changed == true" - - "'this is my motd banner' in result.commands[0]" - - "'that has a multiline' in result.commands[0]" - -- name: Set motd again (idempotent) - iosxr_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - provider: "{{ cli }}" - state: present - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - - -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" diff --git a/test/integration/targets/iosxr_banner/tests/cli/basic-no-login.yaml b/test/integration/targets/iosxr_banner/tests/cli/basic-no-login.yaml deleted file mode 100644 index 539baf23f5..0000000000 --- a/test/integration/targets/iosxr_banner/tests/cli/basic-no-login.yaml +++ /dev/null @@ -1,41 +0,0 @@ ---- -- name: Setup - iosxr_banner: - banner: login - text: | - Junk login banner - over multiple lines - provider: "{{ cli }}" - state: present - -- name: remove login - iosxr_banner: - banner: login - state: absent - provider: "{{ cli }}" - register: result - -- debug: - msg: "{{ result }}" - -- assert: - that: - - "result.changed == true" - - "'no banner login' in result.commands[0]" - -- name: remove login (idempotent) - iosxr_banner: - banner: login - state: absent - provider: "{{ cli }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.commands | length == 0" - - -# FIXME add in tests for everything defined in docs -# FIXME Test state:absent + test: -# FIXME Without powers ensure "privileged mode required" diff --git a/test/integration/targets/iosxr_banner/tests/netconf/basic-login.yaml b/test/integration/targets/iosxr_banner/tests/netconf/basic-login.yaml deleted file mode 100644 index 4335d59827..0000000000 --- a/test/integration/targets/iosxr_banner/tests/netconf/basic-login.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- name: setup - remove login - iosxr_banner: - banner: login - provider: "{{ netconf }}" - state: absent - -- name: Set login - iosxr_banner: - banner: login - text: | - this is my login banner - that has a multiline - string - provider: "{{ netconf }}" - state: present - register: result - -- debug: - msg: "{{ result }}" - -- assert: - that: - - "result.changed == true" - - "'this is my login banner' in result.xml" - - "'that has a multiline' in result.xml" - -- name: Set login again (idempotent) - iosxr_banner: - banner: login - text: | - this is my login banner - that has a multiline - string - provider: "{{ netconf }}" - state: present - register: result - -- assert: - that: - - "result.changed == false" - - "result.xml | length == 0" diff --git a/test/integration/targets/iosxr_banner/tests/netconf/basic-motd.yaml b/test/integration/targets/iosxr_banner/tests/netconf/basic-motd.yaml deleted file mode 100644 index 49969dd616..0000000000 --- a/test/integration/targets/iosxr_banner/tests/netconf/basic-motd.yaml +++ /dev/null @@ -1,42 +0,0 @@ ---- -- name: setup - remove motd - iosxr_banner: - banner: motd - state: absent - provider: "{{ netconf }}" - -- name: Set motd - iosxr_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - provider: "{{ netconf }}" - state: present - register: result - -- debug: - msg: "{{ result }}" - -- assert: - that: - - "result.changed == true" - - "'this is my motd banner' in result.xml" - - "'that has a multiline' in result.xml" - -- name: Set motd again (idempotent) - iosxr_banner: - banner: motd - text: | - this is my motd banner - that has a multiline - string - provider: "{{ netconf }}" - state: present - register: result - -- assert: - that: - - "result.changed == false" - - "result.xml | length == 0" diff --git a/test/integration/targets/iosxr_banner/tests/netconf/basic-no-login.yaml b/test/integration/targets/iosxr_banner/tests/netconf/basic-no-login.yaml deleted file mode 100644 index c8bb8f1616..0000000000 --- a/test/integration/targets/iosxr_banner/tests/netconf/basic-no-login.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- name: Setup - iosxr_banner: - banner: login - text: | - Junk login banner - over multiple lines - provider: "{{ netconf }}" - state: present - -- name: remove login - iosxr_banner: - banner: login - state: absent - provider: "{{ netconf }}" - register: result - -- debug: - msg: "{{ result }}" - -- assert: - that: - - "result.changed == true" - - "'xc:operation=\"delete\"' in result.xml" - -- name: remove login (idempotent) - iosxr_banner: - banner: login - state: absent - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.changed == false" - - "result.xml | length == 0" diff --git a/test/integration/targets/iosxr_bgp/defaults/main.yaml b/test/integration/targets/iosxr_bgp/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/iosxr_bgp/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/iosxr_bgp/meta/main.yaml b/test/integration/targets/iosxr_bgp/meta/main.yaml deleted file mode 100644 index d4da833dd5..0000000000 --- a/test/integration/targets/iosxr_bgp/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_bgp/tasks/cli.yaml b/test/integration/targets/iosxr_bgp/tasks/cli.yaml deleted file mode 100644 index 3f93a4f369..0000000000 --- a/test/integration/targets/iosxr_bgp/tasks/cli.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - 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/iosxr_bgp/tasks/main.yaml b/test/integration/targets/iosxr_bgp/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_bgp/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_bgp/tests/cli/basic.yaml b/test/integration/targets/iosxr_bgp/tests/cli/basic.yaml deleted file mode 100644 index bb3755916b..0000000000 --- a/test/integration/targets/iosxr_bgp/tests/cli/basic.yaml +++ /dev/null @@ -1,246 +0,0 @@ ---- -- debug: msg="START iosxr cli/iosxr_bgp.yaml on connection={{ ansible_connection }}" - -- name: Check IOS-XR version - iosxr_facts: - gather_subset: default - register: facts - -- block: - - name: Clear existing BGP config - iosxr_bgp: - operation: delete - ignore_errors: yes - - - name: Configure BGP with AS 64496 and a router-id - iosxr_bgp: &config - operation: merge - config: - bgp_as: 64496 - router_id: 192.0.2.2 - register: result - - - assert: - that: - - 'result.changed == true' - - "'router bgp 64496' in result.commands" - - "'bgp router-id 192.0.2.2' in result.commands" - - - name: Configure BGP with AS 64496 and a router-id (idempotent) - iosxr_bgp: *config - register: result - - - assert: - that: - - 'result.changed == false' - - - name: Configure BGP neighbors - iosxr_bgp: &nbr - operation: merge - config: - bgp_as: 64496 - neighbors: - - neighbor: 192.0.2.10 - remote_as: 64496 - description: IBGP_NBR_1 - advertisement_interval: 120 - timers: - keepalive: 300 - holdtime: 360 - - - neighbor: 192.0.2.15 - remote_as: 64496 - description: IBGP_NBR_2 - tcp_mss: 1500 - register: result - - - assert: - that: - - 'result.changed == true' - - "'router bgp 64496' in result.commands" - - "'neighbor 192.0.2.10' in result.commands" - - "'remote-as 64496' in result.commands" - - "'description IBGP_NBR_1' in result.commands" - - "'timers 300 360' in result.commands" - - "'advertisement-interval 120' in result.commands" - - "'neighbor 192.0.2.15' in result.commands" - - "'remote-as 64496' in result.commands" - - "'description IBGP_NBR_2' in result.commands" - - "'tcp mss 1500' in result.commands" - - - name: Configure BGP neighbors (idempotent) - iosxr_bgp: *nbr - register: result - - - assert: - that: - - 'result.changed == false' - - - name: Configure BGP neighbors with operation replace - iosxr_bgp: &nbr_rplc - operation: replace - config: - bgp_as: 64496 - neighbors: - - neighbor: 192.0.2.15 - remote_as: 64496 - description: IBGP_NBR_2 - tcp_mss: 1500 - - - neighbor: 203.0.113.10 - remote_as: 64511 - description: EBGP_NBR_1 - register: result - - - assert: - that: - - 'result.changed == true' - - "'neighbor 203.0.113.10' in result.commands" - - "'remote-as 64511' in result.commands" - - "'description EBGP_NBR_1' in result.commands" - - "'no neighbor 192.0.2.10' in result.commands" - - - name: Configure BGP neighbors with operation replace (idempotent) - iosxr_bgp: *nbr_rplc - register: result - - - assert: - that: - - 'result.changed == false' - - - name: create route-policy as prerequisite for BGP configuration - iosxr_config: - lines: - - no route-policy RMAP_1 - - route-policy RMAP_1 - - exit - register: result - - - name: Configure networks under address family - iosxr_bgp: &af_net - operation: merge - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - networks: - - prefix: 198.51.100.48 - masklen: 28 - route_map: RMAP_1 - - - prefix: 192.0.2.64 - masklen: 27 - - - prefix: 203.0.113.160 - masklen: 27 - - - afi: ipv4 - safi: multicast - networks: - - prefix: 198.51.100.64 - masklen: 28 - register: result - - - assert: - that: - - 'result.changed == true' - - "'router bgp 64496' in result.commands" - - "'address-family ipv4 unicast' in result.commands" - - "'network 198.51.100.48/28 route-policy RMAP_1' in result.commands" - - "'network 192.0.2.64/27' in result.commands" - - "'network 203.0.113.160/27' in result.commands" - - "'address-family ipv4 multicast' in result.commands" - - "'network 198.51.100.64/28' in result.commands" - - - name: Configure networks under address family (idempotent) - iosxr_bgp: *af_net - register: result - - - assert: - that: - - 'result.changed == false' - - - name: Configure networks under address family with operation replace - iosxr_bgp: &af_net_rplc - operation: replace - config: - bgp_as: 64496 - address_family: - - afi: ipv4 - safi: unicast - networks: - - prefix: 198.51.100.80 - masklen: 28 - - - prefix: 192.0.2.64 - masklen: 27 - - - prefix: 203.0.113.192 - masklen: 27 - - - afi: ipv4 - safi: multicast - networks: - - prefix: 198.51.100.64 - masklen: 28 - register: result - - - assert: - that: - - 'result.changed == true' - - '"router bgp 64496" in result.commands' - - '"address-family ipv4 unicast" in result.commands' - - '"network 198.51.100.80/28" in result.commands' - - '"network 203.0.113.192/27" in result.commands' - - '"no network 198.51.100.48/28" in result.commands' - - '"no network 203.0.113.160/27" in result.commands' - - - name: Configure networks under address family with operation replace (idempotent) - iosxr_bgp: *af_net_rplc - register: result - - - assert: - that: - - 'result.changed == false' - - - name: Override all the exisiting BGP config - iosxr_bgp: - operation: override - config: - bgp_as: 64497 - router_id: 192.0.2.10 - log_neighbor_changes: True - register: result - - - assert: - that: - - 'result.changed == true' - - "'router bgp 64497' in result.commands" - - "'bgp router-id 192.0.2.10' in result.commands" - - "'bgp log neighbor changes detail' in result.commands" - - - name: Teardown - iosxr_bgp: &rm - operation: delete - register: result - - - assert: - that: - - 'result.changed == true' - - "'no router bgp 64497' in result.commands" - - - name: Teardown again (idempotent) - iosxr_bgp: *rm - register: result - - - assert: - that: - - 'result.changed == false' - - - name: delete route-policy configures as prerequisite for BGP configuration (teardown) - iosxr_config: - lines: no route-policy RMAP_1 - - when: facts['ansible_facts']['ansible_net_version'].split('[')[0] == '6.1.3' - -- debug: msg="END iosxr cli/iosxr_bgp.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_command/defaults/main.yaml b/test/integration/targets/iosxr_command/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/iosxr_command/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/iosxr_command/meta/main.yml b/test/integration/targets/iosxr_command/meta/main.yml deleted file mode 100644 index d4da833dd5..0000000000 --- a/test/integration/targets/iosxr_command/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_command/tasks/cli.yaml b/test/integration/targets/iosxr_command/tasks/cli.yaml deleted file mode 100644 index 3f93a4f369..0000000000 --- a/test/integration/targets/iosxr_command/tasks/cli.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - 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/iosxr_command/tasks/main.yaml b/test/integration/targets/iosxr_command/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_command/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_command/tests/cli/bad_operator.yaml b/test/integration/targets/iosxr_command/tests/cli/bad_operator.yaml deleted file mode 100644 index 28e359ab7c..0000000000 --- a/test/integration/targets/iosxr_command/tests/cli/bad_operator.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- debug: msg="START cli/bad_operator.yaml on connection={{ ansible_connection }}" - -- name: test bad operator - iosxr_command: - commands: - - show version - - show interfaces GigabitEthernet 0/0 - wait_for: - - "result[0] contains 'Description: Foo'" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- debug: msg="END cli/bad_operator.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_command/tests/cli/cli_command.yaml b/test/integration/targets/iosxr_command/tests/cli/cli_command.yaml deleted file mode 100644 index 5101e2aa81..0000000000 --- a/test/integration/targets/iosxr_command/tests/cli/cli_command.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -- debug: - msg: "START cli/cli_command.yaml on connection={{ ansible_connection }}" - -- name: get output for single command - cli_command: - command: show version - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: send invalid command - cli_command: - command: 'show foo' - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- name: delete config file on disk to prevent failure of copy task for duplicate - cli_command: - command: 'delete harddisk:ansible_tmp.txt' - prompt: 'Delete harddisk\:/?ansible_tmp\.txt\[confirm\]' - answer: "" - ignore_errors: yes - -- name: Run command with prompt - cli_command: - command: 'copy running-config harddisk:ansible_tmp.txt' - prompt: 'Destination file name \(control-c to abort\)\: \[\/ansible_tmp.txt\]\?' - answer: 'ansible_tmp.txt' - register: result - -- assert: - that: - - "result.stdout is defined" - - "'ansible_tmp' in result.stdout" - -- debug: msg="END cli/cli_command.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_command/tests/cli/contains.yaml b/test/integration/targets/iosxr_command/tests/cli/contains.yaml deleted file mode 100644 index 55dd302dc0..0000000000 --- a/test/integration/targets/iosxr_command/tests/cli/contains.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- debug: msg="START cli/contains.yaml on connection={{ ansible_connection }}" - -- name: test contains operator - iosxr_command: - commands: - - show version - - show interfaces Loopback 888 - wait_for: - - "result[0] contains 'Cisco IOS XR Software'" - - "result[1] contains 'Hardware is Loopback interface'" - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- debug: msg="END cli/contains.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_command/tests/cli/invalid.yaml b/test/integration/targets/iosxr_command/tests/cli/invalid.yaml deleted file mode 100644 index 1f9393ddec..0000000000 --- a/test/integration/targets/iosxr_command/tests/cli/invalid.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- debug: msg="START cli/invalid.yaml on connection={{ ansible_connection }}" - -- name: run invalid command - iosxr_command: - commands: {command: 'show foo', prompt: 'fooprompt', answer: 'yes'} - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed" - -- name: run commands that include invalid command - iosxr_command: - commands: - - show version - - {command: 'show foo', prompt: 'fooprompt', answer: 'yes'} - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed" - -- debug: msg="END cli/invalid.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_command/tests/cli/output.yaml b/test/integration/targets/iosxr_command/tests/cli/output.yaml deleted file mode 100644 index 3057d58c49..0000000000 --- a/test/integration/targets/iosxr_command/tests/cli/output.yaml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- debug: msg="START cli/output.yaml on connection={{ ansible_connection }}" - -- name: get output for single command - iosxr_command: - commands: ['show version'] - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - -- name: get output for multiple commands - iosxr_command: - commands: - - show version - - show interfaces - register: result - -- assert: - that: - - "result.changed == false" - - "result.stdout is defined" - - "result.stdout | length == 2" - -- debug: msg="END cli/output.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_command/tests/cli/prompt.yaml b/test/integration/targets/iosxr_command/tests/cli/prompt.yaml deleted file mode 100644 index 83f6cc8a3a..0000000000 --- a/test/integration/targets/iosxr_command/tests/cli/prompt.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- debug: - msg: "START cli/prompt.yaml on connection={{ ansible_connection }}" - -- name: delete config file on disk to prevent failure of copy task for duplicate - iosxr_command: - commands: - - command: 'delete harddisk:ansible_tmp.txt' - prompt: 'Delete harddisk\:/?ansible_tmp\.txt\[confirm\]' - answer: "" - ignore_errors: yes - -- name: copy - iosxr_command: - commands: - - command: 'copy running-config harddisk:ansible_tmp.txt' - prompt: 'Destination file name \(control-c to abort\)\: \[\/ansible_tmp.txt\]\?' - answer: 'ansible_tmp.txt' - register: result - -- assert: - that: - - "result.stdout is defined" - - "'ansible_tmp' in result.stdout[0]" - -- debug: msg="END cli/prompt.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_command/tests/cli/timeout.yaml b/test/integration/targets/iosxr_command/tests/cli/timeout.yaml deleted file mode 100644 index bbad3ecaf5..0000000000 --- a/test/integration/targets/iosxr_command/tests/cli/timeout.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- debug: msg="START cli/timeout.yaml on connection={{ ansible_connection }}" - -- name: test bad condition - iosxr_command: - commands: - - show version - wait_for: - - "result[0] contains bad_value_string" - register: result - ignore_errors: yes - -- assert: - that: - - "result.failed == true" - - "result.msg is defined" - -- debug: msg="END cli/timeout.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/defaults/main.yaml b/test/integration/targets/iosxr_config/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/iosxr_config/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/iosxr_config/fixtures/config_add_interface.txt b/test/integration/targets/iosxr_config/fixtures/config_add_interface.txt deleted file mode 100644 index 4aca281446..0000000000 --- a/test/integration/targets/iosxr_config/fixtures/config_add_interface.txt +++ /dev/null @@ -1,35 +0,0 @@ -hostname iosxr01 -line default - transport input ssh -! -interface Loopback888 - description test for ansible - shutdown -! -interface MgmtEth0/0/CPU0/0 - ipv4 address dhcp -! -interface preconfigure GigabitEthernet0/0/0/3 - description test-interface-3 - mtu 256 - speed 100 - duplex full -! -interface GigabitEthernet0/0/0/0 - shutdown -! -interface GigabitEthernet0/0/0/1 - shutdown -! -router static - address-family ipv4 unicast - 0.0.0.0/0 10.0.2.2 - ! -! -netconf-yang agent - ssh -! -ssh server v2 -ssh server netconf vrf default -! -end diff --git a/test/integration/targets/iosxr_config/fixtures/config_del_interface.txt b/test/integration/targets/iosxr_config/fixtures/config_del_interface.txt deleted file mode 100644 index a35e4da75a..0000000000 --- a/test/integration/targets/iosxr_config/fixtures/config_del_interface.txt +++ /dev/null @@ -1,29 +0,0 @@ -hostname iosxr01 -line default - transport input ssh -! -interface Loopback888 - description test for ansible - shutdown -! -interface MgmtEth0/0/CPU0/0 - ipv4 address dhcp -! -interface GigabitEthernet0/0/0/0 - shutdown -! -interface GigabitEthernet0/0/0/1 - shutdown -! -router static - address-family ipv4 unicast - 0.0.0.0/0 10.0.2.2 - ! -! -netconf-yang agent - ssh -! -ssh server v2 -ssh server netconf vrf default -! -end diff --git a/test/integration/targets/iosxr_config/meta/main.yml b/test/integration/targets/iosxr_config/meta/main.yml deleted file mode 100644 index d4da833dd5..0000000000 --- a/test/integration/targets/iosxr_config/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_config/tasks/cli.yaml b/test/integration/targets/iosxr_config/tasks/cli.yaml deleted file mode 100644 index 3f93a4f369..0000000000 --- a/test/integration/targets/iosxr_config/tasks/cli.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - 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/iosxr_config/tasks/cli_config.yaml b/test/integration/targets/iosxr_config/tasks/cli_config.yaml deleted file mode 100644 index a12f077120..0000000000 --- a/test/integration/targets/iosxr_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/iosxr_config/tasks/main.yaml b/test/integration/targets/iosxr_config/tasks/main.yaml deleted file mode 100644 index 5e327e8d52..0000000000 --- a/test/integration/targets/iosxr_config/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: cli_config.yaml, tags: ['cli_config'] } diff --git a/test/integration/targets/iosxr_config/templates/basic/change_prefix_set.j2 b/test/integration/targets/iosxr_config/templates/basic/change_prefix_set.j2 deleted file mode 100644 index 572d15bf6d..0000000000 --- a/test/integration/targets/iosxr_config/templates/basic/change_prefix_set.j2 +++ /dev/null @@ -1,7 +0,0 @@ -prefix-set ebpg_filter - 192.168.0.0/16 ge 15 le 30 -end-set - -interface Loopback999 - description this is a test interface for prefix-set - diff --git a/test/integration/targets/iosxr_config/templates/basic/config.j2 b/test/integration/targets/iosxr_config/templates/basic/config.j2 deleted file mode 100644 index 06f9848883..0000000000 --- a/test/integration/targets/iosxr_config/templates/basic/config.j2 +++ /dev/null @@ -1,4 +0,0 @@ -interface Loopback999 - description this is a test - shutdown - diff --git a/test/integration/targets/iosxr_config/templates/basic/init_prefix_set.j2 b/test/integration/targets/iosxr_config/templates/basic/init_prefix_set.j2 deleted file mode 100644 index d1170b02de..0000000000 --- a/test/integration/targets/iosxr_config/templates/basic/init_prefix_set.j2 +++ /dev/null @@ -1,3 +0,0 @@ -prefix-set ebpg_filter - 192.168.0.0/16 ge 17 le 30 -end-set diff --git a/test/integration/targets/iosxr_config/templates/basic/route_policy.j2 b/test/integration/targets/iosxr_config/templates/basic/route_policy.j2 deleted file mode 100644 index ecc68e8147..0000000000 --- a/test/integration/targets/iosxr_config/templates/basic/route_policy.j2 +++ /dev/null @@ -1,121 +0,0 @@ -router ospf 1 - area 0 -! -prefix-set EBGP-PEER-BOGONS - 0.0.0.0/0, - 0.0.0.0/8 le 32, - 10.0.0.0/8 le 32, - 127.0.0.0/8 le 32, - 169.254.0.0/16 le 32, - 172.16.0.0/12 le 32, - 192.0.0.0/24 le 32, - 192.0.2.0/24 le 32, - 192.168.0.0/16 le 32, - 198.18.0.0/15 le 32, - 224.0.0.0/4 le 32, - 240.0.0.0/4 le 32 -end-set -! -prefix-set cust-ddos-DDOS -end-set -! -prefix-set cust-no-export -end-set -! -prefix-set acme_DC_Internal - 137.1.0.0/16, - 137.1.16.0/24, - 137.1.18.0/24, - 137.1.20.0/24, - 137.1.22.0/24, - 137.1.23.0/24, - 137.1.24.0/24, - 137.1.29.0/24, - 137.1.30.0/24, - 137.1.31.0/24, - 137.1.32.0/21, - 137.1.40.0/22, - 209.1.0.0/16 -end-set -! -as-path-set EBGP-PEER-AS16509-403-PERMIT-PATHS - ios-regex '^11164_8075_', - ios-regex '^11164_16509$', - ios-regex '^1116_16509_[0-9]+$', - ios-regex '^8075_', - ios-regex '^16509$', - ios-regex '^16509_[0-9]+$' -end-set -! -community-set cust-announce - 1525:65298, - 1525:65436, - 1525:65438, - 1525:65439, - 1525:65498, - 1525:65511, - 1523:65418, - 1523:65436, - 1523:65438 -end-set -! -community-set cust-no-export - 1525:65439, - 1525:65511, - 1525:65535 -end-set -! - -route-policy POLICY2 -end-policy -! -route-policy cust2bgp - set origin igp - set next-hop 137.1.16.12 -end-policy -! -rd-set ebpg-1 -end-set -! -rd-set EBGP_INCOMING_RD_SET - 172.16.0.0/16:*, - 172.17.0.0/16:100, - 192:*, - 192:100 -end-set -! -extcommunity-set rt EBGP_INCOMIG_RT_SET - 10:615, - 10:6150, - 15.15.15.15:15 -end-set -! -extcommunity-set rt ebpg-1 -end-set -! -route-policy static-to-bgp - if destination in cust-no-export then - apply cust2bgp - set community cust-no-export additive - elseif destination in cust-announce then - apply cust2bgp - set community cust-announce additive - elseif destination in cust-announce-backup then - apply cust2bgp - set local-preference 100 - set weight 0 - set community cust-announce additive - elseif destination in cust-no-export-backup then - apply cust2bgp - set local-preference 98 - set weight 0 - set community cust-no-export additive - else - drop - endif -end-policy -! -class-map match-any data - match precedence ipv4 0 1 - end-class-map -! diff --git a/test/integration/targets/iosxr_config/templates/basic/route_policy_change.j2 b/test/integration/targets/iosxr_config/templates/basic/route_policy_change.j2 deleted file mode 100644 index 45448bae53..0000000000 --- a/test/integration/targets/iosxr_config/templates/basic/route_policy_change.j2 +++ /dev/null @@ -1,65 +0,0 @@ -prefix-set EBGP-PEER-BOGONS - 192.0.2.0/24 le 32, - 192.168.0.0/16 le 32, - 198.18.0.0/16 le 32, - 224.0.0.0/4 le 32, - 240.0.0.0/4 le 32 -end-set -! -as-path-set EBGP-PEER-AS16509-403-PERMIT-PATHS - ios-regex '^11164_8075_', - ios-regex '^1164_16509$', - ios-regex '^1116_16409_[0-9]+$', - ios-regex '^8075_' -end-set -! -community-set cust-announce - 1525:65298, - 1525:6546, - 1525:6438, - 1525:65439, - 1525:65498 -end-set -! -rd-set EBGP_INCOMING_RD_SET - 172.16.0.0/16:*, - 172.14.0.0/16:100, - 192:*, - 192:100 -end-set -! -extcommunity-set rt EBGP_INCOMIG_RT_SET - 10:615, - 10:6120, - 15.15.15.15:15 -end-set -! -route-policy POLICY2 -end-policy -! -route-policy static-to-bgp - if destination in cust-no-export then - apply cust2bgp - set community cust-no-export additive - elseif destination in cust-announce then - apply cust2bgp - set community cust-announce additive - elseif destination in cust-announce-backup then - apply cust2bgp - set local-preference 100 - set weight 23 - set community cust-announce additive - elseif destination in cust-no-export-backup then - apply cust2bgp - set local-preference 98 - set weight 0 - set community cust-no-export additive - else - drop - endif -end-policy -! -class-map match-any data - match precedence ipv4 0 1 2 - end-class-map -! diff --git a/test/integration/targets/iosxr_config/templates/basic/route_policy_clean.j2 b/test/integration/targets/iosxr_config/templates/basic/route_policy_clean.j2 deleted file mode 100644 index 08ba768671..0000000000 --- a/test/integration/targets/iosxr_config/templates/basic/route_policy_clean.j2 +++ /dev/null @@ -1,32 +0,0 @@ -no router ospf 1 -! -no prefix-set EBGP-PEER-BOGONS -! -no prefix-set cust-ddos-DDOS -! -no prefix-set cust-no-export -! -no prefix-set acme_DC_Internal -! -no as-path-set EBGP-PEER-AS16509-403-PERMIT-PATHS -! -no community-set cust-announce -! -no community-set cust-no-export -! -no rd-set ebpg-1 -! -no rd-set EBGP_INCOMING_RD_SET -! -no extcommunity-set rt EBGP_INCOMIG_RT_SET -! -no extcommunity-set rt ebpg-1 -! -no route-policy POLICY2 -! -no route-policy cust2bgp -! -no route-policy static-to-bgp -! -no class-map match-any data -! diff --git a/test/integration/targets/iosxr_config/templates/defaults/config.j2 b/test/integration/targets/iosxr_config/templates/defaults/config.j2 deleted file mode 100644 index 1d4d9da8d4..0000000000 --- a/test/integration/targets/iosxr_config/templates/defaults/config.j2 +++ /dev/null @@ -1,4 +0,0 @@ -interface Loopback999 - description this is a test - no shutdown - diff --git a/test/integration/targets/iosxr_config/tests/cli/backup.yaml b/test/integration/targets/iosxr_config/tests/cli/backup.yaml deleted file mode 100644 index 2ed758b03c..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/backup.yaml +++ /dev/null @@ -1,123 +0,0 @@ ---- -- debug: msg="START cli/backup.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - no description - - no shutdown - parents: - - interface Loopback999 - match: none - -- name: collect any backup files - find: - paths: "{{ role_path }}/backup" - pattern: "{{ inventory_hostname_short }}_config*" - connection: local - register: backup_files - -- name: delete backup files - file: - path: "{{ item.path }}" - state: absent - with_items: "{{backup_files.files|default([])}}" - -- name: configure device with config - iosxr_config: - src: basic/config.j2 - backup: yes - 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*" - connection: local - register: backup_files - -- 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 - iosxr_config: - backup: yes - backup_options: - filename: backup.cfg - dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - become: yes - 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 - iosxr_config: - backup: yes - backup_options: - filename: backup.cfg - become: yes - 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 - iosxr_config: - backup: yes - backup_options: - dir_path: "{{ role_path }}/backup_test_dir/{{ inventory_hostname_short }}" - become: yes - 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/backup.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml b/test/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml deleted file mode 100644 index 856f9ef386..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- debug: msg="START cli/comment-too-long.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - no description - - no shutdown - parents: - - interface Loopback999 - match: none - -# Defend against https://github.com/ansible/ansible-modules-core/issues/5146 -- name: Commit message too long - iosxr_config: - src: basic/config.j2 - comment: "this is a really long message aaaaabbbbbbcdde end-of-message" - register: result - ignore_errors: true - -- assert: - that: - - "result.changed == false" - - "result.updates is not defined" -# Defend https://github.com/ansible/ansible-modules-core/issues/5146 - - "'comment argument cannot be more than 60 characters' in result.msg" -# Check for the correct error message (and not a generic "Invalid input detected") once fixed - - -- debug: msg="END cli/comment-too-long.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/comment.yaml b/test/integration/targets/iosxr_config/tests/cli/comment.yaml deleted file mode 100644 index 9d8fe312b4..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/comment.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: msg="START cli/comment.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - no description - - no shutdown - parents: - - interface Loopback999 - match: none - -- name: configure device with comment - iosxr_config: - src: basic/config.j2 - comment: "this is sensible commit message" - exclusive: true - register: result - -- assert: - that: - - "result.changed == true" - - "result.updates is not defined" - -- name: check device with config - iosxr_config: - src: basic/config.j2 - exclusive: true - register: result - -- assert: - that: - - "result.changed == false" - - "result.updates is not defined" - -- debug: msg="END cli/comment.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/commit_label.yaml b/test/integration/targets/iosxr_config/tests/cli/commit_label.yaml deleted file mode 100644 index f62ad35bee..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/commit_label.yaml +++ /dev/null @@ -1,70 +0,0 @@ ---- -- debug: msg="START cli/commit_label.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - no description - - no shutdown - parents: - - interface Loopback999 - match: none - -- name: get a unique and valid label - set_fact: - label: "ansible_{{ 1001 | random | to_uuid | truncate(20, true, '_') }}" - -- name: configure device with a label and a comment - iosxr_config: - src: basic/config.j2 - comment: "this is sensible commit message" - label: "{{ label }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: setup - iosxr_config: - commands: - - no description - - no shutdown - parents: - - interface Loopback999 - match: none - -- name: Try to commit with old label, fail with a msg that label is alreay used - iosxr_config: - src: basic/config.j2 - label: "{{ label }}" - register: result - ignore_errors: true - -- assert: - that: - - "result.changed == false" - - "'already used' in result.msg" - -- name: setup - iosxr_config: - commands: - - no description - - no shutdown - parents: - - interface Loopback999 - match: none - -- name: Try to commit with invalid chars($) in label - iosxr_config: - src: basic/config.j2 - label: 'ansible_iosxr_config_$' - register: result - ignore_errors: true - -- assert: - that: - - "result.changed == false" - - "'only contain alphabets' in result.msg" - -- debug: msg="END cli/commit_label.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/misplaced_sublevel.yaml b/test/integration/targets/iosxr_config/tests/cli/misplaced_sublevel.yaml deleted file mode 100644 index 6faa1e4d82..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/misplaced_sublevel.yaml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- debug: msg="START cli/misplaced_sublevel.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - src: basic/init_prefix_set.j2 - ignore_errors: yes - -- name: Change prefix-set and new command after prefix-set - iosxr_config: - src: basic/change_prefix_set.j2 - register: result - -- assert: - that: - - "result.changed == true" - -- name: Play same config again to verify no diff in prefix-set also works - iosxr_config: - src: basic/change_prefix_set.j2 - register: result - -- assert: - that: - - "result.changed == false" - -- debug: msg="END cli/misplaced_sublevel.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/replace_config.yaml b/test/integration/targets/iosxr_config/tests/cli/replace_config.yaml deleted file mode 100644 index 719ba2ade3..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/replace_config.yaml +++ /dev/null @@ -1,43 +0,0 @@ ---- -- debug: msg="START cli/replace_config.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - no interface GigabitEthernet0/0/0/3 - -- name: replace config (add preconfigured interface) - iosxr_config: &addreplace - src: "{{ role_path }}/fixtures/config_add_interface.txt" - replace: config - register: result - -- assert: - that: - - '"load harddisk:/ansible_config.txt" in result.commands' - -- name: replace config (add preconfigured interface)(idempotence) - iosxr_config: *addreplace - register: result - -- assert: &false - that: - - 'result.changed == false' - -- name: replace config (del preconfigured interface) - iosxr_config: &delreplace - src: "{{ role_path }}/fixtures/config_del_interface.txt" - replace: config - register: result - -- assert: - that: - - '"load harddisk:/ansible_config.txt" in result.commands' - -- name: replace config (del preconfigured interface)(idempotence) - iosxr_config: *delreplace - register: result - -- assert: *false - -- debug: msg="END cli/replace_config.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/route_policy.yaml b/test/integration/targets/iosxr_config/tests/cli/route_policy.yaml deleted file mode 100644 index ab6c40d00b..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/route_policy.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -- debug: msg="START cli/route_policy.yaml on connection={{ ansible_connection }}" - -- name: Cleanup - iosxr_config: - src: basic/route_policy_clean.j2 - -- name: config setup route-policy/prefix-set/as-path-set/community-set - iosxr_config: - src: basic/route_policy.j2 - register: result - -- assert: - that: - - "result.changed == true" - -- name: Configure same route-policy/prefix-set ... verify change=0 - iosxr_config: - src: basic/route_policy.j2 - register: result - -- assert: - that: - - "result.changed == false" - -- name: Do a change in multi-sublevel route-policy/prefix-set/community-set - iosxr_config: - src: basic/route_policy_change.j2 - register: result - -- assert: - that: - - "result.changed == true" - -- name: Configure same route-policy/prefix-set ... verify change=0 - iosxr_config: - src: basic/route_policy_change.j2 - register: result - -- assert: - that: - - "result.changed == false" - -- name: Cleanup - iosxr_config: - src: basic/route_policy_clean.j2 - register: result - -- assert: - that: - - "result.changed == true" - -- debug: msg="END cli/route_policy.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/src_basic.yaml b/test/integration/targets/iosxr_config/tests/cli/src_basic.yaml deleted file mode 100644 index 7dae193d66..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/src_basic.yaml +++ /dev/null @@ -1,35 +0,0 @@ ---- -- debug: msg="START cli/src_basic.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - no description - - no shutdown - parents: - - interface Loopback999 - match: none - -- name: configure device with config - iosxr_config: - src: basic/config.j2 - register: result - -- assert: - that: - - "result.changed == true" -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is not defined" - -- name: check device with config - iosxr_config: - src: basic/config.j2 - register: result - -- assert: - that: - - "result.changed == false" -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is not defined" - -- debug: msg="END cli/src_basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/src_invalid.yaml b/test/integration/targets/iosxr_config/tests/cli/src_invalid.yaml deleted file mode 100644 index 5f7b6f2dd1..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/src_invalid.yaml +++ /dev/null @@ -1,18 +0,0 @@ ---- -- debug: msg="START cli/src_invalid.yaml on connection={{ ansible_connection }}" - - -# Defend https://github.com/ansible/ansible-modules-core/issues/4797 -- name: configure with invalid src - iosxr_config: - src: basic/foobar.j2 - register: result - ignore_errors: yes - -- assert: - that: - - "result.changed == false" - - "result.failed == true" - - "result.msg == 'path specified in src not found'" - -- debug: msg="END cli/src_invalid.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/src_match_none.yaml b/test/integration/targets/iosxr_config/tests/cli/src_match_none.yaml deleted file mode 100644 index dc3b269992..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/src_match_none.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: msg="START cli/src_match_none.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - no description - - no shutdown - parents: - - interface Loopback999 - match: none - -- name: configure device with config - iosxr_config: - src: basic/config.j2 - match: none - register: result - -- assert: - that: - - "result.changed == true" -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.updates is not defined" - -- name: check device with config - iosxr_config: - src: basic/config.j2 - register: result - -- assert: - that: - # Idempotent test -# https://github.com/ansible/ansible-modules-core/issues/4807 - - "result.changed == false" - - "result.updates is not defined" - -- debug: msg="END cli/src_match_none.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/sublevel.yaml b/test/integration/targets/iosxr_config/tests/cli/sublevel.yaml deleted file mode 100644 index 6d27a23149..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/sublevel.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: msg="START cli/sublevel.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: ['no ipv4 access-list test'] - match: none - ignore_errors: yes - -- name: configure sub level command - iosxr_config: - commands: ['10 permit ipv4 any any log'] - parents: ['ipv4 access-list test'] - register: result - -- assert: - that: - - "result.changed == true" - - "'ipv4 access-list test' in result.commands" - - "'10 permit ipv4 any any log' in result.commands" - -- name: configure sub level command idempotent check - iosxr_config: - commands: ['10 permit ipv4 any any log'] - parents: ['ipv4 access-list test'] - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - iosxr_config: - commands: ['no ipv4 access-list test'] - match: none - -- debug: msg="END cli/sublevel.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml b/test/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml deleted file mode 100644 index ddd429617b..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/sublevel_block.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -- debug: msg="START cli/sublevel_block.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.2 any log - - 30 permit ipv4 host 192.0.2.3 any log - parents: ['ipv4 access-list test'] - before: ['no ipv4 access-list test'] - match: none - -- name: configure sub level command using block resplace - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.2 any log - - 30 permit ipv4 host 192.0.2.3 any log - - 40 permit ipv4 host 192.0.2.4 any log - parents: ['ipv4 access-list test'] - replace: block - register: result - -- assert: - that: - - "result.changed == true" - - "'ipv4 access-list test' in result.commands" - - "'10 permit ipv4 host 192.0.2.1 any log' in result.commands" - - "'20 permit ipv4 host 192.0.2.2 any log' in result.commands" - - "'30 permit ipv4 host 192.0.2.3 any log' in result.commands" - - "'40 permit ipv4 host 192.0.2.4 any log' in result.commands" - -- name: check sub level command using block replace - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.2 any log - - 30 permit ipv4 host 192.0.2.3 any log - - 40 permit ipv4 host 192.0.2.4 any log - parents: ['ipv4 access-list test'] - replace: block - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - iosxr_config: - commands: ['no ipv4 access-list test'] - match: none - -- debug: msg="END cli/sublevel_block.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml b/test/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml deleted file mode 100644 index 9868b933a4..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/sublevel_exact.yaml +++ /dev/null @@ -1,58 +0,0 @@ ---- -- debug: msg="START cli/sublevel_exact.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.2 any log - - 30 permit ipv4 host 192.0.2.3 any log - - 40 permit ipv4 host 192.0.2.4 any log - - 50 permit ipv4 host 192.0.2.5 any log - parents: ['ipv4 access-list test'] - before: ['no ipv4 access-list test'] - match: none - -- name: configure sub level command using exact match - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.2 any log - - 30 permit ipv4 host 192.0.2.3 any log - - 40 permit ipv4 host 192.0.2.4 any log - parents: ['ipv4 access-list test'] - match: exact - register: result - -- assert: - that: - - "result.changed == true" - - "'ipv4 access-list test' in result.commands" - - "'10 permit ipv4 host 192.0.2.1 any log' in result.commands" - - "'20 permit ipv4 host 192.0.2.2 any log' in result.commands" - - "'30 permit ipv4 host 192.0.2.3 any log' in result.commands" - - "'40 permit ipv4 host 192.0.2.4 any log' in result.commands" - - "'50 permit ipv4 host 192.0.2.5 any log' not in result.commands" - -- name: check sub level command using exact match - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.2 any log - - 30 permit ipv4 host 192.0.2.3 any log - - 40 permit ipv4 host 192.0.2.4 any log - - 50 permit ipv4 host 192.0.2.5 any log - parents: ['ipv4 access-list test'] - match: exact - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - iosxr_config: - commands: ['no ipv4 access-list test'] - match: none - -- debug: msg="END cli/sublevel_exact.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml b/test/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml deleted file mode 100644 index 2c3c865189..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/sublevel_strict.yaml +++ /dev/null @@ -1,59 +0,0 @@ ---- -- debug: msg="START cli/sublevel_strict.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.3 any log - - 30 permit ipv4 host 192.0.2.2 any log - - 40 permit ipv4 host 192.0.2.4 any log - - 50 permit ipv4 host 192.0.2.5 any log - parents: ['ipv4 access-list test'] - before: ['no ipv4 access-list test'] - match: none - -- name: configure sub level command using strict match - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.2 any log - - 30 permit ipv4 host 192.0.2.3 any log - - 40 permit ipv4 host 192.0.2.4 any log - parents: ['ipv4 access-list test'] - before: ['no ipv4 access-list test'] - match: strict - replace: block - register: result - -- assert: - that: - - "result.changed == true" - - "'ipv4 access-list test' in result.commands" - - "'10 permit ipv4 host 192.0.2.1 any log' in result.commands" - - "'20 permit ipv4 host 192.0.2.2 any log' in result.commands" - - "'30 permit ipv4 host 192.0.2.3 any log' in result.commands" - - "'40 permit ipv4 host 192.0.2.4 any log' in result.commands" - - "'50 permit ipv4 host 192.0.2.5 any log' not in result.commands" - -- name: check sub level command using strict match - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.2 any log - - 30 permit ipv4 host 192.0.2.3 any log - - 40 permit ipv4 host 192.0.2.4 any log - parents: ['ipv4 access-list test'] - match: strict - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - iosxr_config: - commands: ['no ipv4 access-list test'] - match: none - -- debug: msg="END cli/sublevel_strict.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/sublevel_strict_mul_parents.yaml b/test/integration/targets/iosxr_config/tests/cli/sublevel_strict_mul_parents.yaml deleted file mode 100644 index b06c0570d5..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/sublevel_strict_mul_parents.yaml +++ /dev/null @@ -1,67 +0,0 @@ ---- -- debug: msg="START cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - lines: - - class-map match-any c1 - - match precedence 7 - - policy-map p1 - - class c1 - - set precedence 2 - before: ['no policy-map p1', 'no class-map match-any c1'] - match: none - -- name: configure sub level command using strict match - iosxr_config: - lines: - - set precedence 5 - - police rate percent 10 - parents: ['policy-map p1', 'class c1'] - match: strict - register: result - -- assert: - that: - - "result.changed == true" - - "'set precedence 5' in result.commands" - - "'police rate percent 10' in result.commands" - -- name: change sub level command order and config with strict match - iosxr_config: - lines: - - police rate percent 10 - - set precedence 5 - parents: ['policy-map p1', 'class c1'] - match: strict - register: result - -- assert: - that: - - "result.changed == true" - - "'set precedence 5' in result.commands" - - "'police rate percent 10' in result.commands" - -- name: Config sub level command with strict match (Idempotency) - iosxr_config: - lines: -#IOSxr does not change order of class action if reconfigured -#so we have to use old order for Idempotency - - set precedence 5 - - police rate percent 10 - parents: ['policy-map p1', 'class c1'] - match: strict - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - iosxr_config: - lines: - - no policy-map p1 - - no class-map match-any c1 - match: none - -- debug: msg="END cli/sublevel_strict_mul_parents.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/toplevel.yaml b/test/integration/targets/iosxr_config/tests/cli/toplevel.yaml deleted file mode 100644 index 01f9665fc9..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/toplevel.yaml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- debug: msg="START cli/toplevel.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: ['hostname {{ inventory_hostname_short }}'] - match: none - -- name: configure top level command - iosxr_config: - commands: ['hostname foo'] - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.commands" - -- name: configure top level command idempotent check - iosxr_config: - commands: ['hostname foo'] - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - iosxr_config: - commands: ['hostname {{ inventory_hostname_short }}'] - match: none - -- debug: msg="END cli/toplevel.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml b/test/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml deleted file mode 100644 index 7fcb78a7e3..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/toplevel_after.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- debug: msg="START cli/toplevel_after.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - "no cdp" - - "hostname {{ inventory_hostname_short }}" - match: none - -- name: configure top level command with before - iosxr_config: - commands: ['hostname foo'] - after: ['cdp'] - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.commands" - - "'cdp' in result.commands" - -- name: configure top level command with before idempotent check - iosxr_config: - commands: ['hostname foo'] - after: ['no cdp'] - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - iosxr_config: - commands: - - "no cdp" - - "hostname {{ inventory_hostname_short }}" - match: none - -- debug: msg="END cli/toplevel_after.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml b/test/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml deleted file mode 100644 index 4c264269cf..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/toplevel_before.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- debug: msg="START cli/toplevel_before.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: - - "no cdp" - - "hostname {{ inventory_hostname_short }}" - match: none - -- name: configure top level command with before - iosxr_config: - commands: ['hostname foo'] - before: ['cdp'] - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.commands" - - "'cdp' in result.commands" - -- name: configure top level command with before idempotent check - iosxr_config: - commands: ['hostname foo'] - before: ['cdp'] - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - iosxr_config: - commands: - - "no cdp" - - "hostname {{ inventory_hostname_short }}" - match: none - -- debug: msg="END cli/toplevel_before.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml b/test/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml deleted file mode 100644 index 084a38cc24..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli/toplevel_nonidempotent.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: msg="START cli/toplevel_nonidempotent.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - commands: ['hostname {{ inventory_hostname_short }}'] - match: none - -- name: configure top level command - iosxr_config: - commands: ['banner motd "hello world"', 'hostname foo'] - match: strict - register: result - -- assert: - that: - - "result.changed == true" - - "'hostname foo' in result.commands" - - "'banner motd \"hello world\"' in result.commands" - -- name: configure top level command idempotent check - iosxr_config: - commands: ['banner motd "hello world"', 'hostname foo'] - match: strict - register: result - -- assert: - that: - - "result.changed == true" - -- name: teardown - iosxr_config: - commands: ['hostname {{ inventory_hostname_short }}'] - match: none - -- debug: msg="END cli/toplevel_nonidempotent.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_config/tests/cli_config/cli_backup.yaml b/test/integration/targets/iosxr_config/tests/cli_config/cli_backup.yaml deleted file mode 100644 index a431c01fde..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli_config/cli_backup.yaml +++ /dev/null @@ -1,113 +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 - become: 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 }}" - become: yes - 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 - become: yes - 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 }}" - become: yes - 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/iosxr_config/tests/cli_config/cli_basic.yaml b/test/integration/targets/iosxr_config/tests/cli_config/cli_basic.yaml deleted file mode 100644 index 7d1ee14876..0000000000 --- a/test/integration/targets/iosxr_config/tests/cli_config/cli_basic.yaml +++ /dev/null @@ -1,33 +0,0 @@ ---- -- debug: msg="START cli_config/cli_basic.yaml on connection={{ ansible_connection }}" - -- name: setup - cli_config: &rm - config: | - interface Loopback999 - no description - no shutdown - become: yes - -- name: configure device with config - cli_config: &conf - config: "{{ lookup('template', 'basic/config.j2') }}" - register: result - become: yes - -- assert: - that: - - "result.changed == true" - -- name: Idempotence - cli_config: *conf - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - cli_config: *rm - -- debug: msg="END cli_config/cli_basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_facts/defaults/main.yaml b/test/integration/targets/iosxr_facts/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/iosxr_facts/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/iosxr_facts/meta/main.yml b/test/integration/targets/iosxr_facts/meta/main.yml deleted file mode 100644 index d4da833dd5..0000000000 --- a/test/integration/targets/iosxr_facts/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_facts/tasks/cli.yaml b/test/integration/targets/iosxr_facts/tasks/cli.yaml deleted file mode 100644 index 3f93a4f369..0000000000 --- a/test/integration/targets/iosxr_facts/tasks/cli.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - 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/iosxr_facts/tasks/main.yaml b/test/integration/targets/iosxr_facts/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_facts/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_facts/tests/cli/all_facts.yaml b/test/integration/targets/iosxr_facts/tests/cli/all_facts.yaml deleted file mode 100644 index eda117236c..0000000000 --- a/test/integration/targets/iosxr_facts/tests/cli/all_facts.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- debug: msg="START cli/all_facts.yaml on connection={{ ansible_connection }}" - - -- name: test getting all facts - iosxr_facts: - gather_subset: - - all - provider: "{{ cli }}" - register: result - -- assert: - that: - # _facts modules should never report a change - - "result.changed == false" - - # Correct subsets are present - - "'config' in result.ansible_facts.ansible_net_gather_subset" - - "'hardware' in result.ansible_facts.ansible_net_gather_subset" - - "'default' in result.ansible_facts.ansible_net_gather_subset" - - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" - - "result.ansible_facts.ansible_net_model == 'IOS XRv'" - # Items from those subsets are present - - "result.ansible_facts.ansible_net_filesystems is defined" - -- debug: msg="END cli/all_facts.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_facts/tests/cli/default_facts.yaml b/test/integration/targets/iosxr_facts/tests/cli/default_facts.yaml deleted file mode 100644 index d56132b734..0000000000 --- a/test/integration/targets/iosxr_facts/tests/cli/default_facts.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- debug: msg="START cli/default_facts.yaml on connection={{ ansible_connection }}" - - -- name: test getting default facts - iosxr_facts: - provider: "{{ cli }}" - register: result - -- assert: - that: - # _facts modules should never report a change - - "result.changed == false" - - # Correct subsets are present - - "'hardware' in result.ansible_facts.ansible_net_gather_subset" - - "'default' in result.ansible_facts.ansible_net_gather_subset" - - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" - - "result.ansible_facts.ansible_net_filesystems is defined" - # ... and not present - - "'config' not in result.ansible_facts.ansible_net_gather_subset" - - # Items from those subsets are present - - "result.ansible_facts.ansible_net_filesystems is defined" # hardware - - "result.ansible_facts.ansible_net_interfaces | length > 1" # more than one interface returned - - # ... and not present - - "result.ansible_facts.ansible_net_config is not defined" # config - -- debug: msg="END cli/default.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml b/test/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml deleted file mode 100644 index 188337ae44..0000000000 --- a/test/integration/targets/iosxr_facts/tests/cli/invalid_subset.yaml +++ /dev/null @@ -1,48 +0,0 @@ ---- -- debug: msg="START cli/invalid_subset.yaml on connection={{ ansible_connection }}" - - -- name: test invalid subset (foobar) - iosxr_facts: - gather_subset: - - "foobar" - provider: "{{ cli }}" - register: result - ignore_errors: true - - -- assert: - that: - # Failures shouldn't return changes - - "result.changed == false" - # It's a failure - - "result.failed == true" - # Sensible Failure message - - "result.msg == 'Subset must be one of [config, default, hardware, interfaces], got foobar'" - -############### -# FIXME Future -# We may in the future want to add a test for - -- name: test subset specified multiple times - iosxr_facts: - gather_subset: - - "!hardware" - - "hardware" - provider: "{{ cli }}" - register: result - ignore_errors: true - -- assert: - that: - # Failures shouldn't return changes - - "result.changed == false" - # It's a failure - - "result.failed == true" - # Sensible Failure message - - "result.msg == 'Bad subset'" - ignore_errors: true - - - -- debug: msg="END cli/invalid_subset.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml b/test/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml deleted file mode 100644 index 325d07be99..0000000000 --- a/test/integration/targets/iosxr_facts/tests/cli/not_hardware.yaml +++ /dev/null @@ -1,30 +0,0 @@ ---- -- debug: msg="START cli/not_hardware_facts.yaml on connection={{ ansible_connection }}" - - -- name: test not hardware - iosxr_facts: - gather_subset: - - "!hardware" - provider: "{{ cli }}" - register: result - -- assert: - that: - # _facts modules should never report a change - - "result.changed == false" - - # Correct subsets are present - - "'config' in result.ansible_facts.ansible_net_gather_subset" - - - "'default' in result.ansible_facts.ansible_net_gather_subset" - - "'interfaces' in result.ansible_facts.ansible_net_gather_subset" - # ... and not present - - "'hardware' not in result.ansible_facts.ansible_net_gather_subset" - - # Items from those subsets are present - - "result.ansible_facts.ansible_net_interfaces | length > 1" # more than one interface returned - # ... and not present - - "result.ansible_facts.ansible_net_filesystems is not defined" - -- debug: msg="END cli/not_hardware_facts.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_interface/defaults/main.yaml b/test/integration/targets/iosxr_interface/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/iosxr_interface/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/iosxr_interface/meta/main.yaml b/test/integration/targets/iosxr_interface/meta/main.yaml deleted file mode 100644 index d4da833dd5..0000000000 --- a/test/integration/targets/iosxr_interface/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_interface/tasks/cli.yaml b/test/integration/targets/iosxr_interface/tasks/cli.yaml deleted file mode 100644 index 3f93a4f369..0000000000 --- a/test/integration/targets/iosxr_interface/tasks/cli.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - 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/iosxr_interface/tasks/main.yaml b/test/integration/targets/iosxr_interface/tasks/main.yaml deleted file mode 100644 index af08869c92..0000000000 --- a/test/integration/targets/iosxr_interface/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: netconf.yaml, tags: ['netconf'] } diff --git a/test/integration/targets/iosxr_interface/tasks/netconf.yaml b/test/integration/targets/iosxr_interface/tasks/netconf.yaml deleted file mode 100644 index 5e492412ad..0000000000 --- a/test/integration/targets/iosxr_interface/tasks/netconf.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: collect all netconf test cases - find: - paths: "{{ role_path }}/tests/netconf" - 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 cases (connection=netconf) - include: "{{ test_case_to_run }} ansible_connection=netconf" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - -# Only one of the Testcase would be run to check if `connection: local` -# is established. Full suite is run with `connection:network_cli` or `connection:netconf` -- 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/iosxr_interface/tests/cli/basic.yaml b/test/integration/targets/iosxr_interface/tests/cli/basic.yaml deleted file mode 100644 index 403893d81f..0000000000 --- a/test/integration/targets/iosxr_interface/tests/cli/basic.yaml +++ /dev/null @@ -1,263 +0,0 @@ ---- -- debug: msg="START iosxr_interface cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Setup interface - iosxr_interface: - name: GigabitEthernet0/0/0/2 - state: absent - provider: "{{ cli }}" - register: result - - -- name: Confgure interface - iosxr_interface: - name: GigabitEthernet0/0/0/2 - description: test-interface-initial - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/2 description test-interface-initial" in result.commands' - -- name: Confgure interface (idempotent) - iosxr_interface: - name: GigabitEthernet0/0/0/2 - description: test-interface-initial - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Confgure interface parameters - iosxr_interface: - name: GigabitEthernet0/0/0/2 - description: test-interface - speed: 100 - duplex: half - mtu: 512 - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/2 description test-interface" in result.commands' - - '"interface GigabitEthernet0/0/0/2 speed 100" in result.commands' - - '"interface GigabitEthernet0/0/0/2 duplex half" in result.commands' - - '"interface GigabitEthernet0/0/0/2 mtu 512" in result.commands' - -- name: Change interface parameters - iosxr_interface: - name: GigabitEthernet0/0/0/2 - description: test-interface-1 - speed: 10 - duplex: full - mtu: 256 - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/2 description test-interface-1" in result.commands' - - '"interface GigabitEthernet0/0/0/2 speed 10" in result.commands' - - '"interface GigabitEthernet0/0/0/2 duplex full" in result.commands' - - '"interface GigabitEthernet0/0/0/2 mtu 256" in result.commands' - -- name: Change interface parameters (idempotent) - iosxr_interface: - name: GigabitEthernet0/0/0/2 - description: test-interface-1 - speed: 10 - duplex: full - mtu: 256 - state: present - provider: "{{ cli }}" - register: result -- assert: - that: - - 'result.changed == false' - -- name: Disable interface - iosxr_interface: - name: GigabitEthernet0/0/0/2 - enabled: False - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/2 shutdown" in result.commands' - -- name: Enable interface - iosxr_interface: - name: GigabitEthernet0/0/0/2 - enabled: True - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"no interface GigabitEthernet0/0/0/2 shutdown" in result.commands' - -- name: Confgure second interface (setup) - iosxr_interface: - name: GigabitEthernet0/0/0/3 - description: test-interface-initial - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/3 description test-interface-initial" in result.commands' - -- name: Delete interface aggregate (setup) - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/3 - - name: GigabitEthernet0/0/0/2 - state: absent - provider: "{{ cli }}" - -- name: Add interface aggregate - iosxr_interface: - aggregate: - - { name: GigabitEthernet0/0/0/3, mtu: 256, description: test-interface-1 } - - { name: GigabitEthernet0/0/0/2, mtu: 516, description: test-interface-2 } - speed: 100 - duplex: full - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/3 speed 100" in result.commands' - - '"interface GigabitEthernet0/0/0/3 description test-interface-1" in result.commands' - - '"interface GigabitEthernet0/0/0/3 duplex full" in result.commands' - - '"interface GigabitEthernet0/0/0/3 mtu 256" in result.commands' - - '"interface GigabitEthernet0/0/0/2 speed 100" in result.commands' - - '"interface GigabitEthernet0/0/0/2 description test-interface-2" in result.commands' - - '"interface GigabitEthernet0/0/0/2 duplex full" in result.commands' - - '"interface GigabitEthernet0/0/0/2 mtu 516" in result.commands' - - -- name: Add interface aggregate (idempotent) - iosxr_interface: - aggregate: - - { name: GigabitEthernet0/0/0/3, mtu: 256, description: test-interface-1 } - - { name: GigabitEthernet0/0/0/2, mtu: 516, description: test-interface-2 } - speed: 100 - duplex: full - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Disable interface aggregate - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/3 - - name: GigabitEthernet0/0/0/2 - enabled: False - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/3 shutdown" in result.commands' - - '"interface GigabitEthernet0/0/0/2 shutdown" in result.commands' - -- name: Enable interface aggregate - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/3 - - name: GigabitEthernet0/0/0/2 - enabled: True - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"no interface GigabitEthernet0/0/0/3 shutdown" in result.commands' - - '"no interface GigabitEthernet0/0/0/2 shutdown" in result.commands' - -- name: interface aggregate (setup) - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/4 - - name: GigabitEthernet0/0/0/5 - description: test-interface-initial - provider: "{{ cli }}" - register: result - -- name: Create interface aggregate - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/4 - description: test_interface_1 - - name: GigabitEthernet0/0/0/5 - description: test_interface_2 - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/4 description test_interface_1" in result.commands' - - '"interface GigabitEthernet0/0/0/5 description test_interface_2" in result.commands' - -- name: Delete interface aggregate - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/2 - - name: GigabitEthernet0/0/0/3 - - name: GigabitEthernet0/0/0/4 - - name: GigabitEthernet0/0/0/5 - state: absent - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"no interface GigabitEthernet0/0/0/4" in result.commands' - - '"no interface GigabitEthernet0/0/0/5" in result.commands' - -- name: Delete interface aggregate (idempotent) - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/2 - - name: GigabitEthernet0/0/0/3 - - name: GigabitEthernet0/0/0/4 - - name: GigabitEthernet0/0/0/5 - state: absent - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == false' - -- debug: msg="END iosxr_interface cli/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_interface/tests/cli/intent.yaml b/test/integration/targets/iosxr_interface/tests/cli/intent.yaml deleted file mode 100644 index 3227bad78c..0000000000 --- a/test/integration/targets/iosxr_interface/tests/cli/intent.yaml +++ /dev/null @@ -1,78 +0,0 @@ ---- -- debug: msg="START iosxr_interface cli/intent.yaml on connection={{ ansible_connection }}" - -- name: Setup (interface is up) - iosxr_interface: - name: GigabitEthernet0/0/0/1 - description: test_interface_1 - enabled: True - state: present - provider: "{{ cli }}" - register: result - -- name: Check intent arguments - iosxr_interface: - name: GigabitEthernet0/0/0/1 - state: up - delay: 20 - provider: "{{ cli }}" - register: result - -- assert: - that: - - "result.failed == false" - -- name: Check intent arguments (failed condition) - iosxr_interface: - name: GigabitEthernet0/0/0/1 - state: down - provider: "{{ cli }}" - ignore_errors: yes - register: result - -- assert: - that: - - "result.failed == true" - - "'state eq(down)' in result.failed_conditions" - -- name: Config + intent - iosxr_interface: - name: GigabitEthernet0/0/0/1 - enabled: False - state: down - delay: 20 - provider: "{{ cli }}" - register: result - -- assert: - that: - - "result.failed == false" - -- name: Config + intent (fail) - iosxr_interface: - name: GigabitEthernet0/0/0/1 - enabled: False - state: up - provider: "{{ cli }}" - ignore_errors: yes - register: result - -- assert: - that: - - "result.failed == true" - - "'state eq(up)' in result.failed_conditions" - -- name: Aggregate config + intent (pass) - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/1 - enabled: True - state: up - delay: 20 - provider: "{{ cli }}" - ignore_errors: yes - register: result - -- assert: - that: - - "result.failed == false" diff --git a/test/integration/targets/iosxr_interface/tests/cli/net_interface.yaml b/test/integration/targets/iosxr_interface/tests/cli/net_interface.yaml deleted file mode 100644 index 7beef4440c..0000000000 --- a/test/integration/targets/iosxr_interface/tests/cli/net_interface.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -- debug: msg="START iosxr cli/net_interface.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Setup interface - net_interface: - name: GigabitEthernet0/0/0/2 - state: absent - provider: "{{ cli }}" - register: result - - -- name: Confgure interface using platform agnostic module - net_interface: - name: GigabitEthernet0/0/0/2 - description: test-interface-initial - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/2 description test-interface-initial" in result.commands' - -- name: Confgure interface parameters using platform agnostic module - net_interface: - name: GigabitEthernet0/0/0/2 - description: test-interface - speed: 100 - duplex: half - mtu: 512 - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"interface GigabitEthernet0/0/0/2 description test-interface" in result.commands' - - '"interface GigabitEthernet0/0/0/2 speed 100" in result.commands' - - '"interface GigabitEthernet0/0/0/2 duplex half" in result.commands' - - '"interface GigabitEthernet0/0/0/2 mtu 512" in result.commands' - -- name: Teardown interface - net_interface: - name: GigabitEthernet0/0/0/2 - state: absent - provider: "{{ cli }}" - register: result - -- debug: msg="END iosxr cli/net_interface.yaml on connection={{ ansible_connection }}"
\ No newline at end of file diff --git a/test/integration/targets/iosxr_interface/tests/netconf/basic.yaml b/test/integration/targets/iosxr_interface/tests/netconf/basic.yaml deleted file mode 100644 index beb2c2d70d..0000000000 --- a/test/integration/targets/iosxr_interface/tests/netconf/basic.yaml +++ /dev/null @@ -1,276 +0,0 @@ ---- -- debug: msg="START iosxr_interface netconf/basic.yaml" - -- name: Setup interface - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/0 - - name: GigabitEthernet0/0/0/1 - state: absent - provider: "{{ netconf }}" - register: result - - -- name: Confgure interface - iosxr_interface: - name: GigabitEthernet0/0/0/1 - description: test-interface-initial - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"GigabitEthernet0/0/0/1" in result.xml[0]' - -- name: Confgure interface (idempotent) - iosxr_interface: - name: GigabitEthernet0/0/0/1 - description: test-interface-initial - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Confgure interface parameters - iosxr_interface: - name: GigabitEthernet0/0/0/1 - description: test-interface - speed: 100 - duplex: half - mtu: 512 - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"GigabitEthernet0/0/0/1" in result.xml[0]' - - '"test-interface" in result.xml[0]' - - '"100" in result.xml[0]' - - '"512" in result.xml[0]' - -- name: Change interface parameters - iosxr_interface: - name: GigabitEthernet0/0/0/1 - description: test-interface-1 - speed: 10 - duplex: full - mtu: 256 - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"GigabitEthernet0/0/0/1" in result.xml[0]' - - '"test-interface-1" in result.xml[0]' - - '"10" in result.xml[0]' - - '"256" in result.xml[0]' - -- name: Change interface parameters (idempotent) - iosxr_interface: - name: GigabitEthernet0/0/0/1 - description: test-interface-1 - speed: 10 - duplex: full - mtu: 256 - state: present - provider: "{{ netconf }}" - register: result -- assert: - that: - - 'result.changed == false' - -- name: Disable interface - iosxr_interface: - name: GigabitEthernet0/0/0/1 - enabled: False - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - -- name: Enable interface - iosxr_interface: - name: GigabitEthernet0/0/0/1 - enabled: True - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - -- name: Confgure second interface (setup) - iosxr_interface: - name: GigabitEthernet0/0/0/0 - description: test-interface-initial - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"GigabitEthernet0/0/0/0" in result.xml[0]' - -- name: Delete interface aggregate (setup) - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/0 - - name: GigabitEthernet0/0/0/1 - state: absent - provider: "{{ netconf }}" - -- name: Add interface aggregate - iosxr_interface: - aggregate: - - { name: GigabitEthernet0/0/0/0, mtu: 256, description: test-interface-1 } - - { name: GigabitEthernet0/0/0/1, mtu: 516, description: test-interface-2 } - speed: 100 - duplex: full - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"GigabitEthernet0/0/0/1" in result.xml[0]' - - '"GigabitEthernet0/0/0/0" in result.xml[0]' - -- name: Add interface aggregate (idempotent) - iosxr_interface: - aggregate: - - { name: GigabitEthernet0/0/0/0, mtu: 256, description: test-interface-1 } - - { name: GigabitEthernet0/0/0/1, mtu: 516, description: test-interface-2 } - speed: 100 - duplex: full - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Disable interface aggregate - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/0 - - name: GigabitEthernet0/0/0/1 - enabled: False - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - -- name: Disable interface aggregate (idempotent) - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/0 - - name: GigabitEthernet0/0/0/1 - enabled: False - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == false' - -- name: Enable interface aggregate - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/0 - - name: GigabitEthernet0/0/0/1 - enabled: True - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - -- name: Enable interface aggregate - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/0 - - name: GigabitEthernet0/0/0/1 - enabled: True - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == false' - -- name: interface aggregate (setup) - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/0 - - name: GigabitEthernet0/0/0/1 - description: test-interface-initial - provider: "{{ netconf }}" - register: result - -- name: Create interface aggregate - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/0 - description: test_interface_1 - - name: GigabitEthernet0/0/0/1 - description: test_interface_2 - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"GigabitEthernet0/0/0/0" in result.xml[0]' - - '"GigabitEthernet0/0/0/1" in result.xml[0]' - - '"test_interface_1" in result.xml[0]' - - '"test_interface_2" in result.xml[0]' - -- name: Delete interface aggregate - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/0 - - name: GigabitEthernet0/0/0/1 - state: absent - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - -- name: Delete interface aggregate (idempotent) - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/0 - - name: GigabitEthernet0/0/0/1 - state: absent - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == false' - -- debug: msg="END iosxr_interface netconf/basic.yaml" diff --git a/test/integration/targets/iosxr_interface/tests/netconf/intent.yaml b/test/integration/targets/iosxr_interface/tests/netconf/intent.yaml deleted file mode 100644 index 5d8d07f888..0000000000 --- a/test/integration/targets/iosxr_interface/tests/netconf/intent.yaml +++ /dev/null @@ -1,78 +0,0 @@ ---- -- debug: msg="START iosxr_interface netconf/intent.yaml" - -- name: Setup (interface is up) - iosxr_interface: - name: GigabitEthernet0/0/0/1 - description: test_interface_1 - enabled: True - state: present - provider: "{{ netconf }}" - register: result - -- name: Check intent arguments - iosxr_interface: - name: GigabitEthernet0/0/0/1 - state: up - delay: 10 - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.failed == false" - -- name: Check intent arguments (failed condition) - iosxr_interface: - name: GigabitEthernet0/0/0/1 - state: down - provider: "{{ netconf }}" - ignore_errors: yes - register: result - -- assert: - that: - - "result.failed == true" - - "'state eq(down)' in result.failed_conditions" - -- name: Config + intent - iosxr_interface: - name: GigabitEthernet0/0/0/1 - enabled: False - state: down - delay: 10 - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.failed == false" - -- name: Config + intent (fail) - iosxr_interface: - name: GigabitEthernet0/0/0/1 - enabled: False - state: up - provider: "{{ netconf }}" - ignore_errors: yes - register: result - -- assert: - that: - - "result.failed == true" - - "'state eq(up)' in result.failed_conditions" - -- name: Aggregate config + intent (pass) - iosxr_interface: - aggregate: - - name: GigabitEthernet0/0/0/1 - enabled: True - state: up - delay: 10 - provider: "{{ netconf }}" - ignore_errors: yes - register: result - -- assert: - that: - - "result.failed == false" diff --git a/test/integration/targets/iosxr_interface/tests/netconf/net_interface.yaml b/test/integration/targets/iosxr_interface/tests/netconf/net_interface.yaml deleted file mode 100644 index 3310645f7d..0000000000 --- a/test/integration/targets/iosxr_interface/tests/netconf/net_interface.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- debug: msg="START iosxr netconf/net_interface.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Setup interface - net_interface: - name: GigabitEthernet0/0/0/1 - state: absent - provider: "{{ netconf }}" - register: result - - -- name: Confgure interface using platform agnostic module - net_interface: - name: GigabitEthernet0/0/0/1 - description: test-interface-initial - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"GigabitEthernet0/0/0/1" in result.xml[0]' - -- name: Confgure interface parameters using platform agnostic module - net_interface: - name: GigabitEthernet0/0/0/1 - description: test-interface - speed: 100 - duplex: half - mtu: 512 - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"GigabitEthernet0/0/0/1" in result.xml[0]' - - '"test-interface" in result.xml[0]' - - '"100" in result.xml[0]' - - '"512" in result.xml[0]' - -- debug: msg="END iosxr netconf/net_interface.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_interfaces/defaults/main.yaml b/test/integration/targets/iosxr_interfaces/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/iosxr_interfaces/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/iosxr_interfaces/meta/main.yaml b/test/integration/targets/iosxr_interfaces/meta/main.yaml deleted file mode 100644 index 32cf5dda7e..0000000000 --- a/test/integration/targets/iosxr_interfaces/meta/main.yaml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/test/integration/targets/iosxr_interfaces/tasks/cli.yaml b/test/integration/targets/iosxr_interfaces/tasks/cli.yaml deleted file mode 100644 index 337e34133b..0000000000 --- a/test/integration/targets/iosxr_interfaces/tasks/cli.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: Set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - delegate_to: localhost - -- name: Run test case (connection=network_cli) - include: "{{ test_case_to_run }}" - vars: - ansible_connection: network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_interfaces/tasks/main.yaml b/test/integration/targets/iosxr_interfaces/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_interfaces/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_interfaces/tests/cli/_populate_config.yaml b/test/integration/targets/iosxr_interfaces/tests/cli/_populate_config.yaml deleted file mode 100644 index 39d844a4d8..0000000000 --- a/test/integration/targets/iosxr_interfaces/tests/cli/_populate_config.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: Populate Config - cli_config: - config: "{{ lines }}" - vars: - lines: | - interface GigabitEthernet 0/0/0/0 - description this is interface0 - mtu 65 - speed 10 - no shutdown - interface GigabitEthernet 0/0/0/1 - description this is interface1 - mtu 65 - speed 10 - no shutdown diff --git a/test/integration/targets/iosxr_interfaces/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_interfaces/tests/cli/_remove_config.yaml deleted file mode 100644 index 650c581114..0000000000 --- a/test/integration/targets/iosxr_interfaces/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,23 +0,0 @@ ---- -- name: Remove Config - cli_config: - config: "{{ lines }}" - vars: - lines: | - interface loopback888 - no description - no shutdown - interface loopback999 - no description - no shutdown - -- name: Remove interfaces from config before actual testing - iosxr_config: - lines: - - "no interface {{ item }}" - loop: - - GigabitEthernet 0/0/0/0 - - GigabitEthernet 0/0/0/1 - - GigabitEthernet 0/0/0/2 - - GigabitEthernet 0/0/0/3 - ignore_errors: yes diff --git a/test/integration/targets/iosxr_interfaces/tests/cli/deleted.yaml b/test/integration/targets/iosxr_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index 9b0cede985..0000000000 --- a/test/integration/targets/iosxr_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- debug: - msg: "Start Deleted integration state for iosxr_interfaces ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Delete attributes of all configured interfaces - iosxr_interfaces: &deleted - state: deleted - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ deleted['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Delete attributes of all configured interfaces (IDEMPOTENT) - iosxr_interfaces: *deleted - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_interfaces/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_interfaces/tests/cli/empty_config.yaml deleted file mode 100644 index 3ee4239b4e..0000000000 --- a/test/integration/targets/iosxr_interfaces/tests/cli/empty_config.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: - msg: "START iosxr_interfaces empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - iosxr_interfaces: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - iosxr_interfaces: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' - -- name: Overridden with empty config should give appropriate error message - iosxr_interfaces: - config: - state: overridden - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state overridden'
\ No newline at end of file diff --git a/test/integration/targets/iosxr_interfaces/tests/cli/merged.yaml b/test/integration/targets/iosxr_interfaces/tests/cli/merged.yaml deleted file mode 100644 index 83738e4c38..0000000000 --- a/test/integration/targets/iosxr_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,52 +0,0 @@ ---- -- debug: - msg: "START Merged iosxr_interfaces state for integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Merge provided configuration with device configuration - iosxr_interfaces: &merged - config: - - name: GigabitEthernet0/0/0/0 - description: 'Configured and Merged by Ansible-Network' - mtu: 110 - enabled: True - duplex: half - - name: GigabitEthernet0/0/0/1 - description: 'Configured and Merged by Ansible-Network' - mtu: 2800 - enabled: False - speed: 100 - duplex: full - state: merged - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ merged['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Merge provided configuration with device configuration (IDEMPOTENT) - iosxr_interfaces: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml
\ No newline at end of file diff --git a/test/integration/targets/iosxr_interfaces/tests/cli/overridden.yaml b/test/integration/targets/iosxr_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index 7aa789d9d2..0000000000 --- a/test/integration/targets/iosxr_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- debug: - msg: "START Overridden iosxr_interfaces state for integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Override device configuration of all interfaces with provided configuration - iosxr_interfaces: &overridden - config: - - name: GigabitEthernet0/0/0/1 - description: 'Configured and Overridden by Ansible-Network' - enabled: False - duplex: full - mtu: 2000 - speed: 100 - state: overridden - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ overridden['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Override device configuration of all interfaces with provided configuration (IDEMPOTENT) - iosxr_interfaces: *overridden - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_interfaces/tests/cli/replaced.yaml b/test/integration/targets/iosxr_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index 292b25dd05..0000000000 --- a/test/integration/targets/iosxr_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- debug: - msg: "START Replaced iosxr_interfaces state for integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Replaces device configuration of listed interfaces with provided configuration - iosxr_interfaces: &replaced - config: - - name: GigabitEthernet0/0/0/0 - description: 'Configured and Replaced by Ansible-Network' - mtu: 110 - - name: GigabitEthernet0/0/0/1 - description: 'Configured and Replaced by Ansible-Network' - speed: 100 - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ replaced['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Replaces device configuration of listed interfaces with provided configuration (IDEMPOTENT) - iosxr_interfaces: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_interfaces/vars/main.yaml b/test/integration/targets/iosxr_interfaces/vars/main.yaml deleted file mode 100644 index 18411e162e..0000000000 --- a/test/integration/targets/iosxr_interfaces/vars/main.yaml +++ /dev/null @@ -1,162 +0,0 @@ ---- -merged: - before: - - enabled: true - name: Loopback888 - - enabled: true - name: Loopback999 - - description: this is interface0 - enabled: true - mtu: 65 - name: GigabitEthernet0/0/0/0 - speed: 10 - - description: this is interface1 - enabled: true - mtu: 65 - name: GigabitEthernet0/0/0/1 - speed: 10 - - commands: - - "interface GigabitEthernet0/0/0/0" - - "description Configured and Merged by Ansible-Network" - - "mtu 110" - - "duplex half" - - "interface GigabitEthernet0/0/0/1" - - "description Configured and Merged by Ansible-Network" - - "mtu 2800" - - "speed 100" - - "duplex full" - - "shutdown" - - after: - - enabled: true - name: Loopback888 - - enabled: true - name: Loopback999 - - description: Configured and Merged by Ansible-Network - duplex: half - enabled: true - mtu: 110 - name: GigabitEthernet0/0/0/0 - speed: 10 - - description: Configured and Merged by Ansible-Network - duplex: full - enabled: false - mtu: 2800 - name: GigabitEthernet0/0/0/1 - speed: 100 - -replaced: - before: - - enabled: true - name: Loopback888 - - enabled: true - name: Loopback999 - - description: this is interface0 - enabled: true - mtu: 65 - name: GigabitEthernet0/0/0/0 - speed: 10 - - description: this is interface1 - enabled: true - mtu: 65 - name: GigabitEthernet0/0/0/1 - speed: 10 - - commands: - - "interface GigabitEthernet0/0/0/0" - - "no speed" - - "description Configured and Replaced by Ansible-Network" - - "mtu 110" - - "interface GigabitEthernet0/0/0/1" - - "no mtu" - - "description Configured and Replaced by Ansible-Network" - - "speed 100" - - after: - - enabled: true - name: Loopback888 - - enabled: true - name: Loopback999 - - description: Configured and Replaced by Ansible-Network - enabled: true - mtu: 110 - name: GigabitEthernet0/0/0/0 - - description: Configured and Replaced by Ansible-Network - enabled: true - name: GigabitEthernet0/0/0/1 - speed: 100 - -overridden: - before: - - enabled: true - name: Loopback888 - - enabled: true - name: Loopback999 - - description: this is interface0 - enabled: true - mtu: 65 - name: GigabitEthernet0/0/0/0 - speed: 10 - - description: this is interface1 - enabled: true - mtu: 65 - name: GigabitEthernet0/0/0/1 - speed: 10 - - commands: - - "interface GigabitEthernet0/0/0/0" - - "no description" - - "no speed" - - "no mtu" - - "interface GigabitEthernet0/0/0/1" - - "description Configured and Overridden by Ansible-Network" - - "mtu 2000" - - "duplex full" - - "speed 100" - - "shutdown" - - after: - - enabled: true - name: Loopback888 - - enabled: true - name: Loopback999 - - description: Configured and Overridden by Ansible-Network - duplex: full - enabled: false - mtu: 2000 - name: GigabitEthernet0/0/0/1 - speed: 100 - -deleted: - before: - - enabled: true - name: Loopback888 - - enabled: true - name: Loopback999 - - description: this is interface0 - enabled: true - mtu: 65 - name: GigabitEthernet0/0/0/0 - speed: 10 - - description: this is interface1 - enabled: true - mtu: 65 - name: GigabitEthernet0/0/0/1 - speed: 10 - - commands: - - "interface GigabitEthernet0/0/0/0" - - "no description" - - "no speed" - - "no mtu" - - "interface GigabitEthernet0/0/0/1" - - "no description" - - "no speed" - - "no mtu" - - after: - - enabled: true - name: Loopback888 - - enabled: true - name: Loopback999 diff --git a/test/integration/targets/iosxr_l2_interfaces/defaults/main.yaml b/test/integration/targets/iosxr_l2_interfaces/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/iosxr_l2_interfaces/meta/main.yaml b/test/integration/targets/iosxr_l2_interfaces/meta/main.yaml deleted file mode 100644 index 32cf5dda7e..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/meta/main.yaml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/test/integration/targets/iosxr_l2_interfaces/tasks/cli.yaml b/test/integration/targets/iosxr_l2_interfaces/tasks/cli.yaml deleted file mode 100644 index 337e34133b..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/tasks/cli.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: Set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - delegate_to: localhost - -- name: Run test case (connection=network_cli) - include: "{{ test_case_to_run }}" - vars: - ansible_connection: network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_l2_interfaces/tasks/main.yaml b/test/integration/targets/iosxr_l2_interfaces/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_l2_interfaces/tests/cli/_populate_config.yaml b/test/integration/targets/iosxr_l2_interfaces/tests/cli/_populate_config.yaml deleted file mode 100644 index cab1e156d9..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/tests/cli/_populate_config.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- name: Populate Config - cli_config: - config: "{{ lines }}" - vars: - lines: | - interface GigabitEthernet 0/0/0/1 - dot1q native vlan 10 - l2transport l2protocol cdp forward - l2transport propagate remote-status - interface GigabitEthernet 0/0/0/4 - dot1q native vlan 20 - l2transport l2protocol vtp tunnel - interface GigabitEthernet 0/0/0/3.900 - dot1q vlan 40 60 diff --git a/test/integration/targets/iosxr_l2_interfaces/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_l2_interfaces/tests/cli/_remove_config.yaml deleted file mode 100644 index 4484fbe8fd..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- name: Remove Config - cli_config: - config: "{{ lines }}" - vars: - lines: | - interface GigabitEthernet 0/0/0/1 - no dot1q native vlan - no l2transport - no interface GigabitEthernet 0/0/0/2 - no interface GigabitEthernet 0/0/0/3 - no interface GigabitEthernet 0/0/0/3.900 - no interface GigabitEthernet 0/0/0/4 diff --git a/test/integration/targets/iosxr_l2_interfaces/tests/cli/deleted.yaml b/test/integration/targets/iosxr_l2_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index cd241dce12..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,40 +0,0 @@ ---- -- debug: - msg: "Start Deleted integration state for ios_interfaces ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Delete L2 interfaces attributes of all configured interfaces - iosxr_l2_interfaces: &deleted - state: deleted - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ deleted['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Delete L2 interfaces attributes of all configured interfaces (IDEMPOTENT) - iosxr_l2_interfaces: *deleted - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - always: - - include_tasks: _remove_config.yaml
\ No newline at end of file diff --git a/test/integration/targets/iosxr_l2_interfaces/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_l2_interfaces/tests/cli/empty_config.yaml deleted file mode 100644 index 56aa670f19..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/tests/cli/empty_config.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: - msg: "START iosxr_l2_interfaces empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - iosxr_l2_interfaces: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - iosxr_l2_interfaces: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' - -- name: Overridden with empty config should give appropriate error message - iosxr_l2_interfaces: - config: - state: overridden - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state overridden'
\ No newline at end of file diff --git a/test/integration/targets/iosxr_l2_interfaces/tests/cli/merged.yaml b/test/integration/targets/iosxr_l2_interfaces/tests/cli/merged.yaml deleted file mode 100644 index 7ed169504e..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,52 +0,0 @@ ---- -- debug: - msg: "START Merged ios_interfaces state for integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Merge provided L2 configuration with device configuration - iosxr_l2_interfaces: &merged - config: - - name: GigabitEthernet0/0/0/1 - native_vlan: 10 - l2transport: True - l2protocol: - - pvst: tunnel - - cdp: forward - propagate: True - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 20 - - 40 - - name: GigabitEthernet0/0/0/4 - native_vlan: 40 - state: merged - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ merged['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Merge provided L2 configuration with device configuration (IDEMPOTENT) - iosxr_l2_interfaces: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_l2_interfaces/tests/cli/overridden.yaml b/test/integration/targets/iosxr_l2_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index f9ed4bf725..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- -- debug: - msg: "START Overridden ios_interfaces state for integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Override device L2 configuration of all interfaces with provided configuration - iosxr_l2_interfaces: &overridden - config: - - name: GigabitEthernet0/0/0/4 - native_vlan: 40 - l2transport: True - l2protocol: - - stp: forward - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 20 - - 40 - state: overridden - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ overridden['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Override device L2 configuration of all interfaces with provided configuration (IDEMPOTENT) - iosxr_l2_interfaces: *overridden - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_l2_interfaces/tests/cli/replaced.yaml b/test/integration/targets/iosxr_l2_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index a9e2c76a5d..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- debug: - msg: "START Replaced ios_interfaces state for integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Replaces device L2 configuration of listed interfaces with provided configuration - iosxr_l2_interfaces: &replaced - config: - - name: GigabitEthernet0/0/0/1 - native_vlan: 40 - l2transport: True - l2protocol: - - vtp: tunnel - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ replaced['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Replaces device L2 configuration of listed interfaces with provided configuration (IDEMPOTENT) - iosxr_l2_interfaces: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_l2_interfaces/vars/main.yaml b/test/integration/targets/iosxr_l2_interfaces/vars/main.yaml deleted file mode 100644 index 5756b341bf..0000000000 --- a/test/integration/targets/iosxr_l2_interfaces/vars/main.yaml +++ /dev/null @@ -1,142 +0,0 @@ ---- -merged: - before: [] - - commands: - - interface GigabitEthernet0/0/0/1 - - dot1q native vlan 10 - - l2transport l2protocol pvst tunnel - - l2transport l2protocol cdp forward - - l2transport propagate remote-status - - interface GigabitEthernet0/0/0/3.900 - - dot1q vlan 20 40 - - interface GigabitEthernet0/0/0/4 - - dot1q native vlan 40 - - after: - - l2protocol: - - cdp: forward - - pvst: tunnel - l2transport: true - name: GigabitEthernet0/0/0/1 - native_vlan: 10 - propagate: true - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 20 - - 40 - - name: GigabitEthernet0/0/0/4 - native_vlan: 40 - - -replaced: - before: - - l2protocol: - - cdp: forward - l2transport: true - name: GigabitEthernet0/0/0/1 - native_vlan: 10 - propagate: true - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 40 - - 60 - - l2protocol: - - vtp: tunnel - l2transport: true - name: GigabitEthernet0/0/0/4 - native_vlan: 20 - - commands: - - interface GigabitEthernet0/0/0/1 - - no l2transport - - dot1q native vlan 40 - - l2transport l2protocol vtp tunnel - - after: - - l2protocol: - - vtp: tunnel - l2transport: true - name: GigabitEthernet0/0/0/1 - native_vlan: 40 - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 40 - - 60 - - l2protocol: - - vtp: tunnel - l2transport: true - name: GigabitEthernet0/0/0/4 - native_vlan: 20 - -overridden: - before: - - l2protocol: - - cdp: forward - l2transport: true - name: GigabitEthernet0/0/0/1 - native_vlan: 10 - propagate: true - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 40 - - 60 - - l2protocol: - - vtp: tunnel - l2transport: true - name: GigabitEthernet0/0/0/4 - native_vlan: 20 - - commands: - - interface GigabitEthernet0/0/0/1 - - no dot1q native vlan - - no l2transport - - interface GigabitEthernet0/0/0/3.900 - - dot1q vlan 20 40 - - interface GigabitEthernet0/0/0/4 - - no l2transport - - dot1q native vlan 40 - - l2transport l2protocol stp forward - - after: - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 20 - - 40 - - l2protocol: - - stp: forward - l2transport: true - name: GigabitEthernet0/0/0/4 - native_vlan: 40 - -deleted: - before: - - l2protocol: - - cdp: forward - l2transport: true - name: GigabitEthernet0/0/0/1 - native_vlan: 10 - propagate: true - - name: GigabitEthernet0/0/0/3.900 - q_vlan: - - 40 - - 60 - - l2protocol: - - vtp: tunnel - l2transport: true - name: GigabitEthernet0/0/0/4 - native_vlan: 20 - - commands: - - interface GigabitEthernet0/0/0/1 - - no dot1q native vlan - - no l2transport - - interface GigabitEthernet0/0/0/3.900 - - no encapsulation dot1q - - interface GigabitEthernet0/0/0/4 - - no dot1q native vlan - - no l2transport - - after: - - name: GigabitEthernet0/0/0/4 - - name: GigabitEthernet0/0/0/3.900 diff --git a/test/integration/targets/iosxr_l3_interfaces/defaults/main.yaml b/test/integration/targets/iosxr_l3_interfaces/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/iosxr_l3_interfaces/meta/main.yaml b/test/integration/targets/iosxr_l3_interfaces/meta/main.yaml deleted file mode 100644 index 32cf5dda7e..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/meta/main.yaml +++ /dev/null @@ -1 +0,0 @@ -dependencies: [] diff --git a/test/integration/targets/iosxr_l3_interfaces/tasks/cli.yaml b/test/integration/targets/iosxr_l3_interfaces/tasks/cli.yaml deleted file mode 100644 index 337e34133b..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/tasks/cli.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: Set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - delegate_to: localhost - -- name: Run test case (connection=network_cli) - include: "{{ test_case_to_run }}" - vars: - ansible_connection: network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_l3_interfaces/tasks/main.yaml b/test/integration/targets/iosxr_l3_interfaces/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_l3_interfaces/tests/cli/_populate_config.yaml b/test/integration/targets/iosxr_l3_interfaces/tests/cli/_populate_config.yaml deleted file mode 100644 index 7c9e80cfd8..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/tests/cli/_populate_config.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Populate Config - cli_config: - config: "{{ lines }}" - vars: - lines: | - interface GigabitEthernet 0/0/0/0 - ipv4 address 198.51.100.1 255.255.255.0 - ipv6 address 2001:db8::/32 - interface GigabitEthernet 0/0/0/1 - ipv4 address 192.0.2.1 255.255.255.0 - ipv4 address 192.0.2.2 255.255.255.0 secondary diff --git a/test/integration/targets/iosxr_l3_interfaces/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_l3_interfaces/tests/cli/_remove_config.yaml deleted file mode 100644 index ebc3d1c2de..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Remove Config - cli_config: - config: "{{ lines }}" - vars: - lines: | - interface GigabitEthernet 0/0/0/0 - no ipv4 address - no ipv6 address - interface GigabitEthernet 0/0/0/1 - no ipv4 address - no ipv6 address diff --git a/test/integration/targets/iosxr_l3_interfaces/tests/cli/deleted.yaml b/test/integration/targets/iosxr_l3_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index 70ec49771c..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,43 +0,0 @@ ---- -- debug: - msg: "Start Deleted integration state for iosxr_l3_interfaces ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Delete attributes of all configured interfaces - iosxr_l3_interfaces: &deleted - config: - - name: GigabitEthernet0/0/0/0 - - name: GigabitEthernet0/0/0/1 - state: deleted - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ deleted['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Delete attributes of all configured interfaces (IDEMPOTENT) - iosxr_l3_interfaces: *deleted - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_l3_interfaces/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_l3_interfaces/tests/cli/empty_config.yaml deleted file mode 100644 index cfc70c0a49..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/tests/cli/empty_config.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: - msg: "START iosxr_l3_interfaces empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - iosxr_l3_interfaces: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - iosxr_l3_interfaces: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' - -- name: Overridden with empty config should give appropriate error message - iosxr_l3_interfaces: - config: - state: overridden - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state overridden'
\ No newline at end of file diff --git a/test/integration/targets/iosxr_l3_interfaces/tests/cli/merged.yaml b/test/integration/targets/iosxr_l3_interfaces/tests/cli/merged.yaml deleted file mode 100644 index 624491e107..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- debug: - msg: "START Merged iosxr_l3_interfaces state for integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Merge provided configuration with device configuration - iosxr_l3_interfaces: &merged - config: - - name: GigabitEthernet0/0/0/0 - ipv4: - - address: 198.51.100.1/24 - - name: GigabitEthernet0/0/0/1 - ipv6: - - address: 2001:db8:0:3::/64 - ipv4: - - address: 192.0.2.1/24 - - address: 192.0.2.2/24 - secondary: True - state: merged - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ merged['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Merge provided configuration with device configuration (IDEMPOTENT) - iosxr_l3_interfaces: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_l3_interfaces/tests/cli/overridden.yaml b/test/integration/targets/iosxr_l3_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index 2bb52f0217..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- debug: - msg: "START Overridden iosxr_l3_interfaces state for integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Override device configuration of all interfaces with provided configuration - iosxr_l3_interfaces: &overridden - config: - - name: GigabitEthernet0/0/0/1 - ipv4: - - address: 198.51.102.1/24 - ipv6: - - address: 2001:db8:1::/64 - state: overridden - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ overridden['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Override device configuration of all interfaces with provided configuration (IDEMPOTENT) - iosxr_l3_interfaces: *overridden - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_l3_interfaces/tests/cli/replaced.yaml b/test/integration/targets/iosxr_l3_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index ee0dee50cc..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- debug: - msg: "START Replaced iosxr_l3_interfaces state for integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Replaces device configuration of listed interfaces with provided configuration - iosxr_l3_interfaces: &replaced - config: - - name: GigabitEthernet0/0/0/0 - ipv4: - - address: 203.0.113.27/24 - - address: 203.0.114.1/24 - secondary: True - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) | length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ replaced['before'] | symmetric_difference(result['before']) | length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['after']) | length == 0 }}" - - - name: Replaces device configuration of listed interfaces with provided configuration (IDEMPOTENT) - iosxr_l3_interfaces: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_l3_interfaces/tests/cli/rtt.yaml b/test/integration/targets/iosxr_l3_interfaces/tests/cli/rtt.yaml deleted file mode 100644 index 9c95dc4402..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/tests/cli/rtt.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- debug: - msg: "START iosxr_l3_interfaces round trip integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Round Trip test by applying the provided configuration (base config) - iosxr_l3_interfaces: - config: - - name: GigabitEthernet0/0/0/0 - ipv4: - - address: 198.51.100.1/24 - - name: GigabitEthernet0/0/0/1 - ipv6: - - address: 2001:db8:0:3::/64 - ipv4: - - address: 192.0.2.1/24 - - secondary: True - address: 192.0.2.2/24 - state: merged - register: base_config - - - name: Gather interfaces facts - iosxr_facts: - gather_subset: - - default - gather_network_resources: - - l3_interfaces - register: l3facts_config - - - name: Apply config from l3_interfaces facts generated (IDEMPOTENT) - iosxr_l3_interfaces: - config: "{{ l3facts_config['ansible_facts']['ansible_network_resources']['l3_interfaces'] }}" - state: merged - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_l3_interfaces/vars/main.yaml b/test/integration/targets/iosxr_l3_interfaces/vars/main.yaml deleted file mode 100644 index f49514eda7..0000000000 --- a/test/integration/targets/iosxr_l3_interfaces/vars/main.yaml +++ /dev/null @@ -1,121 +0,0 @@ ---- -merged: - before: - - name: Loopback888 - - name: Loopback999 - - commands: - - "interface GigabitEthernet0/0/0/0" - - "ipv4 address 198.51.100.1 255.255.255.0" - - "interface GigabitEthernet0/0/0/1" - - "ipv4 address 192.0.2.2 255.255.255.0 secondary" - - "ipv4 address 192.0.2.1 255.255.255.0" - - "ipv6 address 2001:db8:0:3::/64" - - after: - - name: Loopback888 - - name: Loopback999 - - ipv4: - - address: 198.51.100.1 255.255.255.0 - name: GigabitEthernet0/0/0/0 - - ipv4: - - address: 192.0.2.1 255.255.255.0 - - address: 192.0.2.2 255.255.255.0 - secondary: true - ipv6: - - address: 2001:db8:0:3::/64 - name: GigabitEthernet0/0/0/1 - -replaced: - before: - - name: Loopback888 - - name: Loopback999 - - ipv4: - - address: 198.51.100.1 255.255.255.0 - ipv6: - - address: 2001:db8::/32 - name: GigabitEthernet0/0/0/0 - - ipv4: - - address: 192.0.2.1 255.255.255.0 - - address: 192.0.2.2 255.255.255.0 - secondary: true - name: GigabitEthernet0/0/0/1 - - commands: - - "interface GigabitEthernet0/0/0/0" - - "no ipv6 address" - - "ipv4 address 203.0.113.27 255.255.255.0" - - "ipv4 address 203.0.114.1 255.255.255.0 secondary" - - after: - - name: Loopback888 - - name: Loopback999 - - ipv4: - - address: 203.0.113.27 255.255.255.0 - - address: 203.0.114.1 255.255.255.0 - secondary: true - name: GigabitEthernet0/0/0/0 - - ipv4: - - address: 192.0.2.1 255.255.255.0 - - address: 192.0.2.2 255.255.255.0 - secondary: true - name: GigabitEthernet0/0/0/1 - -overridden: - before: - - name: Loopback888 - - name: Loopback999 - - ipv4: - - address: 198.51.100.1 255.255.255.0 - ipv6: - - address: 2001:db8::/32 - name: GigabitEthernet0/0/0/0 - - ipv4: - - address: 192.0.2.1 255.255.255.0 - - address: 192.0.2.2 255.255.255.0 - secondary: true - name: GigabitEthernet0/0/0/1 - - commands: - - "interface GigabitEthernet0/0/0/0" - - "no ipv4 address" - - "no ipv6 address" - - "interface GigabitEthernet0/0/0/1" - - "no ipv4 address" - - "ipv4 address 198.51.102.1 255.255.255.0" - - "ipv6 address 2001:db8:1::/64" - - after: - - name: Loopback888 - - name: Loopback999 - - ipv4: - - address: 198.51.102.1 255.255.255.0 - ipv6: - - address: 2001:db8:1::/64 - name: GigabitEthernet0/0/0/1 - -deleted: - before: - - name: Loopback888 - - name: Loopback999 - - ipv4: - - address: 198.51.100.1 255.255.255.0 - ipv6: - - address: 2001:db8::/32 - name: GigabitEthernet0/0/0/0 - - ipv4: - - address: 192.0.2.1 255.255.255.0 - - address: 192.0.2.2 255.255.255.0 - secondary: true - name: GigabitEthernet0/0/0/1 - - commands: - - "interface GigabitEthernet0/0/0/0" - - "no ipv4 address" - - "no ipv6 address" - - "interface GigabitEthernet0/0/0/1" - - "no ipv4 address" - - after: - - name: Loopback888 - - name: Loopback999 diff --git a/test/integration/targets/iosxr_lacp/defaults/main.yaml b/test/integration/targets/iosxr_lacp/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/iosxr_lacp/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/iosxr_lacp/tasks/cli.yaml b/test/integration/targets/iosxr_lacp/tasks/cli.yaml deleted file mode 100644 index 337e34133b..0000000000 --- a/test/integration/targets/iosxr_lacp/tasks/cli.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: Set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - delegate_to: localhost - -- name: Run test case (connection=network_cli) - include: "{{ test_case_to_run }}" - vars: - ansible_connection: network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_lacp/tasks/main.yaml b/test/integration/targets/iosxr_lacp/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_lacp/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_lacp/tests/cli/_populate.yaml b/test/integration/targets/iosxr_lacp/tests/cli/_populate.yaml deleted file mode 100644 index 5f34cde033..0000000000 --- a/test/integration/targets/iosxr_lacp/tests/cli/_populate.yaml +++ /dev/null @@ -1,9 +0,0 @@ ---- -- name: Setup - cli_config: - config: "{{ lines }}" - vars: - lines: | - lacp system priority 12 - lacp system mac 00c1.4c00.bd16 - diff --git a/test/integration/targets/iosxr_lacp/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_lacp/tests/cli/_remove_config.yaml deleted file mode 100644 index fcdfb194b9..0000000000 --- a/test/integration/targets/iosxr_lacp/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Remove Config - cli_config: - config: "{{ lines }}" - vars: - lines: | - no lacp system priority - no lacp system mac diff --git a/test/integration/targets/iosxr_lacp/tests/cli/deleted.yaml b/test/integration/targets/iosxr_lacp/tests/cli/deleted.yaml deleted file mode 100644 index 72e584e270..0000000000 --- a/test/integration/targets/iosxr_lacp/tests/cli/deleted.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -- debug: - msg: "Start iosxr_lacp deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Delete LACP attributes - iosxr_lacp: &deleted - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ populate == result['before'] }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted['after'] == result['after'] }}" - - - name: Delete attributes of given interfaces (IDEMPOTENT) - iosxr_lacp: *deleted - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted['after'] == result['before'] }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lacp/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_lacp/tests/cli/empty_config.yaml deleted file mode 100644 index 04ba95169a..0000000000 --- a/test/integration/targets/iosxr_lacp/tests/cli/empty_config.yaml +++ /dev/null @@ -1,25 +0,0 @@ ---- -- debug: - msg: "START iosxr_lacp empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - iosxr_lacp: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - iosxr_lacp: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' diff --git a/test/integration/targets/iosxr_lacp/tests/cli/merged.yaml b/test/integration/targets/iosxr_lacp/tests/cli/merged.yaml deleted file mode 100644 index 3d285c4830..0000000000 --- a/test/integration/targets/iosxr_lacp/tests/cli/merged.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- debug: - msg: "START iosxr_lacp merged integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Merge the provided configuration with the exisiting running configuration - iosxr_lacp: &merged - config: - system: - priority: 11 - mac: - address: 00c1.4c00.bd15 - state: merged - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['before'] == result['before'] }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts was correctly generated - assert: - that: - - "{{ merged['after'] == result['after'] }}" - - - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - iosxr_lacp: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ merged['after'] == result['before']}}" - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lacp/tests/cli/replaced.yaml b/test/integration/targets/iosxr_lacp/tests/cli/replaced.yaml deleted file mode 100644 index 8b1b0ca84b..0000000000 --- a/test/integration/targets/iosxr_lacp/tests/cli/replaced.yaml +++ /dev/null @@ -1,48 +0,0 @@ ---- -- debug: - msg: "START iosxr_lacp replaced integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Replace LACP configuration with provided configurations - iosxr_lacp: &replaced - config: - system: - priority: 11 - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ populate == result['before'] }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] == result['after'] }}" - - - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) - iosxr_lacp: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ replaced['after'] == result['before'] }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lacp/tests/cli/rtt.yaml b/test/integration/targets/iosxr_lacp/tests/cli/rtt.yaml deleted file mode 100644 index 3ba1f0be5f..0000000000 --- a/test/integration/targets/iosxr_lacp/tests/cli/rtt.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -- debug: - msg: "START isoxr_lacp round trip integration tests on connection={{ ansible_connection }}" - -- block: - - include_tasks: _remove_config.yaml - - - name: Apply the provided configuration (base config) - iosxr_lacp: - config: - system: - priority: 15 - mac: - address: 00c1.4c00.bd16 - state: merged - register: base_config - - - name: Gather interfaces facts - iosxr_facts: - gather_subset: - - "!all" - - "!min" - gather_network_resources: - - lacp - - - name: Apply the provided configuration (config to be reverted) - iosxr_lacp: - config: - system: - priority: 10 - mac: - address: 00c1.4c00.bd10 - state: merged - register: result - - - name: Assert that changes were applied - assert: - that: "{{ round_trip['after'] == result['after'] }}" - - - name: Revert back to base config using facts round trip - iosxr_lacp: - config: "{{ ansible_facts['network_resources']['lacp'] }}" - state: replaced - register: revert - - - name: Assert that config was reverted - assert: - that: "{{ base_config['after'] == revert['after'] }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lacp/vars/main.yaml b/test/integration/targets/iosxr_lacp/vars/main.yaml deleted file mode 100644 index 8f445d1744..0000000000 --- a/test/integration/targets/iosxr_lacp/vars/main.yaml +++ /dev/null @@ -1,43 +0,0 @@ ---- -merged: - before: {} - - commands: - - "lacp system priority 11" - - "lacp system mac 00c1.4c00.bd15" - - after: - system: - priority: 11 - mac: - address: "00c1.4c00.bd15" - -populate: - system: - priority: 12 - mac: - address: "00c1.4c00.bd16" - -replaced: - commands: - - "no lacp system mac" - - "lacp system priority 11" - - after: - system: - priority: 11 - -deleted: - commands: - - "no lacp system priority" - - "no lacp system mac" - - after: {} - -round_trip: - after: - system: - priority: 10 - mac: - address: "00c1.4c00.bd10" - diff --git a/test/integration/targets/iosxr_lacp_interfaces/defaults/main.yaml b/test/integration/targets/iosxr_lacp_interfaces/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/iosxr_lacp_interfaces/tasks/cli.yaml b/test/integration/targets/iosxr_lacp_interfaces/tasks/cli.yaml deleted file mode 100644 index 337e34133b..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/tasks/cli.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: Set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - delegate_to: localhost - -- name: Run test case (connection=network_cli) - include: "{{ test_case_to_run }}" - vars: - ansible_connection: network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_lacp_interfaces/tasks/main.yaml b/test/integration/targets/iosxr_lacp_interfaces/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/_populate.yaml b/test/integration/targets/iosxr_lacp_interfaces/tests/cli/_populate.yaml deleted file mode 100644 index 630828d6d1..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/_populate.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: Setup Bundle-Ether10 - iosxr_config: - lines: - - lacp churn logging actor - - lacp switchover suppress-flaps 500 - - lacp collector-max-delay 100 - parents: interface Bundle-Ether10 - -- name: Setup Bundle-Ether11 - iosxr_config: - lines: - - lacp system mac 00c2.4c00.bd15 - parents: interface Bundle-Ether11 - -- name: Setup GigE0 - iosxr_config: - lines: - - lacp period 100 - parents: interface GigabitEthernet0/0/0/0 - -- name: Setup GigE1 - iosxr_config: - lines: - - lacp period 200 - parents: interface GigabitEthernet0/0/0/1 diff --git a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_lacp_interfaces/tests/cli/_remove_config.yaml deleted file mode 100644 index bf6e6afca3..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,32 +0,0 @@ ---- -- name: Remove Bundles - cli_config: - config: "{{ lines }}" - vars: - lines: | - no interface Bundle-Ether10 - no interface Bundle-Ether11 - no interface Bundle-Ether12 - -- name: Remove LACP interface config - iosxr_config: - lines: - - no lacp period - - shutdown - parents: "interface GigabitEthernet{{ item }}" - loop: - - 0/0/0/0 - - 0/0/0/1 - -# To make sure our assertions are not affected by -# spill overs from previous tests -- name: Remove unwanted interfaces from config - iosxr_config: - lines: - - "no interface GigabitEthernet{{ item }}" - loop: - - 0/0/0/2 - - 0/0/0/3 - - 0/0/0/4 - - 0/0/0/5 - ignore_errors: yes diff --git a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/deleted.yaml b/test/integration/targets/iosxr_lacp_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index a2aa5e1dbc..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- debug: - msg: "Start iosxr_lacp_interfaces deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Delete LACP attributes of all interfaces - iosxr_lacp_interfaces: &deleted - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Delete LACP attributes of all interfaces (IDEMPOTENT) - iosxr_lacp_interfaces: *deleted - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_lacp_interfaces/tests/cli/empty_config.yaml deleted file mode 100644 index b9153e7de8..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/empty_config.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: - msg: "START iosxr_lacp_interfaces empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - iosxr_lacp_interfaces: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - iosxr_lacp_interfaces: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' - -- name: Overridden with empty config should give appropriate error message - iosxr_lacp_interfaces: - config: - state: overridden - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state overridden'
\ No newline at end of file diff --git a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/merged.yaml b/test/integration/targets/iosxr_lacp_interfaces/tests/cli/merged.yaml deleted file mode 100644 index be5134091b..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -- debug: - msg: "START iosxr_lacp_interfaces merged integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Merge the provided configuration with the exisiting running configuration - iosxr_lacp_interfaces: &merged - config: - - name: Bundle-Ether10 - churn_logging: actor - collector_max_delay: 100 - switchover_suppress_flaps: 500 - - - name: Bundle-Ether11 - system: - mac: 00c2.4c00.bd15 - - - name: GigabitEthernet0/0/0/1 - period: 100 - state: merged - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts was correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - iosxr_lacp_interfaces: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/overridden.yaml b/test/integration/targets/iosxr_lacp_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index 0ad9ac47a4..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,54 +0,0 @@ ---- -- debug: - msg: "START iosxr_lacp_interfaces overridden integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Overridde all interface LACP configuration with provided configuration - iosxr_lacp_interfaces: &overridden - config: - - name: Bundle-Ether12 - churn_logging: both - collector_max_delay: 100 - switchover_suppress_flaps: 500 - - - name: GigabitEthernet0/0/0/1 - period: 300 - state: overridden - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Overridde all interface LACP configuration with provided configuration (IDEMPOTENT) - iosxr_lacp_interfaces: *overridden - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/replaced.yaml b/test/integration/targets/iosxr_lacp_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index 0dcb8505e0..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,52 +0,0 @@ ---- -- debug: - msg: "START iosxr_lacp_interfaces replaced integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Replace device configurations of listed interfaces with provided configurations - iosxr_lacp_interfaces: &replaced - config: - - name: Bundle-Ether10 - churn_logging: partner - - - name: GigabitEthernet0/0/0/1 - period: 300 - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) - iosxr_lacp_interfaces: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/rtt.yaml b/test/integration/targets/iosxr_lacp_interfaces/tests/cli/rtt.yaml deleted file mode 100644 index a73965c545..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/tests/cli/rtt.yaml +++ /dev/null @@ -1,60 +0,0 @@ ---- -- debug: - msg: "START isoxr_lacp_interfaces round trip integration tests on connection={{ ansible_connection }}" - -- block: - - include_tasks: _remove_config.yaml - - - name: Apply the provided configuration (base config) - iosxr_lacp_interfaces: - config: - - name: Bundle-Ether10 - churn_logging: actor - collector_max_delay: 200 - - - name: Bundle-Ether11 - period: 100 - - - name: GigabitEthernet0/0/0/0 - period: 200 - state: merged - register: base_config - - - name: Gather interfaces facts - iosxr_facts: - gather_subset: - - "!all" - - "!min" - gather_network_resources: - - lacp_interfaces - - - name: Apply the provided configuration (config to be reverted) - iosxr_lacp_interfaces: - config: - - name: Bundle-Ether10 - churn_logging: partner - - - name: Bundle-Ether11 - period: 200 - - - name: GigabitEthernet0/0/0/0 - period: 300 - state: overridden - register: result - - - name: Assert that changes were applied - assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Revert back to base config using facts round trip - iosxr_lacp_interfaces: - config: "{{ ansible_facts['network_resources']['lacp_interfaces'] }}" - state: overridden - register: revert - - - name: Assert that config was reverted - assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lacp_interfaces/vars/main.yaml b/test/integration/targets/iosxr_lacp_interfaces/vars/main.yaml deleted file mode 100644 index ffe921bd54..0000000000 --- a/test/integration/targets/iosxr_lacp_interfaces/vars/main.yaml +++ /dev/null @@ -1,137 +0,0 @@ ---- -merged: - before: - - name: GigabitEthernet0/0/0/0 - - - name: GigabitEthernet0/0/0/1 - - commands: - - "interface Bundle-Ether10" - - "lacp churn logging actor" - - "lacp switchover suppress-flaps 500" - - "lacp collector-max-delay 100" - - "interface Bundle-Ether11" - - "lacp system mac 00c2.4c00.bd15" - - "interface GigabitEthernet0/0/0/1" - - "lacp period 100" - - after: - - name: Bundle-Ether10 - churn_logging: actor - switchover_suppress_flaps: 500 - collector_max_delay: 100 - - - name: Bundle-Ether11 - system: - mac: 00c2.4c00.bd15 - - - name: GigabitEthernet0/0/0/0 - - - name: GigabitEthernet0/0/0/1 - period: 100 - -populate: - - name: Bundle-Ether10 - churn_logging: actor - switchover_suppress_flaps: 500 - collector_max_delay: 100 - - - name: Bundle-Ether11 - system: - mac: 00c2.4c00.bd15 - - - name: GigabitEthernet0/0/0/0 - period: 100 - - - name: GigabitEthernet0/0/0/1 - period: 200 - -replaced: - commands: - - "interface Bundle-Ether10" - - "no lacp switchover suppress-flaps 500" - - "no lacp collector-max-delay 100" - - "lacp churn logging partner" - - "interface GigabitEthernet0/0/0/1" - - "lacp period 300" - - after: - - name: Bundle-Ether10 - churn_logging: partner - - - name: Bundle-Ether11 - system: - mac: 00c2.4c00.bd15 - - - name: GigabitEthernet0/0/0/0 - period: 100 - - - name: GigabitEthernet0/0/0/1 - period: 300 - -overridden: - commands: - - "interface Bundle-Ether10" - - "no lacp switchover suppress-flaps 500" - - "no lacp collector-max-delay 100" - - "no lacp churn logging actor" - - "interface Bundle-Ether11" - - "no lacp system mac 00c2.4c00.bd15" - - "interface GigabitEthernet0/0/0/0" - - "no lacp period 100" - - "interface Bundle-Ether12" - - "lacp churn logging both" - - "lacp collector-max-delay 100" - - "lacp switchover suppress-flaps 500" - - "interface GigabitEthernet0/0/0/1" - - "lacp period 300" - - after: - - name: Bundle-Ether10 - - - name: Bundle-Ether11 - - - name: Bundle-Ether12 - churn_logging: both - collector_max_delay: 100 - switchover_suppress_flaps: 500 - - - name: GigabitEthernet0/0/0/0 - - - name: GigabitEthernet0/0/0/1 - period: 300 - -deleted: - commands: - - "interface Bundle-Ether10" - - "no lacp switchover suppress-flaps 500" - - "no lacp collector-max-delay 100" - - "no lacp churn logging actor" - - "interface Bundle-Ether11" - - "no lacp system mac 00c2.4c00.bd15" - - "interface GigabitEthernet0/0/0/0" - - "no lacp period 100" - - "interface GigabitEthernet0/0/0/1" - - "no lacp period 200" - - after: - - name: Bundle-Ether10 - - - name: Bundle-Ether11 - - - name: GigabitEthernet0/0/0/0 - - - name: GigabitEthernet0/0/0/1 - -round_trip: - after: - - name: Bundle-Ether10 - churn_logging: partner - - - name: Bundle-Ether11 - period: 200 - - - name: GigabitEthernet0/0/0/0 - period: 300 - - - name: GigabitEthernet0/0/0/1 diff --git a/test/integration/targets/iosxr_lag_interfaces/defaults/main.yaml b/test/integration/targets/iosxr_lag_interfaces/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/iosxr_lag_interfaces/tasks/cli.yaml b/test/integration/targets/iosxr_lag_interfaces/tasks/cli.yaml deleted file mode 100644 index 337e34133b..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/tasks/cli.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: Set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - delegate_to: localhost - -- name: Run test case (connection=network_cli) - include: "{{ test_case_to_run }}" - vars: - ansible_connection: network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_lag_interfaces/tasks/main.yaml b/test/integration/targets/iosxr_lag_interfaces/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_lag_interfaces/tests/cli/_populate_config.yaml b/test/integration/targets/iosxr_lag_interfaces/tests/cli/_populate_config.yaml deleted file mode 100644 index f3b53a853a..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/tests/cli/_populate_config.yaml +++ /dev/null @@ -1,26 +0,0 @@ ---- -- name: Setup - iosxr_lag_interfaces: - config: - - name: Bundle-Ether10 - mode: active - members: - - member: GigabitEthernet0/0/0/0 - mode: inherit - - - member: GigabitEthernet0/0/0/1 - mode: passive - load_balancing_hash: src-ip - links: - max_active: 10 - min_active: 2 - - - name: Bundle-Ether11 - load_balancing_hash: dst-ip - members: - - member: GigabitEthernet0/0/0/8 - mode: passive - - - member: GigabitEthernet0/0/0/9 - mode: passive - state: merged diff --git a/test/integration/targets/iosxr_lag_interfaces/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_lag_interfaces/tests/cli/_remove_config.yaml deleted file mode 100644 index 3b102740a8..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- name: Remove Bundles - cli_config: - config: "{{ lines }}" - vars: - lines: | - no interface Bundle-Ether10 - no interface Bundle-Ether11 - no interface Bundle-Ether12 - ignore_errors: yes - -- name: Remove LAG interface config - iosxr_config: - lines: - - no bundle id - - shutdown - parents: "interface GigabitEthernet{{ item }}" - loop: - - 0/0/0/0 - - 0/0/0/1 - - 0/0/0/2 - - 0/0/0/8 - - 0/0/0/9 - ignore_errors: yes - -- name: Remove unwanted interfaces from config - iosxr_config: - lines: - - "no interface GigabitEthernet{{ item }}" - loop: - - 0/0/0/2 - - 0/0/0/8 - - 0/0/0/9 - ignore_errors: yes diff --git a/test/integration/targets/iosxr_lag_interfaces/tests/cli/deleted.yaml b/test/integration/targets/iosxr_lag_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index 762a7d9f36..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- debug: - msg: "Start iosxr_lag_interfaces deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Delete LAG interfaces configuration - iosxr_lag_interfaces: &deleted - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Delete LACP attributes of all interfaces (IDEMPOTENT) - iosxr_lag_interfaces: *deleted - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lag_interfaces/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_lag_interfaces/tests/cli/empty_config.yaml deleted file mode 100644 index c2508c82c0..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/tests/cli/empty_config.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: - msg: "START iosxr_lag_interfaces empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - iosxr_lag_interfaces: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - iosxr_lag_interfaces: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' - -- name: Overridden with empty config should give appropriate error message - iosxr_lag_interfaces: - config: - state: overridden - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state overridden'
\ No newline at end of file diff --git a/test/integration/targets/iosxr_lag_interfaces/tests/cli/merged.yaml b/test/integration/targets/iosxr_lag_interfaces/tests/cli/merged.yaml deleted file mode 100644 index 5f5e57d5ca..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,65 +0,0 @@ ---- -- debug: - msg: "START iosxr_lag_interfaces merged integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Merge the provided configuration with the exisiting running configuration - iosxr_lag_interfaces: &merged - config: - - name: Bundle-Ether10 - mode: active - members: - - member: GigabitEthernet0/0/0/0 - mode: inherit - - - member: GigabitEthernet0/0/0/1 - mode: passive - load_balancing_hash: src-ip - links: - max_active: 10 - min_active: 2 - - - name: Bundle-Ether11 - load_balancing_hash: dst-ip - members: - - member: GigabitEthernet0/0/0/8 - mode: passive - - - member: GigabitEthernet0/0/0/9 - mode: passive - state: merged - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts was correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - iosxr_lag_interfaces: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lag_interfaces/tests/cli/overridden.yaml b/test/integration/targets/iosxr_lag_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index 76bccca85f..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,59 +0,0 @@ ---- -- debug: - msg: "START iosxr_lag_interfaces overridden integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Overridde all LAG interface configuration with provided configuration - iosxr_lag_interfaces: &overridden - config: - - name: Bundle-Ether11 - mode: active - members: - - member: GigabitEthernet0/0/0/0 - mode: active - - - member: GigabitEthernet0/0/0/1 - mode: active - load_balancing_hash: src-ip - links: - max_active: 10 - min_active: 5 - state: overridden - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Overridde all interface LAG interface configuration with provided configuration (IDEMPOTENT) - iosxr_lag_interfaces: *overridden - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lag_interfaces/tests/cli/replaced.yaml b/test/integration/targets/iosxr_lag_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index fd7b1e29ea..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,56 +0,0 @@ ---- -- debug: - msg: "START iosxr_lag_interfaces replaced integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Replace device configurations of listed interfaces with provided configurations - iosxr_lag_interfaces: &replaced - config: - - name: Bundle-Ether10 - mode: passive - members: - - member: GigabitEthernet0/0/0/0 - mode: passive - load_balancing_hash: dst-ip - - - name: Bundle-Ether12 - mode: active - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) - iosxr_lag_interfaces: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lag_interfaces/tests/cli/rtt.yaml b/test/integration/targets/iosxr_lag_interfaces/tests/cli/rtt.yaml deleted file mode 100644 index cd4c308d07..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/tests/cli/rtt.yaml +++ /dev/null @@ -1,62 +0,0 @@ ---- -- debug: - msg: "START isoxr_lag_interfaces round trip integration tests on connection={{ ansible_connection }}" - -- block: - - include_tasks: _remove_config.yaml - - - name: Apply the provided configuration (base config) - iosxr_lag_interfaces: - config: - - name: Bundle-Ether10 - members: - - member: GigabitEthernet0/0/0/1 - mode: passive - links: - max_active: 10 - min_active: 2 - - - name: Bundle-Ether11 - mode: passive - state: merged - register: base_config - - - name: Gather interfaces facts - iosxr_facts: - gather_subset: - - "!all" - - "!min" - gather_network_resources: - - lag_interfaces - - - name: Apply the provided configuration (config to be reverted) - iosxr_lag_interfaces: - config: - - name: Bundle-Ether10 - members: - - member: GigabitEthernet0/0/0/9 - mode: active - - member: GigabitEthernet0/0/0/8 - mode: passive - - - name: Bundle-Ether11 - mode: active - state: overridden - register: result - - - name: Assert that changes were applied - assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Revert back to base config using facts round trip - iosxr_lag_interfaces: - config: "{{ ansible_facts['network_resources']['lag_interfaces'] }}" - state: overridden - register: revert - - - name: Assert that config was reverted - assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lag_interfaces/vars/main.yaml b/test/integration/targets/iosxr_lag_interfaces/vars/main.yaml deleted file mode 100644 index 44ad52f9b1..0000000000 --- a/test/integration/targets/iosxr_lag_interfaces/vars/main.yaml +++ /dev/null @@ -1,149 +0,0 @@ ---- -merged: - before: [] - - commands: - - "interface Bundle-Ether10" - - "bundle load-balancing hash src-ip" - - "bundle minimum-active links 2" - - "bundle maximum-active links 10" - - "lacp mode active" - - "interface GigabitEthernet0/0/0/1" - - "bundle id 10 mode passive" - - "interface GigabitEthernet0/0/0/0" - - "bundle id 10 mode inherit" - - "interface Bundle-Ether11" - - "bundle load-balancing hash dst-ip" - - "interface GigabitEthernet0/0/0/8" - - "bundle id 11 mode passive" - - "interface GigabitEthernet0/0/0/9" - - "bundle id 11 mode passive" - - after: - - name: Bundle-Ether10 - links: - max_active: 10 - min_active: 2 - load_balancing_hash: src-ip - members: - - member: GigabitEthernet0/0/0/0 - mode: inherit - - member: GigabitEthernet0/0/0/1 - mode: passive - mode: active - - - name: Bundle-Ether11 - load_balancing_hash: dst-ip - members: - - member: GigabitEthernet0/0/0/8 - mode: passive - - member: GigabitEthernet0/0/0/9 - mode: passive - -replaced: - commands: - - interface Bundle-Ether10 - - no bundle maximum-active links 10 - - no bundle minimum-active links 2 - - bundle load-balancing hash dst-ip - - lacp mode passive - - interface GigabitEthernet0/0/0/1 - - no bundle id - - interface GigabitEthernet0/0/0/0 - - bundle id 10 mode passive - - interface Bundle-Ether12 - - lacp mode active - - after: - - load_balancing_hash: dst-ip - members: - - member: GigabitEthernet0/0/0/0 - mode: passive - mode: passive - name: Bundle-Ether10 - - - load_balancing_hash: dst-ip - members: - - member: GigabitEthernet0/0/0/8 - mode: passive - - member: GigabitEthernet0/0/0/9 - mode: passive - name: Bundle-Ether11 - - - mode: active - name: Bundle-Ether12 - -overridden: - commands: - - interface Bundle-Ether10 - - no bundle maximum-active links 10 - - no bundle minimum-active links 2 - - no bundle load-balancing hash src-ip - - no lacp mode active - - interface GigabitEthernet0/0/0/0 - - no bundle id - - interface GigabitEthernet0/0/0/1 - - no bundle id - - interface Bundle-Ether11 - - bundle load-balancing hash src-ip - - bundle minimum-active links 5 - - bundle maximum-active links 10 - - lacp mode active - - interface GigabitEthernet0/0/0/8 - - no bundle id - - interface GigabitEthernet0/0/0/9 - - no bundle id - - interface GigabitEthernet0/0/0/0 - - bundle id 11 mode active - - interface GigabitEthernet0/0/0/1 - - bundle id 11 mode active - - after: - - name: Bundle-Ether10 - - - links: - max_active: 10 - min_active: 5 - load_balancing_hash: src-ip - members: - - member: GigabitEthernet0/0/0/0 - mode: active - - member: GigabitEthernet0/0/0/1 - mode: active - mode: active - name: Bundle-Ether11 - -deleted: - commands: - - interface Bundle-Ether10 - - no bundle maximum-active links 10 - - no bundle minimum-active links 2 - - no bundle load-balancing hash src-ip - - no lacp mode active - - interface GigabitEthernet0/0/0/0 - - no bundle id - - interface GigabitEthernet0/0/0/1 - - no bundle id - - interface Bundle-Ether11 - - no bundle load-balancing hash dst-ip - - interface GigabitEthernet0/0/0/8 - - no bundle id - - interface GigabitEthernet0/0/0/9 - - no bundle id - - after: - - name: Bundle-Ether10 - - name: Bundle-Ether11 - -round_trip: - after: - - members: - - member: GigabitEthernet0/0/0/8 - mode: passive - - member: GigabitEthernet0/0/0/9 - mode: active - name: Bundle-Ether10 - - - mode: active - name: Bundle-Ether11 -
\ No newline at end of file diff --git a/test/integration/targets/iosxr_lldp_global/defaults/main.yaml b/test/integration/targets/iosxr_lldp_global/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/iosxr_lldp_global/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/iosxr_lldp_global/tasks/cli.yaml b/test/integration/targets/iosxr_lldp_global/tasks/cli.yaml deleted file mode 100644 index 337e34133b..0000000000 --- a/test/integration/targets/iosxr_lldp_global/tasks/cli.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: Set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - delegate_to: localhost - -- name: Run test case (connection=network_cli) - include: "{{ test_case_to_run }}" - vars: - ansible_connection: network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_lldp_global/tasks/main.yaml b/test/integration/targets/iosxr_lldp_global/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_lldp_global/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_lldp_global/tests/cli/_populate.yaml b/test/integration/targets/iosxr_lldp_global/tests/cli/_populate.yaml deleted file mode 100644 index 9ae12ca43d..0000000000 --- a/test/integration/targets/iosxr_lldp_global/tests/cli/_populate.yaml +++ /dev/null @@ -1,13 +0,0 @@ ---- -- name: Setup - cli_config: - config: "{{ lines }}" - vars: - lines: | - lldp reinit 2 - lldp holdtime 100 - lldp timer 3000 - lldp subinterfaces enable - lldp tlv-select system-description disable - lldp tlv-select management-address disable - diff --git a/test/integration/targets/iosxr_lldp_global/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_lldp_global/tests/cli/_remove_config.yaml deleted file mode 100644 index 222ae70034..0000000000 --- a/test/integration/targets/iosxr_lldp_global/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,7 +0,0 @@ ---- -- name: Remove Config - cli_config: - config: "{{ lines }}" - vars: - lines: | - no lldp diff --git a/test/integration/targets/iosxr_lldp_global/tests/cli/deleted.yaml b/test/integration/targets/iosxr_lldp_global/tests/cli/deleted.yaml deleted file mode 100644 index 24733b39f8..0000000000 --- a/test/integration/targets/iosxr_lldp_global/tests/cli/deleted.yaml +++ /dev/null @@ -1,45 +0,0 @@ ---- -- debug: - msg: "Start iosxr_lldp_global deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Delete global LLDP attributes - iosxr_lldp_global: &deleted - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ merged['after'] == result['before'] }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted['after'] == result['after'] }}" - - - name: Delete attributes of given interfaces (IDEMPOTENT) - iosxr_lldp_global: *deleted - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted['after'] == result['before'] }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lldp_global/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_lldp_global/tests/cli/empty_config.yaml deleted file mode 100644 index 15c0057fad..0000000000 --- a/test/integration/targets/iosxr_lldp_global/tests/cli/empty_config.yaml +++ /dev/null @@ -1,25 +0,0 @@ ---- -- debug: - msg: "START iosxr_lldp_global empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - iosxr_lldp_global: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - iosxr_lldp_global: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced'
\ No newline at end of file diff --git a/test/integration/targets/iosxr_lldp_global/tests/cli/merged.yaml b/test/integration/targets/iosxr_lldp_global/tests/cli/merged.yaml deleted file mode 100644 index ac4a3abd45..0000000000 --- a/test/integration/targets/iosxr_lldp_global/tests/cli/merged.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- debug: - msg: "START iosxr_lldp_global merged integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Merge the provided configuration with the exisiting running configuration - iosxr_lldp_global: &merged - config: - holdtime: 100 - reinit: 2 - timer: 3000 - subinterfaces: True - tlv_select: - management_address: False - system_description: False - state: merged - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['before'] == result['before'] }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts was correctly generated - assert: - that: - - "{{ merged['after'] == result['after'] }}" - - - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - iosxr_lldp_global: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ merged['after'] == result['before']}}" - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lldp_global/tests/cli/replaced.yaml b/test/integration/targets/iosxr_lldp_global/tests/cli/replaced.yaml deleted file mode 100644 index 66ac85daaf..0000000000 --- a/test/integration/targets/iosxr_lldp_global/tests/cli/replaced.yaml +++ /dev/null @@ -1,51 +0,0 @@ ---- -- debug: - msg: "START iosxr_lldp_global replaced integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Replace global LLDP configuration with provided configurations - iosxr_lldp_global: &replaced - config: - holdtime: 100 - tlv_select: - port_description: False - system_description: False - management_address: False - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ merged['after'] == result['before'] }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] == result['after'] }}" - - - name: Replace device global LLDP configurations with provided configurarions (IDEMPOTENT) - iosxr_lldp_global: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ replaced['after'] == result['before'] }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lldp_global/tests/cli/rtt.yaml b/test/integration/targets/iosxr_lldp_global/tests/cli/rtt.yaml deleted file mode 100644 index 1e81572742..0000000000 --- a/test/integration/targets/iosxr_lldp_global/tests/cli/rtt.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- debug: - msg: "START isoxr_lldp_global round trip integration tests on connection={{ ansible_connection }}" - -- block: - - include_tasks: _remove_config.yaml - - - name: Apply the provided configuration (base config) - iosxr_lldp_global: - config: - holdtime: 200 - timer: 500 - state: merged - register: base_config - - - name: Gather interfaces facts - iosxr_facts: - gather_subset: - - "!all" - - "!min" - gather_network_resources: - - lldp_global - - - name: Apply the provided configuration (config to be reverted) - iosxr_lldp_global: - config: - holdtime: 200 - reinit: 4 - subinterfaces: True - timer: 3000 - state: merged - register: result - - - name: Assert that changes were applied - assert: - that: "{{ round_trip['after'] == result['after'] }}" - - - name: Revert back to base config using facts round trip - iosxr_lldp_global: - config: "{{ ansible_facts['network_resources']['lldp_global'] }}" - state: replaced - register: revert - - - name: Assert that config was reverted - assert: - that: "{{ base_config['after'] == revert['after'] }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lldp_global/vars/main.yaml b/test/integration/targets/iosxr_lldp_global/vars/main.yaml deleted file mode 100644 index e556ec57bd..0000000000 --- a/test/integration/targets/iosxr_lldp_global/vars/main.yaml +++ /dev/null @@ -1,52 +0,0 @@ ---- -merged: - before: {} - - commands: - - "lldp reinit 2" - - "lldp holdtime 100" - - "lldp timer 3000" - - "lldp subinterfaces enable" - - "lldp tlv-select system-description disable" - - "lldp tlv-select management-address disable" - - after: - holdtime: 100 - reinit: 2 - subinterfaces: True - timer: 3000 - tlv_select: - management_address: False - system_description: False - -replaced: - commands: - - "no lldp reinit 2" - - "no lldp subinterfaces enable" - - "no lldp timer 3000" - - "lldp tlv-select port-description disable" - - after: - holdtime: 100 - tlv_select: - management_address: False - port_description: False - system_description: False - -deleted: - commands: - - "no lldp holdtime 100" - - "no lldp reinit 2" - - "no lldp subinterfaces enable" - - "no lldp timer 3000" - - "no lldp tlv-select management-address disable" - - "no lldp tlv-select system-description disable" - - after: {} - -round_trip: - after: - holdtime: 200 - reinit: 4 - subinterfaces: True - timer: 3000
\ No newline at end of file diff --git a/test/integration/targets/iosxr_lldp_interfaces/defaults/main.yaml b/test/integration/targets/iosxr_lldp_interfaces/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/iosxr_lldp_interfaces/tasks/cli.yaml b/test/integration/targets/iosxr_lldp_interfaces/tasks/cli.yaml deleted file mode 100644 index 337e34133b..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/tasks/cli.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: Set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - delegate_to: localhost - -- name: Run test case (connection=network_cli) - include: "{{ test_case_to_run }}" - vars: - ansible_connection: network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_lldp_interfaces/tasks/main.yaml b/test/integration/targets/iosxr_lldp_interfaces/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/_populate.yaml b/test/integration/targets/iosxr_lldp_interfaces/tests/cli/_populate.yaml deleted file mode 100644 index 17fe33f751..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/_populate.yaml +++ /dev/null @@ -1,12 +0,0 @@ ---- -- name: Setup GigE1 - iosxr_config: - lines: - - lldp receive disable - parents: interface GigabitEthernet0/0/0/1 - -- name: Setup GigE0 - iosxr_config: - lines: - - lldp transmit disable - parents: interface GigabitEthernet0/0/0/0 diff --git a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_lldp_interfaces/tests/cli/_remove_config.yaml deleted file mode 100644 index 633dd953f0..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: Remove LLDP interface config - iosxr_config: - lines: - - no lldp - - shutdown - parents: "interface GigabitEthernet{{ item }}" - loop: - - 0/0/0/0 - - 0/0/0/1 - ignore_errors: yes - -# To make sure our assertions are not affected by -# spill overs from previous tests -- name: Remove unwanted interfaces from config - iosxr_config: - lines: - - "no interface GigabitEthernet{{ item }}" - loop: - - 0/0/0/2 - - 0/0/0/3 - - 0/0/0/4 - - 0/0/0/5 - ignore_errors: yes diff --git a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/deleted.yaml b/test/integration/targets/iosxr_lldp_interfaces/tests/cli/deleted.yaml deleted file mode 100644 index 1894e9c231..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/deleted.yaml +++ /dev/null @@ -1,46 +0,0 @@ ---- -- debug: - msg: "Start iosxr_lldp_interfaces deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Delete LLDP attributes of all interfaces - iosxr_lldp_interfaces: &deleted - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Delete LACP attributes of all interfaces (IDEMPOTENT) - iosxr_lldp_interfaces: *deleted - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result.changed == false" - - "result.commands|length == 0" - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_lldp_interfaces/tests/cli/empty_config.yaml deleted file mode 100644 index 1fd25365e1..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/empty_config.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: - msg: "START iosxr_lldp_interfaces empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - iosxr_lldp_interfaces: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - iosxr_lldp_interfaces: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' - -- name: Overridden with empty config should give appropriate error message - iosxr_lldp_interfaces: - config: - state: overridden - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state overridden'
\ No newline at end of file diff --git a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/merged.yaml b/test/integration/targets/iosxr_lldp_interfaces/tests/cli/merged.yaml deleted file mode 100644 index a0bf019689..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/merged.yaml +++ /dev/null @@ -1,48 +0,0 @@ ---- -- debug: - msg: "START iosxr_lldp_interfaces merged integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Merge the provided configuration with the exisiting running configuration - iosxr_lldp_interfaces: &merged - config: - - name: GigabitEthernet0/0/0/0 - transmit: False - - - name: GigabitEthernet0/0/0/1 - receive: False - state: merged - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts was correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - iosxr_lldp_interfaces: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/overridden.yaml b/test/integration/targets/iosxr_lldp_interfaces/tests/cli/overridden.yaml deleted file mode 100644 index 96c938b7bd..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/overridden.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- debug: - msg: "START iosxr_lldp_interfaces overridden integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Overridde all interface LLDP configuration with provided configuration - iosxr_lldp_interfaces: &overridden - config: - - name: GigabitEthernet0/0/0/0 - transmit: False - state: overridden - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Overridde all interface LACP configuration with provided configuration (IDEMPOTENT) - iosxr_lldp_interfaces: *overridden - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/replaced.yaml b/test/integration/targets/iosxr_lldp_interfaces/tests/cli/replaced.yaml deleted file mode 100644 index d4155e9d10..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/replaced.yaml +++ /dev/null @@ -1,49 +0,0 @@ ---- -- debug: - msg: "START iosxr_lldp_interfaces replaced integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate.yaml - -- block: - - name: Replace device configurations of listed interfaces with provided configurations - iosxr_lldp_interfaces: &replaced - config: - - name: GigabitEthernet0/0/0/1 - transmit: False - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ populate | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Replace device configurations of listed interfaces with provided configurarions (IDEMPOTENT) - iosxr_lldp_interfaces: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/rtt.yaml b/test/integration/targets/iosxr_lldp_interfaces/tests/cli/rtt.yaml deleted file mode 100644 index 96027fc866..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/tests/cli/rtt.yaml +++ /dev/null @@ -1,50 +0,0 @@ ---- -- debug: - msg: "START iosxr_lldp_interfaces round trip integration tests on connection={{ ansible_connection }}" - -- block: - - include_tasks: _remove_config.yaml - - - name: Apply the provided configuration (base config) - iosxr_lldp_interfaces: - config: - - name: GigabitEthernet0/0/0/0 - transmit: False - state: merged - register: base_config - - - name: Gather interfaces facts - iosxr_facts: - gather_subset: - - "!all" - - "!min" - gather_network_resources: - - lldp_interfaces - - - name: Apply the provided configuration (config to be reverted) - iosxr_lldp_interfaces: - config: - - name: GigabitEthernet0/0/0/0 - receive: False - - - name: GigabitEthernet0/0/0/1 - transmit: False - state: overridden - register: result - - - name: Assert that changes were applied - assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Revert back to base config using facts round trip - iosxr_lldp_interfaces: - config: "{{ ansible_facts['network_resources']['lldp_interfaces'] }}" - state: overridden - register: revert - - - name: Assert that config was reverted - assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_lldp_interfaces/vars/main.yaml b/test/integration/targets/iosxr_lldp_interfaces/vars/main.yaml deleted file mode 100644 index 7bea216b7e..0000000000 --- a/test/integration/targets/iosxr_lldp_interfaces/vars/main.yaml +++ /dev/null @@ -1,70 +0,0 @@ ---- -merged: - before: - - name: GigabitEthernet0/0/0/0 - - - name: GigabitEthernet0/0/0/1 - - commands: - - "interface GigabitEthernet0/0/0/0" - - "lldp transmit disable" - - "interface GigabitEthernet0/0/0/1" - - "lldp receive disable" - - after: - - name: GigabitEthernet0/0/0/0 - transmit: False - - - name: GigabitEthernet0/0/0/1 - receive: False - -populate: - - name: GigabitEthernet0/0/0/0 - transmit: False - - - name: GigabitEthernet0/0/0/1 - receive: False - -replaced: - commands: - - "interface GigabitEthernet0/0/0/1" - - "no lldp receive disable" - - "lldp transmit disable" - - after: - - name: GigabitEthernet0/0/0/0 - transmit: False - - - name: GigabitEthernet0/0/0/1 - transmit: False - -overridden: - commands: - - "interface GigabitEthernet0/0/0/1" - - "no lldp receive disable" - - after: - - name: GigabitEthernet0/0/0/0 - transmit: False - - - name: GigabitEthernet0/0/0/1 - -deleted: - commands: - - "interface GigabitEthernet0/0/0/0" - - "no lldp transmit disable" - - "interface GigabitEthernet0/0/0/1" - - "no lldp receive disable" - - after: - - name: GigabitEthernet0/0/0/0 - - - name: GigabitEthernet0/0/0/1 - -round_trip: - after: - - name: GigabitEthernet0/0/0/0 - receive: False - - - name: GigabitEthernet0/0/0/1 - transmit: False diff --git a/test/integration/targets/iosxr_logging/defaults/main.yaml b/test/integration/targets/iosxr_logging/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/iosxr_logging/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/iosxr_logging/meta/main.yaml b/test/integration/targets/iosxr_logging/meta/main.yaml deleted file mode 100644 index d4da833dd5..0000000000 --- a/test/integration/targets/iosxr_logging/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_logging/tasks/cli.yaml b/test/integration/targets/iosxr_logging/tasks/cli.yaml deleted file mode 100644 index 8c9d032f48..0000000000 --- a/test/integration/targets/iosxr_logging/tasks/cli.yaml +++ /dev/null @@ -1,19 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - 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 - -- name: reset connection - meta: reset_connection diff --git a/test/integration/targets/iosxr_logging/tasks/main.yaml b/test/integration/targets/iosxr_logging/tasks/main.yaml deleted file mode 100644 index af08869c92..0000000000 --- a/test/integration/targets/iosxr_logging/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: netconf.yaml, tags: ['netconf'] } diff --git a/test/integration/targets/iosxr_logging/tasks/netconf.yaml b/test/integration/targets/iosxr_logging/tasks/netconf.yaml deleted file mode 100644 index 41b2de5450..0000000000 --- a/test/integration/targets/iosxr_logging/tasks/netconf.yaml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: collect all netconf test cases - find: - paths: "{{ role_path }}/tests/netconf" - 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=netconf) - include: "{{ test_case_to_run }} ansible_connection=netconf" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - -# Only one of the Testcase would be run to check if `connection: local` -# is established. Full suite is run with `connection:network_cli` or `connection:netconf` -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_first_found: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - -- name: reset connection - meta: reset_connection diff --git a/test/integration/targets/iosxr_logging/tests/cli/basic.yaml b/test/integration/targets/iosxr_logging/tests/cli/basic.yaml deleted file mode 100644 index 477d30481d..0000000000 --- a/test/integration/targets/iosxr_logging/tests/cli/basic.yaml +++ /dev/null @@ -1,155 +0,0 @@ ---- -# Remove old logging entries so that they don't conflict with tests -- name: remove host logging - iosxr_logging: - dest: host - name: 172.16.0.1 - state: absent - provider: "{{ cli }}" - -- name: remove console logging - iosxr_logging: - dest: console - state: absent - provider: "{{ cli }}" - register: result - -- name: remove buffered logging - iosxr_logging: - dest: buffered - size: 2097155 - state: absent - provider: "{{ cli }}" - register: result - -# Start tests -- name: set up syslog host logging - iosxr_logging: &addhostlog - dest: host - name: 172.16.0.1 - level: errors - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging 172.16.0.1 vrf default severity error" in result.commands' - -- name: set up syslog host logging (idempotent) - iosxr_logging: *addhostlog - register: result - -- assert: &false - that: - - 'result.changed == false' - -- name: delete/disable syslog host logging - iosxr_logging: &delhostlog - dest: host - name: 172.16.0.1 - state: absent - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"no logging 172.16.0.1 vrf default" in result.commands' - -- name: delete/disable syslog host logging (idempotent) - iosxr_logging: *delhostlog - register: result - -- assert: *false - -- name: add console logging with level warning - iosxr_logging: &consolelog - dest: console - level: warning - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging console warning" in result.commands' - -- name: console logging with level warning (idempotent) - iosxr_logging: *consolelog - register: result - -- assert: *false - -- name: remove console logging with level warning - iosxr_logging: - dest: console - level: warning - state: absent - provider: "{{ cli }}" - register: result - -- assert: &true - that: - - 'result.changed == true' - -- name: configure buffered logging size - iosxr_logging: &bufferlog - dest: buffered - size: 4800000 - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging buffered 4800000" in result.commands' - -- name: configure buffered logging size (idempotence) - iosxr_logging: *bufferlog - register: result - -- assert: *false - -- name: remove buffered logging size - iosxr_logging: - dest: buffered - size: 4800000 - state: absent - provider: "{{ cli }}" - register: result - -- assert: *true - -- name: change logging parameters using aggregate - iosxr_logging: - aggregate: - - { dest: console, level: notifications } - - { dest: buffered, size: 4700000 } - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging buffered 4700000" in result.commands' - - '"logging console notifications" in result.commands' - -- name: remove logging parameters using aggregate - iosxr_logging: - aggregate: - - { dest: console, level: notifications } - - { dest: buffered, size: 4700000 } - state: absent - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"no logging console" in result.commands' - - '"no logging buffered" in result.commands' diff --git a/test/integration/targets/iosxr_logging/tests/cli/net_logging.yaml b/test/integration/targets/iosxr_logging/tests/cli/net_logging.yaml deleted file mode 100644 index b2b94f576e..0000000000 --- a/test/integration/targets/iosxr_logging/tests/cli/net_logging.yaml +++ /dev/null @@ -1,34 +0,0 @@ ---- -- debug: msg="START iosxr cli/net_logging.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: Remove host logging - setup - net_logging: - dest: host - name: 172.16.0.1 - state: absent - provider: "{{ cli }}" - -- name: Set up host logging using platform agnostic module - net_logging: - dest: host - name: 172.16.0.1 - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"logging 172.16.0.1 vrf default severity info" in result.commands' - -- name: Remove host logging - teardown - net_logging: - dest: host - name: 172.16.0.1 - state: absent - provider: "{{ cli }}" - -- debug: msg="END iosxr cli/net_logging.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_logging/tests/netconf/basic.yaml b/test/integration/targets/iosxr_logging/tests/netconf/basic.yaml deleted file mode 100644 index 1afec2cc75..0000000000 --- a/test/integration/targets/iosxr_logging/tests/netconf/basic.yaml +++ /dev/null @@ -1,189 +0,0 @@ ---- -# Remove old logging entries so that they don't conflict with tests -- name: remove host logging - iosxr_logging: - dest: host - name: 172.16.0.1 - state: absent - provider: "{{ netconf }}" - -- name: remove console logging - iosxr_logging: - dest: console - level: warning - state: absent - provider: "{{ netconf }}" - register: result - -- name: remove buffered logging - iosxr_logging: - dest: buffered - size: 2097155 - state: absent - provider: "{{ netconf }}" - register: result - -# Start tests -- name: set up syslog host logging - iosxr_logging: &addhostlog - dest: host - name: 172.16.0.1 - level: errors - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"172.16.0.1" in result.xml[0]' - -- name: set up syslog host logging (idempotent) - iosxr_logging: *addhostlog - register: result - -- assert: &false - that: - - 'result.changed == false' - -- name: delete/disable syslog host logging - iosxr_logging: &delhostlog - dest: host - name: 172.16.0.1 - state: absent - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"172.16.0.1" in result.xml[0]' - - '"delete" in result.xml[0]' - -- name: delete/disable syslog host logging (idempotent) - iosxr_logging: *delhostlog - register: result - -- assert: *false - -- name: add console logging with level warning - iosxr_logging: &consolelog - dest: console - level: warning - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"console" in result.xml[0]' - - '"warning" in result.xml[0]' - -- name: console logging with level warning (idempotent) - iosxr_logging: *consolelog - register: result - -- assert: *false - -- name: remove console logging with level warning - iosxr_logging: - dest: console - level: warning - state: absent - provider: "{{ netconf }}" - register: result - -- assert: &true - that: - - 'result.changed == true' - -- name: configure buffered logging size - iosxr_logging: &bufferlog - dest: buffered - size: 4800000 - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"buffered" in result.xml[0]' - - '"4800000" in result.xml[0]' - -- name: configure buffered logging size (idempotence) - iosxr_logging: *bufferlog - register: result - -- assert: *false - -- name: remove buffered logging size - iosxr_logging: - dest: buffered - size: 4800000 - state: absent - provider: "{{ netconf }}" - register: result - -- assert: *true - -- name: change logging parameters using aggregate - iosxr_logging: - aggregate: - - { dest: console, level: notifications } - - { dest: buffered, size: 4700000 } - - { dest: monitor, level: alerts } - - { dest: host, name: 10.10.10.1, level: errors } - - { dest: host, name: 10.10.10.2 } - - { dest: file, name: file1, size: 2048, level: critical} - - { dest: file, name: file2, size: 2048 } - - { facility: local3 } - - { hostnameprefix: host3 } - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"file1" in result.xml[0]' - - '"file2" in result.xml[0]' - - '"10.10.10.1" in result.xml[1]' - - '"10.10.10.2" in result.xml[1]' - - '"notice" in result.xml[2]' - - '"alert" in result.xml[3]' - - '"4700000" in result.xml[4]' - - '"info" in result.xml[5]' - - '"local3" in result.xml[6]' - - '"host3" in result.xml[7]' - -- name: remove logging parameters using aggregate - iosxr_logging: - aggregate: - - { dest: console, level: notifications } - - { dest: buffered, size: 4700000 } - - { dest: monitor, level: alerts } - - { dest: host, name: 10.10.10.1, level: errors } - - { dest: host, name: 10.10.10.2 } - - { dest: file, name: file1, size: 2048, level: critical} - - { dest: file, name: file2, size: 2048 } - - { facility: local3 } - - { hostnameprefix: host3 } - state: absent - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"file1" in result.xml[0]' - - '"file2" in result.xml[0]' - - '"10.10.10.1" in result.xml[1]' - - '"10.10.10.2" in result.xml[1]' - - '"notice" in result.xml[2]' - - '"alert" in result.xml[3]' - - '"4700000" in result.xml[4]' - - '"info" in result.xml[5]' - - '"local3" in result.xml[6]' - - '"host3" in result.xml[7]' diff --git a/test/integration/targets/iosxr_netconf/defaults/main.yaml b/test/integration/targets/iosxr_netconf/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/iosxr_netconf/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/iosxr_netconf/meta/main.yaml b/test/integration/targets/iosxr_netconf/meta/main.yaml deleted file mode 100644 index d4da833dd5..0000000000 --- a/test/integration/targets/iosxr_netconf/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_netconf/tasks/cli.yaml b/test/integration/targets/iosxr_netconf/tasks/cli.yaml deleted file mode 100644 index 3f93a4f369..0000000000 --- a/test/integration/targets/iosxr_netconf/tasks/cli.yaml +++ /dev/null @@ -1,16 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - 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/iosxr_netconf/tasks/main.yaml b/test/integration/targets/iosxr_netconf/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_netconf/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_netconf/tests/cli/basic.yaml b/test/integration/targets/iosxr_netconf/tests/cli/basic.yaml deleted file mode 100644 index c1eae2e6d7..0000000000 --- a/test/integration/targets/iosxr_netconf/tests/cli/basic.yaml +++ /dev/null @@ -1,69 +0,0 @@ ---- -- debug: msg="START iosxr_netconf cli/basic.yaml on connection={{ ansible_connection }}" - -- name: Disable NetConf service - iosxr_netconf: &disable_netconf - state: absent - -- block: - - name: Enable Netconf service - iosxr_netconf: - netconf_port: 830 - netconf_vrf: 'default' - state: present - register: result - - - assert: &true - that: - - 'result.changed == true' - - - name: Check idempotence of Enable Netconf service - iosxr_netconf: - netconf_port: 830 - netconf_vrf: 'default' - state: present - register: result - - - assert: &false - that: - - 'result.changed == false' - - - name: Change Netconf port - iosxr_netconf: - netconf_port: 9000 - state: present - register: result - - - assert: *true - - - name: Check idempotent of change Netconf port - iosxr_netconf: - netconf_port: 9000 - state: present - register: result - - - assert: *false - - - name: Add Netconf vrf - iosxr_netconf: - netconf_port: 9000 - netconf_vrf: 'new_default' - state: present - register: result - - - assert: *true - - - name: Check idempotent of add Netconf vrf - iosxr_netconf: - netconf_port: 9000 - netconf_vrf: 'new_default' - state: present - register: result - - - assert: *false - - always: - - name: Disable Netconf service - iosxr_netconf: *disable_netconf - -- debug: msg="END iosxr_netconf cli/basic.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_smoke/defaults/main.yaml b/test/integration/targets/iosxr_smoke/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/iosxr_smoke/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/iosxr_smoke/meta/main.yaml b/test/integration/targets/iosxr_smoke/meta/main.yaml deleted file mode 100644 index d4da833dd5..0000000000 --- a/test/integration/targets/iosxr_smoke/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_smoke/tasks/cli.yaml b/test/integration/targets/iosxr_smoke/tasks/cli.yaml deleted file mode 100644 index e6956cc5b0..0000000000 --- a/test/integration/targets/iosxr_smoke/tasks/cli.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - 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 - -- 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/iosxr_smoke/tasks/main.yaml b/test/integration/targets/iosxr_smoke/tasks/main.yaml deleted file mode 100644 index af08869c92..0000000000 --- a/test/integration/targets/iosxr_smoke/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: netconf.yaml, tags: ['netconf'] } diff --git a/test/integration/targets/iosxr_smoke/tasks/netconf.yaml b/test/integration/targets/iosxr_smoke/tasks/netconf.yaml deleted file mode 100644 index 2b284b5886..0000000000 --- a/test/integration/targets/iosxr_smoke/tasks/netconf.yaml +++ /dev/null @@ -1,22 +0,0 @@ ---- -- name: collect all netconf test cases - find: - paths: "{{ role_path }}/tests/netconf" - 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 cases (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/iosxr_smoke/tests/cli/common_config.yaml b/test/integration/targets/iosxr_smoke/tests/cli/common_config.yaml deleted file mode 100644 index fc5ba99abb..0000000000 --- a/test/integration/targets/iosxr_smoke/tests/cli/common_config.yaml +++ /dev/null @@ -1,100 +0,0 @@ ---- -- debug: msg="START cli/common_config.yaml on connection={{ ansible_connection }}" - -# Sublevel / Block -- name: setup - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.2 any log - - 30 permit ipv4 host 192.0.2.3 any log - parents: ['ipv4 access-list test'] - before: ['no ipv4 access-list test'] - match: none - -- name: configure sub level command using block resplace - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.2 any log - - 30 permit ipv4 host 192.0.2.3 any log - - 40 permit ipv4 host 192.0.2.4 any log - parents: ['ipv4 access-list test'] - replace: block - register: result - -- assert: - that: - - "result.changed == true" - - "'ipv4 access-list test' in result.commands" - - "'10 permit ipv4 host 192.0.2.1 any log' in result.commands" - - "'20 permit ipv4 host 192.0.2.2 any log' in result.commands" - - "'30 permit ipv4 host 192.0.2.3 any log' in result.commands" - - "'40 permit ipv4 host 192.0.2.4 any log' in result.commands" - -- name: check sub level command using block replace - iosxr_config: - commands: - - 10 permit ipv4 host 192.0.2.1 any log - - 20 permit ipv4 host 192.0.2.2 any log - - 30 permit ipv4 host 192.0.2.3 any log - - 40 permit ipv4 host 192.0.2.4 any log - parents: ['ipv4 access-list test'] - replace: block - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - iosxr_config: - commands: ['no ipv4 access-list test'] - match: none - -# diff exact, strict, line -- name: setup - iosxr_config: - commands: - - 'hostname {{ inventory_hostname_short }}' - register: result - -- name: set hostname - iosxr_config: - commands: - - hostname testhost - match: strict - register: result - -- iosxr_command: - commands: - - show configuration running-config hostname - register: configured_hostname - -- assert: - that: - - "'testhost' in configured_hostname.stdout[0]" - -- name: set hostname - iosxr_config: - commands: - - hostname testhost2 - match: exact - register: result - -- iosxr_command: - commands: - - show configuration running-config hostname - register: configured_hostname - -- assert: - that: - - "'testhost2' in configured_hostname.stdout[0]" - -- name: teardown - iosxr_config: - commands: - - 'hostname {{ inventory_hostname_short }}' - register: result - -- debug: msg="END cli/common_config.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_smoke/tests/cli/common_utils.yaml b/test/integration/targets/iosxr_smoke/tests/cli/common_utils.yaml deleted file mode 100644 index f1dfeffbab..0000000000 --- a/test/integration/targets/iosxr_smoke/tests/cli/common_utils.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: msg="START iosxr cli/common_utils.yaml on connection={{ ansible_connection }}" - -# Functions used by iosxr: conditional, remove_default_spec - -# hit conditional() and remove_default_spec() -- name: Check intent arguments - iosxr_interface: - name: GigabitEthernet0/0/0/1 - state: up - tx_rate: ge(0) - rx_rate: ge(0) - provider: "{{ cli }}" - register: result - -- assert: - that: - - "result.failed == false" - -- name: Check intent arguments (failed condition) - iosxr_interface: - name: GigabitEthernet0/0/0/1 - state: down - tx_rate: gt(0) - rx_rate: lt(0) - provider: "{{ cli }}" - ignore_errors: yes - register: result - -- assert: - that: - - "result.failed == true" - - "'state eq(down)' in result.failed_conditions" - - "'tx_rate gt(0)' in result.failed_conditions" - - "'rx_rate lt(0)' in result.failed_conditions" - -- debug: msg="END iosxr cli/common_utils.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml b/test/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml deleted file mode 100644 index 3463cc2bb4..0000000000 --- a/test/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml +++ /dev/null @@ -1,53 +0,0 @@ ---- -- debug: msg="START iosxr netconf/common_netconf.yaml on connection={{ ansible_connection }}" - -# hit general code -- name: setup - remove login - iosxr_banner: - banner: login - provider: "{{ netconf }}" - state: absent - -- name: Set login - iosxr_banner: - banner: login - text: | - this is my login banner - that has a multiline - string - provider: "{{ netconf }}" - state: present - register: result - -- debug: - msg: "{{ result }}" - -- assert: - that: - - "result.changed == true" - - "'this is my login banner' in result.xml" - - "'that has a multiline' in result.xml" - -# hit etree_findall() -- name: remove host logging - iosxr_logging: - dest: host - name: 172.16.0.1 - state: absent - provider: "{{ netconf }}" - -- name: set up syslog host logging - iosxr_logging: &addhostlog - dest: host - name: 172.16.0.1 - level: errors - state: present - provider: "{{ netconf }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"172.16.0.1" in result.xml[0]' - -- debug: msg="END iosxr netconf/common_netconf.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_smoke/tests/netconf/misc_tests.yaml b/test/integration/targets/iosxr_smoke/tests/netconf/misc_tests.yaml deleted file mode 100644 index fc5df1fb5d..0000000000 --- a/test/integration/targets/iosxr_smoke/tests/netconf/misc_tests.yaml +++ /dev/null @@ -1,39 +0,0 @@ -- debug: msg="START iosxr netconf/misc_tests.yaml on connection={{ ansible_connection }}" - - -# hit module_utils.network.iosxr -> get_oper() -- name: Setup (interface is up) - iosxr_interface: - name: GigabitEthernet0/0/0/1 - description: test_interface_1 - enabled: True - state: present - provider: "{{ netconf }}" - register: result - -- name: Check intent arguments - iosxr_interface: - name: GigabitEthernet0/0/0/1 - state: up - delay: 10 - provider: "{{ netconf }}" - register: result - -- assert: - that: - - "result.failed == false" - -- name: Check intent arguments (failed condition) - iosxr_interface: - name: GigabitEthernet0/0/0/1 - state: down - provider: "{{ netconf }}" - ignore_errors: yes - register: result - -- assert: - that: - - "result.failed == true" - - "'state eq(down)' in result.failed_conditions" - -- debug: msg="END iosxr netconf/misc_tests.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_static_routes/defaults/main.yaml b/test/integration/targets/iosxr_static_routes/defaults/main.yaml deleted file mode 100644 index 164afead28..0000000000 --- a/test/integration/targets/iosxr_static_routes/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "[^_].*" -test_items: [] diff --git a/test/integration/targets/iosxr_static_routes/fixtures/parsed.cfg b/test/integration/targets/iosxr_static_routes/fixtures/parsed.cfg deleted file mode 100644 index 3594833635..0000000000 --- a/test/integration/targets/iosxr_static_routes/fixtures/parsed.cfg +++ /dev/null @@ -1,18 +0,0 @@ -Fri Nov 29 21:10:41.896 UTC -router static - address-family ipv4 unicast - 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 - 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 - 192.0.2.32/28 192.0.2.11 100 - ! - address-family ipv6 unicast - 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC - 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 - ! - vrf DEV_SITE - address-family ipv4 unicast - 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV - 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 - ! - ! -! diff --git a/test/integration/targets/iosxr_static_routes/tasks/cli.yaml b/test/integration/targets/iosxr_static_routes/tasks/cli.yaml deleted file mode 100644 index 337e34133b..0000000000 --- a/test/integration/targets/iosxr_static_routes/tasks/cli.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- name: Collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - use_regex: true - register: test_cases - delegate_to: localhost - -- name: Set test_items - set_fact: test_items="{{ test_cases.files | map(attribute='path') | list }}" - delegate_to: localhost - -- name: Run test case (connection=network_cli) - include: "{{ test_case_to_run }}" - vars: - ansible_connection: network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_static_routes/tasks/main.yaml b/test/integration/targets/iosxr_static_routes/tasks/main.yaml deleted file mode 100644 index 415c99d8b1..0000000000 --- a/test/integration/targets/iosxr_static_routes/tasks/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml deleted file mode 100644 index 1c1d63b1d7..0000000000 --- a/test/integration/targets/iosxr_static_routes/tests/cli/_populate_config.yaml +++ /dev/null @@ -1,60 +0,0 @@ ---- -- name: Setup - iosxr_static_routes: - config: - - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.16/28 - next_hops: - - forward_router_address: 192.0.2.10 - interface: FastEthernet0/0/0/1 - description: "LAB" - metric: 120 - tag: 10 - - - interface: FastEthernet0/0/0/5 - track: ip_sla_1 - - - dest: 192.0.2.32/28 - next_hops: - - forward_router_address: 192.0.2.11 - admin_distance: 100 - - - afi: ipv6 - safi: unicast - routes: - - dest: 2001:db8:1000::/36 - next_hops: - - interface: FastEthernet0/0/0/7 - description: "DC" - - - interface: FastEthernet0/0/0/8 - forward_router_address: 2001:db8:2000:2::1 - - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.12 - description: "DEV" - dest_vrf: test_1 - - - forward_router_address: 192.0.3.24 - interface: GigabitEthernet0/0/0/1 - vrflabel: 2302 - - - dest: 192.0.2.80/28 - next_hops: - - interface: FastEthernet0/0/0/2 - forward_router_address: 192.0.2.14 - dest_vrf: test_1 - track: ip_sla_2 - vrflabel: 124 - - state: merged -
\ No newline at end of file diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml deleted file mode 100644 index 97d4d48ee2..0000000000 --- a/test/integration/targets/iosxr_static_routes/tests/cli/_remove_config.yaml +++ /dev/null @@ -1,8 +0,0 @@ ---- -- name: Remove Static Routes - cli_config: - config: "{{ lines }}" - vars: - lines: | - no router static - ignore_errors: yes diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml deleted file mode 100644 index b6724c13aa..0000000000 --- a/test/integration/targets/iosxr_static_routes/tests/cli/deleted.yaml +++ /dev/null @@ -1,124 +0,0 @@ ---- -- debug: - msg: "Start iosxr_static_routes deleted integration tests ansible_connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Delete a single next_hop from a destination network - iosxr_static_routes: &deleted_1 - config: - - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.16/28 - next_hops: - - forward_router_address: 192.0.2.10 - interface: FastEthernet0/0/0/1 - state: deleted - register: result - - - assert: - that: - - '"router static" in result.commands' - - '"address-family ipv4 unicast" in result.commands' - - '"no 192.0.2.16/28 192.0.2.10 FastEthernet0/0/0/1" in result.commands' - - 'result.commands|length == 3' - - - name: Delete a single next_hop from a destination network (IDEMPOTENT) - iosxr_static_routes: *deleted_1 - register: result - - - assert: &unchanged - that: - - "result.changed == false" - - "result.commands|length == 0" - - - name: Delete a destination network entry - iosxr_static_routes: &deleted_2 - config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - state: deleted - register: result - - - assert: - that: - - '"router static" in result.commands' - - '"vrf DEV_SITE" in result.commands' - - '"address-family ipv4 unicast" in result.commands' - - '"no 192.0.2.48/28" in result.commands' - - "result.commands|length == 4" - - - name: Delete a destination network entry (IDEMPOTENT) - iosxr_static_routes: *deleted_2 - register: result - - - assert: *unchanged - - - name: Delete all destination network entries under a single AFI - iosxr_static_routes: &deleted_3 - config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - state: deleted - register: result - - - assert: - that: - - '"router static" in result.commands' - - '"vrf DEV_SITE" in result.commands' - - '"no address-family ipv4 unicast" in result.commands' - - "result.commands|length == 3" - - - name: Delete all destination network entries under a single AFI (IDEMPOTENT) - iosxr_static_routes: *deleted_3 - register: result - - - assert: *unchanged - - - include_tasks: _populate_config.yaml - - - name: Delete static routes configuration - iosxr_static_routes: &deleted - state: deleted - register: result - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ replaced['before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that the correct set of commands were generated - assert: - that: - - "{{ deleted['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that the after dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Delete all static routes (IDEMPOTENT) - iosxr_static_routes: *deleted - register: result - - - name: Assert that the previous task was idempotent - assert: *unchanged - - - name: Assert that the before dicts were correctly generated - assert: - that: - - "{{ deleted['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml deleted file mode 100644 index fd0625e012..0000000000 --- a/test/integration/targets/iosxr_static_routes/tests/cli/empty_config.yaml +++ /dev/null @@ -1,47 +0,0 @@ ---- -- debug: - msg: "START iosxr_static_routes empty_config integration tests on connection={{ ansible_connection }}" - -- name: Merged with empty config should give appropriate error message - iosxr_static_routes: - config: - state: merged - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state merged' - -- name: Replaced with empty config should give appropriate error message - iosxr_static_routes: - config: - state: replaced - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state replaced' - -- name: Overridden with empty config should give appropriate error message - iosxr_static_routes: - config: - state: overridden - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of config parameter must not be empty for state overridden' - -- name: Parsed with empty running_config should give appropriate error message - iosxr_static_routes: - running_config: - state: parsed - register: result - ignore_errors: True - -- assert: - that: - - result.msg == 'value of running_config parameter must not be empty for state parsed'
\ No newline at end of file diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml deleted file mode 100644 index 2286b02ad3..0000000000 --- a/test/integration/targets/iosxr_static_routes/tests/cli/gathered.yaml +++ /dev/null @@ -1,20 +0,0 @@ ---- -- debug: - msg: "START iosxr_static_routes gathered integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Gather static routes facts from the device using iosxr_static_routes module - iosxr_static_routes: - state: gathered - register: result - - - assert: - that: "{{ replaced['before'] | symmetric_difference(result['gathered']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml - diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/merged.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/merged.yaml deleted file mode 100644 index 40eb02f45e..0000000000 --- a/test/integration/targets/iosxr_static_routes/tests/cli/merged.yaml +++ /dev/null @@ -1,141 +0,0 @@ ---- -- debug: - msg: "START iosxr_static_routes merged integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Merge the provided configuration with the exisiting running configuration - iosxr_static_routes: &merged - config: - - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.16/28 - next_hops: - - forward_router_address: 192.0.2.10 - interface: FastEthernet0/0/0/1 - description: "LAB" - metric: 120 - tag: 10 - - - interface: FastEthernet0/0/0/5 - track: ip_sla_1 - - - dest: 192.0.2.32/28 - next_hops: - - forward_router_address: 192.0.2.11 - admin_distance: 100 - - - afi: ipv6 - safi: unicast - routes: - - dest: 2001:db8:1000::/36 - next_hops: - - interface: FastEthernet0/0/0/7 - description: "DC" - - - interface: FastEthernet0/0/0/8 - forward_router_address: 2001:db8:2000:2::1 - - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.12 - description: "DEV" - dest_vrf: test_1 - - - dest: 192.0.2.80/28 - next_hops: - - interface: FastEthernet0/0/0/2 - forward_router_address: 192.0.2.14 - dest_vrf: test_1 - track: ip_sla_2 - vrflabel: 124 - state: merged - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - set_fact: - diff: "{{ merged['after'] | symmetric_difference(result['after']) }}" - - - name: Assert that after dicts was correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Merge the provided configuration with the existing running configuration (IDEMPOTENT) - iosxr_static_routes: *merged - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dicts were correctly generated - assert: - that: - - "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Update existing configuration using merged - iosxr_static_routes: &merged_update - config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.12 - vrflabel: 2301 - dest_vrf: test_1 - - - dest: 192.0.2.80/28 - next_hops: - - interface: FastEthernet0/0/0/2 - forward_router_address: 192.0.2.14 - dest_vrf: test_1 - description: "rt_test_1" - register: result - - - name: Assert that before dicts were correctly generated - assert: - that: "{{ merged['after'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ merged['update_commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that after dicts were correctly generated - assert: - that: "{{ merged['update_after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Update existing static_routes configuration using merged (IDEMPOTENT) - iosxr_static_routes: *merged_update - register: result - - - name: Assert that the previous task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml deleted file mode 100644 index 44f62efe44..0000000000 --- a/test/integration/targets/iosxr_static_routes/tests/cli/overridden.yaml +++ /dev/null @@ -1,66 +0,0 @@ ---- -- debug: - msg: "START iosxr_static_routes overridden integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Overridde all static routes configuration with provided configuration - iosxr_static_routes: &overridden - config: - - vrf: DEV_NEW - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.15 - interface: FastEthernet0/0/0/3 - description: "DEV1" - - afi: ipv6 - safi: unicast - routes: - - dest: 2001:db8:3000::/36 - next_hops: - - interface: FastEthernet0/0/0/4 - forward_router_address: 2001:db8:2000:2::2 - description: "PROD1" - track: ip_sla_1 - state: overridden - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ overridden['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ replaced['before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Overridde all static routes configuration with given configuration (IDEMPOTENT) - iosxr_static_routes: *overridden - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ overridden['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml deleted file mode 100644 index 0932818c51..0000000000 --- a/test/integration/targets/iosxr_static_routes/tests/cli/parsed.yaml +++ /dev/null @@ -1,15 +0,0 @@ ---- -- debug: - msg: "START iosxr_static_routes parsed integration tests on connection={{ ansible_connection }}" - -- block: - - name: Use parsed state to convert externally supplied device specific static routes commands to structured format - iosxr_static_routes: - running_config: "{{ lookup('file', '../../fixtures/parsed.cfg') }}" - state: parsed - register: result - - - assert: - that: "{{ merged['after'] | symmetric_difference(result['parsed']) |length==0 }}" - -
\ No newline at end of file diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml deleted file mode 100644 index f469eb1b2c..0000000000 --- a/test/integration/targets/iosxr_static_routes/tests/cli/rendered.yaml +++ /dev/null @@ -1,76 +0,0 @@ ---- -- debug: - msg: "START iosxr_static_routes rendered integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- block: - - name: Use rendered state to convert task input to device specific commands - iosxr_static_routes: - config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.12 - description: "DEV" - dest_vrf: test_1 - - - dest: 192.0.2.80/28 - next_hops: - - interface: FastEthernet0/0/0/2 - forward_router_address: 192.0.2.14 - dest_vrf: test_1 - track: ip_sla_2 - vrflabel: 124 - - - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.16/28 - next_hops: - - forward_router_address: 192.0.2.10 - interface: FastEthernet0/0/0/1 - description: "LAB" - metric: 120 - tag: 10 - - - interface: FastEthernet0/0/0/5 - track: ip_sla_1 - - - dest: 192.0.2.32/28 - next_hops: - - forward_router_address: 192.0.2.11 - admin_distance: 100 - - - afi: ipv6 - safi: unicast - routes: - - dest: 2001:db8:1000::/36 - next_hops: - - interface: FastEthernet0/0/0/7 - description: "DC" - - - interface: FastEthernet0/0/0/8 - forward_router_address: 2001:db8:2000:2::1 - state: rendered - register: result - - - assert: - that: "{{ merged['commands'] | symmetric_difference(result['rendered']) |length==0 }}" - - - name: Gather static routes facts from the device and assert that its empty - iosxr_static_routes: - state: gathered - register: result - - - name: Make sure that rendered task actually did not make any changes to the device - assert: - that: "{{ result['gathered'] == [] }}" - - always: - - include_tasks: _remove_config.yaml
\ No newline at end of file diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml deleted file mode 100644 index b0f9cf8429..0000000000 --- a/test/integration/targets/iosxr_static_routes/tests/cli/replaced.yaml +++ /dev/null @@ -1,58 +0,0 @@ ---- -- debug: - msg: "START iosxr_static_routes replaced integration tests on connection={{ ansible_connection }}" - -- include_tasks: _remove_config.yaml - -- include_tasks: _populate_config.yaml - -- block: - - name: Replace device configurations of static routes with provided configurations - iosxr_static_routes: &replaced - config: - - vrf: DEV_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.15 - interface: FastEthernet0/0/0/3 - description: "DEV_NEW" - dest_vrf: dev_test_2 - state: replaced - register: result - - - name: Assert that correct set of commands were generated - assert: - that: - - "{{ replaced['commands'] | symmetric_difference(result['commands']) |length == 0 }}" - - - name: Assert that before dicts are correctly generated - assert: - that: - - "{{ replaced['before'] | symmetric_difference(result['before']) |length == 0 }}" - - - name: Assert that after dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Replace device configurations of listed vrfs/global entry with provided configuration (IDEMPOTENT) - iosxr_static_routes: *replaced - register: result - - - name: Assert that task was idempotent - assert: - that: - - "result['changed'] == false" - - "result.commands|length == 0" - - - name: Assert that before dict is correctly generated - assert: - that: - - "{{ replaced['after'] | symmetric_difference(result['before']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_static_routes/tests/cli/rtt.yaml b/test/integration/targets/iosxr_static_routes/tests/cli/rtt.yaml deleted file mode 100644 index ccc63bcbd5..0000000000 --- a/test/integration/targets/iosxr_static_routes/tests/cli/rtt.yaml +++ /dev/null @@ -1,73 +0,0 @@ ---- -- debug: - msg: "START iosxr_static_routes round trip integration tests on connection={{ ansible_connection }}" - -- block: - - include_tasks: _remove_config.yaml - - - name: Apply the provided configuration (base config) - iosxr_static_routes: - config: - - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.15 - admin_distance: 105 - track: ip_sla_2 - - vrf: DEV_SITE - address_families: - - afi: ipv6 - safi: unicast - routes: - - dest: 2001:db8:3000::/36 - next_hops: - - forward_router_address: 2001:db8:2000:2::2 - interface: FastEthernet0/0/0/11 - description: PROD1 - state: merged - register: base_config - - - name: Gather interfaces facts - iosxr_facts: - gather_subset: - - "!all" - - "!min" - gather_network_resources: - - static_routes - - - name: Apply the provided configuration (config to be reverted) - iosxr_static_routes: - config: - - vrf: TEST_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.80/28 - next_hops: - - forward_router_address: 192.0.2.12 - interface: FastEthernet0/0/0/3 - description: "DEV_MOVED" - dest_vrf: dev_moved - state: overridden - register: result - - - name: Assert that changes were applied - assert: - that: "{{ round_trip['after'] | symmetric_difference(result['after']) |length == 0 }}" - - - name: Revert back to base config using facts round trip - iosxr_static_routes: - config: "{{ ansible_facts['network_resources']['static_routes'] }}" - state: overridden - register: revert - - - name: Assert that config was reverted - assert: - that: "{{ base_config['after'] | symmetric_difference(revert['after']) |length == 0 }}" - - always: - - include_tasks: _remove_config.yaml diff --git a/test/integration/targets/iosxr_static_routes/vars/main.yaml b/test/integration/targets/iosxr_static_routes/vars/main.yaml deleted file mode 100644 index 68881b51d3..0000000000 --- a/test/integration/targets/iosxr_static_routes/vars/main.yaml +++ /dev/null @@ -1,281 +0,0 @@ ---- -merged: - before: [] - - commands: - - router static - - address-family ipv4 unicast - - 192.0.2.16/28 192.0.2.10 FastEthernet0/0/0/1 description LAB metric 120 tag 10 - - 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 - - 192.0.2.32/28 192.0.2.11 100 - - address-family ipv6 unicast - - 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC - - 2001:db8:1000::/36 2001:db8:2000:2::1 FastEthernet0/0/0/8 - - vrf DEV_SITE - - address-family ipv4 unicast - - 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV - - 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 track ip_sla_2 vrflabel 124 - - update_commands: - - router static - - vrf DEV_SITE - - address-family ipv4 unicast - - 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV vrflabel 2301 - - 192.0.2.80/28 vrf test_1 192.0.2.14 FastEthernet0/0/0/2 description rt_test_1 track ip_sla_2 vrflabel 124 - - after: - - address_families: - - afi: ipv4 - routes: - - dest: 192.0.2.16/28 - next_hops: - - description: LAB - forward_router_address: 192.0.2.10 - interface: FastEthernet0/0/0/1 - metric: 120 - tag: 10 - - interface: FastEthernet0/0/0/5 - track: ip_sla_1 - - dest: 192.0.2.32/28 - next_hops: - - admin_distance: 100 - forward_router_address: 192.0.2.11 - safi: unicast - - afi: ipv6 - routes: - - dest: 2001:db8:1000::/36 - next_hops: - - description: DC - interface: FastEthernet0/0/0/7 - - forward_router_address: 2001:db8:2000:2::1 - interface: FastEthernet0/0/0/8 - safi: unicast - - address_families: - - afi: ipv4 - routes: - - dest: 192.0.2.48/28 - next_hops: - - description: DEV - dest_vrf: test_1 - forward_router_address: 192.0.2.12 - - dest: 192.0.2.80/28 - next_hops: - - dest_vrf: test_1 - forward_router_address: 192.0.2.14 - interface: FastEthernet0/0/0/2 - track: ip_sla_2 - vrflabel: 124 - safi: unicast - vrf: DEV_SITE - - update_after: - - address_families: - - afi: ipv4 - routes: - - dest: 192.0.2.16/28 - next_hops: - - description: LAB - forward_router_address: 192.0.2.10 - interface: FastEthernet0/0/0/1 - metric: 120 - tag: 10 - - interface: FastEthernet0/0/0/5 - track: ip_sla_1 - - dest: 192.0.2.32/28 - next_hops: - - admin_distance: 100 - forward_router_address: 192.0.2.11 - safi: unicast - - afi: ipv6 - routes: - - dest: 2001:db8:1000::/36 - next_hops: - - description: DC - interface: FastEthernet0/0/0/7 - - forward_router_address: 2001:db8:2000:2::1 - interface: FastEthernet0/0/0/8 - safi: unicast - - address_families: - - afi: ipv4 - routes: - - dest: 192.0.2.48/28 - next_hops: - - description: DEV - dest_vrf: test_1 - forward_router_address: 192.0.2.12 - vrflabel: 2301 - - dest: 192.0.2.80/28 - next_hops: - - dest_vrf: test_1 - forward_router_address: 192.0.2.14 - interface: FastEthernet0/0/0/2 - track: ip_sla_2 - vrflabel: 124 - description: rt_test_1 - safi: unicast - vrf: DEV_SITE - - -replaced: - before: - - address_families: - - afi: ipv4 - routes: - - dest: 192.0.2.16/28 - next_hops: - - description: LAB - forward_router_address: 192.0.2.10 - interface: FastEthernet0/0/0/1 - metric: 120 - tag: 10 - - interface: FastEthernet0/0/0/5 - track: ip_sla_1 - - dest: 192.0.2.32/28 - next_hops: - - admin_distance: 100 - forward_router_address: 192.0.2.11 - safi: unicast - - afi: ipv6 - routes: - - dest: 2001:db8:1000::/36 - next_hops: - - description: DC - interface: FastEthernet0/0/0/7 - - forward_router_address: 2001:db8:2000:2::1 - interface: FastEthernet0/0/0/8 - safi: unicast - - - address_families: - - afi: ipv4 - routes: - - dest: 192.0.2.48/28 - next_hops: - - description: DEV - dest_vrf: test_1 - forward_router_address: 192.0.2.12 - - - forward_router_address: 192.0.3.24 - interface: GigabitEthernet0/0/0/1 - vrflabel: 2302 - - - dest: 192.0.2.80/28 - next_hops: - - dest_vrf: test_1 - forward_router_address: 192.0.2.14 - interface: FastEthernet0/0/0/2 - track: ip_sla_2 - vrflabel: 124 - safi: unicast - vrf: DEV_SITE - - commands: - - router static - - vrf DEV_SITE - - address-family ipv4 unicast - - no 192.0.2.48/28 192.0.3.24 GigabitEthernet0/0/0/1 - - no 192.0.2.48/28 vrf test_1 192.0.2.12 - - 192.0.2.48/28 vrf dev_test_2 192.0.2.15 FastEthernet0/0/0/3 description DEV_NEW - - after: - - address_families: - - afi: ipv4 - routes: - - dest: 192.0.2.16/28 - next_hops: - - description: LAB - forward_router_address: 192.0.2.10 - interface: FastEthernet0/0/0/1 - metric: 120 - tag: 10 - - interface: FastEthernet0/0/0/5 - track: ip_sla_1 - - dest: 192.0.2.32/28 - next_hops: - - admin_distance: 100 - forward_router_address: 192.0.2.11 - safi: unicast - - afi: ipv6 - routes: - - dest: 2001:db8:1000::/36 - next_hops: - - description: DC - interface: FastEthernet0/0/0/7 - - forward_router_address: 2001:db8:2000:2::1 - interface: FastEthernet0/0/0/8 - safi: unicast - - - address_families: - - afi: ipv4 - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.15 - interface: FastEthernet0/0/0/3 - description: "DEV_NEW" - dest_vrf: dev_test_2 - - - dest: 192.0.2.80/28 - next_hops: - - dest_vrf: test_1 - forward_router_address: 192.0.2.14 - interface: FastEthernet0/0/0/2 - track: ip_sla_2 - vrflabel: 124 - safi: unicast - vrf: DEV_SITE - - -overridden: - commands: - - router static - - no vrf DEV_SITE - - no address-family ipv4 unicast - - no address-family ipv6 unicast - - vrf DEV_NEW - - address-family ipv4 unicast - - 192.0.2.48/28 192.0.2.15 FastEthernet0/0/0/3 description DEV1 - - address-family ipv6 unicast - - 2001:db8:3000::/36 2001:db8:2000:2::2 FastEthernet0/0/0/4 description PROD1 track ip_sla_1 - - after: - - vrf: DEV_NEW - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.48/28 - next_hops: - - forward_router_address: 192.0.2.15 - interface: FastEthernet0/0/0/3 - description: "DEV1" - - - afi: ipv6 - safi: unicast - routes: - - dest: 2001:db8:3000::/36 - next_hops: - - interface: FastEthernet0/0/0/4 - forward_router_address: 2001:db8:2000:2::2 - description: "PROD1" - track: ip_sla_1 - -deleted: - commands: - - no router static - - after: [] - -round_trip: - after: - - vrf: TEST_SITE - address_families: - - afi: ipv4 - safi: unicast - routes: - - dest: 192.0.2.80/28 - next_hops: - - forward_router_address: 192.0.2.12 - interface: FastEthernet0/0/0/3 - description: "DEV_MOVED" - dest_vrf: dev_moved -
\ No newline at end of file diff --git a/test/integration/targets/iosxr_system/defaults/main.yaml b/test/integration/targets/iosxr_system/defaults/main.yaml deleted file mode 100644 index 5f709c5aac..0000000000 --- a/test/integration/targets/iosxr_system/defaults/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ ---- -testcase: "*" diff --git a/test/integration/targets/iosxr_system/meta/main.yml b/test/integration/targets/iosxr_system/meta/main.yml deleted file mode 100644 index d4da833dd5..0000000000 --- a/test/integration/targets/iosxr_system/meta/main.yml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_system/tasks/cli.yaml b/test/integration/targets/iosxr_system/tasks/cli.yaml deleted file mode 100644 index cb2f3ff6e7..0000000000 --- a/test/integration/targets/iosxr_system/tasks/cli.yaml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - 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 - -# Only one of the Testcase would be run to check if `connection: local` -# is established. Full suite is run with `connection:network_cli` or `connection:netconf` -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_first_found: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - -- name: reset connection - meta: reset_connection diff --git a/test/integration/targets/iosxr_system/tasks/main.yaml b/test/integration/targets/iosxr_system/tasks/main.yaml deleted file mode 100644 index af08869c92..0000000000 --- a/test/integration/targets/iosxr_system/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: netconf.yaml, tags: ['netconf'] } diff --git a/test/integration/targets/iosxr_system/tasks/netconf.yaml b/test/integration/targets/iosxr_system/tasks/netconf.yaml deleted file mode 100644 index 4f2789e85f..0000000000 --- a/test/integration/targets/iosxr_system/tasks/netconf.yaml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: collect all netconf test cases - find: - paths: "{{ role_path }}/tests/netconf" - 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=netconf) - include: "{{ test_case_to_run }}" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - -# Only one of the Testcase would be run to check if `connection: local` -# is established. Full suite is run with `connection:network_cli` or `connection:netconf` -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_first_found: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - -- name: reset connection - meta: reset_connection diff --git a/test/integration/targets/iosxr_system/tests/cli/net_system.yaml b/test/integration/targets/iosxr_system/tests/cli/net_system.yaml deleted file mode 100644 index d78c510757..0000000000 --- a/test/integration/targets/iosxr_system/tests/cli/net_system.yaml +++ /dev/null @@ -1,37 +0,0 @@ ---- -- debug: msg="START iosxr cli/net_system.yaml on connection={{ ansible_connection }}" - -# Add minimal testcase to check args are passed correctly to -# implementation module and module run is successful. - -- name: setup - iosxr_config: - lines: - - no domain list ansible.com - - no domain list redhat.com - match: none - provider: "{{ cli }}" - -- name: configure domain_search using platform agnostic module - net_system: - domain_search: - - ansible.com - - redhat.com - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == true - - "'domain list ansible.com' in result.commands" - - "'domain list redhat.com' in result.commands" - -- name: teardown - iosxr_config: - lines: - - no domain list ansible.com - - no domain list redhat.com - match: none - provider: "{{ cli }}" - -- debug: msg="END iosxr cli/net_system.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml b/test/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml deleted file mode 100644 index 7a3ed5f03e..0000000000 --- a/test/integration/targets/iosxr_system/tests/cli/set_domain_list.yaml +++ /dev/null @@ -1,121 +0,0 @@ ---- -- debug: msg="START cli/set_domain_search.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - lines: - - no domain list ansible.com - - no domain list redhat.com - match: none - provider: "{{ cli }}" - -- name: configure domain_search - iosxr_system: - domain_search: - - ansible.com - - redhat.com - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == true - - "'domain list ansible.com' in result.commands" - - "'domain list redhat.com' in result.commands" - -- name: verify domain_search - iosxr_system: - domain_search: - - ansible.com - - redhat.com - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == false - -- name: remove one entry - iosxr_system: - domain_search: - - ansible.com - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == true - - "'no domain list redhat.com' in result.commands" - -- name: verify remove one entry - iosxr_system: - domain_search: - - ansible.com - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == false - -- name: add one entry - iosxr_system: - domain_search: - - ansible.com - - redhat.com - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == true - - "'domain list redhat.com' in result.commands" - -- name: verify add one entry - iosxr_system: - domain_search: - - ansible.com - - redhat.com - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == false - -- name: add and remove one entry - iosxr_system: - domain_search: - - ansible.com - - eng.ansible.com - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == true - - "'no domain list redhat.com' in result.commands" - - "'domain list eng.ansible.com' in result.commands" - - result.commands|length == 2 - -- name: verify add and remove one entry - iosxr_system: - domain_search: - - ansible.com - - eng.ansible.com - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == false - -- name: teardown - iosxr_config: - lines: - - no domain list ansible.com - - no domain list eng.ansible.com - match: none - provider: "{{ cli }}" - -- debug: msg="END cli/set_domain_search.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml b/test/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml deleted file mode 100644 index abbbcab4f9..0000000000 --- a/test/integration/targets/iosxr_system/tests/cli/set_domain_name.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: msg="START cli/set_domain_name.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - lines: no domain name - match: none - provider: "{{ cli }}" - -- name: configure domain_name - iosxr_system: - domain_name: eng.ansible.com - provider: "{{ cli }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify domain_name - iosxr_system: - domain_name: eng.ansible.com - provider: "{{ cli }}" - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - iosxr_config: - lines: no domain name - match: none - provider: "{{ cli }}" - -- debug: msg="END cli/set_domain_name.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_system/tests/cli/set_hostname.yaml b/test/integration/targets/iosxr_system/tests/cli/set_hostname.yaml deleted file mode 100644 index 69f8ee114e..0000000000 --- a/test/integration/targets/iosxr_system/tests/cli/set_hostname.yaml +++ /dev/null @@ -1,36 +0,0 @@ ---- -- debug: msg="START cli/set_hostname.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - lines: hostname switch - match: none - provider: "{{ cli }}" - -- name: configure hostname - iosxr_system: - hostname: foo - provider: "{{ cli }}" - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify hostname - iosxr_system: - hostname: foo - provider: "{{ cli }}" - register: result - -- assert: - that: - - "result.changed == false" - -- name: teardown - iosxr_config: - lines: "hostname {{ inventory_hostname }}" - match: none - provider: "{{ cli }}" - -- debug: msg="END cli/set_hostname.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml b/test/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml deleted file mode 100644 index ab1b64ad13..0000000000 --- a/test/integration/targets/iosxr_system/tests/cli/set_lookup_source.yaml +++ /dev/null @@ -1,38 +0,0 @@ ---- -- debug: msg="START cli/set_lookup_source.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - lines: no domain lookup source-interface Loopback10 - match: none - provider: "{{ cli }}" - -- name: configure lookup_source - iosxr_system: - lookup_source: Loopback10 - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == true - - "'domain lookup source-interface Loopback10' in result.commands" - -- name: verify lookup_source - iosxr_system: - lookup_source: Loopback10 - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == false - -- name: teardown - iosxr_config: - lines: - - no domain lookup source-interface Loopback10 - match: none - provider: "{{ cli }}" - -- debug: msg="END cli/set_lookup_source.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml b/test/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml deleted file mode 100644 index 7a18ebaa7d..0000000000 --- a/test/integration/targets/iosxr_system/tests/cli/set_name_servers.yaml +++ /dev/null @@ -1,64 +0,0 @@ ---- -- debug: msg="START cli/set_name_servers.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - lines: - - no ip name-server 192.0.2.1 - - no ip name-server 192.0.2.2 - - no ip name-server 192.0.2.3 - match: none - provider: "{{ cli }}" - -- name: configure name_servers - iosxr_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == true - - "'domain name-server 192.0.2.1' in result.commands" - - "'domain name-server 192.0.2.2' in result.commands" - - "'domain name-server 192.0.2.3' in result.commands" - -- name: verify name_servers - iosxr_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == false - -- name: remove one - iosxr_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - provider: "{{ cli }}" - register: result - -- assert: - that: - - result.changed == true - - result.commands|length == 1 - - "'no domain name-server 192.0.2.3' in result.commands" - -- name: setup - iosxr_config: - lines: - - no ip name-server 192.0.2.1 - - no ip name-server 192.0.2.2 - match: none - provider: "{{ cli }}" - -- debug: msg="END cli/set_name_servers.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_system/tests/netconf/set_domain_list.yaml b/test/integration/targets/iosxr_system/tests/netconf/set_domain_list.yaml deleted file mode 100644 index b500f0e9e3..0000000000 --- a/test/integration/targets/iosxr_system/tests/netconf/set_domain_list.yaml +++ /dev/null @@ -1,177 +0,0 @@ ---- -- debug: - msg: "START netconf/set_domain_search.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - lines: - - no domain list ansible.com - - no domain list redhat.com - - no domain list eng.ansible.com - - no domain vrf ansiblevrf list redhat.com - - no domain vrf ansiblevrf list ansible.com - match: none - provider: "{{ cli }}" - connection: network_cli - -- name: configure domain_search - iosxr_system: - domain_search: - - ansible.com - - redhat.com - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'ansible.com' in result.xml[0]" - - "'redhat.com' in result.xml[0]" - -- name: configure domain_search with vrf - iosxr_system: &domainvrf - vrf: ansiblevrf - domain_search: - - redhat.com - - ansible.com - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'ansiblevrf' in result.xml[0]" - - "'ansible.com' in result.xml[0]" - - "'redhat.com' in result.xml[0]" - -- name: verify domain_search with vrf - iosxr_system: *domainvrf - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: delete domain_search with vrf - iosxr_system: &deldomainvrf - vrf: ansiblevrf - domain_search: - - redhat.com - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'ansiblevrf' in result.xml[0]" - - "'ansible.com' in result.xml[0]" - -- name: verify delete domain_search with vrf - iosxr_system: *deldomainvrf - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: remove one entry - iosxr_system: - domain_search: - - ansible.com - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'redhat.com' in result.xml[0]" - -- name: verify remove one entry - iosxr_system: - domain_search: - - ansible.com - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: add one entry - iosxr_system: - domain_search: - - ansible.com - - redhat.com - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'redhat.com' in result.xml[0]" - -- name: verify add one entry - iosxr_system: - domain_search: - - ansible.com - - redhat.com - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: add and remove one entry - iosxr_system: - domain_search: - - ansible.com - - eng.ansible.com - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'redhat.com' in result.xml[1]" - - "'eng.ansible.com' in result.xml[0]" - - result.xml|length == 2 - -- name: verify add and remove one entry - iosxr_system: - domain_search: - - ansible.com - - eng.ansible.com - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: teardown - iosxr_config: - lines: - - no domain list ansible.com - - no domain list redhat.com - - no domain list eng.ansible.com - - no domain vrf ansiblevrf list redhat.com - - no domain vrf ansiblevrf list ansible.com - - no domain vrf ansiblevrf list eng.ansible.com - match: none - provider: "{{ cli }}" - connection: network_cli - -- debug: - msg: "END netconf/set_domain_search.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_system/tests/netconf/set_domain_name.yaml b/test/integration/targets/iosxr_system/tests/netconf/set_domain_name.yaml deleted file mode 100644 index a229a4763e..0000000000 --- a/test/integration/targets/iosxr_system/tests/netconf/set_domain_name.yaml +++ /dev/null @@ -1,77 +0,0 @@ ---- -- debug: - msg: "START netconf/set_domain_name.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - lines: - - no domain name - - no domain vrf ansiblevrf name - match: none - provider: "{{ cli }}" - connection: network_cli - -- name: configure domain_name - iosxr_system: &domain - domain_name: eng.ansible.com - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify domain_name - iosxr_system: *domain - connection: netconf - register: result - -- assert: - that: - - "result.changed == false" - -- name: configure domain_name - iosxr_system: &deldomain - domain_name: eng.ansible.com - provider: "{{ netconf }}" - state: absent - connection: netconf - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify domain_name - iosxr_system: *deldomain - connection: netconf - register: result - -- assert: - that: - - "result.changed == false" - -- name: configure domain_name with vrf - iosxr_system: &domainvrf - domain_name: eng.ansible.com - vrf: ansiblevrf - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - "result.changed == true" - -- name: verify domain_name with vrf - iosxr_system: *domainvrf - connection: netconf - register: result - -- assert: - that: - - "result.changed == false" - -- debug: - msg: "END netconf/set_domain_name.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_system/tests/netconf/set_hostname.yaml b/test/integration/targets/iosxr_system/tests/netconf/set_hostname.yaml deleted file mode 100644 index 08c99b0ec6..0000000000 --- a/test/integration/targets/iosxr_system/tests/netconf/set_hostname.yaml +++ /dev/null @@ -1,43 +0,0 @@ ---- -- debug: - msg: "START netconf/set_hostname.yaml on connection={{ ansible_connection }}" - -- block: - - name: setup - iosxr_config: - lines: hostname switch - match: none - provider: "{{ cli }}" - connection: network_cli - - - name: configure hostname - iosxr_system: - hostname: foo - provider: "{{ netconf }}" - connection: netconf - register: result - - - assert: - that: - - "result.changed == true" - - - name: verify hostname - iosxr_system: - hostname: foo - provider: "{{ netconf }}" - connection: netconf - register: result - - - assert: - that: - - "result.changed == false" - always: - - name: teardown - iosxr_config: - lines: "hostname {{ inventory_hostname }}" - match: none - provider: "{{ cli }}" - connection: network_cli - -- debug: - msg: "END netconf/set_hostname.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_system/tests/netconf/set_lookup_source.yaml b/test/integration/targets/iosxr_system/tests/netconf/set_lookup_source.yaml deleted file mode 100644 index 88ad90d2d8..0000000000 --- a/test/integration/targets/iosxr_system/tests/netconf/set_lookup_source.yaml +++ /dev/null @@ -1,160 +0,0 @@ ---- -- debug: - msg: "START netconf/set_lookup_source.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - lines: - - no domain lookup source-interface Loopback10 - - no domain vrf ansiblevrf lookup source-interface Loopback10 - - no domain lookup disable - - no domain vrf ansiblevrf lookup disable - match: none - provider: "{{ cli }}" - connection: network_cli - -- name: configure lookup_source - iosxr_system: &lookup - lookup_source: Loopback10 - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'Loopback10' in result.xml[0]" - -- name: verify lookup_source - iosxr_system: *lookup - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: disable lookup - iosxr_system: &disable - lookup_enabled: False - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'lookup' in result.xml[0]" - -- name: verify disable lookup - iosxr_system: *disable - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: delete lookup_source - iosxr_system: &dellookup - lookup_source: Loopback10 - provider: "{{ netconf }}" - state: absent - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'Loopback10' in result.xml[0]" - -- name: verify lookup_source - iosxr_system: *dellookup - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: configure lookup_source with vrf - iosxr_system: &lookupvrf - lookup_source: Loopback10 - vrf: ansiblevrf - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'Loopback10' in result.xml[0]" - - "'ansiblevrf' in result.xml[0]" - -- name: verify lookup_source - iosxr_system: *lookupvrf - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: disable lookup - iosxr_system: &disablevrf - lookup_enabled: False - vrf: ansiblevrf - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'lookup' in result.xml[0]" - - "'ansiblevrf' in result.xml[0]" - -- name: verify disable lookup - iosxr_system: *disablevrf - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: delete lookup_source - iosxr_system: &dellookupvrf - lookup_source: Loopback10 - vrf: ansiblevrf - provider: "{{ netconf }}" - state: absent - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - "'Loopback10' in result.xml[0]" - - "'ansiblevrf' in result.xml[0]" - -- name: verify lookup_source - iosxr_system: *dellookupvrf - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: teardown - iosxr_config: - lines: - - no domain lookup disable - - no domain vrf ansiblevrf lookup disable - match: none - provider: "{{ cli }}" - connection: network_cli - -- debug: - msg: "END netconf/set_lookup_source.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_system/tests/netconf/set_name_servers.yaml b/test/integration/targets/iosxr_system/tests/netconf/set_name_servers.yaml deleted file mode 100644 index 3dd9796439..0000000000 --- a/test/integration/targets/iosxr_system/tests/netconf/set_name_servers.yaml +++ /dev/null @@ -1,137 +0,0 @@ ---- -- debug: - msg: "START netconf/set_name_servers.yaml on connection={{ ansible_connection }}" - -- name: setup - iosxr_config: - lines: - - no domain name-server 192.0.2.1 - - no domain name-server 192.0.2.2 - - no domain name-server 192.0.2.3 - match: none - provider: "{{ cli }}" - connection: network_cli - -- name: setup - iosxr_system: - vrf: ansible - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - provider: "{{ netconf }}" - state: absent - connection: netconf - ignore_errors: True - register: result - -- name: configure name_servers - iosxr_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - result.xml|length == 1 - - "'192.0.2.1' in result.xml[0]" - - "'192.0.2.2' in result.xml[0]" - - "'192.0.2.3' in result.xml[0]" - -- name: verify name_servers - iosxr_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: add name servers with vrf - iosxr_system: &addvrf - vrf: ansible - name_servers: - - 192.0.2.1 - - 192.0.2.2 - - 192.0.2.3 - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - result.xml|length == 1 - - "'ansible' in result.xml[0]" - - "'192.0.2.1' in result.xml[0]" - - "'192.0.2.2' in result.xml[0]" - - "'192.0.2.3' in result.xml[0]" - -- name: verify change to vrf - iosxr_system: *addvrf - connection: netconf - register: result - -- assert: - that: - - result.changed == false - -- name: remove one - iosxr_system: - name_servers: - - 192.0.2.1 - - 192.0.2.2 - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - result.changed == true - - result.xml|length == 1 - - "'192.0.2.3' in result.xml[0]" - -- name: remove one with vrf - iosxr_system: - vrf: ansible - name_servers: - - 192.0.2.1 - - 192.0.2.2 - provider: "{{ netconf }}" - connection: netconf - ignore_errors: True - register: result - -- name: teardown - iosxr_config: - lines: - - no domain name-server 192.0.2.1 - - no domain name-server 192.0.2.2 - match: none - provider: "{{ cli }}" - connection: network_cli - -- name: teardown - iosxr_system: - vrf: ansible - name_servers: - - 192.0.2.1 - - 192.0.2.2 - provider: "{{ netconf }}" - state: absent - connection: netconf - ignore_errors: True - register: result - -- debug: - msg: "END netconf/set_name_servers.yaml on connection={{ ansible_connection }}" diff --git a/test/integration/targets/iosxr_user/defaults/main.yaml b/test/integration/targets/iosxr_user/defaults/main.yaml deleted file mode 100644 index 9ef5ba5165..0000000000 --- a/test/integration/targets/iosxr_user/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/test/integration/targets/iosxr_user/files/private b/test/integration/targets/iosxr_user/files/private deleted file mode 100644 index bf2425bb88..0000000000 --- a/test/integration/targets/iosxr_user/files/private +++ /dev/null @@ -1,30 +0,0 @@ ------BEGIN RSA PRIVATE KEY----- -Proc-Type: 4,ENCRYPTED -DEK-Info: DES-EDE3-CBC,A823A6B5ED873917 - -mLZ1xM1+xwutkRy+K/c9QsstDPQ9F6UWtDpoYyIgs7n9VgMjhIMbWQC9CkTvnFJM -ey+iwGdQZZOThwxalm+k3pMibwRjhnF+PNFhiVkzWH8/K8QvXRQiW/vYmE/QB9pY -T0IWbMcC7/ktEfQn+6GLXoe/L7yH+aNv/2Flsa2jN2cfSXpzbneUA06/LVVOw6E+ -C74NKRWUmMPA39Zd4WOeBoWUdS5Kgwl57SOtrKs1LIGh33+TPu+Go8gJ7h/t/kaN -kverVSz+0eeX+exKumejfo1UfosplRhcjRG8YgiQ8l7SN3NBF/gXiiSrH3fLwmRJ -hbokJ8TmCozrYBs1MNe3LoU2iuIqVnJ5Sd6DJELs6vCuFz+v6J/s80NaaYMlBCbB -1lahelYqoyLb4uiDd4zQSpaxzO+Cx/d50Wpee8mFxbAL/YxacOzD3b/VCBgB+AZN -TTHr1ayd+ITd8gewXAyERKWyrDcC2beJI0fOil23PYowWvEncS6I1f4hKQY28sRf -vHSbwQdltky/xiib2/feQTaMSQFvsY67uTHipMwl5wJNOKcbeqDVMWPYST3XUsBg -LRlbT+VTUEehbOJAJ6Hh7Yv4nqu7fEh95HUQK7Ed56rMLKpmdorYO49JtewkEUsj -LJn7tcxMUuOcWKHMPu6vB/63f6Ulthqp1SEG8aNBaZMuPyLWAPAJc2okOmkiSbvO -0Hxe6BtAGn2fUo2jK6E3tD/dsIR2qqMlL09FkACGT8D5Lfh5d3z+lo9DxpXl281R -ablehPyHgHcIC6cD2/7FwwjzUuyj/kYcETnMs51agcWFAXTom/ehqD+IQ8jZ73zT -5O4FFgslnNmB/vddh9PeYpjDYdR4y5xMrlMxJ+qcZuQOq7dfaiodq8oj+XPmwgxA -audX/sHMutOpmOagrsQfaQXaPqRXdQTnuwHacQfwq+tBBhrft5gwt1HE7Ir2ulwD -Q19kefchkJu/0c1cAGg1VHtQic0a6tX6PrwqZOMDfpSywcImMCF4KHgD2EC5/8h6 -tq0PqPLNcwiM2NhpypCuYmkYZ0gnJ/xAwtM85Ck9nmPFptLSd0b7YB7dtGsFYY5A -rhIcq5lZhy06/RRAPluIkniscA50iEO/EXKwzYzovBJh6jQz7oYsbEUW5kwg0gm/ -YPSa6lqv2kTpXS+UiGyeNWdUkr5DpdwKe4lrAsN94HE9/SoLgFvz0X5/WyTssSzo -IO3WfLfBc7SOkZK1ibcleIqilzd+LSoIqqGrft2yonXgJD3p9xO+Hlldczx2kHmu -z4lZBq53AkVAQ4os5L7ZRnmxoqKn2XAQRwVH3M9ZFYFEqEyDmZhlFdJSGEnKws81 -Ej48t6KWwqml02cx675bSYI22tL3+RL7AGmlC0/Xh8wIVesgulsYmnhW4BtpBYf2 -fwv5esJJMjkh2LvLNG3edYChugudeZXtcBJdNr0GYRbBAhvO25bRcr6z8nYDusKX -e/+30vATOcBO/zaOYIwDGT5ZwMQAV1aQl8HyeyYESNjb0fBXQ3OYObOrTTs8MLyC -I4b6wr1vlbN+lMOm+RIXCDgmC3COdlgCHyo3qiIu2YNYQVoNF4NN4A== ------END RSA PRIVATE KEY----- diff --git a/test/integration/targets/iosxr_user/files/public.pub b/test/integration/targets/iosxr_user/files/public.pub deleted file mode 100644 index db1847f45f..0000000000 --- a/test/integration/targets/iosxr_user/files/public.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAkvLTTJdwZ0lg1cUCn13Hi3+ho2+G6/96XuAP7jA7Ghz9NPbC/eqXnjvb27BA8CxtFXYuXR5eZWSq2UN5zFcfrFb57XFxdAg2q21hGEX+FGiTUuRZh8+ByVEh0LUetFTwsEZ1iGv6GZiLBt7IJvClXbyNTJEt3DZncHfGwudyGFviV4dGrzusDAGAcoHqvD/5uXYl4PjMH9oSfraO3sG4Q7soQwxNeiM8qOLf3c1SabHBAtSewwnA0E/jhzpOLD2QUncU5s+Oa9PvEXXhGv5eZo9lp71brsgyWj32m2UuXx/n+EZg78GVJT5mFO7LG239n3gTnwkMVdr6zVBFNX5Mvw== rsa-key-20171025 diff --git a/test/integration/targets/iosxr_user/files/public2.pub b/test/integration/targets/iosxr_user/files/public2.pub deleted file mode 100644 index 2fc645683e..0000000000 --- a/test/integration/targets/iosxr_user/files/public2.pub +++ /dev/null @@ -1 +0,0 @@ -ssh-rsa AAAAB3NzaC1yc2EAAAABJQAAAQEAhTxbibM8hKZn7xDURs15L3gkcsnpDoZ+tNm5zpP9dcboASnIyJzfC7J/RdRCQsO/pDmUY4y/tsTx18uenyfazxtNkyCHdANlp8XVF1fGNv5GM+QbsDqxe54sdG9csASX0/Ljvl538IbcLFVH0zxyKspbDOgkAkUSuKIAH5x+/GhkAoGQO2tOhYjqofNtUxLSvfRsf4Gm1M0WgdWmz3MW4NOdZhsL4S+STgRPU1jy1dKGj7BKY9cpnCWBFHa2wSaOXJEBZEKNaFVxlBBrFs5brjRQA0mVPmE+pz+/+IJeSNEEma9cXur0ONeb6OoXvkManxKfkaswT2ybOChAzJR8dQ== T-MOBILE
\ No newline at end of file diff --git a/test/integration/targets/iosxr_user/meta/main.yaml b/test/integration/targets/iosxr_user/meta/main.yaml deleted file mode 100644 index d4da833dd5..0000000000 --- a/test/integration/targets/iosxr_user/meta/main.yaml +++ /dev/null @@ -1,2 +0,0 @@ -dependencies: - - prepare_iosxr_tests diff --git a/test/integration/targets/iosxr_user/tasks/cli.yaml b/test/integration/targets/iosxr_user/tasks/cli.yaml deleted file mode 100644 index a08939d6d5..0000000000 --- a/test/integration/targets/iosxr_user/tasks/cli.yaml +++ /dev/null @@ -1,27 +0,0 @@ ---- -- name: collect all common test cases - find: - paths: "{{ role_path }}/tests/common" - patterns: "{{ testcase }}.yaml" - register: common_test_cases - delegate_to: localhost - -- name: collect all cli test cases - find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - register: test_cases - delegate_to: localhost - -- set_fact: - test_cases: - files: "{{ common_test_cases.files }} + {{ test_cases.files }}" - -- 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/iosxr_user/tasks/main.yaml b/test/integration/targets/iosxr_user/tasks/main.yaml deleted file mode 100644 index af08869c92..0000000000 --- a/test/integration/targets/iosxr_user/tasks/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -- { include: cli.yaml, tags: ['cli'] } -- { include: netconf.yaml, tags: ['netconf'] } diff --git a/test/integration/targets/iosxr_user/tasks/netconf.yaml b/test/integration/targets/iosxr_user/tasks/netconf.yaml deleted file mode 100644 index 24bc44bf71..0000000000 --- a/test/integration/targets/iosxr_user/tasks/netconf.yaml +++ /dev/null @@ -1,35 +0,0 @@ ---- -- name: collect all common test cases - find: - paths: "{{ role_path }}/tests/common" - patterns: "{{ testcase }}.yaml" - register: common_test_cases - delegate_to: localhost - -- name: collect all netconf test cases - find: - paths: "{{ role_path }}/tests/netconf" - patterns: "{{ testcase }}.yaml" - register: test_cases - delegate_to: localhost - -- set_fact: - test_cases: - files: "{{ common_test_cases.files }} + {{ test_cases.files }}" - -- 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 }}" - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - -# Only one of the Testcase would be run to check if `connection: local` -# is established. Full suite is run with `connection:network_cli` or `connection:netconf` -- name: run test case (connection=local) - include: "{{ test_case_to_run }} ansible_connection=local" - with_first_found: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run diff --git a/test/integration/targets/iosxr_user/tests/cli/basic.yaml b/test/integration/targets/iosxr_user/tests/cli/basic.yaml deleted file mode 100644 index f1c614d82b..0000000000 --- a/test/integration/targets/iosxr_user/tests/cli/basic.yaml +++ /dev/null @@ -1,169 +0,0 @@ ---- -- name: Remove users prior to tests - iosxr_config: - lines: - - no username ansibletest1 - - no username ansibletest2 - - no username ansibletest3 - provider: "{{ cli }}" - -- name: Create user (SetUp) - iosxr_user: - name: ansibletest1 - configured_password: test - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"username" in result.commands[0]' - - '"secret" in result.commands[1]' - -- name: Create user with update_password always (not idempotent) - iosxr_user: - name: ansibletest1 - configured_password: test - update_password: always - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"username" in result.commands[0]' - - '"secret" in result.commands[0]' - -- name: Create user again with update_password on_create (idempotent) - iosxr_user: - name: ansibletest1 - configured_password: test - update_password: on_create - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == false' - - 'result.commands | length == 0' - -- name: Modify user group - iosxr_user: - name: ansibletest1 - configured_password: test - update_password: on_create - group: sysadmin - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"username" in result.commands[0]' - - '"group" in result.commands[0]' - -- name: Modify user group again (idempotent) - iosxr_user: - name: ansibletest1 - configured_password: test - update_password: on_create - group: sysadmin - state: present - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == false' - - 'result.commands | length == 0' - -- name: Collection of users (SetUp) - iosxr_user: - aggregate: - - name: ansibletest2 - - name: ansibletest3 - configured_password: test - state: present - group: sysadmin - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"username" in result.commands[0]' - - '"secret" in result.commands[1]' - - '"group sysadmin" in result.commands[2]' - - '"username" in result.commands[3]' - - '"secret" in result.commands[4]' - - '"group sysadmin" in result.commands[5]' - -- name: Add collection of users again with update_password always (not idempotent) - iosxr_user: - aggregate: - - name: ansibletest2 - - name: ansibletest3 - configured_password: test - state: present - group: sysadmin - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - '"username" in result.commands[0]' - - '"secret" in result.commands[0]' - - '"username" in result.commands[1]' - - '"secret" in result.commands[1]' - -- name: Add collection of users again with update_password on_create (idempotent) - iosxr_user: - aggregate: - - name: ansibletest2 - - name: ansibletest3 - configured_password: test - update_password: on_create - state: present - group: sysadmin - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == false' - - 'result.commands | length == 0' - -- name: Delete collection of users - iosxr_user: - aggregate: - - name: ansibletest1 - - name: ansibletest2 - - name: ansibletest3 - state: absent - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == true' - - 'result.commands == ["no username ansibletest1", "no username ansibletest2", "no username ansibletest3"]' - -- name: Delete collection of users again (idempotent) - iosxr_user: - aggregate: - - name: ansibletest1 - - name: ansibletest2 - - name: ansibletest3 - state: absent - provider: "{{ cli }}" - register: result - -- assert: - that: - - 'result.changed == false' - - 'result.commands | length == 0' diff --git a/test/integration/targets/iosxr_user/tests/common/auth.yaml b/test/integration/targets/iosxr_user/tests/common/auth.yaml deleted file mode 100644 index 1d542bb367..0000000000 --- a/test/integration/targets/iosxr_user/tests/common/auth.yaml +++ /dev/null @@ -1,109 +0,0 @@ ---- -- block: - - name: Create user with password - iosxr_user: - name: auth_user - state: present - configured_password: pass123 - provider: "{{ cli }}" - connection: network_cli - - - name: test login - expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version" - responses: - (?i)password: "pass123" - connection: network_cli - - - name: test login with invalid password (should fail) - expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no show version" - responses: - (?i)password: "badpass" - ignore_errors: yes - connection: network_cli - register: results - - - name: check that attempt failed - assert: - that: - - results.failed - - - name: create user with private key (contents input) - iosxr_user: - name: auth_user - state: present - public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public.pub\") }}" - provider: "{{ cli }}" - connection: network_cli - - - name: test login with private key - expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" - responses: - (?i)password: 'pass123' - connection: network_cli - - - name: remove user and key - iosxr_user: - name: auth_user - provider: "{{ cli }}" - state: absent - connection: network_cli - - - name: test login with private key (should fail, no user) - expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" - responses: - (?i)password: 'pass123' - ignore_errors: yes - connection: network_cli - register: results - - - name: create user with private key (path input) - iosxr_user: - name: auth_user - state: present - public_key: "{{ role_path }}/files/public.pub" - provider: "{{ cli }}" - connection: network_cli - - - name: test login with private key - expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" - responses: - (?i)password: 'pass123' - ignore_errors: yes - connection: network_cli - - - name: change private key for user - iosxr_user: - name: auth_user - state: present - public_key_contents: "{{ lookup('file', \"{{ role_path }}/files/public2.pub\") }}" - provider: "{{ cli }}" - connection: network_cli - - # FIXME: pexpect fails with OSError: [Errno 5] Input/output error - - name: test login with invalid private key (should fail) - expect: - command: "ssh auth_user@{{ ansible_ssh_host }} -p {{ ansible_ssh_port|default(22) }} -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -i {{ role_path }}/files/private show version" - responses: - (?i)password: "pass123" - ignore_errors: yes - connection: network_cli - register: results - - - name: check that attempt failed - assert: - that: - - results.failed - - always: - - name: delete user - iosxr_user: - name: auth_user - state: absent - provider: "{{ cli }}" - connection: network_cli - register: result diff --git a/test/integration/targets/iosxr_user/tests/netconf/basic.yaml b/test/integration/targets/iosxr_user/tests/netconf/basic.yaml deleted file mode 100644 index ccd3dc2123..0000000000 --- a/test/integration/targets/iosxr_user/tests/netconf/basic.yaml +++ /dev/null @@ -1,181 +0,0 @@ ---- -- name: Remove users prior to tests - iosxr_config: - lines: - - no username ansible1 - - no username ansible2 - - no username ansible3 - provider: "{{ cli }}" - connection: network_cli - -- name: Create user (SetUp) - iosxr_user: - name: ansible1 - configured_password: password - state: present - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - 'result.changed == true' - - '"ansible1" in result.xml[0]' - - '"secret" in result.xml[0]' - -- name: Create user with update_password always (not idempotent) - iosxr_user: - name: ansible1 - configured_password: password - update_password: always - state: present - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - 'result.changed == true' - - '"ansible1" in result.xml[0]' - - '"secret" in result.xml[0]' - -- name: Create user again with update_password on_create (idempotent) - iosxr_user: - name: ansible1 - configured_password: password - update_password: on_create - state: present - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - 'result.changed == false' - - 'result.xml | length == 0' - -- name: Modify user group - iosxr_user: - name: ansible1 - configured_password: password - update_password: on_create - group: sysadmin - state: present - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - 'result.changed == true' - - '"ansible1" in result.xml[0]' - - '"sysadmin" in result.xml[0]' - -- name: Modify user group again (idempotent) - iosxr_user: - name: ansible1 - configured_password: password - update_password: on_create - group: sysadmin - state: present - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - 'result.changed == false' - - 'result.xml | length == 0' - -- name: Collection of users (SetUp) - iosxr_user: - aggregate: - - name: ansible2 - - name: ansible3 - configured_password: password - state: present - group: sysadmin - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - 'result.changed == true' - - '"ansible2" in result.xml[0]' - - '"secret" in result.xml[0]' - - '"sysadmin" in result.xml[1]' - - '"ansible2" in result.xml[0]' - - '"secret" in result.xml[0]' - - '"sysadmin" in result.xml[1]' - -- name: Add collection of users again with update_password always (not idempotent) - iosxr_user: - aggregate: - - name: ansible2 - - name: ansible3 - configured_password: password - state: present - group: sysadmin - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - 'result.changed == true' - - '"ansible2" in result.xml[0]' - - '"ansible3" in result.xml[0]' - - '"secret" in result.xml[0]' - -- name: Add collection of users again with update_password on_create (idempotent) - iosxr_user: - aggregate: - - name: ansible2 - - name: ansible3 - configured_password: password - update_password: on_create - state: present - group: sysadmin - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - 'result.changed == false' - - 'result.xml | length == 0' - -- name: Delete collection of users - iosxr_user: - aggregate: - - name: ansible1 - - name: ansible2 - - name: ansible3 - state: absent - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - 'result.changed == true' - - '"ansible1" in result.xml[0]' - - '"ansible2" in result.xml[0]' - - '"ansible3" in result.xml[0]' - -- name: Delete collection of users again (idempotent) - iosxr_user: - aggregate: - - name: ansible1 - - name: ansible2 - - name: ansible3 - state: absent - provider: "{{ netconf }}" - connection: netconf - register: result - -- assert: - that: - - 'result.changed == false' - - 'result.xml | length == 0' diff --git a/test/sanity/ignore.txt b/test/sanity/ignore.txt index cb050a0467..3543cd0fb2 100644 --- a/test/sanity/ignore.txt +++ b/test/sanity/ignore.txt @@ -92,18 +92,6 @@ lib/ansible/module_utils/network/dellos6/dellos6.py future-import-boilerplate lib/ansible/module_utils/network/dellos6/dellos6.py metaclass-boilerplate lib/ansible/module_utils/network/dellos9/dellos9.py future-import-boilerplate lib/ansible/module_utils/network/dellos9/dellos9.py metaclass-boilerplate -lib/ansible/module_utils/network/iosxr/iosxr.py future-import-boilerplate -lib/ansible/module_utils/network/iosxr/iosxr.py metaclass-boilerplate -lib/ansible/module_utils/network/iosxr/providers/cli/config/bgp/address_family.py future-import-boilerplate -lib/ansible/module_utils/network/iosxr/providers/cli/config/bgp/address_family.py metaclass-boilerplate -lib/ansible/module_utils/network/iosxr/providers/cli/config/bgp/neighbors.py future-import-boilerplate -lib/ansible/module_utils/network/iosxr/providers/cli/config/bgp/neighbors.py metaclass-boilerplate -lib/ansible/module_utils/network/iosxr/providers/cli/config/bgp/process.py future-import-boilerplate -lib/ansible/module_utils/network/iosxr/providers/cli/config/bgp/process.py metaclass-boilerplate -lib/ansible/module_utils/network/iosxr/providers/module.py future-import-boilerplate -lib/ansible/module_utils/network/iosxr/providers/module.py metaclass-boilerplate -lib/ansible/module_utils/network/iosxr/providers/providers.py future-import-boilerplate -lib/ansible/module_utils/network/iosxr/providers/providers.py metaclass-boilerplate lib/ansible/module_utils/network/junos/argspec/facts/facts.py future-import-boilerplate lib/ansible/module_utils/network/junos/argspec/facts/facts.py metaclass-boilerplate lib/ansible/module_utils/network/junos/facts/facts.py future-import-boilerplate @@ -1815,82 +1803,6 @@ lib/ansible/modules/network/f5/bigiq_regkey_license_assignment.py validate-modul lib/ansible/modules/network/f5/bigiq_regkey_pool.py validate-modules:doc-required-mismatch lib/ansible/modules/network/f5/bigiq_utility_license.py validate-modules:doc-required-mismatch lib/ansible/modules/network/f5/bigiq_utility_license_assignment.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/iosxr/_iosxr_interface.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/iosxr/_iosxr_interface.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/network/iosxr/_iosxr_interface.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/iosxr/_iosxr_interface.py validate-modules:doc-missing-type -lib/ansible/modules/network/iosxr/_iosxr_interface.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/iosxr/_iosxr_interface.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/iosxr/_iosxr_interface.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/iosxr/_iosxr_interface.py validate-modules:undocumented-parameter -lib/ansible/modules/network/iosxr/iosxr_banner.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_banner.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_banner.py validate-modules:doc-missing-type -lib/ansible/modules/network/iosxr/iosxr_banner.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/iosxr/iosxr_banner.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/iosxr/iosxr_banner.py validate-modules:undocumented-parameter -lib/ansible/modules/network/iosxr/iosxr_bgp.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/iosxr/iosxr_bgp.py validate-modules:doc-missing-type -lib/ansible/modules/network/iosxr/iosxr_bgp.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/iosxr/iosxr_bgp.py validate-modules:invalid-ansiblemodule-schema -lib/ansible/modules/network/iosxr/iosxr_bgp.py validate-modules:nonexistent-parameter-documented -lib/ansible/modules/network/iosxr/iosxr_bgp.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/iosxr/iosxr_bgp.py validate-modules:undocumented-parameter -lib/ansible/modules/network/iosxr/iosxr_command.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_command.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_command.py validate-modules:doc-missing-type -lib/ansible/modules/network/iosxr/iosxr_command.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/iosxr/iosxr_command.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/iosxr/iosxr_command.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/iosxr/iosxr_command.py validate-modules:undocumented-parameter -lib/ansible/modules/network/iosxr/iosxr_config.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_config.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_config.py validate-modules:doc-missing-type -lib/ansible/modules/network/iosxr/iosxr_config.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/iosxr/iosxr_config.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/iosxr/iosxr_config.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/iosxr/iosxr_config.py validate-modules:undocumented-parameter -lib/ansible/modules/network/iosxr/iosxr_facts.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_facts.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_facts.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/iosxr/iosxr_facts.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/iosxr/iosxr_facts.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/iosxr/iosxr_facts.py validate-modules:undocumented-parameter -lib/ansible/modules/network/iosxr/iosxr_l2_interfaces.py validate-modules:invalid-ansiblemodule-schema -lib/ansible/modules/network/iosxr/iosxr_l2_interfaces.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/iosxr/iosxr_l3_interfaces.py validate-modules:invalid-ansiblemodule-schema -lib/ansible/modules/network/iosxr/iosxr_l3_interfaces.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/iosxr/iosxr_lacp_interfaces.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/iosxr/iosxr_logging.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_logging.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_logging.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/iosxr/iosxr_logging.py validate-modules:doc-missing-type -lib/ansible/modules/network/iosxr/iosxr_logging.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/iosxr/iosxr_logging.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/iosxr/iosxr_logging.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/iosxr/iosxr_logging.py validate-modules:undocumented-parameter -lib/ansible/modules/network/iosxr/iosxr_netconf.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_netconf.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_netconf.py validate-modules:doc-missing-type -lib/ansible/modules/network/iosxr/iosxr_netconf.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/iosxr/iosxr_netconf.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/iosxr/iosxr_netconf.py validate-modules:undocumented-parameter -lib/ansible/modules/network/iosxr/iosxr_system.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_system.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_system.py validate-modules:doc-missing-type -lib/ansible/modules/network/iosxr/iosxr_system.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/iosxr/iosxr_system.py validate-modules:parameter-list-no-elements -lib/ansible/modules/network/iosxr/iosxr_system.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/iosxr/iosxr_system.py validate-modules:undocumented-parameter -lib/ansible/modules/network/iosxr/iosxr_user.py validate-modules:doc-choices-do-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_user.py validate-modules:doc-default-does-not-match-spec -lib/ansible/modules/network/iosxr/iosxr_user.py validate-modules:doc-elements-mismatch -lib/ansible/modules/network/iosxr/iosxr_user.py validate-modules:doc-missing-type -lib/ansible/modules/network/iosxr/iosxr_user.py validate-modules:doc-required-mismatch -lib/ansible/modules/network/iosxr/iosxr_user.py validate-modules:missing-suboption-docs -lib/ansible/modules/network/iosxr/iosxr_user.py validate-modules:mutually_exclusive-unknown -lib/ansible/modules/network/iosxr/iosxr_user.py validate-modules:parameter-type-not-in-doc -lib/ansible/modules/network/iosxr/iosxr_user.py validate-modules:undocumented-parameter lib/ansible/modules/network/junos/_junos_interface.py validate-modules:doc-choices-do-not-match-spec lib/ansible/modules/network/junos/_junos_interface.py validate-modules:doc-default-does-not-match-spec lib/ansible/modules/network/junos/_junos_interface.py validate-modules:doc-elements-mismatch @@ -2980,7 +2892,6 @@ lib/ansible/plugins/action/bigiq.py action-plugin-docs # undocumented action plu lib/ansible/plugins/action/dellos10.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` lib/ansible/plugins/action/dellos6.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` lib/ansible/plugins/action/dellos9.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` -lib/ansible/plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` lib/ansible/plugins/action/junos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` lib/ansible/plugins/action/normal.py action-plugin-docs # default action plugin for modules without a dedicated action plugin lib/ansible/plugins/action/nxos.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` @@ -3012,8 +2923,6 @@ lib/ansible/plugins/doc_fragments/hcloud.py future-import-boilerplate lib/ansible/plugins/doc_fragments/hcloud.py metaclass-boilerplate lib/ansible/plugins/doc_fragments/inventory_cache.py future-import-boilerplate lib/ansible/plugins/doc_fragments/inventory_cache.py metaclass-boilerplate -lib/ansible/plugins/doc_fragments/iosxr.py future-import-boilerplate -lib/ansible/plugins/doc_fragments/iosxr.py metaclass-boilerplate lib/ansible/plugins/doc_fragments/junos.py future-import-boilerplate lib/ansible/plugins/doc_fragments/junos.py metaclass-boilerplate lib/ansible/plugins/doc_fragments/meraki.py future-import-boilerplate diff --git a/test/units/modules/network/iosxr/fixtures/dir_7all b/test/units/modules/network/iosxr/fixtures/dir_7all deleted file mode 100644 index b992498c0e..0000000000 --- a/test/units/modules/network/iosxr/fixtures/dir_7all +++ /dev/null @@ -1,6 +0,0 @@ -Directory of disk0: -file1 -file2 - -Directory of flash0: -file3 diff --git a/test/units/modules/network/iosxr/fixtures/iosxr_acls_config.cfg b/test/units/modules/network/iosxr/fixtures/iosxr_acls_config.cfg deleted file mode 100644 index d9c32dd691..0000000000 --- a/test/units/modules/network/iosxr/fixtures/iosxr_acls_config.cfg +++ /dev/null @@ -1,5 +0,0 @@ -ipv4 access-list acl_2 - 10 deny ipv4 any any - 20 permit tcp host 192.168.1.100 any -ipv6 access-list acl6_1 - 10 deny icmpv6 any any diff --git a/test/units/modules/network/iosxr/fixtures/iosxr_config_config.cfg b/test/units/modules/network/iosxr/fixtures/iosxr_config_config.cfg deleted file mode 100644 index afad9d08aa..0000000000 --- a/test/units/modules/network/iosxr/fixtures/iosxr_config_config.cfg +++ /dev/null @@ -1,12 +0,0 @@ -! -hostname router -! -interface GigabitEthernet0/0 - ip address 1.2.3.4 255.255.255.0 - description test string -! -interface GigabitEthernet0/1 - ip address 6.7.8.9 255.255.255.0 - description test string - shutdown -! diff --git a/test/units/modules/network/iosxr/fixtures/iosxr_config_src.cfg b/test/units/modules/network/iosxr/fixtures/iosxr_config_src.cfg deleted file mode 100644 index b3d8961a99..0000000000 --- a/test/units/modules/network/iosxr/fixtures/iosxr_config_src.cfg +++ /dev/null @@ -1,11 +0,0 @@ -! -hostname foo -! -interface GigabitEthernet0/0 - no ip address -! -interface GigabitEthernet0/1 - ip address 6.7.8.9 255.255.255.0 - description test string - shutdown -! diff --git a/test/units/modules/network/iosxr/fixtures/iosxr_static_routes_config.cfg b/test/units/modules/network/iosxr/fixtures/iosxr_static_routes_config.cfg deleted file mode 100644 index 36c9eb2330..0000000000 --- a/test/units/modules/network/iosxr/fixtures/iosxr_static_routes_config.cfg +++ /dev/null @@ -1,18 +0,0 @@ -Fri Nov 29 21:10:41.896 UTC -router static - address-family ipv4 unicast - 192.0.2.16/28 FastEthernet0/0/0/1 192.0.2.10 tag 10 description LAB metric 120 - 192.0.2.16/28 FastEthernet0/0/0/5 track ip_sla_1 - 192.0.2.32/28 192.0.2.11 100 - ! - address-family ipv6 unicast - 2001:db8:1000::/36 FastEthernet0/0/0/7 description DC - 2001:db8:1000::/36 FastEthernet0/0/0/8 2001:db8:2000:2::1 - ! - vrf DEV_SITE - address-family ipv4 unicast - 192.0.2.48/28 vrf test_1 192.0.2.12 description DEV - 192.0.2.80/28 vrf test_1 FastEthernet0/0/0/2 192.0.2.14 vrflabel 124 track ip_sla_2 - ! - ! -!
\ No newline at end of file diff --git a/test/units/modules/network/iosxr/fixtures/iosxr_system_config.cfg b/test/units/modules/network/iosxr/fixtures/iosxr_system_config.cfg deleted file mode 100644 index fc6fd2b753..0000000000 --- a/test/units/modules/network/iosxr/fixtures/iosxr_system_config.cfg +++ /dev/null @@ -1,8 +0,0 @@ -hostname iosxr01 -domain name eng.ansible.com -domain lookup disable -domain lookup source-interface MgmtEth0/0/CPU0/0 -domain list redhat.com -domain list cisco.com -domain name-server 8.8.8.8 -domain name-server 8.8.4.4 diff --git a/test/units/modules/network/iosxr/fixtures/iosxr_user_config.cfg b/test/units/modules/network/iosxr/fixtures/iosxr_user_config.cfg deleted file mode 100644 index 0f0ab168be..0000000000 --- a/test/units/modules/network/iosxr/fixtures/iosxr_user_config.cfg +++ /dev/null @@ -1,8 +0,0 @@ -username admin - secret 5 $1$mdQIUxjg$3t3lzBpfKfITKvFm1uEIY. - group sysadmin -! -username ansible - secret 5 $1$3yWSXiIi$VdzV59ChiurrNdGxlDeAW/ - group sysadmin -! diff --git a/test/units/modules/network/iosxr/fixtures/show_interfaces b/test/units/modules/network/iosxr/fixtures/show_interfaces deleted file mode 100644 index d68907c0b0..0000000000 --- a/test/units/modules/network/iosxr/fixtures/show_interfaces +++ /dev/null @@ -1,41 +0,0 @@ -Loopback0 is up, line protocol is up - Interface state transitions: 1 - Hardware is Loopback interface(s) - Description: Loopback - Internet address is 192.168.0.3/32 - MTU 1500 bytes, BW 0 Kbit - reliability Unknown, txload Unknown, rxload Unknown - Encapsulation Loopback, loopback not set, - Last link flapped 12w1d - Last input Unknown, output Unknown - Last clearing of "show interface" counters Unknown - Input/output data rate is disabled. - -GigabitEthernet0/0/0/0 is up, line protocol is up - Interface state transitions: 1 - Hardware is GigabitEthernet, address is fa16.3e6c.20bd (bia fa16.3e6c.20bd) - Description: to nxos01 - Internet address is 10.0.0.5/30 - MTU 1514 bytes, BW 1000000 Kbit (Max: 1000000 Kbit) - reliability 255/255, txload 0/255, rxload 0/255 - Encapsulation ARPA, - Full-duplex, 1000Mb/s, unknown, link type is force-up - output flow control is off, input flow control is off - Carrier delay (up) is 10 msec - loopback not set, - Last link flapped 12w1d - ARP type ARPA, ARP timeout 04:00:00 - Last input 00:00:44, output 00:12:45 - Last clearing of "show interface" counters never - 5 minute input rate 0 bits/sec, 0 packets/sec - 5 minute output rate 0 bits/sec, 0 packets/sec - 150700 packets input, 36897055 bytes, 0 total input drops - 0 drops for unrecognized upper-level protocol - Received 1 broadcast packets, 150445 multicast packets - 0 runts, 0 giants, 0 throttles, 0 parity - 0 input errors, 0 CRC, 0 frame, 0 overrun, 0 ignored, 0 abort - 11691 packets output, 2904632 bytes, 0 total output drops - Output 1 broadcast packets, 11436 multicast packets - 0 output errors, 0 underruns, 0 applique, 0 resets - 0 output buffer failures, 0 output buffers swapped out - 1 carrier transitions diff --git a/test/units/modules/network/iosxr/fixtures/show_ipv6_interface b/test/units/modules/network/iosxr/fixtures/show_ipv6_interface deleted file mode 100644 index 971d1f65e7..0000000000 --- a/test/units/modules/network/iosxr/fixtures/show_ipv6_interface +++ /dev/null @@ -1,5 +0,0 @@ -Loopback0 is Up, ipv6 protocol is Up, Vrfid is default (0x60000000) - IPv6 is disabled, link-local address unassigned - No global unicast address is configured -GigabitEthernet0/0/0/0 is Up, ipv6 protocol is Up, Vrfid is default (0x60000000) - IPv6 is disabled, link-local address unassigned diff --git a/test/units/modules/network/iosxr/fixtures/show_lldp b/test/units/modules/network/iosxr/fixtures/show_lldp deleted file mode 100644 index 60ab287f87..0000000000 --- a/test/units/modules/network/iosxr/fixtures/show_lldp +++ /dev/null @@ -1 +0,0 @@ -% LLDP is not enabled diff --git a/test/units/modules/network/iosxr/fixtures/show_lldp_neighbors_detail b/test/units/modules/network/iosxr/fixtures/show_lldp_neighbors_detail deleted file mode 100644 index 60ab287f87..0000000000 --- a/test/units/modules/network/iosxr/fixtures/show_lldp_neighbors_detail +++ /dev/null @@ -1 +0,0 @@ -% LLDP is not enabled diff --git a/test/units/modules/network/iosxr/fixtures/show_memory_summary b/test/units/modules/network/iosxr/fixtures/show_memory_summary deleted file mode 100644 index b26abeae36..0000000000 --- a/test/units/modules/network/iosxr/fixtures/show_memory_summary +++ /dev/null @@ -1,5 +0,0 @@ -Physical Memory: 3095M total (1499M available) - Application Memory : 2893M (1499M available) - Image: 73M (bootram: 73M) - Reserved: 128M, IOMem: 0, flashfsys: 0 - Total shared window: 23M diff --git a/test/units/modules/network/iosxr/fixtures/show_running-config b/test/units/modules/network/iosxr/fixtures/show_running-config deleted file mode 100644 index 085baef473..0000000000 --- a/test/units/modules/network/iosxr/fixtures/show_running-config +++ /dev/null @@ -1,43 +0,0 @@ -hostname iosxr01 -service timestamps log datetime msec -service timestamps debug datetime msec -telnet vrf default ipv4 server max-servers 10 -telnet vrf Mgmt-intf ipv4 server max-servers 10 -domain name eng.ansible.com -domain lookup disable -vrf Mgmt-intf - address-family ipv4 unicast - ! - address-family ipv6 unicast - ! -! -line template vty - timestamp - exec-timeout 720 0 -! -line console - exec-timeout 0 0 -! -line default - exec-timeout 720 0 -! -vty-pool default 0 50 -control-plane - management-plane - inband - interface all - allow all - ! - ! - ! -! -interface Loopback0 - description Loopback - ipv4 address 192.168.0.1 255.255.255.255 -! -interface GigabitEthernet0/0/0/0 - description to nxos01 - cdp - ipv4 address 10.0.0.1 255.255.255.252 -! -end diff --git a/test/units/modules/network/iosxr/fixtures/show_version b/test/units/modules/network/iosxr/fixtures/show_version deleted file mode 100644 index faecfffdcb..0000000000 --- a/test/units/modules/network/iosxr/fixtures/show_version +++ /dev/null @@ -1,84 +0,0 @@ -Cisco IOS XR Software, Version 6.0.0[Default] -Copyright (c) 2015 by Cisco Systems, Inc. - -ROM: GRUB, Version 1.99(0), DEV RELEASE - -iosxr01 uptime is 11 weeks, 2 days, 5 hours, 48 minutes -System image file is "bootflash:disk0/xrvr-os-mbi-6.0.0/mbixrvr-rp.vm" - -cisco IOS XRv Series (Pentium Celeron Stepping 3) processor with 3169911K bytes of memory. -Pentium Celeron Stepping 3 processor at 3836MHz, Revision 2.174 -IOS XRv Chassis - -1 Management Ethernet -6 GigabitEthernet -97070k bytes of non-volatile configuration memory. -866M bytes of hard disk. -2321392k bytes of disk0: (Sector size 512 bytes). - -Configuration register on node 0/0/CPU0 is 0x2102 -Boot device on node 0/0/CPU0 is disk0: -Package active on node 0/0/CPU0: -iosxr-infra, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-infra-6.0.0 - Built on Thu Dec 24 08:53:49 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -iosxr-fwding, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-fwding-6.0.0 - Built on Thu Dec 24 08:53:49 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -iosxr-routing, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-routing-6.0.0 - Built on Thu Dec 24 08:53:49 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -iosxr-ce, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-ce-6.0.0 - Built on Thu Dec 24 08:53:49 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -xrvr-os-mbi, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-os-mbi-6.0.0 - Built on Thu Dec 24 08:54:41 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -xrvr-base, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-base-6.0.0 - Built on Thu Dec 24 08:53:49 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -xrvr-fwding, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-fwding-6.0.0 - Built on Thu Dec 24 08:53:49 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -xrvr-mgbl-x, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-mgbl-x-6.0.0 - Built on Thu Dec 24 08:53:57 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -iosxr-mpls, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-mpls-6.0.0 - Built on Thu Dec 24 08:53:49 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -iosxr-mgbl, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-mgbl-6.0.0 - Built on Thu Dec 24 08:53:49 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -iosxr-mcast, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-mcast-6.0.0 - Built on Thu Dec 24 08:53:49 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -xrvr-mcast-supp, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-mcast-supp-6.0.0 - Built on Thu Dec 24 08:53:49 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -iosxr-bng, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-bng-6.0.0 - Built on Thu Dec 24 08:53:47 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -xrvr-bng-supp, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-bng-supp-6.0.0 - Built on Thu Dec 24 08:53:47 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -iosxr-security, V 6.0.0[Default], Cisco Systems, at disk0:iosxr-security-6.0.0 - Built on Thu Dec 24 08:53:41 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie - -xrvr-fullk9-x, V 6.0.0[Default], Cisco Systems, at disk0:xrvr-fullk9-x-6.0.0 - Built on Thu Dec 24 08:55:12 UTC 2015 - By iox-lnx-010 in /auto/srcarchive16/production/6.0.0/xrvr/workspace for pie diff --git a/test/units/modules/network/iosxr/fixtures/show_version___utility_head_-n_20 b/test/units/modules/network/iosxr/fixtures/show_version___utility_head_-n_20 deleted file mode 100644 index 7f82039ff1..0000000000 --- a/test/units/modules/network/iosxr/fixtures/show_version___utility_head_-n_20 +++ /dev/null @@ -1,18 +0,0 @@ -Cisco IOS XR Software, Version 6.0.0[Default] -Copyright (c) 2015 by Cisco Systems, Inc. - -ROM: GRUB, Version 1.99(0), DEV RELEASE - -iosxr01 uptime is 11 weeks, 6 days, 2 hours, 2 minutes -System image file is "bootflash:disk0/xrvr-os-mbi-6.0.0/mbixrvr-rp.vm" - -cisco IOS XRv Series (Pentium Celeron Stepping 3) processor with 3169911K bytes -of memory. -Pentium Celeron Stepping 3 processor at 3836MHz, Revision 2.174 -IOS XRv Chassis - -1 Management Ethernet -6 GigabitEthernet -97070k bytes of non-volatile configuration memory. -866M bytes of hard disk. -2321392k bytes of disk0: (Sector size 512 bytes). diff --git a/test/units/modules/network/iosxr/fixtures/show_version_brief b/test/units/modules/network/iosxr/fixtures/show_version_brief deleted file mode 100644 index 7f82039ff1..0000000000 --- a/test/units/modules/network/iosxr/fixtures/show_version_brief +++ /dev/null @@ -1,18 +0,0 @@ -Cisco IOS XR Software, Version 6.0.0[Default] -Copyright (c) 2015 by Cisco Systems, Inc. - -ROM: GRUB, Version 1.99(0), DEV RELEASE - -iosxr01 uptime is 11 weeks, 6 days, 2 hours, 2 minutes -System image file is "bootflash:disk0/xrvr-os-mbi-6.0.0/mbixrvr-rp.vm" - -cisco IOS XRv Series (Pentium Celeron Stepping 3) processor with 3169911K bytes -of memory. -Pentium Celeron Stepping 3 processor at 3836MHz, Revision 2.174 -IOS XRv Chassis - -1 Management Ethernet -6 GigabitEthernet -97070k bytes of non-volatile configuration memory. -866M bytes of hard disk. -2321392k bytes of disk0: (Sector size 512 bytes). diff --git a/test/units/modules/network/iosxr/iosxr_module.py b/test/units/modules/network/iosxr/iosxr_module.py deleted file mode 100644 index 55f2a23688..0000000000 --- a/test/units/modules/network/iosxr/iosxr_module.py +++ /dev/null @@ -1,88 +0,0 @@ -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -import os -import json - -from units.modules.utils import AnsibleExitJson, AnsibleFailJson, ModuleTestCase - - -fixture_path = os.path.join(os.path.dirname(__file__), 'fixtures') -fixture_data = {} - - -def load_fixture(name): - path = os.path.join(fixture_path, name) - - if path in fixture_data: - return fixture_data[path] - - with open(path) as f: - data = f.read() - - try: - data = json.loads(data) - except Exception: - pass - - fixture_data[path] = data - return data - - -class TestIosxrModule(ModuleTestCase): - - def execute_module(self, failed=False, changed=False, commands=None, sort=True, defaults=False): - - self.load_fixtures(commands) - - if failed: - result = self.failed() - self.assertTrue(result['failed'], result) - else: - result = self.changed(changed) - self.assertEqual(result['changed'], changed, result) - - if commands is not None: - if sort: - self.assertEqual(sorted(commands), sorted(result['commands']), result['commands']) - else: - self.assertEqual(commands, result['commands'], result['commands']) - - return result - - def failed(self): - with self.assertRaises(AnsibleFailJson) as exc: - self.module.main() - - result = exc.exception.args[0] - self.assertTrue(result['failed'], result) - return result - - def changed(self, changed=False): - with self.assertRaises(AnsibleExitJson) as exc: - self.module.main() - - result = exc.exception.args[0] - self.assertEqual(result['changed'], changed, result) - return result - - def load_fixtures(self, commands=None): - pass diff --git a/test/units/modules/network/iosxr/test_iosxr_acls.py b/test/units/modules/network/iosxr/test_iosxr_acls.py deleted file mode 100644 index 6eab446a9f..0000000000 --- a/test/units/modules/network/iosxr/test_iosxr_acls.py +++ /dev/null @@ -1,246 +0,0 @@ -# -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.iosxr import iosxr_acls -from units.modules.utils import set_module_args -from .iosxr_module import TestIosxrModule, load_fixture - - -class TestIosxrAclsModule(TestIosxrModule): - module = iosxr_acls - - def setUp(self): - super(TestIosxrAclsModule, self).setUp() - - self.mock_get_config = patch( - 'ansible.module_utils.network.common.network.Config.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - 'ansible.module_utils.network.common.network.Config.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_get_resource_connection_config = patch( - 'ansible.module_utils.network.common.cfg.base.get_resource_connection' - ) - self.get_resource_connection_config = self.mock_get_resource_connection_config.start( - ) - - self.mock_get_resource_connection_facts = patch( - 'ansible.module_utils.network.common.facts.facts.get_resource_connection' - ) - self.get_resource_connection_facts = self.mock_get_resource_connection_facts.start( - ) - - self.mock_execute_show_command = patch( - 'ansible.module_utils.network.iosxr.facts.acls.acls.AclsFacts.get_device_data' - ) - self.execute_show_command = self.mock_execute_show_command.start() - - def tearDown(self): - super(TestIosxrAclsModule, self).tearDown() - self.mock_get_resource_connection_config.stop() - self.mock_get_resource_connection_facts.stop() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_execute_show_command.stop() - - def load_fixtures(self, commands=None): - def load_from_file(*args, **kwargs): - return load_fixture('iosxr_acls_config.cfg') - - self.execute_show_command.side_effect = load_from_file - - def test_iosxr_acls_merged(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="acl_1", - aces=[ - dict(sequence="10", - grant="permit", - protocol="ospf", - source=dict(prefix="192.168.1.0/24"), - destination=dict(any="true"), - log="true") - ]) - ]) - ], - state="merged")) - commands = [ - 'ipv4 access-list acl_1', - '10 permit ospf 192.168.1.0 0.0.0.255 any log' - ] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_acls_merged_idempotent(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="acl_2", - aces=[ - dict(sequence="10", - grant="deny", - protocol='ipv4', - destination=dict(any='true'), - source=dict(any="true")), - ]) - ]) - ], - state="merged")) - self.execute_module(changed=False, commands=[]) - - def test_iosxr_acls_replaced(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="acl_2", - aces=[ - dict(sequence="30", - grant="permit", - protocol="ospf", - source=dict(prefix="10.0.0.0/8"), - destination=dict(any="true"), - log="true") - ]) - ]) - ], - state="replaced")) - commands = [ - 'ipv4 access-list acl_2', 'no 10', 'no 20', - '30 permit ospf 10.0.0.0 0.255.255.255 any log' - ] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_acls_replaced_idempotent(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="acl_2", - aces=[ - dict(sequence="10", - grant="deny", - protocol='ipv4', - destination=dict(any='true'), - source=dict(any="true")), - dict(sequence="20", - grant="permit", - protocol="tcp", - destination=dict(any='true'), - source=dict(host="192.168.1.100")), - ]) - ]) - ], - state="replaced")) - self.execute_module(changed=False, commands=[]) - - def test_iosxr_acls_overridden(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="acl_2", - aces=[ - dict(sequence="40", - grant="permit", - protocol="ospf", - source=dict(any="true"), - destination=dict(any="true"), - log="true") - ]) - ]) - ], - state="overridden")) - commands = [ - 'no ipv6 access-list acl6_1', 'ipv4 access-list acl_2', 'no 10', - 'no 20', '40 permit ospf any any log' - ] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_acls_overridden_idempotent(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="acl_2", - aces=[ - dict(sequence="10", - grant="deny", - protocol='ipv4', - destination=dict(any='true'), - source=dict(any="true")), - dict(sequence="20", - grant="permit", - protocol="tcp", - destination=dict(any='true'), - source=dict(host="192.168.1.100")), - ]) - ]), - dict(afi='ipv6', - acls=[ - dict(name="acl6_1", - aces=[ - dict( - sequence="10", - grant="deny", - protocol="icmpv6", - destination=dict(any='true'), - source=dict(any='true'), - ) - ]) - ]) - ], - state="overridden")) - self.execute_module(changed=False, commands=[]) - - def test_iosxr_acls_deletedaces(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[dict(name="acl_2", aces=[dict(sequence="20")])]) - ], - state="deleted")) - commands = ['ipv4 access-list acl_2', 'no 20'] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_acls_deletedacls(self): - set_module_args( - dict(config=[dict(afi="ipv6", acls=[dict(name="acl6_1")])], - state="deleted")) - commands = ['no ipv6 access-list acl6_1'] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_acls_deletedafis(self): - set_module_args(dict(config=[dict(afi="ipv4")], state="deleted")) - commands = ['no ipv4 access-list acl_2'] - self.execute_module(changed=True, commands=commands) - - def test_eos_acls_rendered(self): - set_module_args( - dict(config=[ - dict(afi="ipv4", - acls=[ - dict(name="acl_2", - aces=[ - dict(grant="permit", - source=dict(any="true"), - destination=dict(any="true"), - protocol='igmp') - ]) - ]) - ], - state="rendered")) - commands = ['ipv4 access-list acl_2', 'permit igmp any any'] - result = self.execute_module(changed=False) - self.assertEqual(sorted(result['rendered']), sorted(commands), - result['rendered']) diff --git a/test/units/modules/network/iosxr/test_iosxr_command.py b/test/units/modules/network/iosxr/test_iosxr_command.py deleted file mode 100644 index 49242939e4..0000000000 --- a/test/units/modules/network/iosxr/test_iosxr_command.py +++ /dev/null @@ -1,106 +0,0 @@ -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.iosxr import iosxr_command -from units.modules.utils import set_module_args -from .iosxr_module import TestIosxrModule, load_fixture - - -class TestIosxrCommandModule(TestIosxrModule): - - module = iosxr_command - - def setUp(self): - super(TestIosxrCommandModule, self).setUp() - - self.mock_run_commands = patch('ansible.modules.network.iosxr.iosxr_command.run_commands') - self.run_commands = self.mock_run_commands.start() - - def tearDown(self): - super(TestIosxrCommandModule, self).tearDown() - - self.mock_run_commands.stop() - - def load_fixtures(self, commands=None): - - def load_from_file(*args, **kwargs): - module, commands = args - output = list() - - for item in commands: - try: - command = item['command'] - except Exception: - command = item - filename = str(command).replace(' ', '_') - output.append(load_fixture(filename)) - return output - - self.run_commands.side_effect = load_from_file - - def test_iosxr_command_simple(self): - set_module_args(dict(commands=['show version'])) - result = self.execute_module() - self.assertEqual(len(result['stdout']), 1) - self.assertTrue(result['stdout'][0].startswith('Cisco IOS XR Software')) - - def test_iosxr_command_multiple(self): - set_module_args(dict(commands=['show version', 'show version'])) - result = self.execute_module() - self.assertEqual(len(result['stdout']), 2) - self.assertTrue(result['stdout'][0].startswith('Cisco IOS XR Software')) - - def test_iosxr_command_wait_for(self): - wait_for = 'result[0] contains "Cisco IOS"' - set_module_args(dict(commands=['show version'], wait_for=wait_for)) - self.execute_module() - - def test_iosxr_command_wait_for_fails(self): - wait_for = 'result[0] contains "test string"' - set_module_args(dict(commands=['show version'], wait_for=wait_for)) - self.execute_module(failed=True) - self.assertEqual(self.run_commands.call_count, 10) - - def test_iosxr_command_retries(self): - wait_for = 'result[0] contains "test string"' - set_module_args(dict(commands=['show version'], wait_for=wait_for, retries=2)) - self.execute_module(failed=True) - self.assertEqual(self.run_commands.call_count, 2) - - def test_iosxr_command_match_any(self): - wait_for = ['result[0] contains "Cisco IOS"', - 'result[0] contains "test string"'] - set_module_args(dict(commands=['show version'], wait_for=wait_for, match='any')) - self.execute_module() - - def test_iosxr_command_match_all(self): - wait_for = ['result[0] contains "Cisco IOS"', - 'result[0] contains "XR Software"'] - set_module_args(dict(commands=['show version'], wait_for=wait_for, match='all')) - self.execute_module() - - def test_iosxr_command_match_all_failure(self): - wait_for = ['result[0] contains "Cisco IOS"', - 'result[0] contains "test string"'] - commands = ['show version', 'show version'] - set_module_args(dict(commands=commands, wait_for=wait_for, match='all')) - self.execute_module(failed=True) diff --git a/test/units/modules/network/iosxr/test_iosxr_config.py b/test/units/modules/network/iosxr/test_iosxr_config.py deleted file mode 100644 index aa08042b71..0000000000 --- a/test/units/modules/network/iosxr/test_iosxr_config.py +++ /dev/null @@ -1,221 +0,0 @@ -# -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch, MagicMock -from ansible.modules.network.iosxr import iosxr_config -from ansible.plugins.cliconf.iosxr import Cliconf -from units.modules.utils import set_module_args -from .iosxr_module import TestIosxrModule, load_fixture - - -class TestIosxrConfigModule(TestIosxrModule): - - module = iosxr_config - - def setUp(self): - super(TestIosxrConfigModule, self).setUp() - - self.patcher_get_config = patch('ansible.modules.network.iosxr.iosxr_config.get_config') - self.mock_get_config = self.patcher_get_config.start() - - self.patcher_exec_command = patch('ansible.modules.network.iosxr.iosxr_config.load_config') - self.mock_exec_command = self.patcher_exec_command.start() - - self.mock_get_connection = patch('ansible.modules.network.iosxr.iosxr_config.get_connection') - self.get_connection = self.mock_get_connection.start() - - self.conn = self.get_connection() - self.conn.edit_config = MagicMock() - - self.cliconf_obj = Cliconf(MagicMock()) - self.running_config = load_fixture('iosxr_config_config.cfg') - - def tearDown(self): - super(TestIosxrConfigModule, self).tearDown() - - self.patcher_get_config.stop() - self.patcher_exec_command.stop() - self.mock_get_connection.stop() - - def load_fixtures(self, commands=None): - config_file = 'iosxr_config_config.cfg' - self.mock_get_config.return_value = load_fixture(config_file) - self.mock_exec_command.return_value = 'dummy diff' - - def test_iosxr_config_unchanged(self): - src = load_fixture('iosxr_config_config.cfg') - set_module_args(dict(src=src)) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(src, src)) - self.execute_module() - - def test_iosxr_config_src(self): - src = load_fixture('iosxr_config_src.cfg') - set_module_args(dict(src=src)) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(src, self.running_config)) - commands = ['hostname foo', 'interface GigabitEthernet0/0', - 'no ip address'] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_config_backup(self): - set_module_args(dict(backup=True)) - result = self.execute_module() - self.assertIn('__backup__', result) - - def test_iosxr_config_lines_wo_parents(self): - lines = ['hostname foo'] - set_module_args(dict(lines=lines)) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config)) - commands = ['hostname foo'] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_config_lines_w_parents(self): - lines = ['shutdown'] - parents = ['interface GigabitEthernet0/0'] - set_module_args(dict(lines=lines, parents=parents)) - module = MagicMock() - module.params = {'lines': lines, 'parents': parents, 'src': None} - candidate_config = iosxr_config.get_candidate(module) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config)) - commands = ['interface GigabitEthernet0/0', 'shutdown'] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_config_before(self): - lines = ['hostname foo'] - set_module_args(dict(lines=lines, before=['test1', 'test2'])) - commands = ['test1', 'test2', 'hostname foo'] - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config)) - self.execute_module(changed=True, commands=commands, sort=False) - - def test_iosxr_config_after(self): - lines = ['hostname foo'] - set_module_args(dict(lines=lines, after=['test1', 'test2'])) - commands = ['hostname foo', 'test1', 'test2'] - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config)) - self.execute_module(changed=True, commands=commands, sort=False) - - def test_iosxr_config_before_after_no_change(self): - lines = ['hostname router'] - set_module_args(dict(lines=lines, - before=['test1', 'test2'], - after=['test3', 'test4'])) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config)) - self.execute_module() - - def test_iosxr_config_config(self): - config = 'hostname localhost' - lines = ['hostname router'] - set_module_args(dict(lines=['hostname router'], config=config)) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), config)) - commands = ['hostname router'] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_config_replace_block(self): - lines = ['description test string', 'test string'] - parents = ['interface GigabitEthernet0/0'] - set_module_args(dict(lines=lines, replace='block', parents=parents)) - commands = parents + lines - - module = MagicMock() - module.params = {'lines': lines, 'parents': parents, 'src': None} - candidate_config = iosxr_config.get_candidate(module) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_replace='block', path=parents)) - self.execute_module(changed=True, commands=commands) - - def test_iosxr_config_force(self): - lines = ['hostname router'] - set_module_args(dict(lines=lines, force=True)) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config, diff_match='none')) - self.execute_module(changed=True, commands=lines) - - def test_iosxr_config_admin(self): - lines = ['username admin', 'group root-system', 'secret P@ssw0rd'] - set_module_args(dict(lines=lines, admin=True)) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff('\n'.join(lines), self.running_config)) - self.execute_module(changed=True, commands=lines) - - def test_iosxr_config_match_none(self): - lines = ['ip address 1.2.3.4 255.255.255.0', 'description test string'] - parents = ['interface GigabitEthernet0/0'] - set_module_args(dict(lines=lines, parents=parents, match='none')) - commands = parents + lines - module = MagicMock() - module.params = {'lines': lines, 'parents': parents, 'src': None} - candidate_config = iosxr_config.get_candidate(module) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_match='none', path=parents)) - - self.execute_module(changed=True, commands=commands, sort=False) - - def test_iosxr_config_match_strict(self): - lines = ['ip address 1.2.3.4 255.255.255.0', 'description test string', - 'shutdown'] - parents = ['interface GigabitEthernet0/0'] - set_module_args(dict(lines=lines, parents=parents, match='strict')) - commands = parents + ['shutdown'] - module = MagicMock() - module.params = {'lines': lines, 'parents': parents, 'src': None} - candidate_config = iosxr_config.get_candidate(module) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_match='strict', path=parents)) - - self.execute_module(changed=True, commands=commands, sort=False) - - def test_iosxr_config_match_exact(self): - lines = ['ip address 1.2.3.4 255.255.255.0', 'description test string', - 'shutdown'] - parents = ['interface GigabitEthernet0/0'] - set_module_args(dict(lines=lines, parents=parents, match='exact')) - commands = parents + lines - module = MagicMock() - module.params = {'lines': lines, 'parents': parents, 'src': None} - candidate_config = iosxr_config.get_candidate(module) - self.conn.get_diff = MagicMock(return_value=self.cliconf_obj.get_diff(candidate_config, self.running_config, diff_match='exact', path=parents)) - - self.execute_module(changed=True, commands=commands, sort=False) - - def test_iosxr_config_src_and_lines_fails(self): - args = dict(src='foo', lines='foo') - set_module_args(args) - self.execute_module(failed=True) - - def test_iosxr_config_src_and_parents_fails(self): - args = dict(src='foo', parents='foo') - set_module_args(args) - self.execute_module(failed=True) - - def test_iosxr_config_match_exact_requires_lines(self): - args = dict(match='exact') - set_module_args(args) - self.execute_module(failed=True) - - def test_iosxr_config_match_strict_requires_lines(self): - args = dict(match='strict') - set_module_args(args) - self.execute_module(failed=True) - - def test_iosxr_config_replace_block_requires_lines(self): - args = dict(replace='block') - set_module_args(args) - self.execute_module(failed=True) - - def test_iosxr_config_replace_config_requires_src(self): - args = dict(replace='config') - set_module_args(args) - self.execute_module(failed=True) diff --git a/test/units/modules/network/iosxr/test_iosxr_facts.py b/test/units/modules/network/iosxr/test_iosxr_facts.py deleted file mode 100644 index 28f59c253a..0000000000 --- a/test/units/modules/network/iosxr/test_iosxr_facts.py +++ /dev/null @@ -1,103 +0,0 @@ -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -import json - -from units.compat.mock import patch -from units.modules.utils import set_module_args -from .iosxr_module import TestIosxrModule, load_fixture -from ansible.modules.network.iosxr import iosxr_facts - - -class TestIosxrFacts(TestIosxrModule): - - module = iosxr_facts - - def setUp(self): - super(TestIosxrFacts, self).setUp() - - self.mock_run_commands = patch( - 'ansible.module_utils.network.iosxr.facts.legacy.base.run_commands') - self.run_commands = self.mock_run_commands.start() - - self.mock_get_resource_connection = patch('ansible.module_utils.network.common.facts.facts.get_resource_connection') - self.get_resource_connection = self.mock_get_resource_connection.start() - - self.mock_get_capabilities = patch('ansible.module_utils.network.iosxr.facts.legacy.base.get_capabilities') - self.get_capabilities = self.mock_get_capabilities.start() - self.get_capabilities.return_value = { - 'device_info': { - 'network_os': 'iosxr', - 'network_os_hostname': 'iosxr01', - 'network_os_image': 'bootflash:disk0/xrvr-os-mbi-6.1.3/mbixrvr-rp.vm', - 'network_os_version': '6.1.3[Default]' - }, - 'network_api': 'cliconf' - } - - def tearDown(self): - super(TestIosxrFacts, self).tearDown() - - self.mock_run_commands.stop() - self.mock_get_capabilities.stop() - self.mock_get_resource_connection.stop() - - def load_fixtures(self, commands=None): - - def load_from_file(*args, **kwargs): - module, commands = args - output = list() - - for item in commands: - try: - obj = json.loads(item) - command = obj['command'] - except ValueError: - command = item - filename = str(command).replace(' ', '_') - filename = filename.replace('/', '7') - filename = filename.replace('|', '_') - output.append(load_fixture(filename)) - return output - - self.run_commands.side_effect = load_from_file - - def test_iosxr_facts_gather_subset_default(self): - set_module_args(dict()) - result = self.execute_module() - ansible_facts = result['ansible_facts'] - self.assertIn('hardware', ansible_facts['ansible_net_gather_subset']) - self.assertIn('default', ansible_facts['ansible_net_gather_subset']) - self.assertIn('interfaces', ansible_facts['ansible_net_gather_subset']) - self.assertEqual('iosxr01', ansible_facts['ansible_net_hostname']) - self.assertEqual(['disk0:', 'flash0:'], ansible_facts['ansible_net_filesystems']) - self.assertIn('GigabitEthernet0/0/0/0', ansible_facts['ansible_net_interfaces'].keys()) - self.assertEqual('3095', ansible_facts['ansible_net_memtotal_mb']) - self.assertEqual('1499', ansible_facts['ansible_net_memfree_mb']) - - def test_iosxr_facts_gather_subset_config(self): - set_module_args({'gather_subset': 'config'}) - result = self.execute_module() - ansible_facts = result['ansible_facts'] - self.assertIn('default', ansible_facts['ansible_net_gather_subset']) - self.assertIn('config', ansible_facts['ansible_net_gather_subset']) - self.assertEqual('iosxr01', ansible_facts['ansible_net_hostname']) - self.assertIn('ansible_net_config', ansible_facts) diff --git a/test/units/modules/network/iosxr/test_iosxr_netconf.py b/test/units/modules/network/iosxr/test_iosxr_netconf.py deleted file mode 100644 index a6f8b65cc1..0000000000 --- a/test/units/modules/network/iosxr/test_iosxr_netconf.py +++ /dev/null @@ -1,87 +0,0 @@ -# (c) 2017 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.iosxr import iosxr_netconf -from units.modules.utils import set_module_args -from .iosxr_module import TestIosxrModule - - -class TestIosxrNetconfModule(TestIosxrModule): - - module = iosxr_netconf - - def setUp(self): - super(TestIosxrNetconfModule, self).setUp() - - self.mock_get_config = patch('ansible.modules.network.iosxr.iosxr_netconf.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.modules.network.iosxr.iosxr_netconf.load_config') - self.load_config = self.mock_load_config.start() - - def tearDown(self): - super(TestIosxrNetconfModule, self).tearDown() - self.mock_get_config.stop() - self.mock_load_config.stop() - - def test_iosxr_disable_netconf_service(self): - self.get_config.return_value = ''' - netconf-yang agent - ssh - ! - ssh server netconf vrf default - ''' - self.load_config.return_value = 'dummy diff' - set_module_args(dict(netconf_port=830, netconf_vrf='default', state='absent')) - result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['no netconf-yang agent ssh', 'no ssh server netconf port 830', 'no ssh server netconf vrf default']) - - def test_iosxr_enable_netconf_service(self): - self.get_config.return_value = '' - self.load_config.return_value = 'dummy diff' - set_module_args(dict(netconf_port=830, netconf_vrf='default', state='present')) - result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['netconf-yang agent ssh', 'ssh server netconf port 830', 'ssh server netconf vrf default']) - - def test_iosxr_change_netconf_port(self): - self.get_config.return_value = ''' - netconf-yang agent - ssh - ! - ssh server netconf vrf default - ''' - self.load_config.return_value = 'dummy diff' - set_module_args(dict(netconf_port=9000, state='present')) - result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['ssh server netconf port 9000']) - - def test_iosxr_change_netconf_vrf(self): - self.get_config.return_value = ''' - netconf-yang agent - ssh - ! - ssh server netconf vrf default - ''' - self.load_config.return_value = 'dummy diff' - set_module_args(dict(netconf_vrf='new_default', state='present')) - result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['ssh server netconf vrf new_default']) diff --git a/test/units/modules/network/iosxr/test_iosxr_static_routes.py b/test/units/modules/network/iosxr/test_iosxr_static_routes.py deleted file mode 100644 index 257b855ba6..0000000000 --- a/test/units/modules/network/iosxr/test_iosxr_static_routes.py +++ /dev/null @@ -1,395 +0,0 @@ -# -# (c) 2019, Ansible by Red Hat, inc -# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) -# - -from __future__ import absolute_import, division, print_function - -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.iosxr import iosxr_static_routes -from units.modules.utils import set_module_args -from .iosxr_module import TestIosxrModule, load_fixture - - -class TestIosxrStaticRoutesModule(TestIosxrModule): - module = iosxr_static_routes - - def setUp(self): - super(TestIosxrStaticRoutesModule, self).setUp() - - self.mock_get_config = patch( - "ansible.module_utils.network.common.network.Config.get_config" - ) - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch( - "ansible.module_utils.network.common.network.Config.load_config" - ) - self.load_config = self.mock_load_config.start() - - self.mock_get_resource_connection_config = patch( - "ansible.module_utils.network.common.cfg.base.get_resource_connection" - ) - self.get_resource_connection_config = ( - self.mock_get_resource_connection_config.start() - ) - - self.mock_get_resource_connection_facts = patch( - "ansible.module_utils.network.common.facts.facts.get_resource_connection" - ) - self.get_resource_connection_facts = ( - self.mock_get_resource_connection_facts.start() - ) - - self.mock_execute_show_command = patch( - "ansible.module_utils.network.iosxr.facts.static_routes.static_routes.Static_routesFacts.get_device_data" - ) - self.execute_show_command = self.mock_execute_show_command.start() - - def tearDown(self): - super(TestIosxrStaticRoutesModule, self).tearDown() - self.mock_get_resource_connection_config.stop() - self.mock_get_resource_connection_facts.stop() - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_execute_show_command.stop() - - def load_fixtures(self, commands=None): - def load_from_file(*args, **kwargs): - return load_fixture("iosxr_static_routes_config.cfg") - - self.execute_show_command.side_effect = load_from_file - - def test_iosxr_static_routes_merged(self): - set_module_args( - dict( - config=[ - dict( - vrf="dev_site", - address_families=[ - dict( - afi="ipv6", - safi="unicast", - routes=[ - dict( - dest="1200:10::/64", - next_hops=[ - dict( - interface="GigabitEthernet0/0/0/1", - admin_distance=55, - ) - ], - ) - ], - ) - ], - ) - ], - state="merged", - ) - ) - commands = [ - "router static", - "vrf dev_site", - "address-family ipv6 unicast", - "1200:10::/64 GigabitEthernet0/0/0/1 55", - ] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_static_routes_merged_idempotent(self): - set_module_args( - dict( - config=[ - dict( - vrf="DEV_SITE", - address_families=[ - dict( - afi="ipv4", - safi="unicast", - routes=[ - dict( - dest="192.0.2.48/28", - next_hops=[ - dict( - interface="192.0.2.12", - description="DEV", - dest_vrf="test_1", - ) - ], - ) - ], - ) - ], - ) - ], - state="merged", - ) - ) - self.execute_module(changed=False, commands=[]) - - def test_iosxr_static_routes_default(self): - set_module_args( - dict( - config=[ - dict( - address_families=[ - dict( - afi="ipv4", - safi="unicast", - routes=[ - dict( - dest="192.168.1.0/24", - next_hops=[ - dict( - interface="GigabitEthernet0/0/0/2", - track="ip_sla_2", - vrflabel=1200, - ) - ], - ) - ], - ) - ] - ) - ] - ) - ) - commands = [ - "router static", - "address-family ipv4 unicast", - "192.168.1.0/24 GigabitEthernet0/0/0/2 track ip_sla_2 vrflabel 1200", - ] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_static_routes_default_idempotent(self): - set_module_args( - dict( - config=[ - dict( - address_families=[ - dict( - afi="ipv4", - safi="unicast", - routes=[ - dict( - dest="192.0.2.32/28", - next_hops=[ - dict( - forward_router_address="192.0.2.11", - admin_distance=100, - ) - ], - ) - ], - ) - ] - ) - ] - ) - ) - self.execute_module(changed=False, commands=[]) - - def test_iosxr_static_routes_replaced(self): - set_module_args( - dict( - config=[ - dict( - address_families=[ - dict( - afi="ipv4", - safi="unicast", - routes=[ - dict( - dest="192.0.2.16/28", - next_hops=[ - dict( - forward_router_address="192.0.2.11", - admin_distance=100, - ) - ], - ) - ], - ) - ] - ) - ], - state="replaced", - ) - ) - commands = [ - "router static", - "address-family ipv4 unicast", - "no 192.0.2.16/28 192.0.2.10 FastEthernet0/0/0/1", - "no 192.0.2.16/28 FastEthernet0/0/0/5", - "192.0.2.16/28 192.0.2.11 100", - ] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_static_routes_replaced_idempotent(self): - set_module_args( - dict( - config=[ - dict( - address_families=[ - dict( - afi="ipv4", - safi="unicast", - routes=[ - dict( - dest="192.0.2.16/28", - next_hops=[ - dict( - interface="FastEthernet0/0/0/5", - track="ip_sla_1", - ), - dict( - interface="FastEthernet0/0/0/1", - forward_router_address="192.0.2.10", - tag=10, - description="LAB", - metric=120, - ), - ], - ) - ], - ) - ] - ) - ], - state="replaced", - ) - ) - self.execute_module(changed=False, commands=[]) - - def test_iosxr_static_routes_overridden(self): - set_module_args( - dict( - config=[ - dict( - vrf="DEV_SITE_NEW", - address_families=[ - dict( - afi="ipv4", - safi="unicast", - routes=[ - dict( - dest="192.0.4.16/28", - next_hops=[ - dict( - interface="FastEthernet0/0/0/5", - track="ip_sla_1", - ), - dict( - interface="FastEthernet0/0/0/1", - forward_router_address="192.0.2.10", - tag=10, - description="LAB", - metric=120, - ), - ], - ) - ], - ) - ], - ) - ], - state="overridden", - ) - ) - commands = [ - "router static", - "no address-family ipv4 unicast", - "no address-family ipv6 unicast", - "no vrf DEV_SITE", - "vrf DEV_SITE_NEW", - "address-family ipv4 unicast", - "192.0.4.16/28 192.0.2.10 FastEthernet0/0/0/1 description LAB metric 120 tag 10", - "192.0.4.16/28 FastEthernet0/0/0/5 track ip_sla_1", - ] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_static_routes_deleted_next_hop(self): - set_module_args( - dict( - config=[ - dict( - address_families=[ - dict( - afi="ipv4", - safi="unicast", - routes=[ - dict( - dest="192.0.2.16/28", - next_hops=[ - dict(interface="FastEthernet0/0/0/5") - ], - ) - ], - ) - ] - ) - ], - state="deleted", - ) - ) - - commands = [ - "router static", - "address-family ipv4 unicast", - "no 192.0.2.16/28 FastEthernet0/0/0/5", - ] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_static_routes_deleted_dest(self): - set_module_args( - dict( - config=[ - dict( - address_families=[ - dict( - afi="ipv4", - safi="unicast", - routes=[dict(dest="192.0.2.16/28")], - ) - ] - ) - ], - state="deleted", - ) - ) - - commands = ["router static", "address-family ipv4 unicast", "no 192.0.2.16/28"] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_static_routes_deleted_afi(self): - set_module_args( - dict( - config=[dict(address_families=[dict(afi="ipv4", safi="unicast")])], - state="deleted", - ) - ) - - commands = [ - "router static", - "no address-family ipv4 unicast", - ] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_static_routes_deleted_vrf(self): - set_module_args(dict(config=[dict(vrf="DEV_SITE")], state="deleted")) - - commands = [ - "router static", - "no vrf DEV_SITE", - ] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_static_routes_deleted_all(self): - set_module_args(dict(state="deleted")) - - commands = [ - "no router static", - ] - self.execute_module(changed=True, commands=commands) diff --git a/test/units/modules/network/iosxr/test_iosxr_system.py b/test/units/modules/network/iosxr/test_iosxr_system.py deleted file mode 100644 index 626f6fe358..0000000000 --- a/test/units/modules/network/iosxr/test_iosxr_system.py +++ /dev/null @@ -1,101 +0,0 @@ -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from units.modules.utils import set_module_args -from .iosxr_module import TestIosxrModule, load_fixture -from ansible.modules.network.iosxr import iosxr_system - - -class TestIosxrSystemModule(TestIosxrModule): - - module = iosxr_system - - def setUp(self): - super(TestIosxrSystemModule, self).setUp() - - self.mock_get_config = patch('ansible.modules.network.iosxr.iosxr_system.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.modules.network.iosxr.iosxr_system.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_is_cliconf = patch('ansible.modules.network.iosxr.iosxr_system.is_cliconf') - self.is_cliconf = self.mock_is_cliconf.start() - - def tearDown(self): - super(TestIosxrSystemModule, self).tearDown() - - self.mock_get_config.stop() - self.mock_load_config.stop() - - def load_fixtures(self, commands=None): - self.get_config.return_value = load_fixture('iosxr_system_config.cfg') - self.load_config.return_value = dict(diff=None, session='session') - self.is_cliconf.return_value = True - - def test_iosxr_system_hostname_changed(self): - set_module_args(dict(hostname='foo')) - commands = ['hostname foo', 'no domain lookup disable'] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_system_domain_name(self): - set_module_args(dict(domain_name='test.com')) - commands = ['domain name test.com', 'no domain lookup disable'] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_system_domain_search(self): - set_module_args(dict(domain_search=['ansible.com', 'redhat.com'])) - commands = ['domain list ansible.com', 'no domain list cisco.com', 'no domain lookup disable'] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_system_lookup_source(self): - set_module_args(dict(lookup_source='Ethernet1')) - commands = ['domain lookup source-interface Ethernet1', 'no domain lookup disable'] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_system_lookup_enabled(self): - set_module_args(dict(lookup_enabled=True)) - commands = ['no domain lookup disable'] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_system_name_servers(self): - name_servers = ['8.8.8.8', '8.8.4.4', '1.1.1.1'] - set_module_args(dict(name_servers=name_servers)) - self.execute_module(changed=True) - - def test_iosxr_system_state_absent(self): - set_module_args(dict(state='absent')) - commands = [ - 'no hostname', - 'no domain name', - 'no domain lookup disable', - 'no domain lookup source-interface MgmtEth0/0/CPU0/0', - 'no domain list redhat.com', - 'no domain list cisco.com', - 'no domain name-server 8.8.8.8', - 'no domain name-server 8.8.4.4' - ] - self.execute_module(changed=True, commands=commands) - - def test_iosxr_system_no_change(self): - set_module_args(dict(hostname='iosxr01', domain_name='eng.ansible.com', lookup_enabled=False)) - self.execute_module() diff --git a/test/units/modules/network/iosxr/test_iosxr_user.py b/test/units/modules/network/iosxr/test_iosxr_user.py deleted file mode 100644 index 755520fffd..0000000000 --- a/test/units/modules/network/iosxr/test_iosxr_user.py +++ /dev/null @@ -1,94 +0,0 @@ -# (c) 2016 Red Hat Inc. -# -# This file is part of Ansible -# -# Ansible is free software: you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation, either version 3 of the License, or -# (at your option) any later version. -# -# Ansible is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with Ansible. If not, see <http://www.gnu.org/licenses/>. - -# Make coding more python3-ish -from __future__ import (absolute_import, division, print_function) -__metaclass__ = type - -from units.compat.mock import patch -from ansible.modules.network.iosxr import iosxr_user -from units.modules.utils import set_module_args -from .iosxr_module import TestIosxrModule, load_fixture - - -class TestIosxrUserModule(TestIosxrModule): - - module = iosxr_user - - def setUp(self): - super(TestIosxrUserModule, self).setUp() - - self.mock_get_config = patch('ansible.modules.network.iosxr.iosxr_user.get_config') - self.get_config = self.mock_get_config.start() - - self.mock_load_config = patch('ansible.modules.network.iosxr.iosxr_user.load_config') - self.load_config = self.mock_load_config.start() - - self.mock_is_cliconf = patch('ansible.modules.network.iosxr.iosxr_user.is_cliconf') - self.is_cliconf = self.mock_is_cliconf.start() - - def tearDown(self): - super(TestIosxrUserModule, self).tearDown() - - self.mock_get_config.stop() - self.mock_load_config.stop() - self.mock_is_cliconf.stop() - - def load_fixtures(self, commands=None, transport='cli'): - self.get_config.return_value = load_fixture('iosxr_user_config.cfg') - self.load_config.return_value = dict(diff=None, session='session') - self.is_cliconf.return_value = True - - def test_iosxr_user_delete(self): - set_module_args(dict(name='ansible', state='absent')) - result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['no username ansible']) - - def test_iosxr_user_password(self): - set_module_args(dict(name='ansible', configured_password='test')) - result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['username ansible secret test']) - - def test_iosxr_user_purge(self): - set_module_args(dict(purge=True)) - result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['no username ansible']) - - def test_iosxr_user_group(self): - set_module_args(dict(name='ansible', group='sysadmin')) - result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['username ansible group sysadmin']) - - def test_iosxr_user_update_password_changed(self): - set_module_args(dict(name='test', configured_password='test', update_password='on_create')) - result = self.execute_module(changed=True) - self.assertEqual(result['commands'], - ['username test', 'username test secret test']) - - def test_iosxr_user_update_password_on_create_ok(self): - set_module_args(dict(name='ansible', configured_password='test', update_password='on_create')) - self.execute_module() - - def test_iosxr_user_update_password_always(self): - set_module_args(dict(name='ansible', configured_password='test', update_password='always')) - result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['username ansible secret test']) - - def test_iosxr_user_admin_mode(self): - set_module_args(dict(name='ansible-2', configured_password='test-2', admin=True)) - result = self.execute_module(changed=True) - self.assertEqual(result['commands'], ['username ansible-2', 'username ansible-2 secret test-2']) |