aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/resources/clds/camel/routes/dcae-flows.xml
blob: 6c963349bfe838ace5c48376e9def08225e0913b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
<routes xmlns="http://camel.apache.org/schema/spring">
	<route id="deploy-loop">
		<from uri="direct:deploy-loop" />
		<doTry>
			<log loggingLevel="INFO"
				message="Deploying the loop: ${exchangeProperty[loopObject].getName()}" />
			<to
				uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Deploying the loop')" />
			<setBody>
				<method ref="org.onap.clamp.loop.components.external.DcaeComponent"
					method="getDeployPayload(${exchangeProperty[loopObject]})" />
			</setBody>
			<setProperty propertyName="dcaeDeploymentId">
				<method ref="org.onap.clamp.loop.components.external.DcaeComponent"
					method="generateDeploymentId()" />
			</setProperty>
			<setHeader headerName="CamelHttpMethod">
				<constant>PUT</constant>
			</setHeader>
			<setHeader headerName="Content-Type">
				<constant>application/json</constant>
			</setHeader>
			<setHeader headerName="X-ONAP-RequestID">
				<simple>${exchangeProperty[X-ONAP-RequestID]}
				</simple>
			</setHeader>
			<setHeader headerName="X-ONAP-InvocationID">
				<simple>${exchangeProperty[X-ONAP-InvocationID]}
				</simple>
			</setHeader>
			<setHeader headerName="X-ONAP-PartnerName">
				<simple>${exchangeProperty[X-ONAP-PartnerName]}
				</simple>
			</setHeader>
			<log loggingLevel="INFO"
				message="Endpoint to deploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[dcaeDeploymentId]}"></log>
			<toD
				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" />
			<convertBodyTo type="java.lang.String" />
			<setProperty propertyName="dcaeResponse">
				<method ref="org.onap.clamp.loop.components.external.DcaeComponent"
					method="convertDcaeResponse(${body})" />
			</setProperty>
			<setProperty propertyName="dcaeStatusUrl">
				<method ref="org.onap.clamp.loop.components.external.DcaeComponent"
					method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
			</setProperty>
			<to
				uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[dcaeDeploymentId]},${exchangeProperty[dcaeStatusUrl]})" />
			<doFinally>
				<to uri="direct:reset-raise-http-exception-flag" />
				<to
					uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
				<setProperty propertyName="logMessage">
					<simple>DEPLOY loop status
						(Dep-id:${exchangeProperty[dcaeDeploymentId]},
						StatusUrl:${exchangeProperty[dcaeStatusUrl]})
					</simple>
				</setProperty>
				<setProperty propertyName="logComponent">
					<simple>DCAE</simple>
				</setProperty>
				<to uri="direct:dump-loop-log-http-response" />
			</doFinally>
		</doTry>
	</route>

	<route id="undeploy-loop">
		<from uri="direct:undeploy-loop" />
		<log loggingLevel="INFO"
			message="Undeploying the loop: ${exchangeProperty[loopObject].getName()} : ${exchangeProperty[loopObject].getDcaeDeploymentId()}" />
		<to
			uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Undeploying the loop')" />
		<choice>
			<when>
				<simple>${exchangeProperty[loopObject].getDcaeDeploymentId()}
					!= null
				</simple>
				<doTry>
					<setBody>
						<method ref="org.onap.clamp.loop.components.external.DcaeComponent"
							method="getUndeployPayload(${exchangeProperty[loopObject]})" />
					</setBody>
					<setHeader headerName="CamelHttpMethod">
						<constant>DELETE</constant>
					</setHeader>
					<setHeader headerName="Content-Type">
						<constant>application/json</constant>
					</setHeader>

					<setHeader headerName="X-ONAP-RequestID">
						<simple>${exchangeProperty[X-ONAP-RequestID]}
						</simple>
					</setHeader>
					<setHeader headerName="X-ONAP-InvocationID">
						<simple>${exchangeProperty[X-ONAP-InvocationID]}
						</simple>
					</setHeader>
					<setHeader headerName="X-ONAP-PartnerName">
						<simple>${exchangeProperty[X-ONAP-PartnerName]}
						</simple>
					</setHeader>
					<log loggingLevel="INFO"
						message="Endpoint to undeploy loop: {{clamp.config.dcae.deployment.url}}/dcae-deployments/${exchangeProperty[loopObject].getDcaeDeploymentId()}"></log>
					<toD
						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" />
					<convertBodyTo type="java.lang.String" />
					<setProperty propertyName="dcaeResponse">
						<method ref="org.onap.clamp.loop.components.external.DcaeComponent"
							method="convertDcaeResponse(${body})" />
					</setProperty>
					<setProperty propertyName="dcaeStatusUrl">
						<method ref="org.onap.clamp.loop.components.external.DcaeComponent"
							method="getStatusUrl(${exchangeProperty[dcaeResponse]})" />
					</setProperty>
					<to
						uri="bean:org.onap.clamp.loop.LoopService?method=updateDcaeDeploymentFields(${exchangeProperty[loopObject]},${exchangeProperty[loopObject].getDcaeDeploymentId()},${exchangeProperty[dcaeStatusUrl]})" />
					<doFinally>
						<to uri="direct:reset-raise-http-exception-flag" />
						<to
							uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
						<setProperty propertyName="logMessage">
							<simple>UNDEPLOY loop status</simple>
						</setProperty>
						<setProperty propertyName="logComponent">
							<simple>DCAE</simple>
						</setProperty>
						<to uri="direct:dump-loop-log-http-response" />
					</doFinally>
				</doTry>
			</when>
			<otherwise>
				<log loggingLevel="WARNING"
					message="Cannot Undeploy for the loop: ${exchangeProperty[loopObject].getName()}, the Deployment ID does not exist !" />
				<to
					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]})" />

			</otherwise>
		</choice>
	</route>
	<route id="get-dcae-deployment-status">
		<from uri="direct:get-dcae-deployment-status" />
		<log loggingLevel="INFO"
			message="Getting DCAE deployment status for loop: ${exchangeProperty[loopObject].getName()}" />
		<to
			uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting Deployment status')" />
		<doTry>
			<setHeader headerName="CamelHttpMethod">
				<constant>GET</constant>
			</setHeader>
			<setHeader headerName="X-ONAP-RequestID">
				<simple>${exchangeProperty[X-ONAP-RequestID]}
				</simple>
			</setHeader>
			<setHeader headerName="X-ONAP-InvocationID">
				<simple>${exchangeProperty[X-ONAP-InvocationID]}
				</simple>
			</setHeader>
			<setHeader headerName="X-ONAP-PartnerName">
				<simple>${exchangeProperty[X-ONAP-PartnerName]}
				</simple>
			</setHeader>
			<log loggingLevel="INFO"
				message="Endpoint to query Closed Loop status: ${exchangeProperty[loopObject].getDcaeDeploymentStatusUrl()}"></log>
			<toD
				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" />
			<doFinally>
				<to uri="direct:reset-raise-http-exception-flag" />
				<to
					uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
				<setProperty propertyName="logMessage">
					<simple>DCAE deployment status</simple>
				</setProperty>
				<setProperty propertyName="logComponent">
					<simple>DCAE</simple>
				</setProperty>
				<to uri="direct:dump-loop-log-http-response" />
			</doFinally>
		</doTry>
	</route>
	<route id="get-dcae-blueprint-inventory">
		<from uri="direct:get-dcae-blueprint-inventory" />
		<log loggingLevel="INFO"
			message="Getting DCAE blueprint id in inventory" />
		<to
			uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting blueprint id in inventory')" />
		<doTry>
			<setHeader headerName="CamelHttpMethod">
				<constant>GET</constant>
			</setHeader>
			<setHeader headerName="X-ONAP-RequestID">
				<simple>${exchangeProperty[X-ONAP-RequestID]}
				</simple>
			</setHeader>
			<setHeader headerName="X-ONAP-InvocationID">
				<simple>${exchangeProperty[X-ONAP-InvocationID]}
				</simple>
			</setHeader>
			<setHeader headerName="X-ONAP-PartnerName">
				<simple>${exchangeProperty[X-ONAP-PartnerName]}
				</simple>
			</setHeader>
			<log loggingLevel="INFO"
				message="Endpoint to query Dcae inventory Loop status: {{clamp.config.dcae.inventory.url}}/dcae-service-types?${header[CamelHttpQuery]}"></log>
			<toD
				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" />
			<convertBodyTo type="java.lang.String" />
			<doFinally>
				<to uri="direct:reset-raise-http-exception-flag" />
				<to
					uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
			</doFinally>
		</doTry>

	</route>
	<route id="get-all-dcae-blueprint-inventory">
		<from uri="direct:get-all-dcae-blueprint-inventory" />
		<log loggingLevel="INFO"
			 message="Getting all DCAE blueprint from inventory" />
		<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeLog('DCAE', 'Getting all blueprint from inventory')" />
		<doTry>
			<setHeader headerName="CamelHttpMethod">
				<constant>GET</constant>
			</setHeader>
			<setHeader headerName="X-ONAP-RequestID">
				<simple>${exchangeProperty[X-ONAP-RequestID]}
				</simple>
			</setHeader>
			<setHeader headerName="X-ONAP-InvocationID">
				<simple>${exchangeProperty[X-ONAP-InvocationID]}
				</simple>
			</setHeader>
			<setHeader headerName="X-ONAP-PartnerName">
				<simple>${exchangeProperty[X-ONAP-PartnerName]}
				</simple>
			</setHeader>
			<log loggingLevel="INFO"
				 message="Endpoint to query Blueprints from DCAE inventory: {{clamp.config.dcae.inventory.url}}/dcae-service-types?${header[CamelHttpQuery]}"></log>
			<toD uri="{{clamp.config.dcae.inventory.url}}/dcae-service-types;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" />
			<convertBodyTo type="java.lang.String" />
			<setProperty propertyName="dcaeResponseList">
				<method ref="org.onap.clamp.loop.components.external.DcaeComponent"
						method="convertToDcaeInventoryResponse(${body})" />
			</setProperty>
			<split>
				<simple>${exchangeProperty[dcaeResponseList]}</simple>
				<convertBodyTo type="org.onap.clamp.clds.model.dcae.DcaeInventoryResponse" />
				<setProperty propertyName="dcaeResponse">
					<simple>${body}</simple>
				</setProperty>
				<to uri="bean:org.onap.clamp.clds.model.dcae.DcaeInventoryCache?method=addDcaeInventoryResponse(${exchangeProperty[dcaeResponse]})" />
			</split>
			<doFinally>
				<to uri="direct:reset-raise-http-exception-flag" />
				<to uri="bean:org.onap.clamp.flow.log.FlowLogOperation?method=invokeReturnLog()" />
			</doFinally>
		</doTry>
	</route>
</routes>