Skip to content

Commit fa239b3

Browse files
authored
Merge pull request #75 from cisco-ie/rel-v1.0.12
Release v1.0.12
2 parents 909df28 + 2691963 commit fa239b3

File tree

6 files changed

+21
-8
lines changed

6 files changed

+21
-8
lines changed

src/cisco_gnmi/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,4 @@
3030
from .xe import XEClient
3131
from .builder import ClientBuilder
3232

33-
__version__ = "1.0.11"
33+
__version__ = "1.0.12"

src/cisco_gnmi/cli.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,12 @@ def gnmi_subscribe():
113113
default="SAMPLE",
114114
choices=proto.gnmi_pb2.SubscriptionMode.keys(),
115115
)
116+
parser.add_argument(
117+
"-req_mode",
118+
help="SubscriptionList.Mode mode for Subscriptions. Defaults to STREAM.",
119+
default="STREAM",
120+
choices=proto.gnmi_pb2.SubscriptionList.Mode.keys(),
121+
)
116122
parser.add_argument(
117123
"-suppress_redundant",
118124
help="Suppress redundant information in Subscription.",
@@ -159,6 +165,8 @@ def gnmi_subscribe():
159165
kwargs["sample_interval"] = args.interval * int(1e9)
160166
if args.mode:
161167
kwargs["sub_mode"] = args.mode
168+
if args.req_mode:
169+
kwargs["request_mode"] = args.req_mode
162170
if args.suppress_redundant:
163171
kwargs["suppress_redundant"] = args.suppress_redundant
164172
if args.heartbeat_interval:

src/cisco_gnmi/client.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,8 @@ def subscribe_xpaths(
408408
subscription_list.subscription.extend(subscriptions)
409409
return self.subscribe([subscription_list])
410410

411-
def parse_xpath_to_gnmi_path(self, xpath, origin=None):
411+
@classmethod
412+
def parse_xpath_to_gnmi_path(cls, xpath, origin=None):
412413
"""Parses an XPath to proto.gnmi_pb2.Path.
413414
This function should be overridden by any child classes for origin logic.
414415

src/cisco_gnmi/nx.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -289,7 +289,8 @@ def subscribe_xpaths(
289289
heartbeat_interval,
290290
)
291291

292-
def parse_xpath_to_gnmi_path(self, xpath, origin=None):
292+
@classmethod
293+
def parse_xpath_to_gnmi_path(cls, xpath, origin=None):
293294
"""Attempts to determine whether origin should be YANG (device) or DME.
294295
"""
295296
if origin is None:

src/cisco_gnmi/xe.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,8 @@ def subscribe_xpaths(
312312
prefix
313313
)
314314

315-
def parse_xpath_to_gnmi_path(self, xpath, origin=None):
315+
@classmethod
316+
def parse_xpath_to_gnmi_path(cls, xpath, origin=None):
316317
"""Naively tries to intelligently (non-sequitur!) origin
317318
Otherwise assume rfc7951
318319
legacy is not considered
@@ -323,4 +324,4 @@ def parse_xpath_to_gnmi_path(self, xpath, origin=None):
323324
origin = "openconfig"
324325
else:
325326
origin = "rfc7951"
326-
return super(XEClient, self).parse_xpath_to_gnmi_path(xpath, origin)
327+
return super(XEClient, cls).parse_xpath_to_gnmi_path(xpath, origin)

src/cisco_gnmi/xr.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -338,7 +338,8 @@ def subscribe_xpaths(
338338
heartbeat_interval,
339339
)
340340

341-
def parse_xpath_to_gnmi_path(self, xpath, origin=None):
341+
@classmethod
342+
def parse_xpath_to_gnmi_path(cls, xpath, origin=None):
342343
"""No origin specified implies openconfig
343344
Otherwise origin is expected to be the module name
344345
"""
@@ -351,9 +352,10 @@ def parse_xpath_to_gnmi_path(self, xpath, origin=None):
351352
# module name
352353
origin, xpath = xpath.split(":", 1)
353354
origin = origin.strip("/")
354-
return super(XRClient, self).parse_xpath_to_gnmi_path(xpath, origin)
355+
return super(XRClient, cls).parse_xpath_to_gnmi_path(xpath, origin)
355356

356-
def parse_cli_to_gnmi_path(self, command):
357+
@classmethod
358+
def parse_cli_to_gnmi_path(cls, command):
357359
"""Parses a CLI command to proto.gnmi_pb2.Path.
358360
IOS XR appears to be the only OS with this functionality.
359361

0 commit comments

Comments
 (0)