summaryrefslogtreecommitdiffstats
path: root/src/main/resources/clds
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/resources/clds')
-rw-r--r--src/main/resources/clds/camel/rest/clamp-api-v2.xml55
-rw-r--r--src/main/resources/clds/camel/routes/policy-flows.xml96
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 3ed272e7c..fbf90712a 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 afc5f952a..48e518da9 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&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;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&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.api.userName}}&amp;authPassword={{clamp.config.policy.api.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=20000&amp;authenticationPreemptive=true&amp;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>