Commit bade52b9 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component - NCE Driver:

- Add log messages in subscriptions
- Code cleanup
parent b972041c
Loading
Loading
Loading
Loading
+6 −10
Original line number Diff line number Diff line
@@ -51,13 +51,6 @@ class SubscriptionHandler:
    def __init__(self, rest_conf_client : RestConfClient) -> None:
        self._rest_conf_client = rest_conf_client

        self._url_qos_profile = '/huawei-nce-app-flow:qos-profiles'
        self._url_qos_profile_item = self._url_qos_profile + '/qos-profile={:s}'

        self._url_app_flow = '/huawei-nce-app-flow:app-flows'
        self._url_app_flow_item = self._url_app_flow + '/app-flow={:s}'


    def subscribe(
        self, subscription_data : SubscribedNotificationsSchema
    ) -> SubscriptionId:
@@ -66,12 +59,13 @@ class SubscriptionHandler:
        try:
            url = '/subscriptions:establish-subscription'
            LOGGER.debug('Subscribing to telemetry: {:s}'.format(str(subscription_data)))
            return self._rest_conf_client.rpc(url, json=subscription_data)
            reply = self._rest_conf_client.rpc(url, json=subscription_data)
            LOGGER.debug('Subscription reply: {:s}'.format(str(reply)))
            return reply
        except requests.exceptions.ConnectionError as e:
            MSG = 'Failed to send RPC request'
            raise Exception(MSG) from e


    def unsubscribe(
        self, unsubscription_data : UnsubscribedNotificationsSchema
    ) -> SubscriptionId:
@@ -80,7 +74,9 @@ class SubscriptionHandler:
        try:
            url = '/subscriptions:delete-subscription'
            LOGGER.debug('Unsubscribing from telemetry: {:s}'.format(str(unsubscription_data)))
            return self._rest_conf_client.rpc(url, json=unsubscription_data)
            reply = self._rest_conf_client.rpc(url, json=unsubscription_data)
            LOGGER.debug('Unsubscription reply: {:s}'.format(str(reply)))
            return reply
        except requests.exceptions.ConnectionError as e:
            MSG = 'Failed to send RPC request'
            raise Exception(MSG) from e