aboutsummaryrefslogtreecommitdiffstats
path: root/platform-logic/optical-service/src/main/xml/optical-service_optical-service-delete.xml
blob: 2bbd79e3a7d09305d62446e94ef40e92dda3dd6b (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
<service-logic
    xmlns='http://www.onap.org/sdnc/svclogic'
    xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='optical-service' version='${project.version}'>
    <method rpc='optical-service-delete' mode='sync'>
        <block atomic='true'>
            <execute plugin='org.onap.ccsdk.sli.plugins.prop.PropertiesNode' method='readProperties' >
                <parameter name='fileName' value='/opt/onap/sdnc/data/properties/optical-service-dg.properties' />
                <parameter name='contextPrefix' value='prop' />
            </execute>
            <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
key='SELECT *
from REQUEST_DETAILS
WHERE request_id = $optical-service-delete-input.request-id'
pfx='detail-db'>
                <outcome value='success'>
                    <set>
                        <parameter name='domain-req' value='`$detail-db.domain-requests`' />
                        <parameter name='delete-acc-svc-id' value='`$detail-db.service-instance-id`' />
                    </set>
                </outcome>
            </get-resource>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' >
                <parameter name="original_string" value='`$domain-req`'/>
                <parameter name="regex" value=","/>
                <parameter name="ctx_memory_result_key" value="param-prefix1"/>
            </execute>
            <set>
                <parameter name='notification-url' value="http://167.254.204.152:31817/asyncNotification" />
                <parameter name='domain-service1' value='`$param-prefix1[0]`' />
                <parameter name='domain-service2' value='`$param-prefix1[1]`' />
            </set>
            <for index='ppx' start='0' end='`$param-prefix1_length`' >
                <switch test='`$param-prefix1_length`'>
                    <outcome value='1'>
                        <block atomic='true'>
                            <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
key='SELECT controller_id
from REQUEST_DETAILS
WHERE request_id = $domain-service1'
pfx='detail-db1'>
                                <outcome value='success'>
                                    <set>
                                        <parameter name='controller-id1' value='`$detail-db1.controller-id`' />
                                    </set>
                                </outcome>
                            </get-resource>
                            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' >
                                <parameter name="original_string" value='`$controller-id1`'/>
                                <parameter name="regex" value="_"/>
                                <parameter name="ctx_memory_result_key" value="param-prefix"/>
                            </execute>
                            <set>
                                <parameter name='domain-type' value='`$param-prefix[0]`' />
                                <parameter name='controller-ip' value='`$param-prefix[1]`' />
                                <parameter name='optical-service-delete-input.request-id' value="`$domain-service1`" />
                                <parameter name='optical-service-delete-input.payload.service-name' value="`$optical-service-delete-input.payload.param[0].value + '_MDONS-OTN_'`"/>
                            </set>
                            <switch test='`$domain-type`'>
                                <outcome value='MSA'>
                                    <block>
                                        <call module='optical-service' rpc='service-delete-msa' mode='sync' >
                                            <outcome value='success'>
                                                <block atomic='true'>
                                                    <set>
                                                        <parameter name='service1-status' value='`$final-response-code`' />
                                                    </set>
                                                </block>
                                            </outcome>
                                            <outcome value='failure'>
                                                <return status='failure'>
                                                    <parameter name='error-code' value='500' />
                                                    <parameter name='error-message' value='Failed to call MSA DG' />
                                                    <parameter name='ack-final-indicator' value="Y" />
                                                </return>
                                            </outcome>
                                        </call>
                                    </block>
                                </outcome>
                                <outcome value='TAPI'>
                                    <block>
                                        <call module='optical-service' rpc='service-delete-tapi' mode='sync' >
                                            <outcome value='success'>
                                                <block>
                                                    <set>
                                                        <parameter name='service1-status' value='`$final-response-code`' />
                                                    </set>
                                                    <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                                        <parameter name="file" value="/opt/opendaylight/current/data/log/service-delete-tapi.log" />
                                                        <parameter name="level" value="info" />
                                                        <parameter name="field1" value="`$service1-status`"/>
                                                    </record>
                                                </block>
                                            </outcome>
                                            <outcome value='failure'>
                                                <return status='failure'>
                                                    <parameter name='error-code' value='500' />
                                                    <parameter name='error-message' value='Failed to call MSA DG' />
                                                    <parameter name='ack-final-indicator' value="Y" />
                                                </return>
                                            </outcome>
                                        </call>
                                    </block>
                                </outcome>
                            </switch>
                        </block>
                    </outcome>
                    <outcome value='2'>
                        <switch test='`$ppx`'>
                            <outcome value='0'>
                                <block>
                                    <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
key='SELECT controller_id
from REQUEST_DETAILS
WHERE request_id = $domain-service1'
pfx='detail-db11'>
                                        <outcome value='success'>
                                            <set>
                                                <parameter name='controller-id11' value='`$detail-db11.controller-id`' />
                                            </set>
                                        </outcome>
                                    </get-resource>
                                    <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' >
                                        <parameter name="original_string" value='`$controller-id11`'/>
                                        <parameter name="regex" value="_"/>
                                        <parameter name="ctx_memory_result_key" value="domain1"/>
                                    </execute>
                                    <set>
                                        <parameter name='optical-service-delete-input.request-id' value="`$domain-service1`" />
                                        <parameter name='optical-service-delete-input.payload.service-name' value="`$optical-service-delete-input.payload.param[0].value + '_MDONS-OTN_'`"/>
                                        <parameter name='domain-type' value='`$domain1[0]`' />
                                        <parameter name='controller-ip' value='`$domain1[1]`' />
                                    </set>
                                    <call module='optical-service' rpc='service-delete-tapi' mode='sync' >
                                        <outcome value='success'>
                                            <block>
                                                <set>
                                                    <parameter name='service1-status' value='`$final-response-code`' />
                                                </set>
                                                <switch test='`$service1-status == 200`'>
                                                    <outcome value='true'>
                                                        <set>
                                                            <parameter name='service1' value='success' />
                                                        </set>
                                                    </outcome>
                                                    <outcome value='false'>
                                                        <set>
                                                            <parameter name='service1' value='failure' />
                                                        </set>
                                                    </outcome>
                                                </switch>
                                            </block>
                                        </outcome>
                                        <outcome value='failure'>
                                            <return status='failure'>
                                                <parameter name='error-code' value='500' />
                                                <parameter name='error-message' value='Main Delete Dg not available' />
                                                <parameter name='ack-final-indicator' value="Y" />
                                            </return>
                                        </outcome>
                                    </call>
                                </block>
                            </outcome>
                            <outcome value='1'>
                                <block>
                                    <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
key='SELECT controller_id
from REQUEST_DETAILS
WHERE request_id = $domain-service2'
pfx='detail-db22'>
                                        <outcome value='success'>
                                            <set>
                                                <parameter name='controller-id22' value='`$detail-db22.controller-id`' />
                                            </set>
                                        </outcome>
                                    </get-resource>
                                    <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' >
                                        <parameter name="original_string" value='`$controller-id22`'/>
                                        <parameter name="regex" value="_"/>
                                        <parameter name="ctx_memory_result_key" value="domain2"/>
                                    </execute>
                                    <set>
                                        <parameter name='optical-service-delete-input.request-id' value="`$domain-service2`" />
                                        <parameter name='optical-service-delete-input.payload.service-name' value="`$optical-service-delete-input.payload.param[0].value + '_MDONS-OTN_'`"/>
                                        <parameter name='domain-type' value='`$domain2[0]`' />
                                        <parameter name='controller-ip' value='`$domain2[1]`' />
                                    </set>
                                    <call module='optical-service' rpc='service-delete-tapi' mode='sync' >
                                        <outcome value='success'>
                                            <block>
                                                <set>
                                                    <parameter name='service2-status' value='`$final-response-code`' />
                                                </set>
                                                <switch test='`$service2-status == 200`'>
                                                    <outcome value='true'>
                                                        <set>
                                                            <parameter name='service2' value='success' />
                                                        </set>
                                                    </outcome>
                                                    <outcome value='false'>
                                                        <set>
                                                            <parameter name='service2' value='failure' />
                                                        </set>
                                                    </outcome>
                                                </switch>
                                            </block>
                                        </outcome>
                                        <outcome value='failure'>
                                            <return status='failure'>
                                                <parameter name='error-code' value='500' />
                                                <parameter name='error-message' value='Main Delete Dg not available' />
                                                <parameter name='ack-final-indicator' value="Y" />
                                            </return>
                                        </outcome>
                                    </call>
                                </block>
                            </outcome>
                        </switch>
                    </outcome>
                </switch>
            </for>
            <switch test='`$ppx`'>
                <outcome value='0'>
                    <block>
                        <switch test='`$service1-status`'>
                            <outcome value='200'>
                                <block>
                                    <delete plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource'
    resource="SQL"
    key="DELETE FROM REQUEST_DETAILS WHERE request_id = $access-id"></delete>
                                    <return status='success'>
                                        <parameter name="error-code" value="200" />
                                        <parameter name="error-message" value="Service Deleted Successfully" />
                                        <parameter name='ack-final-indicator' value='Y' />
                                    </return>
                                </block>
                            </outcome>
                            <outcome value='Other'>
                                <block>
                                    <return status='failure'>
                                        <parameter name='error-code' value='500' />
                                        <parameter name='error-message' value='Access service request entry cannot be deleted' />
                                        <parameter name='ack-final-indicator' value="Y" />
                                    </return>
                                </block>
                            </outcome>
                        </switch>
                    </block>
                </outcome>
                <outcome value='1'>
                    <block>
                        <switch test='`$service1-status == $service2-status == 200`'>
                            <outcome value='true'>
                                <block>
                                    <delete plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource'
    resource="SQL"
    key="DELETE FROM REQUEST_DETAILS WHERE request_id = $access-id"></delete>
                                    <record plugin="org.onap.ccsdk.sli.core.sli.recording.FileRecorder">
                                        <parameter name="file" value="/opt/opendaylight/current/data/log/optical-service-create.log" />
                                        <parameter name="level" value="info" />
                                        <parameter name="field1" value="`'domain rquest_' + $domain-requests`"/>
                                        <parameter name="field2" value="`'Access rquest_' + $as-request-id`"/>
                                    </record>
                                    <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
resource="service-instance"
 key='customer.global-customer-id = $output.global-customer-id AND
     service-subscription.service-type = $output.service-type AND
     service-instance.service-instance-id = $delete-acc-svc-id' 
pfx='acc-serv-dl'      local-only='false'></get-resource>
                                    <set>
                                        <parameter name='link-name' value='`$acc-serv-dl.relationship-list.relationship[0].relationship-data[0].relationship-value`' />
                                    </set>
                                    <update plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' 
force='true'
resource='logical-link'
     key='logical-link.link-name = $link-name '
      local-only='false'>
                                        <parameter name='operational-status' value='available' />
                                    </update>
                                    <return status='success'>
                                        <parameter name="error-code" value="200" />
                                        <parameter name="error-message" value="Service Deleted Successfully" />
                                        <parameter name='ack-final-indicator' value='Y' />
                                    </return>
                                </block>
                            </outcome>
                            <outcome value='false'>
                                <block>
                                    <return status='failure'>
                                        <parameter name='error-code' value='500' />
                                        <parameter name='error-message' value='Access service request entry cannot be deleted' />
                                        <parameter name='ack-final-indicator' value="Y" />
                                    </return>
                                </block>
                            </outcome>
                        </switch>
                    </block>
                </outcome>
            </switch>
        </block>
    </method>
</service-logic>