Commit 59ccaf20 authored by Lluis Gifre Renom's avatar Lluis Gifre Renom
Browse files

Device component - NCE Driver:

- Use PUT instead of POST to prevent already exists error
parent fa7269f0
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
@@ -50,7 +50,7 @@ class AppFlowHandler:
                qos_profile_name = qos_profile['name']
                LOGGER.info('Creating QoS Profile: {:s}'.format(str(request)))
                url = self._url_qos_profile_item.format(qos_profile_name)
                self._rest_conf_client.post(url, body=request)
                self._rest_conf_client.put(url, body=request)

            applications = (
                data
@@ -63,7 +63,7 @@ class AppFlowHandler:
                application_name = application['name']
                LOGGER.info('Creating Application: {:s}'.format(str(request)))
                url = self._url_application_item.format(application_name)
                self._rest_conf_client.post(url, body=request)
                self._rest_conf_client.put(url, body=request)

            app_flows = (
                data
@@ -75,10 +75,10 @@ class AppFlowHandler:
                app_flow_name = app_flow['name']
                LOGGER.info('Creating App Flow: {:s}'.format(str(request)))
                url = self._url_app_flow_item.format(app_flow_name)
                self._rest_conf_client.post(url, body=request)
                self._rest_conf_client.put(url, body=request)

        except requests.exceptions.ConnectionError as e:
            MSG = 'Failed to send POST requests to NCE FAN NBI'
            MSG = 'Failed to send PUT requests to NCE FAN NBI'
            raise Exception(MSG) from e