blob: 3e69fa44ad35b6e9b79c88878583b91bac943f66 [file] [log] [blame]
Determe, Sebastien (sd378r)7c083742018-02-14 15:31:55 +01001<routes xmlns="http://camel.apache.org/schema/spring">
sebdetdfa86ca2019-04-05 15:15:31 +02002 <route id="submit">
3 <from uri="direct:processSubmit" />
4 <choice>
5 <when>
6 <simple> ${exchangeProperty.actionCd} == 'SUBMIT' ||
7 ${exchangeProperty.actionCd} == 'RESUBMIT'
8 </simple>
9 <to
10 uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
11 <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDelegate" />
12 <to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDelegate" />
13 <delay>
14 <constant>30000</constant>
15 </delay>
16 <to
17 uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
18 <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
19 <to
20 uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
21 </when>
22 <when>
23 <simple> ${exchangeProperty.actionCd} == 'DELETE'</simple>
24 <to
25 uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
26 <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDeleteDelegate" />
27 <to
28 uri="bean:org.onap.clamp.clds.client.HolmesPolicyDeleteDelegate" />
29 <delay>
30 <constant>30000</constant>
31 </delay>
32 <to
33 uri="bean:org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate" />
34 <to
35 uri="bean:org.onap.clamp.clds.client.GuardPolicyDeleteDelegate" />
36 <to uri="bean:org.onap.clamp.clds.client.ModelDeleteDelegate" />
37 <to
38 uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
39 </when>
40 <when>
41 <simple> ${exchangeProperty.actionCd} == 'UPDATE'</simple>
42 <to
43 uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
44 <to uri="bean:org.onap.clamp.clds.client.TcaPolicyDelegate" />
45 <to uri="bean:org.onap.clamp.clds.client.HolmesPolicyDelegate" />
46 <delay>
47 <constant>30000</constant>
48 </delay>
49 <to
50 uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
51 <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
52 <to
53 uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
54 </when>
55 <when>
56 <simple> ${exchangeProperty.actionCd} == 'STOP'</simple>
57 <to
58 uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
59 <to
60 uri="bean:org.onap.clamp.clds.client.OperationalPolicyDeleteDelegate" />
61 <to
62 uri="bean:org.onap.clamp.clds.client.GuardPolicyDeleteDelegate" />
63 <to
64 uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
65 </when>
66 <when>
67 <simple> ${exchangeProperty.actionCd} == 'RESTART'</simple>
68 <to
69 uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'INITIATED')" />
70 <to uri="bean:org.onap.clamp.clds.client.GuardPolicyDelegate" />
71 <to
72 uri="bean:org.onap.clamp.clds.client.OperationalPolicyDelegate" />
73 <to
74 uri="bean:org.onap.clamp.clds.client.CldsEventDelegate?method=addEvent(*,'COMPLETED')" />
75 </when>
76 </choice>
77 </route>
sebdetdfa86ca2019-04-05 15:15:31 +020078
sebdet919ef9d2019-04-08 18:32:26 +020079 <route id="load-loop">
80 <from uri="direct:load-loop" />
sebdet667cb722019-04-11 02:07:44 +020081 <setBody>
82 <simple>${header.loopName}</simple>
83 </setBody>
sebdet919ef9d2019-04-08 18:32:26 +020084 <setHeader headerName="LoopObject">
85 <method
86 ref="org.onap.clamp.loop.LoopService"
87 method="getLoop" />
88 </setHeader>
89
90 <when>
91 <simple>${header.LoopObject} == null</simple>
92 <setHeader headerName="CamelHttpResponseCode">
93 <constant>404</constant>
94 </setHeader>
95 <log
96 loggingLevel="WARNING"
97 message="Loop not found in database: ${body}" />
98 <stop />
99 </when>
sebdet919ef9d2019-04-08 18:32:26 +0200100 </route>
101
102 <route id="create-micro-service-policy">
103 <from uri="direct:create-micro-service-policy" />
sebdet667cb722019-04-11 02:07:44 +0200104 <to uri="direct:check-raise-http-exception-flag" />
sebdet919ef9d2019-04-08 18:32:26 +0200105 <log
106 loggingLevel="INFO"
107 message="Creating Micro Service Policy: ${header.microServicePolicy.getName()}" />
108 <setBody>
109 <simple>${header.microServicePolicy.createPolicyPayload()}
110 </simple>
111 </setBody>
112 <setHeader headerName="CamelHttpMethod">
113 <constant>POST</constant>
114 </setHeader>
115 <setHeader headerName="Content-Type">
116 <constant>application/json</constant>
117 </setHeader>
118 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200119 <simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/${header.microServicePolicy.getModelType()}/versions/1.0.0/policies
sebdet919ef9d2019-04-08 18:32:26 +0200120 </simple>
121 </setHeader>
122 <log
123 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200124 message="Endpoint to create microservice policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdet919ef9d2019-04-08 18:32:26 +0200125 <toD
sebdetece804b2019-04-10 15:29:16 +0200126 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
sebdetea775862019-04-09 13:08:10 +0200127 <to
128 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('MicroService policy created successfully','INFO',${header.LoopObject})" />
sebdet667cb722019-04-11 02:07:44 +0200129 <to uri="direct:reset-raise-http-exception-flag" />
sebdet919ef9d2019-04-08 18:32:26 +0200130 </route>
131 <route id="delete-micro-service-policy">
132 <from uri="direct:delete-micro-service-policy" />
sebdet667cb722019-04-11 02:07:44 +0200133 <to uri="direct:check-raise-http-exception-flag" />
sebdet919ef9d2019-04-08 18:32:26 +0200134 <log
135 loggingLevel="INFO"
136 message="Deleting Micro Service Policy: ${header.microServicePolicy.getName()}" />
137 <setBody>
138 <constant>null</constant>
139 </setBody>
sebdetdfa86ca2019-04-05 15:15:31 +0200140 <setHeader headerName="CamelHttpMethod">
141 <constant>DELETE</constant>
142 </setHeader>
143 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200144 <simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/${header.microServicePolicy.getModelType()}/versions/1.0.0/policies/${header.microServicePolicy.getName()}
sebdetdfa86ca2019-04-05 15:15:31 +0200145 </simple>
146 </setHeader>
sebdetdfa86ca2019-04-05 15:15:31 +0200147 <log
148 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200149 message="Endpoint to delete microservice policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdetdfa86ca2019-04-05 15:15:31 +0200150 <toD
sebdetece804b2019-04-10 15:29:16 +0200151 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}}" />
sebdetea775862019-04-09 13:08:10 +0200152 <to
153 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('MicroService policy deleted successfully','INFO',${header.LoopObject})" />
sebdet667cb722019-04-11 02:07:44 +0200154 <to uri="direct:reset-raise-http-exception-flag" />
sebdetdfa86ca2019-04-05 15:15:31 +0200155 </route>
sebdetdfa86ca2019-04-05 15:15:31 +0200156
sebdet919ef9d2019-04-08 18:32:26 +0200157 <route id="create-operational-policy">
158 <from uri="direct:create-operational-policy" />
sebdet667cb722019-04-11 02:07:44 +0200159 <to uri="direct:check-raise-http-exception-flag" />
sebdet919ef9d2019-04-08 18:32:26 +0200160 <log
161 loggingLevel="INFO"
162 message="Creating Operational Policy: ${header.operationalPolicy.getName()}" />
163 <setBody>
164 <simple>${header.operationalPolicy.createPolicyPayload()}
165 </simple>
166 </setBody>
sebdetdfa86ca2019-04-05 15:15:31 +0200167 <setHeader headerName="CamelHttpMethod">
168 <constant>POST</constant>
169 </setHeader>
sebdet919ef9d2019-04-08 18:32:26 +0200170 <setHeader headerName="Content-Type">
sebdeteb71d702019-04-09 18:10:32 +0200171 <constant>application/yaml; legacy-version</constant>
sebdet919ef9d2019-04-08 18:32:26 +0200172 </setHeader>
sebdetdfa86ca2019-04-05 15:15:31 +0200173 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200174 <simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controloop.operational/versions/1.0.0/policies
sebdetdfa86ca2019-04-05 15:15:31 +0200175 </simple>
176 </setHeader>
sebdetdfa86ca2019-04-05 15:15:31 +0200177 <log
178 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200179 message="Endpoint to create operational policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdetdfa86ca2019-04-05 15:15:31 +0200180 <toD
sebdetece804b2019-04-10 15:29:16 +0200181 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
sebdetea775862019-04-09 13:08:10 +0200182 <to
183 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational policy created successfully','INFO',${header.LoopObject})" />
sebdet667cb722019-04-11 02:07:44 +0200184 <to uri="direct:reset-raise-http-exception-flag" />
sebdet919ef9d2019-04-08 18:32:26 +0200185 </route>
186 <route id="delete-operational-policy">
187 <from uri="direct:delete-operational-policy" />
sebdet667cb722019-04-11 02:07:44 +0200188 <to uri="direct:check-raise-http-exception-flag" />
sebdet919ef9d2019-04-08 18:32:26 +0200189 <log
190 loggingLevel="INFO"
191 message="Deleting Operational Policy: ${header.operationalPolicy.getName()}" />
192 <setBody>
193 <constant>null</constant>
194 </setBody>
195 <setHeader headerName="CamelHttpMethod">
196 <constant>DELETE</constant>
197 </setHeader>
198 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200199 <simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controloop.operational/versions/1.0.0/policies/${header.operationalPolicy.getName()}
sebdet919ef9d2019-04-08 18:32:26 +0200200 </simple>
201 </setHeader>
202 <log
203 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200204 message="Endpoint to delete operational policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdet919ef9d2019-04-08 18:32:26 +0200205 <toD
sebdetece804b2019-04-10 15:29:16 +0200206 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}}" />
sebdetea775862019-04-09 13:08:10 +0200207 <to
208 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational policy deleted successfully','INFO',${header.LoopObject})" />
sebdet667cb722019-04-11 02:07:44 +0200209 <to uri="direct:reset-raise-http-exception-flag" />
sebdet919ef9d2019-04-08 18:32:26 +0200210 </route>
211
212 <route id="create-guard-policy">
213 <from uri="direct:create-guard-policy" />
sebdet667cb722019-04-11 02:07:44 +0200214 <to uri="direct:check-raise-http-exception-flag" />
sebdet919ef9d2019-04-08 18:32:26 +0200215 <log
216 loggingLevel="INFO"
217 message="Creating Guard Policy: ${header.guardPolicy.getKey()}" />
218 <setBody>
219 <simple>${header.guardPolicy.getValue()}
220 </simple>
221 </setBody>
222 <setHeader headerName="CamelHttpMethod">
223 <constant>POST</constant>
224 </setHeader>
225 <setHeader headerName="Content-Type">
226 <constant>application/json</constant>
227 </setHeader>
228 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200229 <simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controlloop.Guard/versions/1.0.0/policies
sebdet919ef9d2019-04-08 18:32:26 +0200230 </simple>
231 </setHeader>
232 <log
233 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200234 message="Endpoint to create guard policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdet919ef9d2019-04-08 18:32:26 +0200235 <toD
sebdetece804b2019-04-10 15:29:16 +0200236 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
sebdetea775862019-04-09 13:08:10 +0200237 <to
238 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Guard policy created successfully','INFO',${header.LoopObject})" />
sebdet667cb722019-04-11 02:07:44 +0200239 <to uri="direct:reset-raise-http-exception-flag" />
sebdet919ef9d2019-04-08 18:32:26 +0200240 </route>
241 <route id="delete-guard-policy">
242 <from uri="direct:delete-guard-policy" />
sebdet667cb722019-04-11 02:07:44 +0200243 <to uri="direct:check-raise-http-exception-flag" />
sebdet919ef9d2019-04-08 18:32:26 +0200244 <log
245 loggingLevel="INFO"
246 message="Deleting Guard Policy: ${header.guardPolicy.getKey()}" />
247 <setBody>
248 <constant>null</constant>
249 </setBody>
250 <setHeader headerName="CamelHttpMethod">
251 <constant>DELETE</constant>
252 </setHeader>
253 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200254 <simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controlloop.Guard/versions/1.0.0/policies/${header.guardPolicy.getKey()}
sebdet919ef9d2019-04-08 18:32:26 +0200255 </simple>
256 </setHeader>
257 <log
258 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200259 message="Endpoint to delete guard policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdet919ef9d2019-04-08 18:32:26 +0200260 <toD
sebdetece804b2019-04-10 15:29:16 +0200261 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}}" />
sebdetea775862019-04-09 13:08:10 +0200262 <to
263 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Guard policy deleted successfully','INFO',${header.LoopObject})" />
sebdet667cb722019-04-11 02:07:44 +0200264 <to uri="direct:reset-raise-http-exception-flag" />
sebdetdfa86ca2019-04-05 15:15:31 +0200265 </route>
sebdet667cb722019-04-11 02:07:44 +0200266 <route id="add-all-to-active-pdp-group">
267 <from uri="direct:add-all-to-active-pdp-group" />
268 <to uri="direct:check-raise-http-exception-flag" />
sebdeteb71d702019-04-09 18:10:32 +0200269 <log
270 loggingLevel="INFO"
sebdet667cb722019-04-11 02:07:44 +0200271 message="Adding loop policies to PDP Group: ${header.LoopObject.getName()}" />
sebdeteb71d702019-04-09 18:10:32 +0200272 <setBody>
273 <simple>${header.LoopObject.createPoliciesPayloadPdpGroup()}
274 </simple>
275 </setBody>
276 <setHeader headerName="CamelHttpMethod">
277 <constant>POST</constant>
278 </setHeader>
279 <setHeader headerName="Content-Type">
280 <constant>application/json</constant>
281 </setHeader>
282 <setHeader headerName="CamelHttpUri">
283 <simple>{{clamp.config.policy.url}}/policy/pap/v1/pdps
284 </simple>
285 </setHeader>
286 <log
287 loggingLevel="INFO"
sebdet667cb722019-04-11 02:07:44 +0200288 message="Endpoint to add policies to PDP Group: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdeteb71d702019-04-09 18:10:32 +0200289 <toD
sebdetece804b2019-04-10 15:29:16 +0200290 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
sebdeteb71d702019-04-09 18:10:32 +0200291 <to
sebdet667cb722019-04-11 02:07:44 +0200292 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Policies pushed to PDP Group successfully','INFO',${header.LoopObject})" />
293 <to uri="direct:reset-raise-http-exception-flag" />
294 </route>
295
296 <route id="remove-all-policy-from-active-pdp-group">
297 <from uri="direct:remove-all-policy-from-active-pdp-group" />
298 <to uri="direct:check-raise-http-exception-flag" />
299 <log
300 loggingLevel="INFO"
301 message="Removing policies from active PDP group for loop: ${header.LoopObject.getName()}" />
302 <split>
303 <simple>${header.LoopObject.listPolicyNamesPdpGroup()}</simple>
304 <setHeader headerName="PolicyName">
305 <simple>${body}</simple>
306 </setHeader>
307 <setBody>
308 <constant>null</constant>
309 </setBody>
310 <setHeader headerName="CamelHttpMethod">
311 <constant>DELETE</constant>
312 </setHeader>
313 <setHeader headerName="CamelHttpUri">
314 <simple>{{clamp.config.policy.url}}/pdps/policies/${header.PolicyName}/versions/1.0.0
315 </simple>
316 </setHeader>
317 <log
318 loggingLevel="INFO"
319 message="Endpoint to delete policy from PDP Group: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
320 <toD
321 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;httpClient.connectTimeout=10000&amp;authUsername={{clamp.config.policy.userName}}&amp;authPassword={{clamp.config.policy.password}}" />
322 <to
323 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog(${header.PolicyName}' Policy removed from PDP Group successfully','INFO',${header.LoopObject})" />
324 </split>
325 <to uri="direct:reset-raise-http-exception-flag" />
326 </route>
327
328 <route id="check-raise-http-exception-flag">
329 <from uri="direct:check-raise-http-exception-flag" />
330 <when>
331 <simple>${header.RaiseHttpExceptionFlag} == null</simple>
332 <setHeader headerName="RaiseHttpExceptionFlag">
333 <simple resultType="java.lang.Boolean">true</simple>
334 </setHeader>
335 </when>
336 </route>
337
338 <route id="reset-raise-http-exception-flag">
339 <from uri="direct:reset-raise-http-exception-flag" />
340 <setHeader headerName="RaiseHttpExceptionFlag">
341 <constant>null</constant>
342 </setHeader>
sebdeteb71d702019-04-09 18:10:32 +0200343 </route>
Determe, Sebastien (sd378r)7c083742018-02-14 15:31:55 +0100344</routes>