blob: fb3bc90ec961f871c32c807908d18f72892099ee [file] [log] [blame]
sebdet74303b72019-10-08 17:53:08 +02001<routes xmlns="http://camel.apache.org/schema/spring">
2 <route id="deploy-loop">
3 <from uri="direct:deploy-loop" />
4 <doTry>
5 <log loggingLevel="INFO"
6 message="Deploying the loop: ${exchangeProperty[loopObject].getName()}" />
7 <to
8 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploying the loop')" />
9 <setBody>
10 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
11 method="getDeployPayload(${exchangeProperty[loopObject]})" />
12 </setBody>
13 <setProperty propertyName="dcaeDeploymentId">
14 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
15 method="generateDeploymentId()" />
16 </setProperty>
17 <setHeader headerName="CamelHttpMethod">
18 <constant>PUT</constant>
19 </setHeader>
20 <setHeader headerName="Content-Type">
21 <constant>application/json</constant>
22 </setHeader>
23 <setHeader headerName="X-ONAP-RequestID">
24 <simple>${exchangeProperty[X-ONAP-RequestID]}
25 </simple>
26 </setHeader>
27 <setHeader headerName="X-ONAP-InvocationID">
28 <simple>${exchangeProperty[X-ONAP-InvocationID]}
29 </simple>
30 </setHeader>
31 <setHeader headerName="X-ONAP-PartnerName">
32 <simple>${exchangeProperty[X-ONAP-PartnerName]}
33 </simple>
34 </setHeader>
35 <log loggingLevel="INFO"
36 message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}"></log>
37 <toD
38 uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=300000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
39 <convertBodyTo type="java.lang.String" />
40 <setProperty propertyName="dcaeResponse">
41 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
42 method="convertDcaeResponse(${body})" />
43 </setProperty>
44 <setProperty propertyName="dcaeStatusUrl">
45 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
46 method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
47 </setProperty>
48 <to
49 uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[dcaeDeploymentId]},${exchangeProperty[dcaeStatusUrl]})" />
50 <doFinally>
51 <to uri="direct:reset-raise-http-exception-flag" />
52 <to
53 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
54 <setProperty propertyName="logMessage">
55 <simple>DEPLOY loop status
56 (Dep-id:${exchangeProperty[dcaeDeploymentId]},
57 StatusUrl:${exchangeProperty[dcaeStatusUrl]})
58 </simple>
59 </setProperty>
60 <setProperty propertyName="logComponent">
61 <simple>DCAE</simple>
62 </setProperty>
63 <to uri="direct:dump-loop-log-http-response" />
64 </doFinally>
65 </doTry>
66 </route>
67
68 <route id="undeploy-loop">
69 <from uri="direct:undeploy-loop" />
70 <log loggingLevel="INFO"
71 message="Undeploying the loop: ${exchangeProperty[loopObject].getName()} : ${exchangeProperty[loopObject].getDcaeDeploymentId()}" />
72 <to
73 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Undeploying the loop')" />
74 <choice>
75 <when>
76 <simple>${exchangeProperty[loopObject].getDcaeDeploymentId()}
77 != null
78 </simple>
79 <doTry>
80 <setBody>
81 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
82 method="getUndeployPayload(${exchangeProperty[loopObject]})" />
83 </setBody>
84 <setHeader headerName="CamelHttpMethod">
85 <constant>DELETE</constant>
86 </setHeader>
87 <setHeader headerName="Content-Type">
88 <constant>application/json</constant>
89 </setHeader>
90
91 <setHeader headerName="X-ONAP-RequestID">
92 <simple>${exchangeProperty[X-ONAP-RequestID]}
93 </simple>
94 </setHeader>
95 <setHeader headerName="X-ONAP-InvocationID">
96 <simple>${exchangeProperty[X-ONAP-InvocationID]}
97 </simple>
98 </setHeader>
99 <setHeader headerName="X-ONAP-PartnerName">
100 <simple>${exchangeProperty[X-ONAP-PartnerName]}
101 </simple>
102 </setHeader>
103 <log loggingLevel="INFO"
104 message="Endpoint to undeploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}"></log>
105 <toD
106 uri="{{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;mapHttpMessageHeaders=false&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=300000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
107 <convertBodyTo type="java.lang.String" />
108 <setProperty propertyName="dcaeResponse">
109 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
110 method="convertDcaeResponse(${body})" />
111 </setProperty>
112 <setProperty propertyName="dcaeStatusUrl">
113 <method ref="org.onap.clamp.loop.components.external.DcaeComponent"
114 method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
115 </setProperty>
116 <to
117 uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[loopObject].getDcaeDeploymentId()},${exchangeProperty[dcaeStatusUrl]})" />
118 <doFinally>
119 <to uri="direct:reset-raise-http-exception-flag" />
120 <to
121 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
122 <setProperty propertyName="logMessage">
123 <simple>UNDEPLOY loop status</simple>
124 </setProperty>
125 <setProperty propertyName="logComponent">
126 <simple>DCAE</simple>
127 </setProperty>
128 <to uri="direct:dump-loop-log-http-response" />
129 </doFinally>
130 </doTry>
131 </when>
132 <otherwise>
133 <log loggingLevel="WARNING"
134 message="Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !" />
135 <to
136 uri="bean:org.onap.clamp.loop.log.LoopLogService?method=addLog('Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !','WARNING',${exchangeProperty[loopObject]})" />
137
138 </otherwise>
139 </choice>
140 </route>
141 <route id="get-dcae-deployment-status">
142 <from uri="direct:get-dcae-deployment-status" />
143 <log loggingLevel="INFO"
144 message="Getting DCAE deployment status for loop: ${exchangeProperty[loopObject].getName()}" />
145 <to
146 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting Deployment status')" />
147 <doTry>
148 <setHeader headerName="CamelHttpMethod">
149 <constant>GET</constant>
150 </setHeader>
151 <setHeader headerName="X-ONAP-RequestID">
152 <simple>${exchangeProperty[X-ONAP-RequestID]}
153 </simple>
154 </setHeader>
155 <setHeader headerName="X-ONAP-InvocationID">
156 <simple>${exchangeProperty[X-ONAP-InvocationID]}
157 </simple>
158 </setHeader>
159 <setHeader headerName="X-ONAP-PartnerName">
160 <simple>${exchangeProperty[X-ONAP-PartnerName]}
161 </simple>
162 </setHeader>
163 <log loggingLevel="INFO"
164 message="Endpoint to query Closed Loop status: ${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}"></log>
165 <toD
166 uri="${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}?bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
167 <doFinally>
168 <to uri="direct:reset-raise-http-exception-flag" />
169 <to
170 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
171 <setProperty propertyName="logMessage">
172 <simple>DCAE deployment status</simple>
173 </setProperty>
174 <setProperty propertyName="logComponent">
175 <simple>DCAE</simple>
176 </setProperty>
177 <to uri="direct:dump-loop-log-http-response" />
178 </doFinally>
179 </doTry>
180 </route>
181 <route id="get-dcae-blueprint-inventory">
182 <from uri="direct:get-dcae-blueprint-inventory" />
183 <log loggingLevel="INFO"
184 message="Getting DCAE blueprint id in inventory" />
185 <to
186 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting blueprint id in inventory')" />
187 <doTry>
188 <setHeader headerName="CamelHttpMethod">
189 <constant>GET</constant>
190 </setHeader>
191 <setHeader headerName="X-ONAP-RequestID">
192 <simple>${exchangeProperty[X-ONAP-RequestID]}
193 </simple>
194 </setHeader>
195 <setHeader headerName="X-ONAP-InvocationID">
196 <simple>${exchangeProperty[X-ONAP-InvocationID]}
197 </simple>
198 </setHeader>
199 <setHeader headerName="X-ONAP-PartnerName">
200 <simple>${exchangeProperty[X-ONAP-PartnerName]}
201 </simple>
202 </setHeader>
203 <log loggingLevel="INFO"
204 message="Endpoint to query Dcae inventory Loop status: {{clamp.config.dcae.inventory.url}}/dcae-service-types?${header[CamelHttpQuery]}"></log>
205 <toD
206 uri="{{clamp.config.dcae.inventory.url}}/dcae-service-types?asdcResourceId=${exchangeProperty[blueprintResourceId]}&amp;asdcServiceId=${exchangeProperty[blueprintServiceId]}&amp;typeName=${exchangeProperty[blueprintName]}&amp;bridgeEndpoint=true&amp;useSystemProperties=true&amp;throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&amp;authMethod=Basic&amp;authUsername={{clamp.config.dcae.deployment.userName}}&amp;authPassword={{clamp.config.dcae.deployment.password}}&amp;connectionTimeToLive=5000&amp;httpClient.connectTimeout=10000&amp;httpClient.socketTimeout=30000&amp;authenticationPreemptive=true&amp;connectionClose=true" />
207 <convertBodyTo type="java.lang.String" />
208 <doFinally>
209 <to uri="direct:reset-raise-http-exception-flag" />
210 <to
211 uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
212 </doFinally>
213 </doTry>
214
215 </route>
216</routes>