From a0a3a03686a386bf6def6f7da6de4d3f6a11ce61 Mon Sep 17 00:00:00 2001 From: sebdet Date: Tue, 16 Feb 2021 14:53:43 +0100 Subject: Introduce a new endpoint to create policy One first part of the update is to create a policy version from an existing one (this is similar as the create new policy). The policy-flow.xml has been refactored so that the same policy query is done for policies and loop related flows. A code has been added to remove fields from the UI that could be present (the PDP group info json enrichment) Issue-ID: POLICY-2926 Signed-off-by: sebdet Change-Id: Ia60c656a9b5100296042d3346d5c97c8dad5d041 --- .../resources/clds/camel/rest/clamp-api-v2.xml | 54 +++- .../resources/clds/camel/routes/policy-flows.xml | 296 ++++++++++++--------- 2 files changed, 223 insertions(+), 127 deletions(-) (limited to 'src/main/resources') 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 7ca4f081e..bcad3ea33 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -1316,7 +1316,9 @@ - + + + @@ -1347,17 +1349,63 @@ + message="GET Policies list JSON request failed: ${exception.stacktrace}"/> 500 - GET Policy model YAML FAILED + GET Policies list JSON FAILED + + + + + + + + + + + + ${header.policyModelName} + + + ${header.policyModelVersion} + + + + + + + + java.lang.Exception + + true + + + + + 500 + + + CREATE Policy FAILED + + + + + + + message="GET policy request FAILED for loop: ${header.loopName}, ${exception.stacktrace}"/> + uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLog('GET policy request failed, Error reported: ${exception.message}','ERROR',${exchangeProperty[loopObject]})"/> @@ -117,9 +117,9 @@ + message="GET policy request FAILED for loop: ${header.loopName}, ${exception.stacktrace}"/> + uri="bean:org.onap.policy.clamp.loop.log.LoopLogService?method=addLog('GET policy request failed, Error reported: ${exception.message}','ERROR',${exchangeProperty[loopObject]})"/> @@ -137,108 +137,26 @@ - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - - - - - - - - GET - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - - - - - - - - - - + + + + message="Creating Policy from loop object: ${exchangeProperty[policy].getName()}"/> + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Creating Policy from loop object')"/> ${exchangeProperty[policy].createPolicyPayload()} - - POST - - - application/json - - - ${exchangeProperty[X-ONAP-RequestID]} - - - - ${exchangeProperty[X-ONAP-InvocationID]} - - - - ${exchangeProperty[X-ONAP-PartnerName]} - - - - + + ${exchangeProperty[policy].getPolicyModel().getPolicyModelType()} + + + ${exchangeProperty[policy].getPolicyModel().getVersion()} + + - @@ -303,6 +221,7 @@ + @@ -402,6 +321,116 @@ + + + + + + + + 1.0.0 + + + + ${exchangeProperty[policyName]} PDP Group removal status + + + + POLICY + + + + java.lang.Exception + + false + + + PDP Group removal, Error reported: ${exception} + + + POLICY + + + + + + + + + + + + + + + + + GET + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + + + + + + + + + + + + + + + + GET + + + ${exchangeProperty[X-ONAP-RequestID]} + + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + + + + + + + + + + @@ -436,6 +465,7 @@ + @@ -470,13 +500,14 @@ - - + + + + message="Undeploy POLICY from PAP: ${exchangeProperty[policyName]}/${exchangeProperty[policyVersion]}"/> + uri="bean:org.onap.policy.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Undeploy POLICY from PAP')"/> null @@ -496,30 +527,47 @@ + message="Endpoint to delete policy from PDP Group: {{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}"> - - ${exchangeProperty[policyName]} PDP Group removal status + uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.policy.pap.userName}}&authPassword={{clamp.config.policy.pap.password}}&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> + + + + + + + + + + + + + + + POST + + + application/json + + + ${exchangeProperty[X-ONAP-RequestID]} - - - POLICY - - - - java.lang.Exception - - false - - - PDP Group removal, Error reported: ${exception} - - - POLICY - - - + + + ${exchangeProperty[X-ONAP-InvocationID]} + + + + ${exchangeProperty[X-ONAP-PartnerName]} + + + +