Skip to content

Commit 806be4c

Browse files
Pepa Hajekrjarry
authored andcommitted
Port to libyang 2
- There is no pretty print parameter for print functions (was LYP_FORMAT in 1.x). Also there were renamed functions freeing libyang structures from memory. - Change test_data_parse_config_json() to be working cdefs.h: Add lyd_parse_mem() and its parser and validation options. context.py: Change keyword parameters for parse_data_mem() according to a parser parameters in libyang2. data.py: change parser flags, add validation flags. They have been change and split for parse_*() fuctions in libyang2. test_data.py: in test_data_parse_config_json(), change comparison data for assert. There is no "pretty" parameter in libyang2 anymore (its implicit now) and json data are printed with sorted keys. However, test_data_parse_config_json() still does not pass because resulting json have the "number" union listed with numbers as string not as integer. It looks like a bug in libyang2. - Function print_mem() needs to be used with with_siblings parameter, otherwise prints only one unspecified node on the same level. - Function feature_disable() was removed because there is no replace for lys_features_disable() in libyang2. The only way how to disable eparticular feature is to disable all and enable set required features again. - Parsed and compiled node schema trees corresponds closely to each other. In order connecting both together LY_CTX_SET_PRIV_PARSED context option is set by default. It is necessary for some features (eg. node type resolving). - Libyang 2 does not have derived types anymore. All the code refering derived types removed. Removed also "description()" method, there is no support for it anymore. - Function data.print_dict() was rewritten. There is no function like lys_should_print() in libyang2 thus nodes converted to json cannot be limited by parameters of this function. - Parsing edit operation from dictionary is not supported because libyang2 is able to process LYD_TYPE_RPC_NETCONF operations only from XML format. The reason is that NETCONF supports XML only. - Remove functions deprecated in libyang2 - Remove rpcreply argument from data.dict_to_dnode() since this information type is already know from DataType (lyd_type) structure. Signed-off-by: Pepa Hajek <hajekpepa@gmail.com> Signed-off-by: Jean-Sébastien Bevilacqua <jean-sebastien.bevilacqua@6wind.com> Signed-off-by: Robin Jarry <robin@jarry.cc>
1 parent 77fe009 commit 806be4c

26 files changed

+3639
-1359
lines changed

.github/workflows/ci.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
- uses: actions/checkout@v2
1313
- uses: actions/setup-python@v2
1414
with:
15-
python-version: 3.8
15+
python-version: 3.x
1616
- uses: actions/cache@v2
1717
with:
1818
path: ~/.cache/pip
@@ -27,18 +27,18 @@ jobs:
2727
strategy:
2828
matrix:
2929
include:
30-
- python: 3.5
31-
toxenv: py35
3230
- python: 3.6
3331
toxenv: py36
3432
- python: 3.7
3533
toxenv: py37
3634
- python: 3.8
3735
toxenv: py38
36+
- python: 3.9
37+
toxenv: py39
38+
- python: "3.10"
39+
toxenv: py310
3840
- python: pypy3
3941
toxenv: pypy3
40-
- python: 3.x
41-
toxenv: py3-libyang1
4242
steps:
4343
- uses: actions/checkout@v2
4444
- uses: actions/setup-python@v2

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ lint:
77
tox -e lint
88

99
tests:
10-
tox -e py3-libyang1
10+
tox -e py37
1111

1212
format:
1313
tox -e format

README.rst

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,13 @@ On a Debian/Ubuntu system::
4343
Compatibility
4444
-------------
4545

46-
.. attention::
46+
The current version requires at least C `libyang 2.19`__.
4747

48-
For now, only `libyang 1.x`__ is supported. These CFFI bindings will not work
49-
with the libyang 2.x. See issues `sysrepo/sysrepo-python#17`__ for more
50-
details and `sysrepo/sysrepo-python#12`__ for updates.
48+
The last version of the bindings that works with C `libyang 1.x`__ is v1.7.0__.
5149

52-
__ https://github.com/CESNET/libyang/tree/libyang1
53-
__ https://github.com/sysrepo/sysrepo-python/issues/17
54-
__ https://github.com/sysrepo/sysrepo-python/issues/12
50+
__ https://github.com/CESNET/libyang/commit/94c581ae59ee79feecb8b560827e0760a4d4da53
51+
__ https://github.com/CESNET/libyang/tree/libyang1
52+
__ https://pypi.org/project/libyang/1.7.0/
5553

5654
Compilation Flags
5755
-----------------

0 commit comments

Comments
 (0)