diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-04-15 00:43:20 +0200 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2020-04-15 00:43:20 +0200 |
commit | 3854d7c1008aa947e4b532bbef9d9efc738f6928 (patch) | |
tree | b7f370f60f47d5eac4750de7a113c08d8391a2c7 /src/main/resources | |
parent | 0f3c8ae745988969aca1f605635b291367ecd69d (diff) |
Fix legacy policy submit issues
Operational legacy policy does not support semantic versionin for get status and delete policies, it has to be changed to integer
Issue-ID: CLAMP-820
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Change-Id: I78ff69b7502900d96fcc605fe997dd564dfa3e98
Diffstat (limited to 'src/main/resources')
-rw-r--r-- | src/main/resources/clds/camel/routes/loop-flows.xml | 23 | ||||
-rw-r--r-- | src/main/resources/clds/camel/routes/policy-flows.xml | 322 |
2 files changed, 84 insertions, 261 deletions
diff --git a/src/main/resources/clds/camel/routes/loop-flows.xml b/src/main/resources/clds/camel/routes/loop-flows.xml index 8c22743a3..2f4d9c8cf 100644 --- a/src/main/resources/clds/camel/routes/loop-flows.xml +++ b/src/main/resources/clds/camel/routes/loop-flows.xml @@ -40,6 +40,9 @@ <setProperty propertyName="policyType"> <simple>${body.getPolicyModel().getPolicyModelType()}</simple> </setProperty> + <setProperty propertyName="policyTypeVersion"> + <simple>${body.getPolicyModel().getVersion()}</simple> + </setProperty> <setProperty propertyName="policyVersion"> <simple>1.0.0</simple> </setProperty> @@ -61,9 +64,22 @@ <setProperty propertyName="policyType"> <simple>${body.getPolicyModel().getPolicyModelType()}</simple> </setProperty> - <setProperty propertyName="policyVersion"> - <simple>1.0.0</simple> + <setProperty propertyName="policyTypeVersion"> + <simple>${body.getPolicyModel().getVersion()}</simple> </setProperty> + <choice> + <when> + <simple>${body.isLegacy()} == true</simple> + <setProperty propertyName="policyVersion"> + <simple>1</simple> + </setProperty> + </when> + <otherwise> + <setProperty propertyName="policyVersion"> + <simple>1.0.0</simple> + </setProperty> + </otherwise> + </choice> <setProperty propertyName="operationalPolicy"> <simple>${body}</simple> </setProperty> @@ -84,6 +100,9 @@ <setProperty propertyName="policyType"> <simple>onap.policies.controlloop.Guard</simple> </setProperty> + <setProperty propertyName="policyTypeVersion"> + <simple>1.0.0</simple> + </setProperty> <setProperty propertyName="policyVersion"> <simple>1</simple> </setProperty> diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml index 80926722f..a61bc67fb 100644 --- a/src/main/resources/clds/camel/routes/policy-flows.xml +++ b/src/main/resources/clds/camel/routes/policy-flows.xml @@ -54,9 +54,9 @@ </simple> </setHeader> <log loggingLevel="INFO" - message="Endpoint to get policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}"></log> + message="Endpoint to get policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/${exchangeProperty[policyTypeVersion]}/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}"></log> <toD - uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/1.0.0/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}?bridgeEndpoint=true&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policyType]}/versions/${exchangeProperty[policyTypeVersion]}/policies/${exchangeProperty[policyName]}/versions/${exchangeProperty[policyVersion]}?bridgeEndpoint=true&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> <doFinally> <to uri="direct:reset-raise-http-exception-flag"/> <to @@ -258,10 +258,23 @@ <simple>${exchangeProperty[X-ONAP-PartnerName]} </simple> </setHeader> + <choice> + <when> + <simple>${body.isLegacy()} == true</simple> + <setProperty propertyName="policyVersion"> + <simple>1</simple> + </setProperty> + </when> + <otherwise> + <setProperty propertyName="policyVersion"> + <simple>1.0.0</simple> + </setProperty> + </otherwise> + </choice> <log loggingLevel="INFO" - message="Endpoint to delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies/${exchangeProperty[policy].getName()}/versions/1.0.0"></log> + message="Endpoint to delete policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies/${exchangeProperty[policy].getName()}/versions/${exchangeProperty[policyVersion]}"></log> <toD - uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies/${exchangeProperty[policy].getName()}/versions/1.0.0?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&deleteWithBody=false&mapHttpMessageBody=false&mapHttpMessageFormUrlEncodedBody=false&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies/${exchangeProperty[policy].getName()}/versions/${exchangeProperty[policyVersion]}?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&deleteWithBody=false&mapHttpMessageBody=false&mapHttpMessageFormUrlEncodedBody=false&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> <doFinally> <to uri="direct:reset-raise-http-exception-flag"/> @@ -279,199 +292,6 @@ </doFinally> </doTry> </route> - <route id="create-micro-service-policy"> - <from uri="direct:create-micro-service-policy"/> - <doTry> - <log loggingLevel="INFO" - message="Creating Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}"/> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Micro Service Policy')"/> - <setBody> - <simple>${exchangeProperty[microServicePolicy].createPolicyPayload()} - </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 create microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getPolicyModel().getPolicyModelType()}/versions/1.0.0/policies"></log> - <toD - uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getPolicyModel().getPolicyModelType()}/versions/1.0.0/policies?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> - <doFinally> - <to uri="direct:reset-raise-http-exception-flag"/> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/> - <setProperty propertyName="logMessage"> - <simple>${exchangeProperty[microServicePolicy].getName()} creation - status - </simple> - </setProperty> - <setProperty propertyName="logComponent"> - <simple>POLICY</simple> - </setProperty> - <to uri="direct:dump-loop-log-http-response"/> - </doFinally> - </doTry> - </route> - - <route id="delete-micro-service-policy"> - <from uri="direct:delete-micro-service-policy"/> - <doTry> - <log loggingLevel="INFO" - message="Deleting Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}"/> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Micro Service Policy')"/> - <setBody> - <constant>null</constant> - </setBody> - <setHeader headerName="CamelHttpMethod"> - <constant>DELETE</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 delete microservice policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getPolicyModel().getPolicyModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0"></log> - <toD - uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[microServicePolicy].getPolicyModel().getPolicyModelType()}/versions/1.0.0/policies/${exchangeProperty[microServicePolicy].getName()}/versions/1.0.0?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&deleteWithBody=false&mapHttpMessageBody=false&mapHttpMessageFormUrlEncodedBody=false&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> - - <doFinally> - <to uri="direct:reset-raise-http-exception-flag"/> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/> - <setProperty propertyName="logMessage"> - <simple>${exchangeProperty[microServicePolicy].getName()} removal - status - </simple> - </setProperty> - <setProperty propertyName="logComponent"> - <simple>POLICY</simple> - </setProperty> - <to uri="direct:dump-loop-log-http-response"/> - </doFinally> - </doTry> - </route> - - <route id="create-operational-policy"> - <from uri="direct:create-operational-policy"/> - <doTry> - <log loggingLevel="INFO" - message="Creating Operational Policy: ${exchangeProperty[operationalPolicy].getName()}"/> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Operational Policy')"/> - <setBody> - <simple>${exchangeProperty[operationalPolicy].createPolicyPayload()} - </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 create operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies"></log> - <toD - uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> - <doFinally> - <to uri="direct:reset-raise-http-exception-flag"/> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/> - <setProperty propertyName="logMessage"> - <simple>${exchangeProperty[operationalPolicy].getName()} creation - status - </simple> - </setProperty> - <setProperty propertyName="logComponent"> - <simple>POLICY</simple> - </setProperty> - <to uri="direct:dump-loop-log-http-response"/> - </doFinally> - </doTry> - </route> - - <route id="delete-operational-policy"> - <from uri="direct:delete-operational-policy"/> - <doTry> - <log loggingLevel="INFO" - message="Deleting Operational Policy: ${exchangeProperty[operationalPolicy].getName()}"/> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Operational Policy')"/> - <setBody> - <constant>null</constant> - </setBody> - <setHeader headerName="CamelHttpMethod"> - <constant>DELETE</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 delete operational policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1"></log> - <toD - uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/onap.policies.controlloop.Operational/versions/1.0.0/policies/${exchangeProperty[operationalPolicy].getName()}/versions/1?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&deleteWithBody=false&mapHttpMessageBody=false&mapHttpMessageFormUrlEncodedBody=false&authUsername={{clamp.config.policy.api.userName}}&authPassword={{clamp.config.policy.api.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> - <doFinally> - <to uri="direct:reset-raise-http-exception-flag"/> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/> - <setProperty propertyName="logMessage"> - <simple>${exchangeProperty[operationalPolicy].getName()} removal - status - </simple> - </setProperty> - <setProperty propertyName="logComponent"> - <simple>POLICY</simple> - </setProperty> - <to uri="direct:dump-loop-log-http-response"/> - </doFinally> - </doTry> - </route> - <route id="create-guard-policy"> <from uri="direct:create-guard-policy"/> <doTry> @@ -575,7 +395,7 @@ <to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Add policies to PDP group')"/> <setBody> - <simple>${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject])} + <simple>${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject],"POST")} </simple> </setBody> <setHeader headerName="CamelHttpMethod"> @@ -618,67 +438,51 @@ <route id="remove-all-policy-from-active-pdp-group"> <from uri="direct:remove-all-policy-from-active-pdp-group"/> - <doTry> - <log loggingLevel="INFO" - message="Removing policies from active PDP group for loop: ${exchangeProperty[loopObject].getName()}"/> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Removing policies PDP group')"/> - <split> - <simple>${exchangeProperty[loopObject].getComponent("POLICY").listPolicyNamesPdpGroup(exchangeProperty[loopObject])} - </simple> - <setProperty propertyName="policyName"> - <simple>${body}</simple> - </setProperty> - <setBody> - <constant>null</constant> - </setBody> - <setHeader headerName="CamelHttpMethod"> - <constant>DELETE</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 delete policy from PDP Group: {{clamp.config.policy.pap.url}}/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0"></log> - <toD - uri="{{clamp.config.policy.pap.url}}/policy/pap/v1/pdps/policies/${exchangeProperty[policyName]}/versions/1.0.0?bridgeEndpoint=true&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.policy.pap.userName}}&authPassword={{clamp.config.policy.pap.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> - <setProperty propertyName="logMessage"> - <simple>${exchangeProperty[policyName]} PDP Group removal status - </simple> - </setProperty> - <setProperty propertyName="logComponent"> - <simple>POLICY</simple> - </setProperty> - <to uri="direct:dump-loop-log-http-response"/> - </split> - <doCatch> - <exception>java.lang.Exception</exception> - <handled> - <constant>false</constant> - </handled> - <setProperty propertyName="logMessage"> - <simple>PDP Group removal, Error reported: ${exception}</simple> - </setProperty> - <setProperty propertyName="logComponent"> - <simple>POLICY</simple> - </setProperty> - <to uri="direct:dump-loop-log-http-response"/> - </doCatch> - <doFinally> - <to uri="direct:reset-raise-http-exception-flag"/> - <to - uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/> - </doFinally> - </doTry> + <doTry> + <log loggingLevel="INFO" + message="Removing loop policies from PDP Group: ${exchangeProperty[loopObject].getName()}"/> + <to + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Remove policies from PDP group')"/> + <setBody> + <simple>${exchangeProperty[loopObject].getComponent("POLICY").createPoliciesPayloadPdpGroup(exchangeProperty[loopObject],"DELETE")} + </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 remove policies from 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}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=20000&authenticationPreemptive=true&connectionClose=true"/> + + <doFinally> + <to uri="direct:reset-raise-http-exception-flag"/> + <to + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()"/> + <setProperty propertyName="logMessage"> + <simple>PDP Group remove ALL status</simple> + </setProperty> + <setProperty propertyName="logComponent"> + <simple>POLICY</simple> + </setProperty> + <to uri="direct:dump-loop-log-http-response"/> + </doFinally> + </doTry> </route> <route id="get-all-pdp-groups"> <from uri="direct:get-all-pdp-groups"/> |