Title: Data tree example is not working · Issue #65 · CESNET/libyang-python · GitHub
Open Graph Title: Data tree example is not working · Issue #65 · CESNET/libyang-python
X Title: Data tree example is not working · Issue #65 · CESNET/libyang-python
Description: cffi==1.15.1 libyang==2.7.1 pycparser==2.21 Python 3.10.12 (main, Jun 7 2023, 20:12:10) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import libyang >>> ctx = libyang.Context() ...
Open Graph Description: cffi==1.15.1 libyang==2.7.1 pycparser==2.21 Python 3.10.12 (main, Jun 7 2023, 20:12:10) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> imp...
X Description: cffi==1.15.1 libyang==2.7.1 pycparser==2.21 Python 3.10.12 (main, Jun 7 2023, 20:12:10) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "lic...
Opengraph URL: https://github.com/CESNET/libyang-python/issues/65
X: @github
Domain: patch-diff.githubusercontent.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Data tree example is not working","articleBody":"`cffi==1.15.1`\r\n`libyang==2.7.1`\r\n`pycparser==2.21`\r\n\r\n```\r\nPython 3.10.12 (main, Jun 7 2023, 20:12:10) [GCC 10.2.1 20210110] on linux\r\nType \"help\", \"copyright\", \"credits\" or \"license\" for more information.\r\n\u003e\u003e\u003e import libyang\r\n\u003e\u003e\u003e ctx = libyang.Context()\r\n\u003e\u003e\u003e module = ctx.parse_module_str('''\r\n... module example {\r\n... namespace \"urn:example\";\r\n... prefix \"ex\";\r\n... container data {\r\n... list interface {\r\n... key name;\r\n... leaf name {\r\n... type string;\r\n... }\r\n... leaf address {\r\n... type string;\r\n... }\r\n... }\r\n... leaf hostname {\r\n... type string;\r\n... }\r\n... }\r\n... }\r\n... ''')\r\n\u003e\u003e\u003e print(module.print_mem('tree'))\r\nmodule: example\r\n +--rw data\r\n +--rw interface* [name]\r\n | +--rw name string\r\n | +--rw address? string\r\n +--rw hostname? string\r\n\r\n\u003e\u003e\u003e node = module.parse_data_dict({\r\n... 'data': {\r\n... 'hostname': 'foobar',\r\n... 'interface': [\r\n... {'name': 'eth0', 'address': '1.2.3.4/24'},\r\n... {'name': 'lo', 'address': '127.0.0.1'},\r\n... ],\r\n... },\r\n... })\r\nTraceback (most recent call last):\r\n File \"\u003cstdin\u003e\", line 1, in \u003cmodule\u003e\r\n File \"/usr/local/lib/python3.10/site-packages/libyang/schema.py\", line 215, in parse_data_dict\r\n return dict_to_dnode(\r\n File \"/usr/local/lib/python3.10/site-packages/libyang/data.py\", line 1277, in dict_to_dnode\r\n result.root().validate(\r\n File \"/usr/local/lib/python3.10/site-packages/libyang/data.py\", line 430, in validate\r\n self.validate_all(no_state, validate_present)\r\n File \"/usr/local/lib/python3.10/site-packages/libyang/data.py\", line 449, in validate_all\r\n raise self.context.error(\"validation failed\")\r\nlibyang.util.LibyangError: validation failed: Mandatory node \"content-id\" instance does not exist.\r\n\u003e\u003e\u003e\r\n```\r\n\r\nIt seems to be related to config store:\r\nhttps://github.com/CESNET/libyang-python/commit/93676bc9a829d5c94ba645db5bfbd90a13aab387\r\nhttps://github.com/CESNET/libyang-python/issues/21\r\n","author":{"url":"https://github.com/tias77","@type":"Person","name":"tias77"},"datePublished":"2023-06-09T09:21:17.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":0},"url":"https://github.com/65/libyang-python/issues/65"}
| route-pattern | /_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format) |
| route-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:815b31e3-2d94-8c41-ab7d-1c0079748ef8 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 948C:3F5913:379EAB:4D7A78:698E0C5E |
| html-safe-nonce | 19f8da301c82a75cc1db84531413d1303e75b1721e69845ffa35bcd89a4920f1 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5NDhDOjNGNTkxMzozNzlFQUI6NEQ3QTc4OjY5OEUwQzVFIiwidmlzaXRvcl9pZCI6IjY4Mzg2OTE0ODk0MjIwMzgyIiwicmVnaW9uX2VkZ2UiOiJpYWQiLCJyZWdpb25fcmVuZGVyIjoiaWFkIn0= |
| visitor-hmac | 6a5dd9f5d77e4908dcf325894275746e1b3e38ca6a519929d1f0fbf77cd58b5d |
| hovercard-subject-tag | issue:1749499237 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/CESNET/libyang-python/65/issue_layout |
| twitter:image | https://opengraph.githubassets.com/dca6f4cab1a133793bda2c469e2b10a73ca13feaa88cc9652be786b8442f7930/CESNET/libyang-python/issues/65 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/dca6f4cab1a133793bda2c469e2b10a73ca13feaa88cc9652be786b8442f7930/CESNET/libyang-python/issues/65 |
| og:image:alt | cffi==1.15.1 libyang==2.7.1 pycparser==2.21 Python 3.10.12 (main, Jun 7 2023, 20:12:10) [GCC 10.2.1 20210110] on linux Type "help", "copyright", "credits" or "license" for more information. >>> imp... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | tias77 |
| hostname | github.com |
| expected-hostname | github.com |
| None | fdf74c91c9ac187cc5cd7b14d4af2d6ef3e18136d002f5d36253f8538e97ee4c |
| turbo-cache-control | no-preview |
| go-import | github.com/CESNET/libyang-python git https://github.com/CESNET/libyang-python.git |
| octolytics-dimension-user_id | 1116469 |
| octolytics-dimension-user_login | CESNET |
| octolytics-dimension-repository_id | 275748507 |
| octolytics-dimension-repository_nwo | CESNET/libyang-python |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 275748507 |
| octolytics-dimension-repository_network_root_nwo | CESNET/libyang-python |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 1a5a3e7bbfb3486980e340c242368684156fba87 |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width