Skip to content

Confirmed commit fails with TypeError in IOS XR netconf plugin (for 2.9.9) #74

Closed
@kmtenhouse

Description

SUMMARY

Hitting a TypeError when attempting to use the confirmed commit capability with the IOX XR netconf plugin (Ansible 2.9.9). (Ansible module seems to want type=int for the timeout operation; underlying ncclient seems to need bytes or unicode.)

ISSUE TYPE
  • Bug Report
COMPONENT NAME

Netconf plugin for IOS XR:
plugins/netconf/iosxr.py

Note: I did see that this code is part of the main Ansible stable-2.9 branch. However, it was recommended that I instead open the issue here, as this will be the ongoing place for this plugin.

ANSIBLE VERSION
ansible 2.9.9
python version = 2.7.5 
CONFIGURATION
(no output was shown)
OS / ENVIRONMENT

Cisco IOS XR

STEPS TO REPRODUCE

Attempt to perform a task with a confirmed commit, ex:

- name: use lookup filter to provide xml configuration to be applied via netconf
connection: netconf
netconf_config:
target: "{{ netconf_target | default('candidate') }}"
error_option: "{{ netconf_error_option | default('rollback-on-error') }}"
commit: yes
confirm: 10
default_operation: "merge"
content: |
<nc:config xmlns="urn:ietf:params:xml:ns:netconf:base:1.0" xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0">
<cdp xmlns="http://cisco.com/ns/yang/Cisco-IOS-XR-cdp-cfg">
<enable>true</enable>
</cdp>
</nc:config>
register: result
vars:
ansible_persistent_log_messages: True
EXPECTED RESULTS

Expected not to receive a type error.

ACTUAL RESULTS

TypeError is received when trying to perform the confirmed commit.

Additionally, setting confirm='10' does not help, although a team mate was able to do the following with Python:
m.commit(confirmed=True, timeout='40', persist='100') succeeds.
m.commit(confirmed=True, timeout=40, persist='100') fails with the same TypeError.

Example error message is below:

  File "/usr/lib/python2.7/site-packages/ansible/utils/jsonrpc.py", line 45, in handle_request
    result = rpc_method(*args, **kwargs)
  File "/usr/lib/python2.7/site-packages/ansible/plugins/netconf/iosxr.py", line 185, in commit
    resp = self.m.commit(confirmed=confirmed, timeout=timeout, persist=persist)
  File "/usr/lib/python2.7/site-packages/ncclient/manager.py", line 231, in execute
    huge_tree=self._huge_tree).request(*args, **kwds)
  File "/usr/lib/python2.7/site-packages/ncclient/operations/edit.py", line 158, in request
    sub_ele(node, "confirm-timeout").text = timeout
  File "src/lxml/etree.pyx", line 1024, in lxml.etree._Element.text.__set__
  File "src/lxml/apihelpers.pxi", line 747, in lxml.etree._setNodeText
  File "src/lxml/apihelpers.pxi", line 735, in lxml.etree._createTextNode
  File "src/lxml/apihelpers.pxi", line 1538, in lxml.etree._utf8
TypeError: Argument must be bytes or unicode, got 'int'

Activity

ikhan2010

ikhan2010 commented on Aug 15, 2020

@ikhan2010
Member

Thanks for raising the issue. cc @trishnaguha @ganeshrn
We will backport this bugfix to 2.9 stable branch.

ganeshrn

ganeshrn commented on Aug 15, 2020

@ganeshrn
Member

@kmtenhouse Please check if PR ansible/ansible#71291 (on stable-2.9) fixes the issue.

Also raised PR on 2.10 and individual collections
stable-2.10: ansible/ansible#71292
cisco.iosxr: #76
ansible.netcommon: ansible-collections/ansible.netcommon#124 (testcase only)

self-assigned this
on Aug 15, 2020
kmtenhouse

kmtenhouse commented on Aug 17, 2020

@kmtenhouse
Author

Wow, thank you so much for your prompt response! We will check and let you know.

2 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions

    Confirmed commit fails with TypeError in IOS XR netconf plugin (for 2.9.9) · Issue #74 · ansible-collections/cisco.iosxr