I'm working Netconf-Yang for the first time on an IOS-XE device (Cat 9k, 16.8.1r) and I'm sending the following XML block to change an interface description.
I'm using ansible netconf_config with these parameters:
- name: netconf playbook
hosts: switch1
vars:
ansible_connection: netconf
ansible_port: 830
outfile: yang-config.xml
tasks:
- name: Changing interfaces description
netconf_config:
lock: if-supported
error_option: rollback-on-error
default_operation: "merge"
commit: yes
content: "{{ lookup('file', outfile) }}"
register: result
- debug:
var: result
Contents of outfile: >>>
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>GigabitEthernet1/1/1</name>
<description>netconf-test1</description>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
</interface>
</interfaces>
</config>
I then get the following errors. I've ruled out authentication problems. It's not the username or password, it's not an ACL on the switch. It has to be something wrong with the model, somehow. I've validated it with pyang2dsdl but it just tells me "config" should be "data".
TASK [Changing interfaces description] *********************************************************************************************************************************************************
The full traceback is:
File "/tmp/ansible_netconf_config_payload_jx0san85/ansible_netconf_config_payload.zip/ansible/modules/network/netconf/netconf_config.py", line 401, in main
File "/tmp/ansible_netconf_config_payload_jx0san85/ansible_netconf_config_payload.zip/ansible/module_utils/connection.py", line 185, in __rpc__
raise ConnectionError(to_text(msg, errors='surrogate_then_replace'), code=code)
fatal: [switch1]: FAILED! => changed=false
invocation:
module_args:
backup: false
backup_options: null
commit: true
confirm: 0
confirm_commit: false
content: |-
<config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<interfaces xmlns="urn:ietf:params:xml:ns:yang:ietf-interfaces">
<interface>
<name>GigabitEthernet1/1/1</name>
<description>netconf-test1</description>
<type xmlns:ianaift="urn:ietf:params:xml:ns:yang:iana-if-type">ianaift:ethernetCsmacd</type>
</interface>
</interfaces>
</config>
default_operation: merge
delete: false
error_option: rollback-on-error
format: xml
host: null
hostkey_verify: true
lock: always
look_for_keys: true
password: null
port: 830
save: false
source_datastore: null
src: null
ssh_keyfile: null
target: auto
timeout: 10
username: null
validate: false
msg: |-
error: /oc-stp:stp/rapid-pvst/vlan: badarg
error: /oc-sys:system/ntp/config/ntp-source-interface: badarg
error: /oc-sys:system/aaa/authentication/config/authentication-method: {case_clause,<<"tacgroup">>}
I haven't been able to find anything about this error. Thanks for your help.