diff options
Diffstat (limited to 'src/main/resources/clds/camel/routes/loop-flows.xml')
-rw-r--r-- | src/main/resources/clds/camel/routes/loop-flows.xml | 253 |
1 files changed, 253 insertions, 0 deletions
diff --git a/src/main/resources/clds/camel/routes/loop-flows.xml b/src/main/resources/clds/camel/routes/loop-flows.xml new file mode 100644 index 000000000..d0d552568 --- /dev/null +++ b/src/main/resources/clds/camel/routes/loop-flows.xml @@ -0,0 +1,253 @@ +<routes xmlns="http://camel.apache.org/schema/spring"> + <route id="load-loop"> + <from uri="direct:load-loop" /> + <setBody> + <simple>${header.loopName}</simple> + </setBody> + <setProperty propertyName="loopObject"> + <method ref="org.onap.clamp.loop.LoopService" method="getLoop" /> + </setProperty> + + <when> + <simple>${exchangeProperty[loopObject]} == null</simple> + <setHeader headerName="CamelHttpResponseCode"> + <constant>404</constant> + </setHeader> + <log loggingLevel="WARN" message="Loop not found in database: ${body}" /> + <stop /> + </when> + </route> + <route id="update-policy-status-for-loop"> + <from uri="direct:update-policy-status-for-loop" /> + <setProperty propertyName="policyComponent"> + <simple>${exchangeProperty[loopObject].getComponent('POLICY')} + </simple> + </setProperty> + <setProperty propertyName="policyFound"> + <simple resultType="java.lang.Boolean">true</simple> + </setProperty> + <setProperty propertyName="policyDeployed"> + <simple resultType="java.lang.Boolean">true</simple> + </setProperty> + <log loggingLevel="INFO" + message="Processing all MICRO-SERVICES policies defined in loop ${exchangeProperty[loopObject].getName()}" /> + <split> + <simple>${exchangeProperty[loopObject].getMicroServicePolicies()} + </simple> + <setProperty propertyName="policyName"> + <simple>${body.getName()}</simple> + </setProperty> + <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> + <setBody> + <constant>null</constant> + </setBody> + <log loggingLevel="INFO" + message="Processing Micro Service Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" /> + <to uri="direct:verify-one-policy" /> + </split> + <log loggingLevel="INFO" + message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" /> + <split> + <simple>${exchangeProperty[loopObject].getOperationalPolicies()} + </simple> + <setProperty propertyName="policyName"> + <simple>${body.getName()}</simple> + </setProperty> + <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> + <setProperty propertyName="operationalPolicy"> + <simple>${body}</simple> + </setProperty> + <setBody> + <constant>null</constant> + </setBody> + <log loggingLevel="INFO" + message="Processing Operational Policy: ${exchangeProperty[policyName]} of type ${exchangeProperty[policyType]}" /> + <to uri="direct:verify-one-policy" /> + </split> + <setProperty propertyName="policyState"> + <simple> ${exchangeProperty[policyComponent].getState()} + </simple> + </setProperty> + <log loggingLevel="INFO" + message="Policy state set to: ${exchangeProperty[policyState].getStateName()}" /> + <to + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('Policy state set to: ${exchangeProperty[policyState].getStateName()}','INFO','POLICY',${exchangeProperty[loopObject]})" /> + </route> + <route id="update-dcae-status-for-loop"> + <from uri="direct:update-dcae-status-for-loop" /> + <log loggingLevel="INFO" + message="Updating DCAE status for loop: ${exchangeProperty[loopObject].getName()}" /> + <choice> + <when> + <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == true + </simple> + <setProperty propertyName="dcaeComponent"> + <simple>${exchangeProperty[loopObject].getComponent('DCAE')}</simple> + </setProperty> + <when> + <simple>${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()} != null + </simple> + <setProperty propertyName="getStatusUrl"> + <simple>${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}</simple> + </setProperty> + <setProperty propertyName="raiseHttpExceptionFlag"> + <simple resultType="java.lang.Boolean">false</simple> + </setProperty> + <to uri="direct:get-dcae-deployment-status" /> + <when> + <simple> ${header.CamelHttpResponseCode} == 200 </simple> + <convertBodyTo type="java.lang.String" /> + <setProperty propertyName="dcaeResponse"> + <method ref="org.onap.clamp.loop.components.external.DcaeComponent" + method="convertDcaeResponse(${body})" /> + </setProperty> + </when> + </when> + <setProperty propertyName="dcaeState"> + <simple> ${exchangeProperty[dcaeComponent].computeState(*)} + </simple> + </setProperty> + <log loggingLevel="INFO" + message="DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - DCAE message: ${exchangeProperty[dcaeResponse].getError()}" /> + <to + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - message: ${exchangeProperty[dcaeResponse].getError()}','INFO','DCAE',${exchangeProperty[loopObject]})" /> + </when> + <when> + <simple>${exchangeProperty['loopObject'].getLoopTemplate().getUniqueBlueprint()} == false + </simple> + <split> + <simple>${exchangeProperty[loopObject].getMicroServicePolicies()} + </simple> + <setProperty propertyName="microServicePolicy"> + <simple>${body}</simple> + </setProperty> + <setProperty propertyName="dcaeComponent"> + <simple>${exchangeProperty[loopObject].getComponent('DCAE_' + ${exchangeProperty[microServicePolicy].getName()})}</simple> + </setProperty> + <when> + <simple>${exchangeProperty[microServicePolicy].getDcaeDeploymentStatusUrl()} != null + </simple> + <setProperty propertyName="getStatusUrl"> + <simple>${exchangeProperty[microServicePolicy].getDcaeDeploymentStatusUrl()}</simple> + </setProperty> + <setProperty propertyName="raiseHttpExceptionFlag"> + <simple resultType="java.lang.Boolean">false</simple> + </setProperty> + <to uri="direct:get-dcae-deployment-status" /> + <when> + <simple> ${header.CamelHttpResponseCode} == 200 </simple> + <convertBodyTo type="java.lang.String" /> + <setProperty propertyName="dcaeResponse"> + <method ref="org.onap.clamp.loop.components.external.DcaeComponent" + method="convertDcaeResponse(${body})" /> + </setProperty> + </when> + </when> + <setProperty propertyName="dcaeState"> + <simple> ${exchangeProperty[dcaeComponent].computeState(*)} + </simple> + </setProperty> + <log loggingLevel="INFO" + message="DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - DCAE message: ${exchangeProperty[dcaeResponse].getError()}" /> + <to + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLogForComponent('DCAE state set to: ${exchangeProperty[dcaeState].getStateName()} - message: ${exchangeProperty[dcaeResponse].getError()}','INFO','DCAE',${exchangeProperty[microServicePolicy]})" /> + </split>> + </when> + </choice> + </route> + <route id="direct:update-loop-state"> + <from uri="direct:update-loop-state" /> + <log loggingLevel="INFO" + message="Updating status for loop: ${exchangeProperty[loopObject].getName()}" /> + <choice> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'BLUEPRINT_DEPLOYED' and ${exchangeProperty['policyState'].getStateName()} + == 'NOT_SENT' + </simple> + <to + uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'DESIGN')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == 'IN_ERROR' or + ${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_INSTALLATION_FAILED' + </simple> + <to + uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'IN_ERROR')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_UNINSTALLATION_FAILED' or + ${exchangeProperty['policyState'].getStateName()} == 'IN_ERROR' + </simple> + <to + uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'IN_ERROR')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and + ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' + </simple> + <to + uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'RUNNING')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and + ${exchangeProperty['policyState'].getStateName()} == 'SENT' + </simple> + <to + uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'STOPPED')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'BLUEPRINT_DEPLOYED' or ${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_UNINSTALLED_SUCCESSFULLY' and + ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' + </simple> + <to + uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'SUBMITTED')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'PROCESSING_MICROSERVICE_INSTALLATION' or + ${exchangeProperty['dcaeState'].getStateName()} == + 'PROCESSING_MICROSERVICE_UNINSTALLATION' and + ${exchangeProperty['policyState'].getStateName()} == 'SENT_AND_DEPLOYED' + </simple> + <to + uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'WAITING')" /> + </when> + <when> + <simple>${exchangeProperty['dcaeState'].getStateName()} == + 'MICROSERVICE_INSTALLED_SUCCESSFULLY' and + ${exchangeProperty['policyState'].getStateName()} != 'NOT_SENT' + </simple> + <to + uri="bean:org.onap.clamp.loop.LoopService?method=updateLoopState(${exchangeProperty[loopObject]},'DEPLOYED')" /> + </when> + </choice> + <log loggingLevel="INFO" + message="New loop state is: ${exchangeProperty[loopObject].getLastComputedState().toString()}" /> + <to + uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('New loop state is: ${exchangeProperty[loopObject].getLastComputedState().toString()}','INFO',${exchangeProperty[loopObject]})" /> + + </route> +</routes>
\ No newline at end of file |