@@ -79,6 +79,7 @@ def data_format(fmt_string: str) -> int:
7979# -------------------------------------------------------------------------------------
8080def newval_flags (
8181 rpc_output : bool = False ,
82+ store_only : bool = False ,
8283 bin_value : bool = False ,
8384 canon_value : bool = False ,
8485 meta_clear_default : bool = False ,
@@ -91,6 +92,8 @@ def newval_flags(
9192 flags = 0
9293 if rpc_output :
9394 flags |= lib .LYD_NEW_VAL_OUTPUT
95+ if store_only :
96+ flags |= lib .LYD_NEW_VAL_STORE_ONLY
9497 if bin_value :
9598 flags |= lib .LYD_NEW_VAL_BIN
9699 if canon_value :
@@ -112,6 +115,7 @@ def parser_flags(
112115 opaq : bool = False ,
113116 ordered : bool = False ,
114117 strict : bool = False ,
118+ store_only : bool = False ,
115119) -> int :
116120 flags = 0
117121 if lyb_mod_update :
@@ -126,6 +130,8 @@ def parser_flags(
126130 flags |= lib .LYD_PARSE_ORDERED
127131 if strict :
128132 flags |= lib .LYD_PARSE_STRICT
133+ if store_only :
134+ flags |= lib .LYD_PARSE_STORE_ONLY
129135 return flags
130136
131137
@@ -314,8 +320,10 @@ def meta_free(self, name):
314320 break
315321 item = item .next
316322
317- def new_meta (self , name : str , value : str , clear_dflt : bool = False ):
318- flags = newval_flags (meta_clear_default = clear_dflt )
323+ def new_meta (
324+ self , name : str , value : str , clear_dflt : bool = False , store_only : bool = False
325+ ):
326+ flags = newval_flags (meta_clear_default = clear_dflt , store_only = store_only )
319327 ret = lib .lyd_new_meta (
320328 ffi .NULL ,
321329 self .cdata ,
@@ -391,13 +399,15 @@ def new_path(
391399 opt_opaq : bool = False ,
392400 opt_bin_value : bool = False ,
393401 opt_canon_value : bool = False ,
402+ opt_store_only : bool = False ,
394403 ):
395404 flags = newval_flags (
396405 update = opt_update ,
397406 rpc_output = opt_output ,
398407 opaq = opt_opaq ,
399408 bin_value = opt_bin_value ,
400409 canon_value = opt_canon_value ,
410+ store_only = opt_store_only ,
401411 )
402412 ret = lib .lyd_new_path (
403413 self .cdata , ffi .NULL , str2c (path ), str2c (value ), flags , ffi .NULL
@@ -1062,9 +1072,10 @@ def create_path(
10621072 path : str ,
10631073 value : Any = None ,
10641074 rpc_output : bool = False ,
1075+ store_only : bool = False ,
10651076 ) -> Optional [DNode ]:
10661077 return self .context .create_data_path (
1067- path , parent = self , value = value , rpc_output = rpc_output
1078+ path , parent = self , value = value , rpc_output = rpc_output , store_only = store_only
10681079 )
10691080
10701081 def children (self , no_keys = False ) -> Iterator [DNode ]:
@@ -1188,6 +1199,7 @@ def dict_to_dnode(
11881199 rpc : bool = False ,
11891200 rpcreply : bool = False ,
11901201 notification : bool = False ,
1202+ store_only : bool = False ,
11911203) -> Optional [DNode ]:
11921204 """
11931205 Convert a python dictionary to a DNode object given a YANG module object. The return
@@ -1214,6 +1226,8 @@ def dict_to_dnode(
12141226 Data represents RPC or action output parameters.
12151227 :arg notification:
12161228 Data represents notification parameters.
1229+ :arg store_only:
1230+ Data are being stored regardless of type validation (length, range, pattern, etc.)
12171231 """
12181232 if not dic :
12191233 return None
@@ -1235,7 +1249,7 @@ def _create_leaf(_parent, module, name, value, in_rpc_output=False):
12351249 value = str (value )
12361250
12371251 n = ffi .new ("struct lyd_node **" )
1238- flags = newval_flags (rpc_output = in_rpc_output )
1252+ flags = newval_flags (rpc_output = in_rpc_output , store_only = store_only )
12391253 ret = lib .lyd_new_term (
12401254 _parent ,
12411255 module .cdata ,
@@ -1273,7 +1287,7 @@ def _create_container(_parent, module, name, in_rpc_output=False):
12731287
12741288 def _create_list (_parent , module , name , key_values , in_rpc_output = False ):
12751289 n = ffi .new ("struct lyd_node **" )
1276- flags = newval_flags (rpc_output = in_rpc_output )
1290+ flags = newval_flags (rpc_output = in_rpc_output , store_only = store_only )
12771291 ret = lib .lyd_new_list (
12781292 _parent ,
12791293 module .cdata ,
0 commit comments