summaryrefslogtreecommitdiffstats
path: root/runtime/src/main
diff options
context:
space:
mode:
authorbrunomilitzer <bruno.militzer@est.tech>2022-05-05 15:20:30 +0100
committerbrunomilitzer <bruno.militzer@est.tech>2022-05-25 15:01:02 +0100
commitf35587328e1bd99882ed8a4df85d01660d54c007 (patch)
tree668b2e35b88a24dbf60ce84d62c21c463e2c0449 /runtime/src/main
parentb77b61847ddd169da9a71b05742ed51bc826f5f6 (diff)
Added Edit Instance Properties Functionality
Issue-ID: POLICY-4094 Change-Id: Id52dba3c0912486fa551697be170c05542a0ee22 Signed-off-by: brunomilitzer <bruno.militzer@est.tech>
Diffstat (limited to 'runtime/src/main')
-rw-r--r--runtime/src/main/resources/clds/camel/rest/clamp-api-v2.xml50
-rw-r--r--runtime/src/main/resources/clds/camel/routes/acm-flows.xml81
2 files changed, 126 insertions, 5 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 8ad20a844..7db468024 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
@@ -1480,7 +1480,7 @@
produces="application/json">
<route>
<removeHeaders pattern="*"
- excludePattern="name|version"/>
+ excludePattern="name|version|instanceName"/>
<doTry>
<to
uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET Tosca Service Template ')"/>
@@ -1860,6 +1860,50 @@
</doTry>
</route>
</post>
+
+ <put uri="/v2/acm/putToscaInstanceProperties"
+ type="java.lang.String"
+ consumes="plain/text"
+ outType="java.lang.String"
+ produces="application/json"
+ bindingMode="off">
+ <route>
+ <removeHeaders pattern="*" excludePattern="name|version"/>
+ <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:put-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="Updating Instance Properties FAILED"/>
+
+ <setHeader name="CamelHttpResponseCode">
+ <constant>500</constant>
+ </setHeader>
+ <setBody>
+ <simple>Updating Instance Properties FAILED</simple>
+ </setBody>
+ </doCatch>
+ </doTry>
+ </route>
+ </put>
+
<delete uri="/v2/acm/deleteToscaInstanceProperties"
type="java.lang.String"
consumes="plain/text"
@@ -1907,7 +1951,7 @@
<get uri="/v2/acm/getCommonOrInstanceProperties" outType="java.lang.String" bindingMode="off" produces="application/json">
<route>
<removeHeaders pattern="*"
- excludePattern="name|version|requestId|common"/>
+ excludePattern="name|version|instanceName|requestId|common"/>
<doTry>
<to uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET Common Properties ')"/>
<to uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')"/>
@@ -1932,7 +1976,7 @@
<constant>500</constant>
</setHeader>
<setBody>
- <simple>GET Common Properties FAILED</simple>
+ <simple>GET Common or Instance Properties FAILED</simple>
</setBody>
</doCatch>
</doTry>
diff --git a/runtime/src/main/resources/clds/camel/routes/acm-flows.xml b/runtime/src/main/resources/clds/camel/routes/acm-flows.xml
index c304c5360..9150a2335 100644
--- a/runtime/src/main/resources/clds/camel/routes/acm-flows.xml
+++ b/runtime/src/main/resources/clds/camel/routes/acm-flows.xml
@@ -18,9 +18,12 @@
<setProperty name="version">
<simple>${header.version}</simple>
</setProperty>
+ <setProperty name="instanceName">
+ <simple>${header.instanceName}</simple>
+ </setProperty>
<log loggingLevel="INFO"
message="Endpoint to get Tosca Service Template: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/toscaservicetemplate"></log>
- <toD uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/toscaservicetemplate?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ <toD uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/toscaservicetemplate?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;instanceName=${exchangeProperty[instanceName]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>
@@ -166,6 +169,37 @@
</doFinally>
</doTry>
</route>
+ <route id="put-tosca-instance-properties">
+ <from uri="direct:put-tosca-instance-properties"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Updating the tosca instance properties"/>
+ <to
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Updating the tosca instance properties')"/>
+ <setHeader name="CamelHttpMethod">
+ <constant>PUT</constant>
+ </setHeader>
+ <setHeader name="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setProperty name="name">
+ <simple>${header.name}</simple>
+ </setProperty>
+ <setProperty name="version">
+ <simple>${header.version}</simple>
+ </setProperty>
+ <log loggingLevel="INFO"
+ message="Endpoint to send Tosca Instance Properties: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instanceProperties"></log>
+ <toD
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/instanceProperties?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.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="delete-tosca-instance-properties">
<from uri="direct:delete-tosca-instance-properties"/>
<doTry>
@@ -369,13 +403,56 @@
<setHeader name="Content-Type">
<constant>application/json</constant>
</setHeader>
+ <setProperty name="name">
+ <simple>${header.name}</simple>
+ </setProperty>
+ <setProperty name="version">
+ <simple>${header.version}</simple>
+ </setProperty>
+ <setProperty name="instanceName">
+ <simple>${header.instanceName}</simple>
+ </setProperty>
<setProperty name="common">
<simple>${header.common}</simple>
</setProperty>
<log loggingLevel="INFO"
message="Endpoint to get Common Or Instance Properties: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/getCommonOrInstanceProperties"></log>
<toD
- uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/getCommonOrInstanceProperties?common=${exchangeProperty[common]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/getCommonOrInstanceProperties?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;instanceName=${exchangeProperty[instanceName]}&amp;common=${exchangeProperty[common]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.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="get-saved-instance-name-instance-properties">
+ <from uri="direct:get-saved-instance-name-instance-properties"/>
+ <doTry>
+ <log loggingLevel="INFO"
+ message="Getting Common Or Instance Properties"/>
+ <to
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('AutomationComposition', 'Getting Saved Instance Name Instance Properties')"/>
+ <setHeader name="CamelHttpMethod">
+ <constant>GET</constant>
+ </setHeader>
+ <setHeader name="Content-Type">
+ <constant>application/json</constant>
+ </setHeader>
+ <setProperty name="name">
+ <simple>${header.name}</simple>
+ </setProperty>
+ <setProperty name="version">
+ <simple>${header.version}</simple>
+ </setProperty>
+ <setProperty name="instanceName">
+ <simple>${header.instanceName}</simple>
+ </setProperty>
+ <log loggingLevel="INFO"
+ message="Endpoint to get Common Or Instance Properties: {{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/getSavedInstanceNameInstanceProperties"></log>
+ <toD
+ uri="{{clamp.config.acm.runtime.url}}/onap/policy/clamp/acm/v2/commission/getSavedInstanceNameInstanceProperties?name=${exchangeProperty[name]}&amp;version=${exchangeProperty[version]}&amp;instanceName=${exchangeProperty[instanceName]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.acm.runtime.userName}}&amp;authPassword={{clamp.config.acm.runtime.password}}&amp;authenticationPreemptive=true&amp;connectionClose=true"/>
<convertBodyTo type="java.lang.String"/>
<doFinally>
<to uri="direct:reset-raise-http-exception-flag"/>