Fix for Penetration test _ Session and cookie management
[vid.git] / vid-automation / src / main / java / vid / automation / test / services / BulkRegistration.java
1 package vid.automation.test.services;
2
3 import static org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset.DEFAULT_CLOUD_OWNER;
4 import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE;
5 import static vid.automation.test.infra.ModelInfo.serviceFabricSriovService;
6 import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND;
7
8 import com.google.common.collect.ImmutableList;
9 import com.google.common.collect.ImmutableMap;
10 import org.apache.commons.lang3.StringUtils;
11 import org.onap.simulator.presetGenerator.presets.aai.PresetAAICloudRegionAndSourceFromConfigurationPut;
12 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIFilterServiceInstanceById;
13 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId;
14 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetHomingForVfModule;
15 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetModelsByOwningEntity;
16 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetModelsByProject;
17 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkZones;
18 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPortMirroringSourcePorts;
19 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsGet;
20 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsWithoutInstancesGet;
21 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet;
22 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetTenants;
23 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIPostNamedQueryForViewEdit;
24 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOActivateFabricConfiguration;
25 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost;
26 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModule;
27 import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeactivateAndCloudDelete;
28 import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteInstanceOrchestrationRequestGet;
29 import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteNetwork;
30 import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteService;
31 import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVfModule;
32 import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVnf;
33 import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVolumeGroup;
34 import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet;
35 import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSOActOnConfiguration;
36 import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSOCreateConfiguration;
37 import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSODeleteConfiguration;
38 import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMsoEnableDisablePort;
39 import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet;
40 import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet;
41 import vid.automation.test.Constants;
42 import vid.automation.test.Constants.ViewEdit;
43
44 public class BulkRegistration {
45
46     public static void searchExistingServiceInstance() {
47         searchExistingServiceInstance("Active");
48     }
49
50     public static void searchExistingServiceInstance(String orchStatus)  {
51         searchExistingServiceInstance(orchStatus, "pending-delete");
52     }
53
54     public static void searchExistingServiceInstance(String orchStatus, String vfModuleOrchStatus) {
55         genericSearchExistingServiceInstance();
56         SimulatorApi.registerExpectation(
57                 new String [] {
58                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS,
59                         Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_SERVICE_INSTANCE_BY_ID,
60                         Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT,
61                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SDC_CATALOG_SERVICE_VID_TEST_444,
62                         Constants.RegisterToSimulator.CreateNewServiceInstance.deploy.GET_AIC_ZONES
63                 }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus, "<VF_MODULE_ORCH_STATUS>", vfModuleOrchStatus), SimulatorApi.RegistrationStrategy.APPEND);
64     }
65
66     public static void searchExistingServiceInstanceWithFabric(String orchStatus) {
67         genericSearchExistingServiceInstance();
68         SimulatorApi.registerExpectationFromPresets(
69                 ImmutableList.of(
70                         new PresetAAIFilterServiceInstanceById("e433710f-9217-458d-a79d-1c7aff376d89",
71                                  "TYLER SILVIA",
72                                 "c187e9fe-40c3-4862-b73e-84ff056205f61234"),
73                         new PresetAAIGetSubDetailsGet("e433710f-9217-458d-a79d-1c7aff376d89", orchStatus),
74                         new PresetAAIGetSubDetailsWithoutInstancesGet("e433710f-9217-458d-a79d-1c7aff376d89", true),
75                         new PresetAAIPostNamedQueryForViewEdit("c187e9fe-40c3-4862-b73e-84ff056205f61234", false, true),
76                         new PresetSDCGetServiceMetadataGet(serviceFabricSriovService),
77                         new PresetSDCGetServiceToscaModelGet(serviceFabricSriovService),
78                         new PresetAAIGetNetworkZones(),
79                         new PresetMSOActivateFabricConfiguration("c187e9fe-40c3-4862-b73e-84ff056205f61234"),
80                         new PresetMSOOrchestrationRequestGet(COMPLETE, "318cc766-b673-4a50-b9c5-471f68914584", "Success", false)),
81                 SimulatorApi.RegistrationStrategy.APPEND);
82     }
83
84     public static void searchExistingServiceInstanceByOEAndProject(){
85         SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
86                 new PresetAAIGetModelsByOwningEntity("Melissa"),
87                 new PresetAAIGetModelsByProject("x1"),
88                 new PresetAAIGetModelsByProject("yyy1")
89                 ), APPEND);
90     }
91
92     public static void searchExistingCRServiceInstance(String orchStatus) {
93         genericSearchExistingServiceInstance();
94         SimulatorApi.registerExpectation(
95                 new String [] {
96                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS_CR,
97                         Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_CR_SERVICE_INSTANCE_BY_ID,
98                         Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_CR_VIEW_EDIT,
99                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SDC_CATALOG_SERVICE_VID_TEST_CR,
100                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_MSO_INSTANCE_ORCH_STATUS_REQ,
101                         Constants.RegisterToSimulator.CreateNewServiceInstance.deploy.GET_AIC_ZONES
102                 }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus, "<SERVICE_INSTANCE_ID>", "3f93c7cb-2fd0-4557-9514-e189b7testCR"), SimulatorApi.RegistrationStrategy.APPEND);
103     }
104
105     public static void searchExistingVFServiceWithVFCInstanceGroupInstance(String orchStatus) {
106         genericSearchExistingServiceInstance();
107         SimulatorApi.registerExpectation(
108                 new String [] {
109                         Constants.RegisterToSimulator.AddSubinterface.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS_VFC_IG,
110                         Constants.RegisterToSimulator.AddSubinterface.FILTER_VFC_IG_SERVICE_INSTANCE_BY_ID,
111                         Constants.RegisterToSimulator.AddSubinterface.NAMED_QUERY_VFC_IG_VIEW_EDIT,
112                         Constants.RegisterToSimulator.AddSubinterface.GET_SDC_CATALOG_SERVICE_VID_TEST_444,
113                         Constants.RegisterToSimulator.AddSubinterface.GET_MSO_VFC_IG_INSTANCE_ORCH_STATUS_REQ,
114                  }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus), SimulatorApi.RegistrationStrategy.APPEND);
115     }
116
117     public static void genericSearchExistingServiceInstance() {
118         SimulatorApi.registerExpectation(
119                 new String [] {
120                         Constants.RegisterToSimulator.genericRequest.ECOMP_PORTAL_GET_SESSION_SLOT_CHECK_INTERVAL,
121                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SERVICES
122                 }, ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND);
123         SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(),SimulatorApi.RegistrationStrategy.APPEND);
124     }
125
126     public static void searchExistingServiceInstance2(String orchStatus) {
127         genericSearchExistingServiceInstance();
128         SimulatorApi.registerExpectation(
129                 new String [] {
130                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_CRAIG_ROBERTS,
131                         Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_SERVICE_INSTANCE_BY_ID_2,
132                         Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT_2
133                 }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus), SimulatorApi.RegistrationStrategy.APPEND);
134     }
135
136     public static void searchExistingServiceInstancePortMirroring(String orchStatus, String desiredCloudRegionId) {
137         searchExistingServiceInstancePortMirroring(orchStatus, true, desiredCloudRegionId);
138     }
139
140     public static void searchExistingServiceInstancePortMirroring(String orchStatus, boolean isMirrored, String desiredCloudRegionId) {
141         genericSearchExistingServiceInstance();
142         final String configurationId = "9533-config-LB1113";
143         final String configurationId2 = "9533-config-LB1114";
144         final String portInterfaceId = "d35bf534-7d8e-4cb4-87f9-0a8bb6cd47b2";
145         final String modelToReplaceWith ="pm1111_equip_model_rename.zip";
146
147         SimulatorApi.registerExpectationFromPreset(new PresetAAICloudRegionAndSourceFromConfigurationPut(configurationId, desiredCloudRegionId), APPEND);
148         SimulatorApi.registerExpectationFromPreset(new PresetAAIGetPortMirroringSourcePorts(configurationId, portInterfaceId, ViewEdit.COMMON_PORT_MIRRORING_PORT_NAME, isMirrored), APPEND);
149         SimulatorApi.registerExpectationFromPreset(new PresetAAICloudRegionAndSourceFromConfigurationPut(configurationId2, desiredCloudRegionId), APPEND);
150         SimulatorApi.registerExpectationFromPreset(new PresetAAIGetPortMirroringSourcePorts(configurationId2, portInterfaceId, "i'm not your port", isMirrored), APPEND);
151         SimulatorApi.registerExpectationFromPreset(PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC, APPEND);
152         SimulatorApi.registerExpectation(
153                 new String [] {
154                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS,
155                         Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_SERVICE_INSTANCE_BY_ID_PM,
156                         Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT_PM,
157                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SDC_CATALOG_SERVICE_PM,
158                         Constants.RegisterToSimulator.CreateNewServiceInstance.deploy.GET_AIC_ZONES
159                 }, ImmutableMap.<String, Object>of(
160                         "<ORCH_STATUS>", orchStatus, "<IS_MIRRORED>", isMirrored,
161                         "pm1111.zip", modelToReplaceWith
162                         ), SimulatorApi.RegistrationStrategy.APPEND);
163     }
164
165     public static void associatePnf() {
166         SimulatorApi.registerExpectation(
167                 new String [] {
168                         Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
169                         Constants.RegisterToSimulator.pProbe.GET_SPECIFIC_PNF,
170                         Constants.RegisterToSimulator.pProbe.ADD_PNF_RELATIONSHIP,
171                         Constants.RegisterToSimulator.pProbe.GET_ADD_PNF_RELATIONSHIP_ORCH_REQ
172                 }, ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND);
173     }
174
175     public static void searchPnfError() {
176         SimulatorApi.registerExpectation(
177                 new String [] {
178                         Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
179                         Constants.RegisterToSimulator.pProbe.GET_SPECIFIC_PNF_ERROR
180                 }, ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND);
181     }
182     public static void associatePnfError() {
183         SimulatorApi.registerExpectation(
184                 new String [] {
185                         Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
186                         Constants.RegisterToSimulator.pProbe.GET_SPECIFIC_PNF,
187                         Constants.RegisterToSimulator.pProbe.ADD_PNF_RELATIONSHIP_ERROR
188                 }, ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND);
189     }
190
191     public static void dissociatePnf() {
192         SimulatorApi.registerExpectation(
193                 new String [] {
194                         Constants.RegisterToSimulator.pProbe.REMOVE_PNF_RELATIONSHIP,
195                         Constants.RegisterToSimulator.pProbe.GET_REMOVE_PNF_RELATIONSHIP_ORCH_REQ
196                 }, ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND);
197     }
198
199     public static void getAssociatedPnfs() {
200         SimulatorApi.registerExpectation(
201                 new String [] {
202                         Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
203                         Constants.RegisterToSimulator.pProbe.GET_LOGICAL_LINK
204                 }, ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND);
205     }
206
207     public static void activateServiceInstance(String action) {
208         SimulatorApi.registerExpectation(
209                 new String [] {
210                         Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
211                         Constants.RegisterToSimulator.activateDeactivate.ACTIVATE_SERVICE_INSTANCE,
212                         Constants.RegisterToSimulator.activateDeactivate.ACTIVATE_SERVICE_INSTANCE_ORCH_REQUEST
213                 }, ImmutableMap.<String, Object>of("<ACTIVE_ACTION>", action), SimulatorApi.RegistrationStrategy.APPEND);
214     }
215
216
217     public static void activateDeactivateConfiguration(String action) {
218         appendWithGetStatus(new PresetMSOActOnConfiguration(action), PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC);
219     }
220
221     public static void deleteConfiguration() {
222         appendWithGetStatus(new PresetMSODeleteConfiguration(), PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC);
223     }
224
225     public static void enableDisablePort(String action){
226         appendWithGetStatus(new PresetMsoEnableDisablePort(
227                 "c187e9fe-40c3-4862-b73e-84ff056205f6",
228                 "9533-config-LB1113", action), PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC);
229     }
230
231     public static void addNetwork() {
232         SimulatorApi.registerExpectation(
233                 new String [] {
234                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_Emanuel,
235                         Constants.RegisterToSimulator.addNetwork.AAI_GET_TENANTS,
236                         Constants.RegisterToSimulator.addNetwork.AAI_NAMED_QUERY_FOR_VIEW_EDIT,
237                         Constants.RegisterToSimulator.addNetwork.FILTER_SERVICE_INSTANCE_BY_ID,
238                         //Constants.RegisterToSimulator.addNetwork.FILTER_SERVICE_INSTANCE_BY_NAME,
239                         Constants.RegisterToSimulator.addNetwork.GET_SDC_CATALOG_SERVICES_NETWORK,
240
241                 }, ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND);
242     }
243
244     public static void msoAddNetworkError(String instanceName){
245         SimulatorApi.registerExpectation(
246                 new String [] {
247                         Constants.RegisterToSimulator.addNetwork.MSO_ADD_NETWORK_ERROR
248                 }, ImmutableMap.<String, Object>of("<SERVICE_INSTANCE_NAME>",instanceName), SimulatorApi.RegistrationStrategy.APPEND);
249     }
250     public static void activateServiceInstanceError(String action) {
251         SimulatorApi.registerExpectation(
252                 new String []{
253                         Constants.RegisterToSimulator.pProbe.GET_SERVICE_INSTANCE_WITH_LOGICAL_LINKS,
254                         Constants.RegisterToSimulator.activateDeactivate.ACTIVATE_SERVICE_INSTANCE_ERROR
255                 } , ImmutableMap.<String, Object>of("<ACTIVE_ACTION>", action), SimulatorApi.RegistrationStrategy.APPEND);
256     }
257
258
259     public static void createPolicyConfiguration(boolean isSuccessFlow, String serviceType) {
260         createConfiguration();
261
262         SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND,
263                 Constants.RegisterToSimulator.createConfiguration.GET_MODEL_BY_ONE_INVARIANT_ID);
264
265         SimulatorApi.registerExpectation(Constants.RegisterToSimulator.createConfiguration.GET_PNF_INSTANCES,
266                 ImmutableMap.of("<SERVICE-TYPE>", serviceType), SimulatorApi.RegistrationStrategy.APPEND);
267
268         if (isSuccessFlow) {
269             msoCreatePProbeConfiguration();
270         } else {
271             msoCreatePProbeConfigurationError();
272         }
273     }
274
275     public static void deletePolicyConfiguration(boolean isSuccessFlow) {
276         createConfiguration();
277         SimulatorApi.registerExpectation(SimulatorApi.RegistrationStrategy.APPEND,
278                 Constants.RegisterToSimulator.createConfiguration.GET_MODEL_BY_ONE_INVARIANT_ID);
279         appendWithGetStatus(new PresetMSODeleteConfiguration(), PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC);
280     }
281
282
283
284
285     private static void msoCreatePProbeConfiguration() {
286         appendWithGetStatus(new PresetMSOCreateConfiguration("c187e9fe-40c3-4862-b73e-84ff056205f6"), PresetAAIGetCloudOwnersByCloudRegionId.PRESET_AAIAIC25_TO_ATT_AIC);
287     }
288
289     private static void appendWithGetStatus(PresetMSOBaseCreateInstancePost createInstancePreset, PresetAAIGetCloudOwnersByCloudRegionId cloudOwnerPreset) {
290         SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
291                 createInstancePreset,
292                 cloudOwnerPreset,
293                 new PresetMSOOrchestrationRequestGet(COMPLETE, createInstancePreset.getRequestId(), "Success", false)),
294                 SimulatorApi.RegistrationStrategy.APPEND);
295     }
296
297     private static void msoCreatePProbeConfigurationError() {
298         SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
299                 new PresetMSOCreateConfiguration("c187e9fe-40c3-4862-b73e-84ff056205f6", 500, null),
300                 PresetAAIGetCloudOwnersByCloudRegionId.PRESET_AAIAIC25_TO_ATT_AIC),
301                 SimulatorApi.RegistrationStrategy.APPEND);
302     }
303
304     public static void createConfiguration() {
305         createConfiguration("model-version-id=2a2ea15f-07c6-4b89-bfca-e8aba39a34d6&model-invariant-id=a7eac2b3-8444-40ee-92e3-b3359b32445c");
306     }
307
308     public static void createConfiguration(String model) {
309         SimulatorApi.registerExpectation(
310                 new String []{
311                         Constants.RegisterToSimulator.createConfiguration.GET_VNF_INSTANCES,
312                         Constants.RegisterToSimulator.createConfiguration.GET_MODEL_BY_2_INVARIANT_IDS
313                 } , ImmutableMap.of("model-version-id=2a2ea15f-07c6-4b89-bfca-e8aba39a34d6&model-invariant-id=a7eac2b3-8444-40ee-92e3-b3359b32445c", model), SimulatorApi.RegistrationStrategy.APPEND);
314     }
315
316     public static void getNetworkNodeFormData() {
317         SimulatorApi.registerExpectation(
318                 new String []{
319                         Constants.RegisterToSimulator.createConfiguration.GET_TENANTS
320                 } , ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND);
321     }
322
323     public static void createNewServiceInstance(String subscriber) {
324         SimulatorApi.registerExpectationFromPreset(new PresetAAIGetSubscribersGet(),SimulatorApi.RegistrationStrategy.APPEND);
325         SimulatorApi.registerExpectation(Constants.RegisterToSimulator.CreateNewServiceInstance.GET_SERVICES, SimulatorApi.RegistrationStrategy.APPEND);
326
327         switch (subscriber) {
328             case "SILVIA ROBBINS": createNewServiceInstanceUspVoice(); break;
329             case "CAR_2020_ER": createNewServiceInstanceMso1610ST(); break;
330         }
331     }
332
333     private static void createNewServiceInstanceMso1610ST() {
334         SimulatorApi.registerExpectation(
335                 new String []{
336                         Constants.RegisterToSimulator.CreateNewServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_CAR_2020_ER,
337                         Constants.RegisterToSimulator.CreateNewServiceInstance.GET_MODELS_BY_SERVICE_TYPE_CAR_2020_ER
338                 } , ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND);
339     }
340
341     private static void createNewServiceInstanceUspVoice() {
342         SimulatorApi.registerExpectation(
343                 new String []{
344                         Constants.RegisterToSimulator.CreateNewServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS,
345                         Constants.RegisterToSimulator.CreateNewServiceInstance.GET_MODELS_BY_SERVICE_TYPE_SILVIA_ROBBINS
346                 } , ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND);
347     }
348
349     public static void deployNewServiceInstance(String instanceName) {
350         SimulatorApi.registerExpectation(
351                 new String []{
352                         Constants.RegisterToSimulator.CreateNewServiceInstance.deploy.SDC_GET_CATALOG,
353                         Constants.RegisterToSimulator.CreateNewServiceInstance.deploy.GET_AIC_ZONES,
354                         Constants.RegisterToSimulator.CreateNewServiceInstance.deploy.MSO_CREATE_SVC_INSTANCE,
355                         Constants.RegisterToSimulator.CreateNewServiceInstance.deploy.MSO_CREATE_SVC_INSTANCE_ORCH_REQ
356                 } , ImmutableMap.<String, Object>of("<INSTANCE_NAME>", instanceName), SimulatorApi.RegistrationStrategy.APPEND);
357     }
358
359     public static void searchExistingServiceInstanceWithoutModelVerId() {
360         SimulatorApi.registerExpectation(
361                 new String []{
362                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_CRAIG_ROBERTS,
363                         Constants.RegisterToSimulator.SearchForServiceInstance.FILTER_SERVICE_INSTANCE_BY_ID_NO_MODEL_VER_ID,
364                        // Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT_NO_MODEL_VER_ID
365                 } ,  ImmutableMap.<String, Object>of(), SimulatorApi.RegistrationStrategy.APPEND);
366     }
367
368     public static void deleteExistingInstance(String orchStatus, String type)  {
369         deleteExistingInstance(orchStatus, type, "pending-delete");
370     }
371
372     public static void deleteExistingInstance(String orchStatus, String type, String vfModuleOrchStatus) {
373         genericSearchExistingServiceInstance();
374         SimulatorApi.registerExpectation(
375                 new String [] {
376                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS,
377                         Constants.RegisterToSimulator.CreateNewServiceInstance.deploy.GET_AIC_ZONES
378                 }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus, "<VF_MODULE_ORCH_STATUS>", vfModuleOrchStatus), SimulatorApi.RegistrationStrategy.APPEND);
379
380         //for delete service instance we will use other preset , so the service would be empty
381         if (!StringUtils.equals(type, "Service")) {
382             SimulatorApi.registerExpectation(
383                 new String [] {
384                     Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT,
385                 }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus, "<VF_MODULE_ORCH_STATUS>", vfModuleOrchStatus), SimulatorApi.RegistrationStrategy.APPEND);
386         }
387
388         SimulatorApi.registerExpectationFromPresets(
389                 ImmutableList.of(
390                         new PresetAAIGetTenants(),
391                         new PresetMSODeleteInstanceOrchestrationRequestGet(type),
392                         new PresetSDCGetServiceMetadataGet("7a6ee536-f052-46fa-aa7e-2fca9d674c44", "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", "service-Complexservice-aLaCarte-csar.zip"),
393                         new PresetSDCGetServiceToscaModelGet("7a6ee536-f052-46fa-aa7e-2fca9d674c44", "service-Complexservice-aLaCarte-csar.zip"),
394                         new PresetMSODeactivateAndCloudDelete("3f93c7cb-2fd0-4557-9514-e189b7b04f9d", "c015cc0f-0f37-4488-aabf-53795fd93cd3",
395                                 "a231a99c-7e75-4d6d-a0fb-5c7d26f30f77", "c0011670-0e1a-4b74-945d-8bf5aede1d9c", "irma-aic"),
396                         PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MTN6_TO_ATT_AIC
397                 ),
398                 SimulatorApi.RegistrationStrategy.APPEND);
399     }
400
401     public static void deleteExistingVolumeGroupInstance(String orchStatus) {
402         deleteExistingInstance(orchStatus, "Volume Group");
403         SimulatorApi.registerExpectationFromPreset(new PresetMSODeleteVolumeGroup(), SimulatorApi.RegistrationStrategy.APPEND);
404     }
405
406     public static void deleteExistingVfModuleInstance(String orchStatus) {
407         deleteExistingInstance(orchStatus, "VF Module");
408         SimulatorApi.registerExpectationFromPreset(new PresetMSODeleteVfModule(), SimulatorApi.RegistrationStrategy.APPEND);
409     }
410
411     public static void deleteExistingVnfInstance(String orchStatus) {
412         deleteExistingInstance(orchStatus, "Vnf");
413         SimulatorApi.registerExpectationFromPreset(new PresetMSODeleteVnf(), SimulatorApi.RegistrationStrategy.APPEND);
414     }
415
416     public static void deleteExistingNetworkInstance(String orchStatus) {
417         deleteExistingInstance(orchStatus, "Network");
418         SimulatorApi.registerExpectationFromPreset(new PresetMSODeleteNetwork(), SimulatorApi.RegistrationStrategy.APPEND);
419     }
420
421     public static void deleteExistingServiceInstance(String orchStatus) {
422         deleteExistingInstance(orchStatus, "Service");
423         SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
424                 new PresetMSODeleteService(),
425                 new PresetAAIPostNamedQueryForViewEdit("3f93c7cb-2fd0-4557-9514-e189b7b04f9d", false, false)), SimulatorApi.RegistrationStrategy.APPEND);
426     }
427
428     public static void resumeWithHomingDataVfModule(String serviceOrchStatus, String vfModuleOrchStatus, String vfModuleName)  {
429         SimulatorApi.registerExpectation(Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT,
430                 ImmutableMap.<String, Object>of("<ORCH_STATUS>", serviceOrchStatus, "<VF_MODULE_ORCH_STATUS>", vfModuleOrchStatus),
431                 SimulatorApi.RegistrationStrategy.APPEND);
432
433         SimulatorApi.registerExpectationFromPresets(
434                 ImmutableList.of (
435                         new PresetAAIGetHomingForVfModule("c015cc0f-0f37-4488-aabf-53795fd93cd3", "a231a99c-7e75-4d6d-a0fb-5c7d26f30f77", "092eb9e8e4b7412e8787dd091bc58e86", "hvf6"),
436                         new PresetMSOCreateVfModule("3f93c7cb-2fd0-4557-9514-e189b7b04f9d",
437                                 "c015cc0f-0f37-4488-aabf-53795fd93cd3", DEFAULT_CLOUD_OWNER, vfModuleName,
438                                 "7a6ee536-f052-46fa-aa7e-2fca9d674c44", "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", "ComplexService"),
439                         new PresetMSOOrchestrationRequestGet(
440                                 COMPLETE,
441                                 "c0011670-0e1a-4b74-945d-8bf5aede1d9c",
442                                 Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT,
443                                 false)),
444                 SimulatorApi.RegistrationStrategy.APPEND);
445     }
446
447     public static void resumeVfModule(String serviceInstanceId, String vnfInstanceId ){
448         BulkRegistration.searchExistingServiceInstance();
449         SimulatorApi.registerExpectationFromPresets(
450                 ImmutableList.of (
451                         new PresetAAIGetTenants(),
452                         new PresetMSOCreateVfModule(serviceInstanceId,vnfInstanceId, DEFAULT_CLOUD_OWNER),
453                         new PresetMSOOrchestrationRequestGet(
454                                 COMPLETE,
455                                 "c0011670-0e1a-4b74-945d-8bf5aede1d9c",
456                                 Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT,
457                                 false)),
458                 SimulatorApi.RegistrationStrategy.APPEND);
459
460     }
461 }