cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
9084
Views
0
Helpful
11
Replies

NETCONF to IOS-XR

Hi all,

I use IOS-XR ver 6.1.2.

After I establish the NETCONF connection to the IOS-XR, I send "Hello Message" as bellows.

But at the moment Hello Message is sent , NETCONF conneciton is disconnected.

Does the hello message have the wrong point?

-------------------------------------------------------------------

root@manager:~# ssh -l <user> <IOS-XR IP> -s netconf
<user>@<IOS-XR IP>'s password:
<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">
 <capabilities>
...
 </capabilities>
 <session-id>1231927858</session-id>
</hello>
]]>]]>
<?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:capability:candidate:1.0
        </capability>
        <capability>
            urn:ietf:params:netconf:capability:notification:1.0
        </capability>
    </capabilities>
</hello>
]]>]]>
root@manager:~#

-------------------------------------------------------------------

Thanks,

1 Accepted Solution

Accepted Solutions

hi rouge,

good news, norio from our development team focussing on netconf whom I had been speaking with on this posted a client to use here:

https://github.com/nnakamot/netconf_client

I have asked him to watch this thread in case you have follow up questions or need more support in case the associated readme doesnt provide for all the answers :)

have a look at this and let us know how it rolls :)

cheers

xander 

View solution in original post

11 Replies 11

xthuijs
Cisco Employee
Cisco Employee

hi rough, yeah I see what is going on, the hello message is not correctly formatted.

I beleive the rfc asks for the capability request to be suggested and closed in the same line for security reasons or so.

The xml/ns designator in your request needs to be omitted also.

Here is a template:

Incorrect:

<?xml version="1.0" encoding="UTF-8"?>

<hello>

   <capabilities>

       <capability>

           urn:ietf:params:xml:ns:netconf:base:1.0

     </capability>

    </capabilities>

</hello>

]]>]]>

Correct:

<?xml version="1.0" encoding="UTF-8"?>

<hello>

  <capabilities>

    <capability>urn:ietf:params:netconf:base:1.0</capability>

  </capabilities>

</hello>]]>]]>

xander

HI xthuijs,

Thank you for response.

According to your advice, I sent the hello message as bellows.

But, NETCONF conneciton is disconnected also.

-------------------------------------------------------------

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

-------------------------------------------------------------

Is there the point wrong elsewhere?

BTW, I use XRv ver 6.1.2.

rouge

hi rouge, hmm, can you share the config that you have for this?

show run | i "xml|netconf|ssh"

do you get an error on the console that says pty read error or something similar?

can you run a query, like this what you did above, and get the 

show netconf-yang trace last 30

this may help to identify what goes wrong.

cheers

xander

Hi xthuijs,

I issue 'show run | i "xml|netconf|ssh"'.

------------------
Building configuration...
xml agent tty
netconf agent tty
netconf-yang agent
 ssh
ssh server v2
------------------

> do you get an error on the console that says pty read error or something similar?
No, when I issue the above hello, no messages is indicated and NETCONF is disconnected.

After I issue the above hello, I see 'show netconf-yang trace last 30"'.
It seems namespace error happens.

