4d7a127a85f2935b6e9862636923df93a01943bf
[so.git] / bpmn / mso-infrastructure-bpmn / src / test / java / org / onap / so / bpmn / common / OofHomingIT.java
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.common;
22
23 import static org.junit.Assert.assertEquals;
24 import static org.junit.Assert.assertNull;
25 import static org.onap.so.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogDataByModelUuid;
26 import static org.onap.so.bpmn.mock.StubResponseOof.mockOof;
27 import static org.onap.so.bpmn.mock.StubResponseOof.mockOof_500;
28
29 import java.io.IOException;
30 import java.util.ArrayList;
31 import java.util.HashMap;
32 import java.util.List;
33 import java.util.Map;
34 import java.util.UUID;
35
36 import org.junit.Ignore;
37 import org.junit.Test;
38 import org.onap.so.BaseIntegrationTest;
39 import org.onap.so.bpmn.core.WorkflowException;
40 import org.onap.so.bpmn.core.domain.AllottedResource;
41 import org.onap.so.bpmn.core.domain.HomingSolution;
42 import org.onap.so.bpmn.core.domain.ModelInfo;
43 import org.onap.so.bpmn.core.domain.NetworkResource;
44 import org.onap.so.bpmn.core.domain.Resource;
45 import org.onap.so.bpmn.core.domain.ServiceDecomposition;
46 import org.onap.so.bpmn.core.domain.ServiceInstance;
47 import org.onap.so.bpmn.core.domain.VnfResource;
48 import org.onap.so.bpmn.mock.FileUtil;
49
50
51 /**
52  * Test the OOF Homing subflow building block.
53  */
54 @Ignore
55 public class OofHomingIT extends BaseIntegrationTest {
56
57     ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
58     String subscriber = "";
59     String subscriber2 = "";
60
61     private final CallbackSet callbacks = new CallbackSet();
62
63     public OofHomingIT() throws IOException {
64         String oofCallback = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallbackInfraVnf.json");
65         String oofCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf.json");
66         String oofCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/oofCallback2AR1Vnf2Net.json");
67
68         String oofCallbackNoSolution = FileUtil.
69                 readResourceFile("__files/BuildingBlocks/oofCallbackNoSolutionFound.json");
70         String oofCallbackPolicyException = FileUtil.
71                 readResourceFile("__files/BuildingBlocks/oofCallbackPolicyException.json");
72         String oofCallbackServiceException = FileUtil.
73                 readResourceFile("__files/BuildingBlocks/oofCallbackServiceException.json");
74
75         callbacks.put("oof", JSON, "oofResponse", oofCallback);
76         callbacks.put("oof2", JSON, "oofResponse", oofCallback2);
77         callbacks.put("oof3", JSON, "oofResponse", oofCallback3);
78         callbacks.put("oofNoSol", JSON, "oofResponse", oofCallbackNoSolution);
79         callbacks.put("oofPolicyEx", JSON, "oofResponse", oofCallbackPolicyException);
80         callbacks.put("oofServiceEx", JSON, "oofResponse", oofCallbackServiceException);
81
82         // Service Model
83         ModelInfo sModel = new ModelInfo();
84         sModel.setModelCustomizationName("testModelCustomizationName");
85         sModel.setModelInstanceName("testModelInstanceName");
86         sModel.setModelInvariantUuid("testModelInvariantId");
87         sModel.setModelName("testModelName");
88         sModel.setModelUuid("testModelUuid");
89         sModel.setModelVersion("testModelVersion");
90         // Service Instance
91         ServiceInstance si = new ServiceInstance();
92         si.setInstanceId("testServiceInstanceId123");
93         // Allotted Resources
94         List<AllottedResource> arList = new ArrayList<AllottedResource>();
95         AllottedResource ar = new AllottedResource();
96         ar.setResourceId("testResourceIdAR");
97         ar.setNfFunction("testARFunctionName");
98         ModelInfo arModel = new ModelInfo();
99         arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
100         arModel.setModelInvariantUuid("testModelInvariantIdAR");
101         arModel.setModelName("testModelNameAR");
102         arModel.setModelVersion("testModelVersionAR");
103         arModel.setModelUuid("testARModelUuid");
104         arModel.setModelType("testModelTypeAR");
105         ar.setModelInfo(arModel);
106         AllottedResource ar2 = new AllottedResource();
107         ar2.setResourceId("testResourceIdAR2");
108         ar2.setNfFunction("testAR2FunctionName");
109         ModelInfo arModel2 = new ModelInfo();
110         arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
111         arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
112         arModel2.setModelName("testModelNameAR2");
113         arModel2.setModelVersion("testModelVersionAR2");
114         arModel2.setModelUuid("testAr2ModelUuid");
115         arModel2.setModelType("testModelTypeAR2");
116         ar2.setModelInfo(arModel2);
117         arList.add(ar);
118         arList.add(ar2);
119         // Vnfs
120         List<VnfResource> vnfList = new ArrayList<VnfResource>();
121         VnfResource vnf = new VnfResource();
122         vnf.setResourceId("testResourceIdVNF");
123         vnf.setNfFunction("testVnfFunctionName");
124         vnf.getHomingSolution().setOofDirectives(
125                 "{ \n" +
126                         "      \"directives\":[ \n" +
127                         "         { \n" +
128                         "            \"vnfc_directives\":[ \n" +
129                         "               { \n" +
130                         "                  \"vnfc_id\":\"<ID of VNFC>\",\n" +
131                         "                  \"directives\":[ \n" +
132                         "                     { \n" +
133                         "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
134                         "                        \"attributes\":[ \n" +
135                         "                           { \n" +
136                         "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
137                         "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
138                         "                           }\n" +
139                         "                        ]\n" +
140                         "                     },\n" +
141                         "                     { \n" +
142                         "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
143                         "                        \"attributes\":[ \n" +
144                         "                           { \n" +
145                         "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
146                         "                              \"attribute_value\":\"<value such as direct/normal>\"\n" +
147                         "                           },\n" +
148                         "                           { \n" +
149                         "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
150                         "                              \"attribute_value\":\"<value such as physnet>\"\n" +
151                         "                           }\n" +
152                         "                        ]\n" +
153                         "                     }\n" +
154                         "                  ]\n" +
155                         "               }\n" +
156                         "            ]\n" +
157                         "         },\n" +
158                         "         { \n" +
159                         "            \"vnf_directives\":{ \n" +
160                         "               \"directives\":[ \n" +
161                         "                  { \n" +
162                         "                     \"directive_name\":\"<Name of directive>\",\n" +
163                         "                     \"attributes\":[ \n" +
164                         "                        { \n" +
165                         "                           \"attribute_name\":\"<name of attribute>\",\n" +
166                         "                           \"attribute_value\":\"<value>\"\n" +
167                         "                        }\n" +
168                         "                     ]\n" +
169                         "                  },\n" +
170                         "                  { \n" +
171                         "                     \"directive_name\":\"<Name of directive>\",\n" +
172                         "                     \"attributes\":[ \n" +
173                         "                        { \n" +
174                         "                           \"attribute_name\":\"<name of attribute>\",\n" +
175                         "                           \"attribute_value\":\"<value >\"\n" +
176                         "                        },\n" +
177                         "                        { \n" +
178                         "                           \"attribute_name\":\"<name of attribute>\",\n" +
179                         "                           \"attribute_value\":\"<value >\"\n" +
180                         "                        }\n" +
181                         "                     ]\n" +
182                         "                  }\n" +
183                         "               ]\n" +
184                         "            }\n" +
185                         "         }\n" +
186                         "      ]\n" +
187                         "   },\n" +
188                         "   \"sdnc_directives\":{ \n" +
189                         "      \"directives\":[ \n" +
190                         "         { \n" +
191                         "            \"vnfc_directives\":[ \n" +
192                         "               { \n" +
193                         "                  \"vnfc_id\":\"<ID of VNFC>\",\n" +
194                         "                  \"directives\":[ \n" +
195                         "                     { \n" +
196                         "                        \"directive_name\":\"<Name of directive,example flavor_directive>\",\n" +
197                         "                        \"attributes\":[ \n" +
198                         "                           { \n" +
199                         "                              \"attribute_name\":\"<name of attribute, such as flavor label>\",\n" +
200                         "                              \"attribute_value\":\"<value such as cloud specific flavor>\"\n" +
201                         "                           }\n" +
202                         "                        ]\n" +
203                         "                     },\n" +
204                         "                     { \n" +
205                         "                        \"directive_name\":\"<Name of directive,example vnic-info>\",\n" +
206                         "                        \"attributes\":[ \n" +
207                         "                           { \n" +
208                         "                              \"attribute_name\":\"<name of attribute, such as vnic-type>\",\n" +
209                         "                              \"attribute_value\":\"<value such as direct/normal>\"\n" +
210                         "                           },\n" +
211                         "                           { \n" +
212                         "                              \"attribute_name\":\"<name of attribute, such as provider netweork>\",\n" +
213                         "                              \"attribute_value\":\"<value such as physnet>\"\n" +
214                         "                           }\n" +
215                         "                        ]\n" +
216                         "                     }\n" +
217                         "                  ]\n" +
218                         "               }\n" +
219                         "            ]\n" +
220                         "         },\n" +
221                         "         { \n" +
222                         "            \"vnf_directives\":{ \n" +
223                         "               \"directives\":[ \n" +
224                         "                  { \n" +
225                         "                     \"directive_name\":\"<Name of directive>\",\n" +
226                         "                     \"attributes\":[ \n" +
227                         "                        { \n" +
228                         "                           \"attribute_name\":\"<name of attribute>\",\n" +
229                         "                           \"attribute_value\":\"<value>\"\n" +
230                         "                        }\n" +
231                         "                     ]\n" +
232                         "                  },\n" +
233                         "                  { \n" +
234                         "                     \"directive_name\":\"<Name of directive>\",\n" +
235                         "                     \"attributes\":[ \n" +
236                         "                        { \n" +
237                         "                           \"attribute_name\":\"<name of attribute>\",\n" +
238                         "                           \"attribute_value\":\"<value >\"\n" +
239                         "                        },\n" +
240                         "                        { \n" +
241                         "                           \"attribute_name\":\"<name of attribute>\",\n" +
242                         "                           \"attribute_value\":\"<value >\"\n" +
243                         "                        }\n" +
244                         "                     ]\n" +
245                         "                  }\n" +
246                         "               ]\n" +
247                         "            }\n" +
248                         "         }\n" +
249                         "      ]\n" +
250                         "   }");
251         ModelInfo vnfModel = new ModelInfo();
252         vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
253         vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
254         vnfModel.setModelName("testModelNameVNF");
255         vnfModel.setModelVersion("testModelVersionVNF");
256         vnfModel.setModelUuid("testVnfModelUuid");
257         vnfModel.setModelType("testModelTypeVNF");
258         vnf.setModelInfo(vnfModel);
259         vnfList.add(vnf);
260         System.out.println("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString());
261         serviceDecomposition.setModelInfo(sModel);
262         serviceDecomposition.setAllottedResources(arList);
263         serviceDecomposition.setVnfResources(vnfList);
264         serviceDecomposition.setServiceInstance(si);
265
266         // Subscriber
267         subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
268         subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
269     }
270
271     @Test    
272     public void testHoming_success_2AR1Vnf() throws Exception {
273
274         mockOof(wireMockServer);
275
276         String businessKey = UUID.randomUUID().toString();
277         Map<String, Object> variables = new HashMap<>();
278         setVariables(variables);
279
280         invokeSubProcess("Homing", businessKey, variables);
281
282         injectWorkflowMessages(callbacks, "oof2");
283
284         waitForProcessEnd(businessKey, 10000);
285
286         //Get Variables
287         WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
288                 "WorkflowException");
289         ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
290                 "serviceDecomposition");
291         String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
292
293         Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
294         HomingSolution resourceARHoming = resourceAR.getHomingSolution();
295         Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
296         HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
297         Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
298         HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
299         String resourceARHomingString = resourceARHoming.toString();
300         resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
301         String resourceARHoming2String = resourceARHoming2.toString();
302         resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
303         String resourceVNFHomingString = resourceVNFHoming.toString();
304         resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
305         expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
306
307         assertNull(workflowException);
308         assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
309                 resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
310                 "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
311                 "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
312                 resourceARHomingString);
313         assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
314                 resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
315                 null, null), resourceARHoming2String);
316         assertEquals(homingSolutionCloud("cloud","aic", "testCloudRegionId3",
317                 true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
318                 "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
319                 resourceVNFHomingString);
320         assertEquals(verifyOofRequest(), expectedOofRequest);
321     }
322
323     @Test  
324     public void testHoming_success_2AR1Vnf2Net() throws Exception {
325
326         mockOof(wireMockServer);
327
328         String businessKey = UUID.randomUUID().toString();
329         Map<String, Object> variables = new HashMap<>();
330         setVariables2(variables);
331
332         invokeSubProcess("Homing", businessKey, variables);
333
334         injectWorkflowMessages(callbacks, "oof3");
335
336         waitForProcessEnd(businessKey, 10000);
337
338         //Get Variables
339         WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
340                 "WorkflowException");
341         ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
342                 "serviceDecomposition");
343         String expectedOofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
344
345         Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
346         HomingSolution resourceARHoming = resourceAR.getHomingSolution();
347         Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
348         HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
349         Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
350         HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
351         Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
352         HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
353         Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
354         HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();
355
356         String resourceARHomingString = resourceARHoming.toString();
357         resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
358         String resourceARHoming2String = resourceARHoming2.toString();
359         resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
360         String resourceVNFHomingString = resourceVNFHoming.toString();
361         resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
362         String resourceNetHomingString = resourceNetHoming.toString();
363         resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
364         String resourceNetHoming2String = resourceNetHoming2.toString();
365         resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
366         expectedOofRequest = expectedOofRequest.replaceAll("\\s+", "");
367
368
369         assertNull(workflowException);
370         assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
371                 resourceARHoming.getVnf().getResourceId(),"aic", "dfwtx",
372                 "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
373                 "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
374                 resourceARHomingString);
375         assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
376                 resourceARHoming2.getVnf().getResourceId(),
377                 "aic", "testCloudRegionId2",
378                 null, null), resourceARHoming2String);
379         assertEquals(homingSolutionCloud("cloud","aic",
380                 "testCloudRegionId3",
381                 true, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
382                 "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
383                 resourceVNFHomingString);
384         assertEquals(homingSolutionService("service", "testServiceInstanceIdNet",
385                 "testVnfHostNameNet", resourceNetHoming.getVnf().getResourceId(),"aic",
386                 "testCloudRegionIdNet",
387                 null, null), resourceNetHomingString);
388         assertEquals(homingSolutionCloud("cloud", "aic",
389                 "testCloudRegionIdNet2",
390                 false, "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"",
391                 "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""),
392                 resourceNetHoming2String);
393         assertEquals(verifyOofRequest(), expectedOofRequest);
394
395     }
396
397     @Test
398     public void testHoming_success_vnfResourceList() throws Exception {
399
400         // Create a Service Decomposition
401         MockGetServiceResourcesCatalogDataByModelUuid(wireMockServer, "2f7f309d-c842-4644-a2e4-34167be5eeb4",
402                 "/BuildingBlocks/oofCatalogResp.json");
403         String busKey = UUID.randomUUID().toString();
404         Map<String, Object> vars = new HashMap<>();
405         setVariablesForServiceDecomposition(vars, "testRequestId123",
406                 "ff5256d2-5a33-55df-13ab-12abad84e7ff");
407         invokeSubProcess("DecomposeService", busKey, vars);
408
409         ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
410         System.out.println("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd);
411         List<VnfResource> vnfResourceList = sd.getVnfResources();
412         vnfResourceList.get(0).setResourceId("test-resource-id-000");
413
414         // Invoke Homing
415
416         mockOof(wireMockServer);
417
418         String businessKey = UUID.randomUUID().toString();
419         Map<String, Object> variables = new HashMap<>();
420         variables.put("homingService", "oof");
421         variables.put("isDebugLogEnabled", "true");
422         variables.put("msoRequestId", "testRequestId");
423         variables.put("serviceInstanceId", "testServiceInstanceId");
424         variables.put("serviceDecomposition", sd);
425         variables.put("subscriberInfo", subscriber2);
426         HashMap customerLocation = new HashMap<String, Object>();
427         customerLocation.put("customerLatitude", "32.89748");
428         customerLocation.put("customerLongitude", "-97.040443");
429         customerLocation.put("customerName", "xyz");
430         variables.put("customerLatitude", "32.89748");
431         variables.put("customerLongitude", "-97.040443");
432         variables.put("customerName", "xyz");
433         variables.put("customerLocation", customerLocation);
434         variables.put("cloudOwner", "amazon");
435         variables.put("cloudRegionId", "TNZED");
436
437         invokeSubProcess("Homing", businessKey, variables);
438         injectWorkflowMessages(callbacks, "oof3");
439         waitForProcessEnd(businessKey, 10000);
440
441         //Get Variables
442
443         WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
444                 "WorkflowException");
445         ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey,
446                 "serviceDecomposition");
447         System.out.println("serviceDecompositionExp is: " + serviceDecompositionExp);
448
449         Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
450         System.out.println("resourceVnf is: " + resourceVnf);
451         HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();
452
453         String resourceVnfHomingString = resourceVnfHoming.toString();
454         System.out.println("resourceVnfHomingString is: " + resourceVnfHomingString);
455         resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");
456         System.out.println("Now resourceVnfHomingString is: " + resourceVnfHomingString);
457
458         assertNull(workflowException);
459
460         //Verify request
461         String oofRequest = (String) getVariableFromHistory(businessKey, "oofRequest");
462         System.out.println("oofRequest is: " + oofRequest);
463         assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/oofRequest_infravnf").
464                 replaceAll("\n", "").replaceAll("\r", "").
465                 replaceAll("\t", ""), oofRequest.replaceAll("\n", "").
466                 replaceAll("\r", "").replaceAll("\t", ""));
467
468         //System.out.println("resourceVnfHoming.getVnf().getResourceId() is: " + resourceVnfHoming.getVnf().getResourceId());
469
470         assertEquals(homingSolutionService("service", "service-instance-01234",
471                 "MDTNJ01", "test-resource-id-000","CloudOwner",
472                 "mtmnj1a",
473                 "\"f1d563e8-e714-4393-8f99-cc480144a05e\"," +
474                         " \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
475                 "\"s1d563e8-e714-4393-8f99-cc480144a05e\"," +
476                         " \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
477     }
478
479     @Test   
480     public void testHoming_success_existingLicense() throws Exception {
481
482         mockOof(wireMockServer);
483
484         String businessKey = UUID.randomUUID().toString();
485         Map<String, Object> variables = new HashMap<String, Object>();
486         setVariablesExistingLicense(variables);
487
488         invokeSubProcess("Homing", businessKey, variables);
489
490         injectWorkflowMessages(callbacks, "sniro");
491
492         waitForProcessEnd(businessKey, 10000);
493
494         //Get Variables
495         WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
496         ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
497         String oofRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
498
499         Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
500         HomingSolution resourceARHoming = (HomingSolution) resourceAR.getHomingSolution();
501         Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
502         HomingSolution resourceARHoming2 = (HomingSolution) resourceAR2.getHomingSolution();
503         Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
504         HomingSolution resourceVNFHoming = (HomingSolution) resourceVNF.getHomingSolution();
505         String resourceARHomingString = resourceARHoming.toString();
506         resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
507         String resourceARHoming2String = resourceARHoming2.toString();
508         resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
509         String resourceVNFHomingString = resourceVNFHoming.toString();
510         resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
511         oofRequest = oofRequest.replaceAll("\\s+", "");
512
513         assertNull(workflowException);
514         assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01",
515                 "aic", "dfwtx", "KDTNJ01",
516                 "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"",
517                 "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""),
518                 resourceARHomingString);
519         assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2",
520                 resourceARHoming2.getVnf().getResourceId(),"aic", "testCloudRegionId2",
521                 null, null), resourceARHoming2String);
522         assertEquals(homingSolutionCloud("cloud", "aic",
523                 "testCloudRegionId3",
524                 false, "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"",
525                 "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""),
526                 resourceVNFHomingString);
527         assertEquals(verifyOofRequestExistingLicense(), oofRequest);
528
529     }
530
531     @Test  
532     public void testHoming_error_inputVariable() throws Exception {
533
534         String businessKey = UUID.randomUUID().toString();
535         Map<String, Object> variables = new HashMap<>();
536         setVariables3(variables);
537
538         invokeSubProcess("Homing", businessKey, variables);
539
540         waitForProcessEnd(businessKey, 10000);
541
542         //Get Variables
543         WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
544                 "WorkflowException");
545
546         assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required " +
547                 "input variable is missing or null,workStep=*]", workflowException.toString());
548     }
549
550     @Test  
551     public void testHoming_error_badResponse() throws Exception {
552         mockOof_500(wireMockServer);
553
554         String businessKey = UUID.randomUUID().toString();
555         Map<String, Object> variables = new HashMap<>();
556         setVariables(variables);
557
558         invokeSubProcess("Homing", businessKey, variables);
559
560         waitForProcessEnd(businessKey, 10000);
561
562         //Get Variables
563         WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
564                 "WorkflowException");
565
566         assertEquals("WorkflowException[processKey=Homing,errorCode=401,errorMessage=Internal Error - BasicAuth value null,workStep=*]", workflowException.toString());
567     }
568
569     @Test   
570     public void testHoming_error_oofNoSolution() throws Exception {
571         mockOof(wireMockServer);
572
573         String businessKey = UUID.randomUUID().toString();
574         Map<String, Object> variables = new HashMap<>();
575         setVariables(variables);
576
577         invokeSubProcess("Homing", businessKey, variables);
578
579         injectWorkflowMessages(callbacks, "oofNoSol");
580
581         waitForProcessEnd(businessKey, 10000);
582
583         //Get Variables
584         WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
585                 "WorkflowException");
586         Boolean errorMatch = workflowException.toString().contains("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
587                         "Response contains error: Unable to find any candidate for demand *** Response:");
588         assert(errorMatch);
589     }
590
591     @Test  
592     public void testHoming_error_oofPolicyException() throws Exception {
593         mockOof(wireMockServer);
594
595         String businessKey = UUID.randomUUID().toString();
596         Map<String, Object> variables = new HashMap<>();
597         setVariables(variables);
598
599         invokeSubProcess("Homing", businessKey, variables);
600
601         injectWorkflowMessages(callbacks, "oofPolicyEx");
602
603         waitForProcessEnd(businessKey, 10000);
604
605         //Get Variables
606         WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
607                 "WorkflowException");
608
609         assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
610                 "Response contains a Request Error Policy Exception: Message content size exceeds the allowable " +
611                 "limit]", workflowException.toString());
612     }
613
614     @Test   
615     public void testHoming_error_oofServiceException() throws Exception {
616         mockOof(wireMockServer);
617
618         String businessKey = UUID.randomUUID().toString();
619         Map<String, Object> variables = new HashMap<>();
620         setVariables(variables);
621
622         invokeSubProcess("Homing", businessKey, variables);
623         injectWorkflowMessages(callbacks, "oofServiceEx");
624         waitForProcessEnd(businessKey, 10000);
625
626         //Get Variables
627         WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey,
628                 "WorkflowException");
629
630         assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=OOF Async Callback " +
631                         "Response contains a Request Error Service Exception: OOF PlacementError: " +
632                         "requests.exceptions.HTTPError: 404 Client Error: Not Found for " +
633                         "url: http://192.168.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]",
634                 workflowException.toString());
635     }
636
637
638     private void setVariables(Map<String, Object> variables) {
639         variables.put("homingService", "oof");
640         HashMap customerLocation = new HashMap<String, Object>();
641         customerLocation.put("customerLatitude", "32.89748");
642         customerLocation.put("customerLongitude", "-97.040443");
643         customerLocation.put("customerName", "xyz");
644         variables.put("customerLatitude", "32.89748");
645         variables.put("customerLongitude", "-97.040443");
646         variables.put("customerName", "xyz");
647         variables.put("customerLocation", customerLocation);
648         variables.put("cloudOwner", "amazon");
649         variables.put("cloudRegionId", "TNZED");
650         variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
651         variables.put("vgMuxInfraModelId", "testArModelUuid");
652         //      variables.put("mso-request-id", "testRequestId");
653         variables.put("msoRequestId", "testRequestId");
654         variables.put("serviceInstanceId", "testServiceInstanceId123");
655         variables.put("serviceInstanceName", "testServiceName");
656         variables.put("serviceDecomposition", serviceDecomposition);
657         variables.put("subscriberInfo", subscriber2);
658     }
659
660     private void setVariables2(Map<String, Object> variables) {
661         List<NetworkResource> netList = new ArrayList<NetworkResource>();
662         NetworkResource net = new NetworkResource();
663         net.setResourceId("testResourceIdNet");
664         ModelInfo netModel = new ModelInfo();
665         netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
666         netModel.setModelInvariantUuid("testModelInvariantIdNet");
667         netModel.setModelName("testModelNameNet");
668         netModel.setModelVersion("testModelVersionNet");
669         net.setModelInfo(netModel);
670         netList.add(net);
671         NetworkResource net2 = new NetworkResource();
672         net2.setResourceId("testResourceIdNet2");
673         ModelInfo netModel2 = new ModelInfo();
674         netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
675         netModel2.setModelCustomizationName("testModelCustomizationNameNet2");
676         netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
677         netModel2.setModelName("testModelNameNet2");
678         netModel2.setModelVersion("testModelVersionNet2");
679         net2.setModelInfo(netModel2);
680         netList.add(net2);
681         serviceDecomposition.setNetworkResources(netList);
682
683         variables.put("homingService", "oof");
684         HashMap customerLocation = new HashMap<String, Object>();
685         customerLocation.put("customerLatitude", "32.89748");
686         customerLocation.put("customerLongitude", "-97.040443");
687         customerLocation.put("customerName", "xyz");
688         variables.put("customerLatitude", "32.89748");
689         variables.put("customerLongitude", "-97.040443");
690         variables.put("customerName", "xyz");
691         variables.put("customerLocation", customerLocation);
692         variables.put("cloudOwner", "amazon");
693         variables.put("cloudRegionId", "TNZED");
694         variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
695         variables.put("vgMuxInfraModelId", "testArModelUuid");
696         variables.put("isDebugLogEnabled", "true");
697         variables.put("msoRequestId", "testRequestId");
698         variables.put("serviceInstanceId", "testServiceInstanceId123");
699         variables.put("serviceInstanceName", "testServiceName");
700         variables.put("serviceDecomposition", serviceDecomposition);
701         variables.put("subscriberInfo", subscriber2);
702     }
703
704     private void setVariables3(Map<String, Object> variables) {
705         variables.put("homingService", "oof");
706         HashMap customerLocation = new HashMap<String, Object>();
707         customerLocation.put("customerLatitude", "32.89748");
708         customerLocation.put("customerLongitude", "-97.040443");
709         customerLocation.put("customerName", "xyz");
710         variables.put("customerLatitude", "32.89748");
711         variables.put("customerLongitude", "-97.040443");
712         variables.put("customerName", "xyz");
713         variables.put("customerLocation", customerLocation);
714         variables.put("cloudOwner", "amazon");
715         variables.put("cloudRegionId", "TNZED");
716         variables.put("vgMuxInfraModelInvariantId", "testModelInvariantIdAR");
717         variables.put("vgMuxInfraModelId", "testArModelUuid");
718         variables.put("isDebugLogEnabled", "true");
719         //      variables.put("mso-request-id", "testRequestId");
720         variables.put("msoRequestId", "testRequestId");
721         variables.put("serviceInstanceId", "testServiceInstanceId123");
722         variables.put("serviceInstanceName", "testServiceName");
723         variables.put("serviceDecomposition", null);
724         variables.put("subscriberInfo", subscriber2);
725     }
726
727     private void setVariablesExistingLicense(Map<String, Object> variables) {
728         HomingSolution currentHomingSolution = new HomingSolution();
729         serviceDecomposition.getVnfResources().get(0).setCurrentHomingSolution(currentHomingSolution);
730         serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId1");
731         serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addEntitlementPool("testEntitlementPoolId2");
732
733         serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId1");
734         serviceDecomposition.getVnfResources().get(0).getCurrentHomingSolution().getLicense().addLicenseKeyGroup("testLicenseKeyGroupId2");
735
736         variables.put("isDebugLogEnabled", "true");
737         variables.put("msoRequestId", "testRequestId");
738         variables.put("serviceInstanceId", "testServiceInstanceId");
739         variables.put("serviceDecomposition", serviceDecomposition);
740         variables.put("subscriberInfo", subscriber2);
741
742     }
743
744     private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname,
745                                          String vnfResourceId, String cloudOwner,
746                                          String cloudRegionId, String enList,
747                                          String licenseList){
748
749         String solution = "";
750         if(enList == null){
751             solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
752                     serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
753                     cloudRegionId + "\", " + "\"vnf\" : { \"resourceId\" : \"" + vnfResourceId +
754                     "\", \"resourceType\" : \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" :" +
755                     " { }, \"rehome\" : false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { }," +
756                     " \"rehome\" : false } }";
757         }else{
758             //language=JSON
759             solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" +
760                     serviceInstanceId + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" +
761                     cloudRegionId + "\", \"vnf\" : { \"resourceId\" : \"" + vnfResourceId + "\", \"resourceType\" :" +
762                     " \"VNF\", \"resourceInstance\" : { }, \"homingSolution\" : { \"license\" : { }, \"rehome\" :" +
763                     " false }, \"vnfHostname\" : \"" + vnfHostname + "\" }, \"license\" : { \"entitlementPoolList\" :" +
764                     " [ " + enList + " ], \"licenseKeyGroupList\" : [ " + licenseList + " ] }, \"rehome\" : false } }";
765         }
766         return solution;
767     }
768
769     private String homingSolutionCloud(String type, String cloudOwner,
770                                        String cloudRegionId, Boolean flavors, String enList,
771                                        String licenseList){
772         String solution = "";
773         if(enList == null){
774             solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
775                     cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
776                     "\", \"license\" : { }, \"rehome\" : false } }";
777         } else if (flavors && enList == null){
778             solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
779                     cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
780                     "\", \"flavors\" :  [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
781                     "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
782                     "\"license\" : { }, \"rehome\" : false } }";
783         } else if (flavors) {
784             solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
785                     cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
786                     "\", \"flavors\" : [ { \"flavorLabel\" : \"flavorLabel2xxx\", \"flavor\" : \"vimFlavorxxx\" }, " +
787                     "{ \"flavorLabel\" : \"flavorLabel1xxx\", \"flavor\" : \"vimFlavorxxx\" } ], " +
788                     "\"license\" : { \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " +
789                     licenseList +  " ] }, \"rehome\" : false } }";
790         } else {
791             solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" +
792                     cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId +
793                     "\", \"license\" : { \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " +
794                     licenseList +  " ] }, \"rehome\" : false } }";
795         }
796         return solution;
797     }
798
799     private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
800         variables.put("homingService", "oof");
801         variables.put("isDebugLogEnabled", "true");
802         variables.put("mso-request-id", requestId);
803         variables.put("msoRequestId", requestId);
804         variables.put("serviceInstanceId", siId);
805         HashMap customerLocation = new HashMap<String, Object>();
806         customerLocation.put("customerLatitude", "32.89748");
807         customerLocation.put("customerLongitude", "-97.040443");
808         customerLocation.put("customerName", "xyz");
809         variables.put("customerLatitude", "32.89748");
810         variables.put("customerLongitude", "-97.040443");
811         variables.put("customerName", "xyz");
812         variables.put("customerLocation", customerLocation);
813         variables.put("cloudOwner", "amazon");
814         variables.put("cloudRegionId", "TNZED");
815
816
817         String serviceModelInfo = "{\"modelInvariantId\":\"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\",\"modelUuid\":" +
818                 "\"2f7f309d-c842-4644-a2e4-34167be5eeb4\",\"modelName\":\"vCPE Service\",\"modelVersion\":\"2.0\",}";
819         variables.put("serviceModelInfo", serviceModelInfo);
820     }
821
822     private String verifyOofRequest() {
823         String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
824                 "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/oofResponse/testRequestId\"," +
825                 "\"sourceId\":\"so\",\"requestType\":\"create\",\"numSolutions\":1,\"optimizers\":[\"placement\"]," +
826                 "\"timeout\":600},\"placementInfo\":{\"requestParameters\":{\"customerLatitude\":" +
827                 "\"32.89748\",\"customerLongitude\":\"-97.040443\",\"customerName\":\"xyz\"},\"subscriberInfo\":" +
828                 "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
829                 "\"subscriberCommonSiteId\":\"\"},\"placementDemands\":[{\"resourceModuleName\":\"testARFunctionName\"" +
830                 ",\"serviceResourceId\":\"testResourceIdAR\",\"tenantId\":" +
831                 "\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," +
832                 "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\",\"modelType\":" +
833                 "\"\",\"modelVersion\":\"\",\"modelCustomizationName\":\"\"}}," +
834                 "{\"resourceModuleName\":\"testAR2FunctionName\",\"serviceResourceId\":\"testResourceIdAR2\"," +
835                 "\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\":\"no-resourceModelInvariantId\"," +
836                 "\"modelVersionId\":\"no-resourceModelVersionId\",\"modelName\":\"\"," +
837                 "\"modelType\":\"\",\"modelVersion\":\"\"," +
838                 "\"modelCustomizationName\":\"\"}},{\"resourceModuleName\":\"testVnfFunctionName\",\"serviceResourceId\":\"" +
839                 "testResourceIdVNF\",\"tenantId\":\"\",\"resourceModelInfo\":{\"modelInvariantId\"" +
840                 ":\"testModelInvariantIdVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelName\":\"" +
841                 "testModelNameVNF\",\"modelType\":\"testModelTypeVNF\",\"modelVersion\":\"testModelVersionVNF\"" +
842                 ",\"modelCustomizationName\":\"\"}}]},\"serviceInfo\":" +
843                 "{\"serviceInstanceId\":\"testServiceInstanceId123\"," +
844                 "\"serviceName\":\"testServiceName\",\"modelInfo\":{\"modelType\":\"\",\"modelInvariantId\":" +
845                 "\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\"," +
846                 "\"modelVersion\":\"testModelVersion\",\"modelCustomizationName\":\"" +
847                 "\"}}}";
848         return request;
849     }
850
851     private String verifyOofRequestExistingLicense(){
852         String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\"," +
853                 "\"callbackUrl\":\"http://localhost:28090/workflows/messages/message/SNIROResponse/testRequestId\"," +
854                 "\"sourceId\":\"mso\",\"requestType\":\"speedchanged\",\"optimizer\":[\"placement\",\"license\"]," +
855                 "\"numSolutions\":1,\"timeout\":1800},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\"," +
856                 "\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":" +
857                 "\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":" +
858                 "{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\"," +
859                 "\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":" +
860                 "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\"," +
861                 "\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\"," +
862                 "\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\"," +
863                 "\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":" +
864                 "\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":" +
865                 "\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":" +
866                 "\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\"," +
867                 "\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\"," +
868                 "\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\"," +
869                 "\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":" +
870                 "[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\"," +
871                 "\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":" +
872                 "\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\"," +
873                 "\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\"," +
874                 "\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}," +
875                 "\"existingLicense\":[{\"entitlementPoolUUID\":[\"testEntitlementPoolId1\"," +
876                 "\"testEntitlementPoolId2\"],\"licenseKeyGroupUUID\":[\"testLicenseKeyGroupId1\"," +
877                 "\"testLicenseKeyGroupId2\"]}]}]},\"policyId\":[],\"serviceInstanceId\":" +
878                 "\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
879         return request;
880     }
881 }