File tree Expand file tree Collapse file tree 5 files changed +42
-2
lines changed
Expand file tree Collapse file tree 5 files changed +42
-2
lines changed Original file line number Diff line number Diff line change @@ -14,6 +14,7 @@ struct ly_ctx;
1414#define LY_CTX_EXPLICIT_COMPILE ...
1515#define LY_CTX_REF_IMPLEMENTED ...
1616#define LY_CTX_SET_PRIV_PARSED ...
17+ #define LY_CTX_LEAFREF_EXTENDED ...
1718
1819
1920typedef enum {
Original file line number Diff line number Diff line change 99#if (LY_VERSION_MAJOR != 2 )
1010#error "This version of libyang bindings only works with libyang 2.x"
1111#endif
12- #if (LY_VERSION_MINOR < 25 )
13- #error "Need at least libyang 2.25 "
12+ #if (LY_VERSION_MINOR < 37 )
13+ #error "Need at least libyang 2.37 "
1414#endif
Original file line number Diff line number Diff line change @@ -28,6 +28,7 @@ def __init__(
2828 search_path : Optional [str ] = None ,
2929 disable_searchdir_cwd : bool = True ,
3030 explicit_compile : Optional [bool ] = False ,
31+ leafref_extended : bool = False ,
3132 yanglib_path : Optional [str ] = None ,
3233 yanglib_fmt : str = "json" ,
3334 cdata = None , # C type: "struct ly_ctx *"
@@ -41,6 +42,8 @@ def __init__(
4142 options |= lib .LY_CTX_DISABLE_SEARCHDIR_CWD
4243 if explicit_compile :
4344 options |= lib .LY_CTX_EXPLICIT_COMPILE
45+ if leafref_extended :
46+ options |= lib .LY_CTX_LEAFREF_EXTENDED
4447 # force priv parsed
4548 options |= lib .LY_CTX_SET_PRIV_PARSED
4649
Original file line number Diff line number Diff line change @@ -106,3 +106,8 @@ def test_ctx_parse_module(self):
106106 with Context (YANG_DIR ) as ctx :
107107 mod = ctx .parse_module_file (f , features = ["turbo-boost" , "networking" ])
108108 self .assertIsInstance (mod , Module )
109+
110+ def test_ctx_leafref_extended (self ):
111+ with Context (YANG_DIR , leafref_extended = True ) as ctx :
112+ mod = ctx .load_module ("yolo-leafref-extended" )
113+ self .assertIsInstance (mod , Module )
Original file line number Diff line number Diff line change 1+ module yolo-leafref -extended {
2+ yang-version 1.1 ;
3+ namespace "urn:yang:yolo:leafref-extended" ;
4+ prefix leafref -ext;
5+
6+ revision 2025 -01 -25 {
7+ description
8+ "Initial version." ;
9+ }
10+
11+ list list1 {
12+ key leaf1;
13+ leaf leaf1 {
14+ type string ;
15+ }
16+ leaf-list leaflist2 {
17+ type string ;
18+ }
19+ }
20+
21+ leaf ref1 {
22+ type leafref {
23+ path "../list1/leaf1" ;
24+ }
25+ }
26+ leaf ref2 {
27+ type leafref {
28+ path "deref(../ref1)/../leaflist2" ;
29+ }
30+ }
31+ }
You can’t perform that action at this time.
0 commit comments