------------------
Mar  1 01:36:06.996 netconf-yfw/bk.trace 0/0/CPU0 t1  TRC: me_bk_sysdb_bag_cache_flush:3794 ctx=12016780,Flushing bag cache.
Mar  1 01:36:06.996 netconf-yfw/bk.trace 0/0/CPU0 t1  TRC: me_bk_sysdb_pack_cache_flush:1327 ctx=12016780,Flushing pack cache.
Mar  1 01:36:06.996 netconf-yfw/bk.trace 0/0/CPU0 t1  DBG: sysdb_backend_session_drop:1561 ctx=12016780,SysDB backend session dropped (1343696c).
Mar  1 01:36:06.996 netconf-yfw/processor.trace 0/0/CPU0 t1  TRC: yfw_req_session_stop:502 ctx=1200a8bc,ses=12430a78,op=12,session stop success, removed session-id=2317232025
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_sm_rcv_eom:4326 EOM received, data len: 327
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_sm_rcv_eom:4327 Received data (len:327): '<?xml version="1.0" encoding="UTF-8"?>
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1  <hello>
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1      <capabilities>
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1          <capability>urn:ietf:params:netconf:base:1.0</capability>
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1          <capability>urn:ietf:params:netconf:capability:candidate:1.0</cap
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1  ERR: nc_sm_hello_validate:3028 Error, namespace is NULL, expected: urn:ietf:params:xml:ns:netconf:base:1.0
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1  ERR: nc_sm_rcv_eom:4332 Hello message validation failed
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1  ERR: nc_sm_pxs_readable_msg_handle:5873 Decoding of incoming NETCONF data failed: 'Netconf server' detected the 'warning' condition 'NC_ERRCODE_REQ_INVALID'
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1  ERR: nc_sm_pxs_readable_handle:5934 Failed to handle SSH IPC message: 'Netconf server' detected the 'warning' condition 'NC_ERRCODE_REQ_INVALID', msg:134150fc, session:1342d6ec
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_sm_session_find_session_id:1405 Found session 2317232025 1342d6ec
Mar  1 01:36:06.996 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_sm_session_close:6399 Closing IPC hndl: 1380c404
Mar  1 01:36:06.996 netconf-yfw/map.trace 0/0/CPU0 t1  TRC: yfw_map_transform_request:1314 ctx=1200bb6c,Start
Mar  1 01:36:06.996 netconf-yfw/map.trace 0/0/CPU0 t1  TRC: yfw_map_transform_request:1357 ctx=1200bb6c,Mapping not required for this request.
Mar  1 01:36:06.996 netconf-yfw/me.trace 0/0/CPU0 t1  DBG: me_session_destroy:21608 ctx=1200c204,session destroy ctx=1343d834
Mar  1 01:36:06.996 netconf-yfw/me.trace 0/0/CPU0 t1  DBG: me_session_destroy:21634 ctx=1200c204,Update session info: STOP
------------------

Thank you,
rouge

aha here is a clue:

Error, namespace is NULL, expected: urn:ietf:params:xml:ns:netconf:base:1.0

what happens when you reformat the query to:

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

xander

Hi xthuijs,

I reformat to the above query, and the result dont change.
The message "Error, namespace is NULL, expected: urn:ietf:params:xml:ns:netconf:base:1.0" is shown again.

