[CONTROLLER-1219] OpenDaylight cannot read NETCONF messages that do not contain a xmlns attribute Created: 20/Mar/15  Updated: 25/Jul/23  Resolved: 30/Mar/15

Status: Resolved
Project: controller
Component/s: netconf
Affects Version/s: None
Fix Version/s: None

Type: Bug
Reporter: Gwenael Lambrouin Assignee: Gwenael Lambrouin
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified
Environment:

Operating System: All
Platform: All


Attachments: Zip Archive hostname-cisco--2015-03-20.zip    
External issue ID: 2877

 Description   

When OpenDaylight tries to open a NETCONF session with a Cisco router, OpenDaylight generates an error during the reception of the <hello> message coming from the router:

io.netty.handler.codec.DecoderException: java.lang.IllegalStateException: Hello message not received, instead received: <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:pi-data-model:1.0</capability>
<capability>urn:cisco:params:netconf:capability:notification:1.0</capability>
</capabilities>
<session-id>1409770544</session-id>
</hello>

Consequently, the NETCONF session fails to open.

This has been observed with the follwoing Cisco equipments and IOS versions:

  • CSR1000V (virtual routeur) with IOS 15.4(1)S
  • ASR1001-X with IOS 15.4(2)S0a
  • ISR2900 with IOS 15.1(4)M1

Attached is a test program that can be used to reproduce the problem with a Cisco router.

Some investigations in OpenDaylight NETCONF code show that the failure is due to the lack of xmlns attribute in the <hello> message sent by the router. OpenDaylight expects something like:

<hello xmlns="urn:ietf:params:xml:ns:netconf:base:1.0">

Whether the NETCONF RFC mandates the presence of the xmlns attribute is unclear to me. So I don't know if this is a bug in OpenDaylight or a bug in Cisco routers. Anyway, it can be fixed (or worked around depending on the point of view) in OpenDaylight, and I will propose a patch to do this.



 Comments   
Comment by Gwenael Lambrouin [ 20/Mar/15 ]

Attachment hostname-cisco--2015-03-20.zip has been added with description: Test program to reproduce the problem

Comment by Maros Marsalek [ 20/Mar/15 ]

This was discussed in https://ask.opendaylight.org/question/1206/illegalstateexception-on-netconf-hello-message/

There is a pointer to a class in ODL where the hello validation is performed.

Reading RFC 6241: Hello message example contains the namespace declaration and the xsd schema for netconf base elements contains the hello element. So Id say hello should contain the namespace, but it would do no harm making the validation less strict in ODL.

Comment by Gwenael Lambrouin [ 20/Mar/15 ]

Actually, just removing the namespace test in the method isHelloMessage(Document) of the class https://github.com/opendaylight/controller/blob/master/opendaylight/netconf/netconf-util/src/main/java/org/opendaylight/controller/netconf/util/messages/NetconfHelloMessage.java is not enough.

If we do this, ODL fails later in the method extractSessionId() of the class https://github.com/opendaylight/controller/blob/master/opendaylight/netconf/netconf-client/src/main/java/org/opendaylight/controller/netconf/client/NetconfClientSessionNegotiator.java.

I found a solution, but it is a bit heavy: add the namespace to hello messages when it is missing. I submitted my patch for review here:
https://git.opendaylight.org/gerrit/#/c/16926/

Comment by Maros Marsalek [ 23/Mar/15 ]

Please take bugs if you work on them (so we can keep track of the bugs). I assigned it to you for you this time. Thanks

Generated at Wed Feb 07 19:54:58 UTC 2024 using Jira 8.20.10#820010-sha1:ace47f9899e9ee25d7157d59aa17ab06aee30d3d.