summaryrefslogtreecommitdiffstats
path: root/platform-logic/datachange/src/main/xml/DataChange_esr-thirdparty-sdnc-discovery-of-zte.xml
blob: 77c83bb9a937adf7f4a5fe465c441b3f765791e9 (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
<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="DataChange" version="${project.version}">
  <method rpc="esr-thirdparty-sdnc-discovery-of-zte" mode="sync"> 
    <block atomic="true">
      <switch test="`$data-change-notification-input.aai-event-trigger`"> 
        <outcome value="Update"> 
          <block> 
            <switch test="`$prop.sdncRestApi.type`"> 
              <outcome value="SOTN"> 
                <block atomic="true">
                  <execute plugin="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" method="sendRequest"> 
                    <parameter name="templateFileName" value="`$prop.restapi.templateDir + '/getzteodutopotemplate.json'`"/>  
                    <parameter name="restapiUrl" value="`$zte.prop.sdncRestApi.thirdpartySdnc.url + '/restconf/operations/ZTE-API-Topology:get-topology-details'`"/>  
                    <parameter name="restapiUser" value="`$zte.prop.sdncRestApi.thirdpartySdnc.user`"/>  
                    <parameter name="restapiPassword" value="`$zte.prop.sdncRestApi.thirdpartySdnc.password`"/>  
                    <parameter name="format" value="json"/>  
                    <parameter name="httpMethod" value="POST"/>  
                    <parameter name="responsePrefix" value="ztetopology"/>
                    <outcome value="success"> 
                      <block atomic="true"/>
                    </outcome>
                    <outcome value="failure"> 
                      <return status="failure"> 
                        <parameter name="ack-final" value="Y"/>  
                        <parameter name="error-code" value="500"/>  
                        <parameter name="error-message" value="Error executing Get odutopo rest api"/> 
                      </return>
                    </outcome>
                  </execute>
                  <for index="nidx" start="0" end="`$ztetopology.output.topology.node-ref-id_length`">
                    <block atomic="true">
                      <set> 
                        <parameter name="prop.zte.network-id" value="zteNetwork"/>  
                        <parameter name="prop.zte.client-id" value="zteClient1"/>  
                        <parameter name="prop.zte.topo-id" value="zteTopo1"/>  
                        <parameter name="prop.zte.provider-id" value="zteProvider1"/>  
                        <parameter name="prop.zte.odutopo.name" value="`$ztetopology.output.topology.node-ref-id[$nidx]`"/> 
                      </set>
                      <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="network-resource" key="network-resource.network-id = $prop.zte.network-id"> 
                        <parameter name="network-id" value="`$prop.zte.network-id`"/>  
                        <parameter name="client-id" value="`$prop.zte.client-id`"/>  
                        <parameter name="te-topo-id" value="`$prop.zte.topo-id`"/>  
                        <parameter name="provider-id" value="`$prop.zte.provider-id`"/>
                      </save>
                      <execute plugin="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" method="sendRequest"> 
                        <parameter name="templateFileName" value="`$prop.restapi.templateDir + '/getzteodutoponodetemplate.json'`"/>  
                        <parameter name="restapiUrl" value="`$zte.prop.sdncRestApi.thirdpartySdnc.url + '/restconf/operations/ZTE-API-Topology:get-topology-details'`"/>  
                        <parameter name="restapiUser" value="`$zte.prop.sdncRestApi.thirdpartySdnc.user`"/>  
                        <parameter name="restapiPassword" value="`$zte.prop.sdncRestApi.thirdpartySdnc.password`"/>  
                        <parameter name="format" value="json"/>  
                        <parameter name="httpMethod" value="POST"/>  
                        <parameter name="responsePrefix" value="ztetopologynode"/>
                        <outcome value="failure"> 
                          <return status="failure"> 
                            <parameter name="ack-final" value="Y"/>  
                            <parameter name="error-code" value="500"/>  
                            <parameter name="error-message" value="Error executing Get odutopo node rest api"/> 
                          </return>
                        </outcome>
                        <outcome value="success"> 
                          <for index="pidx" start="0" end="`$ztetopologynode.output.topology.node-ref-id_length`"> 
                            <block> 
                              <set> 
                                <parameter name="prop.zte.odutopo.node.name" value="`$ztetopologynode.output.topology.node-ref-id[$pidx]`"/> 
                              </set>
                              <execute plugin="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" method="sendRequest"> 
                                <parameter name="templateFileName" value="`$prop.restapi.templateDir + '/getzteodutoponodedetailstemplate.json'`"/>  
                                <parameter name="restapiUrl" value="`$zte.prop.sdncRestApi.thirdpartySdnc.url + '/restconf/operations/ZTE-API-Topology:get-node-details'`"/>  
                                <parameter name="restapiUser" value="`$zte.prop.sdncRestApi.thirdpartySdnc.user`"/>  
                                <parameter name="restapiPassword" value="`$zte.prop.sdncRestApi.thirdpartySdnc.password`"/>  
                                <parameter name="format" value="json"/>  
                                <parameter name="httpMethod" value="POST"/>  
                                <parameter name="responsePrefix" value="ztetopologynodedetails"/>
                                <outcome value="failure"> 
                                  <return status="failure"> 
                                    <parameter name="ack-final" value="Y"/>  
                                    <parameter name="error-code" value="500"/>  
                                    <parameter name="error-message" value="Error executing Get odutopo node details rest api"/> 
                                  </return>
                                </outcome>
                                <outcome value="success"> 
                                  <block> 
                                    <switch test="`$ztetopologynodedetails.node.global-state-pac.operational-state == 'ENABLED'`"> 
                                      <outcome value="true"> 
                                        <switch test="`$ztetopologynodedetails.node.global-state-pac.administrative-state == 'LOCKED'`"> 
                                          <outcome value="true"> 
                                            <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="pnf" key="pnf.pnf-name = $ztetopologynodedetails.node.uuid"> 
                                              <parameter name="pnf-name" value="`$ztetopologynodedetails.node.uuid`"/>  
                                              <parameter name="pnf-id" value="`$ztetopologynodedetails.node.uuid`"/>  
                                              <parameter name="operational-status" value="up"/>  
                                              <parameter name="admin-status" value="up"/>  
                                              <parameter name="in-maint" value="true"/> 
                                            </save>
                                          </outcome>
                                          <outcome value="false"> 
                                            <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="pnf" key="pnf.pnf-name = $ztetopologynodedetails.node.uuid"> 
                                              <parameter name="pnf-name" value="`$ztetopologynodedetails.node.uuid`"/>  
                                              <parameter name="pnf-id" value="`$ztetopologynodedetails.node.uuid`"/>  
                                              <parameter name="operational-status" value="up"/>  
                                              <parameter name="admin-status" value="down"/>  
                                              <parameter name="in-maint" value="true"/> 
                                            </save>
                                          </outcome>
                                        </switch>
                                      </outcome>
                                      <outcome value="false"> 
                                        <switch test="`$ztetopologynodedetails.node.global-state-pac.administrative-state == 'LOCKED'`"> 
                                          <outcome value="true"> 
                                            <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="pnf" key="pnf.pnf-name = $ztetopologynodedetails.node.uuid"> 
                                              <parameter name="pnf-name" value="`$ztetopologynodedetails.node.uuid`"/>  
                                              <parameter name="pnf-id" value="`$ztetopologynodedetails.node.uuid`"/>  
                                              <parameter name="operational-status" value="down"/>  
                                              <parameter name="admin-status" value="up"/>  
                                              <parameter name="in-maint" value="true"/> 
                                            </save>
                                          </outcome>
                                          <outcome value="false"> 
                                            <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="pnf" key="pnf.pnf-name = $ztetopologynodedetails.node.uuid"> 
                                              <parameter name="pnf-name" value="`$ztetopologynodedetails.node.uuid`"/>  
                                              <parameter name="pnf-id" value="`$ztetopologynodedetails.node.uuid`"/>  
                                              <parameter name="operational-status" value="down"/>  
                                              <parameter name="admin-status" value="down"/>  
                                              <parameter name="in-maint" value="true"/> 
                                            </save>
                                          </outcome>
                                        </switch>
                                      </outcome>
                                    </switch>
                                    <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="pnf:relationship-list" key="pnf.pnf-name = $ztetopologynodedetails.node.uuid" force="true" pfx="tmp.AnAI-data"> 
                                      <parameter name="relationship-list.relationship[0].related-to" value="network-resource"/>  
                                      <parameter name="relationship-list.relationship[0].related-link" value="'/network/network-resources/network-resource/' + 'zteNetwork'"/>  
                                      <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="network-resource.network-id"/>  
                                      <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="zteNetwork"/>
                                    </save>
                                    <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="esr-thirdparty-sdnc:relationship-list" key="esr-thirdparty-sdnc.thirdparty-sdnc-id = $zte.prop.sdncRestApi.thirdpartySdnc.id" force="true" pfx="tmp.AnAI-data"> 
                                      <parameter name="relationship-list.relationship[0].related-to" value="pnf"/>  
                                      <parameter name="relationship-list.relationship[0].related-link" value="`'/network/pnfs/pnf/' + $ztetopologynodedetails.node.uuid`"/>  
                                      <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="pnf.pnf-name"/>  
                                      <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$ztetopologynodedetails.node.uuid`"/> 
                                    </save>
                                    <for index="ridx" start="0" end="`$ztetopologynodedetails.output.node.node-edge-point-id_length`"> 
                                      <block> 
                                        <set> 
                                          <parameter name="prop.zte.odutopo.node.nep.uuid" value="`$ztetopologynodedetails.output.node.node-edge-point-id[$ridx]`"/> 
                                        </set>
                                        <execute plugin="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" method="sendRequest"> 
                                          <parameter name="templateFileName" value="`$prop.restapi.templateDir + '/getzteodutoponodenepdetailstemplate.json'`"/>  
                                          <parameter name="restapiUrl" value="`$zte.prop.sdncRestApi.thirdpartySdnc.url + '/restconf/operations/ZTE-API-Topology:get-node-edge-point-details'`"/>  
                                          <parameter name="restapiUser" value="`$zte.prop.sdncRestApi.thirdpartySdnc.user`"/>  
                                          <parameter name="restapiPassword" value="`$zte.prop.sdncRestApi.thirdpartySdnc.password`"/>  
                                          <parameter name="format" value="json"/>  
                                          <parameter name="httpMethod" value="POST"/>  
                                          <parameter name="responsePrefix" value="ztetopologynodenepdetails"/>
                                          <outcome value="failure"> 
                                            <return status="failure"> 
                                              <parameter name="ack-final" value="Y"/>  
                                              <parameter name="error-code" value="500"/>  
                                              <parameter name="error-message" value="Error executing Get odutopo node edge point details rest api"/> 
                                            </return>
                                          </outcome>
                                          <outcome value="success"> 
                                            <for index="tidx" start="0" end="`$ztetopologynodenepdetails.output.node-edge-point.name_length`"> 
                                              <execute plugin="org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils" method="contains"> 
                                                <parameter name="source" value="`$ztetopologynodenepdetails.node-edge-point.name[tidx].value`"/>  
                                                <parameter name="target" value="client"/>  
                                                <outcome value="false"> 
                                                  <block></block>
                                                </outcome>
                                                <outcome value="true"> 
                                                  <block> 
                                                    <set> 
                                                      <parameter name="zte-unique-ltpId" value="`'nodeId-' + $ztetopologynodedetails.node.uuid + '-ltpId-' + $ztetopologynodenepdetails.node-edge-point.uuid`"/> 
                                                    </set>
                                                    <set> 
                                                      <parameter name="zte-bandwidth" value="`1000 * 1000000 * 1.25 * $ztetopologynodenepdetails.node-edge-point.lp[0].odu-nep-pac.oducapacity`"/> 
                                                    </set>
                                                    <switch test="`$ztetopologynodedetails.node.global-state-pac.operational-state == 'ENABLED'`"> 
                                                      <outcome value="true"> 
                                                        <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="p-interface" key="pnf.pnf-name = $ztetopologynodedetails.node.uuid       AND p-interface.interface-name = $zte-unique-ltpId"> 
                                                          <parameter name="interface-name" value="`$zte-unique-ltpId`"/>  
                                                          <parameter name="network-ref" value="`'providerId/' + $prop.zte.provider-id + '/topologyId/' + $prop.zte.topo-id + '/clientId/' + $prop.zte.client-id`"/>  
                                                          <parameter name="transparent" value="true"/>  
                                                          <parameter name="speed-value" value="`$zte-bandwidth`"/>  
                                                          <parameter name="operational-status" value="up"/>  
                                                          <parameter name="in-maint" value="true"/> "`'nodeId-' + $node.node-id + '-ltpId-' + $tp.te-tp-id`"
                                                          <outcome value="success"> 
                                                            <block></block>
                                                          </outcome>
                                                          <outcome value="failure"> 
                                                            <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="p-interface" key="pnf.pnf-name = $ztetopologynodedetails.node.uuid       AND p-interface.interface-name = $zte-unique-ltpId"> 
                                                              <parameter name="interface-name" value="`$zte-unique-ltpId`"/>  
                                                              <parameter name="network-ref" value="`'providerId/' + $prop.zte.provider-id + '/topologyId/' + $prop.zte.topo-id + '/clientId/' + $prop.zte.client-id`"/>  
                                                              <parameter name="transparent" value="true"/>  
                                                              <parameter name="speed-value" value="`$zte-bandwidth`"/>  
                                                              <parameter name="operational-status" value="up"/>  
                                                              <parameter name="in-maint" value="true"/> 
                                                            </save>
                                                          </outcome>
                                                        </save>
                                                      </outcome>
                                                      <outcome value="false"> 
                                                        <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="p-interface" key="pnf.pnf-name = $ztetopologynodedetails.node.uuid       AND p-interface.interface-name = $zte-unique-ltpId"> 
                                                          <parameter name="interface-name" value="`$zte-unique-ltpId`"/>  
                                                          <parameter name="network-ref" value="`'providerId/' + $prop.zte.provider-id + '/topologyId/' + $prop.zte.topo-id + '/clientId/' + $prop.zte.client-id`"/>  
                                                          <parameter name="transparent" value="true"/>  
                                                          <parameter name="speed-value" value="`$zte-bandwidth`"/>  
                                                          <parameter name="operational-status" value="down"/>  
                                                          <parameter name="in-maint" value="true"/>  
                                                          <outcome value="success"> 
                                                            <block></block>
                                                          </outcome>
                                                          <outcome value="failure"> 
                                                            <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="p-interface" key="pnf.pnf-name = $ztetopologynodedetails.node.uuid       AND p-interface.interface-name = $zte-unique-ltpId"> 
                                                              <parameter name="interface-name" value="`$zte-unique-ltpId`"/>  
                                                              <parameter name="network-ref" value="`'providerId/' + $prop.zte.provider-id + '/topologyId/' + $prop.zte.topo-id + '/clientId/' + $prop.zte.client-id`"/>  
                                                              <parameter name="transparent" value="true"/>  
                                                              <parameter name="speed-value" value="`$zte-bandwidth`"/>  
                                                              <parameter name="operational-status" value="up"/>  
                                                              <parameter name="in-maint" value="true"/> 
                                                            </save>
                                                          </outcome>
                                                        </save>
                                                      </outcome>
                                                    </switch>
                                                  </block>
                                                </outcome>
                                              </execute>
                                            </for>
                                          </outcome>
                                        </execute>
                                      </block>
                                    </for>
                                  </block>
                                </outcome>
                              </execute>
                            </block>
                          </for>
                        </outcome>
                      </execute>
                    </block>
                  </for>
                </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="`'Unsupported type = ' + $prop.sdncRestApi.type`"/> 
                </return>
              </outcome>
            </switch>
          </block>
        </outcome>
        <outcome value="delete"> 
          <block atomic="true"/>
        </outcome>
      </switch>
    </block>
  </method>
</service-logic>