-
Notifications
You must be signed in to change notification settings - Fork 147
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
Session context with yang-library instance of mount point #470
Comments
@michalvasko I would appreciate some guidance/help on this issue. Thank you. |
You have not included many details so I am going to assume you are completely missing the required setup. Note that this feature is transparent for libnetconf2 and will work if you set up libyang correctly. There is a brief description of schema-mount in its docs but it assumes you are already familiar with Schema Mount specs. Also, the tests in libyang may help you understand how to set everything up. |
Thank you for the links. I am familiar with the Schema Mount specification and have seen the brief description in libyang about schema-mount. I will have a look at tests link you provided and will get back to you shortly. |
Hi @michalvasko, I have follow up questions after reviewing the tests and libnetconf2 code. I have schema mount configured on the Netconf Server:
It seems to me that Libnetconf2 Session Client out-of-the-box support for schema mount where nc_connect_ssh interface would setup the libyang context based on the yang-library and schema-mounts operational data. However, from my observation, only root level yang-library (i.e. regular server implemented modules) is queried but not other yang-library instances in the data tree. As per Schema Mount specification (RFC 8525), each mount point instance MUST contain a copy of YANG library data that defines the mounted schema. Would it make sense for nc_ctx_schema_mount() to read ALL yang-library nodes? Or would I need to define my extension data callback (ly_ext_data_clb) for each mount point? How would my custom callback be set? Would Libnetconf2 provide an interface similar to nc_client_set_schema_callback for setting this new callback? I appreciate your help. Cheers, |
I think you are referring to RFC 8528. Firstly, let me say that using
What do you mean, you cannot have several instances of |
Hi Michal, Thank you for the correction, I was referring to RFC 8528 (Schema Mount). In our use-case scenarios, we would like to support multiple RU vendors with different supported modules (e.g. version, augmentation, deviation of standard modules or proprietary modules). Therefore, we would require From my understanding of the specification, each instance of the mount point "MUST contain a copy of YANG library data that defines the mounted schema in exactly the same way as a top-level schema". For example, operation with XPath filter /aggregated-o-ru/aggregation/operations-root/yang-library should return the YANG library data of the mounted modules (RU). And operation with XPath filter /yang-library should return the YANG library data of the top level parent schema (with mount point extension). In our case, it will be the DU related modules but no RU. I have provided a subset of the o-ran YANG modules for DU and RU as example for our discussion. It is unclear to me how to use Libnetconf2 Client to retrieve YANG library data from the instance tree for the session context at runtime. I think the extension callback would need to determine if mount-point is involved in the request, then query the mount point instance yang-library to load the mounted module in the context?! Cheers, |
I needed to get at least a bit more familiar with this extension, it is a complex one (and I suggest avoiding using it if at all possible). I would first describe your (simplified) use-case with all the details: You have several Now the problem, in case you have several instances of mounted data of a single mount point (
In case it is not clear from what I wrote, the extension callback ( |
Hi Michal, You summarize the problem well :) Unfortunately, we need to support schema-mount in our product and therefore, the reason for this ticket. One point I like to clarify, I believe the schema-mounts state data is only available at the parent schema level (i.e. not provided at mount point).
I think if the mount point instance path is provided for the callback, it would be possible to query the yang-library directly the mounted schema. This would apply to both And from your last comment, no further check is required since the extension callback is only triggered if YANG data has mount-point. Thank you for the clarification. Could you share your thoughts on how to move forward on this? Cheers, |
If you agree that a callback with the data node will solve your issue and enable you to implement what you need, I can add it without much trouble and that should be all. But based on what you wrote I am still waiting for an explicit confirmation. |
Hi Michal, I am fairly new to using libnetconf2 so I appreciate your patience. For my use-cases, I would like to be able to perform the following operations on the mounted modules:
From libyang documentation, I understand that in order to parse data in a mount point, the extension data callback must be provided via So here are my follow up questions:
It seems to me a generic/common callback function could be implemented to query the yang-library of any mount point instance (if the absolute path to the mount point instance is provided). Is there plan for libnetconf2 to provide a default callback? Cheers, |
You can do all of that, in general, with the limitation of having the same YANG context (mounted set of YANG modules) for every
Yes, by libyang.
You cannot directly, why do you want to? It is stored somewhere in the extension, I think, and you can get to it from the parsed mounted data, naturally.
No, this would not even be possible. The callback must return data (including
I believe all the schema-loading mechanisms of the original context are reused (search directory, import callback, ...). You do not have provide anything additional, it all works automatically.
I am not sure what you are asking. The normal data are coupled with schema nodes from the main context and the mounted data are connected to the specific mounted context, they do not really work together. |
Right. And that the enhancement you proposed will allow different mount point instances yang-library to be queried. And therefore, addressing this limitation. From the comments you provided, it seems that no additional logic will be required from the user to parse mounted data. The mounted schema support is provided by libyang/libnetconf2 out-of-the-box. User would use the libyang/libnetconf2 library directly to handle RPC request and response at mount point the same way as they would at the root level. Thank you for addressing my questions. |
@michalvasko Could you confirm that my understanding is correct? i.e. libyang/libnetconf2 would provide enhancement to support loading of mounted modules to the specific mounted context. |
What you wrote before is correct but as for the enhancement, I have tried to implement it but found out it requires quite a lot of changed public functions and when trying to just add new variants to avoid NBC changes, it was a mess. So I am unsure what to do about this currently. |
Perhaps you could propose a temporary workaround or short-term solution? And have a bit more time to decide on the long-term solution? For example, I could (as a temporary solution) skip validation during parsing of mounted data during RPC request/response by setting |
The simplest would be to merge all the operational data for all the mount points and provide that in the "global" ext callback. That should make sure the data can always be parsed. |
Sounds reasonable to me. One question, would it be a problem if the mount points support different version of YANG modules? I would be happy to test out the updated libyang/libnetconf2 with your proposed implementation. |
Generally not, each can have its own unique set of YANG modules in its yang-library but, as discussed, you can only distinguish between different mount points in the schema now, but not in data (if some have more instances).
Okay although I think there is not that much to test, the needed functionality is clear, the design is the problem. Will let you know once there is something. |
Could you elaborate your comment above? What does it implication/limitation to user? For our use-case, the mount-point is defined in a list where the different instances of the mount point could have different schemas mounted. |
Hi @michalvasko, hope all is well with you. Just following up on possible solution to support mounted modules in the context. I am currently block on my automation testing due to this issue. For now, it will be sufficient to support the use-case with same schemas for the mount point instances. I hope you will be able to help. Thank you for your time. |
@michalvasko Any update on availability of fix for loading mounted modules in context? |
No, I got the impression that you are fine with the current solution for your use-case. Like I said, there is no simple solution and I think the only one is to change the relevant API functions but since we have increased the SO version just now, I would prefer to wait. |
@michalvasko Sorry for the miscommunication, I do need the API to support updating of the mounted context with the appropriate modules via user callback. Do you have an ETA when it will be available? |
@michalvasko Could you share your thoughts on the next steps to help me move forward on testing mounted modules with libnetconf2? Thank you for your time. |
I suppose I could prepare a patch for you, if you do not mind using one. |
We could definitely use/test the patch for the time being until it is available in the official release. Thank you @michalvasko! |
So here you go, applies to the current libyang |
Hi there,
We are using libnetconf2 Client library to develop automation test for schema mount feature.
It seems libnetconf2 has the framework in place to support schema mount, however, the mounted schemas does not seem to be loaded in the session context. Here is the error message seen in the log when libnetconf2 handle the "action" request associated to the RPC statement defined in the mounted module (i.e. o-ran-trace.yang):
libyang[0]: No module with namespace "urn:o-ran:trace:1.0" in the context. (path: Data location "/o-ran-aggregation-base:aggregated-o-ru/aggregation[ru-instance='ru_test_1']/o-ran-agg-operations:operations-model", line number 6.)
Could you help me resolve this issue? Would the Libnetconf2 library implicitly load the mounted schemas? Or would the user of Libnetconf2 library be expected to explicitly read/load the mounted modules from the server?
In the example above, we are using the following action request using
nc_rpc_act_generic_xml
to create the action andnc_send_rpc
to send it to the server:Please see attached YANG module with mount point.
o-ran-yang.zip
Thank you for your help.
Cheers,
Pek Lee
The text was updated successfully, but these errors were encountered: