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