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
|
<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&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.dcae.deployment.userName}}&authPassword={{clamp.config.dcae.deployment.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=300000&authenticationPreemptive=true&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>
<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&useSystemProperties=true&mapHttpMessageHeaders=false&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authUsername={{clamp.config.dcae.deployment.userName}}&authPassword={{clamp.config.dcae.deployment.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=300000&authenticationPreemptive=true&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>
<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&useSystemProperties=true&throwExceptionOnFailure=${exchangeProperty[raiseHttpExceptionFlag]}&authMethod=Basic&authUsername={{clamp.config.dcae.deployment.userName}}&authPassword={{clamp.config.dcae.deployment.password}}&connectionTimeToLive=5000&httpClient.connectTimeout=10000&httpClient.socketTimeout=30000&authenticationPreemptive=true&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>
<to uri="direct:dump-loop-log-http-response" />
</doFinally>
</doTry>
</route>
</routes>
|