blob: 7a85871f1f66784d0072127a31e6ee8dc1dceb10 [file] [log] [blame]
sebdet74303b72019-10-08 17:53:08 +02001<routes xmlns="http://camel.apache.org/schema/spring">
2 <route id="deploy-loop">
3 <from uri="direct:deploy-loop" />
xuegao9e01ce32020-01-27 12:10:32 +01004 <choice>
5 <when>
6 <simple>${exchangeProperty['loopObject'].getLoopTemplate().getBlueprint()} != null
7 </simple>
8 <to uri="direct:deploy-loop-single-blueprint" />
9 </when>
10 <when>
11 <simple>${exchangeProperty['loopObject'].getLoopTemplate().getBlueprint()} == null
12 </simple>
13 <to uri="direct:deploy-loop-multi-blueprint" />
14 </when>
15 </choice>
16 </route>
17 <route id="deploy-loop-multi-blueprint">
18 <from uri="direct:deploy-loop-multi-blueprint" />
19 <doTry>
20 <log loggingLevel="INFO"
21 message="Deploying the blueprints for loop: ${exchangeProperty[loopObject].getName()}" />
22 <to
23 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploying the loop with multiple blueprints')" />
24 <split>
25 <simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
26 </simple>
27 <setProperty propertyName="microServicePolicy">
28 <simple>${body}</simple>
29 </setProperty>
30 <log
31 loggingLevel="INFO"
32 message="Processing Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
33 <setProperty propertyName="raiseHttpExceptionFlag">
34 <simple resultType="java.lang.Boolean">false</simple>
35 </setProperty>
36 <setBody>
37 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
38 method="getDeployPayload(${exchangeProperty[loopObject]},${exchangeProperty[microServicePolicy].getName()})" />
39 </setBody>
40 <setProperty propertyName="dcaeDeploymentId">
41 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
42 method="generateDeploymentId()" />
43 </setProperty>
44 <setHeader headerName="CamelHttpMethod">
45 <constant>PUT</constant>
46 </setHeader>
47 <setHeader headerName="Content-Type">
48 <constant>application/json</constant>
49 </setHeader>
50 <setHeader headerName="X-ONAP-RequestID">
51 <simple>${exchangeProperty[X-ONAP-RequestID]}
52 </simple>
53 </setHeader>
54 <setHeader headerName="X-ONAP-InvocationID">
55 <simple>${exchangeProperty[X-ONAP-InvocationID]}
56 </simple>
57 </setHeader>
58 <setHeader headerName="X-ONAP-PartnerName">
59 <simple>${exchangeProperty[X-ONAP-PartnerName]}
60 </simple>
61 </setHeader>
62 <log loggingLevel="INFO"
63 message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}"></log>
64 <toD
65 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" />
66 <convertBodyTo type="java.lang.String" />
67 <setProperty propertyName="dcaeResponse">
68 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
69 method="convertDcaeResponse(${body})" />
70 </setProperty>
71 <setProperty propertyName="dcaeStatusUrl">
72 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
73 method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
74 </setProperty>
75 <to
76 uri="bean:org.onap.clamp.policy.microservice.MicroServicePolicyService?method=updateDcaeDeploymentFields(${exchangeProperty[microServicePolicy]},${exchangeProperty[dcaeDeploymentId]},${exchangeProperty[dcaeStatusUrl]})" />
77 </split>
78 <doCatch>
79 <exception>java.lang.Exception</exception>
80 <handled>
81 <constant>false</constant>
82 </handled>
83 <setProperty propertyName="logMessage">
84 <simple>DEPLOY loop status
85 (Dep-id:${exchangeProperty[dcaeDeploymentId]},
86 StatusUrl:${exchangeProperty[dcaeStatusUrl]})
87 </simple>
88 </setProperty>
89 <setProperty propertyName="logComponent">
90 <simple>DCAE</simple>
91 </setProperty>
92 <to uri="direct:dump-loop-log-http-response" />
93 </doCatch>
94 <doFinally>
95 <to uri="direct:reset-raise-http-exception-flag" />
96 <to
97 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
98 </doFinally>
99 </doTry>
100 </route>
101 <!--<route id="deploy-loop-multi-blueprint">
102 <from uri="direct:deploy-loop-multi-blueprint" />
103
104
105 <doTry>
106 <split>
107 <doTry>
108 <simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
109 </simple>
110 <setProperty propertyName="microServicePolicy">
111 <simple>${body}</simple>
112 </setProperty>
113 <log
114 loggingLevel="INFO"
115 message="Processing Micro Service Policy: ${exchangeProperty[microServicePolicy].getName()}" />
116 <setProperty propertyName="raiseHttpExceptionFlag">
117 <simple resultType="java.lang.Boolean">false</simple>
118 </setProperty>
119 <setBody>
120 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
121 method="getDeployPayload(${exchangeProperty[loopObject]},${exchangeProperty[microServicePolicy].getName())" />
122 </setBody>
123 <setProperty propertyName="dcaeDeploymentId">
124 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
125 method="generateDeploymentId()" />
126 </setProperty>
127 <setHeader headerName="CamelHttpMethod">
128 <constant>PUT</constant>
129 </setHeader>
130 <setHeader headerName="Content-Type">
131 <constant>application/json</constant>
132 </setHeader>
133 <setHeader headerName="X-ONAP-RequestID">
134 <simple>${exchangeProperty[X-ONAP-RequestID]}
135 </simple>
136 </setHeader>
137 <setHeader headerName="X-ONAP-InvocationID">
138 <simple>${exchangeProperty[X-ONAP-InvocationID]}
139 </simple>
140 </setHeader>
141 <setHeader headerName="X-ONAP-PartnerName">
142 <simple>${exchangeProperty[X-ONAP-PartnerName]}
143 </simple>
144 </setHeader>
145 <log loggingLevel="INFO"
146 message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}"></log>
147 <toD
148 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" />
149 <convertBodyTo type="java.lang.String" />
150 <setProperty propertyName="dcaeResponse">
151 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
152 method="convertDcaeResponse(${body})" />
153 </setProperty>
154 <setProperty propertyName="dcaeStatusUrl">
155 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
156 method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
157 </setProperty>
158 <to
159 uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[microServicePolicy].getName(),${exchangeProperty[dcaeDeploymentId]},${exchangeProperty[dcaeStatusUrl]})" />
160 <doFinally>
161 <to uri="direct:reset-raise-http-exception-flag" />
162 <setProperty propertyName="logMessage">
163 <simple>DEPLOY loop status
164 (Dep-id:${exchangeProperty[dcaeDeploymentId]},
165 StatusUrl:${exchangeProperty[dcaeStatusUrl]})
166 </simple>
167 </setProperty>
168 <setProperty propertyName="logComponent">
169 <simple>DCAE</simple>
170 </setProperty>
171 <to uri="direct:dump-loop-log-http-response" />
172 </doFinally>
173 </doTry>
174
175 </split>
176 <doFinally>
177 <to uri="direct:reset-raise-http-exception-flag" />
178 <to
179 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
180 </doFinally>
181 </doTry>
182 </route>-->
183 <route id="deploy-loop-single-blueprint">
184 <from uri="direct:deploy-loop-single-blueprint" />
sebdet74303b72019-10-08 17:53:08 +0200185 <doTry>
186 <log loggingLevel="INFO"
187 message="Deploying the loop: ${exchangeProperty[loopObject].getName()}" />
188 <to
189 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploying the loop')" />
190 <setBody>
191 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
192 method="getDeployPayload(${exchangeProperty[loopObject]})" />
193 </setBody>
194 <setProperty propertyName="dcaeDeploymentId">
195 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
196 method="generateDeploymentId()" />
197 </setProperty>
198 <setHeader headerName="CamelHttpMethod">
199 <constant>PUT</constant>
200 </setHeader>
201 <setHeader headerName="Content-Type">
202 <constant>application/json</constant>
203 </setHeader>
204 <setHeader headerName="X-ONAP-RequestID">
205 <simple>${exchangeProperty[X-ONAP-RequestID]}
206 </simple>
207 </setHeader>
208 <setHeader headerName="X-ONAP-InvocationID">
209 <simple>${exchangeProperty[X-ONAP-InvocationID]}
210 </simple>
211 </setHeader>
212 <setHeader headerName="X-ONAP-PartnerName">
213 <simple>${exchangeProperty[X-ONAP-PartnerName]}
214 </simple>
215 </setHeader>
216 <log loggingLevel="INFO"
217 message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}"></log>
218 <toD
219 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" />
220 <convertBodyTo type="java.lang.String" />
221 <setProperty propertyName="dcaeResponse">
222 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
223 method="convertDcaeResponse(${body})" />
224 </setProperty>
xuegao9e01ce32020-01-27 12:10:32 +0100225
226
sebdet74303b72019-10-08 17:53:08 +0200227 <setProperty propertyName="dcaeStatusUrl">
228 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
229 method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
230 </setProperty>
231 <to
232 uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[dcaeDeploymentId]},${exchangeProperty[dcaeStatusUrl]})" />
233 <doFinally>
234 <to uri="direct:reset-raise-http-exception-flag" />
235 <to
236 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
237 <setProperty propertyName="logMessage">
238 <simple>DEPLOY loop status
239 (Dep-id:${exchangeProperty[dcaeDeploymentId]},
240 StatusUrl:${exchangeProperty[dcaeStatusUrl]})
241 </simple>
242 </setProperty>
243 <setProperty propertyName="logComponent">
244 <simple>DCAE</simple>
245 </setProperty>
246 <to uri="direct:dump-loop-log-http-response" />
247 </doFinally>
248 </doTry>
249 </route>
sebdet74303b72019-10-08 17:53:08 +0200250 <route id="undeploy-loop">
251 <from uri="direct:undeploy-loop" />
252 <log loggingLevel="INFO"
253 message="Undeploying the loop: ${exchangeProperty[loopObject].getName()} : ${exchangeProperty[loopObject].getDcaeDeploymentId()}" />
254 <to
255 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Undeploying the loop')" />
256 <choice>
257 <when>
258 <simple>${exchangeProperty[loopObject].getDcaeDeploymentId()}
259 != null
260 </simple>
261 <doTry>
262 <setBody>
263 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
264 method="getUndeployPayload(${exchangeProperty[loopObject]})" />
265 </setBody>
266 <setHeader headerName="CamelHttpMethod">
267 <constant>DELETE</constant>
268 </setHeader>
269 <setHeader headerName="Content-Type">
270 <constant>application/json</constant>
271 </setHeader>
272
273 <setHeader headerName="X-ONAP-RequestID">
274 <simple>${exchangeProperty[X-ONAP-RequestID]}
275 </simple>
276 </setHeader>
277 <setHeader headerName="X-ONAP-InvocationID">
278 <simple>${exchangeProperty[X-ONAP-InvocationID]}
279 </simple>
280 </setHeader>
281 <setHeader headerName="X-ONAP-PartnerName">
282 <simple>${exchangeProperty[X-ONAP-PartnerName]}
283 </simple>
284 </setHeader>
285 <log loggingLevel="INFO"
286 message="Endpoint to undeploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}"></log>
287 <toD
288 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" />
289 <convertBodyTo type="java.lang.String" />
290 <setProperty propertyName="dcaeResponse">
291 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
292 method="convertDcaeResponse(${body})" />
293 </setProperty>
294 <setProperty propertyName="dcaeStatusUrl">
295 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
296 method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
297 </setProperty>
298 <to
299 uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[loopObject].getDcaeDeploymentId()},${exchangeProperty[dcaeStatusUrl]})" />
300 <doFinally>
301 <to uri="direct:reset-raise-http-exception-flag" />
302 <to
303 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
304 <setProperty propertyName="logMessage">
305 <simple>UNDEPLOY loop status</simple>
306 </setProperty>
307 <setProperty propertyName="logComponent">
308 <simple>DCAE</simple>
309 </setProperty>
310 <to uri="direct:dump-loop-log-http-response" />
311 </doFinally>
312 </doTry>
313 </when>
314 <otherwise>
315 <log loggingLevel="WARNING"
316 message="Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !" />
317 <to
318 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]})" />
319
320 </otherwise>
321 </choice>
322 </route>
323 <route id="get-dcae-deployment-status">
324 <from uri="direct:get-dcae-deployment-status" />
325 <log loggingLevel="INFO"
326 message="Getting DCAE deployment status for loop: ${exchangeProperty[loopObject].getName()}" />
327 <to
328 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting Deployment status')" />
329 <doTry>
330 <setHeader headerName="CamelHttpMethod">
331 <constant>GET</constant>
332 </setHeader>
333 <setHeader headerName="X-ONAP-RequestID">
334 <simple>${exchangeProperty[X-ONAP-RequestID]}
335 </simple>
336 </setHeader>
337 <setHeader headerName="X-ONAP-InvocationID">
338 <simple>${exchangeProperty[X-ONAP-InvocationID]}
339 </simple>
340 </setHeader>
341 <setHeader headerName="X-ONAP-PartnerName">
342 <simple>${exchangeProperty[X-ONAP-PartnerName]}
343 </simple>
344 </setHeader>
345 <log loggingLevel="INFO"
346 message="Endpoint to query Closed Loop status: ${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}"></log>
347 <toD
348 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" />
349 <doFinally>
350 <to uri="direct:reset-raise-http-exception-flag" />
351 <to
352 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
353 <setProperty propertyName="logMessage">
354 <simple>DCAE deployment status</simple>
355 </setProperty>
356 <setProperty propertyName="logComponent">
357 <simple>DCAE</simple>
358 </setProperty>
359 <to uri="direct:dump-loop-log-http-response" />
360 </doFinally>
361 </doTry>
362 </route>
363 <route id="get-dcae-blueprint-inventory">
364 <from uri="direct:get-dcae-blueprint-inventory" />
365 <log loggingLevel="INFO"
366 message="Getting DCAE blueprint id in inventory" />
367 <to
368 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting blueprint id in inventory')" />
369 <doTry>
370 <setHeader headerName="CamelHttpMethod">
371 <constant>GET</constant>
372 </setHeader>
373 <setHeader headerName="X-ONAP-RequestID">
374 <simple>${exchangeProperty[X-ONAP-RequestID]}
375 </simple>
376 </setHeader>
377 <setHeader headerName="X-ONAP-InvocationID">
378 <simple>${exchangeProperty[X-ONAP-InvocationID]}
379 </simple>
380 </setHeader>
381 <setHeader headerName="X-ONAP-PartnerName">
382 <simple>${exchangeProperty[X-ONAP-PartnerName]}
383 </simple>
384 </setHeader>
385 <log loggingLevel="INFO"
386 message="Endpoint to query Dcae inventory Loop status: {{clamp.config.dcae.inventory.url}}/dcae-service-types?${header[CamelHttpQuery]}"></log>
387 <toD
388 uri="{{clamp.config.dcae.inventory.url}}/dcae-service-types?asdcResourceId=${exchangeProperty[blueprintResourceId]}&amp;asdcServiceId=${exchangeProperty[blueprintServiceId]}&amp;typeName=${exchangeProperty[blueprintName]}&amp;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" />
389 <convertBodyTo type="java.lang.String" />
390 <doFinally>
391 <to uri="direct:reset-raise-http-exception-flag" />
392 <to
393 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
394 </doFinally>
395 </doTry>
396
397 </route>
398</routes>