summaryrefslogtreecommitdiffstats
path: root/test-apis-ci/src
diff options
context:
space:
mode:
authorVodafone <onap@vodafone.com>2019-04-11 16:07:52 +0530
committerOren Kleks <orenkle@amdocs.com>2019-04-11 11:28:18 +0000
commit962b8610448d6cec8f12045e09b4adac3aefbf4c (patch)
tree2d7cfe1759ce9c3f20e7be928325722058e13948 /test-apis-ci/src
parent55e8600f2f70f051f7bd897cd4926e258980ba07 (diff)
Functional Test Automation: VSP
Change-Id: I2090a0646c1f1c7077830dbf49294f9a711774e4 Issue-ID: SDC-2047 Co-authored-by: rahul.ghugikar@vodafone.com, soumyarup.paul@vodafone.com Signed-off-by: Vodafone <onap@vodafone.com>
Diffstat (limited to 'test-apis-ci/src')
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java2
-rw-r--r--test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java31
2 files changed, 33 insertions, 0 deletions
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
index f85f326f03..a4338fb272 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/api/Urls.java
@@ -422,4 +422,6 @@ public interface Urls {
String DELETE_CAPABILITY = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/capabilities/%s";
String GET_CAPABILITY = SDC_HTTP_METHOD + "://%s:%s/sdc2/rest/v1/catalog/%s/%s/capabilities/%s";
+ //VSP Validation Operation
+ final String VSP_VALIDATION_CONFIGURATION = SDC_HTTP_METHOD + "://%s:%s/onboarding-api/v1.0/externaltesting/config";
}
diff --git a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
index 4f03767a85..8b5f91b53d 100644
--- a/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
+++ b/test-apis-ci/src/main/java/org/openecomp/sdc/ci/tests/utils/general/OnboardingUtils.java
@@ -27,6 +27,7 @@ import org.openecomp.sdc.ci.tests.datatypes.http.HttpHeaderEnum;
import org.openecomp.sdc.ci.tests.datatypes.http.HttpRequest;
import org.openecomp.sdc.ci.tests.datatypes.http.RestResponse;
import org.openecomp.sdc.ci.tests.utils.Utils;
+import org.openecomp.sdc.ci.tests.utils.rest.ResponseParser;
import java.util.*;
@@ -138,6 +139,36 @@ public class OnboardingUtils {
return response;
}
+ public static String getVspValidationConfiguration() throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.VSP_VALIDATION_CONFIGURATION, config.getOnboardingBeHost(), config.getOnboardingBePort());
+ Map<String, String> headersMap = prepareHeadersMap("cs0008");
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendGet(url, headersMap);
+ if(response.getErrorCode().intValue() == 200){
+ return ResponseParser.getValueFromJsonResponse(response.getResponse(), "enabled");
+ }
+ throw new Exception("Cannot get configuration file");
+ //return response;
+ }
+
+ public static String putVspValidationConfiguration(boolean value) throws Exception {
+ Config config = Utils.getConfig();
+ String url = String.format(Urls.VSP_VALIDATION_CONFIGURATION, config.getOnboardingBeHost(), config.getOnboardingBePort());
+ Map<String, String> headersMap = prepareHeadersMap("cs0008");
+
+ String body = String.format("{\"enabled\": \"%s\"}", value);
+
+ HttpRequest http = new HttpRequest();
+ RestResponse response = http.httpSendPut(url, body, headersMap);
+ if(response.getErrorCode().intValue() == 200){
+ return ResponseParser.getValueFromJsonResponse(response.getResponse(), "enabled");
+ }
+ throw new Exception("Cannot set configuration file");
+ //return response;
+ }
+
protected static Map<String, String> prepareHeadersMap(String userId) {
Map<String, String> headersMap = new HashMap<String, String>();
headersMap.put(HttpHeaderEnum.CONTENT_TYPE.getValue(), "application/json");