diff --git a/src/cisco_gnmi/__init__.py b/src/cisco_gnmi/__init__.py index 0eb3982..16a73b6 100644 --- a/src/cisco_gnmi/__init__.py +++ b/src/cisco_gnmi/__init__.py @@ -30,4 +30,4 @@ from .xe import XEClient from .builder import ClientBuilder -__version__ = "1.0.9" +__version__ = "1.0.10" diff --git a/src/cisco_gnmi/builder.py b/src/cisco_gnmi/builder.py index d80e55b..0f6d445 100644 --- a/src/cisco_gnmi/builder.py +++ b/src/cisco_gnmi/builder.py @@ -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. @@ -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. diff --git a/src/cisco_gnmi/client.py b/src/cisco_gnmi/client.py index 53e9c20..11df9ca 100755 --- a/src/cisco_gnmi/client.py +++ b/src/cisco_gnmi/client.py @@ -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