Completing the logic and the call flow for Transport Slicing operations:
[sdnc/oam.git] / platform-logic / datachange / src / main / xml / DataChange_update-network-to-aai.xml
1 <service-logic\r
2         xmlns='http://www.onap.org/sdnc/svclogic'\r
3         xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance' xsi:schemaLocation='http://www.onap.org/sdnc/svclogic ./svclogic.xsd' module='DataChange' version='${project.version}'>\r
4     <method rpc='update-network-to-aai' mode='sync'>\r
5         <block atomic="true">\r
6             <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' >\r
7                 <parameter name="source" value="`$network.network-id`"/>\r
8                 <parameter name="outputPath" value="tmp.original-network-id"/>\r
9                 <parameter name="target" value="/"/>\r
10                 <parameter name="replacement" value="-"/>\r
11             </execute>\r
12             <set>\r
13                 <!--<parameter name='tmp.network-id' value="`$prop.sdncRestApi.thirdpartySdnc.id + '-' + $tmp.original-network-id`" />-->\r
14                 <parameter name='tmp.network-id' value="`$tmp.original-network-id`" />\r
15             </set>\r
16             <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='network-resource'\r
17                   key='network-resource.network-id = $tmp.network-id' >\r
18                 <parameter name='network-id' value='`$tmp.network-id`' />\r
19                 <parameter name='client-id' value='`$network.client-id`' />\r
20                 <parameter name='te-topo-id' value='`$network.te-topology-id`' />\r
21                 <parameter name='provider-id' value='`$network.provider-id`' />\r
22                 <parameter name='network-type' value='`$network.network-types`' />\r
23             </save>\r
24             <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"\r
25                           resource="esr-thirdparty-sdnc"\r
26                           key="esr-thirdparty-sdnc.thirdparty-sdnc-id = $prop.sdncRestApi.thirdpartySdnc.id AND\r
27                      depth = '1'"\r
28                           pfx='tmp.aai.esr-thirdparty-sdnc' local-only='false' >\r
29                 <outcome value='success'>\r
30                     <block>\r
31                         <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='network-resource:relationship-list'\r
32                               key='network-resource.network-id = $tmp.network-id'\r
33                               force="true" pfx="tmp.AnAI-data">\r
34                             <parameter name="relationship-list.relationship[0].related-to" value="esr-thirdparty-sdnc" />\r
35                             <parameter name="relationship-list.relationship[0].related-link" value="`'/aai/v19/external-system/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/' + $prop.sdncRestApi.thirdpartySdnc.id`" />\r
36                             <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="esr-thirdparty-sdnc.thirdparty-sdnc-id" />\r
37                             <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$prop.sdncRestApi.thirdpartySdnc.id`" />\r
38                             <!--/aai/v19/external-system/esr-thirdparty-sdnc-list/esr-thirdparty-sdnc/SOTNControllerDomain2-->\r
39                         </save>\r
40                     </block>\r
41                 </outcome>\r
42                 <outcome value='not-found'>\r
43                     <return status='failure'>\r
44                         <parameter name='ack-final' value='Y'/>\r
45                         <parameter name="error-code" value="500" />\r
46                         <parameter name="error-message" value="`'An error occurred while querying esr-thirdparty-sdnc from AnAI with thirdparty-sdnc-id = ' + $tmp.thirdparty-sdnc-id`" />\r
47                     </return>\r
48                 </outcome>\r
49                 <outcome value='Other'>\r
50                     <return status='failure'>\r
51                         <parameter name='ack-final' value='Y'/>\r
52                         <parameter name="error-code" value="500" />\r
53                         <parameter name="error-message" value="`'Unexpected error occurred while querying esr-thirdparty-sdnc from AnAI with thirdparty-sdnc-id = ' + $tmp.thirdparty-sdnc-id`" />\r
54                     </return>\r
55                 </outcome>\r
56             </get-resource>\r
57             <for index='pidx' start='0' end='`$network.node_length`' >\r
58                 <set>\r
59                     <parameter name='node.' value='' />\r
60                 </set>\r
61                 <set>\r
62                     <parameter name='node.' value='`$network.node[$pidx].`' />\r
63                     <parameter name='unique-networkId' value='`$tmp.network-id`' />\r
64                 </set>\r
65                 <set>\r
66                     <parameter name='unique-nodeId' value="`'networkId-' + $unique-networkId + '-nodeId-' + $node.node-id`" />\r
67                 </set>\r
68                 <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='pnf'\r
69                       key='pnf.pnf-name = $unique-nodeId' >\r
70                     <parameter name='pnf-name' value='`$unique-nodeId`' />\r
71                     <parameter name='pnf-id' value='`$node.node-id`' />\r
72                     <parameter name='operational-status' value='`$node.te.oper-status`' />\r
73                     <parameter name='admin-status' value='`$node.te.te-node-attributes.admin-status`' />\r
74                     <parameter name='in-maint' value='true' />\r
75                 </save>\r
76                 <switch test='`$node.termination-point_length`'>\r
77                     <outcome value=''>\r
78                         <block></block>\r
79                     </outcome>\r
80                     <outcome value='0'>\r
81                         <block></block>\r
82                     </outcome>\r
83                     <outcome value='Other'>\r
84                         <for index='tidx' start='0' end='`$node.termination-point_length`' >\r
85                             <set>\r
86                                 <parameter name='tp.' value='' />\r
87                             </set>\r
88                             <set>\r
89                                 <parameter name='tp.' value='`$node.termination-point[$tidx].`' />\r
90                             </set>\r
91                             <set>\r
92                                 <parameter name='unique-ltpId' value="`$unique-nodeId + '-ltpId-' + $tp.te-tp-id`" />\r
93                             </set>\r
94                             <switch test='`length($tp.te.inter-domain-plug-id) == 0`'>\r
95                                 <outcome value='true'>\r
96                                     <set>\r
97                                         <parameter name='tmp.decoded-plug-id' value='' />\r
98                                     </set>\r
99                                 </outcome>\r
100                                 <outcome value='false'>\r
101                                     <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='base64DecodingAlgo' >\r
102                                         <parameter name="encodedValue" value='`$tp.te.inter-domain-plug-id`'/>\r
103                                         <parameter name="decodedValue" value="tmp.decoded-plug-id"/>\r
104                                         <outcome value='success'>\r
105                                             <block></block>\r
106                                         </outcome>\r
107                                         <outcome value='failure'>\r
108                                             <set>\r
109                                                 <parameter name='tmp.decoded-plug-id' value='`$tp.te.inter-domain-plug-id`' />\r
110                                             </set>\r
111                                         </outcome>\r
112                                     </execute>\r
113                                 </outcome>\r
114                             </switch>\r
115                             <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='p-interface'\r
116                                   key='pnf.pnf-name = $unique-nodeId\r
117       AND p-interface.interface-name = $unique-ltpId' >\r
118                                 <parameter name='interface-name' value='`$unique-ltpId`' />\r
119                                 <parameter name='network-ref' value='`$tp.supporting-termination-point[0].network-ref`' />\r
120                                 <parameter name='transparent' value='`$tp.svc.supported-classification.transparent`' />\r
121                                 <parameter name='speed-value' value='`$tp.te.interface-switching-capability[0].max-lsp-bandwidth[0].te-bandwidth.eth-bandwidth`' />\r
122                                 <parameter name='operational-status' value='`$tp.te.oper-status`' />\r
123                                 <parameter name='in-maint' value="true" />\r
124                                 <parameter name='inter-layer-lock-id' value='`$tp.te.inter-layer-lock-id[0]`' />\r
125                                 <!--<parameter name='inter-domain-plug-id' value='`$tp.te.inter-domain-plug-id`' />-->\r
126                                 <parameter name='inter-domain-plug-id' value='`$tmp.decoded-plug-id`' />\r
127                                 <outcome value='success'>\r
128                                     <block></block>\r
129                                 </outcome>\r
130                                 <outcome value='failure'>\r
131                                     <update plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='p-interface'\r
132                                             key='pnf.pnf-name = $unique-nodeId\r
133       AND p-interface.interface-name = $unique-ltpId' >\r
134                                         <parameter name='interface-name' value='`$unique-ltpId`' />\r
135                                         <parameter name='network-ref' value='`$tp.supporting-termination-point[0].network-ref`' />\r
136                                         <parameter name='transparent' value='`$tp.svc.supported-classification.transparent`' />\r
137                                         <parameter name='speed-value' value='`$tp.te.interface-switching-capability[0].max-lsp-bandwidth[0].te-bandwidth.eth-bandwidth`' />\r
138                                         <parameter name='operational-status' value='`$tp.te.oper-status`' />\r
139                                         <parameter name='in-maint' value="true" />\r
140                                         <parameter name='inter-layer-lock-id' value='`$tp.te.inter-layer-lock-id[0]`' />\r
141                                         <!--<parameter name='inter-domain-plug-id' value='`$tp.te.inter-domain-plug-id`' />-->\r
142                                         <parameter name='inter-domain-plug-id' value='`$tmp.decoded-plug-id`' />\r
143                                     </update>\r
144                                 </outcome>\r
145                             </save>\r
146                         </for>\r
147                     </outcome>\r
148                 </switch>\r
149                 <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='pnf:relationship-list'\r
150                       key='pnf.pnf-name = $unique-nodeId' force="true" pfx="tmp.AnAI-data">\r
151                     <parameter name="relationship-list.relationship[0].related-to" value="network-resource" />\r
152                     <parameter name="relationship-list.relationship[0].related-link" value="`'/network/network-resources/network-resource/' + $tmp.network-id`" />\r
153                     <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="network-resource.network-id" />\r
154                     <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$tmp.network-id`" />\r
155                 </save>\r
156                 <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='esr-thirdparty-sdnc:relationship-list'\r
157                       key='esr-thirdparty-sdnc.thirdparty-sdnc-id = $prop.sdncRestApi.thirdpartySdnc.id'\r
158                       force="true" pfx="tmp.AnAI-data">\r
159                     <parameter name="relationship-list.relationship[0].related-to" value="pnf" />\r
160                     <parameter name="relationship-list.relationship[0].related-link" value="`'/network/pnfs/pnf/' + $unique-nodeId`" />\r
161                     <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="pnf.pnf-name" />\r
162                     <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$unique-nodeId`" />\r
163                 </save>\r
164                 <switch test='`$node.te.tunnel-termination-point_length`'>\r
165                     <outcome value=''>\r
166                         <block></block>\r
167                     </outcome>\r
168                     <outcome value='0'>\r
169                         <block></block>\r
170                     </outcome>\r
171                     <outcome value='Other'>\r
172                         <for index='ttidx' start='0' end='`$node.te.tunnel-termination-point_length`' >\r
173                             <set>\r
174                                 <parameter name='ttp.' value='' />\r
175                             </set>\r
176                             <set>\r
177                                 <parameter name='ttp.' value='`$node.te.tunnel-termination-point[$ttidx].`' />\r
178                             </set>\r
179                             <set>\r
180                                 <parameter name='unique-ttpId' value="`$unique-nodeId + '-ttpId-' + $ttp.tunnel-tp-id`" />\r
181                             </set>\r
182                             <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='tunnel-termination-point'\r
183                                   key='tunnel-termination-point.ttp-id = $unique-ttpId' >\r
184                                 <parameter name='ttp-id' value='`$unique-ttpId`' />\r
185                                 <parameter name='tunnel-tp-id' value='`$ttp.tunnel-tp-id`' />\r
186                                 <parameter name='name' value='`$ttp.name`' />\r
187                                 <parameter name='admin-status' value='`$ttp.admin-status`' />\r
188                                 <parameter name='oper-status' value='`$ttp.oper-status`' />\r
189                                 <parameter name='inter-layer-lock-id' value='`$ttp.inter-layer-lock-id[0]`' />\r
190                                 <parameter name='switching-capability' value='`$ttp.switching-capability`' />\r
191                                 <parameter name='protection-type' value='`$ttp.protection-type`' />\r
192                                 <parameter name='encoding' value='`$ttp.encoding`' />\r
193                                 <outcome value='success'>\r
194                                     <block></block>\r
195                                 </outcome>\r
196                                 <outcome value='failure'>\r
197                                     <update plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='tunnel-termination-point'\r
198                                             key='tunnel-termination-point.ttp-id = $unique-ttpId' >\r
199                                         <parameter name='ttp-id' value='`$unique-ttpId`' />\r
200                                         <parameter name='tunnel-tp-id' value='`$ttp.tunnel-tp-id`' />\r
201                                         <parameter name='name' value='`$ttp.name`' />\r
202                                         <parameter name='admin-status' value='`$ttp.admin-status`' />\r
203                                         <parameter name='oper-status' value='`$ttp.oper-status`' />\r
204                                         <parameter name='inter-layer-lock-id' value='`$ttp.inter-layer-lock-id[0]`' />\r
205                                         <parameter name='switching-capability' value='`$ttp.switching-capability`' />\r
206                                         <parameter name='protection-type' value='`$ttp.protection-type`' />\r
207                                         <parameter name='encoding' value='`$ttp.encoding`' />\r
208                                     </update>\r
209                                 </outcome>\r
210                             </save>\r
211                             <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='pnf:relationship-list'\r
212                                   key='pnf.pnf-name = $unique-nodeId' force="true" pfx="tmp.AnAI-data">\r
213                                 <parameter name="relationship-list.relationship[0].related-to" value="tunnel-termination-point" />\r
214                                 <!--<parameter name="relationship-list.relationship[$ttidx].related-link" value="`'/network/network-resources/network-resource/' + $tmp.network-id + '/pnfs/pnf/' + $node.node-id '/tunnel-termination-points/tunnel-termination-point/' + $unique-ttpId`" />-->\r
215                                 <parameter name="relationship-list.relationship[0].related-link" value="`'/network/tunnel-termination-points/tunnel-termination-point/' + $unique-ttpId`" />\r
216                                 <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="tunnel-termination-point.ttp-id" />\r
217                                 <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$unique-ttpId`" />\r
218                                 <outcome value='success'></outcome>\r
219                                 <outcome value='failure'></outcome>\r
220                             </save>\r
221                             <switch test='`$node.te.tunnel-termination-point[$ttidx].local-link-connectivities.local-link-connectivity_length`'>\r
222                                 <outcome value=''>\r
223                                     <block></block>\r
224                                 </outcome>\r
225                                 <outcome value='0'>\r
226                                     <block></block>\r
227                                 </outcome>\r
228                                 <outcome value='Other'>\r
229                                     <block>\r
230                                         <set>\r
231                                             <parameter name='unique-ltpId-second' value="`$unique-nodeId + '-ltpId-' + $node.te.tunnel-termination-point[$ttidx].local-link-connectivities.local-link-connectivity[0].link-tp-ref`" />\r
232                                         </set>\r
233                                         <save plugin='org.onap.ccsdk.sli.adaptors.aai.AAIService' resource='tunnel-termination-point:relationship-list'\r
234                                               key='tunnel-termination-point.ttp-id = $unique-ttpId' force="true" pfx="tmp.AnAI-data">\r
235                                             <parameter name="relationship-list.relationship[0].related-to" value="p-interface" />\r
236                                             <parameter name="relationship-list.relationship[0].related-link" value="`'/network/pnfs/pnf/' + $unique-nodeId + '/p-interfaces/p-interface/' + $unique-ltpId-second`" />\r
237                                             <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="p-interface.interface-name" />\r
238                                             <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$unique-ltpId-second`" />\r
239                                         </save>\r
240                                     </block>\r
241                                 </outcome>\r
242                             </switch>\r
243                         </for>\r
244                     </outcome>\r
245                 </switch>\r
246             </for>\r
247             <call module='DataChange' rpc='update-network-links-to-aai' mode='sync' ></call>\r
248         </block>\r
249     </method>\r
250 </service-logic>