libnetconf2 icon indicating copy to clipboard operation
libnetconf2 copied to clipboard

Indication of yang-library support in NETCONF Server

Open OSHINRAJ opened this issue 3 years ago • 6 comments

I came across an issue where one of the netconf-server return a capability message for yang-library support as follows,

urn:ietf:params:xml:ns:yang:ietf-yang-library?module=ietf-yang-library&revision=2016-06-21

So my netconf-client was not able to retrieve the yang-schema supported by that server.

In another netconf-server, it returns yang-library support as follows and all things works fine here.

urn:ietf:params:netconf:capability:yang-library:1.0?revision=2016-06-21&module-set-id=4755

In libnetconf2 library there is a check for yang-library support as below, https://github.com/CESNET/libnetconf2/blob/c21986efedaa948fb9ab8764c332a3d17d5c468b/src/session_client.c#L1143

But As per the RFC 7950 Section 1.1 (https://www.rfc-editor.org/rfc/rfc7950.html#section-1.1) the netconf-server can also indicate the yang-library support using the ietf-yang-library yang model.

The following changes have been done to the NETCONF mapping:

   o  A server advertises support for YANG 1.1 modules by using
      ietf-yang-library [[RFC7895](https://www.rfc-editor.org/rfc/rfc7895)] instead of listing them as
      capabilities in the <hello> message.

So in libnetconf2 the yang-library support need to be determined by considering both of this, right?

OSHINRAJ avatar Jun 15 '22 07:06 OSHINRAJ

No, you are interpreting the referenced snipped wrong. It only says that all YANG 1.1 modules are advertised in YANG library data instead of the capabilities. It does not say anything about advertising the ietf-yang-library module and the yang-library capability itself.

michalvasko avatar Jun 15 '22 07:06 michalvasko

So both of the following in hello message indicating that netconf-server support yang-library or is there any specific meaning ?

urn:ietf:params:xml:ns:yang:ietf-yang-library?module=ietf-yang-library&revision=2016-06-21

urn:ietf:params:netconf:capability:yang-library:1.0?revision=2016-06-21&module-set-id=4755

OSHINRAJ avatar Jun 15 '22 09:06 OSHINRAJ

I think this is defined in RFC 7950, section 5.6.4:

The server also MUST advertise the following capability in the <hello> message (...):

urn:ietf:params:netconf:capability:yang-library:1.0?revision=<date>&module-set-id=<id>

So it appears that the NETCONF server that you tested against does not properly support YANG 1.1.

jktjkt avatar Jun 15 '22 09:06 jktjkt

What @jktjkt said but I will add some details.

urn:ietf:params:xml:ns:yang:ietf-yang-library?module=ietf-yang-library&revision=2016-06-21

means that there is a generic module with this namespace, name, and revision implemented by the server.

urn:ietf:params:netconf:capability:yang-library:1.0?revision=2016-06-21&module-set-id=4755

means the server supports the yang-library capability and is using the specific module-set-id.

michalvasko avatar Jun 15 '22 09:06 michalvasko

@michalvasko ,

One small correction is there from my side, in non-working case the netconf-server returns a capability like following,

<capability>urn:ietf:params:xml:ns:yang:ietf-yang-library?revision=2018-01-17&amp;module-set-id=53</capability>

instead of

<capability>urn:ietf:params:xml:ns:yang:ietf-yang-library?module=ietf-yang-library&amp;revision=2016-06-21</capability>

Do you have any thought on this?

OSHINRAJ avatar Jun 15 '22 12:06 OSHINRAJ

Then it seems simply like a bug, the server is sending the YANG module namespace instead of the capability URI.

michalvasko avatar Jun 16 '22 08:06 michalvasko