Skip to content

Commit 227baf7

Browse files
authored
Merge pull request #57 from cisco-ie/expose_channel
Expose gRPC Channel in Client and ClientBuilder
2 parents c09f40e + a63ce9b commit 227baf7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
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.9"
33+
__version__ = "1.0.10"

src/cisco_gnmi/builder.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def set_channel_option(self, name, value):
281281
self.__channel_options.append(new_option)
282282
return self
283283

284-
def construct(self):
284+
def construct(self, return_channel=False):
285285
"""Constructs and returns the desired Client object.
286286
The instance of this class will reset to default values for further building.
287287
@@ -347,7 +347,10 @@ def construct(self):
347347
],
348348
)
349349
self._reset()
350-
return client
350+
if return_channel:
351+
return client, channel
352+
else:
353+
return client
351354

352355
def _reset(self):
353356
"""Resets the builder.

src/cisco_gnmi/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,7 @@ def __init__(self, grpc_channel, timeout=_C_MAX_LONG, default_call_metadata=None
9898
"""
9999
self.service = proto.gnmi_pb2_grpc.gNMIStub(grpc_channel)
100100
self.default_call_metadata = default_call_metadata
101+
self._channel = grpc_channel
101102

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

0 commit comments

Comments
 (0)