blob: 808e1d8a11058320d0e85104596265bc958395af [file] [log] [blame]
<routes xmlns="http://camel.apache.org/schema/spring">
<route id="submit">
<from uri="direct:processSubmit" />
<choice>
<when>
<simple> ${exchangeProperty.actionCd} == 'SUBMIT' ||
${exchangeProperty.actionCd} == 'RESUBMIT'
</simple>
<to
uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
<to uri="bean:org.onap.clamp.clds.client.TcaPolicyDelegate" />
<to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDelegate" />
<delay>
<constant>30000</constant>
</delay>
<to
uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
<to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
<to
uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
</when>
<when>
<simple> ${exchangeProperty.actionCd} == 'DELETE'</simple>
<to
uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
<to uri="bean:org.onap.clamp.clds.client.TcaPolicyDeleteDelegate" />
<to
uri="bean:org.onap.clamp.clds.client.HolmesPolicyDeleteDelegate" />
<delay>
<constant>30000</constant>
</delay>
<to
uri="bean:org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate" />
<to
uri="bean:org.onap.clamp.clds.client.GuardPolicyDeleteDelegate" />
<to uri="bean:org.onap.clamp.clds.client.ModelDeleteDelegate" />
<to
uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
</when>
<when>
<simple> ${exchangeProperty.actionCd} == 'UPDATE'</simple>
<to
uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
<to uri="bean:org.onap.clamp.clds.client.TcaPolicyDelegate" />
<to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDelegate" />
<delay>
<constant>30000</constant>
</delay>
<to
uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
<to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
<to
uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
</when>
<when>
<simple> ${exchangeProperty.actionCd} == 'STOP'</simple>
<to
uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
<to
uri="bean:org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate" />
<to
uri="bean:org.onap.clamp.clds.client.GuardPolicyDeleteDelegate" />
<to
uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
</when>
<when>
<simple> ${exchangeProperty.actionCd} == 'RESTART'</simple>
<to
uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
<to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
<to
uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
<to
uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
</when>
</choice>
</route>
<route id="load-loop">
<from uri="direct:load-loop" />
<setBody>
<simple>${header.loopName}</simple>
</setBody>
<setHeader headerName="LoopObject">
<method
ref="org.onap.clamp.loop.LoopService"
method="getLoop" />
</setHeader>
<when>
<simple>${header.LoopObject} == null</simple>
<setHeader headerName="CamelHttpResponseCode">
<constant>404</constant>
</setHeader>
<log
loggingLevel="WARNING"
message="Loop not found in database: ${body}" />
<stop />
</when>
</route>
<route id="create-micro-service-policy">
<from uri="direct:create-micro-service-policy" />
<log
loggingLevel="INFO"
message="Creating Micro Service Policy: ${header.microServicePolicy.getName()}" />
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Micro Service Policy')" />
<setBody>
<simple>${header.microServicePolicy.createPolicyPayload()}
</simple>
</setBody>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Content-Type">
<constant>application/json</constant>
</setHeader>
<setHeader headerName="CamelHttpUri">
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/${header.microServicePolicy.getModelType()}/versions/1.0.0/policies
</simple>
</setHeader>
<setHeader headerName="X-ONAP-RequestID">
<simple>${header.X-ONAP-REAUESTID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-InvocationID">
<simple>${header.X-ONAP-InvocationID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-PartnerName">
<simple>${header.X-ONAP-PartnerName}
</simple>
</setHeader>
<log
loggingLevel="INFO"
message="Endpoint to create microservice policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
<toD
uri="http4://policyhost:8085?mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('MicroService policy created successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="delete-micro-service-policy">
<from uri="direct:delete-micro-service-policy" />
<log
loggingLevel="INFO"
message="Deleting Micro Service Policy: ${header.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="CamelHttpUri">
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/${header.microServicePolicy.getModelType()}/versions/1.0.0/policies/${header.microServicePolicy.getName()}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-RequestID">
<simple>${header.X-ONAP-REAUESTID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-InvocationID">
<simple>${header.X-ONAP-InvocationID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-PartnerName">
<simple>${header.X-ONAP-PartnerName}
</simple>
</setHeader>
<log
loggingLevel="INFO"
message="Endpoint to delete microservice policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
<toD
uri="http4://policyhost:8085?mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('MicroService policy deleted successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="create-operational-policy">
<from uri="direct:create-operational-policy" />
<log
loggingLevel="INFO"
message="Creating Operational Policy: ${header.operationalPolicy.getName()}" />
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Operational Policy')" />
<setBody>
<simple>${header.operationalPolicy.createPolicyPayload()}
</simple>
</setBody>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Content-Type">
<constant>application/yaml; legacy-version</constant>
</setHeader>
<setHeader headerName="CamelHttpUri">
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controloop.operational/versions/1.0.0/policies
</simple>
</setHeader>
<setHeader headerName="X-ONAP-RequestID">
<simple>${header.X-ONAP-REAUESTID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-InvocationID">
<simple>${header.X-ONAP-InvocationID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-PartnerName">
<simple>${header.X-ONAP-PartnerName}
</simple>
</setHeader>
<log
loggingLevel="INFO"
message="Endpoint to create operational policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
<toD
uri="http4://policyhost:8085?mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational policy created successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="delete-operational-policy">
<from uri="direct:delete-operational-policy" />
<log
loggingLevel="INFO"
message="Deleting Operational Policy: ${header.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="CamelHttpUri">
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controloop.operational/versions/1.0.0/policies/${header.operationalPolicy.getName()}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-RequestID">
<simple>${header.X-ONAP-REAUESTID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-InvocationID">
<simple>${header.X-ONAP-InvocationID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-PartnerName">
<simple>${header.X-ONAP-PartnerName}
</simple>
</setHeader>
<log
loggingLevel="INFO"
message="Endpoint to delete operational policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
<toD
uri="http4://policyhost:8085?mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational policy deleted successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="create-guard-policy">
<from uri="direct:create-guard-policy" />
<log
loggingLevel="INFO"
message="Creating Guard Policy: ${header.guardPolicy.getKey()}" />
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Create Guard Policy')" />
<setBody>
<simple>${header.guardPolicy.getValue()}
</simple>
</setBody>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Content-Type">
<constant>application/json</constant>
</setHeader>
<setHeader headerName="CamelHttpUri">
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controlloop.Guard/versions/1.0.0/policies
</simple>
</setHeader>
<setHeader headerName="X-ONAP-RequestID">
<simple>${header.X-ONAP-REAUESTID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-InvocationID">
<simple>${header.X-ONAP-InvocationID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-PartnerName">
<simple>${header.X-ONAP-PartnerName}
</simple>
</setHeader>
<log
loggingLevel="INFO"
message="Endpoint to create guard policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
<toD
uri="http4://policyhost:8085?mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Guard policy created successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="delete-guard-policy">
<from uri="direct:delete-guard-policy" />
<log
loggingLevel="INFO"
message="Deleting Guard Policy: ${header.guardPolicy.getKey()}" />
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Delete Guard Policy')" />
<setBody>
<constant>null</constant>
</setBody>
<setHeader headerName="CamelHttpMethod">
<constant>DELETE</constant>
</setHeader>
<setHeader headerName="CamelHttpUri">
<simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${header.guardPolicy.getKey()}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-RequestID">
<simple>${header.X-ONAP-REAUESTID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-InvocationID">
<simple>${header.X-ONAP-InvocationID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-PartnerName">
<simple>${header.X-ONAP-PartnerName}
</simple>
</setHeader>
<log
loggingLevel="INFO"
message="Endpoint to delete guard policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
<toD
uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Guard policy deleted successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="add-all-to-active-pdp-group">
<from uri="direct:add-all-to-active-pdp-group" />
<log
loggingLevel="INFO"
message="Adding loop policies to PDP Group: ${header.LoopObject.getName()}" />
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Add policies to PDP group')" />
<setBody>
<simple>${header.LoopObject.createPoliciesPayloadPdpGroup()}
</simple>
</setBody>
<setHeader headerName="CamelHttpMethod">
<constant>POST</constant>
</setHeader>
<setHeader headerName="Content-Type">
<constant>application/json</constant>
</setHeader>
<setHeader headerName="CamelHttpUri">
<simple>{{clamp.config.policy.url}}/policy/pap/v1/pdps
</simple>
</setHeader>
<setHeader headerName="X-ONAP-RequestID">
<simple>${header.X-ONAP-REAUESTID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-InvocationID">
<simple>${header.X-ONAP-InvocationID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-PartnerName">
<simple>${header.X-ONAP-PartnerName}
</simple>
</setHeader>
<log
loggingLevel="INFO"
message="Endpoint to add policies to PDP Group: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
<toD
uri="http4://policyhost:8085?mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Policies pushed to PDP Group successfully','INFO',${header.LoopObject})" />
<to uri="direct:reset-raise-http-exception-flag" />
<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="remove-all-policy-from-active-pdp-group">
<from uri="direct:remove-all-policy-from-active-pdp-group" />
<log
loggingLevel="INFO"
message="Removing policies from active PDP group for loop: ${header.LoopObject.getName()}" />
<to
uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('Policy', 'Removing policies PDP group')" />
<split>
<simple>${header.LoopObject.listPolicyNamesPdpGroup()}</simple>
<setHeader headerName="PolicyName">
<simple>${body}</simple>
</setHeader>
<setBody>
<constant>null</constant>
</setBody>
<setHeader headerName="CamelHttpMethod">
<constant>DELETE</constant>
</setHeader>
<setHeader headerName="CamelHttpUri">
<simple>{{clamp.config.policy.url}}/pdps/policies/${header.PolicyName}/versions/1.0.0
</simple>
</setHeader>
<setHeader headerName="X-ONAP-RequestID">
<simple>${header.X-ONAP-REAUESTID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-InvocationID">
<simple>${header.X-ONAP-InvocationID}
</simple>
</setHeader>
<setHeader headerName="X-ONAP-PartnerName">
<simple>${header.X-ONAP-PartnerName}
</simple>
</setHeader>
<log
loggingLevel="INFO"
message="Endpoint to delete policy from PDP Group: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
<toD
uri="http4://policyhost:8085?mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
<to
uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog(${header.PolicyName}' Policy removed from PDP Group successfully','INFO',${header.LoopObject})" />
</split>
<to uri="direct:reset-raise-http-exception-flag" />
<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
</route>
<route id="reset-raise-http-exception-flag">
<from uri="direct:reset-raise-http-exception-flag" />
<setHeader headerName="RaiseHttpExceptionFlag">
<simple resultType="java.lang.Boolean">true</simple>
</setHeader>
</route>
</routes>