@@ -56,6 +56,7 @@ class NXClient(Client):
5656 >>> capabilities = client.capabilities()
5757 >>> print(capabilities)
5858 """
59+
5960 def delete_xpaths (self , xpaths , prefix = None ):
6061 """A convenience wrapper for set() which constructs Paths from supplied xpaths
6162 to be passed to set() as the delete parameter.
@@ -90,7 +91,13 @@ def delete_xpaths(self, xpaths, prefix=None):
9091 paths .append (self .parse_xpath_to_gnmi_path (xpath ))
9192 return self .set (deletes = paths )
9293
93- def set_json (self , update_json_configs = None , replace_json_configs = None , ietf = False , prefix = None ):
94+ def set_json (
95+ self ,
96+ update_json_configs = None ,
97+ replace_json_configs = None ,
98+ ietf = False ,
99+ prefix = None ,
100+ ):
94101 """A convenience wrapper for set() which assumes JSON payloads and constructs desired messages.
95102 All parameters are optional, but at least one must be present.
96103
@@ -289,20 +296,25 @@ def subscribe_xpaths(
289296 heartbeat_interval ,
290297 )
291298
292- def parse_xpath_to_gnmi_path (self , xpath , origin = None ):
299+ @classmethod
300+ def parse_xpath_to_gnmi_path (cls , xpath , origin = None ):
293301 """Attempts to determine whether origin should be YANG (device) or DME.
294302 """
295303 if origin is None :
296304 if any (
297- map (xpath .startswith , [
298- "Cisco-NX-OS-device" ,
299- "/Cisco-NX-OS-device" ,
300- "cisco-nx-os-device" ,
301- "/cisco-nx-os-device" ])
305+ map (
306+ xpath .startswith ,
307+ [
308+ "Cisco-NX-OS-device" ,
309+ "/Cisco-NX-OS-device" ,
310+ "cisco-nx-os-device" ,
311+ "/cisco-nx-os-device" ,
312+ ],
313+ )
302314 ):
303315 origin = "device"
304316 # Remove the module
305317 xpath = xpath .split (":" , 1 )[1 ]
306318 else :
307319 origin = "openconfig"
308- return super (NXClient , self ).parse_xpath_to_gnmi_path (xpath , origin )
320+ return super (NXClient , cls ).parse_xpath_to_gnmi_path (xpath , origin )
0 commit comments