summaryrefslogtreecommitdiffstats
path: root/platform-logic/generic-resource-api/src/main/xml/GENERIC-RESOURCE-API_wan-connection-topology-operation-deactivate.xml
blob: 592fb65d3cf855c7907b9717b646de1278b52372 (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
207
208
209
210
211
212
213
214
215
<?xml version="1.0" encoding="utf-8"?>

<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="wan-connection-topology-operation-deactivate" mode="sync"> 
    <block atomic="true">
      <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.network-provided-resource`"/>  
        <parameter name="outputPath" value="tmp.services-url"/>  
        <parameter name="target" value="{service-instance-id}"/>  
        <parameter name="replacement" value="`$network-topology-operation-input.service-information.service-id`"/> 
      </execute>
      <execute plugin="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" method="sendRequest"> 
        <parameter name="restapiUrl" value="`$prop.controller.url + $tmp.services-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="mdsal-psd"/>  
        <outcome value="success"> 
          <block></block>
        </outcome>
        <outcome value="Other"> 
          <return status="failure"> 
            <parameter name="ack-final" value="Y"/>  
            <parameter name="error-code" value="404"/>  
            <parameter name="error-message" value="Error: Parent service data not available"/> 
          </return>
        </outcome>
      </execute>
      <set> 
        <parameter name="tmp.found-network-input" value="false"/>
      </set>
      <for index="pidx" start="0" end="`$mdsal-psd.service-data.networks.network_length`"> 
        <switch test="`$mdsal-psd.service-data.networks.network[$pidx].network-id == $network-topology-operation-input.network-information.network-id`"> 
          <outcome value="true"> 
            <block atomic="true">
              <set> 
                <parameter name="tmp.pidx" value="`$pidx`"/>  
                <parameter name="tmp.network." value="`$mdsal-psd.service-data.networks.network[$pidx].`"/>  
                <parameter name="tmp.network-input-parameters" value="`$mdsal-psd.service-data.networks.network[$pidx].network-data.network-request-input.network-input-parameters`"/>  
                <parameter name="tmp.found-network-input" value="true"/>
              </set>
            </block>
          </outcome>
        </switch>
      </for>
      <switch test="`$found-network-input`"> 
        <outcome value="false"> 
          <return status="failure"> 
            <parameter name="ack-final" value="Y"/>  
            <parameter name="error-code" value="404"/>  
            <parameter name="error-message" value="Error: Network input parameters not found"/> 
          </return>
        </outcome>
        <outcome value="true"> 
          <block atomic="true">
            <set> 
              <parameter name="tmp.restapiUrl-found" value="false"/>  
              <parameter name="tmp.restapiUser-found" value="false"/>  
              <parameter name="tmp.restapiPassword-found" value="false"/>  
              <parameter name="tmp.thirdPartyAdaptorRpc-found" value="false"/>  
              <parameter name="tmp.actualId-found" value="false"/>
            </set>
            <for index="cidx" start="0" end="`$tmp.network.network-data.network-topology.network-parameters.network-parameter_length`"> 
              <block> 
                <switch test="`$tmp.network.network-data.network-topology.network-parameters.network-parameter[$cxid].network-parameter-name == 'restapiUrl-deactivate'`"> 
                  <outcome value="true"> 
                    <set> 
                      <parameter name="tmp.restapiUrl" value="`$tmp.network.network-data.network-topology.network-parameters.network-parameter[$cxid].network-parameter-value`"/>  
                      <parameter name="tmp.restapiUrl-found" value="true"/>
                    </set>
                  </outcome>
                </switch>
                <switch test="`$tmp.network.network-data.network-topology.network-parameters.network-parameter[$cxid].network-parameter-name == 'restapiUser'`"> 
                  <outcome value="true"> 
                    <set> 
                      <parameter name="tmp.restapiUser" value="`$tmp.network.network-data.network-topology.network-parameters.network-parameter[$cxid].network-parameter-value`"/>  
                      <parameter name="tmp.restapiUser-found" value="true"/>
                    </set>
                  </outcome>
                </switch>
                <switch test="`$tmp.network.network-data.network-topology.network-parameters.network-parameter[$cxid].network-parameter-name == 'restapiPassword'`"> 
                  <outcome value="true"> 
                    <set> 
                      <parameter name="tmp.restapiPassword" value="`$tmp.network.network-data.network-topology.network-parameters.network-parameter[$cxid].network-parameter-value`"/>  
                      <parameter name="tmp.restapiPassword-found" value="true"/>
                    </set>
                  </outcome>
                </switch>
                <switch test="`$tmp.network.network-data.network-topology.network-parameters.network-parameter[$cxid].network-parameter-name == 'actualId'`"> 
                  <outcome value="true"> 
                    <set> 
                      <parameter name="tmp.actualId" value="`$tmp.network.network-data.network-topology.network-parameters.network-parameter[$cxid].network-parameter-value`"/>  
                      <parameter name="tmp.actualId-found" value="true"/>
                    </set>
                  </outcome>
                </switch>
                <switch test="`$tmp.network.network-data.network-topology.network-parameters.network-parameter[$cxid].network-parameter-name == 'thirdPartyAdaptorRpc-deactivate'`"> 
                  <outcome value="true"> 
                    <set> 
                      <parameter name="tmp.thirdPartyAdaptorRpc" value="`$tmp.network.network-data.network-topology.network-parameters.network-parameter[$cxid].network-parameter-value`"/>  
                      <parameter name="tmp.thirdPartyAdaptorRpc-found" value="true"/>
                    </set>
                  </outcome>
                </switch>
              </block>
            </for>
            <switch test="`$tmp.thirdPartyAdaptorRpc-found == 'true'`"> 
              <outcome value="true"> 
                <call module="GENERIC-RESOURCE-API" rpc="`$tmp.thirdPartyAdaptorRpc`" mode="sync"> 
                  <outcome value="success"> 
                    <block></block>
                  </outcome>
                  <outcome value="failure"> 
                    <return status="failure"> 
                      <parameter name="ack-final" value="Y"/>  
                      <parameter name="error-code" value="500"/>  
                      <parameter name="error-message" value="`'Error calling ' + $tmp.thirdPartyAdaptorRpc`"/> 
                    </return>
                  </outcome>
                  <outcome value="not-found"> 
                    <return status="failure"> 
                      <parameter name="ack-final" value="Y"/>  
                      <parameter name="error-code" value="500"/>  
                      <parameter name="error-message" value="`'Error calling ' + $tmp.thirdPartyAdaptorRpc`"/> 
                    </return>
                  </outcome>
                </call>
              </outcome>
              <outcome value="false"> 
                <switch test="`$tmp.restapiUrl-found == 'true'`"> 
                  <outcome value="false"> 
                    <return status="failure"> 
                      <parameter name="ack-final" value="Y"/>  
                      <parameter name="error-code" value="404"/>  
                      <parameter name="error-message" value="Error: 3rd party controller restapiUrl not found"/> 
                    </return>
                  </outcome>
                  <outcome value="true"> 
                    <switch test="`$tmp.restapiUser-found == 'true'`"> 
                      <outcome value="false"> 
                        <return status="failure"> 
                          <parameter name="ack-final" value="Y"/>  
                          <parameter name="error-code" value="404"/>  
                          <parameter name="error-message" value="Error: 3rd party controller restapiUser not found"/> 
                        </return>
                      </outcome>
                      <outcome value="true"> 
                        <switch test="`$tmp.restapiPassword-found == 'true'`"> 
                          <outcome value="false"> 
                            <return status="failure"> 
                              <parameter name="ack-final" value="Y"/>  
                              <parameter name="error-code" value="404"/>  
                              <parameter name="error-message" value="Error: 3rd party controller restapiPassword not found"/> 
                            </return>
                          </outcome>
                          <outcome value="true"> 
                            <switch test="`$tmp.actualId-found == 'true'`"> 
                              <outcome value="false"> 
                                <return status="failure"> 
                                  <parameter name="ack-final" value="Y"/>  
                                  <parameter name="error-code" value="404"/>  
                                  <parameter name="error-message" value="Error: Wan Connection actualId not found"/> 
                                </return>
                              </outcome>
                              <outcome value="true"> 
                                <execute plugin="org.onap.ccsdk.sli.plugins.restapicall.RestapiCallNode" method="sendRequest"> 
                                  <parameter name="restapiUrl" value="`$tmp.restapiUrl + $tmp.actualId`"/>  
                                  <parameter name="restapiUser" value="`$tmp.restapiUser`"/>  
                                  <parameter name="restapiPassword" value="`$tmp.restapiPassword`"/>  
                                  <parameter name="format" value="json"/>  
                                  <parameter name="httpMethod" value="delete"/>
                                  <outcome value="success"> 
                                    <block></block>
                                  </outcome>
                                  <outcome value="failure"> 
                                    <return status="failure"> 
                                      <parameter name="ack-final" value="Y"/>  
                                      <parameter name="error-code" value="500"/>  
                                      <parameter name="error-message" value="`'Error calling ' + $tmp.restapiUrl`"/> 
                                    </return>
                                  </outcome>
                                  <outcome value="not-found"> 
                                    <return status="failure"> 
                                      <parameter name="ack-final" value="Y"/>  
                                      <parameter name="error-code" value="500"/>  
                                      <parameter name="error-message" value="`'Error calling ' + $tmp.restapiUrl`"/> 
                                    </return>
                                  </outcome>
                                </execute>
                              </outcome>
                            </switch>
                          </outcome>
                        </switch>
                      </outcome>
                    </switch>
                  </outcome>
                </switch>
              </outcome>
            </switch>
          </block>
        </outcome>
      </switch>
      <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>