CESNET / libyang

YANG data modeling language library
BSD 3-Clause "New" or "Revised" License
368 stars 292 forks source link

Failing to install openconfig-vlan-types #321

Closed fabioantonini closed 7 years ago

fabioantonini commented 7 years ago

Hi

Description I'm playing with some yang files from openconfig. I had the following error trying to install the file openconfig-vlan-types.yang

how to reproduce

sysrepoctl -i -g /etc/configs/sysrepo/repo/openconfig-vlan-types.yang 
[openconfig-vlan-types.yang.txt](https://github.com/CESNET/libyang/files/1007709/openconfig-vlan-types.yang.txt)

Installing a new module from file '/etc/configs/sysrepo/repo/openconfig-vlan-types.yang'...
[ERR] (srctl_ly_log_cb:487) libyang: Invalid keyword "[1-9][0-9]{1,2}|[1-9])\.\.(409[0-4]|"".
[ERR] (srctl_ly_log_cb:487) libyang: Module "openconfig-vlan-types" parsing failed.
Error: Unable to load the module by libyang.
Install operation failed.

The fail seems to be related to \.\.
If I remove those characters the installation goes ahead but then fails in a different section cause a similar problem. Is there anything bad in the yang file or is there a bug in libyang? regards fabio

michalvasko commented 7 years ago

Hi, you are correct, there is something wrong in the YANG file. For more info look here.

Regards, Michal

fabioantonini commented 7 years ago

thanks a lot

fabio

On 17/05/2017 14:48, Michal Vasko wrote:

Hi, you are correct, there is something wrong in the YANG file. For more info look here https://github.com/CESNET/libyang/issues/318#event-1081677941.

Regards, Michal

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CESNET/libyang/issues/321#issuecomment-302079465, or mute the thread https://github.com/notifications/unsubscribe-auth/AFpJnR-yQTkwttOCYg6VZ0cKKwPJZhXRks5r6uyqgaJpZM4NdzYa.

fabioantonini commented 7 years ago

replacing all the " with ' in the patter statemen did the trick

sysrepoctl -i -g /etc/configs/sysrepo/repo/openconfig-vlan-types.yang

Installing a new module from file '/etc/configs/sysrepo/repo/openconfig-vlan-types.yang'... Installing the YANG file to '/etc/configs/sysrepo/current/yang/openconfig-vlan-types@2016-05-26.yang'... Resolving dependency: 'openconfig-vlan-types' imports 'openconfig-extensions'... Installing the YANG file to '/etc/configs/sysrepo/current/yang/openconfig-extensions@2017-01-29.yang'... Skipping installation of data files for module 'openconfig-vlan-types'... Resolving dependency: 'openconfig-vlan-types' imports 'openconfig-extensions'... Skipping installation of data files for module 'openconfig-extensions'... Notifying sysrepo about the change... Install operation completed successfully.

On 17/05/2017 14:48, Michal Vasko wrote:

Hi, you are correct, there is something wrong in the YANG file. For more info look here https://github.com/CESNET/libyang/issues/318#event-1081677941.

Regards, Michal

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CESNET/libyang/issues/321#issuecomment-302079465, or mute the thread https://github.com/notifications/unsubscribe-auth/AFpJnR-yQTkwttOCYg6VZ0cKKwPJZhXRks5r6uyqgaJpZM4NdzYa.

fabioantonini commented 7 years ago

Hi Michal

I'm facing a different problem installing a new file from openconfig

sysrepoctl -i -g /etc/configs/sysrepo/repo/openconfig-if-ip.yang

......

......

Resolving dependency: 'openconfig-vlan' imports 'openconfig-extensions'... Installing the YANG file to '/etc/configs/sysrepo/current/yang/openconfig-extensions@2017-01-29.yang'... Resolving dependency: 'openconfig-if-ip' imports 'openconfig-extensions'... Installing the YANG file to '/etc/configs/sysrepo/current/yang/openconfig-extensions@2017-01-29.yang'... sysrepoctl: /home/fabio/Projects/tiesse/nos/imola6/imola6/tiesse/src/sysrepo/sysrepo/src/module_dependencies.c: 1693: md_traverse_schema_tree: Asserti on `!backtracking || (LYS_USES == child->nodetype)' failed.

I have seen you have already opened a new pull request regarding modules dependencies. Is it reasonable to get that patch to fix my bug? Or can I open a new issue?

Thanks a lot for your feedback fabio

On 17/05/2017 14:48, Michal Vasko wrote:

Hi, you are correct, there is something wrong in the YANG file. For more info look here https://github.com/CESNET/libyang/issues/318#event-1081677941.

Regards, Michal

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CESNET/libyang/issues/321#issuecomment-302079465, or mute the thread https://github.com/notifications/unsubscribe-auth/AFpJnR-yQTkwttOCYg6VZ0cKKwPJZhXRks5r6uyqgaJpZM4NdzYa.

fabioantonini commented 7 years ago

Hi Michal I have updated sysrepo/libyang to the latest commit. Now I have the following error

fabio# sysrepoctl -i -g /etc/configs/sysrepo/repo/openconfig-if-ip.yang

...... ...... Installing the YANG file to '/etc/configs/sysrepo/current/yang/openconfig-extensions@2017-01-29.yang'... Resolving dependency: 'openconfig-if-ip' imports 'openconfig-extensions'... Installing the YANG file to '/etc/configs/sysrepo/current/yang/openconfig-extensions@2017-01-29.yang'... [ERR] (srctl_ly_log_cb:488) libyang: Schema node "openconfig-interfaces:state" not found (openconfig-interfaces:state). [ERR] (srctl_ly_log_cb:488) libyang: Resolving XPath expression "openconfig-interfaces:state/openconfig-interfaces:type = 'iana-if-type:ethernetCsmacd '" failed. [ERR] (md_collect_data_dependencies:1343) Failed to parse an expression Error: Unable to insert the module into the dependency graph. Reverting the install operation... Deleted the schema file '/etc/configs/sysrepo/current/yang/openconfig-if-ip@2016-12-22.yang'. Install operation failed.

thanks fabio

michalvasko commented 7 years ago

Hi Fabio, the referenced pull request should solve this problem (the expression really is invalid and there are several others) so that the behavior conforms to the RFCs. In this case all the invalid when expressions will always evaluate to false because the nodes in their path do not exist.

For next time, please do not create a libyang issue when having errors in sysrepoctl, it should obviously go to sysrepo, thanks.

Regards, Michal

fabioantonini commented 7 years ago

Hi Michal

thanks a lot. I'll give it a try soon.

regards

fabio

On 18/05/2017 14:07, Michal Vasko wrote:

Hi Fabio, the referenced pull request should solve this problem (the expression really is invalid and there are several others) so that the behavior conforms to the RFCs. In this case all the invalid |when| expressions will always evaluate to |false| because the nodes in their path do not exist.

For next time, please do not create a /libyang/ issue when having errors in /sysrepoctl/, it should obviously go to /sysrepo/, thanks.

Regards, Michal

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/CESNET/libyang/issues/321#issuecomment-302385103, or mute the thread https://github.com/notifications/unsubscribe-auth/AFpJnQ1W69Fc5Lu8UWBmbVULKXBiOE4Uks5r7DSAgaJpZM4NdzYa.

fabioantonini commented 7 years ago

Hi Michal still some problems but different from the past

Resolving dependency: 'openconfig-if-ip' imports 'openconfig-extensions'...
Installing the YANG file to '/etc/configs/sysrepo/current/yang/openconfig-extensions@2017-01-29.yang'...
[ERR] (md_get_module_info:1303) Module 'openconfig-interfaces@' is not present in the dependency graph.
[ERR] (md_get_module_info:1303) Module 'openconfig-interfaces@' is not present in the dependency graph.
[ERR] (md_get_module_info:1303) Module 'openconfig-interfaces@' is not present in the dependency graph.
Error: Unable to insert the module into the dependency graph.
Reverting the install operation...
Deleted the schema file '/etc/configs/sysrepo/current/yang/openconfig-if-ip@2016-12-22.yang'.
Install operation failed.

openconfig-interfaces has been successfully installed previously

openconfig-extensions         | 2017-01-29 | Installed   |                     |             |                               |
openconfig-if-aggregate       | 2016-12-22 | Installed   |                     |             |                               |
openconfig-interfaces         | 2016-12-22 | Implemented | root:root           | 777         |                               |
openconfig-if-ethernet        | 2016-12-22 | Implemented |                     |             |                               |
openconfig-types              | 2017-01-13 | Installed   |                     |             |                               |

regards fabio

michalvasko commented 7 years ago

Hi Fabio, please update libyang and sysrepo if you have not already and try again. I can now successfully import openconfig-if-ip (with same revision as yours) with all its dependencies, so you must have something different.

Regards, Michal

fabioantonini commented 7 years ago

Hi Michal I had libyang 0.12.178...I'm going to pull up the latest release 0.12.179..I'll keep you informed thanks fabio

fabioantonini commented 7 years ago

Hi Michal i have updated everything to the last release (both libyang e sysrepo) but unfortunately I continue to have the same problem. I added some more traces

sysrepoctl -i -g /etc/configs/sysrepo/repo/openconfig-if-ip.yang -L3
.....
.....
Installing the YANG file to '/etc/configs/sysrepo/current/yang/iana-if-type@2014-05-08.yang'...
Resolving dependency: 'iana-if-type' imports 'ietf-interfaces'...
Installing the YANG file to '/etc/configs/sysrepo/current/yang/ietf-interfaces@2014-05-08.yang'...
Resolving dependency: 'openconfig-vlan' imports 'openconfig-extensions'...
Installing the YANG file to '/etc/configs/sysrepo/current/yang/openconfig-extensions@2017-01-29.yang'...
Resolving dependency: 'openconfig-if-ip' imports 'openconfig-extensions'...
Installing the YANG file to '/etc/configs/sysrepo/current/yang/openconfig-extensions@2017-01-29.yang'...
[INF] (md_insert_lys_module:1799) Module 'openconfig-interfaces@2016-12-22' is already installed.
[INF] (md_insert_lys_module:1799) Module 'openconfig-extensions@2017-01-29' is already installed.
[INF] (md_insert_lys_module:1799) Module 'openconfig-interfaces@2016-12-22' is already installed.
[INF] (md_insert_lys_module:1799) Module 'openconfig-interfaces@2016-12-22' is already installed.
[INF] (md_insert_lys_module:1799) Module 'ietf-interfaces@2014-05-08' is already installed.
[INF] (md_insert_lys_module:1799) Module 'openconfig-extensions@2017-01-29' is already installed.
[WRN] (md_collect_data_dependencies:1345) Failed to evaluate expression openconfig-interfaces:state/openconfig-interfaces:type = 'iana-if-type:ether.
[INF] (md_insert_lys_module:1799) Module 'openconfig-interfaces@2016-12-22' is already installed.
[INF] (md_insert_lys_module:1799) Module 'openconfig-if-ethernet@2016-12-22' is already installed.
[INF] (md_insert_lys_module:1799) Module 'openconfig-extensions@2017-01-29' is already installed.
[ERR] (md_get_module_info:1303) Module 'openconfig-interfaces@' is not present in the dependency graph.
[WRN] (md_collect_data_dependencies:1365) Failed to get the module schema based on the prefix
[ERR] (md_get_module_info:1303) Module 'openconfig-interfaces@' is not present in the dependency graph.
[WRN] (md_collect_data_dependencies:1365) Failed to get the module schema based on the prefix
[ERR] (md_get_module_info:1303) Module 'openconfig-interfaces@' is not present in the dependency graph.
[WRN] (md_collect_data_dependencies:1365) Failed to get the module schema based on the prefix
[ERR] (md_get_module_info:1303) Module 'openconfig-interfaces@' is not present in the dependency graph.
[WRN] (md_collect_data_dependencies:1365) Failed to get the module schema based on the prefix
Error: Unable to insert the module into the dependency graph.
Reverting the install operation...
Deleted the schema file '/etc/configs/sysrepo/current/yang/openconfig-if-ip@2016-12-22.yang'.
Install operation failed.

Do you see any interesting in the additional traces? thanks fabio

michalvasko commented 7 years ago

Hi Fabio, please try the referenced pull request.

Regards, Michal

fabioantonini commented 7 years ago

Hi Michal

still some problems

Resolving dependency: 'openconfig-vlan' imports 'openconfig-extensions'...
Installing the YANG file to '/etc/configs/sysrepo/current/yang/openconfig-extensions@2017-01-29.yang'...
Resolving dependency: 'openconfig-if-ip' imports 'openconfig-extensions'...
Installing the YANG file to '/etc/configs/sysrepo/current/yang/openconfig-extensions@2017-01-29.yang'...
[ERR] (srctl_ly_log_cb:488) libyang: Schema node "openconfig-interfaces:state" not found (openconfig-interfaces:state).
[ERR] (srctl_ly_log_cb:488) libyang: Resolving XPath expression "openconfig-interfaces:state/openconfig-interfaces:type = 'iana-if-type:ethernetCsma.
[ERR] (md_collect_data_dependencies:1343) Failed to parse an expression
Error: Unable to insert the module into the dependency graph.
Reverting the install operation...
Deleted the schema file '/etc/configs/sysrepo/current/yang/openconfig-if-ip@2016-12-22.yang'.
Install operation failed.

something has changed anyway thanks fabio

michalvasko commented 7 years ago

Hi Fabio, this should be fixed by sysrepo/sysrepo@68ada28b65a350e3d840a239f236bbdef6544ea4 (you can see it changes the message, so you must have some old revision), which is currently also in devel, so update it and it should work.

Regards, Michal

fabioantonini commented 7 years ago

Hi Michal Thanks a lot for your time I apologize, but I have losed some changes in module_dependencies.c. Now it work fine for me too, openconfig-if-ip.yang has been successfully installed. Awyway I have a new problem on a different file named openconfig-if-ip-ext.yang

sysrepoctl -i -g /etc/configs/sysrepo/repo/openconfig-if-ip-ext.yang -L4
[DBG] (sr_log_stderr:141) Setting log level for stderr logs to 4.
Installing a new module from file '/etc/configs/sysrepo/repo/openconfig-if-ip-ext.yang'...
sysrepoctl: /home/fabio/Projects/tiesse/nos/imola6/imola6/tiesse/src/sysrepo/libyang/src/tree_schema.c: 4322: lys_set_implemented_recursion: Assertion `module->augment[i].target' failed.
Aborted

Please can you try to install the same file? thanks a lot fabio

fabioantonini commented 7 years ago

The issue can be closed because the last problem is different. I'll open a new issue under sysrepo as requested. Regards fabio