diff options
author | saul.gill <saul.gill@est.tech> | 2021-06-17 16:28:22 +0100 |
---|---|---|
committer | saul.gill <saul.gill@est.tech> | 2021-06-17 16:28:30 +0100 |
commit | 0f1803780d61b8174bce4914044f5ee5d9a0ff42 (patch) | |
tree | 13d3136f6ea7b97e8b0ddf7cba180299f46a2d7a /runtime/src/main/resources/clds | |
parent | 17f5d3c97e47064407452122bc6cb801e43df5f9 (diff) |
Added Camel Endpoint for Tosca Template Upload
Endpoint redirects a POST to runtime commissiong API
Tosca Service Template is written to the database
Issue-ID: POLICY-3222
Change-Id: I9ca6b0b3fdbef4bf9a182795112de5280ec7f9ff
Signed-off-by: saul.gill <saul.gill@est.tech>
Diffstat (limited to 'runtime/src/main/resources/clds')
-rw-r--r-- | runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml | 46 | ||||
-rw-r--r-- | runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml | 22 |
2 files changed, 67 insertions, 1 deletions
diff --git a/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml b/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml index 6a5da8710..5fd242282 100644 --- a/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -1461,7 +1461,8 @@ </route> </post> - <get uri="/v2/toscaControlLoop/getToscaTemplate" outType="java.lang.String" bindingMode="off" produces="application/json"> + <get uri="/v2/toscaControlLoop/getToscaTemplate" outType="java.lang.String" bindingMode="off" + produces="application/json"> <route> <removeHeaders pattern="*" excludePattern="name|version"/> @@ -1499,6 +1500,49 @@ </route> </get> + <post uri="/v2/toscaControlLoop/commissionToscaTemplate" + type="java.lang.String" + consumes="plain/text" + outType="java.lang.String" + produces="application/json" + bindingMode="off"> + <route> + <removeHeaders pattern="*"/> + <setProperty name="raiseHttpExceptionFlag"> + <simple resultType="java.lang.Boolean">true</simple> + </setProperty> + <setHeader name="Content-Type"> + <constant>application/json</constant> + </setHeader> + <doTry> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update the global properties')"/> + <to + uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')"/> + <to uri="direct:commission-service-template"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=endLog()"/> + <doCatch> + <exception>java.lang.Exception</exception> + <handled> + <constant>true</constant> + </handled> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=errorLog()"/> + <log loggingLevel="ERROR" + message="Commissioning of Tosca Service Template FAILED"/> + + <setHeader name="CamelHttpResponseCode"> + <constant>500</constant> + </setHeader> + <setBody> + <simple>Commissioning Tosca Service Template FAILED</simple> + </setBody> + </doCatch> + </doTry> + </route> + </post> + <get uri="/v2/clampInformation" outType="org.onap.policy.clamp.clds.model.ClampInformation" produces="application/json"> <route> diff --git a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml b/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml index b1fad103b..0641b326e 100644 --- a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml +++ b/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml @@ -30,4 +30,26 @@ </doFinally> </doTry> </route> + <route id="commission-service-template"> + <from uri="direct:commission-service-template"/> + <doTry> + <log loggingLevel="INFO" + message="Commissioning the tosca service template"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Controlloop', 'Commissioning the tosca service template')"/> + <setHeader name="CamelHttpMethod"> + <constant>POST</constant> + </setHeader> + <log loggingLevel="INFO" + message="Endpoint to send Tosca Service Template: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission"></log> + <toD + uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/commission?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.controlloop.runtime.userName}}&authPassword={{clamp.config.controlloop.runtime.password}}&authenticationPreemptive=true&connectionClose=true"/> + <convertBodyTo type="java.lang.String"/> + <doFinally> + <to uri="direct:reset-raise-http-exception-flag"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/> + </doFinally> + </doTry> + </route> </routes> |