Commit 30753efd authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component - NCE Driver:

- Fixed AppFlow RESTCONF POST calls
- Added log messages
parent 12e0fb59
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -179,7 +179,7 @@ class NCEDriver(_Driver):
        if len(resources) == 0: return results
        with self.__lock:
            for resource in resources:
                LOGGER.info('resource = {:s}'.format(str(resource)))
                LOGGER.info('[SetConfig] resource = {:s}'.format(str(resource)))
                resource_key, resource_value = resource
                if not RE_NCE_APP_FLOW_DATA.match(resource_key):
                    continue
@@ -199,7 +199,7 @@ class NCEDriver(_Driver):
        if len(resources) == 0: return results
        with self.__lock:
            for resource in resources:
                LOGGER.info('resource = {:s}'.format(str(resource)))
                LOGGER.info('[DeleteConfig] resource = {:s}'.format(str(resource)))
                resource_key, resource_value = resource
                if not RE_NCE_APP_FLOW_DATA.match(resource_key):
                    continue
+9 −3
Original line number Diff line number Diff line
@@ -47,8 +47,10 @@ class AppFlowHandler:
            )
            for qos_profile in qos_profiles:
                request = {'huawei-nce-app-flow:qos-profiles': {'qos-profile': qos_profile}}
                qos_profile_name = qos_profile['name']
                LOGGER.info('Creating QoS Profile: {:s}'.format(str(request)))
                self._rest_conf_client.post(self._url_qos_profile, body=request)
                url = self._url_qos_profile_item.format(qos_profile_name)
                self._rest_conf_client.post(url, body=request)

            applications = (
                data
@@ -58,8 +60,10 @@ class AppFlowHandler:
            )
            for application in applications:
                request = {'huawei-nce-app-flow:applications': {'application': application}}
                application_name = application['name']
                LOGGER.info('Creating Application: {:s}'.format(str(request)))
                self._rest_conf_client.post(self._url_application, body=request)
                url = self._url_application_item.format(application_name)
                self._rest_conf_client.post(url, body=request)

            app_flows = (
                data
@@ -68,8 +72,10 @@ class AppFlowHandler:
            )
            for app_flow in app_flows:
                request = {'huawei-nce-app-flow:app-flows': {'app-flow': app_flow}}
                app_flow_name = app_flow['name']
                LOGGER.info('Creating App Flow: {:s}'.format(str(request)))
                self._rest_conf_client.post(self._url_app_flow, body=request)
                url = self._url_app_flow_item.format(app_flow_name)
                self._rest_conf_client.post(url, body=request)

        except requests.exceptions.ConnectionError as e:
            MSG = 'Failed to send POST requests to NCE FAN NBI'