Fix delete instance in Design state 59/124759/1
authorsebdet <sebastien.determe@intl.att.com>
Fri, 8 Oct 2021 11:52:10 +0000 (13:52 +0200)
committersebdet <sebastien.determe@intl.att.com>
Fri, 8 Oct 2021 11:52:10 +0000 (13:52 +0200)
The "delete" flow should not crash when policies have not been deployed yet.
+ Fix DCAE logs (set to DCAe component)
+ Fix the STDOUT that should contain the error logs as requested by OOM team

Issue-ID: POLICY-3707
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I15951106280f4e781ee2f3140fa72a935d54f241

runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml
runtime/src/main/resources/clds/camel/routes/dcae-flows.xml
runtime/src/main/resources/logback-default.xml
runtime/ui-react/src/api/LoopActionService.js

index 55e1f8a..82e1940 100644 (file)
                     <to
                             uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLog('DELETE request','INFO',${exchangeProperty[loopObject]})"/>
                     <to uri="direct:undeploy-loop"/>
+                    <setProperty name="raiseHttpExceptionFlag">
+                        <simple resultType="java.lang.Boolean">false</simple>
+                    </setProperty>
                     <to uri="direct:remove-all-policy-from-active-pdp-group"/>
                     <log loggingLevel="INFO"
                          message="Deleting all MICRO-SERVICES policies defined in loop ${exchangeProperty[loopObject].getName()}"/>
                          message="DELETE request successfully executed for loop: ${header.loopName}"/>
                     <to
                             uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=endLog()"/>
+                    <setHeader name="CamelHttpResponseCode">
+                        <constant>200</constant>
+                    </setHeader>
+                    <setBody>
+                        <simple>DELETE request SUCCESSFUL</simple>
+                    </setBody>
                     <doCatch>
                         <exception>java.lang.Exception</exception>
                         <handled>
index d74bd91..517fb09 100644 (file)
             </when>
             <otherwise>
                 <log loggingLevel="WARN"
-                     message="Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !"/>
+                     message="Cannot Undeploy the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !"/>
                 <to
-                        uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLog('Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !','WARNING',${exchangeProperty[loopObject]})"/>
+                        uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLogForComponent('Cannot Undeploy the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !','WARNING','DCAE',${exchangeProperty[loopObject]})"/>
             </otherwise>
         </choice>
     </route>
                 <log loggingLevel="ERROR"
                      message="GET DCAE deployment request FAILED for loop: ${header.loopName}, ${exception.stacktrace}"/>
                 <to
-                        uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLog('GET DCAE deployment request failed, Error reported: ${exception.message}','ERROR',${exchangeProperty[loopObject]})"/>
+                        uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLogForComponent('GET DCAE deployment request failed, Error reported: ${exception.message}','ERROR','DCAE',${exchangeProperty[loopObject]})"/>
             </doCatch>
             <doFinally>
                 <to uri="direct:reset-raise-http-exception-flag"/>
index 443bc0e..cfa280c 100644 (file)
         <appender-ref ref="asyncAudit" />
         <appender-ref ref="asyncMetric" />
         <appender-ref ref="asyncSecurity" />
+        <appender-ref ref="STDOUT" />
     </root>
 </included>
index bff812a..18ae90e 100644 (file)
@@ -32,7 +32,7 @@ export default class LoopActionService{
                        })
                .then(function (response) {
                        if (response.ok) {
-                               return response.json();
+                               return response;
                        } else {
                                return Promise.reject("Perform action failed with code:" + response.status);
                        }