summaryrefslogtreecommitdiffstats
path: root/ms/gra/gra-app/src/test/resources/svclogic/GENERIC-RESOURCE-API_get-complex-resource-service-model.xml
blob: 07a0486e4c8824d304fea8f5c11e534ab5f046fd (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
<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='get-complex-resource-service-model' mode='sync'>
        <block atomic="true">
            <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
  key='SELECT * from COMPLEX_RESOURCE 
  WHERE customization_uuid = $get-complex-resource-service-model-input.customization-uuid'
  pfx='db.complex-resource'>
                <outcome value='not-found'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="`'No complex resource found for customization UUID ' + $get-complex-resource-service-model-input.customization-uuid`" />
                    </return>
                </outcome>
                <outcome value='failure'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="`'No complex resource found for customization UUID ' + $get-complex-resource-service-model-input.customization-uuid`" />
                    </return>
                </outcome>
            </get-resource>
            <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
  key='SELECT * from ATTRIBUTE_VALUE_PAIR 
  WHERE resource_uuid = $db.complex-resource.uuid
  and resource_type = $db.complex-resource.type'
  pfx='db.av-pair'>
                <outcome value='not-found'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="`'No attribute found for customization UUID ' + $get-complex-resource-service-model-input.customization-uuid`" />
                    </return>
                </outcome>
                <outcome value='failure'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="`'No attribute found for customization UUID ' + $get-complex-resource-service-model-input.customization-uuid`" />
                    </return>
                </outcome>
                <outcome value='success'>
                    <for silentFailure='true' index='idx' start='0' end='`$db.av-pair_length`' >
                        <block atomic='true'>
                            <switch test="`$db.sdn-circuit-req[$idx].attribute-name == 'cr_function' `">
                                <outcome value='true'>
                                    <set>
                                        <parameter name='get-complex-resource-service-model-output.cr-function' value='`$db.sdn-circuit-req[$idx].attribute-value`' />
                                    </set>
                                </outcome>
                            </switch>
                            <switch test="`$db.sdn-circuit-req[$idx].attribute-name == 'cr_role'`">
                                <outcome value='true'>
                                    <set>
                                        <parameter name="get-complex-resource-service-model-output.cr-role" value="`$db.sdn-circuit-req[$idx].attribute-value`" />
                                    </set>
                                </outcome>
                            </switch>
                            <switch test="`$db.sdn-circuit-req[$idx].attribute-name == 'cr_type'`">
                                <outcome value='true'>
                                    <set>
                                        <parameter name="get-complex-resource-service-model-output.cr-type" value="`$db.sdn-circuit-req[$idx].attribute-value`" />
                                    </set>
                                </outcome>
                            </switch>
                            <switch test="`$db.sdn-circuit-req[$idx].attribute-name == 'network_collection_function'`">
                                <outcome value='true'>
                                    <set>
                                        <parameter name="get-complex-resource-service-model-output.network-collection-function" value="`$db.sdn-circuit-req[$idx].attribute-value`" />
                                    </set>
                                </outcome>
                            </switch>
                            <switch test="`$db.sdn-circuit-req[$idx].attribute-name == 'network_collection_description'`">
                                <outcome value='true'>
                                    <set>
                                        <parameter name="get-complex-resource-service-model-output.network-collection-description" value="`$db.sdn-circuit-req[$idx].attribute-value`" />
                                    </set>
                                </outcome>
                            </switch>
                            <switch test="`$db.sdn-circuit-req[$idx].attribute-name == 'subinterface_network_quantity'`">
                                <outcome value='true'>
                                    <set>
                                        <parameter name="get-complex-resource-service-model-output.subinterface-network-quantity" value="`$db.sdn-circuit-req[$idx].attribute-value`" />
                                    </set>
                                </outcome>
                            </switch>
                        </block>
                    </for>
                </outcome>
            </get-resource>
            <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
  key='SELECT * from NETWORK_MODEL 
  WHERE complex_resource_uuid = $db.complex-resource.uuid'
  pfx='db.network-model'>
                <outcome value='not-found'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="No network model found" />
                    </return>
                </outcome>
                <outcome value='failure'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="No network model found" />
                    </return>
                </outcome>
            </get-resource>
            <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
  key='SELECT * from RESOURCE_POLICY_TO_TARGET_NODE_MAPPING
  WHERE target_node_uuid = $db.network-model.uuid
  AND target_node_customization_uuid = db.network-model.customization-uuid'
  pfx='db.respoltargetnodemap' >
                <outcome value='not-found'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="No resource_policy_to_target_node_mapping found"  />
                    </return>
                </outcome>
                <outcome value='failure'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="No resource_policy_to_target_node_mapping found"  />
                    </return>
                </outcome>
            </get-resource>
            <get-resource plugin='org.onap.ccsdk.sli.adaptors.resource.sql.SqlResource' resource='SQL'
  key="SELECT * from RESOURCE_POLICY  
  WHERE policy_uuid = $db.respoltargetnodemap.policy_uuid
  and policy_type = 'ecomp.policies.External' "
  pfx='db.resource-policy'>
                <outcome value='not-found'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="`'No complex resource found for customization UUID ' + $get-complex-resource-service-model-input.customization-uuid`" />
                    </return>
                </outcome>
                <outcome value='failure'>
                    <return status='failure'>
                        <parameter name='ack-final' value='Y'/>
                        <parameter name="error-code" value="500" />
                        <parameter name="error-message" value="`'No complex resource found for customization UUID ' + $get-complex-resource-service-model-input.customization-uuid`" />
                    </return>
                </outcome>
                <outcome value='success'>
                    <for silentFailure='true' index='idx' start='0' end='`$db.resource-policy_length`' >
                        <block atomic='true'>
                            <switch test="`$db.resource-policy[$idx].property-type == 'Name' and $db.resource-policy[$idx].property-name == 'Network Collection Name'`">
                                <outcome value='true'>
                                    <set>
                                        <parameter name="get-complex-resource-service-model-output.network-naming-policy" value="`$db.resource-policy[$idx].policy-name`" />
                                    </set>
                                </outcome>
                            </switch>
                            <switch test="`$db.resource-policy[$idx].property-type == 'subnetwork assignments' and $db.resource-policy[$idx].property-name == 'subnet'`">
                                <outcome value='true'>
                                    <set>
                                        <parameter name="get-complex-resource-service-model-output.subnet-assignment-policy" value="`$db.resource-policy[$idx].policy-name`" />
                                    </set>
                                </outcome>
                            </switch>
                            <switch test="`$db.resource-policy[$idx].property-type == 'network assignments' and $db.resource-policy[$idx].property-name == 'route target'`">
                                <outcome value='true'>
                                    <set>
                                        <parameter name="get-complex-resource-service-model-output.vpn-binding-policy" value="`$db.resource-policy[$idx].policy-name`" />
                                    </set>
                                </outcome>
                            </switch>
                        </block>
                    </for>
                </outcome>
            </get-resource>
        </block>
    </method>
</service-logic>