Skip to content

Commit f229cd3

Browse files
committed
Move CLI parsing to XR wrapper
1 parent 46d951f commit f229cd3

File tree

2 files changed

+16
-16
lines changed

2 files changed

+16
-16
lines changed

src/cisco_gnmi/client.py

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -334,19 +334,3 @@ def parse_xpath_to_gnmi_path(self, xpath, origin=None):
334334
raise Exception("Unfinished elements in XPath parsing!")
335335
path.elem.extend(path_elems)
336336
return path
337-
338-
def parse_cli_command_to_gnmi_path(self, cli_command):
339-
"""Parses a CLI command to proto.gnmi_pb2.Path.
340-
This function should be overridden by any child classes for origin logic.
341-
342-
The CLI command becomes a path element.
343-
"""
344-
if not isinstance(cli_command, string_types):
345-
raise Exception("cli_command must be a string!")
346-
347-
path = proto.gnmi_pb2.Path()
348-
curr_elem = proto.gnmi_pb2.PathElem()
349-
curr_elem.name = cli_command
350-
path.elem.extend([curr_elem])
351-
352-
return path

src/cisco_gnmi/xr.py

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -367,3 +367,19 @@ def get_cli_commands(self, cli_commands):
367367
)
368368
return self.get(gnmi_path, encoding='ASCII')
369369

370+
def parse_cli_command_to_gnmi_path(self, cli_command):
371+
"""Parses a CLI command to proto.gnmi_pb2.Path.
372+
This function should be overridden by any child classes for origin logic.
373+
374+
The CLI command becomes a path element.
375+
"""
376+
if not isinstance(cli_command, string_types):
377+
raise Exception("cli_command must be a string!")
378+
379+
path = proto.gnmi_pb2.Path()
380+
curr_elem = proto.gnmi_pb2.PathElem()
381+
curr_elem.name = cli_command
382+
path.elem.extend([curr_elem])
383+
384+
return path
385+

0 commit comments

Comments
 (0)