aboutsummaryrefslogtreecommitdiffstats
path: root/runtime/src/main/resources
diff options
context:
space:
mode:
authorbrunomilitzer <bruno.militzer@est.tech>2021-07-28 16:58:45 +0100
committerBruno Militzer <bruno.militzer@est.tech>2021-08-23 13:00:57 +0000
commit784eb5b7c8b85c0d24403eff2f0b1d40e024e448 (patch)
tree97c309a2811510e11c689be976489f5b2d467530 /runtime/src/main/resources
parent172f990bd92e1441eca6dd161458efddb674b2fc (diff)
Add Create Instance Rest Endpoint
Added Camel Endpoint Will Apply Unit Tests on POLICY-3537, since focus is to get the functionalities completed. Issue-ID: POLICY-3436 Change-Id: I8305896b24c30fc0403c57b3925af983065a5ec2 Signed-off-by: brunomilitzer <bruno.militzer@est.tech>
Diffstat (limited to 'runtime/src/main/resources')
-rw-r--r--runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml45
-rw-r--r--runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml25
2 files changed, 69 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 2e71c58ca..f800efe8d 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
@@ -1553,7 +1553,7 @@
<removeHeaders pattern="*"
excludePattern="name|version|requestId"/>
<setProperty name="raiseHttpExceptionFlag">
- <simple resultType="java.lang.Boolean">true</simple>
+ <simple resultType="java.lang.Boolean">false</simple>
</setProperty>
<setHeader name="Content-Type">
<constant>application/json</constant>
@@ -1760,6 +1760,49 @@
</route>
</get>
+ <post uri="/v2/toscaControlLoop/postToscaInstanceProperties"
+ 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">false</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:post-tosca-instance-properties"/>
+ <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="Creating Instance Properties FAILED"/>
+
+ <setHeader name="CamelHttpResponseCode">
+ <constant>500</constant>
+ </setHeader>
+ <setBody>
+ <simple>Creating Instance Properties FAILED</simple>
+ </setBody>
+ </doCatch>
+ </doTry>
+ </route>
+ </post>
+
<get uri="/v2/toscaControlLoop/getCommonOrInstanceProperties" outType="java.lang.String" bindingMode="off" produces="application/json">
<route>
<removeHeaders pattern="*"
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 230aea142..12b43dd9f 100644
--- a/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml
+++ b/runtime/src/main/resources/clds/camel/routes/controlloop-flows.xml
@@ -110,6 +110,31 @@
</doFinally>
</doTry>
</route>
+ <route id="post-tosca-instance-properties">
+ <from uri="direct:post-tosca-instance-properties"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Creating the tosca instance properties"/>
+ <to
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Controlloop', 'Creating the tosca instance properties')"/>
+ <setHeader name="CamelHttpMethod">
+ <constant>POST</constant>
+ </setHeader>
+ <setHeader name="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <log loggingLevel="INFO"
+ message="Endpoint to send Tosca Instance Properties: {{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instanceProperties"></log>
+ <toD
+ uri="{{clamp.config.controlloop.runtime.url}}/onap/controlloop/v2/instanceProperties? bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.controlloop.runtime.userName}}&amp;authPassword={{clamp.config.controlloop.runtime.password}}&amp;authenticationPreemptive=true&amp;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>
<route id="post-tosca-instantiation">
<from uri="direct:post-tosca-instantiation"/>
<doTry>