blob: 395077a8e8fc35bf7ceabe0cb5958945b5b140c8 [file] [log] [blame]
sebdet09bc8452019-05-23 17:34:07 +02001<routes xmlns="http://camel.apache.org/schema/spring">
2 <route id="deploy-loop">
3 <from uri="direct:deploy-loop" />
4 <doTry>
5 <log
6 loggingLevel="INFO"
7 message="Deploying the loop: ${exchangeProperty[loopObject].getName()}" />
8 <to
9 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploying the loop')" />
10 <setBody>
11 <method
12 ref="org.onap.clamp.loop.components.external.DcaeComponent"
13 method="getDeployPayload(${exchangeProperty[loopObject]})" />
14 </setBody>
15 <setProperty propertyName="dcaeDeploymentId">
16 <method
17 ref="org.onap.clamp.loop.components.external.DcaeComponent"
18 method="generateDeploymentId()" />
19 </setProperty>
20 <setHeader headerName="CamelHttpMethod">
21 <constant>PUT</constant>
22 </setHeader>
23 <setHeader headerName="Content-Type">
24 <constant>application/json</constant>
25 </setHeader>
26 <setHeader headerName="X-ONAP-RequestID">
27 <simple>${exchangeProperty[X-ONAP-RequestID]}
28 </simple>
29 </setHeader>
30 <setHeader headerName="X-ONAP-InvocationID">
31 <simple>${exchangeProperty[X-ONAP-InvocationID]}
32 </simple>
33 </setHeader>
34 <setHeader headerName="X-ONAP-PartnerName">
35 <simple>${exchangeProperty[X-ONAP-PartnerName]}
36 </simple>
37 </setHeader>
38 <log
39 loggingLevel="INFO"
40 message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}"></log>
41 <toD
sebdet493e9e72019-06-13 12:12:09 +020042 uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=300000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
sebdet09bc8452019-05-23 17:34:07 +020043 <convertBodyTo type="java.lang.String" />
44 <setProperty propertyName="dcaeResponse">
45 <method
46 ref="org.onap.clamp.loop.components.external.DcaeComponent"
47 method="convertDcaeResponse(${body})" />
48 </setProperty>
49 <setProperty propertyName="dcaeStatusUrl">
50 <method
51 ref="org.onap.clamp.loop.components.external.DcaeComponent"
52 method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
53 </setProperty>
54 <to
55 uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[dcaeDeploymentId]},${exchangeProperty[dcaeStatusUrl]})" />
56 <doFinally>
57 <to uri="direct:reset-raise-http-exception-flag" />
58 <to
59 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
60 <setProperty propertyName="logMessage">
61 <simple>DEPLOY loop status
62 (Dep-id:${exchangeProperty[dcaeDeploymentId]},
63 StatusUrl:${exchangeProperty[dcaeStatusUrl]})
64 </simple>
65 </setProperty>
66 <to uri="direct:dump-loop-log-http-response" />
67 </doFinally>
68 </doTry>
69 </route>
70
71 <route id="undeploy-loop">
72 <from uri="direct:undeploy-loop" />
73 <log
74 loggingLevel="INFO"
75 message="Undeploying the loop: ${exchangeProperty[loopObject].getName()} : ${exchangeProperty[loopObject].getDcaeDeploymentId()}" />
76 <to
77 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Undeploying the loop')" />
78 <choice>
79 <when>
80 <simple>${exchangeProperty[loopObject].getDcaeDeploymentId()}
81 != null
82 </simple>
83 <doTry>
84 <setBody>
85 <method
86 ref="org.onap.clamp.loop.components.external.DcaeComponent"
87 method="getUndeployPayload(${exchangeProperty[loopObject]})" />
88 </setBody>
89 <setHeader headerName="CamelHttpMethod">
90 <constant>DELETE</constant>
91 </setHeader>
92 <setHeader headerName="Content-Type">
93 <constant>application/json</constant>
94 </setHeader>
95
96 <setHeader headerName="X-ONAP-RequestID">
97 <simple>${exchangeProperty[X-ONAP-RequestID]}
98 </simple>
99 </setHeader>
100 <setHeader headerName="X-ONAP-InvocationID">
101 <simple>${exchangeProperty[X-ONAP-InvocationID]}
102 </simple>
103 </setHeader>
104 <setHeader headerName="X-ONAP-PartnerName">
105 <simple>${exchangeProperty[X-ONAP-PartnerName]}
106 </simple>
107 </setHeader>
108 <log
109 loggingLevel="INFO"
110 message="Endpoint to undeploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}"></log>
111 <toD
sebdet493e9e72019-06-13 12:12:09 +0200112 uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=300000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
sebdet09bc8452019-05-23 17:34:07 +0200113 <convertBodyTo type="java.lang.String" />
114 <setProperty propertyName="dcaeResponse">
115 <method
116 ref="org.onap.clamp.loop.components.external.DcaeComponent"
117 method="convertDcaeResponse(${body})" />
118 </setProperty>
119 <setProperty propertyName="dcaeStatusUrl">
120 <method
121 ref="org.onap.clamp.loop.components.external.DcaeComponent"
122 method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
123 </setProperty>
124 <to
125 uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[loopObject].getDcaeDeploymentId()},${exchangeProperty[dcaeStatusUrl]})" />
126 <doFinally>
127 <to uri="direct:reset-raise-http-exception-flag" />
128 <to
129 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
130 <setProperty propertyName="logMessage">
131 <simple>UNDEPLOY loop status</simple>
132 </setProperty>
133 <to uri="direct:dump-loop-log-http-response" />
134 </doFinally>
135 </doTry>
136 </when>
137 <otherwise>
138 <log
139 loggingLevel="WARNING"
140 message="Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !" />
141 <to
142 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !','WARNING',${exchangeProperty[loopObject]})" />
143
144 </otherwise>
145 </choice>
146 </route>
147 <route id="get-dcae-deployment-status">
148 <from uri="direct:get-dcae-deployment-status" />
149 <log
150 loggingLevel="INFO"
151 message="Getting DCAE deployment status for loop: ${exchangeProperty[loopObject].getName()}" />
152 <to
153 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting Deployment status')" />
154 <doTry>
155 <setHeader headerName="CamelHttpMethod">
156 <constant>GET</constant>
157 </setHeader>
158 <setHeader headerName="X-ONAP-RequestID">
159 <simple>${exchangeProperty[X-ONAP-RequestID]}
160 </simple>
161 </setHeader>
162 <setHeader headerName="X-ONAP-InvocationID">
163 <simple>${exchangeProperty[X-ONAP-InvocationID]}
164 </simple>
165 </setHeader>
166 <setHeader headerName="X-ONAP-PartnerName">
167 <simple>${exchangeProperty[X-ONAP-PartnerName]}
168 </simple>
169 </setHeader>
170 <log
171 loggingLevel="INFO"
172 message="Endpoint to query Closed Loop status: ${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}"></log>
173 <toD
sebdet493e9e72019-06-13 12:12:09 +0200174 uri="${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
sebdet09bc8452019-05-23 17:34:07 +0200175 <doFinally>
176 <to uri="direct:reset-raise-http-exception-flag" />
177 <to
178 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
179 <setProperty propertyName="logMessage">
180 <simple>DCAE deployment status</simple>
181 </setProperty>
182 <to uri="direct:dump-loop-log-http-response" />
183 </doFinally>
184 </doTry>
185
186 </route>
187</routes>