From c4814252e8ef58dde843824d1c4d57ea708a961e Mon Sep 17 00:00:00 2001 From: as221v Date: Mon, 9 Sep 2019 17:56:41 +0300 Subject: Reduce vnf data response from A&AI in change management flows Issue-ID: VID-596 Signed-off-by: Amir Skalka Change-Id: I4462ef0c2dbc9880d1a0d204f6552e3842aad821 Signed-off-by: Alexey Sandler --- .../presets/aai/PresetBaseAAICustomQuery.java | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetBaseAAICustomQuery.java (limited to 'vid-automation/src/main/java/org/onap') diff --git a/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetBaseAAICustomQuery.java b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetBaseAAICustomQuery.java new file mode 100644 index 000000000..a979bae53 --- /dev/null +++ b/vid-automation/src/main/java/org/onap/simulator/presetGenerator/presets/aai/PresetBaseAAICustomQuery.java @@ -0,0 +1,54 @@ +package org.onap.simulator.presetGenerator.presets.aai; + +import com.google.common.collect.ImmutableMap; +import java.util.Collections; +import java.util.List; +import java.util.Map; +import org.onap.simulator.presetGenerator.presets.BasePresets.BaseAAIPreset; +import org.springframework.http.HttpMethod; + +public abstract class PresetBaseAAICustomQuery extends BaseAAIPreset { + + private final String requestBodyStart; + private final String requestBodyQuery; + private final FORMAT format; + + public enum FORMAT { + RESOURCE, SIMPLE; + + public String value() { + return this.name().toLowerCase(); + } + } + public PresetBaseAAICustomQuery(FORMAT format, String requestBodyStart, String requestBodyQuery) { + this.format = format; + this.requestBodyStart = requestBodyStart; + this.requestBodyQuery = requestBodyQuery; + } + + @Override + public HttpMethod getReqMethod() { + return HttpMethod.PUT; + } + + @Override + public String getReqPath() { + return getRootPath() + "/query"; + } + + @Override + public Map getQueryParams() { + return ImmutableMap.of( + "format", Collections.singletonList(format.value()) + ); + } + + @Override + public Object getRequestBody() { + return ImmutableMap.of( + "start", new String[] {requestBodyStart}, + "query", requestBodyQuery + ); + } + +} -- cgit 1.2.3-korg