CiscoDevNet / ansible-nso

GNU General Public License v3.0
9 stars 9 forks source link

nso_action does not handle YANG model choice properly for input #1

Closed gmuloc closed 3 years ago

gmuloc commented 3 years ago

This is in reference to this question that was raised on the NSO developer hub forum: https://community.cisco.com/t5/nso-developer-hub-discussions/using-ansible-quot-nso-action-quot-module-to-invoke-quot-load/m-p/4173500

The following line validates that the input key is a YANG child in the schema of the input container but for a choice this is not correct and the correct input is being rejected: https://github.com/CiscoDevNet/ansible-nso/blob/e6468dd20f3bb79288bbab8c27a8bf16c171ff2f/plugins/modules/nso_action.py#L109

mamullen13316 commented 3 years ago

@gmuloc would you please post the Ansible playbook which returns the error? Thanks.

gmuloc commented 3 years ago

@mamullen13316

- name: Load-Native Config
  hosts: localhost
  connection: local
  gather_facts: no

  tasks:
  - name: Load variables
    include_vars:
      file: nso.yaml
      name: nso

  - name: Load Native Config
    cisco.nso.nso_action:
      url: "{{ nso.url }}"
      username: "{{ nso.username }}"
      password: "{{ nso.password }}"
      path: /ncs:devices/ncs:device{f0}/load-native-config
      input: { file: "test.xml" }

using the same structure as in this repo - https://github.com/NSO-developer/nso-ansible-demo

mamullen13316 commented 3 years ago

Thank you. Can you also provide the contents of "test.xml"?

jabelk commented 3 years ago

@gmuloc thanks!

In order for us to reproduce and fix the erorr, the input file of test.xml will be needed. Thanks for the link to the NSO Ansible demo, but it does not seem to use a load-native-config from an xml file, so we will need a sample payload to reproduce and work from there.

jabelk commented 3 years ago

solved with PR 7