aboutsummaryrefslogtreecommitdiffstats
path: root/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java
diff options
context:
space:
mode:
authorajay_dp001 <ajay.deep.singh@est.tech>2020-12-03 15:18:08 +0530
committerajay_dp001 <ajay.deep.singh@est.tech>2021-01-07 22:57:02 +0530
commit1feb0a77c857d811283d74d0f3df018d42c2debe (patch)
tree298b6820f52f4f1e1863f9037841434f8665bd67 /plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java
parenta94201cdbbe0c1ceb2fa0e676a61627e4bc7b657 (diff)
CSIT Support for ServiceLevel PNF Software Upgrade
- Details on CSIT test cases: https://wiki.onap.org/display/DW/E2E+Integration+Test+Cases+PNF-Software+Upgrade+With+Schema+Updates - Newly added test are listed below: 1. Distribute Service Level Upgrade Template 2. Get ServiceModel Version from AAI using ServiceModelInVariant UUId 3. Invoke Service Instantiation for ServiceLevel Upgrade 4. Verify PNF-1 Configuration for Service Level Upgrade 5. AAI-Update for PNF-1 Target Software Version after Service Level Upgrade 6. Verify PNF-2 Configuration for Service Level Upgrade 7. AAI-Update for PNF-2 Target Software Version after Service Level Upgrade 8. Test AAI-Update for ServiceInstance after Service Level Upgrade Issue-ID: INT-1591 Signed-off-by: ajay_dp001 <ajay.deep.singh@est.tech> Change-Id: I7bd1ee8d19692f16e0f4415b5115e88a9feff869
Diffstat (limited to 'plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java')
-rw-r--r--plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java19
1 files changed, 12 insertions, 7 deletions
diff --git a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java
index ddc2b624..13753871 100644
--- a/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java
+++ b/plans/usecases-pnf-sw-upgrade/pnf-sw-upgrade/sorch/simulator/aai-simulator/src/main/java/org/onap/aaisimulator/controller/ServiceDesignAndCreationController.java
@@ -1,6 +1,6 @@
/*-
* ============LICENSE_START=======================================================
- * Copyright (C) 2019 Nordix Foundation.
+ * Copyright (C) 2020 Nordix Foundation.
* ================================================================================
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -19,11 +19,14 @@
*/
package org.onap.aaisimulator.controller;
+import com.google.gson.Gson;
+import com.google.gson.GsonBuilder;
+import javax.ws.rs.core.MediaType;
+import org.onap.aaisimulator.models.ServiceModelVersion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpStatus;
-import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
@@ -50,25 +53,27 @@ public class ServiceDesignAndCreationController {
@Value("${SERVICE_DESIGN_AND_CREATION_RESPONSES_LOCATION:./}")
private String responsesLocation;
- @GetMapping(path = "/models/model/{model-invariant-id}/model-vers",
- produces = MediaType.APPLICATION_XML_VALUE)
+ @GetMapping(path = "/models/model/{model-invariant-id}/model-vers", produces = {MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
public ResponseEntity<String> getModelVers(@PathVariable("model-invariant-id") String modelInvariantId) {
Path responsesPath = Paths.get(responsesLocation).toAbsolutePath();
LOGGER.info("Will get ModelVer for 'model-invariant-id': {}, looking under {}",
modelInvariantId, responsesPath.toString());
- Path responsePath = responsesPath.resolve(modelInvariantId + ".xml");
+ Path responsePath = responsesPath.resolve(modelInvariantId + ".json");
if (!responsePath.toFile().exists()) {
LOGGER.error("{} not found", responsePath.toString());
return ResponseEntity.notFound().build();
}
try {
String content = new String(Files.readAllBytes(responsePath), StandardCharsets.UTF_8);
+ Gson gson = new GsonBuilder().setPrettyPrinting().create();
+ ServiceModelVersion json = gson.fromJson(content, ServiceModelVersion.class);
+ String jsonInString = gson.toJson(json);
LOGGER.info("{} found with {} characters", responsePath.toString(), content.length());
- return ResponseEntity.ok().body(content);
+ return ResponseEntity.ok().body(jsonInString);
} catch (IOException e) {
LOGGER.error("Failed to read response from {}: {}}", responsePath.toString(), e.getMessage());
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).build();
}
}
-}
+} \ No newline at end of file