aboutsummaryrefslogtreecommitdiffstats
path: root/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_manage-ipaddr-assignment.xml
blob: 724faf3852f9d1c39a354d346252a96065dd184e (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
<!--Reserve/release IP-->
<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='${project.version}'>
    <method rpc='manage-ipaddr-assignment' mode='sync'>
        <block atomic='true'>
            <set>
                <parameter name='tmp.sql.plugin' value='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' />
            </set>
            <switch test='`$tmp.manageIpaddr.action`'>
                <outcome value='reserve'>
                    <block atomic='true'>
                        <get-resource plugin='`$tmp.sql.plugin`' resource='IPADDR' key="SELECT min(ipv4_addr) ip from IPV4_ADDRESS_POOL where universe = $tmp.manageIpaddr.pool and status='AVAILABLE'" pfx="tmp.manageIpaddr" >
                            <outcome value='success'>
                                <save plugin='`$tmp.sql.plugin`' resource='IPADDR' key="UPDATE IPV4_ADDRESS_POOL set status='RESERVED' where universe='VGW' and ipv4_addr = $tmp.manageIpaddr.ip" force='false'></save>
                            </outcome>
                        </get-resource>
                    </block>
                </outcome>
                <outcome value='release'>
                    <save plugin='`$tmp.sql.plugin`' resource='IPADDR' key="UPDATE IPV4_ADDRESS_POOL set status='AVAILABLE' where universe='VGW' and ipv4_addr = $tmp.manageIpaddr.ip" force='false'></save>
                </outcome>
            </switch>
        </block>
    </method>
</service-logic>