summaryrefslogtreecommitdiffstats
path: root/ms/gra/gra-app/src/test/resources/svclogic/GENERIC-RESOURCE-API_service-topology-operation-assign.xml
blob: 300c1a920a52e3d328cbd47ef87cd4f329e12932 (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
<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='aai-disabled'>
    <method rpc='service-topology-operation-assign' mode='sync'>
        <block atomic="true">
            <switch test='`$service-topology-operation-input.request-information.request-action`'>
                <outcome value='CreateServiceInstance'>
                    <block></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="If svc-action is 'assign' then request-action must be 'CreateServiceInstance'" />
                    </return>
                </outcome>
            </switch>
            <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
  key='SELECT * from SERVICE_MODEL WHERE service_uuid = $service-topology-operation-input.service-information.onap-model-information.model-uuid'
  pfx='db.service-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 SERVICE_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="`'No model found for service UUID ' + $service-topology-operation-input.service-information.onap-model-information.model-uuid`" />
                    </return>
                </outcome>
            </get-resource>
            <set>
                <parameter name='tmp.service-instance-name' value='' />
            </set>
            <switch test='`$service-topology-operation-input.service-request-input.service-instance-name`'>
                <outcome value=''>
                    <block atomic="true">
                        <switch test='`$db.service-model.ecomp-naming`'>
                            <outcome value='Y'>
                                <block></block>
                            </outcome>
                            <outcome value='N'>
                                <return status='failure'>
                                    <parameter name='ack-final' value='Y'/>
                                    <parameter name="error-code" value="500" />
                                    <parameter name="error-message" value="No service-instance-name was received but ecomp-naming is not Y" />
                                </return>
                            </outcome>
                            <outcome value='Other'>
                                <return status='failure'>
                                    <parameter name='ack-final' value='Y'/>
                                    <parameter name="error-code" value="500" />
                                    <parameter name="error-message" value="No service-instance-name was received but ecomp-naming is not Y" />
                                </return>
                            </outcome>
                        </switch>
                        <switch test='`$db.service-model.naming-policy`'>
                            <outcome value=''>
                                <block atomic="true">
                                    <set>
                                        <parameter name='generate-unique-name-input.action' value='ASSIGN' />
                                        <parameter name='generate-unique-name-input.context-id' value='`$service-topology-operation-input.service-information.service-instance-id`' />
                                        <parameter name='generate-unique-name-input.index-table-name' value='SERVICE_INSTANCE_NAME_INDEX' />
                                        <parameter name='generate-unique-name-input.index-table-prefix-column' value='service_instance_name_prefix' />
                                        <parameter name='generate-unique-name-input.name-table-type' value='SERVICE_INSTANCE' />
                                        <parameter name='generate-unique-name-input.prefix' value="`$db.service-model.service-instance-name-prefix + '_'`" />
                                    </set>
                                    <call module='GENERIC-RESOURCE-API' rpc='generate-unique-name' 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="`$generate-unique-name-output.error-message`" />
                                            </return>
                                        </outcome>
                                        <outcome value='success'>
                                            <set>
                                                <parameter name='tmp.service-instance-name' value='`$generate-unique-name-output.generated-name`' />
                                            </set>
                                        </outcome>
                                    </call>
                                </block>
                            </outcome>
                            <outcome value='Other'>
                                <block atomic="true">
                                    <set>
                                        <parameter name='generated-via-policy' value='true' />
                                    </set>
                                    <set>
                                        <parameter name='naming-policy-generate-name-input.policy-instance-name' value='`$db.service-model.naming-policy`' />
                                        <parameter name='naming-policy-generate-name-input.naming-type' value='SERVICE' />
                                        <parameter name='naming-policy-generate-name-input.context-id' value='`$service-topology-operation-input.service-information.service-instance-id`' />
                                        <parameter name='naming-policy-generate-name-input.query-parameter' value='`$db.service-model.service-uuid`' />
                                        <parameter name='naming-policy-generate-name-input.action' value='ASSIGN' />
                                    </set>
                                    <call module='GENERIC-RESOURCE-API' rpc='naming-policy-generate-name' 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="Unable to generate service name" />
                                            </return>
                                        </outcome>
                                        <outcome value='success'>
                                            <set>
                                                <parameter name='tmp.service-instance-name' value='`$naming-policy-generate-name-output.service-name`' />
                                            </set>
                                        </outcome>
                                    </call>
                                </block>
                            </outcome>
                        </switch>
                    </block>
                </outcome>
                <outcome value='Other'>
                    <block atomic="true">
                        <set>
                            <parameter name='generate-unique-name-input.name-table-type' value='SERVICE_INSTANCE' />
                            <parameter name='generate-unique-name-input.supplied-name' value='`$service-topology-operation-input.service-request-input.service-instance-name`' />
                            <parameter name='generate-unique-name-input.service-instance-id' value='`$service-topology-operation-input.service-information.service-instance-id`' />
                        </set>
                        <call module='GENERIC-RESOURCE-API' rpc='generate-unique-name' 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="`$generate-unique-name-output.error-message`" />
                                </return>
                            </outcome>
                            <outcome value='success'>
                                <set>
                                    <parameter name='tmp.service-instance-name' value="`$service-topology-operation-input.service-request-input.service-instance-name`" />
                                </set>
                            </outcome>
                        </call>
                    </block>
                </outcome>
            </switch>
            <set>
                <parameter name='service-object-path'
 value="`'restconf/config/GENERIC-RESOURCE-API:services/service/'
 + $service-topology-operation-input.service-information.service-instance-id
 + '/service-data/service-topology/'`"/>
            </set>
            <set>
                <parameter name='service-data.service-topology.service-topology-identifier.service-instance-id'
  value='`$service-topology-operation-input.service-information.service-instance-id`' />
                <parameter name='service-data.service-topology.service-topology-identifier.service-type'
  value='`$service-topology-operation-input.service-information.subscription-service-type`' />
                <parameter name='service-data.service-topology.service-topology-identifier.service-instance-name'
  value='`$tmp.service-instance-name`' />
                <parameter name='service-data.service-topology.service-topology-identifier.global-customer-id'
  value='`$service-topology-operation-input.service-information.global-customer-id`' />
            </set>
            <set>
                <parameter name='service-data.service-topology.onap-model-information.'
  value='`$service-topology-operation-input.service-information.onap-model-information.`' />
            </set>
            <switch test='`$service-topology-operation-input.service-request-input.service-input-parameters.param_length`'>
                <outcome value=''>
                    <block></block>
                </outcome>
                <outcome value='Other'>
                    <for index='idx' start='0' end='`$service-topology-operation-input.service-request-input.service-input-parameters.param_length`' >
                        <set>
                            <parameter name='service-data.service-topology.service-parameters[$idx].service-parameter-name'
  value='`$service-topology-operation-input.service-request-input.service-input-parameters.param[$idx].name`' />
                            <parameter name='service-data.service-topology.service-parameters[$idx].service-parameter-value'
  value='`$service-topology-operation-input.service-request-input.service-input-parameters.param[$idx].value`' />
                        </set>
                    </for>
                </outcome>
            </switch>
            <set>
                <parameter name='service-data.service-level-oper-status.order-status' value='Created' />
                <parameter name='service-data.service-level-oper-status.last-rpc-action' value='assign' />
                <parameter name='service-data.service-level-oper-status.last-action' value='CreateServiceInstance' />
            </set>
        </block>
    </method>
</service-logic>