Merge "Fix bug when adding op policy"
[clamp.git] / src / main / resources / clds / camel / rest / clamp-api-v2.xml
1 <rests xmlns="http://camel.apache.org/schema/spring">
2         <rest>
3                 <get uri="/v2/loop/getAllNames" outType="java.lang.String[]"
4                         produces="application/json">
5                         <route>
6                                 <removeHeaders pattern="*" />
7                                 <doTry>
8                                         <to
9                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Loop')" />
10                                         <to
11                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
12                                         <to
13                                                 uri="bean:org.onap.clamp.loop.LoopController?method=getLoopNames()" />
14                                         <to
15                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
16                                         <doCatch>
17                                                 <exception>java.lang.Exception</exception>
18                                                 <handled>
19                                                         <constant>true</constant>
20                                                 </handled>
21                                                 <to
22                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
23                                                 <log loggingLevel="ERROR"
24                                                          message="GET All Loop names FAILED: ${exception.stacktrace}" />
25
26                                                 <setHeader headerName="CamelHttpResponseCode">
27                                                         <constant>500</constant>
28                                                 </setHeader>
29                                                 <setBody>
30                                                         <simple>GET All Loop names FAILED</simple>
31                                                 </setBody>
32                                         </doCatch>
33                                 </doTry>
34                         </route>
35                 </get>
36                 <get uri="/v2/loop/{loopName}" outType="org.onap.clamp.loop.Loop"
37                         produces="application/json">
38                         <route>
39                                 <removeHeaders pattern="*" excludePattern="loopName" />
40                                 <doTry>
41                                         <to
42                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET Loop')" />
43                                         <to
44                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
45                                         <to
46                                                 uri="bean:org.onap.clamp.loop.LoopController?method=getLoop(${header.loopName})" />
47                                         <to
48                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
49                                         <doCatch>
50                                                 <exception>java.lang.Exception</exception>
51                                                 <handled>
52                                                         <constant>true</constant>
53                                                 </handled>
54                                                 <to
55                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
56                                                 <log loggingLevel="ERROR"
57                                                          message="GET Loop request failed for loop: ${header.loopName}, ${exception.stacktrace}" />
58
59                                                 <setHeader headerName="CamelHttpResponseCode">
60                                                         <constant>500</constant>
61                                                 </setHeader>
62                                                 <setBody>
63                                                         <simple>GET Loop FAILED</simple>
64                                                 </setBody>
65                                         </doCatch>
66                                 </doTry>
67                         </route>
68                 </get>
69                 <get uri="/v2/loop/svgRepresentation/{loopName}"
70                         outType="java.lang.String" produces="application/xml">
71                         <route>
72                                 <removeHeaders pattern="*" excludePattern="loopName" />
73                                 <doTry>
74                                         <to
75                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get SVG Representation')" />
76                                         <to
77                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
78                                         <to
79                                                 uri="bean:org.onap.clamp.loop.LoopController?method=getSvgRepresentation(${header.loopName})" />
80                                         <to
81                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
82                                         <doCatch>
83                                                 <exception>java.lang.Exception</exception>
84                                                 <handled>
85                                                         <constant>true</constant>
86                                                 </handled>
87                                                 <to
88                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
89                                                 <log loggingLevel="ERROR"
90                                                          message="GET SVG request failed for loop: ${header.loopName}, ${exception.stacktrace}" />
91
92                                                 <setHeader headerName="CamelHttpResponseCode">
93                                                         <constant>500</constant>
94                                                 </setHeader>
95                                                 <setBody>
96                                                         <simple>GET SVG For loop FAILED</simple>
97                                                 </setBody>
98                                         </doCatch>
99                                 </doTry>
100                         </route>
101                 </get>
102
103                 <post uri="/v2/loop/updateGlobalProperties/{loopName}"
104                         type="com.google.gson.JsonObject" consumes="application/json"
105                         outType="org.onap.clamp.loop.Loop" produces="application/json">
106                         <route>
107                                 <removeHeaders pattern="*" excludePattern="loopName" />
108                                 <doTry>
109                                         <to
110                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update the global properties')" />
111                                         <to
112                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
113                                         <setHeader headerName="GlobalPropertiesJson">
114                                                 <simple>${body}</simple>
115                                         </setHeader>
116                                         <to uri="direct:load-loop" />
117                                         <to
118                                                 uri="bean:org.onap.clamp.loop.LoopController?method=updateGlobalPropertiesJson(${header.loopName},${header.GlobalPropertiesJson})" />
119                                         <to
120                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Global Properties UPDATED','INFO',${exchangeProperty[loopObject]})" />
121                                         <to
122                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
123                                         <doCatch>
124                                                 <exception>java.lang.Exception</exception>
125                                                 <handled>
126                                                         <constant>true</constant>
127                                                 </handled>
128                                                 <to
129                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
130                                                 <log loggingLevel="ERROR"
131                                                          message="UPDATE Global properties FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
132
133                                                 <setHeader headerName="CamelHttpResponseCode">
134                                                         <constant>500</constant>
135                                                 </setHeader>
136                                                 <setBody>
137                                                         <simple>UPDATE Global properties FAILED </simple>
138                                                 </setBody>
139                                         </doCatch>
140                                 </doTry>
141                         </route>
142                 </post>
143                 <post uri="/v2/loop/updateOperationalPolicies/{loopName}"
144                         type="com.google.gson.JsonArray" consumes="application/json"
145                         outType="org.onap.clamp.loop.Loop" produces="application/json">
146                         <route>
147                                 <removeHeaders pattern="*" excludePattern="loopName" />
148                                 <doTry>
149                                         <to
150                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update operational policies')" />
151                                         <to
152                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
153                                         <setHeader headerName="OperationalPoliciesArray">
154                                                 <simple>${body}</simple>
155                                         </setHeader>
156                                         <to uri="direct:load-loop" />
157                                         <to
158                                                 uri="bean:org.onap.clamp.loop.LoopController?method=updateOperationalPolicies(${header.loopName},${header.OperationalPoliciesArray})" />
159                                         <to
160                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Operational policies UPDATED','INFO',${exchangeProperty[loopObject]})" />
161                                         <to
162                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
163                                         <doCatch>
164                                                 <exception>java.lang.Exception</exception>
165                                                 <handled>
166                                                         <constant>true</constant>
167                                                 </handled>
168                                                 <to
169                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
170                                                 <log loggingLevel="ERROR"
171                                                          message="UPDATE Operational policies FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
172                                                 <to
173                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UPDATE Operational policies request FAILED, Error reported: ${exception.message}','ERROR',${exchangeProperty[loopObject]})" />
174
175                                                 <setHeader headerName="CamelHttpResponseCode">
176                                                         <constant>500</constant>
177                                                 </setHeader>
178                                                 <setBody>
179                                                         <simple>UPDATE Operational policies FAILED</simple>
180                                                 </setBody>
181                                         </doCatch>
182                                 </doTry>
183                         </route>
184                 </post>
185                 <post uri="/v2/loop/updateMicroservicePolicy/{loopName}"
186                         type="org.onap.clamp.policy.microservice.MicroServicePolicy"
187                         consumes="application/json"
188                         outType="org.onap.clamp.policy.microservice.MicroServicePolicy"
189                         produces="application/json">
190                         <route>
191                                 <removeHeaders pattern="*" excludePattern="loopName" />
192                                 <doTry>
193                                         <to
194                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Update Microservice policies')" />
195                                         <to
196                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
197                                         <setProperty propertyName="MicroServicePolicyObject">
198                                                 <simple>${body}</simple>
199                                         </setProperty>
200
201                                         <to uri="direct:load-loop" />
202                                         <to
203                                                 uri="bean:org.onap.clamp.loop.LoopController?method=updateMicroservicePolicy(${header.loopName},${exchangeProperty[MicroServicePolicyObject]})" />
204                                         <to
205                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Micro Service policies UPDATED','INFO',${exchangeProperty[loopObject]})" />
206                                         <to
207                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
208                                         <doCatch>
209                                                 <exception>java.lang.Exception</exception>
210                                                 <handled>
211                                                         <constant>true</constant>
212                                                 </handled>
213                                                 <to
214                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
215                                                 <log loggingLevel="ERROR"
216                                                          message="UPDATE MicroService policy FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
217                                                 <to
218                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UPDATE MicroService policy request FAILED, Error reported: ${exception.message}','ERROR',${exchangeProperty[loopObject]})" />
219                                                 <setHeader headerName="CamelHttpResponseCode">
220                                                         <constant>500</constant>
221                                                 </setHeader>
222                                                 <setBody>
223                                                         <simple>UPDATE MicroService policy FAILED</simple>
224                                                 </setBody>
225                                         </doCatch>
226                                 </doTry>
227                         </route>
228                 </post>
229                 <put uri="/v2/loop/deploy/{loopName}"
230                         outType="org.onap.clamp.loop.Loop" produces="application/json">
231                         <route>
232                                 <removeHeaders pattern="*" excludePattern="loopName" />
233                                 <doTry>
234                                         <log loggingLevel="INFO"
235                                                 message="DCAE DEPLOY request for loop: ${header.loopName}" />
236                                         <to
237                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'DCAE DEPLOY request')" />
238                                         <to
239                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
240                                         <to uri="direct:load-loop" />
241                                         <to
242                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DCAE DEPLOY request','INFO',${exchangeProperty[loopObject]})" />
243
244                                         <to uri="direct:deploy-loop" />
245
246                                         <log loggingLevel="INFO"
247                                                 message="DEPLOY request successfully executed for loop: ${header.loopName}" />
248                                         <to
249                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DEPLOY request successfully executed','INFO',${exchangeProperty[loopObject]})" />
250                                         <to
251                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
252                                         <doCatch>
253                                                 <exception>java.lang.Exception</exception>
254                                                 <handled>
255                                                         <constant>true</constant>
256                                                 </handled>
257                                                 <to
258                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
259                                                 <log loggingLevel="ERROR"
260                                                          message="DEPLOY request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
261                                                 <to
262                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DEPLOY request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
263                                                 <setHeader headerName="CamelHttpResponseCode">
264                                                         <constant>500</constant>
265                                                 </setHeader>
266                                                 <setBody>
267                                                         <simple>DEPLOY request FAILED</simple>
268                                                 </setBody>
269                                         </doCatch>
270                                 </doTry>
271                         </route>
272                 </put>
273                 <put uri="/v2/loop/refreshMicroServicePolicyJsonSchema/{loopName}/{microServicePolicyName}"
274                          outType="org.onap.clamp.loop.Loop" produces="application/json">
275                         <route>
276                                 <removeHeaders pattern="*" excludePattern="loopName|microServicePolicyName" />
277                                 <doTry>
278                                         <log loggingLevel="INFO"
279                                                  message="Refresh Micro Service Policy UI for loop: ${header.loopName} and ${header.microServicePolicyName}" />
280                                         <to
281                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'REFRESH Micro Service Policy UI request')" />
282                                         <to
283                                                         uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
284                                         <to uri="direct:load-loop" />
285                                         <to
286                                                         uri="bean:org.onap.clamp.loop.LoopController?method=refreshMicroServicePolicyJsonRepresentation(${exchangeProperty[loopObject]},${header.microServicePolicyName}})" />
287                                         <log loggingLevel="INFO"
288                                                  message="REFRESH Micro Service policy request successfully executed for loop: ${header.loopName}" />
289                                         <to
290                                                         uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH Micro Service policy request successfully executed','INFO',${exchangeProperty[loopObject]})" />
291                                         <to
292                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
293                                         <doCatch>
294                                                 <exception>java.lang.Exception</exception>
295                                                 <handled>
296                                                         <constant>true</constant>
297                                                 </handled>
298                                                 <to
299                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
300                                                 <log loggingLevel="ERROR"
301                                                          message="REFRESH json schema request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
302                                                 <to
303                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH Json schema request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
304                                                 <setHeader headerName="CamelHttpResponseCode">
305                                                         <constant>500</constant>
306                                                 </setHeader>
307                                                 <setBody>
308                                                         <simple>REFRESH json schema request FAILED</simple>
309                                                 </setBody>
310                                         </doCatch>
311                                 </doTry>
312                         </route>
313                 </put>
314                 <put uri="/v2/loop/refreshOperationalPolicyJsonSchema/{loopName}/{operationalPolicyName}"
315                         outType="org.onap.clamp.loop.Loop" produces="application/json">
316                         <route>
317                                 <removeHeaders pattern="*" excludePattern="loopName|operationalPolicyName" />
318                                 <doTry>
319                                         <log loggingLevel="INFO"
320                                                 message="Refresh Operational Policy UI for loop: ${header.loopName} and ${header.operationalPolicyName}" />
321                                         <to
322                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'REFRESH Operational Policy UI request')" />
323                                         <to
324                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
325                                         <to uri="direct:load-loop" />
326                                         <to
327                                                 uri="bean:org.onap.clamp.loop.LoopController?method=refreshOperationalPolicyJsonRepresentation(${exchangeProperty[loopObject]},${header.operationalPolicyName}})" />
328                                         <log loggingLevel="INFO"
329                                                 message="REFRESH operational policy request successfully executed for loop: ${header.loopName}" />
330                                         <to
331                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH operational policy request successfully executed','INFO',${exchangeProperty[loopObject]})" />
332                                         <to
333                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
334                                         <doCatch>
335                                                 <exception>java.lang.Exception</exception>
336                                                 <handled>
337                                                         <constant>true</constant>
338                                                 </handled>
339                                                 <to
340                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
341                                                 <log loggingLevel="ERROR"
342                                                          message="REFRESH json schema request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
343                                                 <to
344                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REFRESH Json schema request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
345                                                 <setHeader headerName="CamelHttpResponseCode">
346                                                         <constant>500</constant>
347                                                 </setHeader>
348                                                 <setBody>
349                                                         <simple>REFRESH json schema request FAILED</simple>
350                                                 </setBody>
351                                         </doCatch>
352                                 </doTry>
353                         </route>
354                 </put>
355                 <put uri="/v2/loop/undeploy/{loopName}"
356                         outType="org.onap.clamp.loop.Loop" produces="application/json">
357                         <route>
358                                 <removeHeaders pattern="*" excludePattern="loopName" />
359                                 <doTry>
360                                         <log loggingLevel="INFO"
361                                                 message="DCAE UNDEPLOY request for loop: ${header.loopName}" />
362                                         <to
363                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'DCAE UNDEPLOY request')" />
364                                         <to
365                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
366                                         <to uri="direct:load-loop" />
367                                         <to
368                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DCAE UNDEPLOY request','INFO',${exchangeProperty[loopObject]})" />
369                                         <to uri="direct:undeploy-loop" />
370
371                                         <log loggingLevel="INFO"
372                                                 message="UNDEPLOY request successfully executed for loop: ${header.loopName}" />
373                                         <to
374                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UNDEPLOY request successfully executed','INFO',${exchangeProperty[loopObject]})" />
375                                         <to
376                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
377                                         <doCatch>
378                                                 <exception>java.lang.Exception</exception>
379                                                 <handled>
380                                                         <constant>true</constant>
381                                                 </handled>
382                                                 <to
383                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
384                                                 <log loggingLevel="ERROR"
385                                                          message="UNDEPLOY request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
386                                                 <to
387                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('UNDEPLOY request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
388                                                 <setHeader headerName="CamelHttpResponseCode">
389                                                         <constant>500</constant>
390                                                 </setHeader>
391                                                 <setBody>
392                                                         <simple>UNDEPLOY request FAILED</simple>
393                                                 </setBody>
394                                         </doCatch>
395                                 </doTry>
396                         </route>
397                 </put>
398                 <put uri="/v2/loop/stop/{loopName}"
399                         outType="org.onap.clamp.loop.Loop" produces="application/json">
400                         <route>
401                                 <removeHeaders pattern="*" excludePattern="loopName" />
402                                 <doTry>
403                                         <log loggingLevel="INFO"
404                                                 message="STOP request for loop: ${header.loopName}" />
405                                         <to
406                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'STOP request')" />
407                                         <to
408                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
409                                         <to uri="direct:load-loop" />
410                                         <to
411                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request','INFO',${exchangeProperty[loopObject]})" />
412
413                                         <to uri="direct:remove-all-policy-from-active-pdp-group" />
414                                         <log loggingLevel="INFO"
415                                                 message="STOP request successfully executed for loop: ${header.loopName}" />
416                                         <to
417                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request successfully executed','INFO',${exchangeProperty[loopObject]})" />
418                                         <to
419                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
420                                         <doCatch>
421                                                 <exception>java.lang.Exception</exception>
422                                                 <handled>
423                                                         <constant>true</constant>
424                                                 </handled>
425                                                 <to
426                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
427                                                 <log loggingLevel="ERROR"
428                                                          message="STOP request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
429                                                 <to
430                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('STOP request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
431                                                 <setHeader headerName="CamelHttpResponseCode">
432                                                         <constant>500</constant>
433                                                 </setHeader>
434                                                 <setBody>
435                                                         <simple>STOP request FAILED</simple>
436                                                 </setBody>
437                                         </doCatch>
438                                 </doTry>
439                         </route>
440                 </put>
441                 <put uri="/v2/loop/restart/{loopName}"
442                         outType="org.onap.clamp.loop.Loop" produces="application/json">
443                         <route>
444                                 <removeHeaders pattern="*" excludePattern="loopName" />
445                                 <doTry>
446                                         <log loggingLevel="INFO"
447                                                 message="RESTART request for loop: ${header.loopName}" />
448                                         <to
449                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'RESTART request')" />
450                                         <to
451                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
452                                         <to uri="direct:load-loop" />
453
454                                         <to
455                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request','INFO',${exchangeProperty[loopObject]})" />
456
457                                         <to uri="direct:add-all-to-active-pdp-group" />
458                                         <log loggingLevel="INFO"
459                                                 message="RESTART request successfully executed for loop: ${header.loopName}" />
460                                         <to
461                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request successfully executed','INFO',${exchangeProperty[loopObject]})" />
462                                         <to
463                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
464                                         <doCatch>
465                                                 <exception>java.lang.Exception</exception>
466                                                 <handled>
467                                                         <constant>true</constant>
468                                                 </handled>
469                                                 <to
470                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
471                                                 <log loggingLevel="ERROR"
472                                                          message="RESTART request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
473                                                 <to
474                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('RESTART request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
475                                                 <setHeader headerName="CamelHttpResponseCode">
476                                                         <constant>500</constant>
477                                                 </setHeader>
478                                                 <setBody>
479                                                         <simple>RESTART request FAILED</simple>
480                                                 </setBody>
481                                         </doCatch>
482                                 </doTry>
483                         </route>
484                 </put>
485                 <put uri="/v2/loop/submit/{loopName}"
486                         outType="org.onap.clamp.loop.Loop" produces="application/json">
487                         <route>
488                                 <removeHeaders pattern="*" excludePattern="loopName" />
489                                 <doTry>
490                                         <log loggingLevel="INFO"
491                                                 message="POLICY SUBMIT request for loop: ${header.loopName}" />
492                                         <to
493                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'POLICY SUBMIT request')" />
494                                         <to
495                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
496                                         <to uri="direct:load-loop" />
497                                         <to
498                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('POLICY SUBMIT request','INFO',${exchangeProperty[loopObject]})" />
499                                         <setProperty propertyName="raiseHttpExceptionFlag">
500                                                 <simple resultType="java.lang.Boolean">false</simple>
501                                         </setProperty>
502                                         <to uri="direct:remove-all-policy-from-active-pdp-group" />
503                                         <log loggingLevel="INFO"
504                                                 message="Processing all MICRO-SERVICES policies defined in loop ${exchangeProperty[loopObject].getName()}" />
505                                         <split>
506                                                 <simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
507                                                 </simple>
508                                                 <setProperty propertyName="policy">
509                                                         <simple>${body}</simple>
510                                                 </setProperty>
511                                                 <log loggingLevel="INFO"
512                                                         message="Processing Micro Service Policy: ${exchangeProperty[policy].getName()}" />
513                                                 <setProperty propertyName="raiseHttpExceptionFlag">
514                                                         <simple resultType="java.lang.Boolean">false</simple>
515                                                 </setProperty>
516                                                 <to uri="direct:delete-policy" />
517                                                 <to uri="direct:create-policy" />
518                                         </split>
519                                         <log loggingLevel="INFO"
520                                                 message="Processing all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" />
521                                         <split>
522                                                 <simple>${exchangeProperty[loopObject].getOperationalPolicies()}
523                                                 </simple>
524                                                 <setProperty propertyName="policy">
525                                                         <simple>${body}</simple>
526                                                 </setProperty>
527                                                 <log loggingLevel="INFO"
528                                                         message="Processing Operational Policy: ${exchangeProperty[policy].getName()}" />
529                                                 <setProperty propertyName="raiseHttpExceptionFlag">
530                                                         <simple resultType="java.lang.Boolean">false</simple>
531                                                 </setProperty>
532
533                                                 <to uri="direct:delete-policy" />
534                                                 <to uri="direct:create-policy" />
535                                         </split>
536
537                                         <delay>
538                                                 <constant>3000</constant>
539                                         </delay>
540
541                                         <to uri="direct:add-all-to-active-pdp-group" />
542
543                                         <log loggingLevel="INFO"
544                                                 message="SUBMIT request successfully executed for loop: ${header.loopName}" />
545                                         <to
546                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request successfully executed','INFO',${exchangeProperty[loopObject]})" />
547                                         <to
548                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
549                                         <doCatch>
550                                                 <exception>java.lang.Exception</exception>
551                                                 <handled>
552                                                         <constant>true</constant>
553                                                 </handled>
554                                                 <to
555                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
556                                                 <log loggingLevel="ERROR"
557                                                          message="SUBMIT request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
558                                                 <to
559                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('SUBMIT request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
560                                                 <setHeader headerName="CamelHttpResponseCode">
561                                                         <constant>500</constant>
562                                                 </setHeader>
563                                                 <setBody>
564                                                         <simple>SUBMIT request FAILED</simple>
565                                                 </setBody>
566                                         </doCatch>
567                                 </doTry>
568                         </route>
569                 </put>
570                 <put uri="/v2/loop/delete/{loopName}">
571                         <route>
572                                 <removeHeaders pattern="*" excludePattern="loopName" />
573                                 <doTry>
574                                         <log loggingLevel="INFO"
575                                                 message="DELETE request for loop: ${header.loopName}" />
576                                         <to
577                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*,'DELETE request')" />
578                                         <to
579                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
580                                         <to uri="direct:load-loop" />
581                                         <to
582                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request','INFO',${exchangeProperty[loopObject]})" />
583                                         <to uri="direct:undeploy-loop" />
584                                         <to uri="direct:remove-all-policy-from-active-pdp-group" />
585                                         <log loggingLevel="INFO"
586                                                 message="Deleting all MICRO-SERVICES policies defined in loop ${exchangeProperty[loopObject].getName()}" />
587                                         <split>
588                                                 <simple>${exchangeProperty[loopObject].getMicroServicePolicies()}
589                                                 </simple>
590                                                 <setProperty propertyName="policy">
591                                                         <simple>${body}</simple>
592                                                 </setProperty>
593                                                 <log loggingLevel="INFO"
594                                                         message="Deleting Micro Service Policy: ${exchangeProperty[policy].getName()}" />
595                                                 <setProperty propertyName="raiseHttpExceptionFlag">
596                                                         <simple resultType="java.lang.Boolean">false</simple>
597                                                 </setProperty>
598                                                 <to uri="direct:delete-policy" />
599                                         </split>
600                                         <log loggingLevel="INFO"
601                                                 message="Deleting all OPERATIONAL policies defined in loop ${exchangeProperty[loopObject].getName()}" />
602                                         <split>
603                                                 <simple>${exchangeProperty[loopObject].getOperationalPolicies()}
604                                                 </simple>
605                                                 <setProperty propertyName="policy">
606                                                         <simple>${body}</simple>
607                                                 </setProperty>
608                                                 <log loggingLevel="INFO"
609                                                         message="Deleting Operational Policy: ${exchangeProperty[policy].getName()}" />
610                                                 <setProperty propertyName="raiseHttpExceptionFlag">
611                                                         <simple resultType="java.lang.Boolean">false</simple>
612                                                 </setProperty>
613                                                 <to uri="direct:delete-policy" />
614                                         </split>
615                                         <to
616                                                 uri="bean:org.onap.clamp.loop.LoopController?method=deleteLoop(${header.loopName})" />
617                                         <log loggingLevel="INFO"
618                                                 message="DELETE request successfully executed for loop: ${header.loopName}" />
619                                         <to
620                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
621                                         <doCatch>
622                                                 <exception>java.lang.Exception</exception>
623                                                 <handled>
624                                                         <constant>true</constant>
625                                                 </handled>
626                                                 <to
627                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
628                                                 <log loggingLevel="ERROR"
629                                                          message="DELETE request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
630                                                 <to
631                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('DELETE request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
632                                                 <setHeader headerName="CamelHttpResponseCode">
633                                                         <constant>500</constant>
634                                                 </setHeader>
635                                                 <setBody>
636                                                         <simple>DELETE request FAILED</simple>
637                                                 </setBody>
638                                         </doCatch>
639                                 </doTry>
640                         </route>
641                 </put>
642                 <get uri="/v2/loop/getstatus/{loopName}"
643                         outType="org.onap.clamp.loop.Loop" produces="application/json">
644                         <route>
645                                 <removeHeaders pattern="*" excludePattern="loopName" />
646                                 <doTry>
647                                         <log loggingLevel="INFO"
648                                                 message="GET STATUS request for loop: ${header.loopName}" />
649                                         <to
650                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET STATUS request')" />
651                                         <to
652                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','read')" />
653                                         <to uri="direct:load-loop" />
654                                         <to
655                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('GET STATUS request','INFO',${exchangeProperty[loopObject]})" />
656                                         <to uri="direct:update-policy-status-for-loop" />
657                                         <to uri="direct:update-dcae-status-for-loop" />
658                                         <to uri="direct:update-loop-state" />
659
660                                         <to
661                                                         uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('GET STATUS request successfully executed','INFO',${exchangeProperty[loopObject]})" />
662                                         <to
663                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
664                                         <doCatch>
665                                                 <exception>java.lang.Exception</exception>
666                                                 <handled>
667                                                         <constant>true</constant>
668                                                 </handled>
669                                                 <to
670                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
671                                                 <log loggingLevel="ERROR"
672                                                          message="GET STATUS request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
673                                                 <to
674                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('GET STATUS request failed, Error reported: ${exception} - Body: ${exception.responseBody}','ERROR',${exchangeProperty[loopObject]})" />
675                                         </doCatch>
676                                         <doFinally>
677                                                 <setBody>
678                                                         <simple>${exchangeProperty[loopObject]}</simple>
679                                                 </setBody>
680                                                 <setHeader headerName="CamelHttpResponseCode">
681                                                         <constant>200</constant>
682                                                 </setHeader>
683                                         </doFinally>
684                                 </doTry>
685                         </route>
686                 </get>
687
688                 <put uri="/v2/loop/addOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}" outType="org.onap.clamp.loop.Loop" produces="application/json">
689                         <route>
690                                 <removeHeaders pattern="*" excludePattern="loopName|policyType|policyVersion" />
691                                 <doTry>
692                                         <to
693                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Add operational Policy')" />
694                                         <to
695                                                         uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
696                                         <to uri="direct:load-loop" />
697                                         <to
698                                                         uri="bean:org.onap.clamp.loop.LoopController?method=addOperationalPolicy(${header.loopName},${header.policyType},${header.policyVersion})" />
699                                         <to
700                                                         uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('ADD OperationalPolicy request successfully executed','INFO',${exchangeProperty[loopObject]})" />
701                                         <to
702                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
703                                         <doCatch>
704                                                 <exception>java.lang.Exception</exception>
705                                                 <handled>
706                                                         <constant>true</constant>
707                                                 </handled>
708                                                 <to
709                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
710                                                 <log loggingLevel="ERROR"
711                                                          message="ADD operational policy request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
712                                                 <to
713                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('ADD OperationalPolicy request failed','ERROR',${exchangeProperty[loopObject]})" />
714                                                 <setHeader headerName="CamelHttpResponseCode">
715                                                         <constant>500</constant>
716                                                 </setHeader>
717                                                 <setBody>
718                                                         <simple>ADD Operational policy request FAILED for loop: ${header.loopName}, ${exception.message}"</simple>
719                                                 </setBody>
720                                                 
721                                         </doCatch>
722                                 </doTry>
723                         </route>
724                 </put>
725                 <put uri="/v2/loop/removeOperationaPolicy/{loopName}/policyModel/{policyType}/{policyVersion}/{policyName}" outType="org.onap.clamp.loop.Loop" produces="application/json">
726                         <route>
727                                 <removeHeaders pattern="*" excludePattern="loopName|policyType|policyVersion|policyName" />
728                                 <doTry>
729                                         <to
730                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'REMOVE operational Policy')" />
731                                         <to
732                                                         uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
733                                         <to uri="direct:load-loop" />
734                                         <setProperty propertyName="policyName">
735                                                 <simple>${header.policyName}</simple>
736                                         </setProperty>
737                                         <setProperty propertyName="policy">
738                                                 <simple>${exchangeProperty[loopObject].getOperationalPolicy(header.policyName)}</simple>
739                                         </setProperty>
740                                         <setProperty propertyName="raiseHttpExceptionFlag">
741                                                 <simple resultType="java.lang.Boolean">false</simple>
742                                         </setProperty>
743                                         <to uri="direct:remove-one-policy-from-active-pdp-group" />
744                                         <setProperty propertyName="raiseHttpExceptionFlag">
745                                                 <simple resultType="java.lang.Boolean">false</simple>
746                                         </setProperty>
747                                         <to uri="direct:delete-policy" />
748                                         <to
749                                                         uri="bean:org.onap.clamp.loop.LoopController?method=removeOperationalPolicy(${header.loopName},${header.policyType},${header.policyVersion})" />
750                                         <to
751                                                         uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REMOVE OperationalPolicy request successfully executed','INFO',${exchangeProperty[loopObject]})" />
752                                         <to
753                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
754                                         <doCatch>
755                                                 <exception>java.lang.Exception</exception>
756                                                 <handled>
757                                                         <constant>true</constant>
758                                                 </handled>
759                                                 <to
760                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
761                                                 <log loggingLevel="ERROR"
762                                                          message="REMOVE operational policy request FAILED for loop: ${header.loopName}, ${exception.stacktrace}" />
763                                                 <to
764                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('REMOVE OperationalPolicy request failed','ERROR',${exchangeProperty[loopObject]})" />
765                                                 <setHeader headerName="CamelHttpResponseCode">
766                                                         <constant>500</constant>
767                                                 </setHeader>
768                                                 <setBody>
769                                                         <simple>REMOVE Operational policy request FAILED</simple>
770                                                 </setBody>
771                                         </doCatch>
772                                 </doTry>
773                         </route>
774                 </put>
775                 <post
776                                 uri="/v2/loop/create/{loopName}?templateName={templateName}"
777                                 outType="org.onap.clamp.loop.Loop" consumes="application/json"
778                                 produces="application/json">
779                         <route>
780                                 <removeHeaders
781                                                 pattern="*"
782                                                 excludePattern="loopName|templateName" />
783                                 <doTry>
784                                         <to
785                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Create Loop')" />
786                                         <to
787                                                         uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'cl','','update')" />
788                                         <to
789                                                         uri="bean:org.onap.clamp.loop.LoopController?method=createLoop(${header.loopName}, ${header.templateName})" />
790                                         <to
791                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
792                                         <doCatch>
793                                                 <exception>java.lang.Exception</exception>
794                                                 <handled>
795                                                         <constant>true</constant>
796                                                 </handled>
797                                                 <to
798                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
799                                                 <log loggingLevel="ERROR"
800                                                          message="CREATE Loop from Template request failed for loop: ${header.loopName}, ${exception.stacktrace}" />
801                                                 <to
802                                                                 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('CREATE Loop from template request failed','ERROR',${exchangeProperty[loopObject]})" />
803                                                 <setHeader headerName="CamelHttpResponseCode">
804                                                         <constant>500</constant>
805                                                 </setHeader>
806                                                 <setBody>
807                                                         <simple>CREATE Loop from template FAILED</simple>
808                                                 </setBody>
809                                         </doCatch>
810                                 </doTry>
811                         </route>
812                 </post>
813                 <get uri="/v2/dictionary"
814                         outType="org.onap.clamp.tosca.Dictionary" produces="application/json">
815                         <route>
816                                 <removeHeaders pattern="*" />
817                                 <doTry>
818                                         <to
819                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Dictionaries')" />
820                                         <to
821                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" />
822                                         <to
823                                                 uri="bean:org.onap.clamp.tosca.DictionaryService?method=getAllDictionaries()" />
824                                         <to
825                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
826                                         <doCatch>
827                                                 <exception>java.lang.Exception</exception>
828                                                 <handled>
829                                                         <constant>true</constant>
830                                                 </handled>
831                                                 <to
832                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
833                                                 <log loggingLevel="ERROR"
834                                                          message="GET Dictionary request failed: ${exception.stacktrace}" />
835                                                 <setHeader headerName="CamelHttpResponseCode">
836                                                         <constant>500</constant>
837                                                 </setHeader>
838                                                 <setBody>
839                                                         <simple>GET Dictionary FAILED</simple>
840                                                 </setBody>
841                                         </doCatch>
842                                 </doTry>
843                         </route>
844                 </get>
845
846                 <get uri="/v2/dictionary/secondary/names"
847                         outType="java.lang.String[]" produces="application/json">
848                         <route>
849                                 <removeHeaders pattern="*" />
850                                 <doTry>
851                                         <to
852                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Secondary Dictionary Level Names')" />
853                                         <to
854                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" />
855                                         <to
856                                                 uri="bean:org.onap.clamp.tosca.DictionaryService?method=getAllSecondaryLevelDictionaryNames()" />
857                                         <to
858                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
859                                         <doCatch>
860                                                 <exception>java.lang.Exception</exception>
861                                                 <handled>
862                                                         <constant>true</constant>
863                                                 </handled>
864                                                 <to
865                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
866                                                 <log loggingLevel="ERROR"
867                                                          message="GET Dictionary request failed: ${exception.stacktrace}" />
868                                                 <setHeader headerName="CamelHttpResponseCode">
869                                                         <constant>500</constant>
870                                                 </setHeader>
871                                                 <setBody>
872                                                         <simple>GET Dictionary FAILED</simple>
873                                                 </setBody>
874                                         </doCatch>
875                                 </doTry>
876                         </route>
877                 </get>
878                 <get uri="/v2/dictionary/{dictionaryName}"
879                         outType="org.onap.clamp.tosca.Dictionary" produces="application/json">
880                         <route>
881                                 <removeHeaders pattern="*"
882                                         excludePattern="dictionaryName" />
883                                 <doTry>
884                                         <to
885                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Dictionary Elements for a Dictionary Name')" />
886                                         <to
887                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" />
888                                         <to
889                                                 uri="bean:org.onap.clamp.tosca.DictionaryService?method=getDictionary(${header.dictionaryName})" />
890                                         <to
891                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
892                                         <doCatch>
893                                                 <exception>java.lang.Exception</exception>
894                                                 <handled>
895                                                         <constant>true</constant>
896                                                 </handled>
897                                                 <to
898                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
899                                                 <log loggingLevel="ERROR"
900                                                          message="GET Dictionary request failed for: ${header.dictionaryName}, ${exception.stacktrace}" />
901                                                 <setHeader headerName="CamelHttpResponseCode">
902                                                         <constant>500</constant>
903                                                 </setHeader>
904                                                 <setBody>
905                                                         <simple>GET Dictionary FAILED</simple>
906                                                 </setBody>
907                                         </doCatch>
908                                 </doTry>
909                         </route>
910                 </get>
911                 <put uri="/v2/dictionary" type="org.onap.clamp.tosca.Dictionary"
912                         outType="org.onap.clamp.tosca.Dictionary" consumes="application/json"
913                         produces="application/json">
914                         <route>
915                                 <doTry>
916                                         <to
917                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Add New or Update Dictionary')" />
918                                         <to
919                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','update')" />
920                                         <setProperty propertyName="DictionaryObject">
921                                                 <simple>${body}</simple>
922                                         </setProperty>
923                                         <to
924                                                 uri="bean:org.onap.clamp.tosca.DictionaryService?method=saveOrUpdateDictionary(${exchangeProperty[DictionaryObject]})" />
925                                         <to
926                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
927                                         <doCatch>
928                                                 <exception>java.lang.Exception</exception>
929                                                 <handled>
930                                                         <constant>true</constant>
931                                                 </handled>
932                                                 <to
933                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
934                                                 <log loggingLevel="ERROR"
935                                                          message="PUT Dictionary request failed for: ${exception.stacktrace}" />
936                                                 <setHeader headerName="CamelHttpResponseCode">
937                                                         <constant>500</constant>
938                                                 </setHeader>
939                                                 <setBody>
940                                                         <simple>PUT Dictionary FAILED</simple>
941                                                 </setBody>
942                                         </doCatch>
943                                 </doTry>
944                         </route>
945                 </put>
946
947                 <put uri="/v2/dictionary/{name}"
948                         type="org.onap.clamp.tosca.Dictionary"
949                         outType="org.onap.clamp.tosca.Dictionary" consumes="application/json"
950                         produces="application/json">
951                         <route>
952                                 <removeHeaders pattern="*" excludePattern="name" />
953                                 <doTry>
954                                         <to
955                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Add New or Update Dictionary Element')" />
956                                         <to
957                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','update')" />
958                                         <setProperty propertyName="DictionaryObject">
959                                                 <simple>${body}</simple>
960                                         </setProperty>
961                                         <to
962                                                 uri="bean:org.onap.clamp.tosca.DictionaryService?method=saveOrUpdateDictionaryElement(${header.name}, ${exchangeProperty[DictionaryObject]})" />
963                                         <to
964                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
965                                         <doCatch>
966                                                 <exception>java.lang.Exception</exception>
967                                                 <handled>
968                                                         <constant>true</constant>
969                                                 </handled>
970                                                 <to
971                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
972                                                 <log loggingLevel="ERROR"
973                                                          message="PUT Dictionary request failed for: ${header.name}, ${exception.stacktrace}" />
974                                                 <setHeader headerName="CamelHttpResponseCode">
975                                                         <constant>500</constant>
976                                                 </setHeader>
977                                                 <setBody>
978                                                         <simple>PUT Dictionary FAILED</simple>
979                                                 </setBody>
980                                         </doCatch>
981                                 </doTry>
982                         </route>
983                 </put>
984
985                 <delete uri="/v2/dictionary/{name}" produces="application/json">
986                         <route>
987                                 <removeHeaders pattern="*" excludePattern="name" />
988                                 <doTry>
989                                         <to
990                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Delete Dictionary')" />
991                                         <to
992                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','update')" />
993                                         <to
994                                                 uri="bean:org.onap.clamp.tosca.DictionaryService?method=deleteDictionary(${header.name})" />
995                                         <to
996                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
997                                         <doCatch>
998                                                 <exception>java.lang.Exception</exception>
999                                                 <handled>
1000                                                         <constant>true</constant>
1001                                                 </handled>
1002                                                 <to
1003                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
1004                                                 <log loggingLevel="ERROR"
1005                                                          message="DELETE Dictionary request failed for: ${header.name}, ${exception.stacktrace}" />
1006                                                 <setHeader headerName="CamelHttpResponseCode">
1007                                                         <constant>500</constant>
1008                                                 </setHeader>
1009                                                 <setBody>
1010                                                         <simple>DELETE Dictionary FAILED</simple>
1011                                                 </setBody>
1012                                         </doCatch>
1013                                 </doTry>
1014                         </route>
1015                 </delete>
1016
1017                 <delete uri="/v2/dictionary/{name}/elements/{shortName}"
1018                         produces="application/json">
1019                         <route>
1020                                 <removeHeaders pattern="*"
1021                                         excludePattern="name|shortName" />
1022                                 <doTry>
1023                                         <to
1024                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Delete Dictionary Element')" />
1025                                         <to
1026                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','update')" />
1027                                         <to
1028                                                 uri="bean:org.onap.clamp.tosca.DictionaryService?method=deleteDictionaryElement(${header.name}, ${header.shortName})" />
1029                                         <to
1030                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
1031                                         <doCatch>
1032                                                 <exception>java.lang.Exception</exception>
1033                                                 <handled>
1034                                                         <constant>true</constant>
1035                                                 </handled>
1036                                                 <to
1037                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
1038                                                 <log loggingLevel="ERROR"
1039                                                          message="DELETE Dictionary element request failed for: ${header.name}, ${exception.stacktrace}" />
1040                                                 <setHeader headerName="CamelHttpResponseCode">
1041                                                         <constant>500</constant>
1042                                                 </setHeader>
1043                                                 <setBody>
1044                                                         <simple>DELETE Dictionary element FAILED</simple>
1045                                                 </setBody>
1046                                         </doCatch>
1047                                 </doTry>
1048                         </route>
1049                 </delete>
1050
1051                 <get uri="/v2/policyToscaModels"
1052                         outType="org.onap.clamp.loop.template.PolicyModel"
1053                         produces="application/json">
1054                         <route>
1055                                 <removeHeaders pattern="*" />
1056                                 <doTry>
1057                                         <to
1058                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Tosca Policy Models')" />
1059                                         <to
1060                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" />
1061                                         <to
1062                                                 uri="bean:org.onap.clamp.loop.template.PolicyModelsService?method=getAllPolicyModels()" />
1063                                         <to
1064                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
1065                                         <doCatch>
1066                                                 <exception>java.lang.Exception</exception>
1067                                                 <handled>
1068                                                         <constant>true</constant>
1069                                                 </handled>
1070                                                 <to
1071                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
1072                                                 <log loggingLevel="ERROR"
1073                                                          message="GET Policy Models request failed for: ${exception.stacktrace}" />
1074                                                 <setHeader headerName="CamelHttpResponseCode">
1075                                                         <constant>500</constant>
1076                                                 </setHeader>
1077                                                 <setBody>
1078                                                         <simple>GET Policy models FAILED</simple>
1079                                                 </setBody>
1080                                         </doCatch>
1081                                 </doTry>
1082                         </route>
1083                 </get>
1084                 <get uri="/v2/policyToscaModels/{policyModelType}/{policyModelVersion}"
1085                         outType="org.onap.clamp.loop.template.PolicyModel"
1086                         produces="application/json">
1087                         <route>
1088                                 <removeHeaders pattern="*"
1089                                         excludePattern="policyModelType|policyModelVersion" />
1090                                 <doTry>
1091                                         <to
1092                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET Tosca Policy Model by Name/Version')" />
1093                                         <to
1094                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" />
1095                                         <to
1096                                                 uri="bean:org.onap.clamp.loop.template.PolicyModelsService?method=getPolicyModelByType(${header.policyModelType},${header.policyModelVersion})" />
1097                                         <to
1098                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
1099                                         <doCatch>
1100                                                 <exception>java.lang.Exception</exception>
1101                                                 <handled>
1102                                                         <constant>true</constant>
1103                                                 </handled>
1104                                                 <to
1105                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
1106                                                 <log loggingLevel="ERROR"
1107                                                          message="GET Policy Model request failed for type: ${header.policyModelType}, ${exception.stacktrace}" />
1108                                                 <setHeader headerName="CamelHttpResponseCode">
1109                                                         <constant>500</constant>
1110                                                 </setHeader>
1111                                                 <setBody>
1112                                                         <simple>GET Policy model FAILED</simple>
1113                                                 </setBody>
1114                                         </doCatch>
1115                                 </doTry>
1116                         </route>
1117                 </get>
1118                 <get uri="/v2/policyToscaModels/yaml/{policyModelType}/{policyModelVersion}"
1119                         outType="java.lang.String" produces="application/json">
1120                         <route>
1121                                 <removeHeaders pattern="*"
1122                                         excludePattern="policyModelType|policyModelVersion" />
1123                                 <doTry>
1124                                         <to
1125                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET Tosca Policy Model Yaml String by Name/Version')" />
1126                                         <to
1127                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','read')" />
1128                                         <to
1129                                                 uri="bean:org.onap.clamp.loop.template.PolicyModelsService?method=getPolicyModelTosca(${header.policyModelType},${header.policyModelVersion})" />
1130                                         <to
1131                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
1132                                         <doCatch>
1133                                                 <exception>java.lang.Exception</exception>
1134                                                 <handled>
1135                                                         <constant>true</constant>
1136                                                 </handled>
1137                                                 <to
1138                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
1139                                                 <log loggingLevel="ERROR"
1140                                                          message="GET Policy Model YAML request failed for type: ${header.policyModelType}, ${exception.stacktrace}" />
1141                                                 <setHeader headerName="CamelHttpResponseCode">
1142                                                         <constant>500</constant>
1143                                                 </setHeader>
1144                                                 <setBody>
1145                                                         <simple>GET Policy model YAML FAILED</simple>
1146                                                 </setBody>
1147                                         </doCatch>
1148                                 </doTry>
1149                         </route>
1150                 </get>
1151
1152                 <post uri="/v2/policyToscaModels"
1153                         type="java.lang.String"
1154                         outType="org.onap.clamp.loop.template.PolicyModel"
1155                         consumes="plain/text" produces="application/json">
1156                         <route>
1157                                 <removeHeaders pattern="*"/>
1158                                 <doTry>
1159                                         <to
1160                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Upload New or Update Tosca Policy Model')" />
1161                                         <to
1162                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','update')" />
1163                                         <setProperty propertyName="PolicyModelTosca">
1164                                                 <simple>${body}</simple>
1165                                         </setProperty>
1166                                         <to
1167                                                 uri="bean:org.onap.clamp.loop.template.PolicyModelsService?method=createNewPolicyModelFromTosca(${exchangeProperty[PolicyModelTosca]})" />
1168                                         <to
1169                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
1170                                         <doCatch>
1171                                                 <exception>java.lang.Exception</exception>
1172                                                 <handled>
1173                                                         <constant>true</constant>
1174                                                 </handled>
1175                                                 <to
1176                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
1177                                                 <log loggingLevel="ERROR"
1178                                                          message="POST Policy Model YAML request failed: ${exception.stacktrace}" />
1179                                                 <setHeader headerName="CamelHttpResponseCode">
1180                                                         <constant>500</constant>
1181                                                 </setHeader>
1182                                                 <setBody>
1183                                                         <simple>POST Policy model YAML FAILED</simple>
1184                                                 </setBody>
1185                                         </doCatch>
1186                                 </doTry>
1187                         </route>
1188                 </post>
1189                 <put uri="/v2/policyToscaModels/{policyModelType}/{policyModelVersion}"
1190                           type="java.lang.String"
1191                           outType="org.onap.clamp.loop.template.PolicyModel"
1192                           consumes="plain/text" produces="application/json">
1193                         <route>
1194                                 <removeHeaders pattern="*"
1195                                                            excludePattern="policyModelType|policyModelVersion" />
1196                                 <doTry>
1197                                         <to
1198                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Upload New or Update Tosca Policy Model')" />
1199                                         <to
1200                                                         uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'tosca','','update')" />
1201                                         <setProperty propertyName="PolicyModelTosca">
1202                                                 <simple>${body}</simple>
1203                                         </setProperty>
1204                                         <to
1205                                                         uri="bean:org.onap.clamp.loop.template.PolicyModelsService?method=updatePolicyModelTosca(${header.policyModelType},${policyModelVersion},${exchangeProperty[PolicyModelTosca]})" />
1206                                         <to
1207                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
1208                                         <doCatch>
1209                                                 <exception>java.lang.Exception</exception>
1210                                                 <handled>
1211                                                         <constant>true</constant>
1212                                                 </handled>
1213                                                 <to
1214                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
1215                                                 <log loggingLevel="ERROR"
1216                                                          message="MODIFY Policy Model YAML request failed: ${exception.stacktrace}" />
1217                                                 <setHeader headerName="CamelHttpResponseCode">
1218                                                         <constant>500</constant>
1219                                                 </setHeader>
1220                                                 <setBody>
1221                                                         <simple>MODIFY Policy model YAML FAILED</simple>
1222                                                 </setBody>
1223                                         </doCatch>
1224                                 </doTry>
1225                         </route>
1226                 </put>
1227
1228                 <get uri="/v2/templates"
1229                         outType="org.onap.clamp.loop.template.LoopTemplate"
1230                         produces="application/json">
1231                         <route>
1232                                 <removeHeaders pattern="*" />
1233                                 <doTry>
1234                                         <to
1235                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Templates')" />
1236                                         <to
1237                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')" />
1238                                         <to
1239                                                 uri="bean:org.onap.clamp.loop.template.LoopTemplatesService?method=getAllLoopTemplates()" />
1240                                         <to
1241                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
1242                                         <doCatch>
1243                                                 <exception>java.lang.Exception</exception>
1244                                                 <handled>
1245                                                         <constant>true</constant>
1246                                                 </handled>
1247                                                 <to
1248                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
1249                                                 <log loggingLevel="ERROR"
1250                                                          message="GET ALL templates request failed: ${exception.stacktrace}" />
1251                                                 <setHeader headerName="CamelHttpResponseCode">
1252                                                         <constant>500</constant>
1253                                                 </setHeader>
1254                                                 <setBody>
1255                                                         <simple>GET ALL templates FAILED</simple>
1256                                                 </setBody>
1257                                         </doCatch>
1258                                 </doTry>
1259                         </route>
1260                 </get>
1261                 <get uri="/v2/templates/{templateName}"
1262                         outType="org.onap.clamp.loop.template.LoopTemplate"
1263                         produces="application/json">
1264                         <route>
1265                                 <removeHeaders pattern="*"
1266                                         excludePattern="templateName" />
1267                                 <doTry>
1268                                         <to
1269                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET a Template by NAME')" />
1270                                         <to
1271                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')" />
1272                                         <to
1273                                                 uri="bean:org.onap.clamp.loop.template.LoopTemplatesService?method=getLoopTemplate(${header.templateName})" />
1274                                         <to
1275                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
1276                                         <doCatch>
1277                                                 <exception>java.lang.Exception</exception>
1278                                                 <handled>
1279                                                         <constant>true</constant>
1280                                                 </handled>
1281                                                 <to
1282                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
1283                                                 <log loggingLevel="ERROR"
1284                                                          message="GET Template request failed for template: ${header.templateName},  ${exception.stacktrace}" />
1285                                                 <setHeader headerName="CamelHttpResponseCode">
1286                                                         <constant>500</constant>
1287                                                 </setHeader>
1288                                                 <setBody>
1289                                                         <simple>GET Template FAILED</simple>
1290                                                 </setBody>
1291                                         </doCatch>
1292                                 </doTry>
1293                         </route>
1294                 </get>
1295                 <get uri="/v2/templates/names" outType="java.lang.String[]"
1296                         produces="application/json">
1297                         <route>
1298                                 <removeHeaders pattern="*" />
1299                                 <doTry>
1300                                         <to
1301                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'GET ALL Loop Template Names')" />
1302                                         <to
1303                                                 uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')" />
1304                                         <to
1305                                                 uri="bean:org.onap.clamp.loop.template.LoopTemplatesService?method=getLoopTemplateNames()" />
1306                                         <to
1307                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
1308                                         <doCatch>
1309                                                 <exception>java.lang.Exception</exception>
1310                                                 <handled>
1311                                                         <constant>true</constant>
1312                                                 </handled>
1313                                                 <to
1314                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
1315                                                 <log loggingLevel="ERROR"
1316                                                          message="GET All Template names request failed for template:  ${exception.stacktrace}" />
1317                                                 <setHeader headerName="CamelHttpResponseCode">
1318                                                         <constant>500</constant>
1319                                                 </setHeader>
1320                                                 <setBody>
1321                                                         <simple>GET All Template names FAILED</simple>
1322                                                 </setBody>
1323                                         </doCatch>
1324                                 </doTry>
1325                         </route>
1326                 </get>
1327                 <get uri="/v2/templates/{templateName}/svgRepresentation"
1328                          outType="java.lang.String" produces="application/xml">
1329                         <route>
1330                                 <removeHeaders pattern="*" excludePattern="templateName" />
1331                                 <doTry>
1332                                         <to
1333                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=startLog(*, 'Get SVG Representation for Loop template')" />
1334                                         <to
1335                                                         uri="bean:org.onap.clamp.authorization.AuthorizationController?method=authorize(*,'template','','read')" />
1336                                         <to
1337                                                         uri="bean:org.onap.clamp.loop.template.LoopTemplatesService?method=getSvgRepresentation(${header.templateName})" />
1338                                         <to
1339                                                         uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=endLog()" />
1340                                         <doCatch>
1341                                                 <exception>java.lang.Exception</exception>
1342                                                 <handled>
1343                                                         <constant>true</constant>
1344                                                 </handled>
1345                                                 <to
1346                                                                 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=errorLog()" />
1347                                                 <log loggingLevel="ERROR"
1348                                                          message="GET SVG for template failed for template: ${header.templateName},  ${exception.stacktrace}" />
1349                                                 <setHeader headerName="CamelHttpResponseCode">
1350                                                         <constant>500</constant>
1351                                                 </setHeader>
1352                                                 <setBody>
1353                                                         <simple>GET SVG for Template FAILED</simple>
1354                                                 </setBody>
1355                                         </doCatch>
1356                                 </doTry>
1357                         </route>
1358                 </get>
1359                 <get uri="/v2/clampInformation" outType="org.onap.clamp.clds.model.ClampInformation"
1360                          produces="application/json">
1361                         <to
1362                                         uri="bean:org.onap.clamp.authorization.AuthorizationController?method=getClampInformation()" />
1363                 </get>
1364         </rest>
1365 </rests>