Fix for Penetration test _ Session and cookie management
[vid.git] / vid-automation / src / main / java / vid / automation / test / services / BulkRegistration.java
index 0f08395..7366b82 100644 (file)
@@ -1,11 +1,13 @@
 package vid.automation.test.services;
 
-import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.ATT_NC;
+import static org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset.DEFAULT_CLOUD_OWNER;
+import static org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet.COMPLETE;
 import static vid.automation.test.infra.ModelInfo.serviceFabricSriovService;
 import static vid.automation.test.services.SimulatorApi.RegistrationStrategy.APPEND;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
+import org.apache.commons.lang3.StringUtils;
 import org.onap.simulator.presetGenerator.presets.aai.PresetAAICloudRegionAndSourceFromConfigurationPut;
 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIFilterServiceInstanceById;
 import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId;
@@ -37,6 +39,7 @@ import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMsoEna
 import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceMetadataGet;
 import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaModelGet;
 import vid.automation.test.Constants;
+import vid.automation.test.Constants.ViewEdit;
 
 public class BulkRegistration {
 
@@ -74,7 +77,7 @@ public class BulkRegistration {
                         new PresetSDCGetServiceToscaModelGet(serviceFabricSriovService),
                         new PresetAAIGetNetworkZones(),
                         new PresetMSOActivateFabricConfiguration("c187e9fe-40c3-4862-b73e-84ff056205f61234"),
-                        new PresetMSOOrchestrationRequestGet("COMPLETE", "318cc766-b673-4a50-b9c5-471f68914584", "Success")),
+                        new PresetMSOOrchestrationRequestGet(COMPLETE, "318cc766-b673-4a50-b9c5-471f68914584", "Success", false)),
                 SimulatorApi.RegistrationStrategy.APPEND);
     }
 
