diff options
Diffstat (limited to 'ansible_collections/cisco/iosxr/tests')
66 files changed, 152 insertions, 779 deletions
diff --git a/ansible_collections/cisco/iosxr/tests/config.yml b/ansible_collections/cisco/iosxr/tests/config.yml index 41f529264..c26ea5966 100644 --- a/ansible_collections/cisco/iosxr/tests/config.yml +++ b/ansible_collections/cisco/iosxr/tests/config.yml @@ -1,3 +1,3 @@ --- modules: - python_requires: ">=3.6" + python_requires: ">=3.9" diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/backup.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/backup.yaml index f33fedff6..26ecf9931 100644 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/backup.yaml +++ b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/backup.yaml @@ -19,7 +19,7 @@ - ansible.builtin.assert: that: - result.changed == true - - result.updates is not defined + - result.updates is defined - name: Delete configurable backup file path ansible.builtin.file: diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml index cbb59f6e8..b361b6c32 100644 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml +++ b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment-too-long.yaml @@ -20,7 +20,6 @@ - ansible.builtin.assert: that: - result.changed == false - - result.updates is not defined - "'comment argument cannot be more than 60 characters' in result.msg" - ansible.builtin.debug: msg="END cli/comment-too-long.yaml on connection={{ ansible_connection }}" diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment.yaml index dcbbe78a8..7b8ba6dec 100644 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment.yaml +++ b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/comment.yaml @@ -20,7 +20,7 @@ - ansible.builtin.assert: that: - result.changed == true - - result.updates is not defined + - result.updates is defined - name: Check device with configuration register: result @@ -31,7 +31,6 @@ - ansible.builtin.assert: that: - result.changed == false - - result.updates is not defined - name: Assert accurately report configuration failure during pseudo-atomic operation register: result diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/replace_block.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/replace_block.yaml index b5dce6496..e3977bb74 100644 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/replace_block.yaml +++ b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/replace_block.yaml @@ -31,3 +31,9 @@ that: - result2.changed == true - result1.commands == result2.commands + +- name: Cleanup + cisco.iosxr.iosxr_config: + commands: + - no interface GigabitEthernet 0/0/0/5 + ignore_errors: true diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml index dd79ebe07..e4a7e9393 100644 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml +++ b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_basic.yaml @@ -18,7 +18,7 @@ - ansible.builtin.assert: that: - result.changed == true - - result.updates is not defined + - result.updates is defined - name: Check device with configuration register: result @@ -28,6 +28,5 @@ - ansible.builtin.assert: that: - result.changed == false - - result.updates is not defined - ansible.builtin.debug: msg="END cli/src_basic.yaml on connection={{ ansible_connection }}" diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml index 7794ab371..3e804679c 100644 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml +++ b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_config/tests/cli/src_match_none.yaml @@ -19,7 +19,7 @@ - ansible.builtin.assert: that: - result.changed == true - - result.updates is not defined + - result.updates is defined - name: Check device with configuration register: result @@ -29,6 +29,5 @@ - ansible.builtin.assert: that: - result.changed == false - - result.updates is not defined - ansible.builtin.debug: msg="END cli/src_match_none.yaml on connection={{ ansible_connection }}" diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/defaults/main.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/defaults/main.yaml deleted file mode 100644 index 9ef5ba516..000000000 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/defaults/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -testcase: "*" -test_items: [] diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/meta/main.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/meta/main.yaml deleted file mode 100644 index be631e5d8..000000000 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/meta/main.yaml +++ /dev/null @@ -1,3 +0,0 @@ ---- -dependencies: - - prepare_iosxr_tests diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/cli.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/cli.yaml deleted file mode 100644 index 88e4708f8..000000000 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/cli.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: Collect all CLI test cases - ansible.builtin.find: - paths: "{{ role_path }}/tests/cli" - patterns: "{{ testcase }}.yaml" - register: test_cases - delegate_to: localhost - -- name: Set test_items - ansible.builtin.set_fact: - test_items: "{{ test_cases.files | map(attribute='path') | list }}" - -- name: Run test case (connection=ansible.netcommon.network_cli) - ansible.builtin.include_tasks: "{{ test_case_to_run }}" - vars: - ansible_connection: ansible.netcommon.network_cli - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: - - network_cli - -- name: Reset connection - ansible.builtin.meta: reset_connection diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/main.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/main.yaml deleted file mode 100644 index 419a6cde6..000000000 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/main.yaml +++ /dev/null @@ -1,6 +0,0 @@ ---- -- name: Include the CLI tasks - ansible.builtin.include_tasks: cli.yaml - -- name: Include the netconf tasks - ansible.builtin.include_tasks: netconf.yaml diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/netconf.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/netconf.yaml deleted file mode 100644 index 26f9ab49a..000000000 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tasks/netconf.yaml +++ /dev/null @@ -1,24 +0,0 @@ ---- -- name: Collect all CLI test cases - ansible.builtin.find: - paths: "{{ role_path }}/tests/netconf" - patterns: "{{ testcase }}.yaml" - register: test_cases - delegate_to: localhost - -- name: Set test_items - ansible.builtin.set_fact: - test_items: "{{ test_cases.files | map(attribute='path') | list }}" - -- name: Run test case (connection=ansible.netcommon.netconf) - ansible.builtin.include_tasks: "{{ test_case_to_run }}" - vars: - ansible_connection: ansible.netcommon.netconf - with_items: "{{ test_items }}" - loop_control: - loop_var: test_case_to_run - tags: - - netconf - -- name: Reset connection - ansible.builtin.meta: reset_connection diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/cli/basic.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/cli/basic.yaml deleted file mode 100644 index 02280f4a0..000000000 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/cli/basic.yaml +++ /dev/null @@ -1,140 +0,0 @@ ---- -- name: Remove host logging - cisco.iosxr.iosxr_logging: - dest: host - name: 172.16.0.1 - state: absent - -- name: Remove console logging - register: result - cisco.iosxr.iosxr_logging: - dest: console - state: absent - -- name: Remove buffered logging - register: result - cisco.iosxr.iosxr_logging: - dest: buffered - size: 2097155 - state: absent - -- name: Set up syslog host logging - register: result - cisco.iosxr.iosxr_logging: &id001 - dest: host - name: 172.16.0.1 - level: errors - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"logging 172.16.0.1 vrf default severity error" in result.commands' - -- name: Set up syslog host logging (idempotent) - register: result - cisco.iosxr.iosxr_logging: *id001 -- ansible.builtin.assert: &id003 - that: - - result.changed == false - -- name: Delete/disable syslog host logging - register: result - cisco.iosxr.iosxr_logging: &id002 - dest: host - name: 172.16.0.1 - state: absent - -- ansible.builtin.assert: - that: - - result.changed == true - - '"no logging 172.16.0.1 vrf default" in result.commands' - -- name: Delete/disable syslog host logging (idempotent) - register: result - cisco.iosxr.iosxr_logging: *id002 -- ansible.builtin.assert: *id003 -- name: Add console logging with level warning - register: result - cisco.iosxr.iosxr_logging: &id004 - dest: console - level: warning - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"logging console warning" in result.commands' - -- name: Console logging with level warning (idempotent) - register: result - cisco.iosxr.iosxr_logging: *id004 -- ansible.builtin.assert: *id003 -- name: Remove console logging with level warning - register: result - cisco.iosxr.iosxr_logging: - dest: console - level: warning - state: absent - -- ansible.builtin.assert: &id006 - that: - - result.changed == true - -- name: Configure buffered logging size - register: result - cisco.iosxr.iosxr_logging: &id005 - dest: buffered - size: 4800000 - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"logging buffered 4800000" in result.commands' - -- name: Configure buffered logging size (idempotence) - register: result - cisco.iosxr.iosxr_logging: *id005 -- ansible.builtin.assert: *id003 -- name: Remove buffered logging size - register: result - cisco.iosxr.iosxr_logging: - dest: buffered - size: 4800000 - state: absent - -- ansible.builtin.assert: *id006 -- name: Change logging parameters using aggregate - register: result - cisco.iosxr.iosxr_logging: - aggregate: - - dest: console - level: notifications - - - dest: buffered - size: 4700000 - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"logging buffered 4700000" in result.commands' - - '"logging console notifications" in result.commands' - -- name: Remove logging parameters using aggregate - register: result - cisco.iosxr.iosxr_logging: - aggregate: - - dest: console - level: notifications - - - dest: buffered - size: 4700000 - state: absent - -- ansible.builtin.assert: - that: - - result.changed == true - - '"no logging console" in result.commands' - - '"no logging buffered" in result.commands' diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml deleted file mode 100644 index 2bd05e511..000000000 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_logging/tests/netconf/basic.yaml +++ /dev/null @@ -1,208 +0,0 @@ ---- -- name: Remove host logging - cisco.iosxr.iosxr_logging: - dest: host - name: 172.16.0.1 - state: absent - -- name: Remove console logging - register: result - cisco.iosxr.iosxr_logging: - dest: console - level: warning - state: absent - -- name: Remove buffered logging - register: result - cisco.iosxr.iosxr_logging: - dest: buffered - size: 2097155 - state: absent - -- name: Set up syslog host logging - register: result - cisco.iosxr.iosxr_logging: &id001 - dest: host - name: 172.16.0.1 - level: errors - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"172.16.0.1" in result.xml[0]' - -- name: Set up syslog host logging (idempotent) - register: result - cisco.iosxr.iosxr_logging: *id001 -- ansible.builtin.assert: &id003 - that: - - result.changed == false - -- name: Delete/disable syslog host logging - register: result - cisco.iosxr.iosxr_logging: &id002 - dest: host - name: 172.16.0.1 - state: absent - -- ansible.builtin.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) - register: result - cisco.iosxr.iosxr_logging: *id002 -- ansible.builtin.assert: *id003 -- name: Add console logging with level warning - register: result - cisco.iosxr.iosxr_logging: &id004 - dest: console - level: warning - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"console" in result.xml[0]' - - '"warning" in result.xml[0]' - -- name: Console logging with level warning (idempotent) - register: result - cisco.iosxr.iosxr_logging: *id004 -- ansible.builtin.assert: *id003 -- name: Remove console logging with level warning - register: result - cisco.iosxr.iosxr_logging: - dest: console - level: warning - state: absent - -- ansible.builtin.assert: &id006 - that: - - result.changed == true - -- name: Configure buffered logging size - register: result - cisco.iosxr.iosxr_logging: &id005 - dest: buffered - size: 4800000 - state: present - -- ansible.builtin.assert: - that: - - result.changed == true - - '"buffered" in result.xml[0]' - - '"4800000" in result.xml[0]' - -- name: Configure buffered logging size (idempotence) - register: result - cisco.iosxr.iosxr_logging: *id005 -- ansible.builtin.assert: *id003 -- name: Remove buffered logging size - register: result - cisco.iosxr.iosxr_logging: - dest: buffered - size: 4800000 - state: absent - -- ansible.builtin.assert: *id006 -- name: Change logging parameters using aggregate - register: result - cisco.iosxr.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 - path: /file1 - - - dest: file - name: file2 - size: 2048 - path: /file2 - - - facility: local3 - - - hostnameprefix: host3 - state: present - -- ansible.builtin.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]' - - '"debug" in result.xml[4]' - - '"local3" in result.xml[5]' - - '"host3" in result.xml[6]' - -- name: Remove logging parameters using aggregate - register: result - cisco.iosxr.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 - -- ansible.builtin.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]' - - '"debug" in result.xml[4]' - - '"local3" in result.xml[5]' - - '"host3" in result.xml[6]' diff --git a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml index 2ab0957ae..5f08fd677 100644 --- a/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml +++ b/ansible_collections/cisco/iosxr/tests/integration/targets/iosxr_smoke/tests/netconf/common_netconf.yaml @@ -23,24 +23,4 @@ - "'this is my login banner' in result.xml" - "'that has a multiline' in result.xml" -# hit etree_findall() -- name: Remove host logging - cisco.iosxr.iosxr_logging: - dest: host - name: 172.16.0.1 - state: absent - -- name: Set up syslog host logging - cisco.iosxr.iosxr_logging: - dest: host - name: 172.16.0.1 - level: errors - state: present - register: result - -- ansible.builtin.assert: - that: - - "result.changed == true" - - '"172.16.0.1" in result.xml[0]' - - ansible.builtin.debug: msg="END iosxr netconf/common_netconf.yaml on connection={{ ansible_connection }}" diff --git a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.10.txt b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.10.txt deleted file mode 100644 index c2f1a6018..000000000 --- a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.10.txt +++ /dev/null @@ -1,28 +0,0 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py import-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py import-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py import-2.6!skip -plugins/modules/iosxr_acl_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospf_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospfv2.py import-2.6!skip -plugins/modules/iosxr_ospfv3.py import-2.6!skip -plugins/modules/iosxr_bgp_neighbor_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_global.py import-2.6!skip -plugins/modules/iosxr_prefix_lists.py import-2.6!skip -plugins/modules/iosxr_logging_global.py import-2.6!skip diff --git a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.11.txt b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.11.txt deleted file mode 100644 index b492817fc..000000000 --- a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.11.txt +++ /dev/null @@ -1,31 +0,0 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py import-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py import-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py import-2.6!skip -plugins/modules/iosxr_acl_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospf_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospfv2.py import-2.6!skip -plugins/modules/iosxr_ospfv3.py import-2.6!skip -plugins/modules/iosxr_bgp_neighbor_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_global.py import-2.6!skip -plugins/modules/iosxr_prefix_lists.py import-2.6!skip -plugins/modules/iosxr_logging_global.py import-2.6!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.7!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.8!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.9!skip diff --git a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.12.txt b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.12.txt deleted file mode 100644 index 14952a817..000000000 --- a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.12.txt +++ /dev/null @@ -1,31 +0,0 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py import-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py import-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py import-2.6!skip -plugins/modules/iosxr_acl_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospf_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospfv2.py import-2.6!skip -plugins/modules/iosxr_ospfv3.py import-2.6!skip -plugins/modules/iosxr_bgp_neighbor_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_global.py import-2.6!skip -plugins/modules/iosxr_prefix_lists.py import-2.6!skip -plugins/modules/iosxr_logging_global.py import-2.6!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.8!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.9!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip diff --git a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.13.txt b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.13.txt deleted file mode 100644 index 5d99b9b08..000000000 --- a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.13.txt +++ /dev/null @@ -1,4 +0,0 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.8!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.9!skip -plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip diff --git a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.14.txt b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.14.txt index 63b93ff5a..1e8023a57 100644 --- a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.14.txt +++ b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.14.txt @@ -1,4 +1,4 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.9!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip diff --git a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.15.txt b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.15.txt index 63b93ff5a..1e8023a57 100644 --- a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.15.txt +++ b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.15.txt @@ -1,4 +1,4 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.9!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip diff --git a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.16.txt b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.16.txt index 450f3eab7..6d49e3dcb 100644 --- a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.16.txt +++ b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.16.txt @@ -1,4 +1,4 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.12!skip diff --git a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.17.txt b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.17.txt index 450f3eab7..6d49e3dcb 100644 --- a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.17.txt +++ b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.17.txt @@ -1,4 +1,4 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.12!skip diff --git a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.18.txt b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.18.txt new file mode 100644 index 000000000..6d49e3dcb --- /dev/null +++ b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.18.txt @@ -0,0 +1,4 @@ +plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local` +plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.10!skip +plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.11!skip +plugins/sub_plugins/grpc/pb/ems_grpc_pb2.py import-3.12!skip diff --git a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.9.txt b/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.9.txt deleted file mode 100644 index aab3e8dfc..000000000 --- a/ansible_collections/cisco/iosxr/tests/sanity/ignore-2.9.txt +++ /dev/null @@ -1,30 +0,0 @@ -plugins/action/iosxr.py action-plugin-docs # base class for deprecated network platform modules using `connection: local -plugins/modules/iosxr_logging.py validate-modules:deprecation-mismatch # 2.9 expects METADATA -plugins/modules/iosxr_logging.py validate-modules:invalid-documentation # removed_at_date not supported in `deprecated` dict -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py compile-2.6!skip -plugins/module_utils/network/iosxr/config/acl_interfaces/acl_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospf_interfaces/ospf_interfaces.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv2/ospfv2.py import-2.6!skip -plugins/module_utils/network/iosxr/config/ospfv3/ospfv3.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_address_family/bgp_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_neighbor_address_family/bgp_neighbor_address_family.py import-2.6!skip -plugins/module_utils/network/iosxr/config/bgp_global/bgp_global.py import-2.6!skip -plugins/module_utils/network/iosxr/config/prefix_lists/prefix_lists.py import-2.6!skip -plugins/module_utils/network/iosxr/config/logging_global/logging_global.py import-2.6!skip -plugins/modules/iosxr_acl_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospf_interfaces.py import-2.6!skip -plugins/modules/iosxr_ospfv2.py import-2.6!skip -plugins/modules/iosxr_ospfv3.py import-2.6!skip -plugins/modules/iosxr_bgp_neighbor_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_address_family.py import-2.6!skip -plugins/modules/iosxr_bgp_global.py import-2.6!skip -plugins/modules/iosxr_prefix_lists.py import-2.6!skip -plugins/modules/iosxr_logging_global.py import-2.6!skip diff --git a/ansible_collections/cisco/iosxr/tests/unit/compat/__init__.py b/ansible_collections/cisco/iosxr/tests/unit/compat/__init__.py deleted file mode 100644 index e69de29bb..000000000 --- a/ansible_collections/cisco/iosxr/tests/unit/compat/__init__.py +++ /dev/null diff --git a/ansible_collections/cisco/iosxr/tests/unit/compat/mock.py b/ansible_collections/cisco/iosxr/tests/unit/compat/mock.py deleted file mode 100644 index e4ce72b34..000000000 --- a/ansible_collections/cisco/iosxr/tests/unit/compat/mock.py +++ /dev/null @@ -1,129 +0,0 @@ -# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com> -# -# 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 - -""" -Compat module for Python3.x's unittest.mock module -""" -import sys - -import _io - - -# Python 2.7 - -# Note: Could use the pypi mock library on python3.x as well as python2.x. It -# is the same as the python3 stdlib mock library - -try: - # Allow wildcard import because we really do want to import all of mock's - # symbols into this compat shim - # pylint: disable=wildcard-import,unused-wildcard-import - from unittest.mock import * -except ImportError: - # Python 2 - # pylint: disable=wildcard-import,unused-wildcard-import - try: - from mock import * - except ImportError: - print("You need the mock library installed on python2.x to run tests") - - -# Prior to 3.4.4, mock_open cannot handle binary read_data -if sys.version_info >= (3,) and sys.version_info < (3, 4, 4): - file_spec = None - - def _iterate_read_data(read_data): - # Helper for mock_open: - # Retrieve lines from read_data via a generator so that separate calls to - # readline, read, and readlines are properly interleaved - sep = b"\n" if isinstance(read_data, bytes) else "\n" - data_as_list = [l + sep for l in read_data.split(sep)] - - if data_as_list[-1] == sep: - # If the last line ended in a newline, the list comprehension will have an - # extra entry that's just a newline. Remove this. - data_as_list = data_as_list[:-1] - else: - # If there wasn't an extra newline by itself, then the file being - # emulated doesn't have a newline to end the last line remove the - # newline that our naive format() added - data_as_list[-1] = data_as_list[-1][:-1] - - for line in data_as_list: - yield line - - def mock_open(mock=None, read_data=""): - """ - A helper function to create a mock to replace the use of `open`. It works - for `open` called directly or used as a context manager. - - The `mock` argument is the mock object to configure. If `None` (the - default) then a `MagicMock` will be created for you, with the API limited - to methods or attributes available on standard file handles. - - `read_data` is a string for the `read` methoddline`, and `readlines` of the - file handle to return. This is an empty string by default. - """ - - def _readlines_side_effect(*args, **kwargs): - if handle.readlines.return_value is not None: - return handle.readlines.return_value - return list(_data) - - def _read_side_effect(*args, **kwargs): - if handle.read.return_value is not None: - return handle.read.return_value - return type(read_data)().join(_data) - - def _readline_side_effect(): - if handle.readline.return_value is not None: - while True: - yield handle.readline.return_value - for line in _data: - yield line - - global file_spec - if file_spec is None: - file_spec = list( - set(dir(_io.TextIOWrapper)).union(set(dir(_io.BytesIO))), - ) - - if mock is None: - mock = MagicMock(name="open", spec=open) - - handle = MagicMock(spec=file_spec) - handle.__enter__.return_value = handle - - _data = _iterate_read_data(read_data) - - handle.write.return_value = None - handle.read.return_value = None - handle.readline.return_value = None - handle.readlines.return_value = None - - handle.read.side_effect = _read_side_effect - handle.readline.side_effect = _readline_side_effect() - handle.readlines.side_effect = _readlines_side_effect - - mock.return_value = handle - return mock diff --git a/ansible_collections/cisco/iosxr/tests/unit/compat/unittest.py b/ansible_collections/cisco/iosxr/tests/unit/compat/unittest.py deleted file mode 100644 index df4266ec9..000000000 --- a/ansible_collections/cisco/iosxr/tests/unit/compat/unittest.py +++ /dev/null @@ -1,41 +0,0 @@ -# (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com> -# -# 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 - -""" -Compat module for Python2.7's unittest module -""" - -import sys - - -# Allow wildcard import because we really do want to import all of -# unittests's symbols into this compat shim -# pylint: disable=wildcard-import,unused-wildcard-import -if sys.version_info < (2, 7): - try: - # Need unittest2 on python2.6 - from unittest2 import * - except ImportError: - print("You need unittest2 installed on python2.6.x to run tests") -else: - from unittest import * diff --git a/ansible_collections/cisco/iosxr/tests/unit/mock/path.py b/ansible_collections/cisco/iosxr/tests/unit/mock/path.py index 0c87896da..7d287a5fb 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/mock/path.py +++ b/ansible_collections/cisco/iosxr/tests/unit/mock/path.py @@ -2,9 +2,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -from ansible.utils.path import unfrackpath +from unittest.mock import MagicMock -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import MagicMock +from ansible.utils.path import unfrackpath mock_unfrackpath_noop = MagicMock( diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_cdp b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_cdp new file mode 100644 index 000000000..cd5d89cee --- /dev/null +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_cdp @@ -0,0 +1,4 @@ +Global CDP information: + Sending CDP packets every 60 seconds + Sending a holdtime value of 30 seconds + Sending CDPv2 advertisements is not enabled diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_cdp_neighbors_detail b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_cdp_neighbors_detail new file mode 100644 index 000000000..f1ab85923 --- /dev/null +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/fixtures/show_cdp_neighbors_detail @@ -0,0 +1,16 @@ +------------------------- +Device ID: device2.cisco.com +Entry address(es): + IP address: 171.68.162.134 +Platform: cisco 4500, Capabilities: Router +Interface: Ethernet0/1, Port ID (outgoing port): Ethernet0 +Holdtime : 156 sec + +Version : +Cisco Internetwork Operating System Software +IOS (tm) 4500 Software (C4500-J-M), Version 11.1(10.4), MAINTENANCE INTERIM SOFTWARE +Copyright (c) 1986-1997 by Cisco Systems, Inc. +Compiled Mon 07-Apr-97 19:51 by dschwart + + +Total cdp entries displayed : 1 diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_hostname.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_hostname.py index 7c676530b..9eda36615 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_hostname.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_hostname.py @@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_hostname -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr.py index af2fd3a5c..32eb85797 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr.py @@ -22,15 +22,15 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from os import path +from unittest import TestCase from ansible.module_utils._text import to_bytes, to_text from mock import MagicMock from ansible_collections.cisco.iosxr.plugins.cliconf import iosxr -from ansible_collections.cisco.iosxr.tests.unit.compat import unittest -class TestPluginCLIConfIOSXR(unittest.TestCase): +class TestPluginCLIConfIOSXR(TestCase): """Test class for IOSXR CLI Conf Methods""" def setUp(self): diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acl_interfaces.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acl_interfaces.py index 8500c0733..0c29c6c13 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acl_interfaces.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acl_interfaces.py @@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_acl_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acls.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acls.py index 181b239d8..d301bda7b 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acls.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_acls.py @@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_acls -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_banner.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_banner.py index 5dcbada13..32085d51e 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_banner.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_banner.py @@ -38,9 +38,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_banner -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_address_family.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_address_family.py index 57770b59d..ce8d12c95 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_address_family.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_address_family.py @@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_bgp_address_family -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_global.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_global.py index 901b5b4d8..6527fb48d 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_global.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_global.py @@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_bgp_global -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_neighbor_address_family.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_neighbor_address_family.py index d6fd0610d..6714adee8 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_neighbor_address_family.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_neighbor_address_family.py @@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_bgp_neighbor_address_family -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py index 4efc04503..58cec9977 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_bgp_templates.py @@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_bgp_templates -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule @@ -239,6 +239,22 @@ class TestIosxrBgptemplatesModule(TestIosxrModule): safi="unicast", advertise=dict(local_labeled_route=dict(set=True)), ), + dict( + afi="vpnv4", + safi="unicast", + ), + dict( + afi="vpnv6", + safi="unicast", + ), + dict( + afi="link-state", + safi="link-state", + ), + dict( + afi="l2vpn", + safi="evpn", + ), ], ), dict( @@ -324,6 +340,10 @@ class TestIosxrBgptemplatesModule(TestIosxrModule): "bfd fast-detect strict-mode", "internal-vpn-client", "precedence critical", + "address-family vpnv4 unicast", + "address-family vpnv6 unicast", + "address-family link-state link-state", + "address-family l2vpn evpn", "address-family ipv4 unicast", "advertise local-labeled-route", "neighbor-group test1", @@ -1128,6 +1148,14 @@ class TestIosxrBgptemplatesModule(TestIosxrModule): precedence critical advertisement-interval 10 internal-vpn-client + address-family vpnv4 unicast + ! + address-family vpnv6 unicast + ! + address-family link-state link-state + ! + address-family l2vpn evpn + ! address-family ipv4 unicast advertise local-labeled-route ! @@ -1199,6 +1227,10 @@ class TestIosxrBgptemplatesModule(TestIosxrModule): "advertisement_interval": 10, "internal_vpn_client": True, "address_family": [ + {"afi": "vpnv4", "safi": "unicast"}, + {"afi": "vpnv6", "safi": "unicast"}, + {"afi": "link-state", "safi": "link-state"}, + {"afi": "l2vpn", "safi": "evpn"}, { "afi": "ipv4", "safi": "unicast", diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_command.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_command.py index cd691d6c4..b3787e600 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_command.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_command.py @@ -21,8 +21,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_command -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_config.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_config.py index 9ac6866af..dffd4b4c9 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_config.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_config.py @@ -21,10 +21,10 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import MagicMock, patch from ansible_collections.cisco.iosxr.plugins.cliconf.iosxr import Cliconf from ansible_collections.cisco.iosxr.plugins.modules import iosxr_config -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import MagicMock, patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_facts.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_facts.py index da7d597ae..6c0e02e0f 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_facts.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_facts.py @@ -23,8 +23,9 @@ __metaclass__ = type import json +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_facts -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture @@ -131,3 +132,19 @@ class TestIosxrFacts(TestIosxrModule): ansible_facts["ansible_net_cpu_utilization"], cpu_utilization_data, ) + + def test_iosxr_facts_neighbors(self): + set_module_args(dict(gather_subset="interfaces")) + result = self.execute_module() + ansible_facts = result["ansible_facts"]["ansible_net_neighbors"] + expected_neighbors = { + "Ethernet0/1": [ + { + "host": "device2.cisco.com", + "platform": "cisco 4500", + "port": "Ethernet0", + "ip": "171.68.162.134", + }, + ], + } + self.assertCountEqual(ansible_facts.keys(), expected_neighbors.keys()) diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py index bff925c60..15a8de4e5 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_interfaces.py @@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_l2_interfaces.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_l2_interfaces.py index f28561777..9bef80c39 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_l2_interfaces.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_l2_interfaces.py @@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_l2_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py index 071b16b8f..14b5a1e51 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_l3_interfaces.py @@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_l3_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lacp.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lacp.py index 23c4b8cd9..09e7fa8ec 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lacp.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lacp.py @@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_lacp -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lacp_interfaces.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lacp_interfaces.py index 55358a061..d6bb57c40 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lacp_interfaces.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lacp_interfaces.py @@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_lacp_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lag_interfaces.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lag_interfaces.py index b0d68fc62..032539115 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lag_interfaces.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lag_interfaces.py @@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_lag_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lldp_global.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lldp_global.py index 4830058df..d2b74103b 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lldp_global.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lldp_global.py @@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_lldp_global -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lldp_interfaces.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lldp_interfaces.py index 78b6d79f0..889eb8e57 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lldp_interfaces.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_lldp_interfaces.py @@ -22,8 +22,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_lldp_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_logging_global.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_logging_global.py index bffee2b17..205740f19 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_logging_global.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_logging_global.py @@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_logging_global -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_n540.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_n540.py index d2820cfa1..e7ec26877 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_n540.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_n540.py @@ -22,15 +22,15 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from os import path +from unittest import TestCase from ansible.module_utils._text import to_bytes, to_text from mock import MagicMock from ansible_collections.cisco.iosxr.plugins.cliconf import iosxr -from ansible_collections.cisco.iosxr.tests.unit.compat import unittest -class TestPluginCLIConfIOSXR(unittest.TestCase): +class TestPluginCLIConfIOSXR(TestCase): """Test class for IOSXR CLI Conf Methods""" def setUp(self): diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_netconf.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_netconf.py index 727752948..db1f03449 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_netconf.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_netconf.py @@ -21,8 +21,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_netconf -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ntp_global.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ntp_global.py index 702e2a007..e9e0e66fd 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ntp_global.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ntp_global.py @@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ntp_global -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py index 5b967be00..f5030c703 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospf_interfaces.py @@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ospf_interfaces -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py index b51727dbd..3d4e26298 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv2.py @@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ospfv2 -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py index 23c9d071b..447323e7f 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ospfv3.py @@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ospfv3 -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ping.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ping.py index d0ceda0fb..87ffc4f13 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ping.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_ping.py @@ -9,9 +9,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_ping -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule @@ -135,7 +135,7 @@ class TestIosxrPingModule(TestIosxrModule): } self.assertEqual(result, mock_res) - def test_iosxr_ping_state_absent_pass(self): + def test_iosxr_ping_state_absent_pass_1(self): self.execute_show_command.return_value = dedent( """\ Type escape sequence to abort. diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_prefix_lists.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_prefix_lists.py index 6dca5d920..9c2f895ac 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_prefix_lists.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_prefix_lists.py @@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_prefix_lists -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_snmp_server.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_snmp_server.py index 148625190..eaad485d8 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_snmp_server.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_snmp_server.py @@ -23,9 +23,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type from textwrap import dedent +from unittest.mock import patch from ansible_collections.cisco.iosxr.plugins.modules import iosxr_snmp_server -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py index a185b0c4f..4cce2eb6e 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_static_routes.py @@ -8,8 +8,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_static_routes -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_system.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_system.py index 253725979..973f07066 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_system.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_system.py @@ -21,8 +21,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_system -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_user.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_user.py index 0d783d4cd..0ab53a529 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_user.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_user.py @@ -21,8 +21,9 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type +from unittest.mock import patch + from ansible_collections.cisco.iosxr.plugins.modules import iosxr_user -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch from ansible_collections.cisco.iosxr.tests.unit.modules.utils import set_module_args from .iosxr_module import TestIosxrModule, load_fixture diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_utils.py b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_utils.py index 7707adf41..c63e57030 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_utils.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/network/iosxr/test_iosxr_utils.py @@ -7,11 +7,13 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type + +from unittest import TestCase + from ansible_collections.cisco.iosxr.plugins.module_utils.network.iosxr.utils.utils import Version -from ansible_collections.cisco.iosxr.tests.unit.compat import unittest -class TestIosxrUtils(unittest.TestCase): +class TestIosxrUtils(TestCase): def setUp(self): pass diff --git a/ansible_collections/cisco/iosxr/tests/unit/modules/utils.py b/ansible_collections/cisco/iosxr/tests/unit/modules/utils.py index d63a86922..87be9cf8e 100644 --- a/ansible_collections/cisco/iosxr/tests/unit/modules/utils.py +++ b/ansible_collections/cisco/iosxr/tests/unit/modules/utils.py @@ -4,12 +4,12 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type import json +from unittest import TestCase +from unittest.mock import patch + from ansible.module_utils import basic from ansible.module_utils._text import to_bytes -from ansible_collections.cisco.iosxr.tests.unit.compat import unittest -from ansible_collections.cisco.iosxr.tests.unit.compat.mock import patch - def set_module_args(args): if "_ansible_remote_tmp" not in args: @@ -40,7 +40,7 @@ def fail_json(*args, **kwargs): raise AnsibleFailJson(kwargs) -class ModuleTestCase(unittest.TestCase): +class ModuleTestCase(TestCase): def setUp(self): self.mock_module = patch.multiple( basic.AnsibleModule, |