aboutsummaryrefslogtreecommitdiffstats
path: root/platform-logic/optical-service/src/main/xml/optical-service_optical-service-create.xml
blob: 2341c607b280f5fa6d68e52b77afdc36465d48bd (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
<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-create' mode='sync'>
        <block atomic='true'>
            <for index='idx' start='0' end='`$optical-service-create-input.payload.param_length`' >
                <set>
                    <parameter name='params' value='`$optical-service-create-input.payload.param[$idx]`' />
                </set>
                <switch test="`$optical-service-create-input.payload.param[$idx].name == 'uni1_id'`">
                    <outcome value='true'>
                        <set>
                            <parameter name='optical-service-create-input.payload.service-aend.port-id' value="`$optical-service-create-input.payload.param[$idx].value`"/>
                        </set>
                    </outcome>
                </switch>
                <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="`$optical-service-create-input.payload.service-aend.port-id`"/>
                </record>
                <switch test="`$optical-service-create-input.payload.param[$idx].name == 'uni2_id'`">
                    <outcome value='true'>
                        <set>
                            <parameter name='optical-service-create-input.payload.service-zend.port-id' value="`$optical-service-create-input.payload.param[$idx].value`"/>
                        </set>
                    </outcome>
                </switch>
                <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="`$optical-service-create-input.payload.service-zend.port-id`"/>
                </record>
                <switch test="`$optical-service-create-input.payload.param[$idx].name == 'uni1_coding_func'`">
                    <outcome value='true'>
                        <set>
                            <parameter name='optical-service-create-input.payload.service-rate' value="`$optical-service-create-input.payload.param[$idx].value`"/>
                        </set>
                    </outcome>
                </switch>
                <switch test="`$optical-service-create-input.payload.param[$idx].name == 'uni_id'`">
                    <outcome value='true'>
                        <set>
                            <parameter name='optical-service-create-input.payload.service-aend.port-id' value="`$optical-service-create-input.payload.param[$idx].value`"/>
                        </set>
                    </outcome>
                </switch>
                <switch test="`$optical-service-create-input.payload.param[$idx].name == 'enni_id'`">
                    <outcome value='true'>
                        <set>
                            <parameter name='optical-service-create-input.payload.service-zend.port-id' value="`$optical-service-create-input.payload.param[$idx].value`"/>
                        </set>
                    </outcome>
                </switch>
                <switch test="`$optical-service-create-input.payload.param[$idx].name == 'uni_coding_func'`">
                    <outcome value='true'>
                        <set>
                            <parameter name='optical-service-create-input.payload.service-rate' value="`$optical-service-create-input.payload.param[$idx].value`"/>
                        </set>
                    </outcome>
                </switch>
                <switch test="`$optical-service-create-input.payload.param[$idx].name == 'enni1_id'`">
                    <outcome value='true'>
                        <set>
                            <parameter name='optical-service-create-input.payload.service-aend.port-id' value="`$optical-service-create-input.payload.param[$idx].value`"/>
                        </set>
                    </outcome>
                </switch>
                <switch test="`$optical-service-create-input.payload.param[$idx].name == 'enni2_id'`">
                    <outcome value='true'>
                        <set>
                            <parameter name='optical-service-create-input.payload.service-zend.port-id' value="`$optical-service-create-input.payload.param[$idx].value`"/>
                        </set>
                    </outcome>
                </switch>
                <switch test="`$optical-service-create-input.payload.param[$idx].name == 'enni1_coding_func'`">
                    <outcome value='true'>
                        <set>
                            <parameter name='optical-service-create-input.payload.service-rate' value="`$optical-service-create-input.payload.param[$idx].value`"/>
                        </set>
                    </outcome>
                </switch>
                <switch test="`$optical-service-create-input.payload.param[$idx].name == 'service-name'`">
                    <outcome value='true'>
                        <set>
                            <parameter name='optical-service-create-input.payload.service-name' value="`$optical-service-create-input.payload.param[$idx].value`"/>
                        </set>
                    </outcome>
                </switch>
                <switch test="`$optical-service-create-input.payload.param[$idx].name == 'uni1_client_proto'`">
                    <outcome value='true'>
                        <set>
                            <parameter name='optical-service-create-input.payload.service-protocol' value="`$optical-service-create-input.payload.param[$idx].value`"/>
                        </set>
                    </outcome>
                </switch>
            </for>
            <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL' 
key='SELECT controller_id 
from TOPOLOGY_LOGICAL_RELATION_TO_PINTERFACE 
WHERE interface_name = $optical-service-create-input.payload.service-aend.port-id' 
pfx='db.source1'>
                <outcome value='success'>
                    <set>
                        <parameter name='controller1' value="`$db.source1.controller-id`"/>
                    </set>
                </outcome>
            </get-resource>
            <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL' 
key='SELECT controller_id 
from TOPOLOGY_LOGICAL_RELATION_TO_PINTERFACE 
WHERE interface_name = $optical-service-create-input.payload.service-zend.port-id' 
pfx='db.source2'>
                <outcome value='success'>
                    <set>
                        <parameter name='controller2' value="`$db.source2.controller-id`"/>
                    </set>
                </outcome>
            </get-resource>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='generateUUID' >
                <parameter name="ctx-destination" value="service1-svc-instance-id"/>
            </execute>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' >
                <parameter name="original_string" value='`$controller1`'/>
                <parameter name="regex" value="_"/>
                <parameter name="ctx_memory_result_key" value="param-prefix1"/>
            </execute>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='split' >
                <parameter name="original_string" value='`$controller2`'/>
                <parameter name="regex" value="_"/>
                <parameter name="ctx_memory_result_key" value="param-prefix2"/>
            </execute>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='generateUUID' >
                <parameter name="ctx-destination" value="service1-request-id"/>
            </execute>
            <set>
                <parameter name='controller-ip1' value='`$param-prefix1[1]`' />
                <parameter name='domain-type1' value='`$param-prefix1[0]`' />
                <parameter name='controller-ip2' value='`$param-prefix2[1]`' />
                <parameter name='domain-type2' value='`$param-prefix2[0]`' />
            </set>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='generateUUID' >
                <parameter name="ctx-destination" value="service2-svc-instance-id"/>
            </execute>
            <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliPluginUtils' method='generateUUID' >
                <parameter name="ctx-destination" value="service2-request-id"/>
            </execute>
            <switch test='`$controller1==$controller2`'>
                <outcome value='true'>
                    <block>
                        <set>
                            <parameter name='as-request-id' value='`$optical-service-create-input.request-id`' />
                            <parameter name='as-svc-instance-id' value='`$optical-service-create-input.service-id`' />
                        </set>
                        <set>
                            <parameter name='domain-requests' value="`$service1-request-id`" />
                            <parameter name='optical-service-create-input.request-id' value="`$service1-request-id`" />
                            <parameter name='optical-service-create-input.service-id' value="`$service1-svc-instance-id`" />
                            <parameter name='optical-service-create-input.payload.service-name' value="`$optical-service-create-input.payload.service-name + '_' + 'MDONS-OTN'`" />
                        </set>
                        <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>
                        <save plugin="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource" resource="SQL" key="INSERT INTO REQUEST_DETAILS (request_id, controller_id, status, service_rate, service_instance_id, service_type, global_customer_id, notification_url, domain_requests ) VALUES ( $as-request-id , null , 'CREATING' , $optical-service-create-input.payload.service-rate ,  $as-svc-instance-id , $optical-service-create-input.service-type , $optical-service-create-input.global-customer-id , $optical-service-create-input.notification-url , $domain-requests );"></save>
                        <call module='optical-service' rpc='main-create' mode='sync' >
                            <outcome value='success'>
                                <switch test='`$final-response-code`'>
                                    <outcome value='200'>
                                        <block>
                                            <save plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' 
resource='SQL' 
key='UPDATE REQUEST_DETAILS SET status = "CREATED" WHERE request_id = $as-request-id'
force='true' pfx='save-result'></save>
                                            <call module='optical-service' rpc='create-service-relationship' mode='sync' ></call>
                                            <return status='success'>
                                                <parameter name='error-code' value='200' />
                                                <parameter name='error-message' value='Service Created Successfully' />
                                                <parameter name='ack-final-indicator' value='Y' />
                                            </return>
                                        </block>
                                    </outcome>
                                </switch>
                            </outcome>
                        </call>
                    </block>
                </outcome>
                <outcome value='false'>
                    <block>
                        <set>
                            <parameter name='as-request-id' value='`$optical-service-create-input.request-id`' />
                            <parameter name='as-svc-instance-id' value='`$optical-service-create-input.service-id`' />
                            <parameter name='domain-requests' value="`$service1-request-id + ',' + $service2-request-id`" />
                        </set>
                        <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="`'Service 1 req id---' + $service1-request-id`"/>
                            <parameter name="field3" value="`'Service 2 req id---' + $service2-request-id`"/>
                        </record>
                        <save plugin="org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource" resource="SQL" key="INSERT INTO REQUEST_DETAILS (request_id, controller_id, status, service_rate, service_instance_id, service_type, global_customer_id, notification_url, domain_requests ) VALUES ( $as-request-id , null , 'CREATING' , $optical-service-create-input.payload.service-rate ,  $as-svc-instance-id , $optical-service-create-input.service-type , $optical-service-create-input.global-customer-id , $optical-service-create-input.notification-url , $domain-requests );"></save>
                        <set>
                            <parameter name='access-aend' value="`$optical-service-create-input.payload.service-aend.port-id`"/>
                            <parameter name='access-zend' value="`$optical-service-create-input.payload.service-zend.port-id`"/>
                        </set>
                        <call module='optical-service' rpc='inter-domain-handling' mode='sync' ></call>
                    </block>
                </outcome>
            </switch>
        </block>
    </method>
</service-logic>