2 * ============LICENSE_START=======================================================
\r
4 * ================================================================================
\r
5 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
\r
6 * ================================================================================
\r
7 * Licensed under the Apache License, Version 2.0 (the "License");
\r
8 * you may not use this file except in compliance with the License.
\r
9 * You may obtain a copy of the License at
\r
11 * http://www.apache.org/licenses/LICENSE-2.0
\r
13 * Unless required by applicable law or agreed to in writing, software
\r
14 * distributed under the License is distributed on an "AS IS" BASIS,
\r
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\r
16 * See the License for the specific language governing permissions and
\r
17 * limitations under the License.
\r
18 * ============LICENSE_END=========================================================
\r
21 package org.openecomp.mso.bpmn.infrastructure;
\r
23 import static com.github.tomakehurst.wiremock.client.WireMock.aResponse;
\r
24 import static com.github.tomakehurst.wiremock.client.WireMock.containing;
\r
25 import static com.github.tomakehurst.wiremock.client.WireMock.delete;
\r
26 import static com.github.tomakehurst.wiremock.client.WireMock.get;
\r
27 import static com.github.tomakehurst.wiremock.client.WireMock.post;
\r
28 import static com.github.tomakehurst.wiremock.client.WireMock.put;
\r
29 import static com.github.tomakehurst.wiremock.client.WireMock.stubFor;
\r
30 import static com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo;
\r
31 import static com.github.tomakehurst.wiremock.client.WireMock.urlMatching;
\r
32 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockPatchVfModuleId;
\r
33 import static org.openecomp.mso.bpmn.mock.StubResponseAAI.MockVNFAdapterRestVfModule;
\r
34 import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.mockUpdateRequestDB;
\r
35 import static org.openecomp.mso.bpmn.mock.StubResponseVNFAdapter.mockVNFDelete;
\r
37 import java.io.IOException;
\r
38 import java.util.HashMap;
\r
39 import java.util.Map;
\r
40 import java.util.UUID;
\r
42 import org.camunda.bpm.engine.test.Deployment;
\r
43 import org.junit.Ignore;
\r
44 import org.junit.Test;
\r
45 import org.openecomp.mso.bpmn.common.WorkflowTest;
\r
46 import org.openecomp.mso.bpmn.common.workflow.service.WorkflowResponse;
\r
47 import org.openecomp.mso.bpmn.core.WorkflowException;
\r
48 import org.openecomp.mso.bpmn.mock.FileUtil;
\r
50 import com.github.tomakehurst.wiremock.client.WireMock;
\r
52 * Unit test for DoDeleteVfModule.bpmn.
\r
54 public class DeleteVfModuleInfraTest extends WorkflowTest {
\r
55 private final CallbackSet callbacks = new CallbackSet();
\r
57 private static final String EOL = "\n";
\r
59 private final String vnfAdapterDeleteCallback =
\r
60 "<deleteVfModuleResponse>" + EOL +
\r
61 " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
\r
62 " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
\r
63 " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
\r
64 " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
\r
65 "</deleteVfModuleResponse>" + EOL;
\r
67 //private final String vnfAdapterDeleteCallback =
\r
68 // "<deleteVfModuleResponse>" + EOL +
\r
69 // " <vnfId>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnfId>" + EOL +
\r
70 // " <vfModuleId>973ed047-d251-4fb9-bf1a-65b8949e0a73</vfModuleId>" + EOL +
\r
71 // " <vfModuleDeleted>true</vfModuleDeleted>" + EOL +
\r
72 // " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
\r
73 // " <vfModuleOutputs>" + EOL +
\r
74 // " <entry>" + EOL +
\r
75 // " <key>policyKey1_contrail_network_policy_fqdn</key>" + EOL +
\r
76 // " <value>MSOTest:DefaultPolicyFQDN1</value>" + EOL +
\r
77 // "</entry>" + EOL +
\r
78 // "<entry>" + EOL +
\r
79 // "<key>policyKey2_contrail_network_policy_fqdn</key>" + EOL +
\r
80 // "<value>MSOTest:DefaultPolicyFQDN2</value>" + EOL +
\r
81 // "</entry>" + EOL +
\r
82 // " <entry>" + EOL +
\r
83 // " <key>oam_management_v4_address</key>" + EOL +
\r
84 // " <value>1234</value>" + EOL +
\r
85 // "</entry>" + EOL +
\r
86 // " <entry>" + EOL +
\r
87 // " <key>oam_management_v6_address</key>" + EOL +
\r
88 // " <value>1234</value>" + EOL +
\r
89 // "</entry>" + EOL +
\r
90 // "</vfModuleOutputs>" + EOL +
\r
91 // "</deleteVfModuleResponse>" + EOL;
\r
93 private final String vnfAdapterDeleteCallbackFail =
\r
94 "<vfModuleException>" + EOL +
\r
95 " <message>Error processing request to VNF-Async. Not Found.</message>" + EOL +
\r
96 " <category>INTERNAL</category>" + EOL +
\r
97 " <rolledBack>false</rolledBack>" + EOL +
\r
98 " <messageId>{{MESSAGE-ID}}</messageId>" + EOL +
\r
99 "</vfModuleException>" + EOL;
\r
101 private final String sdncAdapterDeleteCallback =
\r
102 "<output xmlns=\"org:onap:sdnctl:l3api\">" + EOL +
\r
103 " <svc-request-id>{{REQUEST-ID}}</svc-request-id>" + EOL +
\r
104 " <ack-final-indicator>Y</ack-final-indicator>" + EOL +
\r
107 public DeleteVfModuleInfraTest() throws IOException {
\r
108 callbacks.put("sdncChangeDelete", sdncAdapterDeleteCallback);
\r
109 callbacks.put("sdncDelete", sdncAdapterDeleteCallback);
\r
110 callbacks.put("vnfDelete", FileUtil.readResourceFile(
\r
111 "__files/DeleteVfModuleCallbackResponse.xml"));
\r
112 //callbacks.put("vnfDelete", vnfAdapterDeleteCallback);
\r
113 callbacks.put("vnfDeleteFail", vnfAdapterDeleteCallbackFail);
\r
117 @Ignore // 1802 merge
\r
118 @Deployment(resources = {
\r
119 "process/DeleteVfModuleInfra.bpmn",
\r
120 "subprocess/DoDeleteVfModule.bpmn",
\r
121 "subprocess/PrepareUpdateAAIVfModule.bpmn",
\r
122 "subprocess/UpdateAAIVfModule.bpmn",
\r
123 "subprocess/UpdateAAIGenericVnf.bpmn",
\r
124 "subprocess/DeleteAAIVfModule.bpmn",
\r
125 "subprocess/SDNCAdapterV1.bpmn",
\r
126 "subprocess/VnfAdapterRestV1.bpmn",
\r
127 "subprocess/CompleteMsoProcess.bpmn",
\r
128 "subprocess/FalloutHandler.bpmn"
\r
131 public void TestDeleteVfModuleSuccess() throws Exception {
\r
132 // delete the Base Module
\r
133 // vnf-id=a27ce5a9-29c4-4c22-a017-6615ac73c721, vf-module-id=973ed047-d251-4fb9-bf1a-65b8949e0a73
\r
135 "<vnf-request xmlns=\"http://openecomp.org/mso/infra/vnf-request/v1\">" + EOL +
\r
136 " <request-info>" + EOL +
\r
137 " <request-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</request-id>" + EOL +
\r
138 " <action>DELETE_VF_MODULE</action>" + EOL +
\r
139 " <source>PORTAL</source>" + EOL +
\r
140 " </request-info>" + EOL +
\r
141 " <vnf-inputs>" + EOL +
\r
142 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
\r
143 " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
\r
144 " <vnf-type>asc_heat-int</vnf-type>" + EOL +
\r
145 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
\r
146 " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
\r
147 " <service-id>00000000-0000-0000-0000-000000000000</service-id>" + EOL +
\r
148 " <service-type>SDN-ETHERNET-INTERNET</service-type>" + EOL +
\r
149 " <tenant-id>fba1bd1e195a404cacb9ce17a9b2b421</tenant-id>" + EOL +
\r
150 " <orchestration-status>pending-delete</orchestration-status>" + EOL +
\r
151 " <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>" + EOL +
\r
152 " </vnf-inputs>" + EOL +
\r
153 " <vnf-params xmlns:tns=\"http://openecomp.org/mso/infra/vnf-request/v1\"/>" + EOL +
\r
154 "</vnf-request>" + EOL;
\r
158 stubFor(post(urlEqualTo("/SDNCAdapter"))
\r
159 .withRequestBody(containing("SvcAction>changedelete"))
\r
160 .willReturn(aResponse()
\r
162 .withHeader("Content-Type", "text/xml")
\r
163 .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
\r
164 stubFor(post(urlEqualTo("/SDNCAdapter"))
\r
165 .withRequestBody(containing("SvcAction>delete"))
\r
166 .willReturn(aResponse()
\r
168 .withHeader("Content-Type", "text/xml")
\r
169 .withBodyFile("DeleteGenericVNFV1/sdncAdapterResponse.xml")));
\r
171 //mockVNFDelete("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73", 202);
\r
172 MockDoDeleteVfModule_DeleteVNFSuccess();
\r
173 MockPatchVfModuleId("a27ce5a9-29c4-4c22-a017-6615ac73c721", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
\r
174 // MockVNFAdapterRestVfModule();
\r
175 // MockAAIGenericVnfSearch();
\r
176 // MockAAIVfModulePUT(false);
\r
177 // MockAAIDeleteGenericVnf();
\r
178 // MockAAIDeleteVfModule();
\r
179 mockUpdateRequestDB(200, "VfModularity/DBUpdateResponse.xml");
\r
181 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73/[?]resource-version=0000073"))
\r
182 .willReturn(aResponse()
\r
183 .withStatus(200)));
\r
184 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a75/[?]resource-version=0000075"))
\r
185 .willReturn(aResponse()
\r
186 .withStatus(200)));
\r
187 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a78/[?]resource-version=0000078"))
\r
188 .willReturn(aResponse()
\r
189 .withStatus(200)));
\r
190 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a77/[?]resource-version=0000077"))
\r
191 .willReturn(aResponse()
\r
193 .withHeader("Content-Type", "text/xml")
\r
194 .withBodyFile("aaiFault.xml")));
\r
195 stubFor(get(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy\\?network-policy-fqdn=.*"))
\r
196 .willReturn(aResponse()
\r
198 .withHeader("Content-Type", "text/xml")
\r
199 .withBodyFile("VfModularity/QueryNetworkPolicy_AAIResponse_Success.xml")));
\r
201 stubFor(delete(urlMatching("/aai/v[0-9]+/network/network-policies/network-policy/.*"))
\r
202 .willReturn(aResponse()
\r
203 .withStatus(200)));
\r
206 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/[?]resource-version=0000021"))
\r
207 .willReturn(aResponse()
\r
208 .withStatus(200)));
\r
209 stubFor(delete(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718/[?]resource-version=0000018"))
\r
210 .willReturn(aResponse()
\r
212 .withHeader("Content-Type", "text/xml")
\r
213 .withBodyFile("aaiFault.xml")));
\r
215 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
\r
216 .withRequestBody(containing("MMSC"))
\r
217 .willReturn(aResponse()
\r
218 .withStatus(200)));
\r
219 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/.*/vf-modules/vf-module/.*"))
\r
220 .withRequestBody(containing("PCRF"))
\r
221 .willReturn(aResponse()
\r
223 .withHeader("Content-Type", "text/xml")
\r
224 .withBodyFile("aaiFault.xml")));
\r
225 stubFor(put(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721"))
\r
226 .willReturn(aResponse()
\r
227 .withStatus(200)));
\r
231 // The following stubs are for CreateAAIVfModule and UpdateAAIVfModule
\r
233 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC23&depth=1"))
\r
234 .willReturn(aResponse()
\r
236 .withHeader("Content-Type", "text/xml")
\r
237 .withBodyFile("aaiFault.xml")));
\r
239 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC22&depth=1"))
\r
240 .willReturn(aResponse()
\r
242 .withHeader("Content-Type", "text/xml")
\r
243 .withBody("Generic VNF Not Found")));
\r
244 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/768073c7-f41f-4822-9323-b75962763d74[?]depth=1"))
\r
245 .willReturn(aResponse()
\r
247 .withHeader("Content-Type", "text/xml")
\r
248 .withBody("Generic VNF Not Found")));
\r
251 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
\r
252 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
\r
253 " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
\r
254 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
\r
255 " <service-id>SDN-MOBILITY</service-id>" + EOL +
\r
256 " <equipment-role>vMMSC</equipment-role>" + EOL +
\r
257 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
258 " <in-maint>false</in-maint>" + EOL +
\r
259 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
\r
260 " <resource-version>1508691</resource-version>" + EOL +
\r
261 " <vf-modules>" + EOL +
\r
262 " <vf-module>" + EOL +
\r
263 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
\r
264 " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
\r
265 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
\r
266 " <persona-model-version>1.0</persona-model-version>" + EOL +
\r
267 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
\r
268 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
\r
269 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
270 " <resource-version>1508692</resource-version>" + EOL +
\r
271 " </vf-module>" + EOL +
\r
272 " </vf-modules>" + EOL +
\r
273 " <relationship-list/>" + EOL +
\r
274 " <l-interfaces/>" + EOL +
\r
275 " <lag-interfaces/>" + EOL +
\r
276 "</generic-vnf>" + EOL;
\r
277 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC21&depth=1"))
\r
278 .willReturn(aResponse()
\r
280 .withHeader("Content-Type", "text/xml")
\r
282 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
\r
283 .willReturn(aResponse()
\r
285 .withHeader("Content-Type", "text/xml")
\r
289 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
\r
290 " <vnf-id>2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4</vnf-id>" + EOL +
\r
291 " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
\r
292 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
\r
293 " <service-id>SDN-MOBILITY</service-id>" + EOL +
\r
294 " <equipment-role>vMMSC</equipment-role>" + EOL +
\r
295 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
296 " <in-maint>false</in-maint>" + EOL +
\r
297 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
\r
298 " <resource-version>1508691</resource-version>" + EOL +
\r
299 " <vf-modules>" + EOL +
\r
300 " <vf-module>" + EOL +
\r
301 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
\r
302 " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
\r
303 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
\r
304 " <persona-model-version>1.0</persona-model-version>" + EOL +
\r
305 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
\r
306 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
\r
307 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
308 " <resource-version>1508692</resource-version>" + EOL +
\r
309 " </vf-module>" + EOL +
\r
310 " <vf-module>" + EOL +
\r
311 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
\r
312 " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
\r
313 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
\r
314 " <persona-model-version>1.0</persona-model-version>" + EOL +
\r
315 " <is-base-vf-module>false</is-base-vf-module>" + EOL +
\r
316 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
\r
317 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
318 " <resource-version>1508692</resource-version>" + EOL +
\r
319 " </vf-module>" + EOL +
\r
320 " </vf-modules>" + EOL +
\r
321 " <relationship-list/>" + EOL +
\r
322 " <l-interfaces/>" + EOL +
\r
323 " <lag-interfaces/>" + EOL +
\r
324 "</generic-vnf>" + EOL;
\r
325 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/[?]vnf-name=STMTN5MMSC20&depth=1"))
\r
326 .willReturn(aResponse()
\r
328 .withHeader("Content-Type", "text/xml")
\r
330 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/2f6aee38-1e2a-11e6-82d1-ffc7d9ee8aa4[?]depth=1"))
\r
331 .willReturn(aResponse()
\r
333 .withHeader("Content-Type", "text/xml")
\r
336 // The following stubs are for DeleteAAIVfModule
\r
338 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c723[?]depth=1"))
\r
339 .willReturn(aResponse()
\r
341 .withHeader("Content-Type", "text/xml")
\r
342 .withBodyFile("aaiFault.xml")));
\r
344 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c722[?]depth=1"))
\r
345 .willReturn(aResponse()
\r
347 .withHeader("Content-Type", "text/xml")
\r
348 .withBody("Generic VNF Not Found")));
\r
351 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
\r
352 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
\r
353 " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
\r
354 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
\r
355 " <service-id>SDN-MOBILITY</service-id>" + EOL +
\r
356 " <equipment-role>vMMSC</equipment-role>" + EOL +
\r
357 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
358 " <in-maint>false</in-maint>" + EOL +
\r
359 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
\r
360 " <resource-version>0000021</resource-version>" + EOL +
\r
361 " <vf-modules>" + EOL +
\r
362 " <vf-module>" + EOL +
\r
363 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
\r
364 " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
\r
365 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
\r
366 " <persona-model-version>1.0</persona-model-version>" + EOL +
\r
367 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
\r
368 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
\r
369 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
370 " <resource-version>0000073</resource-version>" + EOL +
\r
371 " </vf-module>" + EOL +
\r
372 " </vf-modules>" + EOL +
\r
373 " <relationship-list/>" + EOL +
\r
374 " <l-interfaces/>" + EOL +
\r
375 " <lag-interfaces/>" + EOL +
\r
376 "</generic-vnf>" + EOL;
\r
377 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721[?]depth=1"))
\r
378 .willReturn(aResponse()
\r
380 .withHeader("Content-Type", "text/xml")
\r
384 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
\r
385 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c720</vnf-id>" + EOL +
\r
386 " <vnf-name>STMTN5MMSC20</vnf-name>" + EOL +
\r
387 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
\r
388 " <service-id>SDN-MOBILITY</service-id>" + EOL +
\r
389 " <equipment-role>vMMSC</equipment-role>" + EOL +
\r
390 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
391 " <in-maint>false</in-maint>" + EOL +
\r
392 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
\r
393 " <resource-version>0000020</resource-version>" + EOL +
\r
394 " <vf-modules>" + EOL +
\r
395 " <vf-module>" + EOL +
\r
396 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</vf-module-id>" + EOL +
\r
397 " <vf-module-name>STMTN5MMSC20-MMSC::module-0-0</vf-module-name>" + EOL +
\r
398 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a74</persona-model-id>" + EOL +
\r
399 " <persona-model-version>1.0</persona-model-version>" + EOL +
\r
400 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
\r
401 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
\r
402 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
403 " <resource-version>0000074</resource-version>" + EOL +
\r
404 " </vf-module>" + EOL +
\r
405 " <vf-module>" + EOL +
\r
406 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</vf-module-id>" + EOL +
\r
407 " <vf-module-name>STMTN5MMSC20-MMSC::module-1-0</vf-module-name>" + EOL +
\r
408 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a75</persona-model-id>" + EOL +
\r
409 " <persona-model-version>1.0</persona-model-version>" + EOL +
\r
410 " <is-base-vf-module>false</is-base-vf-module>" + EOL +
\r
411 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
\r
412 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
413 " <resource-version>0000075</resource-version>" + EOL +
\r
414 " </vf-module>" + EOL +
\r
415 " </vf-modules>" + EOL +
\r
416 " <relationship-list/>" + EOL +
\r
417 " <l-interfaces/>" + EOL +
\r
418 " <lag-interfaces/>" + EOL +
\r
419 "</generic-vnf>" + EOL;
\r
420 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c720[?]depth=1"))
\r
421 .willReturn(aResponse()
\r
423 .withHeader("Content-Type", "text/xml")
\r
427 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
\r
428 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c719</vnf-id>" + EOL +
\r
429 " <vnf-name>STMTN5MMSC19</vnf-name>" + EOL +
\r
430 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
\r
431 " <service-id>SDN-MOBILITY</service-id>" + EOL +
\r
432 " <equipment-role>vMMSC</equipment-role>" + EOL +
\r
433 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
434 " <in-maint>false</in-maint>" + EOL +
\r
435 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
\r
436 " <resource-version>0000019</resource-version>" + EOL +
\r
437 " <vf-modules>" + EOL +
\r
438 " <vf-module>" + EOL +
\r
439 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</vf-module-id>" + EOL +
\r
440 " <vf-module-name>STMTN5MMSC19-MMSC::module-0-0</vf-module-name>" + EOL +
\r
441 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a76</persona-model-id>" + EOL +
\r
442 " <persona-model-version>1.0</persona-model-version>" + EOL +
\r
443 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
\r
444 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
\r
445 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
446 " <resource-version>0000076</resource-version>" + EOL +
\r
447 " </vf-module>" + EOL +
\r
448 " <vf-module>" + EOL +
\r
449 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</vf-module-id>" + EOL +
\r
450 " <vf-module-name>STMTN5MMSC19-MMSC::module-1-0</vf-module-name>" + EOL +
\r
451 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a77</persona-model-id>" + EOL +
\r
452 " <persona-model-version>1.0</persona-model-version>" + EOL +
\r
453 " <is-base-vf-module>false</is-base-vf-module>" + EOL +
\r
454 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
\r
455 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
456 " <resource-version>0000077</resource-version>" + EOL +
\r
457 " </vf-module>" + EOL +
\r
458 " </vf-modules>" + EOL +
\r
459 " <relationship-list/>" + EOL +
\r
460 " <l-interfaces/>" + EOL +
\r
461 " <lag-interfaces/>" + EOL +
\r
462 "</generic-vnf>" + EOL;
\r
463 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c719[?]depth=1"))
\r
464 .willReturn(aResponse()
\r
466 .withHeader("Content-Type", "text/xml")
\r
470 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
\r
471 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c718</vnf-id>" + EOL +
\r
472 " <vnf-name>STMTN5MMSC18</vnf-name>" + EOL +
\r
473 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
\r
474 " <service-id>SDN-MOBILITY</service-id>" + EOL +
\r
475 " <equipment-role>vMMSC</equipment-role>" + EOL +
\r
476 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
477 " <in-maint>false</in-maint>" + EOL +
\r
478 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
\r
479 " <resource-version>0000018</resource-version>" + EOL +
\r
480 " <vf-modules>" + EOL +
\r
481 " <vf-module>" + EOL +
\r
482 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</vf-module-id>" + EOL +
\r
483 " <vf-module-name>STMTN5MMSC18-MMSC::module-0-0</vf-module-name>" + EOL +
\r
484 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a78</persona-model-id>" + EOL +
\r
485 " <persona-model-version>1.0</persona-model-version>" + EOL +
\r
486 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
\r
487 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
\r
488 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
489 " <resource-version>0000078</resource-version>" + EOL +
\r
490 " </vf-module>" + EOL +
\r
491 " </vf-modules>" + EOL +
\r
492 " <relationship-list/>" + EOL +
\r
493 " <l-interfaces/>" + EOL +
\r
494 " <lag-interfaces/>" + EOL +
\r
495 "</generic-vnf>" + EOL;
\r
496 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c718[?]depth=1"))
\r
497 .willReturn(aResponse()
\r
499 .withHeader("Content-Type", "text/xml")
\r
503 "<generic-vnf xmlns=\"http://org.openecomp.aai.inventory/v7\">" + EOL +
\r
504 " <vnf-id>a27ce5a9-29c4-4c22-a017-6615ac73c721</vnf-id>" + EOL +
\r
505 " <vnf-name>STMTN5MMSC21</vnf-name>" + EOL +
\r
506 " <vnf-type>mmsc-capacity</vnf-type>" + EOL +
\r
507 " <service-id>SDN-MOBILITY</service-id>" + EOL +
\r
508 " <equipment-role>vMMSC</equipment-role>" + EOL +
\r
509 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
510 " <in-maint>false</in-maint>" + EOL +
\r
511 " <is-closed-loop-disabled>false</is-closed-loop-disabled>" + EOL +
\r
512 " <resource-version>0000021</resource-version>" + EOL +
\r
513 " <vf-modules>" + EOL +
\r
514 " <vf-module>" + EOL +
\r
515 " <vf-module-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</vf-module-id>" + EOL +
\r
516 " <vf-module-name>STMTN5MMSC21-MMSC::module-0-0</vf-module-name>" + EOL +
\r
517 " <persona-model-id>973ed047-d251-4fb9-bf1a-65b8949e0a73</persona-model-id>" + EOL +
\r
518 " <persona-model-version>1.0</persona-model-version>" + EOL +
\r
519 " <is-base-vf-module>true</is-base-vf-module>" + EOL +
\r
520 " <heat-stack-id>FILLED-IN-BY-MSO</heat-stack-id>" + EOL +
\r
521 " <orchestration-status>pending-create</orchestration-status>" + EOL +
\r
522 " <resource-version>0000073</resource-version>" + EOL +
\r
523 " </vf-module>" + EOL +
\r
524 " </vf-modules>" + EOL +
\r
525 " <relationship-list/>" + EOL +
\r
526 " <l-interfaces/>" + EOL +
\r
527 " <lag-interfaces/>" + EOL +
\r
528 "</generic-vnf>" + EOL;
\r
529 stubFor(get(urlMatching("/aai/v[0-9]+/network/generic-vnfs/generic-vnf/a27ce5a9-29c4-4c22-a017-6615ac73c721/vf-modules/vf-module/973ed047-d251-4fb9-bf1a-65b8949e0a73"))
\r
530 .willReturn(aResponse()
\r
532 .withHeader("Content-Type", "text/xml")
\r
535 String businessKey = UUID.randomUUID().toString();
\r
536 String deleteVfModuleRequest =
\r
537 FileUtil.readResourceFile("__files/DeleteVfModule_VID_request.json");
\r
538 //Map<String, Object> variables = new HashMap<>();
\r
540 //variables.put("isDebugLogEnabled","true");
\r
541 // variables.put("mso-request-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
\r
542 // variables.put("mso-service-instance-id", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
\r
544 Map<String, Object> variables = setupVariablesSunnyDayVID();
\r
546 TestAsyncResponse asyncResponse = invokeAsyncProcess("DeleteVfModuleInfra",
\r
547 "v1", businessKey, deleteVfModuleRequest, variables);
\r
548 WorkflowResponse response = receiveResponse(businessKey, asyncResponse, 10000);
\r
549 String responseBody = response.getResponse();
\r
550 System.out.println("Workflow (Synch) Response:\n" + responseBody);
\r
552 // "changedelete" operation not required for deleting a Vf Module
\r
553 // injectSDNCCallbacks(callbacks, "sdncChangeDelete");
\r
554 injectVNFRestCallbacks(callbacks, "vnfDelete");
\r
555 waitForRunningProcessCount("vnfAdapterDeleteV1", 0, 120000);
\r
556 injectSDNCCallbacks(callbacks, "sdncDelete");
\r
558 waitForProcessEnd(businessKey, 10000);
\r
559 WorkflowException wfe = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
\r
560 checkVariable(businessKey, "DeleteVfModuleInfraSuccessIndicator", true);
\r
561 checkVariable(businessKey, "WorkflowException", null);
\r
563 System.out.println("TestDeleteVfModuleInfraSuccess: ErrorCode=" + wfe.getErrorCode() +
\r
564 ", ErrorMessage=" + wfe.getErrorMessage());
\r
570 private Map<String, Object> setupVariablesSunnyDayVID() {
\r
571 Map<String, Object> variables = new HashMap<>();
\r
573 // variables.put("bpmnRequest", FileUtil.readResourceFile("__files/CreateVfModule_VID_request.json"));
\r
575 //catch (Exception e) {
\r
578 //variables.put("mso-request-id", "testRequestId");
\r
579 variables.put("requestId", "testRequestId");
\r
580 variables.put("isBaseVfModule", "true");
\r
581 variables.put("isDebugLogEnabled", "true");
\r
582 variables.put("recipeTimeout", "0");
\r
583 variables.put("requestAction", "DELETE_VF_MODULE");
\r
584 variables.put("serviceInstanceId", "f70e927b-6087-4974-9ef8-c5e4d5847ca4");
\r
585 variables.put("vnfId", "a27ce5a9-29c4-4c22-a017-6615ac73c721");
\r
586 variables.put("vfModuleId", "973ed047-d251-4fb9-bf1a-65b8949e0a73");
\r
587 variables.put("volumeGroupId", "");
\r
588 variables.put("serviceType", "MOG");
\r
589 variables.put("vfModuleType", "");
\r
594 public static void MockDoDeleteVfModule_DeleteVNFSuccess() {
\r
595 stubFor(delete(urlMatching("/vnfs/v1/vnfs/.*/vf-modules/.*"))
\r
596 .willReturn(aResponse()
\r
598 .withHeader("Content-Type", "application/xml")));
\r
599 stubFor(delete(urlMatching("/vnfs/v1/volume-groups/78987"))
\r
600 .willReturn(aResponse()
\r
602 .withHeader("Content-Type", "application/xml")));
\r