Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ce_bfd_session: update & add 2 params. #59333

Merged
merged 3 commits into from
Jul 23, 2019
Merged

ce_bfd_session: update & add 2 params. #59333

merged 3 commits into from
Jul 23, 2019

Conversation

yuandongx
Copy link
Contributor

@yuandongx yuandongx commented Jul 20, 2019

SUMMARY

ce_bfd_session: update & add 2 params.

ISSUE TYPE
  • Bugfix Pull Request
COMPONENT NAME

lib/ansible/modules/network/cloudengine/ce_bfd_session.py

ADDITIONAL INFORMATION

Before

---
- name: test
  gather_facts: no
  hosts: switch6
  tasks:
  - name: "Step1.1.1 test the correct session_name"  
    ce_bfd_session:
      session_name: bfd_multi_2
      dest_addr: 10.1.1.1

Error log

fatal: [10.190.121.125]: FAILED! => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": false,
    "module_stderr": "/tmp/ansible_ce_bfd_session_payload_lPeNb7/__main__.py:347: FutureWarning: The behavior of this method will change in future versions.  Use specific 'len(elem)' or 'elem is not None' test instead.\n  if glb:\nTraceback (most recent call last):\n  File \"/root/.ansible/tmp/ansible-tmp-1561079949.39-143866297285102/AnsiballZ_ce_bfd_session.py\", line 125, in <module>\n    _ansiballz_main()\n  File \"/root/.ansible/tmp/ansible-tmp-1561079949.39-143866297285102/AnsiballZ_ce_bfd_session.py\", line 117, in _ansiballz_main\n    invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n  File \"/root/.ansible/tmp/ansible-tmp-1561079949.39-143866297285102/AnsiballZ_ce_bfd_session.py\", line 54, in invoke_module\n    imp.load_module('__main__', mod, module, MOD_DESC)\n  File \"/tmp/ansible_ce_bfd_session_payload_lPeNb7/__main__.py\", line 607, in <module>\n  File \"/tmp/ansible_ce_bfd_session_payload_lPeNb7/__main__.py\", line 603, in main\n  File \"/tmp/ansible_ce_bfd_session_payload_lPeNb7/__main__.py\", line 570, in work\n  File \"/tmp/ansible_ce_bfd_session_payload_lPeNb7/__main__.py\", line 484, in netconf_load_config\n  File \"/tmp/ansible_ce_bfd_session_payload_lPeNb7/ansible_ce_bfd_session_payload.zip/ansible/module_utils/network/cloudengine/ce.py\", line 339, in set_nc_config\n  File \"/tmp/ansible_ce_bfd_session_payload_lPeNb7/ansible_ce_bfd_session_payload.zip/ansible/module_utils/network/common/netconf.py\", line 76, in __rpc__\n  File \"/tmp/ansible_ce_bfd_session_payload_lPeNb7/ansible_ce_bfd_session_payload.zip/ansible/module_utils/network/common/netconf.py\", line 105, in parse_rpc_error\nansible.module_utils.connection.ConnectionError: <?xml version=\"1.0\" encoding=\"UTF-8\"?><rpc-error xmlns=\"urn:ietf:params:xml:ns:netconf:base:1.0\">\n    <error-type>application</error-type>\n    <error-tag>invalid-value</error-tag>\n    <error-severity>error</error-severity>\n    <error-app-tag>31608</error-app-tag>\n    <error-message>The local and remote discriminators must be configured for the current session type.</error-message>\n    <error-info>\n      <bfd xmlns=\"http://www.huawei.com/netconf/vrp\" format-version=\"1.0\" content-version=\"1.0\">\n        <bfdCfgSessions>\n          <bfdCfgSession>\n            <sessName>bfd_multi_2</sessName>\n            <createType>SESS_STATIC</createType>\n            <linkType>IP</linkType>\n            <addrType>IPV4</addrType>\n            <destAddr>10.1.1.1</destAddr>\n          </bfdCfgSession>\n        </bfdCfgSessions>\n      </bfd>\n    </error-info>\n  </rpc-error>\n\n",
    "module_stdout": "",
    "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error",
    "rc": 1
}

