2

I am trying for basic operations on IOS-XR (Cisco) using Netconf.This includes initially setting up a netconf connection as below: ssh [hostname] -p 830 -s netconf

As soon as, the connection is successsful,the router returns something as shown below(hello)

<?xml version=”1.0″ encoding=”UTF-8″?><hello><capabilities>
<capability>urn:ietf:params:netconf:base:1.0</capability>
<capability>urn:ietf:params:netconf:capability:writeable-running:1.0</capability>
<capability>urn:ietf:params:netconf:capability:startup:1.0</capability>
<capability>urn:ietf:params:netconf:capability:url:1.0</capability>
<capability>urn:cisco:params:netconf:capability:notification:1.0</capability>
</capabilities><session-id>1731357996</session-id></hello>]]>]]

Then i send back a hello to the router as below:

<?xml version=”1.0″ encoding=”UTF-8″?>
<hello>
<capabilities>
    <capability>urn:ietf:params:netconf:base:1.0</capability>
</capabilities>
</hello>]]>]]>

Howver, after this there is no response and if i try to do more operations,the connection gets closed.Can you confirm as to where am i going wrong/why is this happening?

  • I'm guessing you need to advertise more capabilities to the server. It may think you can't do enough. – Ron Trunk Sep 3 '16 at 19:21
  • Did any answer help you? If so, you should accept the answer so that the question doesn't keep popping up forever, looking for an answer. Alternatively, you could provide and accept your own answer. – Ron Maupin Aug 14 '17 at 23:07
3

XR probably wants NETCONF 1.1. If you enable debugging you might find something like this in your log:

RP/0/RSP0/CPU0:Sep  8 09:47:27.513 : netconf[1120]: ERR: NC: Error, Capability urn:ietf:params:netconf:base:1.1 not found
RP/0/RSP0/CPU0:Sep  8 09:47:27.513 : netconf[1120]: ERR: NC: Hello message validation failed
RP/0/RSP0/CPU0:Sep  8 09:47:27.514 : netconf[1120]: ERR: NC: Callback handling decoded data returned error: 'Netconf server' detected the 'warning' condition 'NC_ERRCODE_REQ_INVALID'
RP/0/RSP0/CPU0:Sep  8 09:47:27.514 : netconf[1120]: ERR: NC: Decoding of incoming NETCONF data failed: 'Netconf server' detected the 'warning' condition 'NC_ERRCODE_REQ_INVALID'
RP/0/RSP0/CPU0:Sep  8 09:47:27.514 : netconf[1120]: ERR: NC: Failed to handle SSH IPC message: 'Netconf server' detected the 'warning' condition 'NC_ERRCODE_REQ_INVALID', msg:166df16c, session:200fe198

So put 1.1 support in your hello (I'm also qualifying hello with a namespace):

<?xml version="1.0" encoding="UTF-8"?>
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
    <capabilities>
        <capability>urn:ietf:params:netconf:base:1.0</capability>
        <capability>urn:ietf:params:netconf:base:1.1</capability>
    </capabilities>
</hello>

I would however advise you to use a library for talking NETCONF, like ncclient for Python. The framing format (ending messages with ]]>]]>) used in NETCONF 1.0 is deprecated and a new chunked framing mechanism is introduced in 1.1. You need to know the length of the message so it's much easier using a lib than doing it manually.

Also, looking at the capabilities announced by your XR device you appear to be running a rather old version. 6.0 is available and offers a quite decent set of YANG modules, see http://plajjan.github.io/Cisco-IOS-XR-6-0-and-YANG/

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.