aboutsummaryrefslogtreecommitdiffstats
path: root/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_self-serve-vnf-ra-assignment.xml
blob: ac31f90d231783cc0ef045a51c258ab7e8f962e9 (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
<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-vnf-ra-assignment' mode='sync'>
        <block atomic="true">
            <execute plugin="org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils" method="generateUUID" >
                <parameter name="ctx-destination" value="tmp.return.generate.vnf-se-serv-uuid" />
                <outcome value='failure'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="generateUUID is failed" />
                    </return>
                </outcome>
            </execute>
            <set>
                <parameter name="request-id" value="`$tmp.return.generate.vnf-se-serv-uuid`"/>
                <parameter name="resource-type" value="`$vnf-topology-operation-input.vnf-information.vnf-type`" />
                <parameter name="resource-id" value="`$vnf-topology-operation-input.vnf-information.vnf-id`" />
                <parameter name="action-name" value="resource-assignment-action"/>
                <parameter name="responsePrefix" value="sriovAssign" />
            </set>
            <switch test='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param_length`'>
                <outcome value=''>
                    <set>
                        <parameter name='highnum' value='0' />
                        <parameter name='prehighnum' value='0'/>
                    </set>
                </outcome>
                <outcome value='Other'>
                    <set>
                        <parameter name='highnum' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param_length`' />
                        <parameter name='prehighnum' value='`$service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param_length`' />
                    </set>
                </outcome>
            </switch>
            <for index='i' start='0' end='`$vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param_length`' >
                <block atomic="true">
                    <switch test='`$vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$i].name`'>
                        <outcome value='sdnc_model_name'>
                            <set>
                                <parameter name='tmp.sdnc-model-name' value='`$vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$i].value`' />
                            </set>
                        </outcome>
                        <outcome value='sdnc_model_version'>
                            <set>
                                <parameter name='tmp.sdnc-model-version' value='`$vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$i].value`' />
                            </set>
                        </outcome>
                        <outcome value='sdnc_artifact_name'>
                            <set>
                                <parameter name='tmp.sdnc-artifact-name' value='`$vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$i].value`' />
                            </set>
                        </outcome>
                        <outcome value='Other'>
                            <set>
                                <parameter name="tmp.config-name-value-other-payload" value="`$tmp.config-name-value-other-payload + '&quot;' + $vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$i].name + '&quot;:&quot;' + $vnf-topology-operation-input.vnf-request-input.vnf-input-parameters.param[$i].value + '&quot;,'`"/>
                            </set>
                        </outcome>
                    </switch>
                </block>
            </for>
            <switch test="`$tmp.sdnc-model-name == '' or $tmp.sdnc-model-version == '' or $tmp.sdnc-artifact-name == ''`">
                <outcome value='true'>
                    <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
  key='SELECT * from VF_MODEL WHERE customization_uuid = $vnf-topology-operation-input.vnf-information.onap-model-information.model-customization-uuid'
  pfx='db1.vf-model'>
                        <outcome value='failure'>
                            <return status='failure'>
                                <parameter name='ack-final' value='Y'/>
                                <parameter name="error-code" value="500" />
                                <parameter name="error-message" value="Error reading VF_MODULE_MODEL table" />
                            </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="Error reading VF_MODULE_MODEL table" />
                            </return>
                        </outcome>
                        <outcome value='success'>
                            <set>
                                <parameter name='tmp.sdnc-model-name' value='`$db1.vf-model.sdnc-model-name`' />
                                <parameter name='tmp.sdnc-model-version' value='`$db1.vf-model.sdnc-model-version`' />
                                <parameter name='tmp.sdnc-artifact-name' value='`$db1.vf-model.sdnc-artifact-name`' />
                            </set>
                        </outcome>
                    </get-resource>
                </outcome>
            </switch>
            <set>
                <parameter name="tmp.config-name-value-payload4" value="`$tmp.config-name-value-other-payload + '&quot;service-instance-id&quot;:&quot;' + $vnf-topology-operation-input.service-information.service-instance-id   + '&quot;,'`"/>
                <parameter name="tmp.config-name-value-payload5" value="`$tmp.config-name-value-payload4 + '&quot;vnf-model-customization-uuid&quot;:&quot;' + $vnf-topology-operation-input.vnf-information.onap-model-information.model-customization-uuid + '&quot;,'`"/>
                <parameter name="tmp.config-name-value-payload6" value="`$tmp.config-name-value-payload5 + '&quot;vnf-id&quot;:&quot;' + $vnf-topology-operation-input.vnf-information.vnf-id + '&quot;,'`"/>
                <parameter name="tmp.config-name-value-payload7" value="`$tmp.config-name-value-payload6 + '&quot;aic-cloud-region&quot;:&quot;' + $vnf-topology-operation-input.vnf-request-input.aic-cloud-region + '&quot;'`"/>
                <parameter name="tmp.json-payload" value="`'{' + $tmp.config-name-value-payload7 + '}'`" />
            </set>
            <execute plugin='org.openecomp.sdnc.config.assignment.service.ConfigAssignmentNode' method='process'>
                <parameter name="request-id" value='`$request-id`' />
                <parameter name="resource-id" value='`$resource-id`' />
                <parameter name="resource-type" value='`$resource-type`' />
                <parameter name="action-name" value='`$action-name`' />
                <parameter name="template-names" value="`'[&quot;' + $tmp.sdnc-artifact-name + '&quot;]'`" />
                <parameter name="service-template-name" value='`$tmp.sdnc-model-name`' />
                <parameter name="service-template-version" value='`$tmp.sdnc-model-version`' />
                <parameter name='input-data' value='`$tmp.json-payload`' />
                <parameter name="prifix" value="sriovAssign" />
                <outcome value='failure'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="Error from ConfigAssignmentNode" />
                    </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="Error from ConfigAssignmentNode" />
                    </return>
                </outcome>
            </execute>
            <execute plugin="org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils" method="jsonStringToCtx">
                <parameter name="source" value="`'sriovAssign.mashed-data.' + $tmp.sdnc-artifact-name`" />
                <parameter name="outputPath" value="jsonContextPrefix" />
                <parameter name="isEscaped" value="false" />
            </execute>
            <for index='i' start='0' end='`$jsonContextPrefix.resource-accumulator-resolved-data_length`' >
                <block atomic="true">
                    <set>
                        <parameter name='tmp.mso.param.found' value='false' />
                    </set>
                    <switch test='`$prehighnum &gt; 0`'>
                        <outcome value='true'>
                            <for index='cnt' 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[$cnt].name == $jsonContextPrefix.resource-accumulator-resolved-data[$i].param-name`'>
                                    <outcome value='true'>
                                        <set>
                                            <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$cnt].value`' value='`$jsonContextPrefix.resource-accumulator-resolved-data[$i].param-value`'/>
                                            <parameter name='tmp.mso.param.found' value='true' />
                                        </set>
                                    </outcome>
                                </switch>
                            </for>
                        </outcome>
                    </switch>
                    <switch test='`$tmp.mso.param.found`'>
                        <outcome value='false'>
                            <set>
                                <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$highnum].name`' value='`$jsonContextPrefix.resource-accumulator-resolved-data[$i].param-name`'/>
                                <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$highnum].value`' value='`$jsonContextPrefix.resource-accumulator-resolved-data[$i].param-value`'/>
                                <parameter name='highnum' value='`$highnum + 1`' />
                            </set>
                        </outcome>
                    </switch>
                </block>
            </for>
            <for index='i' start='0' end='`$jsonContextPrefix.capability-data_length`' >
                <block atomic="true">
                    <set>
                        <parameter name='num' value='0' />
                    </set>
                    <for index='j' start='0' end='`$jsonContextPrefix.capability-data[$i].key-mapping_length`' >
                        <block atomic="true">
                            <for index='l' start='0' end='`$jsonContextPrefix.capability-data[$i].key-mapping[$j].output-key-mapping_length`' >
                                <block atomic="true">
                                    <set>
                                        <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$highnum].name`' value='`$jsonContextPrefix.capability-data[$i].key-mapping[$j].output-key-mapping[$l].resource-name`'/>
                                        <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$highnum].value`' value='`$jsonContextPrefix.capability-data[$i].key-mapping[$j].output-key-mapping[$l].resource-value`'/>
                                        <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$highnum].resource-resolution-data.capability-name`' value='`$jsonContextPrefix.capability-data[$i].capability-name`'/>
                                        <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$highnum].resource-resolution-data.status`' value='PENDING'/>
                                    </set>
                                    <switch test="`$jsonContextPrefix.capability-data[$i].key-mapping[$j].payload_length == ''`">
                                        <outcome value='true'></outcome>
                                        <outcome value='false'>
                                            <for index='k' start='0' end='`$jsonContextPrefix.capability-data[$i].key-mapping[$j].payload_length`' >
                                                <set>
                                                    <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$highnum].resource-resolution-data.resource-key[$num].name`' value='`$jsonContextPrefix.capability-data[$i].key-mapping[$j].payload[$k].param-name`'/>
                                                    <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$highnum].resource-resolution-data.resource-key[$num].value`' value='`$jsonContextPrefix.capability-data[$i].key-mapping[$j].payload[$k].param-value`'/>
                                                    <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param[$highnum].resource-resolution-data.resource-key_length`' value='`$num + 1`'/>
                                                    <parameter name='num' value='`$num + 1`' />
                                                </set>
                                            </for>
                                        </outcome>
                                    </switch>
                                    <set>
                                        <parameter name='`service-data.vnfs.vnf[$vnf-index].vnf-data.vnf-topology.vnf-parameters-data.param_length`' value='`$highnum + 1`'/>
                                        <parameter name='highnum' value='`$highnum + 1`' />
                                    </set>
                                </block>
                            </for>
                        </block>
                    </for>
                </block>
            </for>
        </block>
    </method>
</service-logic>