summaryrefslogtreecommitdiffstats
path: root/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_aai-get-aic-zone.xml
blob: 5f174c6695dac577bdce99dd908deff977571f4a (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
<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='aai-get-aic-zone' mode='sync'>
        <block atomic="true">
            <set>
                <parameter name='aaiapi.output.cloud-zone' value='' />
                <parameter name='aaiapi.output.complex-name' value='' />
                <parameter name='aaiapi.output.aic-clli' value='' />
            </set>
            <switch test='`$aaiapi.input.cloud-owner`'>
                <outcome value=''>
                    <return status='failure'>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="Error aaiapi.input.network-instance-group-id is NULL" />
                    </return>
                </outcome>
            </switch>
            <switch test='`$aaiapi.input.cloud-region-id`'>
                <outcome value=''>
                    <return status='failure'>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="Error aaiapi.input.network-instance-group-id is NULL" />
                    </return>
                </outcome>
            </switch>
            <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" 
		resource="cloud-region" 
		key="cloud-region.cloud-owner = $aaiapi.input.cloud-owner AND 
		     cloud-region.cloud-region-id = $aaiapi.input.cloud-region-id AND 
		     depth = '0'"
        pfx='aai.cloud-region' local-only='false' >
                <outcome value='not-found'>
                    <block atomic='true'>
                        <set>
                            <parameter name="error-code" value="500"/>
                            <parameter name="tmp.error-message" value="Cloud region not found in AAI"/>
                        </set>
                        <return status='failure'>
                            <parameter name="error-code" value="500" />
                            <parameter name="error-message" value="`$tmp.error-message`" />
                        </return>
                    </block>
                </outcome>
                <outcome value='failure'>
                    <block atomic='true'>
                        <set>
                            <parameter name="error-code" value="500"/>
                            <parameter name="tmp.error-message" value="Error retrieving cloud region from AAI"/>
                        </set>
                        <return status='failure'>
                            <parameter name="error-code" value="500" />
                            <parameter name="error-message" value="`$tmp.error-message`" />
                        </return>
                    </block>
                </outcome>
            </get-resource>
            <switch test='`$aai.cloud-region.relationship-list.relationship_length`'>
                <outcome value='0'>
                    <block atomic='true'>
                        <set>
                            <parameter name="error-code" value="500"/>
                            <parameter name="tmp.error-message" value="Cloud region missing relationships in AAI"/>
                        </set>
                        <return status='failure'>
                            <parameter name="error-code" value="500" />
                            <parameter name="error-message" value="`$tmp.error-message`" />
                        </return>
                    </block>
                </outcome>
                <outcome value=''>
                    <block atomic='true'>
                        <set>
                            <parameter name="error-code" value="500"/>
                            <parameter name="tmp.error-message" value="Cloud region missing relationships in AAI"/>
                        </set>
                        <return status='failure'>
                            <parameter name="error-code" value="500" />
                            <parameter name="error-message" value="`$tmp.error-message`" />
                        </return>
                    </block>
                </outcome>
            </switch>
            <for silentFailure='false' index='ridx' start='0' end="`$aai.cloud-region.relationship-list.relationship_length`" >
                <for silentFailure='false' index='rdidx' start='0' end="`$aai.cloud-region.relationship-list.relationship[$ridx].relationship-data_length`" >
                    <switch test='`$aai.cloud-region.relationship-list.relationship[$ridx].relationship-data[$rdidx].relationship-key`'>
                        <outcome value='complex.physical-location-id'>
                            <block atomic="true">
                                <set>
                                    <parameter name='tmp.complex-found' value='true' />
                                </set>
                                <set>
                                    <parameter name='aaiapi.output.aic-clli' value='`$aai.complex.physical-location-id`' />
                                </set>
                                <get-resource plugin="org.onap.ccsdk.sli.adaptors.aai.AAIService" 
		resource="complex" 
		key="complex.physical-location-id = $aai.cloud-region.relationship-list.relationship[$ridx].relationship-data[$rdidx].relationship-value"
        pfx='aai.complex' local-only='false' ></get-resource>
                            </block>
                        </outcome>
                    </switch>
                </for>
            </for>
            <switch test='`$tmp.complex-found`'>
                <outcome value='false'>
                    <block atomic='true'>
                        <set>
                            <parameter name="error-code" value="500"/>
                            <parameter name="tmp.error-message" value="Complex not found in AAI"/>
                        </set>
                        <return status='failure'>
                            <parameter name="error-code" value="500" />
                            <parameter name="error-message" value="`$tmp.error-message`" />
                        </return>
                    </block>
                </outcome>
            </switch>
            <set>
                <parameter name='aaiapi.output.cloud-zone' value='`$aai.cloud-region.cloud-zone`' />
                <parameter name='aaiapi.output.complex-name' value='`$aai.cloud-region.complex-name`' />
            </set>
        </block>
    </method>
</service-logic>