diff options
author | sebdet <sebastien.determe@intl.att.com> | 2021-03-22 18:55:46 +0100 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2021-04-01 16:53:14 +0200 |
commit | ee233569e74e4620cb35ce4e9c4320b30d108824 (patch) | |
tree | 5c0dbbbe575381d9696ae3f6cf841bea499c0254 /src/main/resources/clds | |
parent | 1da36e7c13bc7efac7bdd8425cede0e69d3f1335 (diff) |
Rework the backend to support PDP updates
Add new mem structure so that we do not need to parse the same Json for each policy/type + rework the camel flows so that we use the same code for loop and policies related calls
Issue-ID: POLICY-2930
Issue-ID: POLICY-2931
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I3c30c4f87cf669b40511472d518fe5ccc89f56f0
Diffstat (limited to 'src/main/resources/clds')
-rw-r--r-- | src/main/resources/clds/camel/rest/clamp-api-v2.xml | 4 | ||||
-rw-r--r-- | src/main/resources/clds/camel/routes/policy-flows.xml | 67 |
2 files changed, 42 insertions, 29 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 7de2de1c9..de0bb1ab0 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -437,7 +437,7 @@ <to uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLog('RESTART request','INFO',${exchangeProperty[loopObject]})"/> - <to uri="direct:add-all-to-active-pdp-group"/> + <to uri="direct:add-policies-from-loop-to-pdp-group"/> <log loggingLevel="INFO" message="RESTART request successfully executed for loop: ${header.loopName}"/> <to @@ -524,7 +524,7 @@ <constant>3000</constant> </delay> - <to uri="direct:add-all-to-active-pdp-group"/> + <to uri="direct:add-policies-from-loop-to-pdp-group"/> <log loggingLevel="INFO" message="SUBMIT request successfully executed for loop: ${header.loopName}"/> diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml index c92617856..cc51a086e 100644 --- a/src/main/resources/clds/camel/routes/policy-flows.xml +++ b/src/main/resources/clds/camel/routes/policy-flows.xml @@ -208,8 +208,8 @@ </doTry> </route> - <route id="add-all-to-active-pdp-group"> - <from uri="direct:add-all-to-active-pdp-group"/> + <route id="add-policies-from-loop-to-pdp-group"> + <from uri="direct:add-policies-from-loop-to-pdp-group"/> <doTry> <log loggingLevel="INFO" message="Adding loop policies to PDP Group: ${exchangeProperty[loopObject].getName()}"/> @@ -220,31 +220,8 @@ ${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject],"POST")} </simple> </setBody> - <setHeader headerName="CamelHttpMethod"> - <constant>POST</constant> - </setHeader> - <setHeader headerName="Content-Type"> - <constant>application/json</constant> - </setHeader> - <setHeader headerName="X-ONAP-RequestID"> - <simple>${exchangeProperty[X-ONAP-RequestID]} - </simple> - </setHeader> - <setHeader headerName="X-ONAP-InvocationID"> - <simple>${exchangeProperty[X-ONAP-InvocationID]} - </simple> - </setHeader> - <setHeader headerName="X-ONAP-PartnerName"> - <simple>${exchangeProperty[X-ONAP-PartnerName]} - </simple> - </setHeader> - <log loggingLevel="INFO" - message="Endpoint to add policies to PDP Group: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/deployments/batch"></log> - <toD - uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/deployments/batch?bridgeEndpoint=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&useSystemProperties=true&authUsername={{clamp.config.policy.pap.userName}}&authPassword={{clamp.config.policy.pap.password}}&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> - + <to uri="direct:add-multiple-policies-to-pdp-group"/> <doFinally> - <to uri="direct:reset-raise-http-exception-flag"/> <to uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/> <setProperty propertyName="logMessage"> @@ -486,7 +463,43 @@ </doFinally> </doTry> </route> - + <route id="add-multiple-policies-to-pdp-group"> + <from uri="direct:add-multiple-policies-to-pdp-group"/> + <!-- Body should come from outside, expect a json describing the policy --> + <doTry> + <log loggingLevel="INFO" + message="Add policies to PDP group"/> + <to + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Add policies to PDP group')"/> + <setHeader headerName="CamelHttpMethod"> + <constant>POST</constant> + </setHeader> + <setHeader headerName="Content-Type"> + <constant>application/json</constant> + </setHeader> + <setHeader headerName="X-ONAP-RequestID"> + <simple>${exchangeProperty[X-ONAP-RequestID]} + </simple> + </setHeader> + <setHeader headerName="X-ONAP-InvocationID"> + <simple>${exchangeProperty[X-ONAP-InvocationID]} + </simple> + </setHeader> + <setHeader headerName="X-ONAP-PartnerName"> + <simple>${exchangeProperty[X-ONAP-PartnerName]} + </simple> + </setHeader> + <log loggingLevel="INFO" + message="Endpoint to add policies to PDP Group: {{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/deployments/batch"></log> + <toD + uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/deployments/batch?bridgeEndpoint=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&useSystemProperties=true&authUsername={{clamp.config.policy.pap.userName}}&authPassword={{clamp.config.policy.pap.password}}&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> + <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="undeploy-one-policy-from-pap"> <from uri="direct:undeploy-one-policy-from-pap"/> <doTry> |