Skip to content

Commit

Permalink
Merge pull request #57 from cisco-ie/expose_channel
Browse files Browse the repository at this point in the history
Expose gRPC Channel in Client and ClientBuilder
  • Loading branch information
remingtonc authored May 27, 2020
2 parents c09f40e + a63ce9b commit 227baf7
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
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.9"
__version__ = "1.0.10"
7 changes: 5 additions & 2 deletions src/cisco_gnmi/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -281,7 +281,7 @@ def set_channel_option(self, name, value):
self.__channel_options.append(new_option)
return self

def construct(self):
def construct(self, return_channel=False):
"""Constructs and returns the desired Client object.
The instance of this class will reset to default values for further building.
Expand Down Expand Up @@ -347,7 +347,10 @@ def construct(self):
],
)
self._reset()
return client
if return_channel:
return client, channel
else:
return client

def _reset(self):
"""Resets the builder.
Expand Down
1 change: 1 addition & 0 deletions src/cisco_gnmi/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ def __init__(self, grpc_channel, timeout=_C_MAX_LONG, default_call_metadata=None
"""
self.service = proto.gnmi_pb2_grpc.gNMIStub(grpc_channel)
self.default_call_metadata = default_call_metadata
self._channel = grpc_channel

def capabilities(self):
"""Capabilities allows the client to retrieve the set of capabilities that
Expand Down

0 comments on commit 227baf7

Please sign in to comment.