@@ -137,11 +140,14 @@ public class BulkRegistration {
     public static void searchExistingServiceInstancePortMirroring(String orchStatus, boolean isMirrored, String desiredCloudRegionId) {
         genericSearchExistingServiceInstance();
         final String configurationId = "9533-config-LB1113";
+        final String configurationId2 = "9533-config-LB1114";
         final String portInterfaceId = "d35bf534-7d8e-4cb4-87f9-0a8bb6cd47b2";
         final String modelToReplaceWith ="pm1111_equip_model_rename.zip";
 
         SimulatorApi.registerExpectationFromPreset(new PresetAAICloudRegionAndSourceFromConfigurationPut(configurationId, desiredCloudRegionId), APPEND);
-        SimulatorApi.registerExpectationFromPreset(new PresetAAIGetPortMirroringSourcePorts(configurationId, portInterfaceId, "i'm a port", isMirrored), APPEND);
+        SimulatorApi.registerExpectationFromPreset(new PresetAAIGetPortMirroringSourcePorts(configurationId, portInterfaceId, ViewEdit.COMMON_PORT_MIRRORING_PORT_NAME, isMirrored), APPEND);
+        SimulatorApi.registerExpectationFromPreset(new PresetAAICloudRegionAndSourceFromConfigurationPut(configurationId2, desiredCloudRegionId), APPEND);
+        SimulatorApi.registerExpectationFromPreset(new PresetAAIGetPortMirroringSourcePorts(configurationId2, portInterfaceId, "i'm not your port", isMirrored), APPEND);
         SimulatorApi.registerExpectationFromPreset(PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC, APPEND);
         SimulatorApi.registerExpectation(
                 new String [] {
@@ -284,7 +290,7 @@ public class BulkRegistration {
         SimulatorApi.registerExpectationFromPresets(ImmutableList.of(
                 createInstancePreset,
                 cloudOwnerPreset,
-                new PresetMSOOrchestrationRequestGet(PresetMSOOrchestrationRequestGet.COMPLETE, createInstancePreset.getRequestId(), "Success")),
+                new PresetMSOOrchestrationRequestGet(COMPLETE, createInstancePreset.getRequestId(), "Success", false)),
                 SimulatorApi.RegistrationStrategy.APPEND);
     }
 
@@ -368,9 +374,17 @@ public class BulkRegistration {
         SimulatorApi.registerExpectation(
                 new String [] {
                         Constants.RegisterToSimulator.SearchForServiceInstance.GET_SUBSCRIBERS_FOR_CUSTOMER_SILVIA_ROBBINS,
-                        Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT,
                         Constants.RegisterToSimulator.CreateNewServiceInstance.deploy.GET_AIC_ZONES
                 }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus, "<VF_MODULE_ORCH_STATUS>", vfModuleOrchStatus), SimulatorApi.RegistrationStrategy.APPEND);
+
+        //for delete service instance we will use other preset , so the service would be empty
+        if (!StringUtils.equals(type, "Service")) {
+            SimulatorApi.registerExpectation(
+                new String [] {
+                    Constants.RegisterToSimulator.SearchForServiceInstance.NAMED_QUERY_VIEW_EDIT,
+                }, ImmutableMap.<String, Object>of("<ORCH_STATUS>", orchStatus, "<VF_MODULE_ORCH_STATUS>", vfModuleOrchStatus), SimulatorApi.RegistrationStrategy.APPEND);
+        }
+
         SimulatorApi.registerExpectationFromPresets(
                 ImmutableList.of(
                         new PresetAAIGetTenants(),
@@ -418,12 +432,15 @@ public class BulkRegistration {
 
         SimulatorApi.registerExpectationFromPresets(
                 ImmutableList.of (
-                        PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC,
-                        new PresetAAIGetHomingForVfModule("c015cc0f-0f37-4488-aabf-53795fd93cd3", "a231a99c-7e75-4d6d-a0fb-5c7d26f30f77", "092eb9e8e4b7412e8787dd091bc58e86", "mdt1"),
+                        new PresetAAIGetHomingForVfModule("c015cc0f-0f37-4488-aabf-53795fd93cd3", "a231a99c-7e75-4d6d-a0fb-5c7d26f30f77", "092eb9e8e4b7412e8787dd091bc58e86", "hvf6"),
                         new PresetMSOCreateVfModule("3f93c7cb-2fd0-4557-9514-e189b7b04f9d",
-                                "c015cc0f-0f37-4488-aabf-53795fd93cd3", ATT_NC, vfModuleName,
+                                "c015cc0f-0f37-4488-aabf-53795fd93cd3", DEFAULT_CLOUD_OWNER, vfModuleName,
                                 "7a6ee536-f052-46fa-aa7e-2fca9d674c44", "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", "ComplexService"),
-                        new PresetMSOOrchestrationRequestGet("COMPLETE","c0011670-0e1a-4b74-945d-8bf5aede1d9c",Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT)),
+                        new PresetMSOOrchestrationRequestGet(
+                                COMPLETE,
+                                "c0011670-0e1a-4b74-945d-8bf5aede1d9c",
+                                Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT,
+                                false)),
                 SimulatorApi.RegistrationStrategy.APPEND);
     }
 
@@ -432,9 +449,12 @@ public class BulkRegistration {
         SimulatorApi.registerExpectationFromPresets(
                 ImmutableList.of (
                         new PresetAAIGetTenants(),
-                        PresetAAIGetCloudOwnersByCloudRegionId.PRESET_MDT1_TO_ATT_NC,
-                        new PresetMSOCreateVfModule(serviceInstanceId,vnfInstanceId, ATT_NC),
-                        new PresetMSOOrchestrationRequestGet("COMPLETE","c0011670-0e1a-4b74-945d-8bf5aede1d9c",Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT)),
+                        new PresetMSOCreateVfModule(serviceInstanceId,vnfInstanceId, DEFAULT_CLOUD_OWNER),
+                        new PresetMSOOrchestrationRequestGet(
+                                COMPLETE,
+                                "c0011670-0e1a-4b74-945d-8bf5aede1d9c",
+                                Constants.ViewEdit.VF_MODULE_CREATED_SUCCESSFULLY_TEXT,
+                                false)),
                 SimulatorApi.RegistrationStrategy.APPEND);
 
     }