aboutsummaryrefslogtreecommitdiffstats
path: root/bpmn/MSOCommonBPMN/src/test/java/org/openecomp/mso/bpmn/common/HomingTest.java
blob: bf79381b927fc318aaf8df3cac5881dd3556679f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
/*-
 * ============LICENSE_START=======================================================
 * ONAP - SO
 * ================================================================================
 * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
 * ================================================================================
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * ============LICENSE_END=========================================================
 */

/*
 * © 2014 AT&T Intellectual Property. All rights reserved. Used under license from AT&T Intellectual Property.
 */
package org.openecomp.mso.bpmn.common;

import static org.openecomp.mso.bpmn.mock.StubResponseDatabase.MockGetServiceResourcesCatalogData;
import static org.openecomp.mso.bpmn.mock.StubResponseSNIRO.*;
import static org.junit.Assert.*;

import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;

import org.camunda.bpm.engine.test.Deployment;
import org.junit.Test;

import org.openecomp.mso.bpmn.core.WorkflowException;
import org.openecomp.mso.bpmn.core.domain.*;

import org.openecomp.mso.bpmn.mock.FileUtil;
import org.openecomp.mso.bpmn.common.WorkflowTest;


/**
 * Test the Homing subflow building block.
 *
 * @author cb645j
 */
public class HomingTest extends WorkflowTest {

	ServiceDecomposition serviceDecomposition = new ServiceDecomposition();
	String subscriber = "";
	String subscriber2 = "";

	private final CallbackSet callbacks = new CallbackSet();

	public HomingTest() throws IOException {
		String sniroCallback = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf");
		String sniroCallback2 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallback2AR1Vnf2Net");
		String sniroCallback3 = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackInfraVnf");
		String sniroCallbackNoSolution = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackNoSolutionFound");
		String sniroCallbackPolicyException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackPolicyException");
		String sniroCallbackServiceException = FileUtil.readResourceFile("__files/BuildingBlocks/sniroCallbackServiceException");
		callbacks.put("sniro", JSON, "SNIROResponse", sniroCallback);
		callbacks.put("sniro2", JSON, "SNIROResponse", sniroCallback2);
		callbacks.put("sniro3", JSON, "SNIROResponse", sniroCallback3);
		callbacks.put("sniroNoSol", JSON, "SNIROResponse", sniroCallbackNoSolution);
		callbacks.put("sniroPolicyEx", JSON, "SNIROResponse", sniroCallbackPolicyException);
		callbacks.put("sniroServiceEx", JSON, "SNIROResponse", sniroCallbackServiceException);

		// Service Model
		ModelInfo sModel = new ModelInfo();
		sModel.setModelCustomizationUuid("testModelCustomizationUuid");
		sModel.setModelInstanceName("testModelInstanceName");
		sModel.setModelInvariantUuid("testModelInvariantId");
		sModel.setModelName("testModelName");
		sModel.setModelUuid("testModelUuid");
		sModel.setModelVersion("testModelVersion");
		// Service Instance
		ServiceInstance si = new ServiceInstance();
		si.setInstanceId("testServiceInstanceId123");
		// Allotted Resources
		List<AllottedResource> arList = new ArrayList<AllottedResource>();
		AllottedResource ar = new AllottedResource();
		ar.setResourceId("testResourceIdAR");
		ar.setResourceInstanceName("testARInstanceName");
		ModelInfo arModel = new ModelInfo();
		arModel.setModelCustomizationUuid("testModelCustomizationUuidAR");
		arModel.setModelInvariantUuid("testModelInvariantIdAR");
		arModel.setModelName("testModelNameAR");
		arModel.setModelVersion("testModelVersionAR");
		arModel.setModelUuid("testARModelUuid");
		arModel.setModelType("testModelTypeAR");
		ar.setModelInfo(arModel);
		AllottedResource ar2 = new AllottedResource();
		ar2.setResourceId("testResourceIdAR2");
		ar2.setResourceInstanceName("testAR2InstanceName");
		ModelInfo arModel2 = new ModelInfo();
		arModel2.setModelCustomizationUuid("testModelCustomizationUuidAR2");
		arModel2.setModelInvariantUuid("testModelInvariantIdAR2");
		arModel2.setModelName("testModelNameAR2");
		arModel2.setModelVersion("testModelVersionAR2");
		arModel2.setModelUuid("testAr2ModelUuid");
		arModel2.setModelType("testModelTypeAR2");
		ar2.setModelInfo(arModel2);
		arList.add(ar);
		arList.add(ar2);
		// Vnfs
		List<VnfResource> vnfList = new ArrayList<VnfResource>();
		VnfResource vnf = new VnfResource();
		vnf.setResourceId("testResourceIdVNF");
		vnf.setResourceInstanceName("testVnfInstanceName");
		ModelInfo vnfModel = new ModelInfo();
		vnfModel.setModelCustomizationUuid("testModelCustomizationUuidVNF");
		vnfModel.setModelInvariantUuid("testModelInvariantIdVNF");
		vnfModel.setModelName("testModelNameVNF");
		vnfModel.setModelVersion("testModelVersionVNF");
		vnfModel.setModelUuid("testVnfModelUuid");
		vnfModel.setModelType("testModelTypeVNF");
		vnf.setModelInfo(vnfModel);
		vnfList.add(vnf);
		System.out.println("SERVICE DECOMP: " + serviceDecomposition.getServiceResourcesJsonString());
		serviceDecomposition.setModelInfo(sModel);
		serviceDecomposition.setServiceAllottedResources(arList);
		serviceDecomposition.setServiceVnfs(vnfList);
		serviceDecomposition.setServiceInstance(si);

		// Subscriber
		subscriber = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberCommonSiteId\": \"DALTX0101\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
		subscriber2 = "{\"globalSubscriberId\": \"SUB12_0322_DS_1201\",\"subscriberName\": \"SUB_12_0322_DS_1201\"}";
	}

