Merge "Remove test for Active on Delete"
[sdnc/oam.git] / platform-logic / vnfapi / src / main / xml / VNF-API_vf-module-topology-changeassign.xml
1 <!--
2   ============LICENSE_START=======================================================
3   openECOMP : SDN-C
4   ================================================================================
5   Copyright (C) 2017 AT&T Intellectual Property. All rights
6                                                 reserved.
7   ================================================================================
8   Licensed under the Apache License, Version 2.0 (the "License");
9   you may not use this file except in compliance with the License.
10   You may obtain a copy of the License at
11        http://www.apache.org/licenses/LICENSE-2.0
12   Unless required by applicable law or agreed to in writing, software
13   distributed under the License is distributed on an "AS IS" BASIS,
14   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   See the License for the specific language governing permissions and
16   limitations under the License.
17   ============LICENSE_END=========================================================
18   -->
19
20 <service-logic xmlns="http://www.onap.org/sdnc/svclogic"
21     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
22     xsi:schemaLocation="http://www.onap.org/sdnc/svclogic ./svclogic.xsd" module='VNF-API' version='${project.version}'><method rpc='vf-module-topology-changeassign' mode='sync'>
23 <block atomic="true"><switch test="`$vf-module-service-data.oper-status.order-status == Active`"><outcome value='false'><return status='failure'>
24     <parameter name='error-code' value='400'/>
25     <parameter name='error-message' value='Invalid service-data order status'/></return></outcome></switch><call module='VNF-API' rpc='vf-module-topology-assign-vnf-networks' mode='sync' ></call><get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
26     resource="vf-module"
27         key="vf-module.vf-module-id = $vf-module-topology-operation-input.vf-module-request-information.vf-module-id
28             and generic-vnf.vnf-id = $vf-module-topology-operation-input.vf-module-request-information.vnf-instance-id"
29         pfx="tmp.AnAI.vfmodule"><outcome value='failure'>
30 <return status='failure'>
31     <parameter name='error-code' value='500'/>
32     <parameter name='error-message' value="`'An error occurred while querying vf-module from AnAI with vf-module-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vf-module-id + ' and vnf-instance-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vnf-instance-id`"/></return></outcome><outcome value='not-found'>
33 <return status='failure'>
34     <parameter name='error-code' value='500'/>
35     <parameter name='error-message' value="`'An error occurred while querying vf-module from AnAI with vf-module-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vf-module-id + ' and vnf-instance-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vnf-instance-id`"/></return></outcome></get-resource><delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
36     resource="vf-module:relationship-list"
37         key="vf-module.vf-module-id = $vf-module-topology-operation-input.vf-module-request-information.vf-module-id
38             AND generic-vnf.vnf-id = $vf-module-topology-operation-input.vf-module-request-information.vnf-instance-id
39             AND related-to = l3-network" ><outcome value='failure'>
40 <return status='failure'>
41     <parameter name='error-code' value='500'/>
42     <parameter name='error-message' value="`'An error occurred while deleting existing vf-module l3-network relationship in AnAI with with vf-module-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vf-module-id + ' and vnf-instance-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vnf-instance-id + ' vf-module update FAILED.'`"/></return></outcome></delete><switch test="`$vf-module-service-data.vf-module-topology-information.vnf-assignments.vnf-networks_length`"><outcome value=''>
43 <set>
44     <parameter name="vf-module-service-data.vf-module-topology-information.vnf-assignments.vnf-networks_length" value = "0" /></set></outcome></switch><for index="i" start="0" end="`$vf-module-service-data.vf-module-topology-information.vnf-assignments.vnf-networks_length`"><save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
45     resource="vf-module:relationship-list"
46         key="vf-module.vf-module-id = $vf-module-topology-operation-input.vf-module-request-information.vf-module-id
47             AND generic-vnf.vnf-id = $vf-module-topology-operation-input.vf-module-request-information.vnf-instance-id" >
48
49     <parameter name="relationship-list.relationship[0].related-to" value="l3-network" />
50     <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="l3-network.network-id" />
51     <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$vf-module-service-data.vf-module-topology-information.vnf-assignments.vnf-networks[$i].network-id`" /><outcome value='failure'>
52 <block atomic='true'><set>
53     <parameter name="error-code" value="500" />
54     <parameter name="error-message" value="`' | An error occurred while saving l3-network relationship with network-id = ' + $vf-module-service-data.vf-module-topology-information.vnf-assignments.vnf-networks[$i].network-id + ' for vf-module with vf-module-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vf-module-id + ' and generic-vnf-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vnf-instance-id`" />
55 </set><delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
56     resource="vf-module:relationship-list"
57         key="vf-module.vf-module-id = $vf-module-topology-operation-input.vf-module-request-information.vf-module-id
58             AND generic-vnf.vnf-id = $vf-module-topology-operation-input.vf-module-request-information.vnf-instance-id
59             AND related-to = l3-network" ></delete><switch test="`$tmp.AnAI.vfmodule.relationship-list.relationship_length`"><outcome value=''>
60 <set>
61     <parameter name="tmp.AnAI.vfmodule.relationship-list.relationship_length" value = "0" /></set></outcome></switch><for index="i" start="0" end="`$tmp.AnAI.vfmodule.relationship-list.relationship_length`"><switch test="`$tmp.AnAI.vfmodule.relationship-list.relationship[$i].related-to`"><outcome value='l3-network'><block atomic='true'><switch test="`$tmp.AnAI.vfmodule.relationship-list.relationship[$i].relationship-data_length`"><outcome value=''>
62 <set>
63     <parameter name="tmp.AnAI.vfmodule.relationship-list.relationship[$i].relationship-data_length" value = "0" /></set></outcome></switch><for index="j" start="0" end="`$tmp.AnAI.vfmodule.relationship-list.relationship[$i].relationship-data_length`"><save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService"
64     resource="vf-module:relationship-list"
65         key="vf-module.vf-module-id = vf-module-topology-operation-input.vf-module-request-information.vf-module-id
66             AND generic-vnf.vnf-id = $vf-module-topology-operation-input.vf-module-request-information.vnf-instance-id" >
67
68     <parameter name="relationship-list.relationship[0].related-to" value="l3-network" />
69     <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="l3-network.network-id" />
70     <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$tmp.AnAI.vfmodule.relationship-list.relationship[$i].relationship-data[$j].relationship-value`" /><outcome value='failure'>
71 <set>
72     <parameter name="error-code" value="500" />
73     <parameter name="error-message" value="`$error-message + ' | An error occurred while during rollback of l3-network relationship for vf-module with vf-module-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vf-module-id + ' and generic-vnf-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vnf-instance-id`" />
74 </set></outcome><outcome value='not-found'>
75 <set>
76     <parameter name="error-code" value="500" />
77     <parameter name="error-message" value="`$error-message + ' | An error occurred while during rollback of l3-network relationship for vf-module with vf-module-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vf-module-id + ' and generic-vnf-id = ' + $vf-module-topology-operation-input.vf-module-request-information.vnf-instance-id`" />
78 </set></outcome></save></for></block></outcome></switch></for><return status='failure'>
79     <parameter name='error-code' value='500'/>
80     <parameter name='error-message' value="`'Failed to update vf-module l3-network relationship in AnAI. ' + $error-message`"/></return></block></outcome></save></for><set>
81     <parameter name="vf-module-service-data.oper-status.last-order-status" value="`$vf-module-service-data.oper-status.order-status`"/></set><set>
82     <parameter name="vf-module-service-data.oper-status.order-status" value="PendingUpdate"/></set><set>
83     <parameter name="vf-module-service-data.oper-status.last-action" value="`$vf-module-service-data.request-information.request-action`"/></set><set>
84 <parameter name="ack-final" value="Y"/></set><return status='success'>
85     <parameter name="error-code" value="200" /></return></block></method></service-logic>