Fix intermittent test inProgressJobMoreThan24HoursIsFailedInVidAudit
[vid.git] / vid-automation / src / test / java / org / onap / vid / api / AsyncInstantiationMacroApiTest.java
1 package org.onap.vid.api;
2
3 import static java.util.Collections.singletonList;
4 import static java.util.stream.Collectors.counting;
5 import static java.util.stream.Collectors.groupingBy;
6 import static java.util.stream.Collectors.toList;
7 import static java.util.stream.Collectors.toMap;
8 import static org.hamcrest.CoreMatchers.hasItem;
9 import static org.hamcrest.CoreMatchers.is;
10 import static org.hamcrest.CoreMatchers.not;
11 import static org.hamcrest.CoreMatchers.startsWith;
12 import static org.hamcrest.MatcherAssert.assertThat;
13 import static org.hamcrest.Matchers.hasSize;
14 import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE;
15 import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2WithNames.Keys;
16 import static org.testng.AssertJUnit.assertEquals;
17 import static org.testng.AssertJUnit.assertTrue;
18 import static vid.automation.test.infra.Features.FLAG_1906_INSTANTIATION_API_USER_VALIDATION;
19 import static vid.automation.test.services.SimulatorApi.registerExpectationFromPresets;
20 import static vid.automation.test.utils.ExtendedHamcrestMatcher.hasItemsFromCollection;
21
22 import com.fasterxml.jackson.core.JsonProcessingException;
23 import com.google.common.collect.ImmutableList;
24 import com.google.common.collect.ImmutableMap;
25 import java.util.Arrays;
26 import java.util.Collections;
27 import java.util.LinkedList;
28 import java.util.List;
29 import java.util.Map;
30 import java.util.Objects;
31 import java.util.Optional;
32 import java.util.Set;
33 import java.util.UUID;
34 import java.util.concurrent.atomic.AtomicReference;
35 import java.util.stream.IntStream;
36 import java.util.stream.Stream;
37 import net.bytebuddy.utility.RandomString;
38 import net.javacrumbs.jsonunit.JsonAssert;
39 import org.apache.commons.lang3.StringUtils;
40 import org.apache.logging.log4j.LogManager;
41 import org.apache.logging.log4j.Logger;
42 import org.hamcrest.collection.IsCollectionWithSize;
43 import org.onap.sdc.ci.tests.datatypes.UserCredentials;
44 import org.onap.simulator.presetGenerator.presets.BasePresets.BasePreset;
45 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId;
46 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
47 import org.onap.simulator.presetGenerator.presets.ecompportal_att.PresetGetSessionSlotCheckIntervalGet;
48 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOAssignServiceInstanceGen2WithNames;
49 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateServiceInstanceGen2WithNames;
50 import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteMacroService;
51 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet;
52 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGetErrorResponse;
53 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestsManyInstanceStatusesGet;
54 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOServiceInstanceGen2ErrorResponse;
55 import org.onap.vid.model.asyncInstantiation.JobAuditStatus;
56 import org.onap.vid.model.asyncInstantiation.ServiceInfo;
57 import org.springframework.http.HttpStatus;
58 import org.springframework.web.client.HttpClientErrorException;
59 import org.springframework.web.client.HttpServerErrorException;
60 import org.testng.Assert;
61 import org.testng.annotations.DataProvider;
62 import org.testng.annotations.Test;
63 import vid.automation.test.infra.FeatureTogglingTest;
64 import vid.automation.test.infra.Wait;
65 import vid.automation.test.model.JobStatus;
66 import vid.automation.test.model.ServiceAction;
67 import vid.automation.test.services.SimulatorApi;
68
69 public class AsyncInstantiationMacroApiTest extends AsyncInstantiationBase {
70     private static final Logger logger = LogManager.getLogger(AsyncInstantiationMacroApiTest.class);
71
72     private static final String MSO_BASE_ERROR =
73             "Received error from SDN-C: java.lang.IllegalArgumentException: All keys must be specified for class org."+
74             "opendaylight.yang.gen.v1.org.onap.sdnc.northbound.generic.resource.rev170824.vf.module.assignments.vf."+
75             "module.assignments.vms.VmKey. Missing key is getVmType. Supplied key is VmKey [].";
76     private static final String MSO_ERROR = MSO_BASE_ERROR + StringUtils.repeat(" and a lot of sentences for long message", 60);
77
78     private static final String INSTANCE_GROUP_ID_LABEL = "instanceGroupId";
79
80     private static final String INSTANCE_GROUP_LABEL = "instanceGroup";
81
82     private static final String DELETE_MACRO_SERVICE_FILE_NAME = "asyncInstantiation/vidRequestDeleteMacroService.json";
83
84     @Test
85     public void createBulkOfCreateInstances(){
86         Map<Keys, String> names = generateNames();
87         final int bulkSize = 3;
88         ImmutableList<BasePreset> presets = addPresetsForCreateBulkOfCreateInstances(bulkSize, names);
89         createBulkOfInstancesAndAssert(presets, false, bulkSize, JobStatus.COMPLETED, names);
90     }
91
92     @Test(dataProvider = "auditSources")
93    public void getAuditStatus_nonExistingJobId_returnsEmptyList(JobAuditStatus.SourceStatus source){
94        List<JobAuditStatus> audits = getAuditStatuses(UUID.randomUUID().toString(), source.name());
95        Assert.assertEquals(audits.size(),0);
96    }
97
98     @Test(expectedExceptions = HttpClientErrorException.class)
99     public void getAuditStatus_nonExistingSource_returnsError() {
100         try {
101             getAuditStatuses(UUID.randomUUID().toString(), new RandomString(8).nextString());
102         } catch (HttpClientErrorException e) {
103             Assert.assertEquals(e.getResponseBodyAsString(),"The parameter source must have a value among : MSO, VID");
104             assertThat(e.getStatusCode(), is(HttpStatus.BAD_REQUEST));
105             throw e;
106         }
107     }
108
109     @Test()
110     public void simulateBulkRequest_getAuditStatus_auditStatusesReturnedAccordingSource() {
111         final int bulkSize = 2;
112         final List<String> jobIds = createBulkAndWaitForBeCompleted(bulkSize);
113
114         for(String jobId: jobIds) {
115             List<JobAuditStatus> actualVidAudits = getAuditStatuses(jobId, JobAuditStatus.SourceStatus.VID.name());
116             List<JobAuditStatus> expectedVidAudits = Stream.of(JobStatus.PENDING, JobStatus.IN_PROGRESS, JobStatus.COMPLETED)
117                     .map(status-> vidAuditStatus(jobId, status.name(), status.equals(JobStatus.COMPLETED))).collect(toList());
118             assertThat(actualVidAudits, hasItemsFromCollection(expectedVidAudits));
119
120             List<JobAuditStatus> actualMsoAudits = getAuditStatuses(jobId, JobAuditStatus.SourceStatus.MSO.name());
121             List<JobAuditStatus> expectedMsoAudits = Stream.of("REQUESTED", "COMPLETE")
122                     .map(status-> new JobAuditStatus(UUID.fromString(jobId),
123                             status,
124                             JobAuditStatus.SourceStatus.MSO,
125                             UUID.fromString("c0011670-0e1a-4b74-945d-8bf5aede1d9c"),
126                             status.equals("COMPLETE") ? "Service Instance was created successfully." : null,
127                             false)).collect(toList());
128             assertThat(actualMsoAudits, is(expectedMsoAudits));
129         }
130     }
131
132
133     @Test(expectedExceptions = HttpClientErrorException.class)
134     public void addBulkAndDeleteInProgress_deletionIsRejected(){
135         try {
136             final Map<String, JobStatus> jobs = addBulkAllPendingButOneInProgress();
137             deleteOneJobHavingTheStatus(jobs, JobStatus.IN_PROGRESS);
138         } catch (HttpClientErrorException e) {
139             JsonAssert.assertJsonPartEquals(
140                 String.format(
141                     "Service status does not allow deletion from the queue (Request id: %s)",
142                     e.getResponseHeaders().getFirst("X-ECOMP-RequestID-echo")
143                 ),
144                 e.getResponseBodyAsString(),
145                 "message"
146             );
147             assertThat(e.getStatusCode(), is(HttpStatus.METHOD_NOT_ALLOWED));
148
149             throw e;
150         }
151     }
152
153     @Test
154     public void addBulkAndDeletePending_deletedIsHiddenFromServiceInfoResults(){
155         Map<String, JobStatus> statusesBefore = addBulkAllPendingButOneInProgress();
156
157         final String deletedJob = deleteOneJobHavingTheStatus(statusesBefore, JobStatus.PENDING);
158
159         final Map<String, JobStatus> statusesNow = serviceListCall().getBody().stream()
160                 .filter(si -> statusesBefore.keySet().contains(si.jobId))
161                 .collect(toMap(si -> si.jobId, si -> si.jobStatus));
162
163         statusesBefore.remove(deletedJob);
164         assertThat("deleted job shall not be present in StatusInfo response", statusesNow, is(statusesBefore));
165     }
166
167     @Test(invocationCount = 3)
168     public void createBulkOfCreateInstancesWithSinglePreset_firstOneInProgressOtherArePending(){
169         final int bulkSize = 3;
170         Map<String, JobStatus> statusMap = addBulkAllPendingButOneInProgress(bulkSize);
171         Set<String> jobIds = statusMap.keySet();
172
173         final Map<JobStatus, List<ServiceInfo>> statuses = serviceListCall().getBody().stream()
174                 .filter(si -> jobIds.contains(si.jobId))
175                 .collect(groupingBy(ServiceInfo::getJobStatus));
176
177         // Variable "statuses" contains two lists by status:
178         // IN_PROGRESS:  The ultimate first job - named with _001 - is always the only one in progress
179         // PENDING:      The other two jobs - named with _002 and _003 - are the still pending
180         assertThat(jobIds, hasSize(bulkSize));
181         assertThat(statuses.get(JobStatus.IN_PROGRESS), hasSize(1));
182
183         assertThat(statuses.get(JobStatus.PENDING), hasSize(bulkSize - 1));
184     }
185
186
187     @Test(dataProvider = "trueAndFalse" )
188     public void whenServiceInBulkFailed_otherServicesAreStopped(Boolean isPresetForCreate){
189         Map<Keys, String> names = generateNames();
190         final int bulkSize = 3;
191
192         //if there is a preset for create,  service shall failed during in_progress (upon get status)
193         //it there is no preset for create, service shall failed during pending (upon create request)
194         List<BasePreset> msoBulkPresets = isPresetForCreate ?
195                 generateMsoCreateBulkPresets(bulkSize, names) :
196                 new LinkedList<>();
197         ImmutableList<BasePreset> presets = new ImmutableList.Builder<BasePreset>()
198                 .add(new PresetGetSessionSlotCheckIntervalGet())
199                 .add(new PresetAAIGetSubscribersGet())
200                 .add(PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MTN3_TO_ATT_SABABA)
201                 .addAll(msoBulkPresets)
202                 .add(new PresetMSOOrchestrationRequestGet("FAILED"))
203                 .build();
204         List<String> jobIds = createBulkOfMacroInstances(presets, false, bulkSize, names);
205         Assert.assertEquals(jobIds.size(),bulkSize);
206         boolean result = Wait.waitFor(x->{
207                 List<ServiceInfo> serviceInfoList = serviceListCall().getBody();
208                 Map<JobStatus, Long> statusCount = serviceInfoList.stream().filter(si->jobIds.contains(si.jobId)).collect(groupingBy(ServiceInfo::getJobStatus, counting()));
209                 return Objects.equals(statusCount.get(JobStatus.FAILED), 1L) && Objects.equals(statusCount.get(JobStatus.STOPPED), 2L);
210             }, null, 15, 1);
211         assertTrue(String.format("failed to get jobs [%s] to state of: 1 failed and 2 stopped ",
212                 String.join(",", jobIds)),result);
213     }
214
215     @Test
216     public void createBulkOfAssignInstances(){
217         Map<Keys, String> names = generateNames();
218         final int bulkSize = 2;
219         ImmutableList<BasePreset> msoBulkPresets = IntStream.rangeClosed(0, bulkSize-1)
220                 .mapToObj(i-> new PresetMSOAssignServiceInstanceGen2WithNames(names, i))
221                 .collect(ImmutableList.toImmutableList());
222         ImmutableList<BasePreset> presets = new ImmutableList.Builder<BasePreset>()
223                 .add(new PresetGetSessionSlotCheckIntervalGet())
224                 .add(new PresetAAIGetSubscribersGet())
225                 .add(PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MTN3_TO_ATT_SABABA)
226                 .addAll(msoBulkPresets)
227                 .add(new PresetMSOOrchestrationRequestGet())
228                 .build();
229         createBulkOfInstancesAndAssert(presets, true, bulkSize, JobStatus.COMPLETED, names);
230     }  
231
232     @Test
233     public void tryToCreateBulkOfAssignInstancesErrorResponseFromMso(){
234         ImmutableList<BasePreset> presets = ImmutableList.of(
235                 new PresetGetSessionSlotCheckIntervalGet(),
236                 new PresetAAIGetSubscribersGet(),
237                 new PresetMSOServiceInstanceGen2ErrorResponse(406));
238
239         List<String> jobIds = createBulkOfInstancesAndAssert(presets, true,1, JobStatus.FAILED, generateNames());
240         String jobId  = jobIds.get(0);
241         List<JobAuditStatus> actualMsoAudits = getAuditStatuses(jobId, JobAuditStatus.SourceStatus.MSO.name());
242         JobAuditStatus expectedMsoAudit = new JobAuditStatus(UUID.fromString(jobId), "FAILED", JobAuditStatus.SourceStatus.MSO,
243                         null,
244                         "Http Code:406, \"messageId\":\"SVC0002\",\"text\":\"JSON Object Mapping Request\"" ,
245                         false);
246         assertThat(actualMsoAudits.get(0), is(expectedMsoAudit));
247     }
248
249     @Test
250     public void whenGetLongErrorMessageFromMso_ThenAuditFirst2000Chars() {
251         Map<Keys, String> names = generateNames();
252         ImmutableList<BasePreset> presets = ImmutableList.of(
253                 new PresetGetSessionSlotCheckIntervalGet(),
254                 new PresetAAIGetSubscribersGet(),
255                 new PresetMSOCreateServiceInstanceGen2WithNames(names, 0),
256                 new PresetMSOOrchestrationRequestGet("FAILED", PresetMSOOrchestrationRequestGet.DEFAULT_REQUEST_ID, MSO_ERROR));
257
258         List<String> jobIds = createBulkOfInstancesAndAssert(presets, false, 1, JobStatus.FAILED, names);
259         String jobId  = jobIds.get(0);
260         List<JobAuditStatus> actualMsoAudits = getAuditStatuses(jobId, JobAuditStatus.SourceStatus.MSO.name());
261         Optional<JobAuditStatus> jobAuditStatus = actualMsoAudits.stream().filter(x -> x.getJobStatus().equals("FAILED")).findFirst();
262         assertTrue(jobAuditStatus.isPresent());
263         assertThat(jobAuditStatus.get().getAdditionalInfo(), startsWith(MSO_BASE_ERROR));
264         assertThat(jobAuditStatus.get().getAdditionalInfo().length(), is(2000));
265     }
266
267     @Test
268     public void whenHideCompletedService_thenServiceNotReturnInServiceList(){
269         List<String> services = createBulkAndWaitForBeCompleted(2);
270         hideService(services.get(0));
271         List<String> serviceInfoList = serviceListCall().getBody().stream().map(ServiceInfo::getJobId).collect(toList());
272         assertThat(serviceInfoList, hasItem(services.get(1)));
273         assertThat(serviceInfoList, not(hasItem(services.get(0))));
274     }
275
276     @Test
277     public void errorResponseInGetStatusFromMso_getAuditStatusFromMso_errorMsgExistInAdditionalInfo(){
278         Map<Keys, String> names = generateNames();
279         ImmutableList<BasePreset> presets = new ImmutableList.Builder<BasePreset>()
280                 .add(new PresetGetSessionSlotCheckIntervalGet())
281                 .add(new PresetAAIGetSubscribersGet())
282                 .add(PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MTN3_TO_ATT_SABABA)
283                 .add(new PresetMSOAssignServiceInstanceGen2WithNames(names, 0))
284                 .add(new PresetMSOOrchestrationRequestGetErrorResponse(406))
285                 .build();
286
287         final List<String> jobIds = createBulkOfInstancesAndAssert(presets, true,1, JobStatus.IN_PROGRESS, names);
288         String jobId = jobIds.get(0);
289         Wait.waitFor(y-> getAuditStatuses(jobId, JobAuditStatus.SourceStatus.MSO.name()).stream()
290                         .anyMatch(si -> si.getJobStatus().equals("FAILED")),
291                 null, 10, 1 );
292         List<JobAuditStatus> actualMsoAudits = getAuditStatuses(jobId, JobAuditStatus.SourceStatus.MSO.name());
293         List<JobAuditStatus> expectedMsoAudits = Stream.of("REQUESTED", "FAILED")
294                 .map(status -> new JobAuditStatus(UUID.fromString(jobId),
295                         status,
296                         JobAuditStatus.SourceStatus.MSO,
297                         UUID.fromString("c0011670-0e1a-4b74-945d-8bf5aede1d9c"),
298                         status.equals("FAILED") ? "Http Code:406, \"messageId\":\"SVC0002\",\"text\":\"JSON Object Mapping Request\"" : null,
299                         false)).collect(toList());
300         assertThat(actualMsoAudits, is(expectedMsoAudits));
301
302     }
303
304     @Test(dataProvider = "trueAndFalse", dataProviderClass = TestUtils.class)
305     public void inProgressJobMoreThan24HoursIsFailedInVidAudit(Boolean over24Hours) throws JsonProcessingException {
306
307         // in case 24 did not pass -- IN_PROGRESS should persist; if 24 hour did pass -- fail
308
309         int startedHoursAgo = over24Hours ? 24 : 23;
310         JobStatus jobStatus = over24Hours ? JobStatus.FAILED : JobStatus.IN_PROGRESS;
311
312         List<String> expectedStatuses = over24Hours
313             ? Arrays.asList(JobStatus.PENDING.name(), JobStatus.IN_PROGRESS.name(), JobStatus.FAILED.name())
314             : Arrays.asList(JobStatus.PENDING.name(), JobStatus.IN_PROGRESS.name());
315
316         AtomicReference<List<ServiceInfo>> serviceInfoRef = new AtomicReference<>();
317
318         Map<Keys, String> names = addBulkPendingWithCustomList(
319             singletonList(new PresetMSOOrchestrationRequestGet("IN_PROGRESS", startedHoursAgo)));
320
321         boolean isJobFound = Wait.waitFor(x -> {
322             List<ServiceInfo> serviceInfoList = serviceListCall().getBody();
323             serviceInfoRef.set(serviceInfoList);
324             ServiceInfo inProgressJob = serviceInfoList.stream()
325                 .filter(serviceInfo -> serviceInfo.serviceInstanceName.equals(names.get(Keys.SERVICE_NAME)))
326                 .findFirst()
327                 .orElseThrow(() -> new AssertionError("Job with serviceInstanceName=" + Keys.SERVICE_NAME + " not found"));
328
329             org.junit.Assert.assertEquals("Tested job status is not as expected",
330                 jobStatus, inProgressJob.getJobStatus());
331
332             verifyAuditStatuses(inProgressJob.jobId, expectedStatuses, JobAuditStatus.SourceStatus.VID);
333             verifyAuditStatuses(inProgressJob.jobId, Arrays.asList("REQUESTED", "IN_PROGRESS"), JobAuditStatus.SourceStatus.MSO);
334
335             return true;
336         }, null, 10, 2);
337
338         org.junit.Assert.assertTrue(
339             "Job with serviceInstanceName=" + Keys.SERVICE_NAME + " should present: " + objectMapper.writeValueAsString(serviceInfoRef.get()), isJobFound);
340     }
341
342     @Test
343     public void verifyAuditStatusOfInstanceGroupId(){
344         SimulatorApi.registerExpectationFromPreset(new PresetMSOOrchestrationRequestsManyInstanceStatusesGet(INSTANCE_GROUP_ID_LABEL, INSTANCE_GROUP_LABEL), SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET);
345         final List<JobAuditStatus> expectedAuditStatusList = getAuditStatusesForInstance("VNFGROUP", "df305d54-75b4-431b-adb2-eb6b9e5460df");
346         verifyInstanceAuditStatuses(Arrays.asList(
347                 new JobAuditStatus("groupTestName", "IN_PROGRESS", UUID.fromString("28502bd2-3aff-4a03-9f2b-5a0d1cb1ca24") , INSTANCE_GROUP_LABEL+" instance creation", null, INSTANCE_GROUP_LABEL),
348                 new JobAuditStatus("groupTestName", "COMPLETE",UUID.fromString("28502bd2-3aff-4a03-9f2b-5a0d1cb1ca24") , INSTANCE_GROUP_LABEL+" instance creation", null, INSTANCE_GROUP_LABEL),
349                 new JobAuditStatus("groupTestName", "IN_PROGRESS", UUID.fromString("f711f0ff-24b6-4d7f-9314-4b4eae15f48c") , INSTANCE_GROUP_LABEL+" instance deletion", null, INSTANCE_GROUP_LABEL),
350                 new JobAuditStatus("groupTestName", "COMPLETE",UUID.fromString("f711f0ff-24b6-4d7f-9314-4b4eae15f48c")  , INSTANCE_GROUP_LABEL+" instance deletion", null, INSTANCE_GROUP_LABEL)),
351                 expectedAuditStatusList);
352     }
353
354     @Test(expectedExceptions = HttpClientErrorException.class)
355     public void verifyAuditStatusOfInstanceGroupId_notExistingVidType(){
356         try {
357             getAuditStatusesForInstance("KUKU", "df305d54-75b4-431b-adb2-eb6b9e5460df");
358         } catch (HttpClientErrorException e){ //to verify the properiatary statusCode field
359             assertThat("Code is not as expected", HttpStatus.BAD_REQUEST.equals(e.getStatusCode()));
360             throw e;
361         }
362     }
363
364     @Test(expectedExceptions = HttpServerErrorException.class)
365     public void verifyAuditStatusOfInstanceGroupId_notExistingMsoInstanceId(){
366         try {
367             getAuditStatusesForInstance("VNFGROUP", "df305d54-75b4-431b-adb2-eb6b9e5460aa");
368         } catch (HttpServerErrorException e){ //to verify the properiatary statusCode field
369             assertThat("Code is not as expected", HttpStatus.INTERNAL_SERVER_ERROR.equals(e.getStatusCode()));
370             throw e;
371         }
372     }
373
374     @DataProvider
375     public static Object[][] macroAndALaCarteBulk(){
376         return new Object[][]{{CREATE_BULK_OF_MACRO_REQUEST}, {CREATE_BULK_OF_ALACARTE_REQUEST_WITH_VNF}};
377     }
378
379     @Test(dataProvider = "macroAndALaCarteBulk", expectedExceptions = HttpClientErrorException.class)
380     @FeatureTogglingTest(FLAG_1906_INSTANTIATION_API_USER_VALIDATION)
381     public void verifyCreateBulkOfInstancesUserPermissionValidation(String requestDetailsFileName) {
382         login(new UserCredentials("em1536000", "em1536000", null, null, null));
383         try {
384             createBulkOfInstances(false, 1, Collections.EMPTY_MAP, requestDetailsFileName);
385         } catch (HttpClientErrorException e){
386             assertEquals("Code is not as expected", HttpStatus.FORBIDDEN.value(), e.getStatusCode().value());
387             throw e;
388         }
389         finally {
390             login();
391         }
392
393     }
394
395     @Test
396     public void deleteMacroService_getAuditStatus_verifyCompleted() {
397         String deleteServiceRequestId = UUID.randomUUID().toString();
398         String serviceInstanceId = "service-instance-id";
399         registerExpectationFromPresets(ImmutableList.of(
400                 new PresetAAIGetSubscribersGet(),
401                 new PresetMSODeleteMacroService(deleteServiceRequestId, serviceInstanceId),
402                 new PresetMSOOrchestrationRequestGet(COMPLETE, deleteServiceRequestId)
403         ), SimulatorApi.RegistrationStrategy.CLEAR_THEN_SET);
404
405         List<String> uuids = createBulkOfInstances(false, 1, ImmutableMap.of(), DELETE_MACRO_SERVICE_FILE_NAME);
406         assertThat(uuids, IsCollectionWithSize.hasSize(1));
407         String jobId = uuids.get(0);
408
409         assertExpectedStatusAndServiceInfo(JobStatus.COMPLETED, jobId, PATIENCE_LEVEL.FAIL_FAST, new ServiceInfo(
410                 "us16807000", JobStatus.COMPLETED, false,
411                 "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", "WayneHolland", "WATKINS",
412                 "JAG1", "YUDFJULP-JAG1",
413                 "092eb9e8e4b7412e8787dd091bc58e86", "USP-SIP-IC-24335-T-01",
414                 "AAIAIC25", null,
415                 "service-instance-type", null,
416                 null, "InstanceName",
417                 "f028b2e2-7080-4b13-91b2-94944d4c42d8", "Service with VRF", "5.0",
418                 jobId, null, ServiceAction.DELETE, false)
419         );
420     }
421
422 }