	@Test
	@Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
	public void testHoming_success_2AR1Vnf() throws Exception {

		mockSNIRO();

		String businessKey = UUID.randomUUID().toString();
		Map<String, Object> variables = new HashMap<String, Object>();
		setVariables(variables);

		invokeSubProcess("Homing", businessKey, variables);

		injectWorkflowMessages(callbacks, "sniro");

		waitForProcessEnd(businessKey, 10000);

		//Get Variables
		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
		ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
		String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");

		Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
		HomingSolution resourceARHoming = resourceAR.getHomingSolution();
		Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
		HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
		Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
		HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
		String resourceARHomingString = resourceARHoming.toString();
		resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
		String resourceARHoming2String = resourceARHoming2.toString();
		resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
		String resourceVNFHomingString = resourceVNFHoming.toString();
		resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
		expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");
		
		assertNull(workflowException);
		assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
		assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
		assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
		assertEquals(verifySniroRequest(), expectedSniroRequest);

	}

	@Test
	@Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
	public void testHoming_success_2AR1Vnf2Net() throws Exception {

		mockSNIRO();

		String businessKey = UUID.randomUUID().toString();
		Map<String, Object> variables = new HashMap<String, Object>();
		setVariables2(variables);

		invokeSubProcess("Homing", businessKey, variables);

		injectWorkflowMessages(callbacks, "sniro2");

		waitForProcessEnd(businessKey, 10000);

		//Get Variables
		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
		ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");
		String expectedSniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");

		Resource resourceAR = serviceDecompositionExp.getServiceResource("testResourceIdAR");
		HomingSolution resourceARHoming = resourceAR.getHomingSolution();
		Resource resourceAR2 = serviceDecompositionExp.getServiceResource("testResourceIdAR2");
		HomingSolution resourceARHoming2 = resourceAR2.getHomingSolution();
		Resource resourceVNF = serviceDecompositionExp.getServiceResource("testResourceIdVNF");
		HomingSolution resourceVNFHoming = resourceVNF.getHomingSolution();
		Resource resourceNet = serviceDecompositionExp.getServiceResource("testResourceIdNet");
		HomingSolution resourceNetHoming = resourceNet.getHomingSolution();
		Resource resourceNet2 = serviceDecompositionExp.getServiceResource("testResourceIdNet2");
		HomingSolution resourceNetHoming2 = resourceNet2.getHomingSolution();

		String resourceARHomingString = resourceARHoming.toString();
		resourceARHomingString = resourceARHomingString.replaceAll("\\s+", " ");
		String resourceARHoming2String = resourceARHoming2.toString();
		resourceARHoming2String = resourceARHoming2String.replaceAll("\\s+", " ");
		String resourceVNFHomingString = resourceVNFHoming.toString();
		resourceVNFHomingString = resourceVNFHomingString.replaceAll("\\s+", " ");
		String resourceNetHomingString = resourceNetHoming.toString();
		resourceNetHomingString = resourceNetHomingString.replaceAll("\\s+", " ");
		String resourceNetHoming2String = resourceNetHoming2.toString();
		resourceNetHoming2String = resourceNetHoming2String.replaceAll("\\s+", " ");
		expectedSniroRequest = expectedSniroRequest.replaceAll("\\s+", "");

		assertNull(workflowException);
		assertEquals(homingSolutionService("service", "testSIID1", "MDTNJ01", "aic", "dfwtx", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceARHomingString);
		assertEquals(homingSolutionService("service", "testSIID2", "testVnfHostname2", "aic", "testCloudRegionId2", "testAicClli2", "3.0", null, null), resourceARHoming2String);
		assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionId3", "testAicClli3", "3.0", "\"91d563e8-e714-4393-8f99-cc480144a05e\", \"21d563e8-e714-4393-8f99-cc480144a05e\"", "\"31d563e8-e714-4393-8f99-cc480144a05e\", \"71d563e8-e714-4393-8f99-cc480144a05e\""), resourceVNFHomingString);
		assertEquals(homingSolutionService("service", "testServiceInstanceIdNet", "testVnfHostNameNet", "aic", "testCloudRegionIdNet", "testAicClliNet", "3.0", null, null), resourceNetHomingString);
		assertEquals(homingSolutionCloud("cloud", "", "", "aic", "testCloudRegionIdNet2", "testAicClliNet2", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05n\", \"j1d563e8-e714-4393-8f99-cc480144a05n\"", "\"s1d563e8-e714-4393-8f99-cc480144a05n\", \"b1d563e8-e714-4393-8f99-cc480144a05n\""), resourceNetHoming2String);
		assertEquals(verifySniroRequest(), expectedSniroRequest);
	}

	@Test
	@Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/BuildingBlock/DecomposeService.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
	public void testHoming_success_vnfResourceList() throws Exception {

		// Create a Service Decomposition 
//System.out.println("At start of testHoming_success_vnfResourceList");
		MockGetServiceResourcesCatalogData("1cc4e2e4-eb6e-404d-a66f-c8733cedcce8", "5.0", "/BuildingBlocks/catalogResp.json");
		String busKey = UUID.randomUUID().toString();
		Map<String, Object> vars = new HashMap<String, Object>();
		setVariablesForServiceDecomposition(vars, "testRequestId123", "ff5256d2-5a33-55df-13ab-12abad84e7ff");
		invokeSubProcess("DecomposeService", busKey, vars);
		
		ServiceDecomposition sd = (ServiceDecomposition) getVariableFromHistory(busKey, "serviceDecomposition");
//System.out.println("In testHoming_success_vnfResourceList, ServiceDecomposition = " + sd);
		List<VnfResource> vnfResourceList = sd.getServiceVnfs();
//System.out.println(" vnfResourceList = " + vnfResourceList);
		vnfResourceList.get(0).setResourceId("test-resource-id-000");
		
		// Invoke Homing 	
		
		mockSNIRO();

		String businessKey = UUID.randomUUID().toString();
		Map<String, Object> variables = new HashMap<String, Object>();
		variables.put("isDebugLogEnabled", "true");
		variables.put("msoRequestId", "testRequestId");
		variables.put("serviceInstanceId", "testServiceInstanceId");
		variables.put("serviceDecomposition", sd);
		variables.put("subscriberInfo", subscriber2);
		
		invokeSubProcess("Homing", businessKey, variables);
		injectWorkflowMessages(callbacks, "sniro3");
		waitForProcessEnd(businessKey, 10000);

		//Get Variables
		
		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");
		ServiceDecomposition serviceDecompositionExp = (ServiceDecomposition) getVariableFromHistory(businessKey, "serviceDecomposition");

		Resource resourceVnf = serviceDecompositionExp.getServiceResource("test-resource-id-000");
		HomingSolution resourceVnfHoming = resourceVnf.getHomingSolution();

		String resourceVnfHomingString = resourceVnfHoming.toString();
		resourceVnfHomingString = resourceVnfHomingString.replaceAll("\\s+", " ");

		assertNull(workflowException);

		//Verify request
		String sniroRequest = (String) getVariableFromHistory(businessKey, "sniroRequest");
		assertEquals(FileUtil.readResourceFile("__files/BuildingBlocks/sniroRequest_infravnf").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""), sniroRequest.replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", ""));
		
		assertEquals(homingSolutionService("service", "service-instance-01234", "MDTNJ01", "att-aic", "mtmnj1a", "KDTNJ01", "3.0", "\"f1d563e8-e714-4393-8f99-cc480144a05e\", \"j1d563e8-e714-4393-8f99-cc480144a05e\"", "\"s1d563e8-e714-4393-8f99-cc480144a05e\", \"b1d563e8-e714-4393-8f99-cc480144a05e\""), resourceVnfHomingString);
	}

	@Test
	@Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
	public void testHoming_error_inputVariable() throws Exception {

		String businessKey = UUID.randomUUID().toString();
		Map<String, Object> variables = new HashMap<String, Object>();
		setVariables3(variables);

		invokeSubProcess("Homing", businessKey, variables);

		waitForProcessEnd(businessKey, 10000);

		//Get Variables
		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");

		assertEquals("WorkflowException[processKey=Homing,errorCode=4000,errorMessage=A required input variable is missing or null]", workflowException.toString());
	}

	@Test
	@Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
	public void testHoming_error_badResponse() throws Exception {
		mockSNIRO_500();

		String businessKey = UUID.randomUUID().toString();
		Map<String, Object> variables = new HashMap<String, Object>();
		setVariables(variables);

		invokeSubProcess("Homing", businessKey, variables);

		waitForProcessEnd(businessKey, 10000);

		//Get Variables
		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");

		assertEquals("WorkflowException[processKey=Homing,errorCode=500,errorMessage=Received a Bad Sync Response from Sniro.]", workflowException.toString());
	}

	@Test
	@Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
	public void testHoming_error_sniroNoSolution() throws Exception {
		mockSNIRO();

		String businessKey = UUID.randomUUID().toString();
		Map<String, Object> variables = new HashMap<String, Object>();
		setVariables(variables);

		invokeSubProcess("Homing", businessKey, variables);

		injectWorkflowMessages(callbacks, "sniroNoSol");

		waitForProcessEnd(businessKey, 10000);

		//Get Variables
		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");

		assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=No solution found for plan 08e1b8cf-144a-4bac-b293-d5e2eedc97e8]", workflowException.toString());
	}

	@Test
	@Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
	public void testHoming_error_sniroPolicyException() throws Exception {
		mockSNIRO();

		String businessKey = UUID.randomUUID().toString();
		Map<String, Object> variables = new HashMap<String, Object>();
		setVariables(variables);

		invokeSubProcess("Homing", businessKey, variables);

		injectWorkflowMessages(callbacks, "sniroPolicyEx");

		waitForProcessEnd(businessKey, 10000);

		//Get Variables
		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");

		assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Policy Exception: Message content size exceeds the allowable limit]", workflowException.toString());
	}

	@Test
	@Deployment(resources = {"subprocess/BuildingBlock/Homing.bpmn", "subprocess/ReceiveWorkflowMessage.bpmn"})
	public void testHoming_error_sniroServiceException() throws Exception {
		mockSNIRO();

		String businessKey = UUID.randomUUID().toString();
		Map<String, Object> variables = new HashMap<String, Object>();
		setVariables(variables);

		invokeSubProcess("Homing", businessKey, variables);

		injectWorkflowMessages(callbacks, "sniroServiceEx");

		waitForProcessEnd(businessKey, 10000);

		//Get Variables
		WorkflowException workflowException = (WorkflowException) getVariableFromHistory(businessKey, "WorkflowException");

		assertEquals("WorkflowException[processKey=Homing,errorCode=400,errorMessage=Sniro Async Callback Response contains a Request Error Service Exception: SNIROPlacementError: requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://135.21.171.200:8091/v1/plans/97b4e303-5f75-492c-8fb2-21098281c8b8]", workflowException.toString());
	}
	


	private void setVariables(Map<String, Object> variables) {
		variables.put("isDebugLogEnabled", "true");
	//	variables.put("mso-request-id", "testRequestId");
		variables.put("msoRequestId", "testRequestId");
		variables.put("serviceInstanceId", "testServiceInstanceId");
		variables.put("serviceDecomposition", serviceDecomposition);
		variables.put("subscriberInfo", subscriber2);

	}

	private void setVariables2(Map<String, Object> variables) {
		List<NetworkResource> netList = new ArrayList<NetworkResource>();
		NetworkResource net = new NetworkResource();
		net.setResourceId("testResourceIdNet");
		ModelInfo netModel = new ModelInfo();
		netModel.setModelCustomizationUuid("testModelCustomizationUuidNet");
		netModel.setModelInvariantUuid("testModelInvariantIdNet");
		netModel.setModelName("testModelNameNet");
		netModel.setModelVersion("testModelVersionNet");
		net.setModelInfo(netModel);
		netList.add(net);
		NetworkResource net2 = new NetworkResource();
		net2.setResourceId("testResourceIdNet2");
		ModelInfo netModel2 = new ModelInfo();
		netModel2.setModelCustomizationUuid("testModelCustomizationUuidNet2");
		netModel2.setModelInvariantUuid("testModelInvariantIdNet2");
		netModel2.setModelName("testModelNameNet2");
		netModel2.setModelVersion("testModelVersionNet2");
		net2.setModelInfo(netModel2);
		netList.add(net2);
		serviceDecomposition.setServiceNetworks(netList);

		variables.put("isDebugLogEnabled", "true");
		variables.put("msoRequestId", "testRequestId");
		variables.put("serviceInstanceId", "testServiceInstanceId");
		variables.put("serviceDecomposition", serviceDecomposition);
		variables.put("subscriberInfo", subscriber2);
	}

	private void setVariables3(Map<String, Object> variables) {
		variables.put("isDebugLogEnabled", "true");
	//	variables.put("mso-request-id", "testRequestId");
		variables.put("msoRequestId", "testRequestId");
		variables.put("serviceInstanceId", "testServiceInstanceId");
		variables.put("serviceDecomposition", null);
		variables.put("subscriberInfo", subscriber2);

	}

	private String homingSolutionService(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){
		String solution = "";
		if(enList == null){
			solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\" } }";
		}else{
			solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"serviceInstanceId\" : \"" + serviceInstanceId + "\", \"vnfHostname\" : \"" + vnfHostname + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " + licenseList +  " ] } }";
		}
		return solution;
	}

	private String homingSolutionCloud(String type, String serviceInstanceId, String vnfHostname, String cloudOwner, String cloudRegionId, String aicClli, String aicVersion, String enList, String licenseList){
		String solution = "";
		if(enList == null){
			solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\" } }";
		}else{
			solution = "{ \"homingSolution\" : { \"inventoryType\" : \"" + type + "\", \"cloudOwner\" : \"" + cloudOwner + "\", \"cloudRegionId\" : \"" + cloudRegionId + "\", \"aicClli\" : \"" + aicClli + "\", \"aicVersion\" : \"" + aicVersion + "\", \"entitlementPoolList\" : [ " + enList +  " ], \"licenseKeyGroupList\" : [ " + licenseList +  " ] } }";
		}
		return solution;
	}
	
	private void setVariablesForServiceDecomposition(Map<String, Object> variables, String requestId, String siId) {
		variables.put("isDebugLogEnabled", "true");
		variables.put("mso-request-id", requestId);
		variables.put("msoRequestId", requestId);
		variables.put("serviceInstanceId",siId);

		String serviceModelInfo = "{ "+ "\"modelType\": \"service\"," +
				"\"modelInvariantUuid\": \"1cc4e2e4-eb6e-404d-a66f-c8733cedcce8\"," +
				"\"modelUuid\": \"2f7f309d-c842-4644-a2e4-34167be5eeb4\"," +
				"\"modelName\": \"ADIOD vRouter vCE 011017 Service\"," +
				"\"modelVersion\": \"5.0\"," +
				"}";
		variables.put("serviceModelInfo", serviceModelInfo);
	}
		
	private String verifySniroRequest(){
		String request = "{\"requestInfo\":{\"transactionId\":\"testRequestId\",\"requestId\":\"testRequestId\",\"callbackUrl\":\"http://localhost:8090/workflows/messages/message/SNIROResponse/testRequestId\",\"sourceId\":\"mso\",\"optimizer\":[\"placement\",\"license\"],\"numSolutions\":1,\"timeout\":600},\"placementInfo\":{\"serviceModelInfo\":{\"modelType\":\"\",\"modelInvariantId\":\"testModelInvariantId\",\"modelVersionId\":\"testModelUuid\",\"modelName\":\"testModelName\",\"modelVersion\":\"testModelVersion\"},\"subscriberInfo\":{\"globalSubscriberId\":\"SUB12_0322_DS_1201\",\"subscriberName\":\"SUB_12_0322_DS_1201\",\"subscriberCommonSiteId\":\"\"},\"demandInfo\":{\"placementDemand\":[{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR\",\"modelInvariantId\":\"testModelInvariantIdAR\",\"modelName\":\"testModelNameAR\",\"modelVersion\":\"testModelVersionAR\",\"modelVersionId\":\"testARModelUuid\",\"modelType\":\"testModelTypeAR\"},\"tenantId\":\"\",\"tenantName\":\"\"},{\"resourceInstanceType\":\"ALLOTTED_RESOURCE\",\"serviceResourceId\":\"testResourceIdAR2\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidAR2\",\"modelInvariantId\":\"testModelInvariantIdAR2\",\"modelName\":\"testModelNameAR2\",\"modelVersion\":\"testModelVersionAR2\",\"modelVersionId\":\"testAr2ModelUuid\",\"modelType\":\"testModelTypeAR2\"},\"tenantId\":\"\",\"tenantName\":\"\"}],\"licenseDemand\":[{\"resourceInstanceType\":\"VNF\",\"serviceResourceId\":\"testResourceIdVNF\",\"resourceModuleName\":\"\",\"resourceModelInfo\":{\"modelCustomizationId\":\"testModelCustomizationUuidVNF\",\"modelInvariantId\":\"testModelInvariantIdVNF\",\"modelName\":\"testModelNameVNF\",\"modelVersion\":\"testModelVersionVNF\",\"modelVersionId\":\"testVnfModelUuid\",\"modelType\":\"testModelTypeVNF\"}}]},\"policyId\":[],\"serviceInstanceId\":\"testServiceInstanceId123\",\"orderInfo\":\"{\\\"requestParameters\\\":null}\"}}";
		return request;
	}

}