05-15-2018 12:49 AM
Hi ALL
I am new to the netconf Yang interface and I trying to configure a ASR9010 (5.3.4) via Netconf Yang interface.
I manage to get pass the initial Hello Messages but I get the following error when I try to enable something Simple like YANG cdp
NETFONF commands sent
</hello>
]]>]]>
<rpc message-id="101" xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
NETCONF- YANG DEBUGS
RP/0/RSP1/CPU0:May 15 07:21:03.931 : netconf[1124]: TRC: NC: Hello message validation success
RP/0/RSP1/CPU0:May 15 07:21:29.517 : netconf_sshd_proxy[65900]: TRC: NC: SSH PIPE INPUT cond: 0x1, fd 25, ctx 50003460
RP/0/RSP1/CPU0:May 15 07:21:29.517 : netconf_sshd_proxy[65900]: TRC: NC: CLIENT read: 71
RP/0/RSP1/CPU0:May 15 07:21:29.518 : netconf_sshd_proxy[65900]: TRC: NC: CLIENT->SERVER 71
RP/0/RSP1/CPU0:May 15 07:21:29.518 : netconf[1124]: ERR: NC: Expected byte 35, received 60
RP/0/RSP1/CPU0:May 15 07:21:29.518 : netconf[1124]: ERR: NC: Failed to extract frame from input buffer
I then Get kicked off the NEFCONF SSH Session
05-17-2018 08:22 AM
It looks like you are trying to communicate over NETCONF by hand crafting and sending XML RPC over SSH, I'd highly recommend against that, particularly when getting started with Model Drive Programmabiliyt. Using a library like ncclient (Python NETCONF Client) or ydk are much better strategies as the libraries handle all the transport details and allow you to focus on the actual data model details and your goals.
You can get the basics of NCCLIENT in the labs in this module: Introduction to Model Driven Programmability (ex: NETCONF/YANG)
And read about YDK at http://developer.cisco.com/site/ydk
05-18-2018 05:53 AM
Ashwin,
The ASR9K only supports netconf chunked encoding after the initial hello message. See RFC 6242, specifically:
https://tools.ietf.org/html/rfc6242#section-4.2
What you have above is not a valid payload for the ASR9K (or any IOS-XR platform). Chunked encoding requires the chunk size to be encoded at the start of the chunk, which you have not done above, and when chunked encoding is used, if you violate the format then the session should be terminated (as it is).
I agree with what Hank says in terms of using a library to support what you're doing. Take a look at https://github.com/CiscoDevNet/ncc for some example of using the library Hank mentioned, ncclient. You can also pip install ncc:
pip install ncc
...and the ncc script itself supports a flag --verbose that will show you all the encoding details of an interaction if you are interested in diving down into encoding details.
Cheers,
Einar
Discover and save your favorite ideas. Come back to expert answers, step-by-step guides, recent topics, and more.
New here? Get started with these tips. How to use Community New member guide