aboutsummaryrefslogtreecommitdiffstats
path: root/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-eipam-ip-assignment.xml
blob: 7b813073dbba4766645e7e7ba6fefb92ff729d43 (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
<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-eipam-ip-assignment' mode='sync'>
        <block atomic="true">
            <switch test='`$ss.capability-name`'>
                <outcome value=''>
                    <return status="failure">
                        <parameter name="ack-final" value="Y" />
                        <parameter name="error-code" value="500"/>
                        <parameter name="error-message" value="ss.capability-name is null" />
                    </return>
                </outcome>
            </switch>
            <switch test='`$ss.capability-action`'>
                <outcome value=''>
                    <return status="failure">
                        <parameter name="ack-final" value="Y" />
                        <parameter name="error-code" value="500"/>
                        <parameter name="error-message" value="ss.capability-action is null" />
                    </return>
                </outcome>
                <outcome value='assign'>
                    <block atomic="true">
                        <call module='GENERIC-RESOURCE-API' rpc='self-service-capability-param-resolution' mode='sync' >
                            <outcome value='failure'>
                                <return status="failure">
                                    <parameter name="ack-final" value="Y" />
                                    <parameter name="error-code" value="500"/>
                                    <parameter name="error-message" value="`'Not all assignments are resolved' + $error-message`" />
                                </return>
                            </outcome>
                        </call>
                        <block>
                            <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.ss.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='`$tmp.ss.param.capability-name == $ss.capability-name`'>
                                    <outcome value='true'>
                                        <break/>
                                    </outcome>
                                </switch>
                            </for>
                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                <parameter name="logger" value="message-log"/>
                                <parameter name="field1" value="__TIMESTAMP__"/>
                                <parameter name="field2" value="`'SS: pidx: ' + $pidx`"/>
                            </record>
                            <for index="kidx" 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[$pidx].resource-resolution-data.resource-key_length`">
                                <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.resource-key[$kidx].name`'>
                                    <outcome value='group-flag'>
                                        <set>
                                            <parameter name='tmp.ss.group-flag' 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.resource-key[$kidx].value`' />
                                        </set>
                                    </outcome>
                                    <outcome value='plan-name'>
                                        <set>
                                            <parameter name='tmp.ss.plan-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.resource-key[$kidx].value`' />
                                        </set>
                                    </outcome>
                                    <outcome value='address-family'>
                                        <set>
                                            <parameter name='tmp.ss.address-family' 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.resource-key[$kidx].value`' />
                                        </set>
                                    </outcome>
                                    <outcome value='client-key'>
                                        <set>
                                            <parameter name='tmp.ss.client-key' 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.resource-key[$kidx].value`' />
                                        </set>
                                    </outcome>
                                </switch>
                            </for>
                        </block>
                        <call module='GENERIC-RESOURCE-API' rpc='self-serve-generate-FQPN' mode='sync' >
                            <outcome value='failure'>
                                <return status="failure">
                                    <parameter name="ack-final" value="Y" />
                                    <parameter name="error-code" value="500"/>
                                    <parameter name="error-message" value="`'Not all assignments are resolved' + $error-message`" />
                                </return>
                            </outcome>
                        </call>
                        <set>
                            <parameter name='eipam-ip-block.plans[0].requests[0].'
    value='self-serve-generate-FQPN-output.' />
                        </set>
                        <set>
                            <parameter name='eipam-ip-block.group-flag'
    value='`$tmp.ss.group-flag`' />
                            <parameter name='eipam-ip-block.plans[0].plan-name'
    value='`$tmp.ss.plan-name`' />
                            <parameter name='eipam-ip-block.plans[0].address-family'
    value="`$tmp.ss.address-family`" />
                            <parameter name='eipam-ip-block.plans[0].requests[0].client-key'
	value="`$tmp.ss.client-key`" />
                        </set>
                        <set>
                            <parameter name='eipam-ip-block.plans[0].requests_length' value='1' />
                        </set>
                        <execute plugin="com.att.sdnctl.sli.plugin.eipam.EIPAMPlugin" method="assignIPAddress">
                            <outcome value='failure'>
                                <block atomic="true">
                                    <set>
                                        <parameter name='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' value='FAILED' />
                                    </set>
                                    <return status="failure">
                                        <parameter name="ack-final" value="Y" />
                                        <parameter name="error-code" value="500"/>
                                        <parameter name="error-message" value="`'An error occured while obtaining ip addresses from EIPAM: ' + $error-message`" />
                                    </return>
                                </block>
                            </outcome>
                        </execute>
                        <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`">
                            <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].name`'>
                                <outcome value='vmxvre_oam_ip_0'>
                                    <block>
                                        <set>
                                            <parameter name='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].value' 
	value='`$eipam-ip-block.plans[0].requests[0].ip-prefix`' />
                                        </set>
                                        <set>
                                            <parameter name='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' 
	value='SUCCESS' />
                                        </set>
                                    </block>
                                </outcome>
                                <outcome value='vmxvre_oam_ip_prefix_0'>
                                    <block>
                                        <set>
                                            <parameter name='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].value' 
	value='`$eipam-ip-block.plans[0].requests[0].ip-prefix-length`' />
                                        </set>
                                        <set>
                                            <parameter name='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' 
	value='SUCCESS' />
                                        </set>
                                    </block>
                                </outcome>
                                <outcome value='vmxvre_oam_gateway'>
                                    <block>
                                        <set>
                                            <parameter name='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].value' 
	value='`$eipam-ip-block.plans[0].requests[0].ReservedAssignments[0].ReservedAssignment[3].ReservedKeyIPAddress`' />
                                        </set>
                                        <set>
                                            <parameter name='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' 
	value='SUCCESS' />
                                        </set>
                                    </block>
                                </outcome>
                            </switch>
                        </for>
                    </block>
                </outcome>
                <outcome value='unassign'>
                    <block atomic="true">
                        <block>
                            <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.ss.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='`$tmp.ss.param.capability-name == $ss.capability-name`'>
                                    <outcome value='true'>
                                        <break/>
                                    </outcome>
                                </switch>
                            </for>
                            <record plugin="org.onap.ccsdk.sli.core.sli.recording.Slf4jRecorder">
                                <parameter name="logger" value="message-log"/>
                                <parameter name="field1" value="__TIMESTAMP__"/>
                                <parameter name="field2" value="`'SS: pidx: ' + $pidx`"/>
                            </record>
                            <for index="kidx" 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[$pidx].resource-resolution-data.resource-key_length`">
                                <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.resource-key[$kidx].name`'>
                                    <outcome value='group-flag'>
                                        <set>
                                            <parameter name='tmp.ss.group-flag' 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.resource-key[$kidx].value`' />
                                        </set>
                                    </outcome>
                                    <outcome value='plan-name'>
                                        <set>
                                            <parameter name='tmp.ss.plan-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.resource-key[$kidx].value`' />
                                        </set>
                                    </outcome>
                                    <outcome value='address-family'>
                                        <set>
                                            <parameter name='tmp.ss.address-family' 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.resource-key[$kidx].value`' />
                                        </set>
                                    </outcome>
                                    <outcome value='client-key'>
                                        <set>
                                            <parameter name='tmp.ss.client-key' 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.resource-key[$kidx].value`' />
                                        </set>
                                    </outcome>
                                </switch>
                            </for>
                        </block>
                        <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
	key='SELECT * from EIPAM_IP_ASSIGNMENTS 
		WHERE service_instance_id = $tmp.ss.service-instance-id
		AND client_key = $tmp.ss.client-key'>
                            <outcome value='not-found'>
                                <block></block>
                            </outcome>
                            <outcome value='success'>
                                <block atomic="true">
                                    <set>
                                        <parameter name='tmp.status' value="PENDING_DELETE" />
                                    </set>
                                    <update plugin="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource" resource="SQL"
	key="UPDATE EIPAM_IP_ASSIGNMENTS set status = $tmp.status 
		WHERE service_instance_id = $tmp.ss.service-instance-id 
		AND client_key = $tmp.ss.client-key" >
                                        <outcome value='failure'>
                                            <return status='failure'>
                                                <parameter name='ack-final' value='Y'/>
                                                <parameter name="error-code" value="500" />
                                                <parameter name="error-message" value="`'Error updating EIPAM_IP_ASSIGNMENTS table to unassign ip with client_key=' + $tmp.ss.client-key + ' and service_instance_id=' + $tmp.ss.service-instance-id`" />
                                            </return>
                                        </outcome>
                                    </update>
                                    <execute plugin="com.att.sdnctl.sli.plugin.eipam.EIPAMPlugin" method="unassignIPAddress">
                                        <parameter name="deleteEIPAM_status" value="`$tmp.status`" />
                                        <outcome value='failure'>
                                            <return status='failure'>
                                                <parameter name='ack-final' value='Y'/>
                                                <parameter name="error-code" value="500" />
                                                <parameter name="error-message" value="`'Error in EIPAMPlugin.unassignIPAddress with client-key='+ $tmp.ss.client-key`" />
                                            </return>
                                        </outcome>
                                    </execute>
                                </block>
                            </outcome>
                        </get-resource>
                        <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`">
                            <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].name`'>
                                <outcome value='vmxvre_oam_ip_0'>
                                    <set>
                                        <parameter name='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' 
	value='DELETED' />
                                    </set>
                                </outcome>
                                <outcome value='vmxvre_oam_ip_prefix_0'>
                                    <set>
                                        <parameter name='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' 
	value='DELETED' />
                                    </set>
                                </outcome>
                                <outcome value='vmxvre_oam_gateway'>
                                    <set>
                                        <parameter name='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' 
	value='DELETED' />
                                    </set>
                                </outcome>
                            </switch>
                        </for>
                    </block>
                </outcome>
            </switch>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='printContext' >
                <parameter name='filename' value='/var/tmp/ss.eipam.log' />
            </execute>
        </block>
    </method>
</service-logic>