diff --git a/.github/workflows/ansible-test.yml b/.github/workflows/ansible-test.yml index 7a60278..c933349 100644 --- a/.github/workflows/ansible-test.yml +++ b/.github/workflows/ansible-test.yml @@ -12,7 +12,8 @@ jobs: - stable-2.11 - stable-2.12 - stable-2.13 - - devel + - stable-2.14 + - stable-2.15 runs-on: ubuntu-latest steps: @@ -21,10 +22,10 @@ jobs: with: path: ansible_collections/dellemc/os10 - - name: Set up Python 3.8 + - name: Set up Python 3.9 uses: actions/setup-python@v1 with: - python-version: 3.8 + python-version: 3.9 - name: Install ansible-base (${{ matrix.ansible }}) run: pip install https://github.com/ansible/ansible/archive/${{ matrix.ansible }}.tar.gz --disable-pip-version-check @@ -33,4 +34,4 @@ jobs: run: ansible-galaxy collection install ansible.netcommon -p ../../ - name: Run sanity tests - run: ansible-test sanity --docker -v --color --python 3.8 + run: ansible-test sanity --docker -v --color --python 3.9 diff --git a/meta/runtime.yml b/meta/runtime.yml index e211415..d54433e 100644 --- a/meta/runtime.yml +++ b/meta/runtime.yml @@ -1,3 +1,4 @@ +requires_ansible: '>=2.9.10' plugin_routing: action: os10_config: diff --git a/plugins/module_utils/network/os10.py b/plugins/module_utils/network/os10.py index 3597648..0b40166 100644 --- a/plugins/module_utils/network/os10.py +++ b/plugins/module_utils/network/os10.py @@ -32,7 +32,7 @@ from __future__ import (absolute_import, division, print_function) -import re +# import re from ansible.module_utils._text import to_text from ansible.module_utils.basic import env_fallback @@ -56,7 +56,7 @@ 'username': dict(fallback=(env_fallback, ['ANSIBLE_NET_USERNAME'])), 'password': dict(fallback=(env_fallback, ['ANSIBLE_NET_PASSWORD']), no_log=True), 'ssh_keyfile': dict(fallback=(env_fallback, ['ANSIBLE_NET_SSH_KEYFILE']), type='path'), - 'authorize': dict(fallback=(env_fallback, ['ANSIBLE_NET_AUTHORIZE']), type='bool'), + 'authorize': dict(fallback=(env_fallback, ['ANSIBLE_NET_AUTHORIZE']), type='bool', default='false'), 'auth_pass': dict(fallback=(env_fallback, ['ANSIBLE_NET_AUTH_PASS']), no_log=True), 'timeout': dict(type='int'), } diff --git a/plugins/modules/bgp_validate.py b/plugins/modules/bgp_validate.py index 85832c7..3f4ce4d 100644 --- a/plugins/modules/bgp_validate.py +++ b/plugins/modules/bgp_validate.py @@ -21,16 +21,19 @@ description: - show ip bgp summary output type: 'list' + elements: 'dict' required: True show_ip_intf_brief: description: - show ip interface brief output type: 'list' + elements: 'dict' required: True bgp_neighbors: description: - planned neighbours input from group_var to compare actual type: 'list' + elements: 'dict' required: True ''' EXAMPLES = ''' @@ -93,14 +96,17 @@ def get_fields(self): spec_fields = { 'show_ip_bgp': { 'type': 'list', + 'elements': 'dict', 'required': True }, 'show_ip_intf_brief': { 'type': 'list', + 'elements': 'dict', 'required': True }, 'bgp_neighbors': { 'type': 'list', + 'elements': 'dict', 'required': True } } diff --git a/plugins/modules/mtu_validate.py b/plugins/modules/mtu_validate.py index f0a9620..dd39307 100644 --- a/plugins/modules/mtu_validate.py +++ b/plugins/modules/mtu_validate.py @@ -21,16 +21,19 @@ description: - show lldp neighbor output type: 'list' + elements: 'dict' required: True show_system_network_summary: description: - show system network summary output type: 'list' + elements: 'dict' required: True show_ip_intf_brief: description: - show ip intf brief type: 'list' + elements: 'dict' required: True ''' EXAMPLES = ''' @@ -94,14 +97,17 @@ def get_fields(self): spec_fields = { 'show_lldp_neighbors_list': { 'type': 'list', + 'elements': 'dict', 'required': True }, 'show_system_network_summary': { 'type': 'list', + 'elements': 'dict', 'required': True }, 'show_ip_intf_brief': { 'type': 'list', + 'elements': 'dict', 'required': True } } diff --git a/plugins/modules/os10.py b/plugins/modules/os10.py new file mode 100644 index 0000000..317b532 --- /dev/null +++ b/plugins/modules/os10.py @@ -0,0 +1,21 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# 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) +__copyright__ = "(c) 2020 Dell Inc. or its subsidiaries. All rights reserved." +__metaclass__ = type + +DOCUMENTATION = ''' +module: os10 +author: "Senthil Kumar Ganesan (@skg-net)" +short_description: created this file to resolve action plugin has no matching module to provide documentation error. +description: + - solve the action plugin has no matching module to provide documentation error. +''' + +EXAMPLES = ''' +Copy below YAML into a playbook (e.g. play.yml) and run follows: + +#$ ansible-playbook -i inv play.yml +''' diff --git a/plugins/modules/os10_command.py b/plugins/modules/os10_command.py index a99f1a6..a55a69d 100644 --- a/plugins/modules/os10_command.py +++ b/plugins/modules/os10_command.py @@ -36,6 +36,7 @@ module is not returned until the condition is satisfied or the number of retries has expired. type: list + elements: str required: true wait_for: description: @@ -167,7 +168,8 @@ def main(): """ argument_spec = dict( # { command: , prompt: , response: } - commands=dict(type='list', required=True), + # commands=dict(type='list', required=True), + commands=dict(type='list', required=True, elements='str'), wait_for=dict(type='list', elements='str'), match=dict(default='all', choices=['all', 'any']), diff --git a/plugins/modules/os10_config.py b/plugins/modules/os10_config.py index 925568f..fa5e079 100644 --- a/plugins/modules/os10_config.py +++ b/plugins/modules/os10_config.py @@ -34,6 +34,7 @@ command syntax as some commands are automatically modified by the device config parser. This argument is mutually exclusive with I(src). type: list + elements: str aliases: ['commands'] parents: description: @@ -42,6 +43,7 @@ is omitted, the commands are checked against the set of top level or global commands. type: list + elements: str src: description: - Specifies the source path to the file that contains the configuration @@ -58,6 +60,7 @@ any changes without affecting how the set of commands are matched against the system. type: list + elements: str after: description: - The ordered set of commands to append to the end of the command @@ -65,6 +68,7 @@ allows the playbook designer to append a set of commands to be executed after the command set. type: list + elements: str match: description: - Instructs the module on the way to perform the matching of @@ -211,7 +215,7 @@ from ansible_collections.dellemc.os10.plugins.module_utils.network.os10 import get_config, get_sublevel_config from ansible_collections.dellemc.os10.plugins.module_utils.network.os10 import os10_argument_spec, check_args from ansible_collections.dellemc.os10.plugins.module_utils.network.os10 import load_config, run_commands -from ansible_collections.dellemc.os10.plugins.module_utils.network.os10 import WARNING_PROMPTS_RE +# from ansible_collections.dellemc.os10.plugins.module_utils.network.os10 import WARNING_PROMPTS_RE from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.config import NetworkConfig, dumps @@ -245,13 +249,13 @@ def main(): dir_path=dict(type='path') ) argument_spec = dict( - lines=dict(aliases=['commands'], type='list'), - parents=dict(type='list'), + lines=dict(aliases=['commands'], type='list', elements='str'), + parents=dict(type='list', elements='str'), src=dict(type='path'), - before=dict(type='list'), - after=dict(type='list'), + before=dict(type='list', elements='str'), + after=dict(type='list', elements='str'), match=dict(default='line', choices=['line', 'strict', 'exact', 'none']), diff --git a/plugins/modules/os10_facts.py b/plugins/modules/os10_facts.py index a79de60..65897ef 100644 --- a/plugins/modules/os10_facts.py +++ b/plugins/modules/os10_facts.py @@ -35,6 +35,7 @@ with an initial C(!) to specify that a specific subset should not be collected. type: list + elements: str default: [ '!config' ] """ @@ -439,7 +440,8 @@ def main(): """main entry point for module execution """ argument_spec = dict( - gather_subset=dict(default=['!config'], type='list') + # gather_subset=dict(default=['!config'], type='list') + gather_subset=dict(default=['!config'], type='list', elements='str') ) argument_spec.update(os10_argument_spec) diff --git a/plugins/modules/show_system_network_summary.py b/plugins/modules/show_system_network_summary.py index 9922b9f..47bc52d 100644 --- a/plugins/modules/show_system_network_summary.py +++ b/plugins/modules/show_system_network_summary.py @@ -26,6 +26,7 @@ required: False cli_responses: type: list + elements: 'dict' required: True description: - show system command xml output @@ -61,7 +62,7 @@ - debug: var=show_system_network_summary ''' -import re +# import re from ansible_collections.dellemc.os10.plugins.module_utils.network.base_network_show import BaseNetworkShow @@ -76,6 +77,7 @@ def get_fields(self): spec_fields = { 'cli_responses': { 'type': 'list', + 'elements': 'dict', 'required': True }, 'output_type': { diff --git a/plugins/modules/textfsm_parser.py b/plugins/modules/textfsm_parser.py new file mode 100644 index 0000000..498791a --- /dev/null +++ b/plugins/modules/textfsm_parser.py @@ -0,0 +1,21 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +# 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) +__copyright__ = "(c) 2020 Dell Inc. or its subsidiaries. All rights reserved." +__metaclass__ = type + +DOCUMENTATION = ''' +module: textfsm_parser +author: "Senthil Kumar Ganesan (@skg-net)" +short_description: created this file to resolve action plugin has no matching module to provide documentation error. +description: + - solve the action plugin has no matching module to provide documentation error. +''' + +EXAMPLES = ''' +Copy below YAML into a playbook (e.g. play.yml) and run follows: + +#$ ansible-playbook -i inv play.yml +''' diff --git a/plugins/modules/vlt_validate.py b/plugins/modules/vlt_validate.py index 2042dfe..3518d84 100644 --- a/plugins/modules/vlt_validate.py +++ b/plugins/modules/vlt_validate.py @@ -21,16 +21,19 @@ description: - show vlt output type: 'list' + elements: 'dict' required: True show_system_network_summary: description: - show system summary output type: 'list' + elements: 'dict' required: True intended_vlt_pairs: description: - intended vlt pair intput to verify with actual type: 'list' + elements: 'dict' required: True ''' @@ -103,14 +106,17 @@ def get_fields(self): spec_fields = { 'show_vlt': { 'type': 'list', + 'elements': 'dict', 'required': True }, 'show_system_network_summary': { 'type': 'list', + 'elements': 'dict', 'required': True }, 'intended_vlt_pairs': { 'type': 'list', + 'elements': 'dict', 'required': True } } diff --git a/plugins/modules/wiring_validate.py b/plugins/modules/wiring_validate.py index 7947c1b..2f77881 100644 --- a/plugins/modules/wiring_validate.py +++ b/plugins/modules/wiring_validate.py @@ -21,16 +21,19 @@ description: - show lldp neighbor output type: 'list' + elements: 'dict' required: True show_system_network_summary: description: - show system network summary output type: 'list' + elements: 'dict' required: True planned_neighbors: description: - planned neighbours input from group_var to compare actual type: 'list' + elements: 'dict' required: True ''' EXAMPLES = ''' @@ -86,14 +89,17 @@ def get_fields(self): spec_fields = { 'show_lldp_neighbors_list': { 'type': 'list', + 'elements': 'dict', 'required': True }, 'show_system_network_summary': { 'type': 'list', + 'elements': 'dict', 'required': True }, 'planned_neighbors': { 'type': 'list', + 'elements': 'dict', 'required': True } } @@ -212,7 +218,7 @@ def perform_action(self): planned_neighbors["reason"] = reason planned_neighbors["error_type"] = "link-mismatch" break - if(actual_neighbors["dest_port"] != planned_neighbors["dest_port"]): + if (actual_neighbors["dest_port"] != planned_neighbors["dest_port"]): bflag = True reason = ( "Destination switch port is not an expected value, " diff --git a/tests/sanity/ignore-2.10.txt b/tests/sanity/ignore-2.10.txt deleted file mode 100644 index bfed9cf..0000000 --- a/tests/sanity/ignore-2.10.txt +++ /dev/null @@ -1,20 +0,0 @@ -plugins/action/os10.py action-plugin-docs -plugins/action/textfsm_parser.py action-plugin-docs -plugins/modules/bgp_validate.py validate-modules:parameter-list-no-elements -plugins/modules/mtu_validate.py validate-modules:parameter-list-no-elements -plugins/modules/vlt_validate.py validate-modules:parameter-list-no-elements -plugins/modules/wiring_validate.py validate-modules:parameter-list-no-elements -plugins/modules/show_system_network_summary.py validate-modules:parameter-list-no-elements -plugins/modules/os10_config.py validate-modules:parameter-list-no-elements -plugins/modules/os10_facts.py validate-modules:parameter-list-no-elements -plugins/modules/os10_command.py validate-modules:parameter-list-no-elements -plugins/modules/os10_config.py validate-modules:doc-default-does-not-match-spec -plugins/modules/os10_facts.py validate-modules:doc-default-does-not-match-spec -plugins/modules/os10_command.py validate-modules:doc-default-does-not-match-spec -plugins/module_utils/network/base_network_show.py import-2.6 -plugins/modules/base_xml_to_dict.py import-2.6 -plugins/modules/bgp_validate.py import-2.6 -plugins/modules/mtu_validate.py import-2.6 -plugins/modules/show_system_network_summary.py import-2.6 -plugins/modules/vlt_validate.py import-2.6 -plugins/modules/wiring_validate.py import-2.6 diff --git a/tests/sanity/ignore-2.11.txt b/tests/sanity/ignore-2.11.txt deleted file mode 100644 index 16dc721..0000000 --- a/tests/sanity/ignore-2.11.txt +++ /dev/null @@ -1,13 +0,0 @@ -plugins/action/os10.py action-plugin-docs -plugins/action/textfsm_parser.py action-plugin-docs -plugins/modules/bgp_validate.py validate-modules:parameter-list-no-elements -plugins/modules/mtu_validate.py validate-modules:parameter-list-no-elements -plugins/modules/vlt_validate.py validate-modules:parameter-list-no-elements -plugins/modules/wiring_validate.py validate-modules:parameter-list-no-elements -plugins/modules/show_system_network_summary.py validate-modules:parameter-list-no-elements -plugins/modules/os10_config.py validate-modules:parameter-list-no-elements -plugins/modules/os10_facts.py validate-modules:parameter-list-no-elements -plugins/modules/os10_command.py validate-modules:parameter-list-no-elements -plugins/modules/os10_config.py validate-modules:doc-default-does-not-match-spec -plugins/modules/os10_facts.py validate-modules:doc-default-does-not-match-spec -plugins/modules/os10_command.py validate-modules:doc-default-does-not-match-spec diff --git a/tests/sanity/ignore-2.12.txt b/tests/sanity/ignore-2.12.txt deleted file mode 100644 index 16dc721..0000000 --- a/tests/sanity/ignore-2.12.txt +++ /dev/null @@ -1,13 +0,0 @@ -plugins/action/os10.py action-plugin-docs -plugins/action/textfsm_parser.py action-plugin-docs -plugins/modules/bgp_validate.py validate-modules:parameter-list-no-elements -plugins/modules/mtu_validate.py validate-modules:parameter-list-no-elements -plugins/modules/vlt_validate.py validate-modules:parameter-list-no-elements -plugins/modules/wiring_validate.py validate-modules:parameter-list-no-elements -plugins/modules/show_system_network_summary.py validate-modules:parameter-list-no-elements -plugins/modules/os10_config.py validate-modules:parameter-list-no-elements -plugins/modules/os10_facts.py validate-modules:parameter-list-no-elements -plugins/modules/os10_command.py validate-modules:parameter-list-no-elements -plugins/modules/os10_config.py validate-modules:doc-default-does-not-match-spec -plugins/modules/os10_facts.py validate-modules:doc-default-does-not-match-spec -plugins/modules/os10_command.py validate-modules:doc-default-does-not-match-spec diff --git a/tests/sanity/ignore-2.13.txt b/tests/sanity/ignore-2.13.txt deleted file mode 100644 index 16dc721..0000000 --- a/tests/sanity/ignore-2.13.txt +++ /dev/null @@ -1,13 +0,0 @@ -plugins/action/os10.py action-plugin-docs -plugins/action/textfsm_parser.py action-plugin-docs -plugins/modules/bgp_validate.py validate-modules:parameter-list-no-elements -plugins/modules/mtu_validate.py validate-modules:parameter-list-no-elements -plugins/modules/vlt_validate.py validate-modules:parameter-list-no-elements -plugins/modules/wiring_validate.py validate-modules:parameter-list-no-elements -plugins/modules/show_system_network_summary.py validate-modules:parameter-list-no-elements -plugins/modules/os10_config.py validate-modules:parameter-list-no-elements -plugins/modules/os10_facts.py validate-modules:parameter-list-no-elements -plugins/modules/os10_command.py validate-modules:parameter-list-no-elements -plugins/modules/os10_config.py validate-modules:doc-default-does-not-match-spec -plugins/modules/os10_facts.py validate-modules:doc-default-does-not-match-spec -plugins/modules/os10_command.py validate-modules:doc-default-does-not-match-spec diff --git a/tests/sanity/ignore-2.14.txt b/tests/sanity/ignore-2.14.txt deleted file mode 100644 index 16dc721..0000000 --- a/tests/sanity/ignore-2.14.txt +++ /dev/null @@ -1,13 +0,0 @@ -plugins/action/os10.py action-plugin-docs -plugins/action/textfsm_parser.py action-plugin-docs -plugins/modules/bgp_validate.py validate-modules:parameter-list-no-elements -plugins/modules/mtu_validate.py validate-modules:parameter-list-no-elements -plugins/modules/vlt_validate.py validate-modules:parameter-list-no-elements -plugins/modules/wiring_validate.py validate-modules:parameter-list-no-elements -plugins/modules/show_system_network_summary.py validate-modules:parameter-list-no-elements -plugins/modules/os10_config.py validate-modules:parameter-list-no-elements -plugins/modules/os10_facts.py validate-modules:parameter-list-no-elements -plugins/modules/os10_command.py validate-modules:parameter-list-no-elements -plugins/modules/os10_config.py validate-modules:doc-default-does-not-match-spec -plugins/modules/os10_facts.py validate-modules:doc-default-does-not-match-spec -plugins/modules/os10_command.py validate-modules:doc-default-does-not-match-spec diff --git a/tests/sanity/ignore-2.9.txt b/tests/sanity/ignore-2.9.txt deleted file mode 100644 index ee4573d..0000000 --- a/tests/sanity/ignore-2.9.txt +++ /dev/null @@ -1,3 +0,0 @@ -plugins/action/os10.py action-plugin-docs -plugins/action/textfsm_parser.py action-plugin-docs -plugins/modules/show_system_network_summary.py validate-modules:missing-module-utils-import