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: github.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:04b508ef-8085-29fa-c00b-b16e2a385f82 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | B844:CE9E9:F8CBFF:15AF26C:696A29AC |
| html-safe-nonce | b40039a3dc5c5775b2198dc1c4381cdba7bd70b7ab686a51ffb3bf2951723333 |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJCODQ0OkNFOUU5OkY4Q0JGRjoxNUFGMjZDOjY5NkEyOUFDIiwidmlzaXRvcl9pZCI6Ijc0Njg5NjI0MTQ1NzM3OTE2NjAiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | a67c00cd756fb02a32e5b1fdaf7fecaf035f2afadfc876579e4014b3a4207d4c |
| 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 | a1022f03e4f0d91ea173e4e5dac892c982e0588c62f1ce56121d755a320a3569 |
| 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 | f472b8e6c7b3fdd5d0354972a3f4c516289bf0be |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width