diff options
author | sebdet <sebastien.determe@intl.att.com> | 2020-02-28 06:03:51 -0800 |
---|---|---|
committer | sebdet <sebastien.determe@intl.att.com> | 2020-03-04 12:45:52 -0800 |
commit | 897a3e004a858ef68d989dad15dde91a69e151a5 (patch) | |
tree | f341b17cbc3a234b4b011bcf7cb7cc11ba99b0ea /src/main/resources/clds | |
parent | f0e00e7c9ea8dd15a4aacdd880aa648539caf087 (diff) |
Change json representation in op policy
Change the json generation for an operational policy instance and update all emulator response for all policy types
Issue-ID: CLAMP-653
Change-Id: I68525be3d5bfbf5dd7a4bcf6d59853df07fd4dd9
Signed-off-by: sebdet <sebastien.determe@intl.att.com>
Diffstat (limited to 'src/main/resources/clds')
-rw-r--r-- | src/main/resources/clds/camel/rest/clamp-api-v2.xml | 55 | ||||
-rw-r--r-- | src/main/resources/clds/camel/routes/policy-flows.xml | 96 |
2 files changed, 126 insertions, 25 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 3ed272e7..fbf90712 100644 --- a/src/main/resources/clds/camel/rest/clamp-api-v2.xml +++ b/src/main/resources/clds/camel/rest/clamp-api-v2.xml @@ -377,51 +377,56 @@ <split> <simple>${exchangeProperty[loopObject].getMicroServicePolicies()} </simple> - <setProperty propertyName="microServicePolicy"> + <setProperty propertyName="policy"> <simple>${body}</simple> </setProperty> <log loggingLevel="INFO" - message="Processing Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" /> + message="Processing Micro Service Policy: ${exchangeProperty[policy].getName()}" /> <setProperty propertyName="raiseHttpExceptionFlag"> <simple resultType="java.lang.Boolean">false</simple> </setProperty> - <to uri="direct:delete-micro-service-policy" /> - <to uri="direct:create-micro-service-policy" /> + <to uri="direct:delete-policy" /> + <to uri="direct:create-policy" /> </split> <log loggingLevel="INFO" message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" /> <split> <simple>${exchangeProperty[loopObject].getOperationalPolicies()} </simple> - <setProperty propertyName="operationalPolicy"> + <setProperty propertyName="policy"> <simple>${body}</simple> </setProperty> <log loggingLevel="INFO" - message="Processing Operational Policy: ${exchangeProperty[operationalPolicy].getName()}" /> + message="Processing Operational Policy: ${exchangeProperty[policy].getName()}" /> <setProperty propertyName="raiseHttpExceptionFlag"> <simple resultType="java.lang.Boolean">false</simple> </setProperty> - <to uri="direct:delete-operational-policy" /> - <to uri="direct:create-operational-policy" /> - - <log loggingLevel="INFO" - message="Processing all GUARD policies defined in loop ${exchangeProperty[loopObject].getName()}" /> - <split> - <simple>${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()} - </simple> - <setProperty propertyName="guardPolicy"> - <simple>${body}</simple> - </setProperty> - <log loggingLevel="INFO" - message="Processing Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" /> + <to uri="direct:delete-policy" /> + <to uri="direct:create-policy" /> + <choice> + <when> + <simple>${exchangeProperty['policy'].isLegacy()} == true + </simple> + <log loggingLevel="INFO" + message="Processing all GUARD policies (LEGACY) defined in loop ${exchangeProperty[loopObject].getName()}" /> + <split> + <simple>${exchangeProperty[operationalPolicy].createGuardPolicyPayloads().entrySet()} + </simple> + <setProperty propertyName="guardPolicy"> + <simple>${body}</simple> + </setProperty> + <log loggingLevel="INFO" + message="Processing Guard Policy: ${exchangeProperty[guardPolicy].getKey()}" /> - <setProperty propertyName="raiseHttpExceptionFlag"> - <simple resultType="java.lang.Boolean">false</simple> - </setProperty> - <to uri="direct:delete-guard-policy" /> - <to uri="direct:create-guard-policy" /> - </split> + <setProperty propertyName="raiseHttpExceptionFlag"> + <simple resultType="java.lang.Boolean">false</simple> + </setProperty> + <to uri="direct:delete-guard-policy" /> + <to uri="direct:create-guard-policy" /> + </split> + </when> + </choice> </split> <delay> diff --git a/src/main/resources/clds/camel/routes/policy-flows.xml b/src/main/resources/clds/camel/routes/policy-flows.xml index afc5f952..48e518da 100644 --- a/src/main/resources/clds/camel/routes/policy-flows.xml +++ b/src/main/resources/clds/camel/routes/policy-flows.xml @@ -183,6 +183,102 @@ </doFinally> </doTry> </route> + <route id="create-policy"> + <from uri="direct:create-policy"/> + <doTry> + <log loggingLevel="INFO" + message="Creating Policy: ${exchangeProperty[policy].getName()}"/> + <to + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Policy')"/> + <setBody> + <simple>${exchangeProperty[policy].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 policy: {{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies"></log> + <toD + uri="{{clamp.config.policy.api.url}}/policy/api/v1/policytypes/${exchangeProperty[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/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[policy].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-policy"> + <from uri="direct:delete-policy"/> + <doTry> + <log loggingLevel="INFO" + message="Deleting Policy: ${exchangeProperty[policy].getName()}"/> + <to + uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete 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[policy].getPolicyModel().getPolicyModelType()}/versions/${exchangeProperty[policy].getPolicyModel().getVersion()}/policies/${exchangeProperty[policy].getName()}/versions/1.0.0"></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"/> + + <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[policy].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-micro-service-policy"> <from uri="direct:create-micro-service-policy"/> <doTry> |