Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with nc_clb_default_get_schema Format Option in libnetconf2 #514

Open
nbiskup-eridan opened this issue Oct 8, 2024 · 9 comments
Open
Labels
is:question Issue is actually a question.

Comments

@nbiskup-eridan
Copy link

Hi,

I'm encountering an issue with nc_clb_default_get_schema when I set the format option to yang. It expects a prefix before the format name.

I'm curious why the prefix is required, especially since the same prefix was removed in this commit ( cd4a72de957d9fb093e732c64a05eae497ef353f ) within Netopeer for the get-schema RPC. Could you provide more information on this behavior?

/* check format */
if (!format || !strcmp(format, "ietf-netconf-monitoring:yang")) {
    outformat = LYS_OUT_YANG;
} else if (!strcmp(format, "ietf-netconf-monitoring:yin")) {
    outformat = LYS_OUT_YIN;
} else {
    err = nc_err(session->ctx, NC_ERR_INVALID_VALUE, NC_ERR_TYPE_APP);
    nc_err_set_msg(err, "The requested format is not supported.", "en");
    return nc_server_reply_err(err);
}

Thank you.

@michalvasko
Copy link
Member

The commit you referenced has been later reverted, to some extent. The format node is an identityref, whose canonical value always includes the module prefix, in all reasonably recent libyang versions.

@michalvasko michalvasko added the is:question Issue is actually a question. label Oct 8, 2024
@nbiskup-eridan
Copy link
Author

Thank you for your response.

I am sending the following RPC, which you can see below. In this case, I receive the value for the format as just "yang". Could you assist me in understanding how the correct RPC should look to resolve this issue?

Here is the RPC I'm currently sending:

<nc:rpc xmlns:nc="urn:ietf:params:xml:ns:netconf:base:1.0" message-id="urn:uuid:a539b3ee-98eb-47f5-9096-0688933aaebd">
  <ncm:get-schema xmlns:ncm="urn:ietf:params:xml:ns:yang:ietf-netconf-monitoring">
	  <ncm:identifier>ietf-netconf</ncm:identifier>
	  <ncm:format>ncm:yang</ncm:format>
  </ncm:get-schema>
</nc:rpc>

@michalvasko
Copy link
Member

The RPC looks fine, what libyang version are you using? That may be the issue.

@nbiskup-eridan
Copy link
Author

I am using version v2.1.111 due to system dependencies.

@michalvasko
Copy link
Member

The compatible version of netopeer2 with that is 2.1.71, which actually has that format check different and it should work. You need to use compatible versions of the projects based on netopeer2 releases or you risk similar problems.

@nbiskup-eridan
Copy link
Author

We are not using Netopeer2, but instead have our own implementation that relies on nc_clb_default_get_schema provided by libnetconf2, which is currently not working for us. We are using the same versions of libyang (v2.1.111), libnetconf2 (v2.1.37), and sysrepo (v2.2.105) as in Netopeer2 version 2.1.71.

I mention this in case we might have misunderstood each other.

@michalvasko
Copy link
Member

Thanks, considering these versions, looking at the libyang code, it seems it generates identity values without prefix for local identities. But libnetconf2 expects it there so that is a bug. One possible fix is to use and manually apply the commit you referenced.

@nbiskup-eridan
Copy link
Author

Thank you for the information. I'm still not entirely sure if this issue has been fixed in the newer versions, and if so, could you please let me know from which version it has been resolved?

@michalvasko
Copy link
Member

You need to use compatible versions of libyang and libnetconf2 for it to work properly. The safest thing to do is to use the latest or one of the few most recent releases, I am not exactly sure when it was fixed (but I would hope it works in all the other versions except for those mentioned here).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is:question Issue is actually a question.
Projects
None yet
Development

No branches or pull requests

2 participants