aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/resources/clds/camel/rest
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources/clds/camel/rest')
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml103
1 files changed, 101 insertions, 2 deletions
diff --git a/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
index 4c1cd812..4d3c6b38 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -206,7 +206,30 @@
<to
uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
<to
- uri="bean:org.onap.clamp.operation.LoopOperation?method=deployLoop(*,${header.loopName})" />
+ 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>
+ <choice>
+ <when>
+ <simple> ${exchangeProperty[policyStatus]} == 'SUBMITTED' and
+ ${exchangeProperty[dcaeStatus]} == 'NOT_DEPLOYED'
+ </simple>
+ <to
+ uri="direct:deploy-closedloop" />
+ </when>
+ <otherwise>
+ <log
+ loggingLevel="INFO"
+ message="Closed Loop is in state ${exchangeProperty[policyStatus]}, it can only be deployed when in state SUBMIT" />
+ <to
+ 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>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
<doCatch>
@@ -216,6 +239,11 @@
</handled>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ <log
+ loggingLevel="ERROR"
+ 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]})" />
</doCatch>
</doTry>
</route>
@@ -234,7 +262,24 @@
<to
uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
<to
- uri="bean:org.onap.clamp.operation.LoopOperation?method=unDeployLoop(${header.loopName})" />
+ uri="direct:load-loop" />
+ <to
+ uri="direct:get-status-from-dcae" />
+ <choice>
+ <when>
+ <simple> ${exchangeProperty[dcaeStatus]} == 'DEPLOYED'
+ </simple>
+ <to
+ uri="direct:undeploy-closedloop" />
+ </when>
+ <otherwise>
+ <log
+ loggingLevel="INFO"
+ message="Closed Loop is in state ${exchangeProperty[dcaeStatus]}, it can only be undeployed when in state DEPLOYED" />
+ <to
+ 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>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
<doCatch>
@@ -244,6 +289,11 @@
</handled>
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ <log
+ loggingLevel="ERROR"
+ 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]})" />
</doCatch>
</doTry>
</route>
@@ -526,5 +576,54 @@
</doTry>
</route>
</put>
+ <get
+ uri="/v2/loop/getstatus/{loopName}"
+ outType="org.onap.clamp.loop.Loop"
+ produces="application/json">
+ <route>
+ <removeHeaders pattern="*" excludePattern="loopName"/>
+ <doTry>
+ <log
+ loggingLevel="INFO"
+ message="Get current status for loop: ${header.loopName}" />
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get the closed loop status')" />
+ <to
+ uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
+ <to uri="direct:load-loop" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Receive GET STATUS request','INFO',${exchangeProperty[loopObject]})" />
+ <setProperty propertyName="raiseHttpExceptionFlag">
+ <simple resultType="java.lang.Boolean">false</simple>
+ </setProperty>
+ <to uri="direct:get-status-from-policy" />
+ <to uri="direct:get-status-from-dcae" />
+ <to
+ uri="bean:org.onap.clamp.loop.LoopOperation?method=updateLoopStatus(${exchangeProperty[loopObject]},${exchangeProperty[policyStatus]}, ${exchangeProperty[dcaeStatus]})" />
+ <log
+ loggingLevel="INFO"
+ message="Get Status request successfully executed. The new state is: ${body}" />
+ <to
+ uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Get Status 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>
+ <exception>java.lang.Exception</exception>
+ <handled>
+ <constant>false</constant>
+ </handled>
+ <to
+ uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
+ <log
+ 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]})" />
+ </doCatch>
+ </doTry>
+ </route>
+ </get>
</rest>
</rests>