<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='network-topology-operation-changeassign' mode='sync'> <block atomic="true"> <switch test='`$service-data.networks.network[$nidx].network-data.network-information.from-preload`'> <outcome value='true'> <block></block> </outcome> <outcome value='Other'> <return status='failure'> <parameter name="error-code" value="500" /> <parameter name="error-message" value="Error: changeassign only allowed for networks with from-preload set to true" /> </return> </outcome> </switch> <execute plugin='org.onap.ccsdk.sli.plugins.prop.PropertiesNode' method='readProperties' > <parameter name='fileName' value='%SDNC_CONFIG_DIR%/generic-resource-api-dg.properties' /> <parameter name='contextPrefix' value='prop' /> </execute> <execute plugin='org.onap.ccsdk.sli.core.slipluginutils.SliStringUtils' method='replace' > <parameter name="source" value="`$prop.restapi.preload-network`"/> <parameter name="outputPath" value="tmp.pn-url"/> <parameter name="target" value="{network-name}"/> <parameter name="replacement" value="`$network-topology-operation-input.network-request-information.network-name`"/> </execute> <execute plugin='org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode' method='sendRequest' > <parameter name='restapiUrl' value='`$prop.controller.url + $tmp.pn-url`' /> <parameter name='restapiUser' value='`$prop.controller.user`' /> <parameter name='restapiPassword' value='`$prop.controller.pwd`' /> <parameter name='format' value='json' /> <parameter name='httpMethod' value='GET' /> <parameter name="responsePrefix" value="preload-data" /> <outcome value='success'> <block atomic="true"></block> </outcome> <outcome value='Other'> <return status='failure'> <parameter name="error-code" value="500" /> <parameter name="error-message" value="'Error: No preload-network found with network-name =' + $tmp.network-instance-name + ' in md-sal'" /> </return> </outcome> </execute> <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network" key="l3-network.network-id = $network-topology-operation-input.network-request-information.network-id AND depth='all'" local-only="false" pfx="tmp.AnAI.l3network"> <outcome value='failure'> <return status='failure'> <parameter name="error-code" value="500" /> <parameter name="error-message" value="`'Error retrieving l3-network with network-id=' + $network-topology-operation-input.network-request-information.network-id + ' from AnAI'`" /> </return> </outcome> <outcome value='not-found'> <return status='failure'> <parameter name="error-code" value="404" /> <parameter name="error-message" value="`'network-id: ' + $network-topology-operation-input.network-request-information.network-id + 'not found in AnAI'`" /> </return> </outcome> </get-resource> <switch test="`$tmp.AnAI.l3network.network-name == $network-data.network-topology.network-topology-identifier-structure.network-name`"> <outcome value='false'> <return status='failure'> <parameter name="error-code" value="404" /> <parameter name="error-message" value="`'The input network-name,' + network-topology-operation-input.network-request-information.network-name + ', does not match what is returned from AnAI with network-id = ' + $network-topology-operation-input.network-request-information.network-id`" /> </return> </outcome> </switch> <switch test="`$tmp.AnAI.l3network.network-type == $network-data.network-topology.network-topology-identifier-structure.network-type`"> <outcome value='false'> <return status='failure'> <parameter name="error-code" value="404" /> <parameter name="error-message" value="`'The input network-type,' + network-topology-operation-input.network-request-information.network-type + ', does not match what is returned from AnAI with network-id = ' + $network-topology-operation-input.network-request-information.network-id`" /> </return> </outcome> </switch> <switch test="`$tmp.AnAI.l3network.network-name == $preload-data.preload-network-topology-information.network-topology-identifier.network-name`"> <outcome value='false'> <return status='failure'> <parameter name="error-code" value="404" /> <parameter name="error-message" value="`'No preload network found with network-name = ' + $tmp.AnAI.l3network.network-name + ' in SDNC'`" /> </return> </outcome> </switch> <switch test="`$tmp.AnAI.l3network.network-type == $preload-data.preload-network-topology-information.network-topology-identifier.network-type`"> <outcome value='false'> <return status='failure'> <parameter name="error-code" value="404" /> <parameter name="error-message" value="`'No preload network found with network-type = ' + $tmp.AnAI.l3network.network-type + ' in SDNC'`" /> </return> </outcome> </switch> <set> <parameter name='x' value='0' /> <parameter name='tmp.error-message' value='' /> <parameter name='execute_failure' value='false' /> <parameter name='tmp.l3networkUpdate' value='0' /> </set> <switch test="`$tmp.AnAI.l3network.subnets.subnet_length`"> <outcome value=''> <set> <parameter name="tmp.AnAI.l3network.subnets.subnet_length" value="0" /> </set> </outcome> </switch> <for index="k" start="0" end="`$tmp.AnAI.l3network.subnets.subnet_length`"> <block atomic='true'> <set> <parameter name='tmp.start-address-match' value='0' /> </set> <set> <parameter name='tmp.subnetUpdate' value='0' /> </set> <block atomic='true'> <for index="n" start="0" end="`$preload-data.preload-network-topology-information.subnets_length`"> <switch test="`$tmp.AnAI.l3network.subnets.subnet[$k].network-start-address == $preload-data.preload-network-topology-information.subnets[$n].start-address`"> <outcome value='true'> <block atomic='true'> <set> <parameter name='tmp.start-address-match' value='1' /> </set> <switch test="`$tmp.AnAI.l3network.subnets.subnet[$k].cidr-mask == $preload-data.preload-network-topology-information.subnets[$n].cidr-mask`"> <outcome value='false'> <set> <parameter name="tmp.subnetUpdate" value="1" /> </set> </outcome> </switch> <switch test="`$preload-data.preload-network-topology-information.subnets[$n].gateway-address`"> <outcome value=''> <block> <execute plugin="com.att.sdnctl.sli.plugin.ipAddressTools.IpAddressTool" method="getGatewayAddress"> <parameter name="ipAddress" value="`$preload-data.preload-network-topology-information.subnets[$n].start-address`" /> <parameter name="ipVersion" value="`$preload-data.preload-network-topology-information.subnets[$n].ip-version`" /> <parameter name="subnet" value="`$preload-data.preload-network-topology-information.subnets[$n].cidr-mask`" /> <parameter name="ctxVariable" value="tmp.return.generate.gateway-address" /> </execute> <switch test="`$tmp.AnAI.l3network.subnets.subnet[$k].gateway-address == $tmp.return.generate.gateway-address`"> <outcome value='false'> <block> <set> <parameter name="tmp.gateway-address" value="`$tmp.return.generate.gateway-address`" /> </set> <set> <parameter name="tmp.subnetUpdate" value="1" /> </set> </block> </outcome> </switch> </block> </outcome> <outcome value='Other'> <switch test="`$tmp.AnAI.l3network.subnets.subnet[$k].gateway-address == $preload-data.preload-network-topology-information.subnets[$n].gateway-address`"> <outcome value='false'> <block> <set> <parameter name="tmp.gateway-address" value="`$preload-data.preload-network-topology-information.subnets[$n].gateway-address`" /> </set> <set> <parameter name="tmp.subnetUpdate" value="1" /> </set> </block> </outcome> <outcome value='true'> <set> <parameter name="tmp.gateway-address" value="`$preload-data.preload-network-topology-information.subnets[$n].gateway-address`" /> </set> </outcome> </switch> </outcome> </switch> <switch test="`$preload-data.preload-network-topology-information.subnets[$n].dhcp-enabled`"> <outcome value='N'> <set> <parameter name="tmp.dhcpEnabled.boolean" value="false" /> </set> </outcome> <outcome value='Y'> <set> <parameter name="tmp.dhcpEnabled.boolean" value="true" /> </set> </outcome> </switch> <switch test="`$preload-data.preload-network-topology-information.subnets[$n].addr-from-start`"> <outcome value='N'> <set> <parameter name="tmp.addrFromStart.boolean" value="false" /> </set> </outcome> <outcome value='Y'> <set> <parameter name="tmp.addrFromStart.boolean" value="true" /> </set> </outcome> </switch> <switch test="`$tmp.AnAI.l3network.subnets.subnet[$k].ip-assignment-direction == $tmp.addrFromStart.boolean`"> <outcome value='false'> <block> <set> <parameter name="tmp.subnetUpdate" value="1" /> </set> </block> </outcome> </switch> <switch test="`$tmp.AnAI.l3network.subnets.subnet[$k].dhcp-enabled == $tmp.dhcpEnabled.boolean`"> <outcome value='false'> <block> <set> <parameter name="tmp.subnetUpdate" value="1" /> </set> </block> </outcome> </switch> <switch test="`$tmp.AnAI.l3network.subnets.subnet[$k].dhcp-start == $preload-data.preload-network-topology-information.subnets[$n].dhcp-start-address`"> <outcome value='false'> <block> <set> <parameter name="tmp.subnetUpdate" value="1" /> </set> </block> </outcome> </switch> <switch test="`$tmp.AnAI.l3network.subnets.subnet[$k].dhcp-end == $preload-data.preload-network-topology-information.subnets[$n].dhcp-end-address`"> <outcome value='false'> <block> <set> <parameter name="tmp.subnetUpdate" value="1" /> </set> </block> </outcome> </switch> <switch test="`$tmp.AnAI.l3network.subnets.subnet[$k].subnet-name == $preload-data.preload-network-topology-information.subnets[$n].subnet-name`"> <outcome value='false'> <block> <set> <parameter name="tmp.subnetUpdate" value="1" /> </set> </block> </outcome> </switch> <switch test="`$tmp.AnAI.l3network.subnets.subnet[$k].subnet-role == $preload-data.preload-network-topology-information.subnets[$n].subnet-role`"> <outcome value='false'> <block> <set> <parameter name="tmp.subnetUpdate" value="1" /> </set> </block> </outcome> </switch> <switch test="`$tmp.subnetUpdate == 1`"> <outcome value='true'> <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="subnet" key="l3-network.network-id = $tmp.AnAI.l3network.network-id AND subnet.subnet-id = $tmp.AnAI.l3network.subnets.subnet[$k].subnet-id" > <!-- Update l3network.subnet --> <parameter name="gateway-address" value="`$tmp.gateway-address`"/> <parameter name="subnet-name" value="`$preload-data.preload-network-topology-information.subnets[$n].subnet-name`"/> <parameter name="cidr-mask" value="`$preload-data.preload-network-topology-information.subnets[$n].cidr-mask`"/> <parameter name="dhcp-start" value="`$preload-data.preload-network-topology-information.subnets[$n].dhcp-start-address`"/> <parameter name="dhcp-end" value="`$preload-data.preload-network-topology-information.subnets[$n].dhcp-end-address`"/> <parameter name="dhcp-enabled" value="`$tmp.dhcpEnabled.boolean`"/> <parameter name="ip-assignment-direction" value="`$tmp.addrFromStart.boolean`" /> <parameter name="orchestration-status" value="PendingUpdate" /> <outcome value='failure'> <block> <set> <parameter name='k' value='`$tmp.AnAI.l3network.subnets.subnet_length + 1`' /> <parameter name='n' value='`$preload-data.preload-network-topology-information.subnets_length + 1`' /> </set> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while updating subnet attributes in AnAI with subnet-id = ' + $tmp.AnAI.l3network.subnets.subnet[$k].subnet-id`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='not-found'> <block> <set> <parameter name='k' value='`$tmp.AnAI.l3network.subnets.subnet_length + 1`' /> <parameter name='n' value='`$preload-data.preload-network-topology-information.subnets_length + 1`' /> </set> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while updating subnet attributes in AnAI with subnet-id = ' + $tmp.AnAI.l3network.subnets.subnet[$k].subnet-id`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='success'> <block> <set> <parameter name="tmp.subnetRollback[$x].subnet-id" value= "`$tmp.AnAI.l3network.subnets.subnet[$k].subnet-id`"/> <parameter name="tmp.subnetRollback[$x].type" value = "update"/> </set> <set> <parameter name="x" value = "`$x + 1`" /> </set> <set> <parameter name="tmp.l3networkUpdate" value="1" /> </set> </block> </outcome> </update> </outcome> </switch> </block> </outcome> </switch> </for> <switch test="`$execute_failure`"> <outcome value='false'> <switch test="`$tmp.start-address-match == 0`"> <outcome value='true'> <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="subnet" key="l3-network.network-id = $tmp.AnAI.l3network.network-id AND subnet.subnet-id = $tmp.AnAI.l3network.subnets.subnet[$k].subnet-id" > <parameter name="orchestration-status" value="PendingDelete" /> <outcome value='failure'> <block> <set> <parameter name='k' value='`$tmp.AnAI.l3network.subnets.subnet_length + 1`' /> <parameter name='n' value='`$preload-data.preload-network-topology-information.subnets_length + 1`' /> </set> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while updating subnet status to PendingDelete in AnAI with subnet-id = ' + $tmp.AnAI.l3network.subnets.subnet[$k].subnet-id`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='not-found'> <block> <set> <parameter name='k' value='`$tmp.AnAI.l3network.subnets.subnet_length + 1`' /> <parameter name='n' value='`$preload-data.preload-network-topology-information.subnets_length + 1`' /> </set> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while updating subnet status to PendingDelete in AnAI with subnet-id = ' + $tmp.AnAI.l3network.subnets.subnet[$k].subnet-id`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='success'> <block> <set> <parameter name="tmp.subnetRollback[$x].subnet-id" value= "`$tmp.AnAI.l3network.subnets.subnet[$k].subnet-id`"/> <parameter name="tmp.subnetRollback[$x].orchestration-status" value= "`$tmp.AnAI.l3network.subnets.subnet[$k].orchestration-status`" /> <parameter name="tmp.subnetRollback[$x].type" value = "delete" /> </set> <set> <parameter name="x" value = "`$x + 1`" /> </set> <set> <parameter name="tmp.l3networkUpdate" value="1" /> </set> </block> </outcome> </update> </outcome> </switch> </outcome> </switch> </block> </block> </for> <switch test="`$execute_failure`"> <outcome value='false'> <for index="i" start="0" end="`$preload-data.preload-network-topology-information.subnets_length`"> <block atomic='true'> <set> <parameter name="tmp.start-address-match" value="0" /> </set> <block atomic='true'> <for index="j" start="0" end="`$tmp.AnAI.l3network.subnets.subnet_length`"> <switch test="`$preload-data.preload-network-topology-information.subnets[$i].start-address == $tmp.AnAI.l3network.subnets.subnet[$j].network-start-address`"> <outcome value='true'> <set> <parameter name='tmp.start-address-match' value='1' /> </set> </outcome> </switch> </for> <switch test="`$tmp.start-address-match == 0`"> <outcome value='true'> <block atomic="true"> <switch test="`$preload-data.preload-network-topology-information.subnets[$i].dhcp-enabled`"> <outcome value='N'> <set> <parameter name="tmp.dhcpEnabled.boolean" value="false" /> </set> </outcome> <outcome value='Y'> <set> <parameter name="tmp.dhcpEnabled.boolean" value="true" /> </set> </outcome> </switch> <switch test="`$preload-data.preload-network-topology-information.subnets[$n].addr-from-start`"> <outcome value='N'> <set> <parameter name="tmp.addrFromStart.boolean" value="false" /> </set> </outcome> <outcome value='Y'> <set> <parameter name="tmp.addrFromStart.boolean" value="true" /> </set> </outcome> <outcome value=''> <set> <parameter name="tmp.addrFromStart.boolean" value="true" /> </set> </outcome> </switch> <set> <parameter name='tmp.gateway-address' value='`$preload-data.preload-network-topology-information.subnets[$i].gateway-address`' /> </set> <switch test="`$preload-data.preload-network-topology-information.subnets[$i].gateway-address`"> <outcome value=''> <block> <execute plugin="com.att.sdnctl.sli.plugin.ipAddressTools.IpAddressTool" method="getGatewayAddress"> <parameter name="ipAddress" value="`$preload-data.preload-network-topology-information.subnets[$i].start-address`" /> <parameter name="ipVersion" value="`$preload-data.preload-network-topology-information.subnets[$i].ip-version`" /> <parameter name="subnet" value="`$preload-data.preload-network-topology-information.subnets[$i].cidr-mask`" /> <parameter name="ctxVariable" value="tmp.return.generate.gateway-address" /> </execute> <set> <parameter name="tmp.gateway-address" value="`$tmp.return.generate.gateway-address`" /> </set> </block> </outcome> </switch> <set> <parameter name="tmp.local.network-id" value="`$tmp.AnAI.l3network.network-id`" /> </set> <call module="VNF-API" rpc="generate-subnets-subnet-id" mode="sync" > <outcome value='failure'> <block> <set> <parameter name='j' value='`$tmp.AnAI.l3subnet_length + 1`' /> <parameter name='i' value='`$preload-data.preload-network-topology-information.subnets_length + 1`' /> </set> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while saving new subnet in AnAI with subnet-id = ' + $tmp.return.generate-subnets-subnet-id.uuid`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> </call> <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="subnet" key="l3-network.network-id = $tmp.AnAI.l3network.network-id AND subnet.subnet-id = $tmp.return.generate-subnets-subnet-id.uuid" > <!-- Create l3-network object --> <parameter name="network-id" value="`$tmp.AnAI.l3network.network-id`" /> <parameter name="subnet-id" value="`$tmp.return.generate-subnets-subnet-id.uuid`" /> <parameter name="gateway-address" value="`$tmp.gateway-address`" /> <parameter name="subnet-name" value="`$preload-data.preload-network-topology-information.subnets[$i].subnet-name`" /> <parameter name="network-start-address" value="`$preload-data.preload-network-topology-information.subnets[$i].start-address`" /> <parameter name="cidr-mask" value="`$preload-data.preload-network-topology-information.subnets[$i].cidr-mask`" /> <parameter name="ip-version" value="`$preload-data.preload-network-topology-information.subnets[$i].ip-version`" /> <parameter name="dhcp-start" value="`$preload-data.preload-network-topology-information.subnets[$i].dhcp-start-address`" /> <parameter name="dhcp-end" value="`$preload-data.preload-network-topology-information.subnets[$i].dhcp-end-address`" /> <parameter name="dhcp-enabled" value="`$tmp.dhcpEnabled.boolean`" /> <parameter name="ip-assignment-direction" value="`$tmp.addrFromStart.boolean`" /> <parameter name="orchestration-status" value="PendingCreate" /> <outcome value='failure'> <block> <set> <parameter name='j' value='`$tmp.AnAI.l3subnet_length + 1`' /> <parameter name='i' value='`$preload-data.preload-network-topology-information.subnets_length + 1`' /> </set> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while saving new subnet in AnAI with subnet-id = ' + $tmp.return.generate-subnets-subnet-id.uuid`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='not-found'> <block> <set> <parameter name='j' value='`$tmp.AnAI.l3subnet_length + 1`' /> <parameter name='i' value='`$preload-data.preload-network-topology-information.subnets_length + 1`' /> </set> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while saving new subnet in AnAI with subnet-id = ' + $tmp.return.generate-subnets-subnet-id.uuid`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='success'> <block> <set> <parameter name="tmp.subnetRollback[$x].subnet-id" value= "`$tmp.return.generate-subnets-subnet-id.uuid`" /> <parameter name="tmp.subnetRollback[$x].type" value = "create" /> </set> <set> <parameter name="x" value = "`$x + 1`" /> </set> <set> <parameter name='tmp.l3networkUpdate' value='1' /> </set> <block> <set> <parameter name="tmp.local.subnet-id" value="`$tmp.AnAI.l3network.subnets.subnet[$j].subnet-id`" /> </set> <switch test='`$preload-data.preload-network-topology-information.subnets[$i].host-routes_length`'> <outcome value=''> <set> <parameter name='preload-data.preload-network-topology-information.subnets[$i].host-routes_length' value='0' /> </set> </outcome> </switch> <for index="h" start="0" end="`$preload-data.preload-network-topology-information.subnets[$i].host-routes_length`"> <block atomic='true'> <call module="VNF-API" rpc="generate-host-routes-host-route-id" mode="sync" > <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while saving host-route in AnAI where host-route-id = ' + $tmp.return.generate-host-routes-host-route-id.uuid`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> </call> <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="host-route" key="l3-network.network-id = $tmp.AnAI.l3network.network-id AND subnet.subnet-id = $tmp.local.subnet-id AND host-route.host-route-id = $tmp.return.generate-host-routes-host-route-id.uuid" > <!-- Create host-route object --> <parameter name="host-route-id" value="`$tmp.return.generate-host-routes-host-route-id.uuid`" /> <parameter name="route-prefix" value="`$preload-data.preload-network-topology-information.subnets[$i].host-routes[$h].route-prefix`" /> <parameter name="next-hop" value="`$preload-data.preload-network-topology-information.subnets[$i].host-routes[$h].next-hop`" /> <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while saving host-route in AnAI where host-route-id = ' + $tmp.return.generate-host-routes-host-route-id.uuid`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='not-found'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while saving host-route in AnAI where host-route-id = ' + $tmp.return.generate-host-routes-host-route-id.uuid`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> </save> </block> </for> </block> </block> </outcome> </save> </block> </outcome> </switch> </block> </block> </for> </outcome> </switch> <switch test="`$execute_failure`"> <outcome value='false'> <block atomic='true'> <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network:relationship-list" key="l3-network.network-id = $tmp.AnAI.l3network.network-id AND related-to = vpn-binding" > <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="An error occurred while deleting l3-network vpn-binding relationship from AnAI"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> </delete> <switch test="`$execute_failure`"> <outcome value='false'> <block atomic='true'> <switch test="`$preload-data.preload-network-topology-information.vpn-bindings_length`"> <outcome value=''> <set> <parameter name="preload-data.preload-network-topology-information.vpn-bindings_length" value="0" /> </set> </outcome> </switch> <for index="i" start="0" end="`$preload-data.preload-network-topology-information.vpn-bindings_length`"> <block atomic='true'> <set> <parameter name="tmp.vpn-binding-id" value="" /> </set> <switch test="`$preload-data.preload-network-topology-information.vpn-bindings[$i].vpn-binding-id`"> <outcome value='Other'> <set> <parameter name="tmp.vpn-binding-id" value="`$preload-data.preload-network-topology-information.vpn-bindings[$i].vpn-binding-id`" /> </set> </outcome> </switch> <switch test="`$preload-data.preload-network-topology-information.vpn-bindings[$i].global-route-target != ''`" > <outcome value='true'> <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="vpn-binding" key="vpn-binding.global-route-target = $preload-data.preload-network-topology-information.vpn-bindings[$i].global-route-target" pfx="tmp.AnAI.vpn-binding"> <outcome value='not-found'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'Failed to query vpn-bindings n AnAI where global-route-target = ' + $preload-data.preload-network-topology-information.vpn-bindings[$i].global-route-target`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'Failed to query vpn-bindings n AnAI where global-route-target = ' + $preload-data.preload-network-topology-information.vpn-bindings[$i].global-route-target`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='success'> <set> <parameter name="tmp.vpn-binding-id" value="`$tmp.AnAI.vpn-binding.vpn-id`" /> </set> </outcome> </get-resource> </outcome> </switch> <switch test="`$execute_failure`"> <outcome value='false'> <switch test="`$tmp.vpn-binding-id != ''`"> <outcome value='true'> <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network:relationship-list" key="l3-network.network-id = $tmp.AnAI.l3network.network-id" > <parameter name="relationship-list.relationship[0].related-to" value="vpn-binding" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="vpn-binding.vpn-id" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$tmp.vpn-binding-id`" /> <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while saving l3-newtork vpn-binding relationship in AnAI where vpn-id = ' + $tmp.vpn-binding-id`"/> </set> <set> <parameter name="i" value = "`$preload-data.preload-network-topology-information.vpn-bindings_length + 1`" /> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='not-found'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while saving l3-newtork vpn-binding relationship in AnAI where vpn-id = ' + $tmp.vpn-binding-id`"/> </set> <set> <parameter name="i" value = "`$preload-data.preload-network-topology-information.vpn-bindings_length + 1`" /> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='success'> <set> <parameter name='tmp.vpn-binding.updated' value='1' /> </set> </outcome> </save> </outcome> </switch> </outcome> </switch> </block> </for> </block> </outcome> </switch> </block> </outcome> </switch> <switch test="`$execute_failure`"> <outcome value='false'> <block atomic='true'> <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network:relationship-list" key="l3-network.network-id = $tmp.AnAI.l3network.network-id AND related-to = network-policy" > <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="An error occurred while deleting l3-network network-policy relationship from AnAI in preparation to regenerate the network-policy relationship from PRELOAD."/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> </delete> <switch test="`$execute_failure`"> <outcome value='false'> <block atomic='true'> <switch test="`$preload-data.preload-network-topology-information.network-policy_length`"> <outcome value=''> <set> <parameter name='preload-data.preload-network-topology-information.network-policy_length' value='0' /> </set> </outcome> </switch> <for index="i" start="0" end="`$preload-data.preload-network-topology-information.network-policy_length`"> <switch test="`$preload-data.preload-network-topology-information.network-policy[$i].network-policy-fqdn != NULL`"> <outcome value='true'> <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="network-policy" key="network-policy.network-policy-fqdn = $preload-data.preload-network-topology-information.network-policy[$i].network-policy-fqdn" pfx="tmp.AnAI.network-policy" > <outcome value='not-found'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'Failed to query network-policy n AnAI where network-policy-fqdn = ' + $preload-data.preload-network-topology-information.network-policy[$i].network-policy-fqdn`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'Failed to query network-policy n AnAI where network-policy-fqdn = ' + $preload-data.preload-network-topology-information.network-policy[$i].network-policy-fqdn`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='success'> <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network:relationship-list" key="l3-network.network-id = $tmp.AnAI.l3network.network-id" > <parameter name="relationship-list.relationship[0].related-to" value="network-policy" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="network-policy.network-policy-id" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$tmp.AnAI.network-policy.network-policy-id`" /> <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while saving l3-newtork network-policy relationship in AnAI where network-policy-id = ' + $tmp.AnAI.network-policy.network-policy-id`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='not-found'></outcome> <outcome value='success'> <set> <parameter name='tmp.network-policy.updated' value='1' /> </set> </outcome> </save> </outcome> </get-resource> </outcome> </switch> </for> </block> </outcome> </switch> </block> </outcome> </switch> <switch test="`$execute_failure`"> <outcome value='false'> <block atomic='true'> <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network:relationship-list" key="l3-network.network-id = $tmp.AnAI.l3network.network-id AND related-to = route-table-reference" > <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="An error occurred while deleting l3-network route-table-reference relationship from AnAI prior to regenerate the route-table-reference relationship from PRELOAD."/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> </delete> <switch test="`$execute_failure`"> <outcome value='false'> <block atomic='true'> <switch test="`$preload-data.preload-network-topology-information.route-table-reference_length`"> <outcome value=''> <set> <parameter name='preload-data.preload-network-topology-information.route-table-reference_length' value='0' /> </set> </outcome> </switch> <for index="i" start="0" end="`$preload-data.preload-network-topology-information.route-table-reference_length`"> <switch test="`$preload-data.preload-network-topology-information.route-table-reference[$i].route-table-reference-fqdn != NULL`"> <outcome value='true'> <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="route-table-reference" key="route-table-reference.route-table-reference-fqdn = $preload-data.preload-network-topology-information.route-table-reference[$i].route-table-reference-fqdn" pfx="tmp.AnAI.route-table-reference"> <outcome value='not-found'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'Failed to query network-policy n AnAI where network-policy-fqdn = ' + $preload-data.preload-network-topology-information.network-policy[$i].network-policy-fqdn`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'Failed to query network-policy n AnAI where network-policy-fqdn = ' + $preload-data.preload-network-topology-information.network-policy[$i].network-policy-fqdn`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='success'> <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network:relationship-list" key="l3-network.network-id = $tmp.AnAI.l3network.network-id" > <parameter name="relationship-list.relationship[0].related-to" value="route-table-reference" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="route-table-reference.route-table-reference-id" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$tmp.AnAI.route-table-reference.route-table-reference-id`" /> <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="`'An error occurred while saving l3-newtork route-table-reference relationship in AnAI where route-table-reference-id = ' + $tmp.AnAI.route-table-reference.route-table-reference-id`"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='not-found'></outcome> <outcome value='success'> <set> <parameter name='tmp.route-table-reference.updated' value='1' /> </set> </outcome> </save> </outcome> </get-resource> </outcome> </switch> </for> </block> </outcome> </switch> </block> </outcome> </switch> <switch test="`$execute_failure`"> <outcome value='false'> <switch test="`$tmp.l3networkUpdate == 1`"> <outcome value='true'> <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network" key="l3-network.network-id = $tmp.AnAI.l3network.network-id" > <parameter name="orchestration-status" value="PendingUpdate" /> <outcome value='failure'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="An error occurred while updating l3-network.orchestration-status in AnAI"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='not-found'> <block> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.error-message" value="An error occurred while updating l3-network.orchestration-status in AnAI"/> </set> <return status='success'> <parameter name='execute_failure' value='true' /> </return> </block> </outcome> <outcome value='success'> <set> <parameter name='tmp.l3network.status.updated' value='1' /> </set> </outcome> </update> </outcome> </switch> </outcome> </switch> <switch test="`$execute_failure`"> <outcome value="true"> <block atomic='true'> <set> <parameter name='ROLLBACK_START' value='NETWORK_TOPOLOGY_CHANGEASSIGN' /> </set> <for index="z" start="0" end="`$tmp.AnAI.l3network.relationship-list.relationship_length`"> <switch test="`$tmp.AnAI.l3network.relationship-list.relationship[$z].related-to`"> <outcome value='vpn-binding'> <switch test="`$tmp.vpn-binding.updated == 1`"> <outcome value='true'> <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network:relationship-list" key="l3-network.network-id = $tmp.AnAI.l3network.network-id" > <parameter name="relationship-list.relationship[0].related-to" value="vpn-binding" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="vpn-binding.vpn-id" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$tmp.AnAI.l3network.relationship-list.relationship[$z].relationship-data[0].relationship-value`" /> <outcome value='failure'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'An error occurred during rollback of l3-newtork vpn-binding relationship in AnAI where vpn-id = ' + $tmp.AnAI.l3network.relationship-list.relationship[$z].relationship-data[0].relationship-value + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> <outcome value='not-found'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'An error occurred during rollback of l3-newtork vpn-binding relationship in AnAI where vpn-id = ' + $tmp.AnAI.l3network.relationship-list.relationship[$z].relationship-data[0].relationship-value + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> </save> </outcome> </switch> </outcome> <outcome value='network-policy'> <switch test="`$tmp.network-policy.updated == 1`"> <outcome value='true'> <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network:relationship-list" key="l3-network.network-id = $tmp.AnAI.l3network.network-id" > <parameter name="relationship-list.relationship[0].related-to" value="network-policy" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="network-policy.network-policy-id" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$tmp.AnAI.l3network.relationship-list.relationship[$z].relationship-data[0].relationship-value`" /> <outcome value='failure'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'An error occurred during rollback of l3-newtork network-policy relationship in AnAI where network-policy-id = ' + $tmp.AnAI.l3network.relationship-list.relationship[$z].relationship-data[0].relationship-value + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> <outcome value='not-found'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'An error occurred during rollback of l3-newtork network-policy relationship in AnAI where network-policy-id = ' + $tmp.AnAI.l3network.relationship-list.relationship[$z].relationship-data[0].relationship-value + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> </save> </outcome> </switch> </outcome> <outcome value='route-table-reference'> <switch test="`$tmp.route-table-reference.updated == 1`"> <outcome value='true'> <save plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network:relationship-list" key="l3-network.network-id = $tmp.AnAI.l3network.network-id" > <parameter name="relationship-list.relationship[0].related-to" value="route-table-reference" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-key" value="route-table-reference.route-table-reference-id" /> <parameter name="relationship-list.relationship[0].relationship-data[0].relationship-value" value="`$tmp.AnAI.l3network.relationship-list.relationship[$z].relationship-data[0].relationship-value`" /> <outcome value='failure'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'An error occurred during rollback of l3-newtork route-table-reference relationship in AnAI where route-table-reference-id = ' + $tmp.AnAI.l3network.relationship-list.relationship[$z].relationship-data[0].relationship-value + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> <outcome value='not-found'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'An error occurred during rollback of l3-newtork route-table-reference relationship in AnAI where route-table-reference-id = ' + $tmp.AnAI.l3network.relationship-list.relationship[$z].relationship-data[0].relationship-value + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> </save> </outcome> </switch> </outcome> </switch> </for> <for index="j" start="0" end="`$x`"> <block atomic='true'> <set> <parameter name="tmp.rollback.match" value="0"/> </set> <for index="i" start="0" end="`$tmp.AnAI.l3network.subnets.subnet_length`"> <switch test="`$tmp.AnAI.l3network.subnets.subnet[$i].subnet-id == $tmp.subnetRollback[$j].subnet-id`"> <outcome value='true'> <block atomic='true'> <switch test="`$tmp.subnetRollback[$j].type`"> <outcome value='delete'> <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="subnet" key="l3-network.network-id = $tmp.AnAI.l3network.network-id AND subnet.subnet-id = $tmp.subnetRollback[$j].subnet-id" > <parameter name="orchestration-status" value="`$tmp.AnAI.l3network.subnets.subnet[$i].orchestration-status`" /> <outcome value='not-found'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'failed to rollback the subnet.orchestration-status in AnAI where subnet-id = ' + $tmp.AnAI.l3network.subnets.subnet[$i].subnet-id + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> <outcome value='failure'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'failed to rollback the subnet.orchestration-status in AnAI where subnet-id = ' + $tmp.AnAI.l3network.subnets.subnet[$i].subnet-id + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> </update> </outcome> <outcome value='update'> <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="subnet" key="l3-network.network-id = $tmp.AnAI.l3network.network-id AND subnet.subnet-id = $tmp.AnAI.l3network.subnets.subnet[$j].subnet-id" > <parameter name="subnet-name" value="`$tmp.AnAI.l3network.subnets.subnet[$i].subnet-name`"/> <parameter name="gateway-address" value="`$tmp.AnAI.l3network.subnets.subnet[$i].gateway-address`"/> <parameter name="cidr-mask" value="`$tmp.AnAI.l3network.subnets.subnet[$i].cidr-mask`"/> <parameter name="dhcp-start" value="`$tmp.AnAI.l3network.subnets.subnet[$i].dhcp-start`"/> <parameter name="dhcp-end" value="`$tmp.AnAI.l3network.subnets.subnet[$i].dhcp-end`"/> <parameter name="dhcp-enabled" value="`$tmp.AnAI.l3network.subnets.subnet[$i].dhcp-enabled`"/> <parameter name="orchestration-status" value="`$tmp.AnAI.l3network.subnets.subnet[$i].orchestration-status`" /> <outcome value='failure'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'failed to rollback the subnet attributes update in AnAI where subnet-id = ' + $tmp.AnAI.l3network.subnets.subnet[$i].subnet-id + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> <outcome value='not-found'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'failed to rollback the subnet attributes update in AnAI where subnet-id = ' + $tmp.AnAI.l3network.subnets.subnet[$i].subnet-id + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> </update> </outcome> </switch> <set> <parameter name="tmp.rollback.match" value="1"/> </set> </block> </outcome> </switch> </for> <switch test="`$tmp.rollback.match == 0`"> <outcome value='true'> <switch test="`$tmp.subnetRollback[$j].type`"> <outcome value='create'> <delete plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="subnet" key="l3-network.network-id = $tmp.AnAI.l3network.network-id AND subnet.subnet-id = $tmp.subnetRollback[$j].subnet-id" > <outcome value='failure'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'failed to rollback to delete subnet from AnAI where subnet-id = ' + $tmp.subnetRollback[$j].subnet-id + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> <outcome value='not-found'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'failed to rollback to delete subnet from AnAI where subnet-id = ' + $tmp.subnetRollback[$j].subnet-id + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> </delete> </outcome> </switch> </outcome> </switch> </block> </for> <switch test="`$tmp.l3network.status.updated == 1`"> <outcome value='true'> <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" resource="l3-network" key="l3-network.network-id = $tmp.AnAI.l3network.network-id" > <parameter name="orchestration-status" value="`$tmp.AnAI.l3network.orchestration-status`" /> <outcome value='failure'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'failed to rollback l3network.orchestration-status in AnAI where subnet-id = ' + $tmp.AnAI.l3network.subnets.subnet[$i].subnet-id + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> <outcome value='not-found'> <set> <parameter name="error-code" value="500"/> <parameter name="tmp.rollback.error-message" value="`'failed to rollback l3network.orchestration-status in AnAI where subnet-id = ' + $tmp.AnAI.l3network.subnets.subnet[$i].subnet-id + ' MANUAL ROLLBACK IS REQUIRED.'`"/> </set> </outcome> </update> </outcome> </switch> <return status='failure'> <parameter name='error-code' value='500'/> <parameter name='error-message' value="`'Error updating l3-network in AnAI with network-id = ' + $tmp.AnAI.l3network.network-id + ' - ' + $tmp.error-message + ' - ' + $tmp.rollback.error-message`"/> </return> </block> </outcome> </switch> <set> <parameter name="ack-final" value="Y"/> </set> <return status="success"> <parameter name="networkId" value="`$network-topology-operation-input.network-request-information.network-id`" /> <parameter name="error-code" value="200" /> </return> </block> </method> </service-logic>