aboutsummaryrefslogtreecommitdiffstats
path: root/platform-logic/datachange/src/main/xml/DataChange_esr-thirdparty-sdnc-discovery.xml
blob: 007f3bf52cc8ad314897c1b18bd1fa7e7b324a4c (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
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
<service-logic xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" module="DataChange" version="${project.version}">
    <method rpc="esr-thirdparty-sdnc-discovery" mode="sync">
        <block atomic="true">
            <switch test="`$prop.sdncRestApi.vendor == 'ZTE'`">
                <outcome value="false">
                    <switch test="`$data-change-notification-input.aai-event-trigger`">
                        <outcome value="Update">
                            <block>
                                <switch test="`$prop.sdncRestApi.type`">
                                    <outcome value="SOTN">
                                        <block atomic="true">
                                            <execute plugin="org.onap.ccsdk.sli.plugins.prop.PropertiesNode" method="readProperties">
                                                <parameter name="fileName" value="%SDNC_CONFIG_DIR%/generic-resource-api-dg.properties"/>
                                                <parameter name="contextPrefix" value="prop"/>
                                            </execute>
                                            <execute plugin="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" method="sendRequest">
                                                <parameter name="templateFileName" value="`$prop.restapi.templateDir + '/actokentemplate.json'`"/>
                                                <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/controller/v2/tokens'`"/>
                                                <parameter name="format" value="json"/>
                                                <parameter name="httpMethod" value="post"/>
                                                <parameter name="responsePrefix" value="token-result"/>
                                                <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.onap.client.jks"/>
                                                <parameter name="trustStorePassword" value="adminadmin"/>
                                                <parameter name="keyStoreFileName" value="/opt/onap/sdnc/data/stores/sdnc.p12"/>
                                                <parameter name="keyStorePassword" value="adminadmin"/>
                                                <outcome value="success">
                                                    <set>
                                                        <parameter name="prop.sdncRestApi.token_id" value="`$token-result.data.token_id`"/>
                                                    </set>
                                                </outcome>
                                                <outcome value="failure">
                                                    <block/>
                                                </outcome>
                                            </execute>
                                            <switch test="`$prop.sdncRestApi.token_id`">
                                                <outcome value="">
                                                    <execute plugin="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" method="sendRequest">
                                                        <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/restconf/data/ietf-network:networks'`"/>
                                                        <parameter name="restapiUser" value="`$prop.sdncRestApi.thirdpartySdnc.user`"/>
                                                        <parameter name="restapiPassword" value="`$prop.sdncRestApi.thirdpartySdnc.password`"/>
                                                        <parameter name="format" value="json"/>
                                                        <parameter name="httpMethod" value="get"/>
                                                        <parameter name="responsePrefix" value="topology"/>
                                                        <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.onap.client.jks"/>
                                                        <parameter name="trustStorePassword" value="adminadmin"/>
                                                        <parameter name="keyStoreFileName" value="/opt/onap/sdnc/data/stores/sdnc.p12"/>
                                                        <parameter name="keyStorePassword" value="adminadmin"/>
                                                        <outcome value="failure">
                                                            <return status="failure">
                                                                <parameter name="ack-final" value="Y"/>
                                                                <parameter name="error-code" value="500"/>
                                                                <parameter name="error-message" value="Error executing Create vpn rest api"/>
                                                            </return>
                                                        </outcome>
                                                        <outcome value="success">
                                                            <block atomic="true">
                                                                <for index="nidx" start="0" end="`$topology.networks.network_length`">
                                                                    <block>
                                                                        <set>
                                                                            <parameter name="network." value="`$topology.networks.network[$nidx].`"/>
                                                                        </set>
                                                                        <call module="DataChange" rpc="update-network-to-aai" mode="sync"/>
                                                                    </block>
                                                                </for>
                                                                <switch test="`$topology.networks.network_length >= 2`">
                                                                    <outcome value="true">
                                                                        <block atomic="true">
                                                                            <for index="netidx" start="0" end="`$topology.networks.network_length`">
                                                                                <block>
                                                                                    <set>
                                                                                        <parameter name="network." value=""/>
                                                                                    </set>
                                                                                    <set>
                                                                                        <parameter name="network." value="`$topology.networks.network[$netidx].`"/>
                                                                                    </set>
                                                                                    <switch test="`$network.te-topology-id`">
                                                                                        <outcome value="11">
                                                                                            <block>
                                                                                                <set>
                                                                                                    <parameter name="network-otn." value="`$topology.networks.network[$netidx].`"/>
                                                                                                </set>
                                                                                            </block>
                                                                                        </outcome>
                                                                                        <outcome value="33">
                                                                                            <block>
                                                                                                <set>
                                                                                                    <parameter name="network-eth." value="`$topology.networks.network[$netidx].`"/>
                                                                                                </set>
                                                                                            </block>
                                                                                        </outcome>
                                                                                    </switch>
                                                                                </block>
                                                                            </for>
                                                                            <call module="DataChange" rpc="update-tp-ttp-relationship" mode="sync"/>
                                                                        </block>
                                                                    </outcome>
                                                                </switch>
                                                            </block>
                                                        </outcome>
                                                    </execute>
                                                </outcome>
                                                <outcome value="Other">
                                                    <execute plugin="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" method="sendRequest">
                                                        <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/restconf/data/ietf-network:networks'`"/>
                                                        <parameter name="restapiUser" value="`$prop.sdncRestApi.thirdpartySdnc.user`"/>
                                                        <parameter name="restapiPassword" value="`$prop.sdncRestApi.thirdpartySdnc.password`"/>
                                                        <parameter name="format" value="json"/>
                                                        <parameter name="httpMethod" value="get"/>
                                                        <parameter name="responsePrefix" value="topology"/>
                                                        <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.onap.client.jks"/>
                                                        <parameter name="trustStorePassword" value="adminadmin"/>
                                                        <parameter name="keyStoreFileName" value="/opt/onap/sdnc/data/stores/sdnc.p12"/>
                                                        <parameter name="keyStorePassword" value="adminadmin"/>
                                                        <parameter name="customHttpHeaders" value="`'X-ACCESS-TOKEN=' + $prop.sdncRestApi.token_id`"/>
                                                        <outcome value="failure">
                                                            <return status="failure">
                                                                <parameter name="ack-final" value="Y"/>
                                                                <parameter name="error-code" value="500"/>
                                                                <parameter name="error-message" value="Error executing Create vpn rest api"/>
                                                            </return>
                                                        </outcome>
                                                        <outcome value="success">
                                                            <block atomic="true">
                                                                <for index="nidx" start="0" end="`$topology.networks.network_length`">
                                                                    <block>
                                                                        <set>
                                                                            <parameter name="network." value="`$topology.networks.network[$nidx].`"/>
                                                                        </set>
                                                                        <call module="DataChange" rpc="update-network-to-aai" mode="sync"/>
                                                                    </block>
                                                                </for>
                                                                <switch test="`$topology.networks.network_length >= 2`">
                                                                    <outcome value="true">
                                                                        <block atomic="true">
                                                                            <for index="netidx" start="0" end="`$topology.networks.network_length`">
                                                                                <block>
                                                                                    <set>
                                                                                        <parameter name="network." value=""/>
                                                                                    </set>
                                                                                    <set>
                                                                                        <parameter name="network." value="`$topology.networks.network[$netidx].`"/>
                                                                                    </set>
                                                                                    <switch test="`$network.te-topology-id`">
                                                                                        <outcome value="11">
                                                                                            <block>
                                                                                                <set>
                                                                                                    <parameter name="network-otn." value="`$topology.networks.network[$netidx].`"/>
                                                                                                </set>
                                                                                            </block>
                                                                                        </outcome>
                                                                                        <outcome value="33">
                                                                                            <block>
                                                                                                <set>
                                                                                                    <parameter name="network-eth." value="`$topology.networks.network[$netidx].`"/>
                                                                                                </set>
                                                                                            </block>
                                                                                        </outcome>
                                                                                    </switch>
                                                                                </block>
                                                                            </for>
                                                                            <call module="DataChange" rpc="update-tp-ttp-relationship" mode="sync"/>
                                                                        </block>
                                                                    </outcome>
                                                                </switch>
                                                            </block>
                                                        </outcome>
                                                    </execute>
                                                </outcome>
                                            </switch>
                                            <set>
                                                <parameter name="input" value="ietf-subscribed-notifications:establish-subscription.input."/>
                                                <parameter name="`$input + 'encoding'`" value="encode-json"/>
                                            </set>
                                            <execute plugin="org.onap.ccsdk.sli.plugins.restconfdiscovery.RestconfDiscoveryNode" method="establishSubscription">
                                                <parameter name="subscriberId" value="sotn-controller"/>
                                                <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/restconf/operations/ietf-subscribed-notifications:establish-subscription'`"/>
                                                <parameter name="restapiUser" value="`$prop.sdncRestApi.thirdpartySdnc.user`"/>
                                                <parameter name="restapiPassword" value="`$prop.sdncRestApi.thirdpartySdnc.password`"/>
                                                <parameter name="sseConnectURL" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/restconf/streams/yang-push-json'`"/>
                                                <parameter name="dirPath" value="/opt/sdnc/restconfapi/yang/notification"/>
                                                <parameter name="format" value="json"/>
                                                <parameter name="httpMethod" value="post"/>
                                                <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.onap.client.jks"/>
                                                <parameter name="trustStorePassword" value="adminadmin"/>
                                                <parameter name="keyStoreFileName" value="/opt/onap/sdnc/data/stores/sdnc.p12"/>
                                                <parameter name="keyStorePassword" value="adminadmin"/>
                                                <parameter name="customHttpHeaders" value="`'X-ACCESS-TOKEN=' + $prop.sdncRestApi.token_id`"/>
                                                <parameter name="module" value="DataChange"/>
                                                <parameter name="rpc" value="sotn-notification-handler"/>
                                                <parameter name="mode" value="sync"/>
                                            </execute>
                                        </block>
                                    </outcome>
                                    <outcome value="TAPI">
                                        <block atomic="true">
                                            <execute plugin="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" method="sendRequest">
                                                <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/cxf/tapi/v2/topologies?topology-id-or-name=otn'`"/>
                                                <parameter name="restapiUser" value="`$prop.sdncRestApi.thirdpartySdnc.user`"/>
                                                <parameter name="restapiPassword" value="`$prop.sdncRestApi.thirdpartySdnc.password`"/>
                                                <parameter name="format" value="json"/>
                                                <parameter name="httpMethod" value="get"/>
                                                <parameter name="responsePrefix" value="topologies"/>
                                                <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.onap.client.tapi.jks"/>
                                                <parameter name="trustStorePassword" value="adminadmin"/>
                                                <parameter name="keyStoreFileName" value="/opt/onap/sdnc/data/stores/sdnc.p12"/>
                                                <parameter name="keyStorePassword" value="adminadmin"/>
                                                <outcome value="failure">
                                                    <return status="failure">
                                                        <parameter name="ack-final" value="Y"/>
                                                        <parameter name="error-code" value="500"/>
                                                        <parameter name="error-message" value="Error executing get topology TAPI rest api"/>
                                                    </return>
                                                </outcome>
                                                <outcome value="success">
                                                    <block atomic="true">
                                                        <for index="tidx" start="0" end="`$topologies.topology_length`">
                                                            <block>
                                                                <set>
                                                                    <parameter name="topology." value="`$topologies.topology[$tidx].`"/>
                                                                </set>
                                                                <call module="DataChange" rpc="tapi-update-network-to-aai" mode="sync"/>
                                                            </block>
                                                        </for>
                                                    </block>
                                                </outcome>
                                            </execute>
                                        </block>
                                    </outcome>
                                    <outcome value="MSA">
                                        <block atomic="true">
                                            <execute plugin="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" method="sendRequest">
                                                <parameter name="restapiUrl" value="`$prop.sdncRestApi.thirdpartySdnc.url + '/cxf/openroadm/v2/networks/otn-topology'`"/>
                                                <parameter name="restapiUser" value="`$prop.sdncRestApi.thirdpartySdnc.user`"/>
                                                <parameter name="restapiPassword" value="`$prop.sdncRestApi.thirdpartySdnc.password`"/>
                                                <parameter name="format" value="json"/>
                                                <parameter name="httpMethod" value="get"/>
                                                <parameter name="responsePrefix" value="networks"/>
                                                <parameter name="trustStoreFileName" value="/opt/onap/sdnc/data/stores/truststore.onap.client.msa.jks"/>
                                                <parameter name="trustStorePassword" value="adminadmin"/>
                                                <parameter name="keyStoreFileName" value="/opt/onap/sdnc/data/stores/sdnc.p12"/>
                                                <parameter name="keyStorePassword" value="adminadmin"/>
                                                <outcome value="failure">
                                                    <return status="failure">
                                                        <parameter name="ack-final" value="Y"/>
                                                        <parameter name="error-code" value="500"/>
                                                        <parameter name="error-message" value="Error executing get topology MSA rest api"/>
                                                    </return>
                                                </outcome>
                                                <outcome value="success">
                                                    <block atomic="true">
                                                        <call module="DataChange" rpc="msa-update-network-to-aai" mode="sync"/>
                                                    </block>
                                                </outcome>
                                            </execute>
                                        </block>
                                    </outcome>
                                    <outcome value="Other">
                                        <return status="failure">
                                            <parameter name="ack-final" value="Y"/>
                                            <parameter name="error-code" value="500"/>
                                            <parameter name="error-message" value="`'Unsupported type = ' + $prop.sdncRestApi.type`"/>
                                        </return>
                                    </outcome>
                                </switch>
                            </block>
                        </outcome>
                        <outcome value="Delete">
                            <block atomic="true">
                                <switch test="`$prop.sdncRestApi.type`">
                                    <outcome value="MSA">
                                        <block atomic="true">
                                            <set>
                                                <parameter name="controllerid" value="`$prop.sdncRestApi.type + '_' + $prop.sdncRestApi.thirdpartySdnc.url + '_' + $prop.sdncRestApi.thirdpartySdnc.id`"/>
                                            </set>
                                            <get-resource plugin="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource" resource="SQL" key="SELECT controller_id from TOPOLOGY_LOGICAL_RELATION_TO_PINTERFACE WHERE controller_id = $controllerid" pfx="dbcontrollerid">
                                                <outcome value="success">
                                                    <delete plugin="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource" resource="SQL" key="DELETE FROM TOPOLOGY_LOGICAL_RELATION_TO_PINTERFACE WHERE controller_id = $controllerid"/>
                                                </outcome>
                                                <outcome value="failure">
                                                    <return status="failure">
                                                        <parameter name="ack-final" value="Y"/>
                                                        <parameter name="error-code" value="500"/>
                                                        <parameter name="error-message" value="Failure in getting controller-id from DB"/>
                                                    </return>
                                                </outcome>
                                                <outcome value="not-found">
                                                    <return status="failure">
                                                        <parameter name="ack-final" value="Y"/>
                                                        <parameter name="error-code" value="500"/>
                                                        <parameter name="error-message" value="controller-id could not be found in DB"/>
                                                    </return>
                                                </outcome>
                                            </get-resource>
                                        </block>
                                    </outcome>
                                    <outcome value="TAPI">
                                        <block>
                                            <set>
                                                <parameter name="controllerid" value="`$prop.sdncRestApi.type + '_' + $prop.sdncRestApi.thirdpartySdnc.url + '_' + $prop.sdncRestApi.thirdpartySdnc.id`"/>
                                            </set>
                                            <get-resource plugin="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource" resource="SQL" key="SELECT controller_id from TOPOLOGY_LOGICAL_RELATION_TO_PINTERFACE WHERE controller_id = $controllerid" pfx="dbcontrollerid">
                                                <outcome value="success">
                                                    <delete plugin="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource" resource="SQL" key="DELETE FROM TOPOLOGY_LOGICAL_RELATION_TO_PINTERFACE WHERE controller_id = $controllerid"/>
                                                </outcome>
                                                <outcome value="failure">
                                                    <return status="failure">
                                                        <parameter name="ack-final" value="Y"/>
                                                        <parameter name="error-code" value="500"/>
                                                        <parameter name="error-message" value="Failure in getting controller-id from DB"/>
                                                    </return>
                                                </outcome>
                                                <outcome value="not-found">
                                                    <return status="failure">
                                                        <parameter name="ack-final" value="Y"/>
                                                        <parameter name="error-code" value="500"/>
                                                        <parameter name="error-message" value="controller-id could not be found in DB"/>
                                                    </return>
                                                </outcome>
                                            </get-resource>
                                        </block>
                                    </outcome>
                                    <outcome value="Other">
                                        <return status="failure">
                                            <parameter name="ack-final" value="Y"/>
                                            <parameter name="error-code" value="500"/>
                                            <parameter name="error-message" value="`'Unsupported type = ' + $prop.sdncRestApi.type`"/>
                                        </return>
                                    </outcome>
                                </switch>
                            </block>
                        </outcome>
                    </switch>
                </outcome>
                <outcome value="true">
                    <call module="DataChange" rpc="esr-thirdparty-sdnc-of-zte" mode="sync"/>
                </outcome>
            </switch>
        </block>
    </method>
</service-logic>