Commit 150b2ce5 authored by Pedro Duarte's avatar Pedro Duarte
Browse files

accept gnmi connections via PROTO

parent 82ac4c4e
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -38,6 +38,7 @@ class GnmiSessionHandler:
        self._username  = settings.get('username')
        self._password  = settings.get('password')
        self._use_tls   = settings.get('use_tls', False)
        self._encoding = settings.get('encoding')
        self._channel : Optional[grpc.Channel] = None
        self._stub : Optional[gNMIStub] = None
        self._monit_thread = None
@@ -90,7 +91,7 @@ class GnmiSessionHandler:

        get_request = GetRequest()
        get_request.type = GetRequest.DataType.ALL
        get_request.encoding = Encoding.JSON_IETF
        get_request.encoding = get_request.encoding = Encoding.Value(self._encoding) if self._encoding else Encoding.JSON_IETF
        #get_request.use_models.add() # kept empty: return for all models supported
        for i,resource_key in enumerate(resource_keys):
            str_resource_name = 'resource_key[#{:d}]'.format(i)
+2 −2
Original line number Diff line number Diff line
@@ -44,6 +44,6 @@ def check_capabilities(
    if len(supported_encodings) == 0:
        # pylint: disable=broad-exception-raised
        raise Exception('No supported encodings found')
    if 'JSON_IETF' not in supported_encodings:
    if len({'JSON_IETF', 'PROTO'}.intersection(supported_encodings)) == 0:
        # pylint: disable=broad-exception-raised
        raise Exception('JSON_IETF encoding not supported')
        raise Exception('JSON_IETF or PROTO encodings not supported')