1717import netconf_client .ncclient
1818from infamy .transport import Transport ,infer_put_dict
1919from netconf_client .error import RpcError
20- from . import env , netutil
20+ from . import env , netutil , coverage
2121
2222
2323def netconf_syn (addr ):
@@ -249,6 +249,7 @@ def reboot(self):
249249 })
250250
251251 def get (self , xpath , parse = True ):
252+ coverage .track_xpath (xpath )
252253 xpath_filter = self ._build_xpath_filter (xpath )
253254 response = self .ncc .get (filter = xpath_filter )
254255 return self ._parse_response (response , parse )
@@ -263,6 +264,7 @@ def get_dict(self, xpath):
263264 return data .print_dict ()
264265
265266 def get_data (self , xpath = None , parse = True ):
267+ coverage .track_xpath (xpath )
266268 xpath_filter = self ._build_xpath_filter (xpath , get_data_xpath = True )
267269 response = self .ncc .get_data (datastore = "ds:operational" , filter = xpath_filter )
268270 parsed_data = self ._parse_response (response , parse )
@@ -273,6 +275,7 @@ def get_data(self, xpath=None, parse=True):
273275 return parsed_data
274276
275277 def get_config (self , xpath ):
278+ coverage .track_xpath (xpath )
276279 xpath_filter = self ._build_xpath_filter (xpath )
277280 response = self .ncc .get_config (source = "running" , filter = xpath_filter )
278281 return self ._parse_response (response , True )
@@ -317,6 +320,8 @@ def put_config_dicts(self, models, retries=3):
317320 """PUT full configuration of all models to running-config"""
318321 config = ""
319322 infer_put_dict (self .name , models )
323+ for mod , data in models .items ():
324+ coverage .track_dict (mod , data )
320325
321326 for model in models .keys ():
322327 try :
@@ -349,6 +354,7 @@ def patch_config(self, modname, edit, retries=3):
349354 f"Available models can be checked with get_schema_list()" ) from None
350355 lyd = mod .parse_data_dict (edit , no_state = True , validate = False )
351356 config = lyd .print_mem ("xml" , with_siblings = True , pretty = False )
357+ coverage .track_dict (modname , edit )
352358 # print(f"Send new XML config: {config}")
353359 return self .put_config (config , retries = retries )
354360
@@ -358,6 +364,7 @@ def call(self, call):
358364
359365 def call_dict (self , modname , call ):
360366 """Call RPC, Python dictionary version"""
367+ coverage .track_dict (modname , call )
361368 try :
362369 mod = self .ly .get_module (modname )
363370 except libyang .util .LibyangError :
@@ -374,6 +381,7 @@ def call_action(self, xpath, input_data=None):
374381 the action's input leaves. Defaults to an empty input for
375382 actions that take no parameters.
376383 """
384+ coverage .track_xpath (xpath )
377385 action = {}
378386 pattern = r"^/(?P<module>[^:]+):(?P<path>[^/]+)"
379387 match = re .search (pattern , xpath )
@@ -416,6 +424,7 @@ def get_schema(self, schema, outdir):
416424 f .write (data .schema )
417425
418426 def delete_xpath (self , xpath ):
427+ coverage .track_xpath (xpath )
419428 # Split out the model and the container from xpath'
420429 pattern = r"^/(?P<module>[^:]+):(?P<path>[^/]+)"
421430 match = re .search (pattern , xpath )
0 commit comments