aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/resources/clds/camel
diff options
context:
space:
mode:
authorsebdet <sebastien.determe@intl.att.com>2021-02-17 17:53:17 +0100
committersebdet <sebastien.determe@intl.att.com>2021-02-19 10:09:31 +0100
commitc427e6459d066859e6da068bf50c78a0d120080a (patch)
treeb3b63a7919175a3500f2c26eb02c7cd9a6475ce0 /src/main/resources/clds/camel
parenta0a3a03686a386bf6def6f7da6de4d3f6a11ce61 (diff)
Add code in UI to create new policy version
Add code to call the policy create backend endpoint + alert box to show status of the creation + Fix backend + Issue-ID: POLICY-2928 Signed-off-by: sebdet <sebastien.determe@intl.att.com> Change-Id: Ia8f2506ecc692ad68111ebe7a55a92579b951908
Diffstat (limited to 'src/main/resources/clds/camel')
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml212
1 files changed, 109 insertions, 103 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 bcad3ea33..f924a8a24 100644
--- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml
+++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml
@@ -803,6 +803,107 @@
</doTry>
</route>
</post>
+ <get uri="/v2/templates"
+ outType="org.onap.policy.clamp.loop.template.LoopTemplate"
+ produces="application/json">
+ <route>
+ <removeHeaders pattern="*"/>
+ <doTry>
+ <to
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Templates')"/>
+ <to
+ uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')"/>
+ <to
+ uri="bean:org.onap.policy.clamp.loop.template.LoopTemplatesService?method=getAllLoopTemplates()"/>
+ <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="GET ALL templates request failed: ${exception.stacktrace}"/>
+ <setHeader headerName="CamelHttpResponseCode">
+ <constant>500</constant>
+ </setHeader>
+ <setBody>
+ <simple>GET ALL templates FAILED</simple>
+ </setBody>
+ </doCatch>
+ </doTry>
+ </route>
+ </get>
+ <get uri="/v2/templates/{templateName}"
+ outType="org.onap.policy.clamp.loop.template.LoopTemplate"
+ produces="application/json">
+ <route>
+ <removeHeaders pattern="*"
+ excludePattern="templateName"/>
+ <doTry>
+ <to
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET a Template by NAME')"/>
+ <to
+ uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')"/>
+ <to
+ uri="bean:org.onap.policy.clamp.loop.template.LoopTemplatesService?method=getLoopTemplate(${header.templateName})"/>
+ <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="GET Template request failed for template: ${header.templateName}, ${exception.stacktrace}"/>
+ <setHeader headerName="CamelHttpResponseCode">
+ <constant>500</constant>
+ </setHeader>
+ <setBody>
+ <simple>GET Template FAILED</simple>
+ </setBody>
+ </doCatch>
+ </doTry>
+ </route>
+ </get>
+ <get uri="/v2/templates/names" outType="java.lang.String[]"
+ produces="application/json">
+ <route>
+ <removeHeaders pattern="*"/>
+ <doTry>
+ <to
+ uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Loop Template Names')"/>
+ <to
+ uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')"/>
+ <to
+ uri="bean:org.onap.policy.clamp.loop.template.LoopTemplatesService?method=getLoopTemplateNames()"/>
+ <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="GET All Template names request failed for template: ${exception.stacktrace}"/>
+ <setHeader headerName="CamelHttpResponseCode">
+ <constant>500</constant>
+ </setHeader>
+ <setBody>
+ <simple>GET All Template names FAILED</simple>
+ </setBody>
+ </doCatch>
+ </doTry>
+ </route>
+ </get>
+
+ <!-- NON LOOP related endpoints -->
<get uri="/v2/dictionary"
outType="org.onap.policy.clamp.tosca.Dictionary" produces="application/json">
<route>
@@ -1217,106 +1318,6 @@
</route>
</put>
- <get uri="/v2/templates"
- outType="org.onap.policy.clamp.loop.template.LoopTemplate"
- produces="application/json">
- <route>
- <removeHeaders pattern="*"/>
- <doTry>
- <to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Templates')"/>
- <to
- uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')"/>
- <to
- uri="bean:org.onap.policy.clamp.loop.template.LoopTemplatesService?method=getAllLoopTemplates()"/>
- <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="GET ALL templates request failed: ${exception.stacktrace}"/>
- <setHeader headerName="CamelHttpResponseCode">
- <constant>500</constant>
- </setHeader>
- <setBody>
- <simple>GET ALL templates FAILED</simple>
- </setBody>
- </doCatch>
- </doTry>
- </route>
- </get>
- <get uri="/v2/templates/{templateName}"
- outType="org.onap.policy.clamp.loop.template.LoopTemplate"
- produces="application/json">
- <route>
- <removeHeaders pattern="*"
- excludePattern="templateName"/>
- <doTry>
- <to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET a Template by NAME')"/>
- <to
- uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')"/>
- <to
- uri="bean:org.onap.policy.clamp.loop.template.LoopTemplatesService?method=getLoopTemplate(${header.templateName})"/>
- <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="GET Template request failed for template: ${header.templateName}, ${exception.stacktrace}"/>
- <setHeader headerName="CamelHttpResponseCode">
- <constant>500</constant>
- </setHeader>
- <setBody>
- <simple>GET Template FAILED</simple>
- </setBody>
- </doCatch>
- </doTry>
- </route>
- </get>
- <get uri="/v2/templates/names" outType="java.lang.String[]"
- produces="application/json">
- <route>
- <removeHeaders pattern="*"/>
- <doTry>
- <to
- uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Loop Template Names')"/>
- <to
- uri="bean:org.onap.policy.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')"/>
- <to
- uri="bean:org.onap.policy.clamp.loop.template.LoopTemplatesService?method=getLoopTemplateNames()"/>
- <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="GET All Template names request failed for template: ${exception.stacktrace}"/>
- <setHeader headerName="CamelHttpResponseCode">
- <constant>500</constant>
- </setHeader>
- <setBody>
- <simple>GET All Template names FAILED</simple>
- </setBody>
- </doCatch>
- </doTry>
- </route>
- </get>
-
<!-- Policy Related endpoints, not related to LOOP -->
<get uri="/v2/policies" outType="com.google.gson.JsonObject" produces="application/json">
<route>
@@ -1360,11 +1361,13 @@
</doTry>
</route>
</get>
- <!-- Update an existing policy, therefore it removes it from pdp first, delete it and then recreate it -->
- <!-- TO BE DONE -->
<!-- Create a new policy -->
- <post uri="/v2/policies/{policyModelName}/{policyModelVersion}" outType="com.google.gson.JsonObject" produces="application/json">
+ <post uri="/v2/policies/{policyModelName}/{policyModelVersion}"
+ type="com.google.gson.JsonElement"
+ consumes="application/json"
+ outType="com.google.gson.JsonObject"
+ produces="application/json">
<route>
<removeHeaders pattern="*"
excludePattern="policyModelName|policyModelVersion"/>
@@ -1382,6 +1385,9 @@
<setBody>
<method ref="org.onap.policy.clamp.policy.pdpgroup.PoliciesPdpMerger"
method="removePdpStatesOnePolicy(${body})"/>
+ </setBody>
+ <setBody>
+ <simple>${body.toString()}</simple>
</setBody>
<to uri="direct:create-policy"/>
<to