From 2faaef3c1c05fcef0cbcda7f77f6c173826e57b6 Mon Sep 17 00:00:00 2001 From: Eylon Malin Date: Thu, 31 Oct 2019 08:24:28 +0200 Subject: assert headers in AAI base preset Issue-ID: VID-253 Signed-off-by: Eylon Malin Change-Id: Ic86ed177602f997f5040351f4a4fb3c79ed545a2 --- .../presets/BasePresets/BaseAAIPreset.java | 14 +++++-- .../automation/test/services/BulkRegistration.java | 48 ++++++++++++++++++---- 2 files changed, 50 insertions(+), 12 deletions(-) (limited to 'vid-automation/src/main') diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseAAIPreset.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseAAIPreset.java index 3e99a38d9..c3c89c5d6 100644 --- a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseAAIPreset.java +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/BasePresets/BaseAAIPreset.java @@ -1,12 +1,20 @@ package org.onap.simulator.presetGenerator.presets.BasePresets; -/** - * Created by itzikliderman on 27/12/2017. - */ +import java.util.Map; + public abstract class BaseAAIPreset extends BasePreset { @Override protected String getRootPath() { return "/aai/v.."; } + + @Override + public Map getRequestHeaders() { + Map map = super.getRequestHeaders(); + map.put("X-ONAP-PartnerName", "VID.VID"); + map.put("X-InvocationID", "[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}"); + map.put("X-ONAP-RequestID", "[0-9a-fA-F]{8}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{4}\\-[0-9a-fA-F]{12}"); + return map; + } } diff --git a/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java b/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java index 050aa752c..7366b82b2 100644 --- a/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java +++ b/vid-automation/src/main/java/vid/automation/test/services/BulkRegistration.java @@ -1,9 +1,37 @@ package vid.automation.test.services; +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.onap.simulator.presetGenerator.presets.aai.*; -import org.onap.simulator.presetGenerator.presets.mso.*; +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; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetHomingForVfModule; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetModelsByOwningEntity; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetModelsByProject; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetNetworkZones; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetPortMirroringSourcePorts; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubDetailsWithoutInstancesGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetSubscribersGet; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetTenants; +import org.onap.simulator.presetGenerator.presets.aai.PresetAAIPostNamedQueryForViewEdit; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOActivateFabricConfiguration; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOBaseCreateInstancePost; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOCreateVfModule; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeactivateAndCloudDelete; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteInstanceOrchestrationRequestGet; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteNetwork; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteService; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVfModule; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVnf; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSODeleteVolumeGroup; +import org.onap.simulator.presetGenerator.presets.mso.PresetMSOOrchestrationRequestGet; import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSOActOnConfiguration; import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSOCreateConfiguration; import org.onap.simulator.presetGenerator.presets.mso.configuration.PresetMSODeleteConfiguration; @@ -13,12 +41,6 @@ import org.onap.simulator.presetGenerator.presets.sdc.PresetSDCGetServiceToscaMo import vid.automation.test.Constants; import vid.automation.test.Constants.ViewEdit; -import static org.onap.simulator.presetGenerator.presets.BasePresets.BaseMSOPreset.DEFAULT_CLOUD_OWNER; -import static org.onap.simulator.presetGenerator.presets.aai.PresetAAIGetCloudOwnersByCloudRegionId.ATT_NC; -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; - public class BulkRegistration { public static void searchExistingServiceInstance() { @@ -352,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.of("", orchStatus, "", 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.of("", orchStatus, "", vfModuleOrchStatus), SimulatorApi.RegistrationStrategy.APPEND); + } + SimulatorApi.registerExpectationFromPresets( ImmutableList.of( new PresetAAIGetTenants(), -- cgit 1.2.3-korg