blob: 1ce67cceee93e19b19c3932f46dab4f3ebe30c12 [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" />
81 <setHeader headerName="LoopObject">
82 <method
83 ref="org.onap.clamp.loop.LoopService"
84 method="getLoop" />
85 </setHeader>
86
87 <when>
88 <simple>${header.LoopObject} == null</simple>
89 <setHeader headerName="CamelHttpResponseCode">
90 <constant>404</constant>
91 </setHeader>
92 <log
93 loggingLevel="WARNING"
94 message="Loop not found in database: ${body}" />
95 <stop />
96 </when>
97
98 </route>
99
100 <route id="create-micro-service-policy">
101 <from uri="direct:create-micro-service-policy" />
102 <log
103 loggingLevel="INFO"
104 message="Creating Micro Service Policy: ${header.microServicePolicy.getName()}" />
105 <setBody>
106 <simple>${header.microServicePolicy.createPolicyPayload()}
107 </simple>
108 </setBody>
109 <setHeader headerName="CamelHttpMethod">
110 <constant>POST</constant>
111 </setHeader>
112 <setHeader headerName="Content-Type">
113 <constant>application/json</constant>
114 </setHeader>
115 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200116 <simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/${header.microServicePolicy.getModelType()}/versions/1.0.0/policies
sebdet919ef9d2019-04-08 18:32:26 +0200117 </simple>
118 </setHeader>
119 <log
120 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200121 message="Endpoint to create microservice policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdet919ef9d2019-04-08 18:32:26 +0200122 <toD
sebdetcd64cc42019-04-10 14:07:35 +0200123 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}" />
sebdetea775862019-04-09 13:08:10 +0200124 <to
125 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('MicroService policy created successfully','INFO',${header.LoopObject})" />
sebdet919ef9d2019-04-08 18:32:26 +0200126 </route>
127 <route id="delete-micro-service-policy">
128 <from uri="direct:delete-micro-service-policy" />
129 <log
130 loggingLevel="INFO"
131 message="Deleting Micro Service Policy: ${header.microServicePolicy.getName()}" />
132 <setBody>
133 <constant>null</constant>
134 </setBody>
sebdetdfa86ca2019-04-05 15:15:31 +0200135 <setHeader headerName="CamelHttpMethod">
136 <constant>DELETE</constant>
137 </setHeader>
138 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200139 <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 +0200140 </simple>
141 </setHeader>
sebdetdfa86ca2019-04-05 15:15:31 +0200142 <log
143 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200144 message="Endpoint to delete microservice policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdetdfa86ca2019-04-05 15:15:31 +0200145 <toD
sebdetcd64cc42019-04-10 14:07:35 +0200146 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false" />
sebdetea775862019-04-09 13:08:10 +0200147 <to
148 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('MicroService policy deleted successfully','INFO',${header.LoopObject})" />
sebdetdfa86ca2019-04-05 15:15:31 +0200149 </route>
sebdetdfa86ca2019-04-05 15:15:31 +0200150
sebdet919ef9d2019-04-08 18:32:26 +0200151 <route id="create-operational-policy">
152 <from uri="direct:create-operational-policy" />
153 <log
154 loggingLevel="INFO"
155 message="Creating Operational Policy: ${header.operationalPolicy.getName()}" />
156 <setBody>
157 <simple>${header.operationalPolicy.createPolicyPayload()}
158 </simple>
159 </setBody>
sebdetdfa86ca2019-04-05 15:15:31 +0200160 <setHeader headerName="CamelHttpMethod">
161 <constant>POST</constant>
162 </setHeader>
sebdet919ef9d2019-04-08 18:32:26 +0200163 <setHeader headerName="Content-Type">
sebdeteb71d702019-04-09 18:10:32 +0200164 <constant>application/yaml; legacy-version</constant>
sebdet919ef9d2019-04-08 18:32:26 +0200165 </setHeader>
sebdetdfa86ca2019-04-05 15:15:31 +0200166 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200167 <simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controloop.operational/versions/1.0.0/policies
sebdetdfa86ca2019-04-05 15:15:31 +0200168 </simple>
169 </setHeader>
sebdetdfa86ca2019-04-05 15:15:31 +0200170 <log
171 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200172 message="Endpoint to create operational policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdetdfa86ca2019-04-05 15:15:31 +0200173 <toD
sebdetcd64cc42019-04-10 14:07:35 +0200174 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}" />
sebdetea775862019-04-09 13:08:10 +0200175 <to
176 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational policy created successfully','INFO',${header.LoopObject})" />
sebdet919ef9d2019-04-08 18:32:26 +0200177 </route>
178 <route id="delete-operational-policy">
179 <from uri="direct:delete-operational-policy" />
180 <log
181 loggingLevel="INFO"
182 message="Deleting Operational Policy: ${header.operationalPolicy.getName()}" />
183 <setBody>
184 <constant>null</constant>
185 </setBody>
186 <setHeader headerName="CamelHttpMethod">
187 <constant>DELETE</constant>
188 </setHeader>
189 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200190 <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 +0200191 </simple>
192 </setHeader>
193 <log
194 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200195 message="Endpoint to delete operational policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdet919ef9d2019-04-08 18:32:26 +0200196 <toD
sebdetcd64cc42019-04-10 14:07:35 +0200197 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false" />
sebdetea775862019-04-09 13:08:10 +0200198 <to
199 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational policy deleted successfully','INFO',${header.LoopObject})" />
sebdet919ef9d2019-04-08 18:32:26 +0200200 </route>
201
202 <route id="create-guard-policy">
203 <from uri="direct:create-guard-policy" />
204 <log
205 loggingLevel="INFO"
206 message="Creating Guard Policy: ${header.guardPolicy.getKey()}" />
207 <setBody>
208 <simple>${header.guardPolicy.getValue()}
209 </simple>
210 </setBody>
211 <setHeader headerName="CamelHttpMethod">
212 <constant>POST</constant>
213 </setHeader>
214 <setHeader headerName="Content-Type">
215 <constant>application/json</constant>
216 </setHeader>
217 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200218 <simple>{{clamp.config.policy.url}}/policy/api/v1/policyTypes/onap.policies.controlloop.Guard/versions/1.0.0/policies
sebdet919ef9d2019-04-08 18:32:26 +0200219 </simple>
220 </setHeader>
221 <log
222 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200223 message="Endpoint to create guard policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdet919ef9d2019-04-08 18:32:26 +0200224 <toD
sebdetcd64cc42019-04-10 14:07:35 +0200225 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}" />
sebdetea775862019-04-09 13:08:10 +0200226 <to
227 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Guard policy created successfully','INFO',${header.LoopObject})" />
sebdet919ef9d2019-04-08 18:32:26 +0200228 </route>
229 <route id="delete-guard-policy">
230 <from uri="direct:delete-guard-policy" />
231 <log
232 loggingLevel="INFO"
233 message="Deleting Guard Policy: ${header.guardPolicy.getKey()}" />
234 <setBody>
235 <constant>null</constant>
236 </setBody>
237 <setHeader headerName="CamelHttpMethod">
238 <constant>DELETE</constant>
239 </setHeader>
240 <setHeader headerName="CamelHttpUri">
sebdeteb71d702019-04-09 18:10:32 +0200241 <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 +0200242 </simple>
243 </setHeader>
244 <log
245 loggingLevel="INFO"
sebdetea775862019-04-09 13:08:10 +0200246 message="Endpoint to delete guard policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
sebdet919ef9d2019-04-08 18:32:26 +0200247 <toD
sebdetcd64cc42019-04-10 14:07:35 +0200248 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}&amp;deleteWithBody=false&amp;mapHttpMessageBody=false&amp;mapHttpMessageFormUrlEncodedBody=false" />
sebdetea775862019-04-09 13:08:10 +0200249 <to
250 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Guard policy deleted successfully','INFO',${header.LoopObject})" />
sebdetdfa86ca2019-04-05 15:15:31 +0200251 </route>
sebdeteb71d702019-04-09 18:10:32 +0200252
253 <route id="create-pdp-group-policy">
254 <from uri="direct:create-pdp-group-policy" />
255 <log
256 loggingLevel="INFO"
257 message="Creating PDP Group Policy: ${header.guardPolicy.getKey()}" />
258 <setBody>
259 <simple>${header.LoopObject.createPoliciesPayloadPdpGroup()}
260 </simple>
261 </setBody>
262 <setHeader headerName="CamelHttpMethod">
263 <constant>POST</constant>
264 </setHeader>
265 <setHeader headerName="Content-Type">
266 <constant>application/json</constant>
267 </setHeader>
268 <setHeader headerName="CamelHttpUri">
269 <simple>{{clamp.config.policy.url}}/policy/pap/v1/pdps
270 </simple>
271 </setHeader>
272 <log
273 loggingLevel="INFO"
274 message="Endpoint to create PDP Group policy: ${header.CamelHttpMethod} ${header.CamelHttpUri}"></log>
275 <toD
sebdetcd64cc42019-04-10 14:07:35 +0200276 uri="http4://policyhost:8085?throwExceptionOnFailure=${header.RaiseHttpExceptionFlag}" />
sebdeteb71d702019-04-09 18:10:32 +0200277 <to
278 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Pdp Group created successfully','INFO',${header.LoopObject})" />
279 </route>
Determe, Sebastien (sd378r)7c083742018-02-14 15:31:55 +0100280</routes>