Springboot 2.0 upgrade
[so.git] / bpmn / so-bpmn-infrastructure-common / src / test / groovy / org / onap / so / bpmn / infrastructure / scripts / DoDeleteNetworkInstanceTest.groovy
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.bpmn.infrastructure.scripts
22
23 import static org.mockito.Mockito.*
24 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion;
25 import static org.onap.so.bpmn.mock.StubResponseAAI.MockGetNetworkCloudRegion_404;
26 import static org.onap.so.bpmn.mock.StubResponseNetworkAdapter.MockNetworkAdapter;
27
28 import org.apache.commons.lang3.*
29 import org.camunda.bpm.engine.ProcessEngineServices
30 import org.camunda.bpm.engine.RepositoryService
31 import org.camunda.bpm.engine.delegate.DelegateExecution
32 import org.camunda.bpm.engine.impl.persistence.entity.ExecutionEntity
33 import org.camunda.bpm.engine.repository.ProcessDefinition
34 import org.junit.Before
35 import org.junit.Ignore
36 import org.junit.Rule
37 import org.junit.Test
38 import org.mockito.MockitoAnnotations
39 import org.onap.aai.domain.yang.L3Network
40 import org.onap.aai.domain.yang.Relationship
41 import org.onap.aai.domain.yang.RelationshipList
42 import org.onap.so.bpmn.common.scripts.MsoGroovyTest
43 import org.onap.so.bpmn.common.scripts.MsoUtils
44 import org.onap.so.bpmn.core.WorkflowException
45 import org.onap.so.client.aai.AAIObjectType
46 import org.onap.so.client.aai.entities.uri.AAIResourceUri
47 import org.onap.so.client.aai.entities.uri.AAIUriFactory
48 import org.onap.so.client.graphinventory.entities.uri.Depth
49 import org.onap.so.constants.Defaults
50
51 import com.github.tomakehurst.wiremock.client.WireMock
52 import com.github.tomakehurst.wiremock.junit.WireMockRule
53
54
55 class DoDeleteNetworkInstanceTest  extends  MsoGroovyTest{
56
57         @Rule
58         public WireMockRule wireMockRule = new WireMockRule(8090);
59
60                 def utils = new MsoUtils()
61                 String Prefix="DELNWKI_"
62
63                 String incomingJsonRequest =
64                 """{ "requestDetails": {
65               "modelInfo": {
66                         "modelType": "network",
67                         "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422",
68                         "modelName": "CONTRAIL_EXTERNAL",
69                         "modelVersion": "1.0"
70                   },
71                   "cloudConfiguration": {
72                         "lcpCloudRegionId": "RDM2WAGPLCP",
73                         "tenantId": "7dd5365547234ee8937416c65507d266"
74                   },
75                   "requestInfo": {
76                         "instanceName": "HSL_direct_net_2",
77                         "source": "VID",
78                         "callbackUrl": "",
79             "suppressRollback": true,
80             "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
81                   },
82                   "relatedInstanceList": [
83                         {
84                         "relatedInstance": {
85                                 "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4",
86                                 "modelInfo": {
87                                         "modelType": "serviceT",
88                                         "modelId": "modelI",
89                                         "modelNameVersionId": "modelNameVersionI",
90                                         "modelName": "modleNam",
91                                         "modelVersion": "1"
92                                 }
93                         }
94                 }
95                   ],
96                   "requestParameters": {
97                         "userParams": []
98                   }
99   }"""
100
101   String expectedDoDeleteNetworkInstanceRequest =
102   """{ "requestDetails": {
103               "modelInfo": {
104                         "modelType": "networkTyp",
105                         "modelId": "modelId",
106                         "modelNameVersionId": "modelNameVersionId",
107                         "modelName": "CONTRAIL_EXTERNAL",
108                         "modelVersion": "1"
109                   },
110                   "cloudConfiguration": {
111                         "lcpCloudRegionId": "RDM2WAGPLCP",
112                         "tenantId": "7dd5365547234ee8937416c65507d266"
113                   },
114                   "requestInfo": {
115                         "instanceName": "HSL_direct_net_2",
116                         "source": "VID",
117                         "callbackUrl": "",
118             "suppressRollback": true,
119             "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
120                   },
121                   "relatedInstanceList": [
122                         {
123                         "relatedInstance": {
124                                 "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4",
125                                 "modelInfo": {
126                                         "modelType": "serviceT",
127                                         "modelId": "modelI",
128                                         "modelNameVersionId": "modelNameVersionI",
129                                         "modelName": "modleNam",
130                                         "modelVersion": "1"
131                                 }
132                         }
133                 }
134                   ],
135                   "requestParameters": {
136                         "userParams": []
137                   }
138   }"""
139
140     // expectedVnfRequest
141         String expectedNetworkRequest =
142 """<network-request xmlns="http://www.w3.org/2001/XMLSchema">
143    <request-info>
144       <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
145       <action>DELETE</action>
146       <source>VID</source>
147       <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
148    </request-info>
149    <network-inputs>
150       <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
151       <network-name>HSL_direct_net_2</network-name>
152       <network-type>CONTRAIL_EXTERNAL</network-type>
153       <modelCustomizationId>f21df226-8093-48c3-be7e-0408fcda0422</modelCustomizationId>
154       <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
155       <tenant-id>7dd5365547234ee8937416c65507d266</tenant-id>
156       <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
157       <backout-on-failure>false</backout-on-failure>
158       <sdncVersion>1610</sdncVersion>
159    </network-inputs>
160    <network-params/>
161 </network-request>"""
162
163         String expectedVperNetworkRequest =
164 """<network-request xmlns="http://www.w3.org/2001/XMLSchema">
165    <request-info>
166       <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
167       <action>DELETE</action>
168       <source>VID</source>
169       <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
170    </request-info>
171    <network-inputs>
172       <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
173       <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
174       <network-type>CONTRAIL_EXTERNAL</network-type>
175       <subscription-service-type>MSO-dev-service-type</subscription-service-type>
176       <global-customer-id>globalId_45678905678</global-customer-id>
177       <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
178       <tenant-id>7dd5365547234ee8937416c65507d266</tenant-id>
179       <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
180       <backout-on-failure>false</backout-on-failure>
181       <failIfExist>false</failIfExist>
182       <networkModelInfo>
183          <modelName>CONTRAIL_EXTERNAL</modelName>
184          <modelUuid>sn5256d1-5a33-55df-13ab-12abad84e111</modelUuid>
185          <modelInvariantUuid>sn5256d1-5a33-55df-13ab-12abad84e764</modelInvariantUuid>
186          <modelVersion>1</modelVersion>
187          <modelCustomizationUuid>sn5256d1-5a33-55df-13ab-12abad84e222</modelCustomizationUuid>
188       </networkModelInfo>
189       <serviceModelInfo>
190          <modelName/>
191          <modelUuid/>
192          <modelInvariantUuid/>
193          <modelVersion/>
194          <modelCustomizationUuid/>
195       </serviceModelInfo>
196       <sdncVersion>1702</sdncVersion>
197    </network-inputs>
198    <network-params/>
199 </network-request>"""    
200
201         String expected_networkInput =
202         """<network-inputs xmlns="http://www.w3.org/2001/XMLSchema">
203    <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
204    <network-name>HSL_direct_net_2</network-name>
205    <network-type>CONTRAIL_EXTERNAL</network-type>
206    <modelCustomizationId>f21df226-8093-48c3-be7e-0408fcda0422</modelCustomizationId>
207    <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
208    <tenant-id>7dd5365547234ee8937416c65507d266</tenant-id>
209    <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
210    <backout-on-failure>false</backout-on-failure>
211    <sdncVersion>1610</sdncVersion>
212 </network-inputs>"""
213
214         String expectedVper_networkInput = 
215 """<network-inputs xmlns="http://www.w3.org/2001/XMLSchema">
216    <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
217    <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
218    <network-type>CONTRAIL_EXTERNAL</network-type>
219    <subscription-service-type>MSO-dev-service-type</subscription-service-type>
220    <global-customer-id>globalId_45678905678</global-customer-id>
221    <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
222    <tenant-id>7dd5365547234ee8937416c65507d266</tenant-id>
223    <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
224    <backout-on-failure>false</backout-on-failure>
225    <failIfExist>false</failIfExist>
226    <networkModelInfo>
227       <modelName>CONTRAIL_EXTERNAL</modelName>
228       <modelUuid>sn5256d1-5a33-55df-13ab-12abad84e111</modelUuid>
229       <modelInvariantUuid>sn5256d1-5a33-55df-13ab-12abad84e764</modelInvariantUuid>
230       <modelVersion>1</modelVersion>
231       <modelCustomizationUuid>sn5256d1-5a33-55df-13ab-12abad84e222</modelCustomizationUuid>
232    </networkModelInfo>
233    <serviceModelInfo>
234       <modelName/>
235       <modelUuid/>
236       <modelInvariantUuid/>
237       <modelVersion/>
238       <modelCustomizationUuid/>
239    </serviceModelInfo>
240    <sdncVersion>1702</sdncVersion>
241 </network-inputs>"""    
242
243 // emptyRegionVnfRequest
244 String emptyRegionVnfRequest =
245 """<network-request xmlns="http://org.onap/so/infra/vnf-request/v1">
246    <request-info>
247       <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
248       <action>DELETE</action>
249       <source>PORTAL</source>
250    </request-info>
251    <network-inputs>
252       <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
253       <network-name>HSL_direct_net_2</network-name>
254       <network-type>CONTRAIL_BASIC</network-type>
255       <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
256       <aic-cloud-region/>
257       <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id>
258    </network-inputs>
259    <network-params>
260       <param name="shared">0</param>
261    </network-params>
262 </network-request>"""
263
264 String vnfRequestCloudRegionNotFound =
265 """<network-request xmlns="http://org.onap/so/infra/vnf-request/v1">
266    <request-info>
267       <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
268       <action>DELETE</action>
269       <source>PORTAL</source>
270    </request-info>
271    <network-inputs>
272       <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
273       <network-name>HSL_direct_net_2</network-name>
274       <network-type>CONTRAIL_BASIC</network-type>
275       <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
276       <aic-cloud-region>MDTWNJ21</aic-cloud-region>
277       <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id>
278    </network-inputs>
279    <network-params>
280       <param name="shared">0</param>
281    </network-params>
282 </network-request>"""
283
284                 String vnfPayload =
285         """<rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
286               contentType="text/xml">
287    <network-request xmlns="http://org.onap/so/infra/vnf-request/v1">
288       <request-info>
289          <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
290          <action>DELETE</action>
291          <source>PORTAL</source>
292       </request-info>
293       <network-inputs>
294          <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
295          <network-name>HSL_direct_net_2</network-name>
296          <network-type>CONTRAIL_BASIC</network-type>
297          <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
298          <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
299          <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id>
300       </network-inputs>
301       <network-params>
302          <param name="shared">0</param>
303       </network-params>
304    </network-request>
305 </rest:payload>"""
306
307         String vnfPayload_MissingId =
308 """<rest:payload xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
309               contentType="text/xml">
310    <network-request xmlns="http://org.onap/so/infra/vnf-request/v1">
311       <request-info>
312          <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
313          <action>DELETE</action>
314          <source>PORTAL</source>
315       </request-info>
316       <network-inputs>
317          <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
318          <network-name/>
319          <network-type>CONTRAIL_BASIC</network-type>
320          <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
321          <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
322          <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id>
323       </network-inputs>
324       <network-params>
325          <param name="shared">0</param>
326       </network-params>
327    </network-request>
328 </rest:payload>"""
329
330                 String vnfRequestRESTPayload =
331 """<network-request xmlns="http://org.onap/so/infra/vnf-request/v1">
332       <request-info>
333          <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
334          <action>DELETE</action>
335          <source>PORTAL</source>
336       </request-info>
337       <network-inputs>
338          <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
339          <network-name>HSL_direct_net_2</network-name>
340          <network-type>CONTRAIL_BASIC</network-type>
341          <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
342          <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
343          <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id>
344       </network-inputs>
345       <network-outputs>
346          <network-id>id</network-id>
347          <network-name>name</network-name>
348       </network-outputs>
349       <network-params>
350          <param name="shared">0</param>
351       </network-params>
352   </network-request>"""
353
354
355 String incomingRequestMissingCloudRegion =
356 """{ "requestDetails": {
357               "modelInfo": {
358                         "modelType": "network",
359                         "modelCustomizationId": "f21df226-8093-48c3-be7e-0408fcda0422",
360                         "modelName": "CONTRAIL_EXTERNAL",
361                         "modelVersion": "1.0"
362                   },
363                   "cloudConfiguration": {
364                         "tenantId": "7dd5365547234ee8937416c65507d266"
365                   },
366                   "requestInfo": {
367                         "instanceName": "HSL_direct_net_2",
368                         "source": "VID",
369                         "callbackUrl": "",
370             "suppressRollback": true,
371             "productFamilyId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb"
372                   },
373                   "relatedInstanceList": [
374                         {
375                         "relatedInstance": {
376                                 "instanceId": "f70e927b-6087-4974-9ef8-c5e4d5847ca4",
377                                 "modelInfo": {
378                                         "modelType": "serviceT",
379                                         "modelId": "modelI",
380                                         "modelNameVersionId": "modelNameVersionI",
381                                         "modelName": "modleNam",
382                                         "modelVersion": "1"
383                                 }
384                         }
385                 }
386                   ],
387                   "requestParameters": {
388                         "userParams": []
389                   }
390   }"""
391
392         String expectedNetworkRequestMissingId =
393   """<network-request xmlns="http://www.w3.org/2001/XMLSchema">
394    <request-info>
395       <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
396       <action>DELETE</action>
397       <source>VID</source>
398       <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
399    </request-info>
400    <network-inputs>
401       <network-id/>
402       <network-name>HSL_direct_net_2</network-name>
403       <network-type>CONTRAIL_EXTERNAL</network-type>
404       <modelCustomizationId>f21df226-8093-48c3-be7e-0408fcda0422</modelCustomizationId>
405       <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
406       <tenant-id>7dd5365547234ee8937416c65507d266</tenant-id>
407       <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
408       <backout-on-failure>false</backout-on-failure>
409       <sdncVersion>1610</sdncVersion>
410    </network-inputs>
411    <network-params/>
412 </network-request>"""
413
414 String expectedNetworkRequestMissingCloudRegion =
415 """<network-request xmlns="http://www.w3.org/2001/XMLSchema">
416    <request-info>
417       <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
418       <action>DELETE</action>
419       <source>VID</source>
420       <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
421    </request-info>
422    <network-inputs>
423       <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
424       <network-name>HSL_direct_net_2</network-name>
425       <network-type>CONTRAIL_EXTERNAL</network-type>
426       <modelCustomizationId>f21df226-8093-48c3-be7e-0408fcda0422</modelCustomizationId>
427       <aic-cloud-region>null</aic-cloud-region>
428       <tenant-id>7dd5365547234ee8937416c65507d266</tenant-id>
429       <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
430       <backout-on-failure>false</backout-on-failure>
431       <sdncVersion>1610</sdncVersion>
432    </network-inputs>
433    <network-params/>
434 </network-request>"""
435
436                 // vnfRESTRequest
437                 String vnfRESTRequest =
438 """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
439                    xmlns="http://www.w3.org/2001/XMLSchema"
440                    statusCode="200">
441    <rest:payload contentType="text/xml">
442       <network-request>
443          <request-info>
444             <action>DELETE</action>
445             <source>VID</source>
446             <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
447          </request-info>
448          <network-inputs>
449             <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
450             <network-name>HSL_direct_net_2</network-name>
451             <network-type>CONTRAIL_EXTERNAL</network-type>
452             <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
453             <tenant-id>7dd5365547234ee8937416c65507d266</tenant-id>
454             <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
455             <backout-on-failure>true</backout-on-failure>
456          </network-inputs>
457          <network-params>
458             <userParams/>
459          </network-params>
460       </network-request>
461    </rest:payload>
462 </rest:RESTResponse>"""
463
464         String networkInputs =
465   """<network-inputs xmlns="http://org.onap/so/infra/vnf-request/v1">
466    <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
467    <network-name>HSL_direct_net_2</network-name>
468    <network-type>CONTRAIL_BASIC</network-type>
469    <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
470    <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
471    <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id>
472 </network-inputs>"""
473
474 String networkInputsNoType =
475 """<network-inputs xmlns="http://org.onap/so/infra/vnf-request/v1">
476    <network-id></network-id>
477    <network-name></network-name>
478    <network-type></network-type>
479    <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
480    <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
481    <tenant-id>e81d842d3e8b45c5a59f57cd76af3aaf</tenant-id>
482 </network-inputs>"""
483
484         String networkInputsMissingId =
485  """<network-inputs xmlns="http://www.w3.org/2001/XMLSchema">
486    <network-id/>
487    <network-name>HSL_direct_net_2</network-name>
488    <network-type>CONTRAIL_EXTERNAL</network-type>
489    <modelCustomizationId>f21df226-8093-48c3-be7e-0408fcda0422</modelCustomizationId>
490    <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
491    <tenant-id>7dd5365547234ee8937416c65507d266</tenant-id>
492    <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
493    <backout-on-failure>false</backout-on-failure>
494    <sdncVersion>1610</sdncVersion>
495 </network-inputs>"""
496
497 String networkInputsMissingCloudRegion =
498 """<network-inputs xmlns="http://www.w3.org/2001/XMLSchema">
499    <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
500    <network-name>HSL_direct_net_2</network-name>
501    <network-type>CONTRAIL_EXTERNAL</network-type>
502    <modelCustomizationId>f21df226-8093-48c3-be7e-0408fcda0422</modelCustomizationId>
503    <aic-cloud-region>null</aic-cloud-region>
504    <tenant-id>7dd5365547234ee8937416c65507d266</tenant-id>
505    <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
506    <backout-on-failure>false</backout-on-failure>
507    <sdncVersion>1610</sdncVersion>
508 </network-inputs>"""
509
510         String MissingIdFault = "Invalid value or missing network-id element"
511         String MissingRegionFault = "Invalid value or missing 'aic-cloud-region' element"
512
513         String  invalidWorkflowException = """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
514                                         <aetgt:ErrorMessage>Invalid value of network-id element</aetgt:ErrorMessage>
515                                         <aetgt:ErrorCode>2500</aetgt:ErrorCode>
516                                   </aetgt:WorkflowException>"""
517
518
519         String queryAAIResponse =
520                 """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
521                    statusCode="200">
522    <rest:headers>
523       <rest:header name="Transfer-Encoding" value="chunked"/>
524       <rest:header name="Date" value="Sat,30 Jan 2016 20:09:24 GMT"/>
525       <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>
526       <rest:header name="X-AAI-TXID"
527                    value="localhost-20160130-20:09:24:814-165843"/>
528       <rest:header name="Content-Type" value="application/xml"/>
529       <rest:header name="Server" value="Apache-Coyote/1.1"/>
530       <rest:header name="Cache-Control" value="private"/>
531    </rest:headers>
532    <rest:payload contentType="text/xml">
533       <l3-network xmlns="http://org.openecomp.aai.inventory/v3">
534          <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
535          <network-name>HSL_direct_net_2</network-name>
536          <network-type>CONTRAIL_BASIC</network-type>
537          <network-role>HSL_direct</network-role>
538          <network-technology>contrail</network-technology>
539          <neutron-network-id>8bbd3edf-b835-4610-96a2-a5cafa029042</neutron-network-id>
540          <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
541          <orchestration-status>active</orchestration-status>
542          <heat-stack-id>HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6</heat-stack-id>
543          <subnets>
544             <subnet>
545                <subnet-id>ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a</subnet-id>
546                <neutron-subnet-id>5a77fdc2-7789-4649-a1b9-6eaf1db1813a</neutron-subnet-id>
547                <gateway-address>172.16.34.1</gateway-address>
548                <network-start-address>172.16.34.0</network-start-address>
549                <cidr-mask>28</cidr-mask>
550                <ip-version>4</ip-version>
551                <orchestration-status>active</orchestration-status>
552                <dhcp-enabled>true</dhcp-enabled>
553                <relationship-list/>
554             </subnet>
555          </subnets>
556          <relationship-list>
557             <relationship>
558                <related-to>tenant</related-to>
559                <related-link>https://aai-app-e2e.test.com:8443/aai/v3/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/</related-link>
560                <relationship-data>
561                   <relationship-key>tenant.tenant-id</relationship-key>
562                   <relationship-value>e81d842d3e8b45c5a59f57cd76af3aaf</relationship-value>
563                </relationship-data>
564             </relationship>
565          </relationship-list>
566       </l3-network>
567    </rest:payload>
568 </rest:RESTResponse>"""
569
570     String deleteNetworkRequest =
571     """<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
572   <soapenv:Header/>
573   <soapenv:Body>
574       <NetworkAdapter:deleteNetwork xmlns:NetworkAdapter="http://org.onap.so/network">
575          <cloudSiteId>RDM2WAGPLCP</cloudSiteId>
576          <tenantId>e81d842d3e8b45c5a59f57cd76af3aaf</tenantId>
577          <networkType>CONTRAIL_BASIC</networkType>
578          <networkId>HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6</networkId>
579          <request>
580             <requestId>88f65519-9a38-4c4b-8445-9eb4a5a5af56</requestId>
581             <serviceInstanceId>0</serviceInstanceId>
582          </request>
583       </NetworkAdapter:deleteNetwork>
584   </soapenv:Body>
585 </soapenv:Envelope>"""
586
587 String deleteNetworkRESTRequest =
588 """<deleteNetworkRequest>
589    <cloudSiteId>RDM2WAGPLCP</cloudSiteId>
590    <tenantId>e81d842d3e8b45c5a59f57cd76af3aaf</tenantId>
591    <networkId>bdc5efe8-404a-409b-85f6-0dcc9eebae30</networkId>
592    <networkStackId>HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6</networkStackId>
593    <networkType>CONTRAIL_BASIC</networkType>
594    <modelCustomizationUuid>sn5256d1-5a33-55df-13ab-12abad84e222</modelCustomizationUuid>
595    <skipAAI>true</skipAAI>
596    <msoRequest>
597       <requestId>88f65519-9a38-4c4b-8445-9eb4a5a5af56</requestId>
598       <serviceInstanceId>f70e927b-6087-4974-9ef8-c5e4d5847ca4</serviceInstanceId>
599    </msoRequest>
600    <messageId>messageId_value</messageId>
601    <notificationUrl/>
602 </deleteNetworkRequest>"""
603
604 String deleteNetworkRESTRequestAlaCarte =
605 """<deleteNetworkRequest>
606    <cloudSiteId>RDM2WAGPLCP</cloudSiteId>
607    <tenantId>e81d842d3e8b45c5a59f57cd76af3aaf</tenantId>
608    <networkId>bdc5efe8-404a-409b-85f6-0dcc9eebae30</networkId>
609    <networkStackId>HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6</networkStackId>
610    <networkType>CONTRAIL_BASIC</networkType>
611    <modelCustomizationUuid>f21df226-8093-48c3-be7e-0408fcda0422</modelCustomizationUuid>
612    <skipAAI>true</skipAAI>
613    <msoRequest>
614       <requestId>88f65519-9a38-4c4b-8445-9eb4a5a5af56</requestId>
615       <serviceInstanceId>f70e927b-6087-4974-9ef8-c5e4d5847ca4</serviceInstanceId>
616    </msoRequest>
617    <messageId>messageId_value</messageId>
618    <notificationUrl/>
619 </deleteNetworkRequest>"""
620
621     String deleteNetworkResponse_noRollback =
622 """<ns2:deleteNetworkResponse xmlns:ns2="http://org.onap.so/network">
623         <networkDeleted>true</networkDeleted>
624 </ns2:deleteNetworkResponse>
625 """
626
627         String deleteNetworkResponse =
628         """<ns2:deleteNetworkResponse xmlns:ns2="http://org.onap.so/network">
629             <networkDeleted>true</networkDeleted>
630             <rollback>
631                  <networkId>MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641</networkId>
632                  <neutronNetworkId>c4f4e878-cde0-4b15-ae9a-bda857759cea</neutronNetworkId>
633                  <networkStackId></networkStackId>
634                  <networkType>CONTRAIL_EXTERNAL</networkType>
635                  <networkCreated>true</networkCreated>
636                  <tenantId>7dd5365547234ee8937416c65507d266</tenantId>
637                  <cloudSiteId>RDM2WAGPLCP</cloudSiteId>
638                  <msoRequest>
639                         <requestId>1ef47428-cade-45bd-a103-0751e8b2deb0</requestId>
640                         <serviceInstanceId></serviceInstanceId>
641                  </msoRequest>
642             </rollback>
643        </ns2:deleteNetworkResponse>"""
644
645            String deleteRollbackNetworkRequest =
646            """<NetworkAdapter:rollbackNetwork xmlns:NetworkAdapter="http://org.onap.so/network">
647    <rollback>
648       <networkId>MNS-25180-L-01-dmz_direct_net_1/2c88a3a9-69b9-43a7-ada6-1aca577c3641</networkId>
649       <neutronNetworkId>c4f4e878-cde0-4b15-ae9a-bda857759cea</neutronNetworkId>
650       <networkStackId/>
651       <networkType>CONTRAIL_EXTERNAL</networkType>
652       <networkCreated>true</networkCreated>
653       <tenantId>7dd5365547234ee8937416c65507d266</tenantId>
654       <cloudSiteId>RDM2WAGPLCP</cloudSiteId>
655       <msoRequest>
656          <requestId>1ef47428-cade-45bd-a103-0751e8b2deb0</requestId>
657          <serviceInstanceId/>
658       </msoRequest>
659    </rollback>
660 </NetworkAdapter:rollbackNetwork>"""
661
662         String deleteNetworkResponseFalseCompletion =
663                 """<ns2:deleteNetworkResponse xmlns:ns2="http://org.onap.so/network"
664                      xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
665                    <networkDeleted>false</networkDeleted>
666                 </ns2:deleteNetworkResponse>"""
667
668         String deleteNetworkErrorResponse =
669         """<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
670 <deleteNetworkError>
671 <messageId>680bd458-5ec1-4a16-b77c-509022e53450</messageId><category>INTERNAL</category>
672 <message>400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data</message>
673 <rolledBack>true</rolledBack>
674 </deleteNetworkError>
675 """
676
677         String deleteNetworkWorkflowException =
678         """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
679                                         <aetgt:ErrorMessage>Received error from Network Adapter: 400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=StackValidationFailed, error.message=Property error: : resources.network.properties: : Unknown Property network_ipam_refs_data</aetgt:ErrorMessage>
680                                         <aetgt:ErrorCode>7020</aetgt:ErrorCode>
681                                   </aetgt:WorkflowException>"""
682
683 String aaiWorkflowException =
684 """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
685                                         <aetgt:ErrorMessage>Bpmn error encountered in DoDeleteNetworkInstance flow. Unexpected Response from AAI Adapter - org.apache.http.conn.HttpHostConnectException: Connect to localhost:8090 [localhost/127.0.0.1, localhost/0:0:0:0:0:0:0:1] failed: Connection refused: connect</aetgt:ErrorMessage>
686                                         <aetgt:ErrorCode>2500</aetgt:ErrorCode>
687                                   </aetgt:WorkflowException>"""
688
689         String aaiResponse =
690    """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
691                    statusCode="200">
692    <rest:headers>
693       <rest:header name="Transfer-Encoding" value="chunked"/>
694       <rest:header name="Date" value="Sat,30 Jan 2016 20:09:24 GMT"/>
695       <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>
696       <rest:header name="X-AAI-TXID"
697                    value="localhost-20160130-20:09:24:814-165843"/>
698       <rest:header name="Content-Type" value="application/xml"/>
699       <rest:header name="Server" value="Apache-Coyote/1.1"/>
700       <rest:header name="Cache-Control" value="private"/>
701    </rest:headers>
702    <rest:payload contentType="text/xml">
703       <l3-network xmlns="http://org.openecomp.aai.inventory/v8">
704          <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
705          <network-name>HSL_direct_net_2</network-name>
706          <network-type>CONTRAIL_BASIC</network-type>
707          <network-role>HSL_direct</network-role>
708          <network-technology>contrail</network-technology>
709          <neutron-network-id>8bbd3edf-b835-4610-96a2-a5cafa029042</neutron-network-id>
710          <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
711          <orchestration-status>active</orchestration-status>
712          <heat-stack-id>HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6</heat-stack-id>
713          <subnets>
714             <subnet>
715                <subnet-id>ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a</subnet-id>
716                <neutron-subnet-id>5a77fdc2-7789-4649-a1b9-6eaf1db1813a</neutron-subnet-id>
717                <gateway-address>172.16.34.1</gateway-address>
718                <network-start-address>172.16.34.0</network-start-address>
719                <cidr-mask>28</cidr-mask>
720                <ip-version>4</ip-version>
721                <orchestration-status>active</orchestration-status>
722                <dhcp-enabled>true</dhcp-enabled>
723                <relationship-list/>
724             </subnet>
725          </subnets>
726          <relationship-list>
727             <relationship>
728                <related-to>tenant</related-to>
729                <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/</related-link>
730                <relationship-data>
731                   <relationship-key>tenant.tenant-id</relationship-key>
732                   <relationship-value>e81d842d3e8b45c5a59f57cd76af3aaf</relationship-value>
733                </relationship-data>
734             </relationship>
735                         <relationship>
736                <related-to>cloud-region</related-to>
737                <related-link>cloud-infrastructure/cloud-regions/cloud-region/CloudOwner/RDM2WAGPLCP/</related-link>
738                <relationship-data>
739                   <relationship-key>cloud-region.cloud-owner</relationship-key>
740                   <relationship-value>CloudOwner</relationship-value>
741                </relationship-data>
742                <relationship-data>
743                   <relationship-key>cloud-region.cloud-region-id</relationship-key>
744                   <relationship-value>RDM2WAGPLCP</relationship-value>
745                </relationship-data>                                                
746             </relationship>                                 
747          </relationship-list>
748       </l3-network>
749    </rest:payload>
750 </rest:RESTResponse>"""
751
752 String aaiResponseWithRelationship =
753 """<rest:RESTResponse xmlns:rest="http://schemas.activebpel.org/REST/2007/12/01/aeREST.xsd"
754                    statusCode="200">
755    <rest:headers>
756       <rest:header name="Transfer-Encoding" value="chunked"/>
757       <rest:header name="Date" value="Sat,30 Jan 2016 20:09:24 GMT"/>
758       <rest:header name="Expires" value="Thu,01 Jan 1970 00:00:00 UTC"/>
759       <rest:header name="X-AAI-TXID"
760                    value="localhost-20160130-20:09:24:814-165843"/>
761       <rest:header name="Content-Type" value="application/xml"/>
762       <rest:header name="Server" value="Apache-Coyote/1.1"/>
763       <rest:header name="Cache-Control" value="private"/>
764    </rest:headers>
765    <rest:payload contentType="text/xml">
766       <l3-network xmlns="http://org.openecomp.aai.inventory/v8">
767          <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
768          <network-name>HSL_direct_net_2</network-name>
769          <network-type>CONTRAIL_BASIC</network-type>
770          <network-role>HSL_direct</network-role>
771          <network-technology>contrail</network-technology>
772          <neutron-network-id>8bbd3edf-b835-4610-96a2-a5cafa029042</neutron-network-id>
773          <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
774          <orchestration-status>active</orchestration-status>
775          <heat-stack-id>HSL_direct_net_2/57594a56-1c92-4a38-9caa-641c1fa3d4b6</heat-stack-id>
776          <subnets>
777             <subnet>
778                <subnet-id>ea5f2a2c-604f-47ff-a9c5-253ee4f0ef0a</subnet-id>
779                <neutron-subnet-id>5a77fdc2-7789-4649-a1b9-6eaf1db1813a</neutron-subnet-id>
780                <gateway-address>172.16.34.1</gateway-address>
781                <network-start-address>172.16.34.0</network-start-address>
782                <cidr-mask>28</cidr-mask>
783                <ip-version>4</ip-version>
784                <orchestration-status>active</orchestration-status>
785                <dhcp-enabled>true</dhcp-enabled>
786                <relationship-list/>
787             </subnet>
788          </subnets>
789          <relationship-list>
790             <relationship>
791                <related-to>tenant</related-to>
792                <related-link>https://aai-app-e2e.test.com:8443/aai/v8/cloud-infrastructure/tenants/tenant/e81d842d3e8b45c5a59f57cd76af3aaf/</related-link>
793                <relationship-data>
794                   <relationship-key>tenant.tenant-id</relationship-key>
795                   <relationship-value>e81d842d3e8b45c5a59f57cd76af3aaf</relationship-value>
796                </relationship-data>
797             </relationship>
798                         <relationship>
799                                 <related-to>vf-module</related-to>
800                                 <related-link>https://aai-app-e2e.ecomp.cci.com:8443/aai/v8/network/generic-vnfs/generic-vnf/105df7e5-0b3b-49f7-a837-4864b62827c4/vf-modules/vf-module/d9217058-95a0-49ee-b9a9-949259e89349/</related-link>
801                                 <relationship-data>
802                                    <relationship-key>generic-vnf.vnf-id</relationship-key>
803                                    <relationship-value>105df7e5-0b3b-49f7-a837-4864b62827c4</relationship-value>
804                             </relationship-data>
805                             <relationship-data>
806                                    <relationship-key>vf-module.vf-module-id</relationship-key>
807                                    <relationship-value>d9217058-95a0-49ee-b9a9-949259e89349</relationship-value>
808                             </relationship-data>
809                     </relationship>            
810                         <relationship>
811                    <related-to>generic-vnf</related-to>
812                <related-link>https://aai-app-e2e.test.com:8443/aai/v8/network/generic-vnfs/generic-vnf/45f822d9-73ca-4255-9844-7cef401bbf47/</related-link>
813                <relationship-data>
814                  <relationship-key>generic-vnf.vnf-id</relationship-key>
815                  <relationship-value>45f822d9-73ca-4255-9844-7cef401bbf47</relationship-value>
816                </relationship-data>
817                <related-to-property>
818                  <property-key>generic-vnf.vnf-name</property-key>
819                  <property-value>zrdm1scpx05</property-value>
820                </related-to-property>
821             </relationship>
822          </relationship-list>
823       </l3-network>
824    </rest:payload>
825 </rest:RESTResponse>"""
826
827         String deleteSDNCRequest =
828     """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
829                                   xmlns:ns5="http://org.onap/so/request/types/v1"
830                                   xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1">
831    <sdncadapter:RequestHeader>
832       <sdncadapter:RequestId>88f65519-9a38-4c4b-8445-9eb4a5a5af56</sdncadapter:RequestId>
833       <sdncadapter:SvcInstanceId>f70e927b-6087-4974-9ef8-c5e4d5847ca4</sdncadapter:SvcInstanceId>
834       <sdncadapter:SvcAction>delete</sdncadapter:SvcAction>
835       <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
836       <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
837    </sdncadapter:RequestHeader>
838    <aetgt:SDNCRequestData>
839       <request-information>
840          <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
841          <request-action>DisconnectNetworkRequest</request-action>
842          <source>VID</source>
843          <notification-url/>
844          <order-number/>
845          <order-version/>
846       </request-information>
847       <service-information>
848          <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
849          <service-type/>
850          <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
851          <subscriber-name/>
852       </service-information>
853       <network-request-information>
854          <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
855          <network-type>CONTRAIL_BASIC</network-type>
856          <network-name>HSL_direct_net_2</network-name>
857          <tenant>7dd5365547234ee8937416c65507d266</tenant>
858          <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
859       </network-request-information>
860    </aetgt:SDNCRequestData>
861 </aetgt:SDNCAdapterWorkflowRequest>"""
862
863         String deleteRpcSDNCRequest =
864         """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
865                                   xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1">
866    <sdncadapter:RequestHeader>
867       <sdncadapter:RequestId>88f65519-9a38-4c4b-8445-9eb4a5a5af56</sdncadapter:RequestId>
868       <sdncadapter:SvcInstanceId>f70e927b-6087-4974-9ef8-c5e4d5847ca4</sdncadapter:SvcInstanceId>
869       <sdncadapter:SvcAction>unassign</sdncadapter:SvcAction>
870       <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
871       <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
872       <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
873    </sdncadapter:RequestHeader>
874    <aetgt:SDNCRequestData>
875       <request-information>
876          <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
877          <request-action>DeleteNetworkInstance</request-action>
878          <source>VID</source>
879          <notification-url/>
880          <order-number/>
881          <order-version/>
882       </request-information>
883       <service-information>
884          <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
885          <subscription-service-type>MSO-dev-service-type</subscription-service-type>
886          <onap-model-information>
887             <model-invariant-uuid>fcc85cb0-ad74-45d7-a5a1-17c8744fdb71</model-invariant-uuid>
888             <model-uuid>36a3a8ea-49a6-4ac8-b06c-89a54544b9b6</model-uuid>
889             <model-version>1.0</model-version>
890             <model-name>HNGW Protected OAM</model-name>
891          </onap-model-information>
892          <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
893          <global-customer-id>globalId_45678905678</global-customer-id>
894          <subscriber-name/>
895       </service-information>
896       <network-information>
897          <network-id>networkId</network-id>
898          <network-type>CONTRAIL_EXTERNAL</network-type>
899          <onap-model-information>
900             <model-invariant-uuid>sn5256d1-5a33-55df-13ab-12abad84e764</model-invariant-uuid>
901             <model-customization-uuid>sn5256d1-5a33-55df-13ab-12abad84e222</model-customization-uuid>
902             <model-uuid>sn5256d1-5a33-55df-13ab-12abad84e111</model-uuid>
903             <model-version>1</model-version>
904             <model-name>CONTRAIL_EXTERNAL</model-name>
905          </onap-model-information>
906       </network-information>
907       <network-request-input>
908          <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
909          <tenant>7dd5365547234ee8937416c65507d266</tenant>
910          <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
911          <aic-clli/>
912          <network-input-parameters/>
913       </network-request-input>
914    </aetgt:SDNCRequestData>
915 </aetgt:SDNCAdapterWorkflowRequest>"""
916
917         String sdncAdapaterDeactivateRollback =
918 """<aetgt:SDNCAdapterWorkflowRequest xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
919                                   xmlns:sdncadapter="http://org.onap.so/workflow/sdnc/adapter/schema/v1">
920    <sdncadapter:RequestHeader>
921       <sdncadapter:RequestId>88f65519-9a38-4c4b-8445-9eb4a5a5af56</sdncadapter:RequestId>
922       <sdncadapter:SvcInstanceId>f70e927b-6087-4974-9ef8-c5e4d5847ca4</sdncadapter:SvcInstanceId>
923       <sdncadapter:SvcAction>activate</sdncadapter:SvcAction>
924       <sdncadapter:SvcOperation>network-topology-operation</sdncadapter:SvcOperation>
925       <sdncadapter:CallbackUrl>sdncCallback</sdncadapter:CallbackUrl>
926       <sdncadapter:MsoAction>generic-resource</sdncadapter:MsoAction>
927    </sdncadapter:RequestHeader>
928    <aetgt:SDNCRequestData>
929       <request-information>
930          <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
931          <request-action>CreateNetworkInstance</request-action>
932          <source>VID</source>
933          <notification-url/>
934          <order-number/>
935          <order-version/>
936       </request-information>
937       <service-information>
938          <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
939          <subscription-service-type>MSO-dev-service-type</subscription-service-type>
940          <onap-model-information>
941             <model-invariant-uuid>fcc85cb0-ad74-45d7-a5a1-17c8744fdb71</model-invariant-uuid>
942             <model-uuid>36a3a8ea-49a6-4ac8-b06c-89a54544b9b6</model-uuid>
943             <model-version>1.0</model-version>
944             <model-name>HNGW Protected OAM</model-name>
945          </onap-model-information>
946          <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
947          <global-customer-id>globalId_45678905678</global-customer-id>
948          <subscriber-name/>
949       </service-information>
950       <network-information>
951          <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
952          <network-type>CONTRAIL_EXTERNAL</network-type>
953          <onap-model-information>
954             <model-invariant-uuid>sn5256d1-5a33-55df-13ab-12abad84e764</model-invariant-uuid>
955             <model-customization-uuid>sn5256d1-5a33-55df-13ab-12abad84e222</model-customization-uuid>
956             <model-uuid>sn5256d1-5a33-55df-13ab-12abad84e111</model-uuid>
957             <model-version>1</model-version>
958             <model-name>CONTRAIL_EXTERNAL</model-name>
959          </onap-model-information>
960       </network-information>
961       <network-request-input>
962          <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
963          <tenant>7dd5365547234ee8937416c65507d266</tenant>
964          <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
965          <aic-clli/>
966          <network-input-parameters/>
967       </network-request-input>
968    </aetgt:SDNCRequestData>
969 </aetgt:SDNCAdapterWorkflowRequest>"""
970          String sdncAdapterWorkflowResponse =
971          """<aetgt:SDNCAdapterWorkflowResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
972                                       xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
973          <sdncadapterworkflow:response-data>
974 <tag0:CallbackHeader xmlns:tag0="http://org.onap.so/workflow/sdnc/adapter/schema/v1">
975    <tag0:RequestId>745b1b50-e39e-4685-9cc8-c71f0bde8bf0</tag0:RequestId>
976    <tag0:ResponseCode>200</tag0:ResponseCode>
977    <tag0:ResponseMessage>OK</tag0:ResponseMessage>
978 </tag0:CallbackHeader>
979       <tag0:RequestData xmlns:tag0="http://org.onap.so/workflow/sdnc/adapter/schema/v1">&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;output xmlns="com:att:sdnctl:vnf"&gt;&lt;svc-request-id&gt;19174929-3809-49ca-89eb-17f84a035389&lt;/svc-request-id&gt;&lt;response-code&gt;200&lt;/response-code&gt;&lt;ack-final-indicator&gt;Y&lt;/ack-final-indicator&gt;&lt;network-information&gt;&lt;network-id&gt;bdc5efe8-404a-409b-85f6-0dcc9eebae30&lt;/network-id&gt;&lt;/network-information&gt;&lt;service-information&gt;&lt;service-type&gt;a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb&lt;/service-type&gt;&lt;service-instance-id&gt;HSL_direct_net_2&lt;/service-instance-id&gt;&lt;subscriber-name&gt;notsurewecare&lt;/subscriber-name&gt;&lt;/service-information&gt;&lt;/output&gt;</tag0:RequestData>
980      </sdncadapterworkflow:response-data>
981    </aetgt:SDNCAdapterWorkflowResponse>"""
982
983    String sdncAdapterWorkflowResponse_404 =
984    """<aetgt:SDNCAdapterWorkflowResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
985                                    xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
986    <sdncadapterworkflow:response-data>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;output xmlns="com:att:sdnctl:vnf"&gt;&lt;svc-request-id&gt;00703dc8-71ff-442d-a4a8-3adc5beef6a9&lt;/svc-request-id&gt;&lt;response-code&gt;404&lt;/response-code&gt;&lt;response-message&gt;Service instance not found in config tree&lt;/response-message&gt;&lt;ack-final-indicator&gt;Y&lt;/ack-final-indicator&gt;&lt;network-information&gt;&lt;network-id&gt;49c86598-f766-46f8-84f8-8d1c1b10f9b4&lt;/network-id&gt;&lt;/network-information&gt;&lt;service-information&gt;&lt;service-type&gt;a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb&lt;/service-type&gt;&lt;service-instance-id&gt;MNS-25180-L-01-dmz_direct_net_1&lt;/service-instance-id&gt;&lt;subscriber-name&gt;notsurewecare&lt;/subscriber-name&gt;&lt;/service-information&gt;&lt;/output&gt;</sdncadapterworkflow:response-data>
987 </aetgt:SDNCAdapterWorkflowResponse>"""
988
989         String expected_sdncAdapterWorkflowFormattedResponse_404 =
990 """<aetgt:SDNCAdapterWorkflowResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
991                                    xmlns="com:att:sdnctl:vnf">
992    <aetgt:response-data>
993       <output>
994          <svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id>
995          <response-code>404</response-code>
996          <response-message>Service instance not found in config tree</response-message>
997          <ack-final-indicator>Y</ack-final-indicator>
998          <network-information>
999             <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id>
1000          </network-information>
1001          <service-information>
1002             <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type>
1003             <service-instance-id>MNS-25180-L-01-dmz_direct_net_1</service-instance-id>
1004             <subscriber-name>notsurewecare</subscriber-name>
1005          </service-information>
1006       </output>
1007    </aetgt:response-data>
1008 </aetgt:SDNCAdapterWorkflowResponse>"""
1009
1010         String sdncAdapterWorkflowFormattedResponse =
1011         """<aetgt:SDNCAdapterWorkflowResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
1012                                    xmlns="com:att:sdnctl:vnf">
1013    <aetgt:response-data>
1014       <output>
1015          <svc-request-id>19174929-3809-49ca-89eb-17f84a035389</svc-request-id>
1016          <response-code>200</response-code>
1017          <ack-final-indicator>Y</ack-final-indicator>
1018          <network-information>
1019             <network-id>bdc5efe8-404a-409b-85f6-0dcc9eebae30</network-id>
1020          </network-information>
1021          <service-information>
1022             <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type>
1023             <service-instance-id>HSL_direct_net_2</service-instance-id>
1024             <subscriber-name>notsurewecare</subscriber-name>
1025          </service-information>
1026       </output>
1027    </aetgt:response-data>
1028 </aetgt:SDNCAdapterWorkflowResponse>"""
1029
1030 String sdncAdapterWorkflowFormattedResponse_404 =
1031 """<aetgt:SDNCAdapterWorkflowResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
1032                                    xmlns="com:att:sdnctl:vnf">
1033    <aetgt:response-data>
1034       <output>
1035          <svc-request-id>00703dc8-71ff-442d-a4a8-3adc5beef6a9</svc-request-id>
1036          <response-code>404</response-code>
1037          <response-message>Service instance not found in config tree</response-message>
1038          <ack-final-indicator>Y</ack-final-indicator>
1039          <network-information>
1040             <network-id>49c86598-f766-46f8-84f8-8d1c1b10f9b4</network-id>
1041          </network-information>
1042          <service-information>
1043             <service-type>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-type>
1044             <service-instance-id>MNS-25180-L-01-dmz_direct_net_1</service-instance-id>
1045             <subscriber-name>notsurewecare</subscriber-name>
1046          </service-information>
1047       </output>
1048    </aetgt:response-data>
1049 </aetgt:SDNCAdapterWorkflowResponse>"""
1050
1051         String invalidRequest = "Invalid value of network-id element"
1052
1053
1054
1055         String sndcWorkflowException =
1056         """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
1057    <aetgt:ErrorMessage>Received error from SDN-C: No availability zone available</aetgt:ErrorMessage>
1058    <aetgt:ErrorCode>5300</aetgt:ErrorCode>
1059    <aetgt:SourceSystemErrorCode>200</aetgt:SourceSystemErrorCode>
1060 </aetgt:WorkflowException>"""
1061
1062         String sndcWorkflowErrorResponse =
1063         """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
1064                                         <aetgt:ErrorMessage>Received error from SDN-C: <aetgt:SDNCAdapterWorkflowResponse xmlns:aetgt="http://org.onap/so/workflow/schema/v1"
1065                                    xmlns:sdncadapterworkflow="http://org.onap/so/workflow/schema/v1">
1066    <sdncadapterworkflow:response-data>&lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;output xmlns="com:att:sdnctl:vnf"&gt;&lt;svc-request-id&gt;00703dc8-71ff-442d-a4a8-3adc5beef6a9&lt;/svc-request-id&gt;&lt;response-code&gt;404&lt;/response-code&gt;&lt;response-message&gt;Service instance not found in config tree&lt;/response-message&gt;&lt;ack-final-indicator&gt;Y&lt;/ack-final-indicator&gt;&lt;network-information&gt;&lt;network-id&gt;49c86598-f766-46f8-84f8-8d1c1b10f9b4&lt;/network-id&gt;&lt;/network-information&gt;&lt;service-information&gt;&lt;service-type&gt;a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb&lt;/service-type&gt;&lt;service-instance-id&gt;MNS-25180-L-01-dmz_direct_net_1&lt;/service-instance-id&gt;&lt;subscriber-name&gt;notsurewecare&lt;/subscriber-name&gt;&lt;/service-information&gt;&lt;/output&gt;</sdncadapterworkflow:response-data>
1067 </aetgt:SDNCAdapterWorkflowResponse></aetgt:ErrorMessage>
1068                                         <aetgt:ErrorCode>5300</aetgt:ErrorCode>
1069                                   </aetgt:WorkflowException>"""
1070
1071         String unexpectedErrorEncountered =
1072         """<aetgt:WorkflowException xmlns:aetgt="http://org.onap/so/workflow/schema/v1">
1073                                         <aetgt:ErrorMessage>bpel error deleting network</aetgt:ErrorMessage>
1074                                         <aetgt:ErrorCode>5300</aetgt:ErrorCode>
1075                                   </aetgt:WorkflowException>"""
1076
1077
1078                                   // expectedVnfRequest
1079   String inputViprSDC_NetworkRequest =
1080                           """<network-request xmlns="http://www.w3.org/2001/XMLSchema">
1081    <request-info>
1082       <request-id>88f65519-9a38-4c4b-8445-9eb4a5a5af56</request-id>
1083       <action>DELETE</action>
1084       <source>VID</source>
1085       <service-instance-id>f70e927b-6087-4974-9ef8-c5e4d5847ca4</service-instance-id>
1086    </request-info>
1087    <network-inputs>
1088       <network-id>networkId</network-id>
1089       <network-name>MNS-25180-L-01-dmz_direct_net_1</network-name>
1090       <network-type>CONTRAIL_EXTERNAL</network-type>
1091       <subscription-service-type>MSO-dev-service-type</subscription-service-type>
1092       <global-customer-id>globalId_45678905678</global-customer-id>
1093       <aic-cloud-region>RDM2WAGPLCP</aic-cloud-region>
1094       <tenant-id>7dd5365547234ee8937416c65507d266</tenant-id>
1095       <service-id>a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb</service-id>
1096       <backout-on-failure>false</backout-on-failure>
1097       <failIfExist>false</failIfExist>
1098       <networkModelInfo>
1099          <modelName>CONTRAIL_EXTERNAL</modelName>
1100          <modelUuid>sn5256d1-5a33-55df-13ab-12abad84e111</modelUuid>
1101          <modelInvariantUuid>sn5256d1-5a33-55df-13ab-12abad84e764</modelInvariantUuid>
1102          <modelVersion>1</modelVersion>
1103          <modelCustomizationUuid>sn5256d1-5a33-55df-13ab-12abad84e222</modelCustomizationUuid>
1104          <modelType>CONTRAIL_EXTERNAL</modelType>
1105       </networkModelInfo>
1106       <serviceModelInfo>
1107          <modelName>HNGW Protected OAM</modelName>
1108          <modelUuid>36a3a8ea-49a6-4ac8-b06c-89a54544b9b6</modelUuid>
1109          <modelInvariantUuid>fcc85cb0-ad74-45d7-a5a1-17c8744fdb71</modelInvariantUuid>
1110          <modelVersion>1.0</modelVersion>
1111          <modelCustomizationUuid/>
1112          <modelType>service</modelType>
1113       </serviceModelInfo>
1114       <sdncVersion>1702</sdncVersion>
1115    </network-inputs>
1116    <network-params/>
1117 </network-request>"""
1118 // - - - - - - - -
1119
1120
1121             @Before
1122                 public void init()
1123                 {
1124                         super.init("DoDeleteNetworkInstance")
1125                         MockitoAnnotations.initMocks(this)
1126                 }
1127
1128                 @Test
1129                 public void preProcessRequest_Json() {
1130                         
1131                         println "************ preProcessRequest_Payload ************* "
1132                         ExecutionEntity mockExecution = setupMock()
1133                         // Initialize prerequisite variables
1134                         when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1135                         when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1136                         when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true)
1137                         when(mockExecution.getVariable("recipeTimeout")).thenReturn(0)
1138                         when(mockExecution.getVariable("requestAction")).thenReturn("DELETE")
1139                         when(mockExecution.getVariable("networkId")).thenReturn("bdc5efe8-404a-409b-85f6-0dcc9eebae30")
1140                         when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
1141                         when(mockExecution.getVariable("vnfId")).thenReturn("")
1142                         when(mockExecution.getVariable("volumeGroupId")).thenReturn("")
1143                         //when(mockExecution.getVariable("networkId")).thenReturn("")
1144                         when(mockExecution.getVariable("serviceType")).thenReturn("MOG")
1145                         when(mockExecution.getVariable("networkType")).thenReturn("modelName")
1146                         when(mockExecution.getVariable("bpmnRequest")).thenReturn(incomingJsonRequest)
1147                         when(mockExecution.getVariable("disableRollback")).thenReturn(true)
1148                         when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad")
1149                         when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1150                         when(mockExecution.getVariable("mso-service-instance-id")).thenReturn("FH/VLXM/003717//SW_INTERNET")
1151                         when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B")
1152                         when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
1153                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1154                         when(mockExecution.getVariable("mso.rollback")).thenReturn("true")
1155                         when(mockExecution.getVariable("sdncVersion")).thenReturn("1610")
1156
1157                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1158                         DoDeleteNetworkInstance.preProcessRequest(mockExecution)
1159
1160                         // check the sequence of variable invocation
1161                         //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl()
1162                         //preDebugger.printInvocations(mockExecution)
1163
1164 //                      verify(mockExecution).getVariable("isDebugLogEnabled")
1165                         verify(mockExecution).setVariable("prefix", Prefix)
1166
1167                         //verify variable initialization
1168                         initializeVariables(mockExecution)
1169
1170                         verify(mockExecution).setVariable("action", "DELETE")
1171                         verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequest)
1172
1173                         verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false)
1174
1175                         verify(mockExecution).setVariable(Prefix + "networkInputs", expected_networkInput)
1176                         verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad")
1177                         verify(mockExecution).setVariable(Prefix + "source", "VID")
1178
1179                         // Authentications
1180                         verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=")
1181                         verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=")
1182
1183
1184                 }
1185
1186                 @Test
1187                 //@Ignore
1188                 public void preProcessRequest_vPER() {
1189
1190                         def networkModelInfo = """{"modelUuid": "sn5256d1-5a33-55df-13ab-12abad84e111",
1191                                      "modelName": "CONTRAIL_EXTERNAL",
1192                                                                          "modelType": "CONTRAIL_EXTERNAL",
1193                                                                          "modelVersion": "1",
1194                                                                          "modelCustomizationUuid": "sn5256d1-5a33-55df-13ab-12abad84e222",
1195                                                                          "modelInvariantUuid": "sn5256d1-5a33-55df-13ab-12abad84e764"
1196                                                                         }""".trim()
1197                         
1198                         println "************ preProcessRequest_Payload ************* "
1199                         ExecutionEntity mockExecution = setupMock()
1200                         // Initialize prerequisite variables
1201                         when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1202                         // Inputs:
1203                         when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1204                         when(mockExecution.getVariable("disableRollback")).thenReturn("true")
1205                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1206                         when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
1207                         when(mockExecution.getVariable("networkId")).thenReturn("bdc5efe8-404a-409b-85f6-0dcc9eebae30")                                // optional
1208                         when(mockExecution.getVariable("networkName")).thenReturn("MNS-25180-L-01-dmz_direct_net_1")        // optional
1209                         when(mockExecution.getVariable("productFamilyId")).thenReturn("a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb")
1210                         when(mockExecution.getVariable("networkModelInfo")).thenReturn("CONTRAIL_EXTERNAL")
1211                         when(mockExecution.getVariable("lcpCloudRegionId")).thenReturn("RDM2WAGPLCP")
1212                         when(mockExecution.getVariable("tenantId")).thenReturn("7dd5365547234ee8937416c65507d266")
1213                         when(mockExecution.getVariable("failIfExists")).thenReturn("false")
1214                         when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo)
1215                         when(mockExecution.getVariable("sdncVersion")).thenReturn("1702")
1216                         when(mockExecution.getVariable("action")).thenReturn("DELETE")
1217                         when(mockExecution.getVariable("subscriptionServiceType")).thenReturn("MSO-dev-service-type")
1218                         when(mockExecution.getVariable("globalSubscriberId")).thenReturn("globalId_45678905678")
1219                         when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad")
1220
1221                         when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B")
1222                         when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
1223
1224                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1225                         DoDeleteNetworkInstance.preProcessRequest(mockExecution)
1226
1227                         // check the sequence of variable invocation
1228                         //MockitoDebuggerImpl preDebugger = new MockitoDebuggerImpl()
1229                         //preDebugger.printInvocations(mockExecution)
1230
1231 //                      verify(mockExecution).getVariable("isDebugLogEnabled")
1232                         verify(mockExecution).setVariable("prefix", Prefix)
1233
1234                         //verify variable initialization
1235                         initializeVariables(mockExecution)
1236
1237                         verify(mockExecution).setVariable("action", "DELETE")
1238                         verify(mockExecution).setVariable(Prefix + "networkRequest", expectedVperNetworkRequest)
1239
1240                         verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false)
1241
1242                         verify(mockExecution).setVariable(Prefix + "networkInputs", expectedVper_networkInput)
1243                         verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad")
1244                         verify(mockExecution).setVariable(Prefix + "source", "VID")
1245
1246                         // Authentications
1247                         verify(mockExecution).setVariable("BasicAuthHeaderValuePO", "Basic cGFzc3dvcmQ=")
1248                         verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=")
1249
1250
1251                 }
1252                 
1253                 public void initializeVariables (DelegateExecution mockExecution) {
1254
1255                         verify(mockExecution).setVariable(Prefix + "networkRequest", "")
1256                         verify(mockExecution).setVariable(Prefix + "isSilentSuccess", false)
1257                         verify(mockExecution).setVariable(Prefix + "Success", false)
1258
1259                         verify(mockExecution).setVariable(Prefix + "requestId", "")
1260                         verify(mockExecution).setVariable(Prefix + "source", "")
1261                         verify(mockExecution).setVariable(Prefix + "lcpCloudRegion", "")
1262                         verify(mockExecution).setVariable(Prefix + "networkInputs", "")
1263                         verify(mockExecution).setVariable(Prefix + "tenantId", "")
1264
1265                         verify(mockExecution).setVariable(Prefix + "queryAAIResponse", "")
1266                         verify(mockExecution).setVariable(Prefix + "aaiReturnCode", "")
1267                         verify(mockExecution).setVariable(Prefix + "isAAIGood", false)
1268                         verify(mockExecution).setVariable(Prefix + "isVfRelationshipExist", false)
1269
1270                         // AAI query Cloud Region
1271                         verify(mockExecution).setVariable(Prefix + "queryCloudRegionRequest","")
1272                         verify(mockExecution).setVariable(Prefix + "queryCloudRegionReturnCode","")
1273                         verify(mockExecution).setVariable(Prefix + "queryCloudRegionResponse","")
1274                         verify(mockExecution).setVariable(Prefix + "cloudRegionPo","")
1275                         verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc","")
1276
1277                         verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", "")
1278                         verify(mockExecution).setVariable(Prefix + "deleteNetworkResponse", "")
1279                         verify(mockExecution).setVariable(Prefix + "networkReturnCode", "")
1280                         verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", "")
1281
1282                         verify(mockExecution).setVariable(Prefix + "deleteSDNCRequest", "")
1283                         verify(mockExecution).setVariable(Prefix + "deleteSDNCResponse", "")
1284                         verify(mockExecution).setVariable(Prefix + "sdncReturnCode", "")
1285                         verify(mockExecution).setVariable(Prefix + "sdncResponseSuccess", false)
1286
1287                         verify(mockExecution).setVariable(Prefix + "deactivateSDNCRequest", "")
1288                         verify(mockExecution).setVariable(Prefix + "deactivateSDNCResponse", "")
1289                         verify(mockExecution).setVariable(Prefix + "deactivateSdncReturnCode", "")
1290                         verify(mockExecution).setVariable(Prefix + "isSdncDeactivateRollbackNeeded", "")
1291
1292                         verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCRequest", "")
1293                         verify(mockExecution).setVariable(Prefix + "isException", false)
1294
1295                 }
1296
1297                 @Test
1298                 //@Ignore
1299                 public void preProcessRequest_Json_MissingId() {
1300
1301                         println "************ preProcessRequest_MissingId() ************* "
1302                         ExecutionEntity mockExecution = setupMock()
1303                         // Initialize prerequisite variables
1304                         when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1305                         when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1306                         when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true)
1307                         when(mockExecution.getVariable("recipeTimeout")).thenReturn(0)
1308                         when(mockExecution.getVariable("requestAction")).thenReturn("DELETE")
1309                         //when(mockExecution.getVariable("networkId")).thenReturn("") // missing Id
1310                         when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
1311                         when(mockExecution.getVariable("vnfId")).thenReturn("")
1312                         when(mockExecution.getVariable("volumeGroupId")).thenReturn("")
1313                         //when(mockExecution.getVariable("networkId")).thenReturn("")
1314                         when(mockExecution.getVariable("serviceType")).thenReturn("MOG")
1315                         when(mockExecution.getVariable("networkType")).thenReturn("modelName")
1316                         when(mockExecution.getVariable("bpmnRequest")).thenReturn(incomingJsonRequest)
1317                         when(mockExecution.getVariable("disableRollback")).thenReturn(true)
1318                         
1319                         when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad")
1320                         when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1321                         when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1322                         when(mockExecution.getVariable("mso-service-instance-id")).thenReturn("FH/VLXM/003717//SW_INTERNET")
1323                         when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B")
1324                         when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
1325                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1326                         when(mockExecution.getVariable("mso.rollback")).thenReturn("true")
1327                         when(mockExecution.getVariable("sdncVersion")).thenReturn("1610")
1328
1329                         // preProcessRequest(DelegateExecution execution)
1330                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1331                         try {
1332                                 DoDeleteNetworkInstance.preProcessRequest(mockExecution)
1333                         } catch (Exception ex) {
1334                                 println " Test End - Handle catch-throw BpmnError()! "
1335                         }
1336
1337                         //verify(mockExecution).getVariable("isDebugLogEnabled")
1338                         verify(mockExecution).setVariable("prefix", Prefix)
1339
1340                         //verify variable initialization
1341                         initializeVariables(mockExecution)
1342
1343                         verify(mockExecution).setVariable("action", "DELETE")
1344                         verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequestMissingId)
1345                         verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false)
1346
1347                         verify(mockExecution).setVariable(Prefix + "networkInputs", networkInputsMissingId)
1348                         verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad")
1349                         verify(mockExecution).setVariable(Prefix + "source", "VID")
1350
1351                 }
1352
1353                 @Test
1354                 //@Ignore
1355                 public void preProcessRequest_Json_MissingCloudRegion() {
1356
1357                         def networkModelInfo = """{"modelVersionId": "sn5256d1-5a33-55df-13ab-12abad84e111",
1358                                      "modelName": "CONTRAIL_EXTERNAL",
1359                                                                          "modelType": "CONTRAIL_EXTERNAL",
1360                                                                          "modelVersion": "1",
1361                                                                          "modelCustomizationId": "sn5256d1-5a33-55df-13ab-12abad84e222",
1362                                                                          "modelInvariantId": "sn5256d1-5a33-55df-13ab-12abad84e764"
1363                                                                         }""".trim()
1364                         
1365                         println "************ preProcessRequest_MissingCloudRegion() ************* "
1366                         ExecutionEntity mockExecution = setupMock()
1367                         // Initialize prerequisite variables
1368                         when(mockExecution.getVariable("networkModelInfo")).thenReturn(networkModelInfo)
1369                         when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1370                         when(mockExecution.getVariable("requestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1371                         when(mockExecution.getVariable("isBaseVfModule")).thenReturn(true)
1372                         when(mockExecution.getVariable("recipeTimeout")).thenReturn(0)
1373                         when(mockExecution.getVariable("requestAction")).thenReturn("DELETE")
1374                         when(mockExecution.getVariable("networkId")).thenReturn("bdc5efe8-404a-409b-85f6-0dcc9eebae30")
1375                         when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
1376                         when(mockExecution.getVariable("vnfId")).thenReturn("")
1377                         when(mockExecution.getVariable("volumeGroupId")).thenReturn("")
1378                         //when(mockExecution.getVariable("networkId")).thenReturn("")
1379                         when(mockExecution.getVariable("serviceType")).thenReturn("MOG")
1380                         when(mockExecution.getVariable("networkType")).thenReturn("modelName")
1381                         when(mockExecution.getVariable("bpmnRequest")).thenReturn(incomingRequestMissingCloudRegion)
1382                         when(mockExecution.getVariable("disableRollback")).thenReturn(true)
1383                         
1384                         when(mockExecution.getVariable("testMessageId")).thenReturn("7df689f9-7b93-430b-9b9e-28140d70cc7ad")
1385                         when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1386                         when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1387                         when(mockExecution.getVariable("mso-service-instance-id")).thenReturn("FH/VLXM/003717//SW_INTERNET")
1388                         when(mockExecution.getVariable("mso.adapters.po.auth")).thenReturn("3141634BF7E070AA289CF2892C986C0B")
1389                         when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
1390                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1391                         when(mockExecution.getVariable("mso.rollback")).thenReturn("true")
1392                         when(mockExecution.getVariable("sdncVersion")).thenReturn("1610")
1393
1394                         // preProcessRequest(DelegateExecution execution)
1395                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1396                         DoDeleteNetworkInstance.preProcessRequest(mockExecution)
1397
1398                         //verify(mockExecution).getVariable("isDebugLogEnabled")
1399                         verify(mockExecution).setVariable("prefix", Prefix)
1400
1401                         //verify variable initialization
1402                         initializeVariables(mockExecution)
1403
1404                         verify(mockExecution).setVariable("action", "DELETE")
1405                         verify(mockExecution).setVariable(Prefix + "networkRequest", expectedNetworkRequestMissingCloudRegion)
1406                         verify(mockExecution).setVariable(Prefix + "rollbackEnabled", false)
1407
1408                         verify(mockExecution).setVariable(Prefix + "networkInputs", networkInputsMissingCloudRegion)
1409                         verify(mockExecution).setVariable(Prefix + "messageId", "7df689f9-7b93-430b-9b9e-28140d70cc7ad")
1410                         verify(mockExecution).setVariable(Prefix + "lcpCloudRegion", null)
1411
1412                         verify(mockExecution).setVariable("BasicAuthHeaderValuePO","Basic cGFzc3dvcmQ=")
1413                         verify(mockExecution).setVariable("BasicAuthHeaderValueSDNC", "Basic cGFzc3dvcmQ=")
1414
1415                 }
1416
1417
1418
1419                 @Test
1420                 //@Ignore
1421                 public void prepareNetworkRequest() {
1422
1423                         println "************ prepareNetworkRequest ************* "
1424                         ExecutionEntity mockExecution = setupMock()
1425                         // Initialize prerequisite variables
1426                         when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedVperNetworkRequest)
1427                         when(mockExecution.getVariable(Prefix + "queryAAIResponse")).thenReturn(queryAAIResponse)
1428                         when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP")
1429                         when(mockExecution.getVariable(Prefix + "tenantId")).thenReturn("e81d842d3e8b45c5a59f57cd76af3aaf")
1430
1431                         when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
1432                         when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter")
1433                         when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1434                         when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_value")
1435                         //when(mockExecution.getVariable("URN_?????")).thenReturn("")   // notificationUrl, //TODO - is this coming from URN? What variable/value to use? 
1436                         when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true")
1437                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1438
1439                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1440                         DoDeleteNetworkInstance.prepareNetworkRequest(mockExecution)
1441
1442                         verify(mockExecution).setVariable("prefix", Prefix)
1443                         verify(mockExecution).setVariable("mso.adapters.network.rest.endpoint", "http://localhost:8090/networks/NetworkAdapter/bdc5efe8-404a-409b-85f6-0dcc9eebae30")
1444                         //verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRequest)
1445                         verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRESTRequest)
1446
1447                 }
1448                 
1449                 @Test
1450                 //@Ignore
1451                 public void prepareNetworkRequest_AlaCarte() {
1452
1453                         println "************ prepareNetworkRequest ************* "
1454                         ExecutionEntity mockExecution = setupMock()
1455                         // Initialize prerequisite variables
1456                         when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest)
1457                         when(mockExecution.getVariable(Prefix + "queryAAIResponse")).thenReturn(queryAAIResponse)
1458                         when(mockExecution.getVariable(Prefix + "cloudRegionPo")).thenReturn("RDM2WAGPLCP")
1459                         when(mockExecution.getVariable(Prefix + "tenantId")).thenReturn("e81d842d3e8b45c5a59f57cd76af3aaf")
1460
1461                         when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
1462                         when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter")
1463                         when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1464                         when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("messageId_value")
1465                         //when(mockExecution.getVariable("URN_?????")).thenReturn("")   // notificationUrl, //TODO - is this coming from URN? What variable/value to use?
1466                         when(mockExecution.getVariable(Prefix + "rollbackEnabled")).thenReturn("true")
1467                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1468
1469                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1470                         DoDeleteNetworkInstance.prepareNetworkRequest(mockExecution)
1471
1472                         verify(mockExecution).setVariable("prefix", Prefix)
1473                         verify(mockExecution).setVariable("mso.adapters.network.rest.endpoint", "http://localhost:8090/networks/NetworkAdapter/bdc5efe8-404a-409b-85f6-0dcc9eebae30")
1474                         //verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRequest)
1475                         verify(mockExecution).setVariable("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1476                         verify(mockExecution).setVariable(Prefix + "deleteNetworkRequest", deleteNetworkRESTRequestAlaCarte)
1477
1478                 }
1479
1480                 @Test
1481                 //@Ignore
1482                 public void sendRequestToVnfAdapter() {
1483
1484                         println "************ sendRequestToVnfAdapter ************* "
1485
1486                         WireMock.reset();
1487                         MockNetworkAdapter("bdc5efe8-404a-409b-85f6-0dcc9eebae30", 200, "deleteNetworkResponse_Success.xml");
1488
1489                         ExecutionEntity mockExecution = setupMock()
1490                         when(mockExecution.getVariable(Prefix + "deleteNetworkRequest")).thenReturn(deleteNetworkRESTRequest)
1491                         when(mockExecution.getVariable("mso.adapters.network.rest.endpoint")).thenReturn("http://localhost:8090/networks/NetworkAdapter/bdc5efe8-404a-409b-85f6-0dcc9eebae30")
1492                         when(mockExecution.getVariable("BasicAuthHeaderValuePO")).thenReturn("3141634BF7E070AA289CF2892C986C0B")
1493                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1494
1495                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1496                         DoDeleteNetworkInstance.sendRequestToVnfAdapter(mockExecution)
1497
1498                         verify(mockExecution).setVariable(Prefix + "networkReturnCode", 200)
1499                         //verify(mockExecution).setVariable(Prefix + "deleteNetworkResponse", deleteNetworkResponse_noRollback)
1500                                                 
1501                 }
1502
1503
1504                 @Test
1505                 //@Ignore
1506                 public void prepareSDNCRequest() {
1507
1508                         println "************ prepareSDNCRequest ************* "
1509
1510                         ExecutionEntity mockExecution = setupMock()
1511                         // Initialize prerequisite variables
1512                         when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(expectedNetworkRequest)
1513                         when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP")
1514                         when(mockExecution.getVariable(Prefix + "queryAAIResponse")).thenReturn(aaiResponse)
1515                         when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1516                         when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1517                         when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
1518                         when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
1519                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1520
1521                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1522                         DoDeleteNetworkInstance.prepareSDNCRequest(mockExecution)
1523
1524                         verify(mockExecution).setVariable("prefix", Prefix)
1525                         verify(mockExecution).setVariable(Prefix + "deleteSDNCRequest", deleteSDNCRequest)
1526
1527                 }
1528
1529                 @Test
1530                 //@Ignore
1531                 public void prepareRpcSDNCRequest() {
1532
1533                         println "************ prepareRpcSDNCRequest ************* "
1534
1535                         ExecutionEntity mockExecution = setupMock()
1536                         // Initialize prerequisite variables
1537                         when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(inputViprSDC_NetworkRequest)
1538                         when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP")
1539                         when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1540                         when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1541                         when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY
1542                         when(mockExecution.getVariable("serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
1543                         when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
1544                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1545
1546                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1547                         DoDeleteNetworkInstance.prepareRpcSDNCRequest(mockExecution)
1548
1549                         verify(mockExecution).setVariable("prefix", Prefix)
1550                         verify(mockExecution).setVariable(Prefix + "deleteSDNCRequest", deleteRpcSDNCRequest)
1551
1552                 }
1553
1554                 @Test
1555                 //@Ignore
1556                 public void prepareRpcSDNCActivateRollback() {
1557
1558                         println "************ prepareRpcSDNCActivateRollback ************* "
1559
1560                         ExecutionEntity mockExecution = mock(ExecutionEntity.class)
1561                         // Initialize prerequisite variables
1562                         when(mockExecution.getVariable(Prefix + "networkRequest")).thenReturn(inputViprSDC_NetworkRequest)
1563                         when(mockExecution.getVariable(Prefix + "cloudRegionSdnc")).thenReturn("RDM2WAGPLCP")
1564                         when(mockExecution.getVariable(Prefix + "serviceInstanceId")).thenReturn("f70e927b-6087-4974-9ef8-c5e4d5847ca4")
1565                         when(mockExecution.getVariable(Prefix + "networkId")).thenReturn("8abc633a-810b-4ca5-8b3a-09511d13a2ce")
1566                         when(mockExecution.getVariable("mso-request-id")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1567                         when(mockExecution.getVariable("msoRequestId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1568                         when(mockExecution.getVariable("testMessageId")).thenReturn("88f65519-9a38-4c4b-8445-9eb4a5a5af56") // test ONLY
1569                         when(mockExecution.getVariable("mso.workflow.sdncadapter.callback")).thenReturn("http://localhost:8090/SDNCAdapterCallback")
1570                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1571                         when(mockExecution.getVariable("GENGSI_siResourceLink")).thenReturn(null)
1572                         when(mockExecution.getVariable(Prefix + "deactivateSDNCResponse")).thenReturn(sdncAdapterWorkflowFormattedResponse)
1573
1574                         // preProcessRequest(DelegateExecution execution)
1575                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1576                         DoDeleteNetworkInstance.prepareRpcSDNCDeactivateRollback(mockExecution)
1577
1578                         // verify set prefix = Prefix + ""
1579                         verify(mockExecution).setVariable("prefix", Prefix)
1580                         //verify(mockExecution).setVariable("mso-request-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1581                         //verify(mockExecution).setVariable(Prefix + "requestId", "88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1582                         //verify(mockExecution).setVariable("mso-service-instance-id", "88f65519-9a38-4c4b-8445-9eb4a5a5af56")
1583                         verify(mockExecution).setVariable(Prefix + "rollbackDeactivateSDNCRequest", sdncAdapaterDeactivateRollback)
1584
1585                 }
1586
1587
1588                 @Test
1589
1590                 public void callRESTQueryAAI_VfRelationshipExist() {
1591
1592                         println "************ callRESTQueryAAI ************* "
1593
1594                         ExecutionEntity mockExecution = setupMock()
1595                         when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest)
1596                         when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6")
1597                         when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090")
1598                         when(mockExecution.getVariable("mso.workflow.default.aai.network.l3-network.uri")).thenReturn("")
1599                         // old: when(mockExecution.getVariable("mso.workflow.DoDeleteNetworkInstance.aai.network.l3-network.uri")).thenReturn("/aai/v8/network/l3-networks/l3-network")
1600                         when(mockExecution.getVariable("mso.workflow.DoDeleteNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network")
1601                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1602                         when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/')
1603                         when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
1604                         when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC")
1605             String networkId = "bdc5efe8-404a-409b-85f6-0dcc9eebae30"
1606             DoDeleteNetworkInstance doDeleteNetworkInstance = spy(DoDeleteNetworkInstance.class)
1607             when(doDeleteNetworkInstance.getAAIClient()).thenReturn(client)
1608             L3Network l3Network = getL3Network()
1609             Relationship relationship = new Relationship();
1610             relationship.setRelatedTo("vf-module")
1611             l3Network.getRelationshipList().getRelationship().add(relationship)
1612             AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ALL)
1613             when(client.get(L3Network.class,uri)).thenReturn(Optional.of(l3Network))
1614
1615                         doDeleteNetworkInstance.callRESTQueryAAI(mockExecution)
1616
1617                         verify(mockExecution).setVariable("prefix", Prefix)
1618
1619                         verify(mockExecution).setVariable(Prefix + "aaiReturnCode", 200)
1620                         //verify(mockExecution).setVariable(Prefix + "queryAAIResponse", aaiResponse)
1621                         verify(mockExecution).setVariable(Prefix + "isAAIGood", true)
1622                         verify(mockExecution).setVariable(Prefix + "isVfRelationshipExist", true)
1623
1624                 }
1625
1626                 @Test
1627                 //@Ignore
1628                 public void callRESTQueryAAI_200() {
1629
1630                         println "************ callRESTQueryAAI ************* "
1631                         ExecutionEntity mockExecution = setupMock()
1632                         when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest)
1633                         when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6")
1634                         when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090")
1635                         when(mockExecution.getVariable("mso.workflow.default.aai.network.l3-network.uri")).thenReturn("")
1636                         when(mockExecution.getVariable("mso.workflow.doDeleteNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network")
1637                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1638                         when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/')
1639                         when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
1640                         when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC")
1641             when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn(null)
1642                         String networkId = "bdc5efe8-404a-409b-85f6-0dcc9eebae30"
1643                         DoDeleteNetworkInstance doDeleteNetworkInstance = spy(DoDeleteNetworkInstance.class)
1644                         when(doDeleteNetworkInstance.getAAIClient()).thenReturn(client)
1645                         L3Network l3Network = getL3Network()
1646             AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ALL)
1647                         when(client.get(L3Network.class,uri)).thenReturn(Optional.of(l3Network))
1648                         doDeleteNetworkInstance.callRESTQueryAAI(mockExecution)
1649
1650                         verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix)
1651
1652                         verify(mockExecution).setVariable(Prefix + "aaiReturnCode", 200)
1653                         verify(mockExecution).setVariable(Prefix + "isAAIGood", true)
1654             verify(mockExecution).setVariable(Prefix + "queryAAIResponse", l3Network)
1655                 }
1656
1657
1658     @Test
1659     //@Ignore
1660     public void callRESTQueryAAI_CloudRegionRelation() {
1661
1662         println "************ callRESTQueryAAI ************* "
1663         ExecutionEntity mockExecution = setupMock()
1664         when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest)
1665         when(mockExecution.getVariable(Prefix + "messageId")).thenReturn("e8ebf6a0-f8ea-4dc0-8b99-fe98a87722d6")
1666         when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090")
1667         when(mockExecution.getVariable("mso.workflow.default.aai.network.l3-network.uri")).thenReturn("")
1668         when(mockExecution.getVariable("mso.workflow.doDeleteNetworkInstance.aai.l3-network.uri")).thenReturn("/aai/v9/network/l3-networks/l3-network")
1669         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1670         when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/')
1671         when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
1672         when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC")
1673         when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn(null)
1674         String networkId = "bdc5efe8-404a-409b-85f6-0dcc9eebae30"
1675         DoDeleteNetworkInstance doDeleteNetworkInstance = spy(DoDeleteNetworkInstance.class)
1676         when(doDeleteNetworkInstance.getAAIClient()).thenReturn(client)
1677         L3Network l3Network = new L3Network();
1678         RelationshipList relationshipList = new RelationshipList()
1679         Relationship relationship = new Relationship();
1680         relationship.setRelatedTo("cloud-region")
1681         relationship.setRelatedLink("http://localhost:18080/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER.toString() + "/lcpCloudRegion/")
1682         relationshipList.getRelationship().add(relationship)
1683         l3Network.setRelationshipList(relationshipList)
1684         AAIResourceUri uri = AAIUriFactory.createResourceUri(AAIObjectType.L3_NETWORK, networkId).depth(Depth.ALL)
1685         when(client.get(L3Network.class,uri)).thenReturn(Optional.of(l3Network))
1686         doDeleteNetworkInstance.callRESTQueryAAI(mockExecution)
1687
1688         verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix)
1689
1690         verify(mockExecution).setVariable(Prefix + "aaiReturnCode", 200)
1691         verify(mockExecution).setVariable(Prefix + "isAAIGood", true)
1692         verify(mockExecution).setVariable(Prefix + "queryAAIResponse", l3Network)
1693     }
1694
1695     private L3Network getL3Network() {
1696                 L3Network l3Network = new L3Network();
1697                 RelationshipList relationshipList = new RelationshipList()
1698                 Relationship relationship = new Relationship();
1699                 relationship.setRelatedTo("cloud-region")
1700                 relationship.setRelatedLink("http://localhost:18080/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER.toString() + "/lcpCloudRegion/")
1701                 relationshipList.getRelationship().add(relationship)
1702                 relationship.setRelatedTo("tenant")
1703                 relationship.setRelatedLink("http://localhost:18080/cloud-regions/cloud-region/" + Defaults.CLOUD_OWNER.toString() + "/lcpCloudRegion/tenants/tenant/tenantId/")
1704                 relationshipList.getRelationship().add(relationship)
1705
1706                 l3Network.setRelationshipList(relationshipList)
1707                 l3Network
1708         }
1709
1710
1711                 @Test
1712                 public void callRESTQueryAAICloudRegion30_200() {
1713
1714                         println "************ callRESTQueryAAICloudRegion30_200 ************* "
1715
1716                         WireMock.reset();
1717                         MockGetNetworkCloudRegion("DeleteNetworkV2/cloudRegion30_AAIResponse_Success.xml", "RDM2WAGPLCP");
1718
1719                         ExecutionEntity mockExecution = setupMock()
1720                         when(mockExecution.getVariable("prefix")).thenReturn(Prefix)
1721                         when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest)
1722                         when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("RDM2WAGPLCP")
1723                         when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090")
1724                         // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner")
1725                         when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8")
1726                         when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner")
1727                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1728                         when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/')
1729                         when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
1730                         when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC")
1731
1732                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1733                         DoDeleteNetworkInstance.callRESTQueryAAICloudRegion(mockExecution)
1734
1735                         verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix)
1736                         verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200")
1737
1738                 }
1739
1740                 @Test
1741                 //@Ignore
1742                 public void callRESTQueryAAICloudRegion_NotFound() {
1743
1744                         println "************ callRESTQueryAAICloudRegion_NotFound ************* "
1745
1746                         WireMock.reset();
1747                         MockGetNetworkCloudRegion_404("MDTWNJ21");
1748
1749                         ExecutionEntity mockExecution = setupMock()
1750                         when(mockExecution.getVariable("prefix")).thenReturn(Prefix)
1751                         when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(vnfRequestCloudRegionNotFound)
1752                         when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("MDTWNJ21")
1753                         when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090")
1754                         // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner")
1755                         when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8")
1756                         when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner")
1757                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1758                         when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/')
1759                         when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
1760                         when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC")
1761
1762                         // preProcessRequest(DelegateExecution execution)
1763                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1764                         DoDeleteNetworkInstance.callRESTQueryAAICloudRegion(mockExecution)
1765
1766                         verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix)
1767                         verify(mockExecution).setVariable(Prefix + "cloudRegionPo", "MDTWNJ21")
1768                         verify(mockExecution).setVariable(Prefix + "cloudRegionSdnc", "AAIAIC25")
1769
1770                 }
1771
1772                 @Test
1773                 //@Ignore
1774                 public void callRESTQueryAAICloudRegion25_200() {
1775
1776                         println "************ callRESTQueryAAICloudRegion25_200 ************* "
1777
1778                         WireMock.reset();
1779                         MockGetNetworkCloudRegion("DeleteNetworkV2/cloudRegion25_AAIResponse_Success.xml", "RDM2WAGPLCP");
1780
1781                         ExecutionEntity mockExecution = setupMock()
1782                         when(mockExecution.getVariable("prefix")).thenReturn(Prefix)
1783                         when(mockExecution.getVariable(Prefix + "networkInputs")).thenReturn(expectedNetworkRequest)
1784                         when(mockExecution.getVariable(Prefix + "lcpCloudRegion")).thenReturn("RDM2WAGPLCP")
1785                         when(mockExecution.getVariable("aai.endpoint")).thenReturn("http://localhost:8090")
1786                         // old: when(mockExecution.getVariable("mso.workflow.default.aai.cloud-infrastructure.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner")
1787                         when(mockExecution.getVariable("mso.workflow.global.default.aai.version")).thenReturn("8")
1788                         when(mockExecution.getVariable("mso.workflow.default.aai.v8.cloud-region.uri")).thenReturn("/aai/v8/cloud-infrastructure/cloud-regions/cloud-region/CloudOwner")
1789                         //
1790                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1791                         when(mockExecution.getVariable("mso.workflow.global.default.aai.namespace")).thenReturn('http://org.openecomp.aai.inventory/')
1792                         when(mockExecution.getVariable("mso.msoKey")).thenReturn("07a7159d3bf51a0e53be7a8f89699be7")
1793                         when(mockExecution.getVariable("aai.auth")).thenReturn("757A94191D685FD2092AC1490730A4FC")
1794
1795                         // preProcessRequest(DelegateExecution execution)
1796                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1797                         DoDeleteNetworkInstance.callRESTQueryAAICloudRegion(mockExecution)
1798
1799                         verify(mockExecution, atLeast(1)).setVariable("prefix", Prefix)         
1800                         verify(mockExecution, atLeast(2)).setVariable(Prefix + "queryCloudRegionReturnCode", "200")
1801
1802                 }
1803
1804
1805                 @Test
1806                 //@Ignore
1807                 public void validateNetworkResponse() {
1808
1809                         println "************ validateNetworkResponse ************* "
1810
1811                         ExecutionEntity mockExecution = setupMock()
1812                         // Initialize prerequisite variables
1813                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1814                         when(mockExecution.getVariable(Prefix + "deleteNetworkResponse")).thenReturn(deleteNetworkResponse)
1815                         when(mockExecution.getVariable(Prefix + "networkReturnCode")).thenReturn('200')
1816
1817                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1818                         DoDeleteNetworkInstance.validateNetworkResponse(mockExecution)
1819
1820                         verify(mockExecution).setVariable("prefix", Prefix)
1821                         //verify(mockExecution).setVariable(Prefix + "rollbackNetworkRequest", null)
1822
1823                 }
1824
1825
1826                 @Test
1827                 //@Ignore
1828                 public void validateSDNCResponse_200() {
1829
1830                         println "************ validateSDNCResponse ************* "
1831                         ExecutionEntity mockExecution = setupMock()
1832                         // Initialize prerequisite variables
1833                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1834                         when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("200")
1835                         when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
1836
1837                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1838                         try {
1839                                 DoDeleteNetworkInstance.validateSDNCResponse(mockExecution, sdncAdapterWorkflowResponse)
1840                         } catch (Exception ex) {
1841                             println " Graceful Exit - " + ex.getMessage()
1842                         }
1843
1844                 }
1845
1846                 @Test
1847                 //@Ignore
1848                 public void validateSDNCResponse_404() {
1849
1850                         println "************ validateSDNCResponse ************* "
1851
1852                         WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from SNDC Adapter: HTTP Status 404.")
1853
1854                         ExecutionEntity mockExecution = setupMock()
1855                         // Initialize prerequisite variables
1856                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1857                         when(mockExecution.getVariable(Prefix + "sdncReturnCode")).thenReturn("404")
1858                         when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(false)
1859                         when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException)
1860
1861                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1862                         try {
1863                                 DoDeleteNetworkInstance.validateSDNCResponse(mockExecution)
1864                         } catch (Exception ex) {
1865                                 println " Graceful Exit - " + ex.getMessage()
1866                         }
1867
1868                 }
1869
1870                 @Test
1871                 //@Ignore
1872                 public void validateRpcSDNCDeactivateResponse() {
1873
1874                         println "************ validateRpcSDNCDeactivateResponse ************* "
1875
1876                         ExecutionEntity mockExecution = setupMock()
1877                         // Initialize prerequisite variables
1878                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1879                         when(mockExecution.getVariable(Prefix + "deactivateSDNCResponse")).thenReturn(sdncAdapterWorkflowResponse)
1880                         when(mockExecution.getVariable("prefix")).thenReturn(Prefix + "")
1881                         when(mockExecution.getVariable("SDNCA_SuccessIndicator")).thenReturn(true)
1882                         when(mockExecution.getVariable(Prefix + "deactivateSDNCReturnCode")).thenReturn("200")
1883
1884                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1885                         try {
1886                           DoDeleteNetworkInstance.validateRpcSDNCDeactivateResponse(mockExecution)
1887                           verify(mockExecution).setVariable(Prefix + "isSdncDeactivateRollbackNeeded", true)
1888
1889                         } catch (Exception ex) {
1890                                 println " Graceful Exit - " + ex.getMessage()
1891                         }
1892                         //MockitoDebuggerImpl debugger = new MockitoDebuggerImpl()
1893                         //debugger.printInvocations(mockExecution)
1894
1895                         //verify(mockExecution).setVariable(Prefix + "isSdncRollbackNeeded", true)
1896
1897                 }
1898
1899                 @Test
1900                 @Ignore
1901                 public void postProcessResponse() {
1902
1903                         println "************ postProcessResponse ************* "
1904                         ExecutionEntity mockExecution = setupMock()
1905                         // Initialize prerequisite variables
1906                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1907                         when(mockExecution.getVariable(Prefix + "source")).thenReturn("PORTAL")
1908                         when(mockExecution.getVariable(Prefix + "isException")).thenReturn(false)
1909
1910                         // postProcessResponse(DelegateExecution execution)
1911                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1912                         DoDeleteNetworkInstance.postProcessResponse(mockExecution)
1913
1914                         verify(mockExecution).setVariable("prefix", Prefix)
1915                         verify(mockExecution).setVariable(Prefix + "Success", true)
1916
1917                 }
1918
1919                 @Test
1920                 //@Ignore
1921                 public void prepareRollbackData() {
1922
1923                         println "************ prepareRollbackData() ************* "
1924
1925
1926
1927                         WorkflowException workflowException = new WorkflowException("DoCreateNetworkInstance", 2500, "Received error from Network Adapter: JBWEB000065: HTTP Status 500.")
1928
1929                         ExecutionEntity mockExecution = mock(ExecutionEntity.class)
1930                         // Initialize prerequisite variables
1931                         when(mockExecution.getVariable("isDebugLogEnabled")).thenReturn("true")
1932                         when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(deleteRollbackNetworkRequest)
1933                         //when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn(null)
1934                         //when(mockExecution.getVariable(Prefix + "rollbackNetworkRequest")).thenReturn("")
1935                         when(mockExecution.getVariable(Prefix + "rollbackDeactivateSDNCRequest")).thenReturn(sdncAdapaterDeactivateRollback)
1936                         when(mockExecution.getVariable("WorkflowException")).thenReturn(workflowException)
1937
1938                         // preProcessRequest(DelegateExecution execution)
1939                         DoDeleteNetworkInstance DoDeleteNetworkInstance = new DoDeleteNetworkInstance()
1940                         DoDeleteNetworkInstance.prepareRollbackData(mockExecution)
1941
1942 //                      verify(mockExecution).getVariable("isDebugLogEnabled")
1943                         verify(mockExecution).setVariable("prefix", Prefix)
1944
1945                 }
1946
1947
1948                 private ExecutionEntity setupMock() {
1949
1950                         ProcessDefinition mockProcessDefinition = mock(ProcessDefinition.class)
1951                         when(mockProcessDefinition.getKey()).thenReturn("DoDeleteNetworkInstance")
1952                         RepositoryService mockRepositoryService = mock(RepositoryService.class)
1953                         when(mockRepositoryService.getProcessDefinition()).thenReturn(mockProcessDefinition)
1954                         when(mockRepositoryService.getProcessDefinition().getKey()).thenReturn("DoDeleteNetworkInstance")
1955                         when(mockRepositoryService.getProcessDefinition().getId()).thenReturn("100")
1956                         ProcessEngineServices mockProcessEngineServices = mock(ProcessEngineServices.class)
1957                         when(mockProcessEngineServices.getRepositoryService()).thenReturn(mockRepositoryService)
1958
1959                         ExecutionEntity mockExecution = mock(ExecutionEntity.class)
1960                         // Initialize prerequisite variables
1961
1962                         when(mockExecution.getId()).thenReturn("100")
1963                         when(mockExecution.getProcessDefinitionId()).thenReturn("DoDeleteNetworkInstance")
1964                         when(mockExecution.getProcessInstanceId()).thenReturn("DoDeleteNetworkInstance")
1965                         when(mockExecution.getProcessEngineServices()).thenReturn(mockProcessEngineServices)
1966                         when(mockExecution.getProcessEngineServices().getRepositoryService().getProcessDefinition(mockExecution.getProcessDefinitionId())).thenReturn(mockProcessDefinition)
1967
1968                         return mockExecution
1969
1970                 }
1971
1972 }