Mar  2 03:47:37.956 netconf-yfw/processor.trace 0/0/CPU0 t1  TRC: yfw_req_session_stop:502 ctx=1200a8bc,ses=12440504,op=12,session stop success, removed session-id=3541972957
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_sm_rcv_eom:4326 EOM received, data len: 151
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_sm_rcv_eom:4327 Received data (len:151): '<?xml version="1.0" encoding="UTF-8"?>
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  <hello>
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  <capabilities>
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  <capability>urn:ietf:params:xml:ns:netconf:base:1.0</capability>
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  </capabilities>
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  </hello>'
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  ERR: nc_sm_hello_validate:3028 Error, namespace is NULL, expected: urn:ietf:params:xml:ns:netconf:base:1.0
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  ERR: nc_sm_rcv_eom:4332 Hello message validation failed
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  ERR: nc_ssh_decode_cb:573 Callback handling decoded data returned error: 'Netconf server' detected the 'warning' condition 'NC_ERRCODE_REQ_INVALID'
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  ERR: nc_sm_pxs_readable_msg_handle:5873 Decoding of incoming NETCONF data failed: 'Netconf server' detected the 'warning' condition 'NC_ERRCODE_REQ_INVALID'
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  ERR: nc_sm_pxs_readable_handle:5934 Failed to handle SSH IPC message: 'Netconf server' detected the 'warning' condition 'NC_ERRCODE_REQ_INVALID', msg:1343c384, session:1342d6ec
Mar  2 03:47:37.956 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_sm_session_find_session_id:1405 Found session 3541972957 1342d6ec
Mar  2 03:47:37.956 netconf-yfw/me.trace 0/0/CPU0 t1  DBG: me_session_destroy:21608 ctx=1200c204,session destroy ctx=1343d834
Mar  2 03:47:37.956 netconf-yfw/map.trace 0/0/CPU0 t1  TRC: yfw_map_transform_request:1314 ctx=1200bb6c,Start
Mar  2 03:47:37.956 netconf-yfw/map.trace 0/0/CPU0 t1  TRC: yfw_map_transform_request:1357 ctx=1200bb6c,Mapping not required for this request.
Mar  2 03:47:37.966 netconf-yfw/bk.trace 0/0/CPU0 t1  TRC: me_bk_sysdb_bag_cache_flush:3794 ctx=12016780,Flushing bag cache.
Mar  2 03:47:37.966 netconf-yfw/bk.trace 0/0/CPU0 t1  TRC: me_bk_sysdb_pack_cache_flush:1327 ctx=12016780,Flushing pack cache.
Mar  2 03:47:37.966 netconf-yfw/bk.trace 0/0/CPU0 t1  DBG: sysdb_backend_session_drop:1561 ctx=12016780,SysDB backend session dropped (134296d0).
Mar  2 03:47:37.966 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_sm_session_close:6399 Closing IPC hndl: 13834afc
Mar  2 03:47:37.966 netconf-yfw/me.trace 0/0/CPU0 t1  DBG: me_session_destroy:21634 ctx=1200c204,Update session info: STOP
Mar  2 03:47:38.896 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_pxs_ipc_notify_callback_fn:315 IPC_NOTIFY_CLOSE
Mar  2 03:47:38.896 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_sm_pxs_notify_callback_fn:6171 Client 13834afc closed connection
Mar  2 03:47:38.896 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_sm_pxs_notify_callback_fn:6174 Session matching with IPC client handle 13834afc was already removed
Mar  2 03:47:38.896 netconf/netconf.trace 0/0/CPU0 t1  TRC: nc_sm_session_pxs_find:1443 No sessions stored in sessions hashmap

Thanks,

rouge

hi rouge,

I tried a few things also and ran into some issues that I investigated with our netconf dev group. This is the outcome:

Netconf-xml agent : supports only netconf v1.0, MDA schema model based

Netconf-yang agent: supports only netconf v1.1, YANG model based (but YANG generated from MDA schema)

you can find the schema's if you go into the ksh and go cd /pkg/schema and /pkg/yang

A proper hello message to start a session and It would be hard to test netconf manually. There are several tools available to test netconf-yang agent for instance python based. I'll also see if I can share some test tools that we may have here from our dev-test that can be shared.

cheers!

xander

Hi xthuijs,

Oh, we can use two kinds of NETCONF for XR.
I had used Netconf-yang agent, and I understood it is hard to test manually.

I'm waiting you'll share some test-tools.
I also search test-tools python based that can control Netconf-yang.

Thanks,
rouge

hi rouge,

good news, norio from our development team focussing on netconf whom I had been speaking with on this posted a client to use here:

https://github.com/nnakamot/netconf_client

I have asked him to watch this thread in case you have follow up questions or need more support in case the associated readme doesnt provide for all the answers :)

have a look at this and let us know how it rolls :)

cheers

xander 

Hi xthuijs,

I downloaded this tools, and tried to send netconf with this.

As a result, it succeed to connect NETCONF.

I can show running-config, and edit configs with this tool.

I learned how to use in reading the help and using it.

Thank you very much for your help!!

Thanks again,

rouge

ah great rouge!! thanks for letting me know!! have fun :)

cheers!

xander