Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release v1.0.12 #75

Merged
merged 8 commits into from
Jul 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cisco_gnmi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@
from .xe import XEClient
from .builder import ClientBuilder

__version__ = "1.0.11"
__version__ = "1.0.12"
8 changes: 8 additions & 0 deletions src/cisco_gnmi/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,12 @@ def gnmi_subscribe():
default="SAMPLE",
choices=proto.gnmi_pb2.SubscriptionMode.keys(),
)
parser.add_argument(
"-req_mode",
help="SubscriptionList.Mode mode for Subscriptions. Defaults to STREAM.",
default="STREAM",
choices=proto.gnmi_pb2.SubscriptionList.Mode.keys(),
)
parser.add_argument(
"-suppress_redundant",
help="Suppress redundant information in Subscription.",
Expand Down Expand Up @@ -159,6 +165,8 @@ def gnmi_subscribe():
kwargs["sample_interval"] = args.interval * int(1e9)
if args.mode:
kwargs["sub_mode"] = args.mode
if args.req_mode:
kwargs["request_mode"] = args.req_mode
if args.suppress_redundant:
kwargs["suppress_redundant"] = args.suppress_redundant
if args.heartbeat_interval:
Expand Down
3 changes: 2 additions & 1 deletion src/cisco_gnmi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -408,7 +408,8 @@ def subscribe_xpaths(
subscription_list.subscription.extend(subscriptions)
return self.subscribe([subscription_list])

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

Expand Down
3 changes: 2 additions & 1 deletion src/cisco_gnmi/nx.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ def subscribe_xpaths(
heartbeat_interval,
)

def parse_xpath_to_gnmi_path(self, xpath, origin=None):
@classmethod
def parse_xpath_to_gnmi_path(cls, xpath, origin=None):
"""Attempts to determine whether origin should be YANG (device) or DME.
"""
if origin is None:
Expand Down
5 changes: 3 additions & 2 deletions src/cisco_gnmi/xe.py
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,8 @@ def subscribe_xpaths(
prefix
)

def parse_xpath_to_gnmi_path(self, xpath, origin=None):
@classmethod
def parse_xpath_to_gnmi_path(cls, xpath, origin=None):
"""Naively tries to intelligently (non-sequitur!) origin
Otherwise assume rfc7951
legacy is not considered
Expand All @@ -323,4 +324,4 @@ def parse_xpath_to_gnmi_path(self, xpath, origin=None):
origin = "openconfig"
else:
origin = "rfc7951"
return super(XEClient, self).parse_xpath_to_gnmi_path(xpath, origin)
return super(XEClient, cls).parse_xpath_to_gnmi_path(xpath, origin)
8 changes: 5 additions & 3 deletions src/cisco_gnmi/xr.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,8 @@ def subscribe_xpaths(
heartbeat_interval,
)

def parse_xpath_to_gnmi_path(self, xpath, origin=None):
@classmethod
def parse_xpath_to_gnmi_path(cls, xpath, origin=None):
"""No origin specified implies openconfig
Otherwise origin is expected to be the module name
"""
Expand All @@ -351,9 +352,10 @@ def parse_xpath_to_gnmi_path(self, xpath, origin=None):
# module name
origin, xpath = xpath.split(":", 1)
origin = origin.strip("/")
return super(XRClient, self).parse_xpath_to_gnmi_path(xpath, origin)
return super(XRClient, cls).parse_xpath_to_gnmi_path(xpath, origin)

def parse_cli_to_gnmi_path(self, command):
@classmethod
def parse_cli_to_gnmi_path(cls, command):
"""Parses a CLI command to proto.gnmi_pb2.Path.
IOS XR appears to be the only OS with this functionality.

Expand Down