Fix flows and error catching 45/87245/1
authorsebdet <sebastien.determe@intl.att.com>
Wed, 8 May 2019 13:36:55 +0000 (15:36 +0200)
committersebdet <sebastien.determe@intl.att.com>
Wed, 8 May 2019 13:36:55 +0000 (15:36 +0200)
Fix flows, remove getLoop at the end and add better error catching in
camel flows

Issue-ID: CLAMP-369
Change-Id: I473d63d9189daf69e1e4e6d025f06ac586a9f2ab
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
src/main/resources/clds/camel/rest/clamp-api-v2.xml
src/main/resources/clds/camel/routes/flexible-flow.xml

index 4d3c6b3..1883145 100644 (file)
                                        excludePattern="loopName" />
                                <doTry>
                                        <to
-                                               uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Deploy the closed loop')" />
+                                               uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'DEPLOY the closed loop')" />
                                        <to
                                                uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
-                                       <to
-                                               uri="direct:load-loop" />
-                                       <to
-                                               uri="direct:get-status-from-policy" />
-                                       <to
-                                               uri="direct:get-status-from-dcae" />
+                                       <to uri="direct:load-loop" />
+                                       <to uri="direct:get-status-from-policy" />
+                                       <to uri="direct:get-status-from-dcae" />
                                        <log
                                                loggingLevel="INFO"
-                                               message="policy status0000: ${exchangeProperty[policyStatus]}"></log>
+                                               message="Policy deployment status: ${exchangeProperty[policyStatus]}"></log>
                                        <choice>
                                                <when>
                                                        <simple> ${exchangeProperty[policyStatus]} == 'SUBMITTED' and
                                                                ${exchangeProperty[dcaeStatus]} == 'NOT_DEPLOYED'
                                                        </simple>
-                                                       <to
-                                                               uri="direct:deploy-closedloop" />
+                                                       <to uri="direct:deploy-closedloop" />
                                                </when>
                                                <otherwise>
                                                        <log
                                                                uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Closed Loop is in state ${exchangeProperty[policyStatus]}, it can only be deployed when in state SUBMIT','ERROR',${exchangeProperty[loopObject]})" />
                                                </otherwise>
                                        </choice>
+                                       <log
+                                               loggingLevel="INFO"
+                                               message="DEPLOY request successfully executed for loop: ${header.loopName}" />
+                                       <to
+                                               uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DEPLOY request successfully executed','INFO',${exchangeProperty[loopObject]})" />
                                        <to
                                                uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
                                        <doCatch>
                                                        uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
                                                <log
                                                        loggingLevel="ERROR"
-                                                       message="Deploy request failed for loop: ${header.loopName}" />
+                                                       message="DEPLOY request failed for loop: ${header.loopName}" />
                                                <to
-                                                       uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Deploy request failed','ERROR',${exchangeProperty[loopObject]})" />
+                                                       uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DEPLOY request failed, Error reported: ${exception}','ERROR',${exchangeProperty[loopObject]})" />
                                        </doCatch>
                                </doTry>
                        </route>
                                                uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Undeploy the closed loop')" />
                                        <to
                                                uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
-                                       <to
-                                               uri="direct:load-loop" />
-                                       <to 
-                                               uri="direct:get-status-from-dcae" />
+                                       <to uri="direct:load-loop" />
+                                       <to uri="direct:get-status-from-dcae" />
                                        <choice>
                                                <when>
                                                        <simple> ${exchangeProperty[dcaeStatus]} == 'DEPLOYED'
                                                        </simple>
-                                                       <to
-                                                               uri="direct:undeploy-closedloop" />
+                                                       <to uri="direct:undeploy-closedloop" />
                                                </when>
                                                <otherwise>
                                                        <log
                                                                uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Closed Loop is in state ${exchangeProperty[dcaeStatus]}, it can only be deployed when in state DEPLOYED','ERROR',${exchangeProperty[loopObject]})" />
                                                </otherwise>
                                        </choice>
+                                       <log
+                                               loggingLevel="INFO"
+                                               message="UNDEPLOY request successfully executed for loop: ${header.loopName}" />
+                                       <to
+                                               uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UNDEPLOY request successfully executed','INFO',${exchangeProperty[loopObject]})" />
                                        <to
                                                uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
                                        <doCatch>
                                                        uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
                                                <log
                                                        loggingLevel="ERROR"
-                                                       message="Undeploy request failed for loop: $${header.loopName}" />
+                                                       message="UNDEPLOY request failed for loop: ${header.loopName}" />
                                                <to
-                                                       uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Undeploy request failed','ERROR',${exchangeProperty[loopObject]})" />
+                                                       uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UNDEPLOY request failed, Error reported: ${exception}','ERROR',${exchangeProperty[loopObject]})" />
                                        </doCatch>
                                </doTry>
                        </route>
                                        <to uri="direct:remove-all-policy-from-active-pdp-group" />
                                        <log
                                                loggingLevel="INFO"
-                                               message="STOP request successfully executed for loop: ${body}" />
+                                               message="STOP request successfully executed for loop: ${header.loopName}" />
                                        <to
                                                uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request successfully executed','INFO',${exchangeProperty[loopObject]})" />
-                                       <to
-                                               uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
                                        <to
                                                uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
                                        <doCatch>
                                                message="START request successfully executed for loop: ${header.loopName}" />
                                        <to
                                                uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('START request successfully executed','INFO',${exchangeProperty[loopObject]})" />
-                                       <to
-                                               uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
                                        <to
                                                uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
                                        <doCatch>
                                                message="SUBMIT request successfully executed for loop: ${header.loopName}" />
                                        <to
                                                uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request successfully executed','INFO',${exchangeProperty[loopObject]})" />
-                                       <to
-                                               uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
                                        <to
                                                uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
                                        <doCatch>
                        outType="org.onap.clamp.loop.Loop"
                        produces="application/json">
                        <route>
-                               <removeHeaders pattern="*" excludePattern="loopName"/>
+                               <removeHeaders
+                                       pattern="*"
+                                       excludePattern="loopName" />
                                <doTry>
                                        <log
                                                loggingLevel="INFO"
                                                        loggingLevel="ERROR"
                                                        message="Get Status request failed for loop: ${header.loopName}" />
                                                <to
-                                                       uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request failed','ERROR',${exchangeProperty[loopObject]})" />
+                                                       uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status request failed, Error reported: ${exception}','ERROR',${exchangeProperty[loopObject]})" />
                                        </doCatch>
                                </doTry>
                        </route>
index 5f85777..43b231e 100644 (file)
                                message="Deploy the closed loop: ${exchangeProperty[loopObject].getName()}" />
                        <to
                                uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploy closed loop')" />
-                       <simple>${exchangeProperty[loopObject].getOperationalPolicies()}
-                       </simple>
-                       <setProperty propertyName="operationalPolicy">
-                               <simple>${body}</simple>
-                       </setProperty>
                        <setBody>
                                <method ref="org.onap.clamp.loop.LoopOperation"
                                        method="getDeployPayload(${exchangeProperty[loopObject]})" />