PLAY RECAP **************************************************************************************
10.190.121.125             : ok=0    changed=0    unreachable=0    failed=1    skipped=0    rescued=0    ignored=0

```
## debug
```
localDiscr and  remoteDiscr is required when  createType   is set as SESS_STATIC;
---

- name: test
  gather_facts: no
  hosts: switch6
  tasks:
  - name: "Step1.1.1 test the correct session_name"  
    ce_bfd_session:
      session_name: bfd_multi_2
      dest_addr: 10.11.11.11
      local_discr: 2
      remote_discr: 2
      state: present

```
Test log after modify
```
changed: [10.190.121.125] => {
    "ansible_facts": {
        "discovered_interpreter_python": "/usr/bin/python"
    },
    "changed": true,
    "end_state": {
        "session": {
            "addrType": "IPV4",
            "createType": "SESS_STATIC",
            "destAddr": "10.11.11.11",
            "localDiscr": "2",
            "outIfName": null,
            "remoteDiscr": "2",
            "sessName": "bfd_multi_2",
            "srcAddr": null,
            "useDefaultIp": "false",
            "vrfName": null
        }
    },
    "existing": {
        "session": {}
    },
    "invocation": {
        "module_args": {
            "addr_type": null,
            "create_type": "static",
            "dest_addr": "10.11.11.11",
            "host": "10.190.121.125",
            "local_discr": 2,
            "out_if_name": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 10111,
            "provider": {
                "host": "10.190.121.125",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "port": 10111,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "cli",
                "use_ssl": null,
                "username": "huawei",
                "validate_certs": null
            },
            "remote_discr": 2,
            "session_name": "bfd_multi_2",
            "src_addr": null,
            "ssh_keyfile": null,
            "state": "present",
            "timeout": null,
            "transport": "cli",
            "use_default_ip": false,
            "use_ssl": null,
            "username": "huawei",
            "validate_certs": null,
            "vrf_name": null
        }
    },
    "proposed": {
        "addr_type": null,
        "create_type": "static",
        "dest_addr": "10.11.11.11",
        "local_discr": 2,
        "out_if_name": null,
        "remote_discr": 2,
        "session_name": "bfd_multi_2",
        "src_addr": null,
        "state": "present",
        "use_default_ip": false,
        "vrf_name": null
    },
    "updates": [
        "bfd bfd_multi_2 bind peer-ip 10.11.11.11",
        "discriminator local 2",
        "discriminator remote 2"
    ]
}
```

@ansibot
Copy link
Contributor

ansibot commented Jul 20, 2019

The test ansible-test sanity --test ansible-doc --python 2.6 [explain] failed with the error:

Command "ansible-doc -t module ce_bfd_session" returned exit status 1.
>>> Standard Error
ERROR! module ce_bfd_session missing documentation (or could not parse documentation): while scanning for the next token
found character that cannot start any token
  in "<byte string>", line 35, column 1

The test ansible-test sanity --test ansible-doc --python 2.7 [explain] failed with the error:

Command "ansible-doc -t module ce_bfd_session" returned exit status 1.
>>> Standard Error
ERROR! module ce_bfd_session missing documentation (or could not parse documentation): while scanning for the next token
found character that cannot start any token
  in "<byte string>", line 35, column 1

The test ansible-test sanity --test ansible-doc --python 3.5 [explain] failed with the error:

Command "ansible-doc -t module ce_bfd_session" returned exit status 1.
>>> Standard Error
ERROR! module ce_bfd_session missing documentation (or could not parse documentation): while scanning for the next token
found character that cannot start any token
  in "<unicode string>", line 35, column 1

The test ansible-test sanity --test ansible-doc --python 3.6 [explain] failed with the error:

Command "ansible-doc -t module ce_bfd_session" returned exit status 1.
>>> Standard Error
ERROR! module ce_bfd_session missing documentation (or could not parse documentation): while scanning for the next token
found character that cannot start any token
  in "<unicode string>", line 35, column 1

The test ansible-test sanity --test ansible-doc --python 3.7 [explain] failed with the error:

Command "ansible-doc -t module ce_bfd_session" returned exit status 1.
>>> Standard Error
ERROR! module ce_bfd_session missing documentation (or could not parse documentation): while scanning for the next token
found character that cannot start any token
  in "<unicode string>", line 35, column 1

The test ansible-test sanity --test ansible-doc --python 3.8 [explain] failed with the error:

Command "ansible-doc -t module ce_bfd_session" returned exit status 1.
>>> Standard Error
ERROR! module ce_bfd_session missing documentation (or could not parse documentation): while scanning for the next token
found character that cannot start any token
  in "<unicode string>", line 35, column 1

The test ansible-test sanity --test docs-build [explain] failed with the error:

Command "/usr/bin/python3.6 /root/ansible/test/sanity/code-smell/docs-build.py" returned exit status 1.
>>> Standard Error
Command 'make singlehtmldocs' failed with status code: 2
--> Standard Output
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-config --template-file=../templates/config.rst.j2 --output-dir=rst/reference_appendices/ ../../lib/ansible/config/base.yml
mkdir -p rst/cli
PYTHONPATH=../../lib ../../hacking/build-ansible.py generate-man --template-file=../templates/cli_rst.j2 --output-dir=rst/cli/ --output-format rst ../../lib/ansible/cli/*.py
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-keywords --template-dir=../templates --output-dir=rst/reference_appendices/ ./keyword_desc.yml
PYTHONPATH=../../lib ../../hacking/build-ansible.py document-plugins -t rst --template-dir=../templates --module-dir=../../lib/ansible/modules -o rst/modules/ 
Evaluating module files...
Makefile:93: recipe for target 'modules' failed
--> Standard Error
Traceback (most recent call last):
  File "../../hacking/build-ansible.py", line 88, in <module>
    main()
  File "../../hacking/build-ansible.py", line 79, in main
    retval = command.main(args)
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py", line 775, in main
    plugin_info, categories = get_plugin_info(args.module_dir, limit_to=args.limit_to, verbose=(args.verbosity > 0))
  File "/root/ansible/hacking/build_library/build_ansible/command_plugins/plugin_formatter.py", line 302, in get_plugin_info
    doc, examples, returndocs, metadata = plugin_docs.get_docstring(module_path, fragment_loader, verbose=verbose)
  File "/root/ansible/lib/ansible/utils/plugin_docs.py", line 111, in get_docstring
    data = read_docstring(filename, verbose=verbose, ignore_errors=ignore_errors)
  File "/root/ansible/lib/ansible/parsing/plugin_docs.py", line 59, in read_docstring
    data[varkey] = AnsibleLoader(child.value.s, file_name=filename).get_single_data()
  File "/usr/local/lib/python3.6/dist-packages/yaml/constructor.py", line 41, in get_single_data
    node = self.get_single_node()
  File "ext/_yaml.pyx", line 707, in _yaml.CParser.get_single_node
  File "ext/_yaml.pyx", line 725, in _yaml.CParser._compose_document
  File "ext/_yaml.pyx", line 776, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node
  File "ext/_yaml.pyx", line 776, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 890, in _yaml.CParser._compose_mapping_node
  File "ext/_yaml.pyx", line 732, in _yaml.CParser._compose_node
  File "ext/_yaml.pyx", line 905, in _yaml.CParser._parse_next_event
yaml.scanner.ScannerError: while scanning for the next token
found character that cannot start any token
  in "<unicode string>", line 35, column 1
make: *** [modules] Error 1

The test ansible-test sanity --test pep8 [explain] failed with 6 errors:

lib/ansible/modules/network/cloudengine/ce_bfd_session.py:57:1: E101 indentation contains mixed spaces and tabs
lib/ansible/modules/network/cloudengine/ce_bfd_session.py:57:1: W191 indentation contains tabs
lib/ansible/modules/network/cloudengine/ce_bfd_session.py:58:1: E101 indentation contains mixed spaces and tabs
lib/ansible/modules/network/cloudengine/ce_bfd_session.py:61:1: E101 indentation contains mixed spaces and tabs
lib/ansible/modules/network/cloudengine/ce_bfd_session.py:61:1: W191 indentation contains tabs
lib/ansible/modules/network/cloudengine/ce_bfd_session.py:62:1: E101 indentation contains mixed spaces and tabs

The test ansible-test sanity --test validate-modules [explain] failed with 7 errors:

lib/ansible/modules/network/cloudengine/ce_bfd_session.py:0:0: E324 Argument 'create_type' in argument_spec defines default as ('static') but documentation defines default as (None)
lib/ansible/modules/network/cloudengine/ce_bfd_session.py:0:0: E324 Argument 'state' in argument_spec defines default as ('present') but documentation defines default as (None)
lib/ansible/modules/network/cloudengine/ce_bfd_session.py:0:0: E326 Argument 'addr_type' in argument_spec defines choices as (['ipv4']) but documentation defines choices as ([])
lib/ansible/modules/network/cloudengine/ce_bfd_session.py:0:0: E326 Argument 'create_type' in argument_spec defines choices as (['static', 'auto']) but documentation defines choices as ([])
lib/ansible/modules/network/cloudengine/ce_bfd_session.py:0:0: E326 Argument 'state' in argument_spec defines choices as (['present', 'absent']) but documentation defines choices as ([])
lib/ansible/modules/network/cloudengine/ce_bfd_session.py:57:1: E302 DOCUMENTATION is not valid YAML
test/sanity/validate-modules/ignore.txt:1834:1: A102 Remove since "lib/ansible/modules/network/cloudengine/ce_bfd_session.py" passes "E322" test

The test ansible-test sanity --test yamllint [explain] failed with 1 error:

lib/ansible/modules/network/cloudengine/ce_bfd_session.py:57:1: error DOCUMENTATION: syntax error: found character '\t' that cannot start any token

click here for bot help

@ansibot
Copy link
Contributor

ansibot commented Jul 20, 2019

@ansibot ansibot added affects_2.9 This issue/PR affects Ansible v2.9 bug This issue/PR relates to a bug. module This issue/PR relates to a module. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. needs_triage Needs a first human triage before being processed. networking Network category owner_pr This PR is made by the module's maintainer. python3 support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback. labels Jul 20, 2019
@ansibot
Copy link
Contributor

ansibot commented Jul 20, 2019

The test ansible-test sanity --test validate-modules [explain] failed with 1 error:

lib/ansible/modules/network/cloudengine/ce_bfd_session.py:0:0: E324 Argument 'create_type' in argument_spec defines default as ('static') but documentation defines default as (None)

click here for bot help

@ansibot ansibot added the ci_verified Changes made in this PR are causing tests to fail. label Jul 20, 2019
@ansibot ansibot added community_review In order to be merged, this PR must follow the community review workflow. and removed ci_verified Changes made in this PR are causing tests to fail. needs_revision This PR fails CI tests or a maintainer has requested a review/revision of the PR. labels Jul 20, 2019
@yuandongxx
Copy link
Contributor

shipit

@yuandongx
Copy link
Contributor Author

bot_status

@ansibot ansibot added automerge This PR was automatically merged by ansibot. shipit This PR is ready to be merged by Core and removed community_review In order to be merged, this PR must follow the community review workflow. needs_triage Needs a first human triage before being processed. labels Jul 23, 2019
@ansibot ansibot merged commit b728347 into ansible:devel Jul 23, 2019
@ansible ansible locked and limited conversation to collaborators Aug 21, 2019
@yuandongx yuandongx deleted the bug/ce_bfd_session/20190720 branch September 26, 2019 06:45
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
affects_2.9 This issue/PR affects Ansible v2.9 automerge This PR was automatically merged by ansibot. bug This issue/PR relates to a bug. module This issue/PR relates to a module. networking Network category owner_pr This PR is made by the module's maintainer. python3 shipit This PR is ready to be merged by Core support:community This issue/PR relates to code supported by the Ansible community. traceback This issue/PR includes a traceback.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants