summaryrefslogtreecommitdiffstats
path: root/ms/generic-resource-api/src/test/resources/svclogic/GENERIC-RESOURCE-API_network-topology-operation-activate.xml
blob: ed5130a3db9459248c758471ae89b7bfb1d7a2aa (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
<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-activate' mode='sync'>
        <block atomic="true">
            <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" 
	resource="l3-network" 
		key="l3-network.network-id = $network-topology-operation-input.network-information.network-id AND 
                     depth = 'all'" 
		local-only="false" 
		pfx="aai.l3-network">
                <outcome value='not-found'>
                    <return status='failure'>
                        <parameter name="error-code" value="404" />
                        <parameter name="error-message" value="network-id not found in AAI" />
                    </return>
                </outcome>
                <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>
            </get-resource>
            <switch test='`$aai.l3-network.subnets.subnet_length`'>
                <outcome value=''>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="no networks found" />
                    </return>
                </outcome>
                <outcome value='Other'>
                    <switch test='`$network-data.network-topology.network-topology-identifier-structure.network-instance-group-id`'>
                        <outcome value=''>
                            <switch test='`$service-data.networks.network[$nidx].network-data.network-information.from-preload`'>
                                <outcome value='true'>
                                    <block atomic="true">
                                        <for index='sidx' start='0' end='`$aai.l3-network.subnets.subnet_length`' >
                                            <block atomic="true">
                                                <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" 
	resource="subnet" 
		key="l3-network.network-id = $aai.l3-network.network-id 
			AND subnet.subnet-id = $aai.l3-network.subnets.subnet[$sidx].subnet-id" >
                                                    <parameter name="orchestration-status" value="Active" />
                                                    <outcome value='failure'>
                                                        <return status="failure">
                                                            <parameter name="error-code" value="500"/>
                                                            <parameter name="error-message" value="Failure updating orchestration-status in AAI for subnet." />
                                                        </return>
                                                    </outcome>
                                                    <outcome value="not-found">
                                                        <return status="failure">
                                                            <parameter name="error-code" value="500"/>
                                                            <parameter name="error-message" value="Failure updating orchestration-status in AAI for subnet.  Subnet not found." />
                                                        </return>
                                                    </outcome>
                                                </update>
                                            </block>
                                        </for>
                                    </block>
                                </outcome>
                                <outcome value='Other'>
                                    <block atomic="true">
                                        <for index='sidx' start='0' end='`$aai.l3-network.subnets.subnet_length`' >
                                            <block atomic="true">
                                                <get-resource
        plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource'
        resource='SQL'
        key="SELECT * from EIPAM_IP_SUBNETS where entity_id = $aai.l3-network.subnets.subnet[$sidx].subnet-id ; "
        pfx='tmp.eipam-subnet-row'>
                                                    <outcome value='failure'>
                                                        <return status="failure">
                                                            <parameter name="error-code" value="500"/>
                                                            <parameter name="error-message" value="Query to DB table EIPAM_IP_SUBNETS failed to find subnet matching aai subnet." />
                                                        </return>
                                                    </outcome>
                                                    <outcome value="not-found">
                                                        <return status="failure">
                                                            <parameter name="error-code" value="500"/>
                                                            <parameter name="error-message" value="Subnet not found in EIPAM_IP_SUBNETS - activate failed." />
                                                        </return>
                                                    </outcome>
                                                    <outcome value='success'>
                                                        <block atomic='true'>
                                                            <set>
                                                                <parameter name="eipam-ip-block.entity-id" value="`$aai.l3-network.subnets.subnet[$sidx].subnet-id`"/>
                                                                <parameter name="eipam-ip-block.plans[0].plan-name" value="`$tmp.eipam-subnet-row.plan-name`"/>
                                                            </set>
                                                            <!--subnet and subnet_keys are deleted in the EIPAMPlugin-->
                                                            <execute plugin="com.att.sdnctl.sli.plugin.eipam.EIPAMPlugin" method="activateSubnet">
                                                                <outcome value='failure'>
                                                                    <return status="failure">
                                                                        <parameter name="error-code" value="500"/>
                                                                        <parameter name="error-message" value="An error occured while activating subnet in EIPAM." />
                                                                    </return>
                                                                </outcome>
                                                            </execute>
                                                            <save 
	plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' 
	resource='SQL'
	key="UPDATE EIPAM_IP_SUBNETS
             SET status = 'ACTIVE'
             WHERE entity_id = $eipam-ip-block.entity-id ; "
    force='true'
        pfx='pfx.eipam-subnet-row'>
                                                                <outcome value='failure'>
                                                                    <return status="failure">
                                                                        <parameter name="error-code" value="500"/>
                                                                        <parameter name="error-message" value="An error occured while updating subnet to active in mysql." />
                                                                    </return>
                                                                </outcome>
                                                                <outcome value="not-found">
                                                                    <return status="failure">
                                                                        <parameter name="error-code" value="500"/>
                                                                        <parameter name="error-message" value="An error occured while updating subnet to active in mysql." />
                                                                    </return>
                                                                </outcome>
                                                                <outcome value='success'>
                                                                    <block atomic='true'>
                                                                        <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" 
	resource="subnet" 
		key="l3-network.network-id = $aai.l3-network.network-id 
			AND subnet.subnet-id = $eipam-ip-block.entity-id" >
                                                                            <parameter name="orchestration-status" value="Active" />
                                                                            <outcome value='failure'>
                                                                                <return status="failure">
                                                                                    <parameter name="error-code" value="500"/>
                                                                                    <parameter name="error-message" value="Failure updating orchestration-status in AAI for subnet." />
                                                                                </return>
                                                                            </outcome>
                                                                            <outcome value="not-found">
                                                                                <return status="failure">
                                                                                    <parameter name="error-code" value="500"/>
                                                                                    <parameter name="error-message" value="Failure updating orchestration-status in AAI for subnet.  Subnet not found." />
                                                                                </return>
                                                                            </outcome>
                                                                        </update>
                                                                    </block>
                                                                </outcome>
                                                            </save>
                                                        </block>
                                                    </outcome>
                                                </get-resource>
                                            </block>
                                        </for>
                                    </block>
                                </outcome>
                            </switch>
                        </outcome>
                        <outcome value='Other'>
                            <block atomic="true">
                                <return status='failure'>
                                    <parameter name='ack-final' value='Y'/>
                                    <parameter name="error-code" value="500" />
                                    <parameter name="error-message" value="network collection activate failed" />
                                </return>
                            </block>
                        </outcome>
                    </switch>
                </outcome>
            </switch>
            <update plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" 
	resource="l3-network" 
		key="l3-network.network-id = $aai.l3-network.network-id" >
                <parameter name="orchestration-status" value="Active" />
                <outcome value='failure'>
                    <return status="failure">
                        <parameter name="error-code" value="500"/>
                        <parameter name="error-message" value="Failure updating orchestration-status in AAI for l3-network" />
                    </return>
                </outcome>
                <outcome value="not-found">
                    <return status="failure">
                        <parameter name="error-code" value="500"/>
                        <parameter name="error-message" value="Failure updating orchestration-status in AAI for l3-network.  Network not found." />
                    </return>
                </outcome>
            </update>
            <set>
                <parameter name='service-data.networks.network[$nidx].network-data.sdnc-request-header.' value='`$network-topology-operation-input.sdnc-request-header.`' />
                <parameter name='service-data.networks.network[$nidx].network-data.request-information.' value='`$network-topology-operation-input.request-information.`' />
            </set>
            <set>
                <parameter name='networkId' value='`$network-topology-operation-input.network-information.network-id`' />
            </set>
            <set>
                <parameter name='network-object-path' value="`'restconf/config/GENERIC-RESOURCE-API:services/service/'
 + $network-topology-operation-input.service-information.service-instance-id
 + '/service-data/networks/network/'
 + $networkId
 + '/network-data/network-topology/'` " />
            </set>
            <set>
                <parameter name='service-data.networks.network[$tmp.nidx].network-data.network-level-oper-status.order-status' value='Created' />
                <parameter name='service-data.networks.network[$tmp.nidx].network-data.network-level-oper-status.last-rpc-action' value='`$network-topology-operation-input.sdnc-request-header.svc-action`' />
                <parameter name='service-data.networks.network[$tmp.nidx].network-data.network-level-oper-status.last-action' value='`$network-topology-operation-input.request-information.request-action`' />
            </set>
            <return status='success'>
                <parameter name="ack-final-indicator" value="Y" />
                <parameter name="error-code" value="200" />
                <parameter name="error-message" value="`$error-message`" />
            </return>
        </block>
    </method>
</service-logic>