summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguochuyicmri <guochuyi@chinamobile.com>2019-04-23 14:22:11 +0800
committerguochuyicmri <guochuyi@chinamobile.com>2019-04-23 14:36:50 +0800
commitb1aa04422b3c0598b7ad6d73a2623fae694d70f7 (patch)
tree4fd3223431174cbdb31bbb2f7c5615b9278d778c
parent1bd5af6ba66a603396c7e10cd44bcd05d66afcd3 (diff)
Change backend Code for LCM UI page of service creation
Change-Id: Ia26583582a1fc36cfc87b88fde64646c2e1b8975 Issue-ID: USECASEUI-221 Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
-rw-r--r--server/pom.xml8
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java6
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java4
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java3
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java25
5 files changed, 41 insertions, 5 deletions
diff --git a/server/pom.xml b/server/pom.xml
index 8773deec..74a63043 100644
--- a/server/pom.xml
+++ b/server/pom.xml
@@ -15,14 +15,14 @@
limitations under the License.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
-
- <parent>
+
+ <parent>
<groupId>org.onap.usecase-ui.server</groupId>
<artifactId>usecase-ui-server-parent</artifactId>
<version>1.3.0-SNAPSHOT</version>
</parent>
-
- <modelVersion>4.0.0</modelVersion>
+
+ <modelVersion>4.0.0</modelVersion>
<groupId>org.onap.usecase-ui.server</groupId>
<artifactId>usecase-ui-server</artifactId>
<version>1.3.0-SNAPSHOT</version>
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java
index 732291d0..a766c0a6 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java
@@ -148,6 +148,12 @@ public class PackageDistributionController {
return packageDistributionService.fetchNsTemplateData(request);
}
+ @RequestMapping(value={"/uui-lcm/fetchTemplateInfo"},method = RequestMethod.POST,produces="application/json")
+ public JSONObject fetchTemplateInfo(HttpServletRequest request){
+ String model = packageDistributionService.fetchTemplateInfo(request).getString("model");
+ JSONObject modelJson = JSONObject.parseObject(model);
+ return modelJson;
+ }
@RequestMapping(value = {"/uui-lcm/listNsTemplates"}, method = RequestMethod.GET , produces = "application/json")
public String listNsTemplates(){
return packageDistributionService.listNsTemplates();
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java
index a4497f16..3133f6e8 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java
@@ -28,6 +28,8 @@ import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.DistributionResult
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.Job;
import org.onap.usecaseui.server.service.lcm.domain.vfc.beans.JobStatus;
+import com.alibaba.fastjson.JSONObject;
+
public interface PackageDistributionService {
VfNsPackageInfo retrievePackageInfo();
@@ -52,6 +54,8 @@ public interface PackageDistributionService {
String fetchNsTemplateData(HttpServletRequest request);
+ JSONObject fetchTemplateInfo(HttpServletRequest request);
+
String getVnfPackages();
String getNetworkServicePackages();
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java
index 570ace3c..6ddec942 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java
@@ -52,6 +52,9 @@ public interface VfcService {
@POST("/api/catalog/v1/parsernsd")
Call<ResponseBody> fetchNsTemplateData(@Body RequestBody body);
+ @POST("/api/parser/v1/parser")
+ Call<ResponseBody> fetchTemplateInfo(@Body RequestBody body);
+
@GET("/api/nslcm/v1/ns")
Call<nsServiceRsp> getNetworkServiceInfo();
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java
index b5350d29..c253b72a 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java
@@ -726,7 +726,30 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
}
return result;
}
-
+
+ @Override
+ public JSONObject fetchTemplateInfo(HttpServletRequest request) {
+ JSONObject result = new JSONObject();;
+ try {
+ logger.info("aai fetchTemplateInfo is starting");
+ RequestBody requestBody = extractBody(request);
+ Response<ResponseBody> response = vfcService.fetchTemplateInfo(requestBody).execute();
+ logger.info("aai fetchTemplateInfo has finished");
+ if (response.isSuccessful()) {
+ result.put("status", Constant.CONSTANT_SUCCESS);
+ result.put("result",JSONObject.parseObject(new String(response.body().bytes())));
+ } else {
+ result.put("status", Constant.CONSTANT_FAILED);
+ result.put("error",String.format("Can not fetchTemplateInfo[code=%s, message=%s]", response.code(), response.message()));
+ logger.error(String.format("Can not fetchTemplateInfo[code=%s, message=%s]", response.code(), response.message()));
+ }
+ } catch (Exception e) {
+ result.put("status", Constant.CONSTANT_FAILED);
+ result.put("errorMessage","fetchTemplateInfo occur exception:"+e);
+ }
+ return result;
+ }
+
@Override
public String instantiateNetworkServiceInstance(HttpServletRequest request, String serviceInstanceId) {
String result = "";