aboutsummaryrefslogtreecommitdiffstats
path: root/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-vf-module-unassign.xml
blob: 5cece27e590586a33859e865efa03cf477582c77 (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
<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='GENERIC-RESOURCE-API' version='${project.version}'>
    <method rpc='self-serve-vf-module-unassign' mode='sync'>
        <block atomic='true'>
            <set>
                <parameter name='ss.capability.execution-order[0]' value='mac-address-assign' />
                <parameter name='ss.capability.execution-order[1]' value='eipam-ip-assign' />
                <parameter name='ss.capability.execution-order[2]' value='vlan-tag-assign' />
                <parameter name='ss.capability.execution-order[3]' value='alts-license-assign' />
                <parameter name='ss.capability.execution-order[4]' value='alts-entitlement-assign' />
                <parameter name='ss.capability.execution-order[5]' value='generate-name' />
                <parameter name='ss.capability.execution-order_length' value='6' />
            </set>
            <set>
                <parameter name='ss.capability-type' value='vf-module' />
            </set>
            <for index='cidx' start='0' end='`$ss.capability.execution-order_length`' >
                <set>
                    <parameter name='ss.capability-name' value='`$ss.capability.execution-order[$cidx]`' />
                    <!--
ss.capability.execution-order
-->
                </set>
                <set>
                    <parameter name='ss.capability-action' value='unassign' />
                </set>
                <switch test='`$ss.capability-name`'>
                    <outcome value='alts-entitlement-assign'>
                        <set>
                            <parameter name='ss.capability-dg' value='self-serve-alts-assignment' />
                        </set>
                    </outcome>
                    <outcome value='alts-license-assign'>
                        <set>
                            <parameter name='ss.capability-dg' value='self-serve-alts-assignment' />
                        </set>
                    </outcome>
                    <outcome value='Other'>
                        <set>
                            <parameter name='ss.capability-dg' value="`'self-serve-' + $ss.capability.execution-order[$cidx]`" />
                        </set>
                    </outcome>
                </switch>
                <for index='pidx' start='0' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-parameters.param_length`' >
                    <set>
                        <parameter name='tmp.param.capability-name' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-parameters.param[$pidx].resource-resolution-data.capability-name`' />
                    </set>
                    <switch test='`$ss.capability-name == $tmp.param.capability-name`'>
                        <outcome value='true'>
                            <switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-parameters.param[$pidx].resource-resolution-data.status`'>
                                <outcome value='SUCCESS'>
                                    <call module='GENERIC-RESOURCE-API' rpc='`$ss.capability-dg`' mode='sync' >
                                        <outcome value='success'>
                                            <set>
                                                <parameter name='`$ss.capability-dg`' value='UNASSIGNED' />
                                            </set>
                                        </outcome>
                                        <outcome value='failure'>
                                            <block atomic='true'>
                                                <set>
                                                    <parameter name='vf.vf-module-id'
    value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-id`' />
                                                    <parameter name='vf.vf-module-data.sdnc-request-header.'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.sdnc-request-header.`' />
                                                    <parameter name='vf.vf-module-data.request-information.'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.request-information.`' />
                                                    <parameter name='vf.vf-module-data.service-information.'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.service-information.`' />
                                                    <parameter name='vf.vf-module-data.vnf-information.'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vnf-information.`' />
                                                    <parameter name='vf.vf-module-data.vf-module-information.'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-information.`' />
                                                    <parameter name='vf.vf-module-data.vf-module-topology.'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.`' />
                                                    <parameter name='vf.vf-module-data.vf-module-level-oper-status.'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-level-oper-status.`' />
                                                    <parameter name='vf.vf-module-data.vf-module-request-input.vf-module-input-parameters.'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-request-input.vf-module-input-parameters.`' />
                                                    <parameter name='vf.vf-module-data.vf-module-request-input.request-version'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-request-input.request-version`' />
                                                    <parameter name='vf.vf-module-data.vf-module-request-input.vf-module-name'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-request-input.vf-module-name`' />
                                                    <parameter name='vf.vf-module-data.vf-module-request-input.tenant'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-request-input.tenant`' />
                                                    <parameter name='vf.vf-module-data.vf-module-request-input.aic-cloud-region'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-request-input.aic-cloud-region`' />
                                                    <parameter name='vf.vf-module-data.vf-module-request-input.aic-clli'
  value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-request-input.aic-clli`' />
                                                </set>
                                                <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
                                                    <parameter name="source" value="`$prop.restapi.ss-vfmodule-assignments`"/>
                                                    <parameter name="outputPath" value="tmp.ss-vfmodule-url"/>
                                                    <parameter name="target" value="{service-instance-id}"/>
                                                    <parameter name="replacement" value="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.service-information.service-instance-id`"/>
                                                </execute>
                                                <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
                                                    <parameter name="source" value="`$tmp.ss-vfmodule-url`"/>
                                                    <parameter name="outputPath" value="tmp.ss-vfmodule-url"/>
                                                    <parameter name="target" value="{vnf-id}"/>
                                                    <parameter name="replacement" value="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vnf-information.vnf-id`"/>
                                                </execute>
                                                <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >
                                                    <parameter name="source" value="`$tmp.ss-vfmodule-url`"/>
                                                    <parameter name="outputPath" value="tmp.ss-vfmodule-url"/>
                                                    <parameter name="target" value="{vf-module-id}"/>
                                                    <parameter name="replacement" value="`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-id`"/>
                                                </execute>
                                                <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' >
                                                    <parameter name='templateFileName' value="`$prop.restapi.templateDir + '/' + $prop.restapi.ss.vfmodule.templatefile`" />
                                                    <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.ss-vfmodule-url`' />
                                                    <parameter name='restapiUser' value='`$prop.controller.user`' />
                                                    <parameter name='restapiPassword' value='`$prop.controller.pwd`' />
                                                    <parameter name='format' value='json' />
                                                    <parameter name='httpMethod' value='PUT' />
                                                    <parameter name="responsePrefix" value="mdsal-ss-vfmodule" />
                                                    <outcome value='success'>
                                                        <block></block>
                                                    </outcome>
                                                    <outcome value='failure'>
                                                        <block atomic="true">
                                                            <set>
                                                                <parameter name="error-message" value="Failed to persist self-serve vf-module assignments during unassign in MD-SAL" />
                                                            </set>
                                                        </block>
                                                    </outcome>
                                                    <outcome value='not-found'>
                                                        <block atomic="true">
                                                            <set>
                                                                <parameter name="error-message" value="Failed to persist self-serve vf-module assignments during unassign in MD-SAL" />
                                                            </set>
                                                        </block>
                                                    </outcome>
                                                </execute>
                                                <return status='failure'>
                                                    <parameter name='error-code' value='500' />
                                                    <parameter name='error-message' value="`'Encountered error from capability: '+ $ss.capability-dg + ', with error: '+ $error-message`" />
                                                </return>
                                            </block>
                                        </outcome>
                                    </call>
                                </outcome>
                                <outcome value='DELETED'>
                                    <block>
                                        <set>
                                            <parameter name='`$ss.capability-dg`' value='UNASSIGNED' />
                                        </set>
                                        <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                            <parameter name="logger" value="message-log"/>
                                            <parameter name="field1" value="`'SS: resource-resolution-data.status: ' + $service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-parameters.param[$pidx].resource-resolution-data.status`"/>
                                            <parameter name="field2" value="`'SS: ss.capability-name: ' + $ss.capability-name`"/>
                                        </record>
                                    </block>
                                </outcome>
                                <outcome value='Other'>
                                    <block atomic='true'>
                                        <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                            <parameter name="logger" value="message-log"/>
                                            <parameter name="field1" value="`'SS: resource-resolution-data.status: ' + $service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-parameters.param[$pidx].resource-resolution-data.status`"/>
                                            <parameter name="field2" value="`'SS: ss.capability-name: ' + $ss.capability-name`"/>
                                        </record>
                                        <return status='failure'>
                                            <parameter name='error-code' value='500' />
                                            <parameter name='error-message' value="`'Failed to unassign self-serve vf-module assignments because the status for ' + $ss.capability-name + ' is '  + $service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-parameters.param[$pidx].resource-resolution-data.status`"/>
                                        </return>
                                    </block>
                                </outcome>
                            </switch>
                        </outcome>
                    </switch>
                </for>
            </for>
            <switch test="`$self-serve-generate-name == 'UNASSIGNED'`">
                <outcome value='false'>
                    <block atomic='true'>
                        <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                            <parameter name="logger" value="message-log"/>
                            <parameter name="field1" value="`'SS: self-serve-generate-name status: ' + $self-serve-generate-name`"/>
                            <parameter name="field2" value="`'SS: self-serve-unresolved-composite-data: ' + $self-serve-unresolved-composite-data`"/>
                        </record>
                        <return status='failure'>
                            <parameter name='error-code' value='500' />
                            <parameter name='error-message' value="`'AAI Put is being skipped because NOT all capability components have SUCCESS status; '+ $error-message`" />
                        </return>
                    </block>
                </outcome>
                <outcome value='true'>
                    <block atomic='true'>
                        <for index='i' start='0' end='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param_length`' >
                            <switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$i].name`'>
                                <outcome value='vnfc-name'>
                                    <!--
<outcome value='vmxvre_name_0'>
-->
                                    <block>
                                        <set>
                                            <parameter name='tmp.ss.vnfc-name' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vf-modules.vf-module[$vf-module-index].vf-module-data.vf-module-topology.vf-module-parameters.param[$i].value`' />
                                        </set>
                                        <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" 
	resource="vnfc" 
		key="vnfc.vnfc-name = $tmp.ss.vnfc-name" >
                                            <outcome value='failure'>
                                                <set>
                                                    <parameter name='error-message' value='Failed to delete vnfc object in AnAI' />
                                                </set>
                                            </outcome>
                                            <outcome value='not-found'>
                                                <block></block>
                                            </outcome>
                                        </delete>
                                        <break/>
                                    </block>
                                </outcome>
                            </switch>
                        </for>
                    </block>
                </outcome>
            </switch>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='printContext' >
                <parameter name='filename' value='/var/tmp/ss-vf-unassign.log' />
            </execute>
        </block>
    </method>
</service-logic>