aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguochuyicmri <guochuyi@chinamobile.com>2019-05-16 14:47:03 +0800
committerguochuyicmri <guochuyi@chinamobile.com>2019-05-16 14:47:04 +0800
commitd1f6623a5b690355dcc9d25494ce002e01d4b5ec (patch)
treec55ca461691f52f4d0f9f5b8103b8197b10be8aa
parent89f6d43f45e184272e85127c5dec7d8c577388ba (diff)
Fix ccvpn template parser calling failure
Change-Id: I63511036079a21e1f6ca1b30bc4293d2af99162f Issue-ID: USECASEUI-268 Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java83
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java4
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/PackageDistributionService.java2
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/vfc/VfcService.java14
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultPackageDistributionService.java605
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java18
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java8
8 files changed, 394 insertions, 342 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java
index 62c9ed28..98bbb294 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/CustomerController.java
@@ -20,6 +20,7 @@ import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAICustomer;
import org.onap.usecaseui.server.service.lcm.domain.aai.bean.AAIServiceSubscription;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -34,6 +35,7 @@ import javax.servlet.http.HttpServletRequest;
import java.util.List;
@Controller
+@CrossOrigin(origins="*")
@org.springframework.context.annotation.Configuration
@EnableAspectJAutoProxy
public class CustomerController {
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 7a821ee3..e2051aed 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
@@ -124,14 +124,14 @@ public class PackageDistributionController {
String operationType = request.getParameter("operationType");
JobStatus jobStatus = packageDistributionService.getNsLcmJobStatus(serviceInstanceId,jobId, responseId,operationType);
if(UuiCommonUtil.isNotNullOrEmpty(jobStatus)&&UuiCommonUtil.isNotNullOrEmpty(jobStatus.getResponseDescriptor())&&UuiCommonUtil.isNotNullOrEmpty(jobStatus.getResponseDescriptor().getProgress())){
- String processNum = jobStatus.getResponseDescriptor().getProgress();
- String operationResult = Constant.IN_PROGRESS_CODE;
- if(Integer.parseInt(processNum)==100){
- operationResult = Constant.SUCCESS_CODE;
- }else if(Integer.parseInt(processNum)>100){
- operationResult=Constant.FAIL_CODE;
- }
- serviceLcmService.updateServiceInstanceOperation(serviceInstanceId,operationType,processNum,operationResult);
+ String processNum = jobStatus.getResponseDescriptor().getProgress();
+ String operationResult = Constant.IN_PROGRESS_CODE;
+ if(Integer.parseInt(processNum)==100){
+ operationResult = Constant.SUCCESS_CODE;
+ }else if(Integer.parseInt(processNum)>100){
+ operationResult=Constant.FAIL_CODE;
+ }
+ serviceLcmService.updateServiceInstanceOperation(serviceInstanceId,operationType,processNum,operationResult);
}
return jobStatus;
@@ -148,11 +148,10 @@ 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/fetchCCVPNTemplateData/{csarId}"},method = RequestMethod.POST,produces="application/json")
+ public JSONObject fetchCCVPNTemplateData(HttpServletRequest request, @PathVariable String csarId){
+ JSONObject model = (JSONObject) packageDistributionService.fetchCCVPNTemplateData(request, csarId).get("result");
+ return model;
}
@RequestMapping(value = {"/uui-lcm/listNsTemplates"}, method = RequestMethod.GET , produces = "application/json")
public String listNsTemplates(){
@@ -251,44 +250,44 @@ public class PackageDistributionController {
@RequestMapping(value = {"/uui-lcm/instantiateNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json")
public String instantiateNetworkServiceInstance(HttpServletRequest request) throws ParseException{
- String customerId = request.getParameter("customerId");
- String serviceType = request.getParameter("serviceType");
- String serviceDomain = request.getParameter("serviceDomain");
- String ns_instance_id = request.getParameter("ns_instance_id");
- String object = packageDistributionService.instantiateNetworkServiceInstance(request,ns_instance_id);
- JSONObject jobObject = JSONObject.parseObject(object);
- String jobId = jobObject.getString("jobId");
- ServiceBean serviceBean = new ServiceBean(UuiCommonUtil.getUUID(),ns_instance_id,customerId,serviceType,serviceDomain,null,null);
- ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.CREATING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
- serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
- serviceLcmService.saveOrUpdateServiceBean(serviceBean);
+ String customerId = request.getParameter("customerId");
+ String serviceType = request.getParameter("serviceType");
+ String serviceDomain = request.getParameter("serviceDomain");
+ String ns_instance_id = request.getParameter("ns_instance_id");
+ String object = packageDistributionService.instantiateNetworkServiceInstance(request,ns_instance_id);
+ JSONObject jobObject = JSONObject.parseObject(object);
+ String jobId = jobObject.getString("jobId");
+ ServiceBean serviceBean = new ServiceBean(UuiCommonUtil.getUUID(),ns_instance_id,customerId,serviceType,serviceDomain,null,null);
+ ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.CREATING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
+ serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
+ serviceLcmService.saveOrUpdateServiceBean(serviceBean);
return object;
}
@RequestMapping(value = {"/uui-lcm/terminateNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json")
public String terminateNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id) throws ParseException{
- String result = packageDistributionService.terminateNetworkServiceInstance(request,ns_instance_id);
- String jobId = "";
- if(UuiCommonUtil.isNotNullOrEmpty(result)){
- JSONObject jobIdObject = JSONObject.parseObject(result);
- jobId = jobIdObject.getString("jobId");
- }
- ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.DELETING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
- serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
- return result;
+ String result = packageDistributionService.terminateNetworkServiceInstance(request,ns_instance_id);
+ String jobId = "";
+ if(UuiCommonUtil.isNotNullOrEmpty(result)){
+ JSONObject jobIdObject = JSONObject.parseObject(result);
+ jobId = jobIdObject.getString("jobId");
+ }
+ ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.DELETING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
+ serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
+ return result;
}
@RequestMapping(value = {"/uui-lcm/healNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json")
public String healNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id) throws ParseException{
- String result= packageDistributionService.healNetworkServiceInstance(request,ns_instance_id);
- String jobId = "";
- if(UuiCommonUtil.isNotNullOrEmpty(result)){
- JSONObject jobIdObject = JSONObject.parseObject(result);
- jobId = jobIdObject.getString("jobId");
- }
- ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.HEALING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
- serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
- return result;
+ String result= packageDistributionService.healNetworkServiceInstance(request,ns_instance_id);
+ String jobId = "";
+ if(UuiCommonUtil.isNotNullOrEmpty(result)){
+ JSONObject jobIdObject = JSONObject.parseObject(result);
+ jobId = jobIdObject.getString("jobId");
+ }
+ ServiceInstanceOperations serviceOpera = new ServiceInstanceOperations(ns_instance_id,jobId,Constant.HEALING_CODE,"0",Constant.IN_PROGRESS_CODE,DateUtils.dateToString(DateUtils.now()),null);
+ serviceLcmService.saveOrUpdateServiceInstanceOperation(serviceOpera);
+ return result;
}
@RequestMapping(value = {"/uui-lcm/scaleNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json")
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
index 7e6d94ae..4f280417 100644
--- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
+++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceInstanceController.java
@@ -22,6 +22,7 @@ import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
+import javax.websocket.server.PathParam;
import org.onap.usecaseui.server.bean.ServiceBean;
import org.onap.usecaseui.server.service.lcm.PackageDistributionService;
@@ -32,6 +33,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -105,7 +107,7 @@ public class ServiceInstanceController {
@ResponseBody
@RequestMapping(value = {"/uui-lcm/serviceNumByServiceType/{customerId}"}, method = RequestMethod.GET , produces = "application/json")
- public String serviceNumByServiceType(String customerId) throws JsonProcessingException{
+ public String serviceNumByServiceType(@PathVariable String customerId) throws JsonProcessingException{
return serviceInstanceService.serviceNumByServiceType(customerId);
}
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 3133f6e8..0edaf924 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
@@ -54,7 +54,7 @@ public interface PackageDistributionService {
String fetchNsTemplateData(HttpServletRequest request);
- JSONObject fetchTemplateInfo(HttpServletRequest request);
+ JSONObject fetchCCVPNTemplateData(HttpServletRequest request, String csarId);
String getVnfPackages();
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 8e94a61d..873025c6 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,7 +52,7 @@ public interface VfcService {
@POST("/api/catalog/v1/parsernsd")
Call<ResponseBody> fetchNsTemplateData(@Body RequestBody body);
- @POST("/api/parser/v1")
+ @POST("/api/parser/v1/parser")
Call<ResponseBody> fetchTemplateInfo(@Body RequestBody body);
@GET("/api/nslcm/v1/ns")
@@ -123,4 +123,16 @@ public interface VfcService {
@GET("/api/nslcm/v1/ns/vnfs/{vnfinstid}")
Call<ResponseBody> getVnfInfoById(@Path("vnfinstid") String vnfinstid);
+
+ @GET("/api/parser/v1/service_packages")
+ Call<ResponseBody> servicePackages();
+
+ @GET("/api/parser/v1/service_packages/{csarId}")
+ Call<ResponseBody> servicePackages(@Path("csarId") String csarId);
+
+ @POST("/api/parser/v1/service_packages")
+ Call<ResponseBody> servicePackages(@Body RequestBody body);
+
+ @DELETE("/api/parser/v1/service_packages/{csarId}")
+ Call<ResponseBody> deleteServicePackages(@Path("csarId") String csarId);
}
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 c253b72a..b4595456 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
@@ -18,13 +18,16 @@ package org.onap.usecaseui.server.service.lcm.impl;
import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.CATEGORY_NS;
import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.DISTRIBUTION_STATUS_DISTRIBUTED;
import static org.onap.usecaseui.server.service.lcm.domain.sdc.consts.SDCConsts.RESOURCETYPE_VF;
+
import static org.onap.usecaseui.server.util.RestfulServices.create;
import static org.onap.usecaseui.server.util.RestfulServices.extractBody;
+import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
@@ -44,6 +47,7 @@ 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 org.onap.usecaseui.server.service.lcm.domain.vfc.exceptions.VfcException;
+import org.onap.usecaseui.server.util.RestfulServices;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
@@ -79,10 +83,10 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
this.vfcService = vfcService;
}
- public void setServiceLcmService(ServiceLcmService serviceLcmService) {
- this.serviceLcmService = serviceLcmService;
- }
-
+ public void setServiceLcmService(ServiceLcmService serviceLcmService) {
+ this.serviceLcmService = serviceLcmService;
+ }
+
@Override
public VfNsPackageInfo retrievePackageInfo() {
List<SDCServiceTemplate> nsTemplate = sdcNsPackageInfo();
@@ -92,36 +96,36 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
@Override
public List<Vnf> sdcVfPackageInfo() {
- try {
- Response<List<Vnf>> response = sdcCatalogService.listResources(RESOURCETYPE_VF).execute();
- if (response.isSuccessful()) {
- return response.body();
- } else {
- logger.info(String.format("Can not get VF resources[code=%s, message=%s]", response.code(), response.message()));
- return Collections.emptyList();
- }
- } catch (IOException e) {
- logger.error("sdcVfPackageInfo occur exception.Details:"+e.getMessage());
- }
- return null;
+ try {
+ Response<List<Vnf>> response = sdcCatalogService.listResources(RESOURCETYPE_VF).execute();
+ if (response.isSuccessful()) {
+ return response.body();
+ } else {
+ logger.info(String.format("Can not get VF resources[code=%s, message=%s]", response.code(), response.message()));
+ return Collections.emptyList();
+ }
+ } catch (IOException e) {
+ logger.error("sdcVfPackageInfo occur exception.Details:"+e.getMessage());
+ }
+ return null;
}
@Override
public List<SDCServiceTemplate> sdcNsPackageInfo() {
- try {
- Response<List<SDCServiceTemplate>> response = sdcCatalogService.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED).execute();
- if (response.isSuccessful()) {
- return response.body();
- } else {
- logger.info(String.format("Can not get NS services[code=%s, message=%s]", response.code(), response.message()));
- return Collections.emptyList();
- }
- } catch (IOException e) {
- logger.error("sdcNsPackageInfo occur exception.Details:"+e.getMessage());
- }
- return null;
- }
-
+ try {
+ Response<List<SDCServiceTemplate>> response = sdcCatalogService.listServices(CATEGORY_NS, DISTRIBUTION_STATUS_DISTRIBUTED).execute();
+ if (response.isSuccessful()) {
+ return response.body();
+ } else {
+ logger.info(String.format("Can not get NS services[code=%s, message=%s]", response.code(), response.message()));
+ return Collections.emptyList();
+ }
+ } catch (IOException e) {
+ logger.error("sdcNsPackageInfo occur exception.Details:"+e.getMessage());
+ }
+ return null;
+ }
+
@Override
public DistributionResult postNsPackage(Csar csar) {
try {
@@ -210,15 +214,15 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
}
}
- @Override
- public String getVnfPackages() {
- String result="";
+ @Override
+ public String getVnfPackages() {
+ String result="";
try {
- logger.info("vfc getVnfPackages is starting!");
+ logger.info("vfc getVnfPackages is starting!");
Response<ResponseBody> response = this.vfcService.getVnfPackages().execute();
logger.info("vfc getVnfPackages has finished!");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
logger.info(String.format("Can not get getVnfPackages[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
@@ -228,18 +232,18 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
result=Constant.CONSTANT_FAILED;;
}
return result;
- }
+ }
- @Override
- public String getNetworkServicePackages() {
+ @Override
+ public String getNetworkServicePackages() {
- String result="";
+ String result="";
try {
- logger.info("vfc getNetworkServicePackages is starting!");
+ logger.info("vfc getNetworkServicePackages is starting!");
Response<ResponseBody> response = this.vfcService.getNetworkServicePackages().execute();
logger.info("vfc getNetworkServicePackages has finished!");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
logger.info(String.format("Can not get getNetworkServicePackages[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
@@ -249,19 +253,19 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public String getPnfPackages() {
+ @Override
+ public String getPnfPackages() {
- String result="";
+ String result="";
try {
- logger.info("vfc getPnfPackages is starting!");
+ logger.info("vfc getPnfPackages is starting!");
Response<ResponseBody> response = this.vfcService.getPnfPackages().execute();
logger.info("vfc getPnfPackages has finished!");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
logger.info(String.format("Can not get getPnfPackages[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
@@ -271,19 +275,19 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public String downLoadNsPackage(String nsdInfoId) {
+ @Override
+ public String downLoadNsPackage(String nsdInfoId) {
- String result="";
+ String result="";
try {
- logger.info("vfc downLoadNsPackage is starting!");
+ logger.info("vfc downLoadNsPackage is starting!");
Response<ResponseBody> response = this.vfcService.downLoadNsPackage(nsdInfoId).execute();
logger.info("vfc downLoadNsPackage has finished!");
if (response.isSuccessful()) {
- result=Constant.CONSTANT_SUCCESS;
+ result=Constant.CONSTANT_SUCCESS;
} else {
logger.info(String.format("Can not get downLoadNsPackage[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
@@ -293,19 +297,19 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public String downLoadPnfPackage(String pnfdInfoId) {
+ @Override
+ public String downLoadPnfPackage(String pnfdInfoId) {
- String result="";
+ String result="";
try {
- logger.info("vfc downLoadPnfPackage is starting!");
+ logger.info("vfc downLoadPnfPackage is starting!");
Response<ResponseBody> response = this.vfcService.downLoadNsPackage(pnfdInfoId).execute();
logger.info("vfc downLoadPnfPackage has finished!");
if (response.isSuccessful()) {
- result=Constant.CONSTANT_SUCCESS;
+ result=Constant.CONSTANT_SUCCESS;
} else {
logger.info(String.format("Can not get downLoadPnfPackage[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
@@ -315,19 +319,19 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public String downLoadVnfPackage(String vnfPkgId) {
+ @Override
+ public String downLoadVnfPackage(String vnfPkgId) {
- String result="";
+ String result="";
try {
- logger.info("vfc downLoadVnfPackage is starting!");
+ logger.info("vfc downLoadVnfPackage is starting!");
Response<ResponseBody> response = this.vfcService.downLoadNsPackage(vnfPkgId).execute();
logger.info("vfc downLoadVnfPackage has finished!");
if (response.isSuccessful()) {
- result=Constant.CONSTANT_SUCCESS;
+ result=Constant.CONSTANT_SUCCESS;
} else {
logger.info(String.format("Can not get downLoadVnfPackage[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
@@ -337,104 +341,104 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public String deleteNsdPackage(String nsdInfoId) {
- Response<ResponseBody> response=null;
- String result="";
+ @Override
+ public String deleteNsdPackage(String nsdInfoId) {
+ Response<ResponseBody> response=null;
+ String result="";
try {
- logger.info("vfc deleteNsdPackage is starting!");
+ logger.info("vfc deleteNsdPackage is starting!");
response = this.vfcService.deleteNsdPackage(nsdInfoId).execute();
logger.info("vfc deleteNsdPackage has finished!");
if (response.isSuccessful()) {
- result=Constant.CONSTANT_SUCCESS;
+ result=Constant.CONSTANT_SUCCESS;
} else {
logger.info(String.format("Can not get deleteNsdPackage[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
}
} catch (IOException e) {
- if(e.getMessage().contains("204")){
- return Constant.CONSTANT_SUCCESS;
- }
+ if(e.getMessage().contains("204")){
+ return Constant.CONSTANT_SUCCESS;
+ }
logger.error("deleteNsdPackage occur exception:"+e);
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public String deleteVnfPackage(String vnfPkgId) {
- Response<ResponseBody> response=null;
- String result="";
+ @Override
+ public String deleteVnfPackage(String vnfPkgId) {
+ Response<ResponseBody> response=null;
+ String result="";
try {
- logger.info("vfc deleteVnfPackage is starting!");
+ logger.info("vfc deleteVnfPackage is starting!");
response = this.vfcService.deleteVnfdPackage(vnfPkgId).execute();
logger.info("vfc deleteVnfPackage has finished!");
if (response.isSuccessful()) {
- result=Constant.CONSTANT_SUCCESS;
+ result=Constant.CONSTANT_SUCCESS;
} else {
logger.info(String.format("Can not get deleteNsdPackage[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
}
} catch (IOException e) {
- if(e.getMessage().contains("204")){
- return Constant.CONSTANT_SUCCESS;
- }
+ if(e.getMessage().contains("204")){
+ return Constant.CONSTANT_SUCCESS;
+ }
logger.error("deleteVnfPackage occur exception:"+e);
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public String deletePnfPackage(String pnfdInfoId) {
- Response<ResponseBody> response=null;
- String result="";
+ @Override
+ public String deletePnfPackage(String pnfdInfoId) {
+ Response<ResponseBody> response=null;
+ String result="";
try {
- logger.info("vfc deletePnfPackage is starting!");
- response = this.vfcService.deletePnfdPackage(pnfdInfoId).execute();
+ logger.info("vfc deletePnfPackage is starting!");
+ response = this.vfcService.deletePnfdPackage(pnfdInfoId).execute();
logger.info("vfc deletePnfPackage has finished!");
if (response.isSuccessful()) {
- result=Constant.CONSTANT_SUCCESS;
+ result=Constant.CONSTANT_SUCCESS;
} else {
logger.info(String.format("Can not get deletePnfPackage[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
}
} catch (IOException e) {
- if(e.getMessage().contains("204")){
- return Constant.CONSTANT_SUCCESS;
- }
+ if(e.getMessage().contains("204")){
+ return Constant.CONSTANT_SUCCESS;
+ }
logger.error("deletePnfPackage occur exception:"+e);
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public List<String> getNetworkServiceInfo() {
- List<String> result = new ArrayList<>();
+ @Override
+ public List<String> getNetworkServiceInfo() {
+ List<String> result = new ArrayList<>();
try {
- logger.info("vfc getNetworkServiceInfo is starting!");
+ logger.info("vfc getNetworkServiceInfo is starting!");
Response<nsServiceRsp> response = this.vfcService.getNetworkServiceInfo().execute();
logger.info("vfc getNetworkServiceInfo has finished!");
if (response.isSuccessful()) {
- List<String> nsServices = response.body().nsServices;
- if(nsServices.size()>0){
- for(String nsService:nsServices){
- JSONObject object = JSON.parseObject(nsService);
- String serviceInstanceId=object.get("nsInstanceId").toString();
- ServiceBean serviceBean = serviceLcmService.getServiceBeanByServiceInStanceId(serviceInstanceId);
- object.put("serviceDomain",serviceBean.getServiceDomain());
- object.put("childServiceInstances","[]");
- result.add(object.toString());
- }
- }
- return result;
+ List<String> nsServices = response.body().nsServices;
+ if(nsServices.size()>0){
+ for(String nsService:nsServices){
+ JSONObject object = JSON.parseObject(nsService);
+ String serviceInstanceId=object.get("nsInstanceId").toString();
+ ServiceBean serviceBean = serviceLcmService.getServiceBeanByServiceInStanceId(serviceInstanceId);
+ object.put("serviceDomain",serviceBean.getServiceDomain());
+ object.put("childServiceInstances","[]");
+ result.add(object.toString());
+ }
+ }
+ return result;
} else {
logger.info(String.format("Can not get getNetworkServiceInfo[code=%s, message=%s]", response.code(), response.message()));
return Collections.emptyList();
@@ -443,191 +447,191 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
logger.error("getNetworkServiceInfo occur exception:"+e);
return Collections.emptyList();
}
-
- }
+
+ }
- @Override
- public String createNetworkServiceInstance(HttpServletRequest request) {
- String result = "";
+ @Override
+ public String createNetworkServiceInstance(HttpServletRequest request) {
+ String result = "";
try {
- logger.info("aai createNetworkServiceInstance is starting");
- RequestBody requestBody = extractBody(request);
+ logger.info("aai createNetworkServiceInstance is starting");
+ RequestBody requestBody = extractBody(request);
Response<ResponseBody> response = vfcService.createNetworkServiceInstance(requestBody).execute();
- logger.info("aai createNetworkServiceInstance has finished");
+ logger.info("aai createNetworkServiceInstance has finished");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
- result=Constant.CONSTANT_FAILED;
+ result=Constant.CONSTANT_FAILED;
logger.error(String.format("Can not createNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message()));
}
} catch (Exception e) {
- result=Constant.CONSTANT_FAILED;
- logger.error("createNetworkServiceInstance occur exception:"+e);
+ result=Constant.CONSTANT_FAILED;
+ logger.error("createNetworkServiceInstance occur exception:"+e);
}
return result;
- }
+ }
- @Override
- public String deleteNetworkServiceInstance(String nsInstanceId) {
- Response response = null;
- String result="";
+ @Override
+ public String deleteNetworkServiceInstance(String nsInstanceId) {
+ Response response = null;
+ String result="";
try {
- logger.info("vfc deleteNetworkServiceInstance is starting!");
+ logger.info("vfc deleteNetworkServiceInstance is starting!");
response = this.vfcService.deleteNetworkServiceInstance(nsInstanceId).execute();
logger.info("vfc deleteNetworkServiceInstance has finished!");
if (response.isSuccessful()) {
- result=Constant.CONSTANT_SUCCESS;
+ result=Constant.CONSTANT_SUCCESS;
} else {
logger.info(String.format("Can not get deleteNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
}
} catch (IOException e) {
- if(e.getMessage().contains("204")){
- return Constant.CONSTANT_SUCCESS;
- }
+ if(e.getMessage().contains("204")){
+ return Constant.CONSTANT_SUCCESS;
+ }
logger.error("deleteNetworkServiceInstance occur exception:"+e);
result=Constant.CONSTANT_FAILED;
}
return result;
-
- }
+
+ }
- @Override
- public String terminateNetworkServiceInstance(HttpServletRequest request,String networkServiceInstanceId) {
- String result = "";
+ @Override
+ public String terminateNetworkServiceInstance(HttpServletRequest request,String networkServiceInstanceId) {
+ String result = "";
try {
- logger.info("aai terminateNetworkServiceInstance is starting");
- RequestBody requestBody = extractBody(request);
+ logger.info("aai terminateNetworkServiceInstance is starting");
+ RequestBody requestBody = extractBody(request);
Response<ResponseBody> response = vfcService.terminateNetworkServiceInstance(networkServiceInstanceId,requestBody).execute();
- logger.info("aai terminateNetworkServiceInstance has finished");
+ logger.info("aai terminateNetworkServiceInstance has finished");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
- result=Constant.CONSTANT_FAILED;
+ result=Constant.CONSTANT_FAILED;
logger.error(String.format("Can not terminateNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message()));
}
} catch (Exception e) {
- result=Constant.CONSTANT_FAILED;
- logger.error("terminateNetworkServiceInstance occur exception:"+e);
+ result=Constant.CONSTANT_FAILED;
+ logger.error("terminateNetworkServiceInstance occur exception:"+e);
}
return result;
- }
+ }
- @Override
- public String healNetworkServiceInstance(HttpServletRequest request,String networkServiceInstanceId) {
- String result = "";
+ @Override
+ public String healNetworkServiceInstance(HttpServletRequest request,String networkServiceInstanceId) {
+ String result = "";
try {
- logger.info("aai healNetworkServiceInstance is starting");
- RequestBody requestBody = extractBody(request);
+ logger.info("aai healNetworkServiceInstance is starting");
+ RequestBody requestBody = extractBody(request);
Response<ResponseBody> response = vfcService.healNetworkServiceInstance(networkServiceInstanceId,requestBody).execute();
- logger.info("aai healNetworkServiceInstance has finished");
+ logger.info("aai healNetworkServiceInstance has finished");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
- result=Constant.CONSTANT_FAILED;
+ result=Constant.CONSTANT_FAILED;
logger.error(String.format("Can not healNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message()));
}
} catch (Exception e) {
- result=Constant.CONSTANT_FAILED;
- logger.error("healNetworkServiceInstance occur exception:"+e);
+ result=Constant.CONSTANT_FAILED;
+ logger.error("healNetworkServiceInstance occur exception:"+e);
}
return result;
- }
+ }
- @Override
- public String scaleNetworkServiceInstance(HttpServletRequest request,String networkServiceInstanceId) {
- String result = "";
+ @Override
+ public String scaleNetworkServiceInstance(HttpServletRequest request,String networkServiceInstanceId) {
+ String result = "";
try {
- logger.info("aai scaleNetworkServiceInstance is starting");
- RequestBody requestBody = extractBody(request);
+ logger.info("aai scaleNetworkServiceInstance is starting");
+ RequestBody requestBody = extractBody(request);
Response<ResponseBody> response = vfcService.scaleNetworkServiceInstance(networkServiceInstanceId,requestBody).execute();
- logger.info("aai scaleNetworkServiceInstance has finished");
+ logger.info("aai scaleNetworkServiceInstance has finished");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
- result=Constant.CONSTANT_FAILED;
+ result=Constant.CONSTANT_FAILED;
logger.error(String.format("Can not scaleNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message()));
}
} catch (Exception e) {
- result=Constant.CONSTANT_FAILED;
- logger.error("scaleNetworkServiceInstance occur exception:"+e);
+ result=Constant.CONSTANT_FAILED;
+ logger.error("scaleNetworkServiceInstance occur exception:"+e);
}
return result;
- }
+ }
- @Override
- public String createNetworkServiceData(HttpServletRequest request) {
- String result = "";
+ @Override
+ public String createNetworkServiceData(HttpServletRequest request) {
+ String result = "";
try {
- logger.info("aai createNetworkServiceData is starting");
- RequestBody requestBody = extractBody(request);
+ logger.info("aai createNetworkServiceData is starting");
+ RequestBody requestBody = extractBody(request);
Response<ResponseBody> response = vfcService.createNetworkServiceData(requestBody).execute();
- logger.info("aai createNetworkServiceData has finished");
+ logger.info("aai createNetworkServiceData has finished");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
- result=Constant.CONSTANT_FAILED;
+ result=Constant.CONSTANT_FAILED;
logger.error(String.format("Can not createNetworkServiceData[code=%s, message=%s]", response.code(), response.message()));
}
} catch (Exception e) {
- result=Constant.CONSTANT_FAILED;
- logger.error("createNetworkServiceData occur exception:"+e);
+ result=Constant.CONSTANT_FAILED;
+ logger.error("createNetworkServiceData occur exception:"+e);
}
return result;
- }
+ }
- @Override
- public String createVnfData(HttpServletRequest request) {
- String result = "";
+ @Override
+ public String createVnfData(HttpServletRequest request) {
+ String result = "";
try {
- logger.info("aai createVnfData is starting");
- RequestBody requestBody = extractBody(request);
+ logger.info("aai createVnfData is starting");
+ RequestBody requestBody = extractBody(request);
Response<ResponseBody> response = vfcService.createVnfData(requestBody).execute();
- logger.info("aai createVnfData has finished");
+ logger.info("aai createVnfData has finished");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
- result=Constant.CONSTANT_FAILED;
+ result=Constant.CONSTANT_FAILED;
logger.error(String.format("Can not createVnfData[code=%s, message=%s]", response.code(), response.message()));
}
} catch (Exception e) {
- result=Constant.CONSTANT_FAILED;
- logger.error("createVnfData occur exception:"+e);
+ result=Constant.CONSTANT_FAILED;
+ logger.error("createVnfData occur exception:"+e);
}
return result;
- }
+ }
- @Override
- public String createPnfData(HttpServletRequest request) {
- String result = "";
+ @Override
+ public String createPnfData(HttpServletRequest request) {
+ String result = "";
try {
- logger.info("aai createPnfData is starting");
- RequestBody requestBody = extractBody(request);
+ logger.info("aai createPnfData is starting");
+ RequestBody requestBody = extractBody(request);
Response<ResponseBody> response = vfcService.createPnfData(requestBody).execute();
- logger.info("aai createPnfData has finished");
+ logger.info("aai createPnfData has finished");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
- result=Constant.CONSTANT_FAILED;
+ result=Constant.CONSTANT_FAILED;
logger.error(String.format("Can not createPnfData[code=%s, message=%s]", response.code(), response.message()));
}
} catch (Exception e) {
- result=Constant.CONSTANT_FAILED;
- logger.error("createPnfData occur exception:"+e);
+ result=Constant.CONSTANT_FAILED;
+ logger.error("createPnfData occur exception:"+e);
}
return result;
- }
+ }
- @Override
- public String getNsdInfo(String nsdInfoId) {
+ @Override
+ public String getNsdInfo(String nsdInfoId) {
- String result="";
+ String result="";
try {
- logger.info("vfc getNsdInfo is starting!");
+ logger.info("vfc getNsdInfo is starting!");
Response<ResponseBody> response = this.vfcService.getNsdInfo(nsdInfoId).execute();
logger.info("vfc getNsdInfo has finished!");
if (response.isSuccessful()) {
- result=Constant.CONSTANT_SUCCESS;
+ result=Constant.CONSTANT_SUCCESS;
} else {
logger.info(String.format("Can not get getNsdInfo[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
@@ -637,19 +641,19 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public String getVnfInfo(String vnfPkgId) {
+ @Override
+ public String getVnfInfo(String vnfPkgId) {
- String result="";
+ String result="";
try {
- logger.info("vfc getVnfInfo is starting!");
+ logger.info("vfc getVnfInfo is starting!");
Response<ResponseBody> response = this.vfcService.getVnfInfo(vnfPkgId).execute();
logger.info("vfc getVnfInfo has finished!");
if (response.isSuccessful()) {
- result=Constant.CONSTANT_SUCCESS;
+ result=Constant.CONSTANT_SUCCESS;
} else {
logger.info(String.format("Can not get getVnfInfo[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
@@ -659,19 +663,19 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public String getPnfInfo(String pnfdInfoId) {
+ @Override
+ public String getPnfInfo(String pnfdInfoId) {
- String result="";
+ String result="";
try {
- logger.info("vfc getPnfInfo is starting!");
+ logger.info("vfc getPnfInfo is starting!");
Response<ResponseBody> response = this.vfcService.getPnfInfo(pnfdInfoId).execute();
logger.info("vfc getPnfInfo has finished!");
if (response.isSuccessful()) {
- result=Constant.CONSTANT_SUCCESS;
+ result=Constant.CONSTANT_SUCCESS;
} else {
logger.info(String.format("Can not get getPnfInfo[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
@@ -681,19 +685,19 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public String listNsTemplates() {
+ @Override
+ public String listNsTemplates() {
- String result="";
+ String result="";
try {
- logger.info("vfc listNsTemplates is starting!");
+ logger.info("vfc listNsTemplates is starting!");
Response<ResponseBody> response = this.vfcService.listNsTemplates().execute();
logger.info("vfc listNsTemplates has finished!");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
logger.info(String.format("Can not get listNsTemplates[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
@@ -703,84 +707,111 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
- @Override
- public String fetchNsTemplateData(HttpServletRequest request) {
- String result = "";
+ @Override
+ public String fetchNsTemplateData(HttpServletRequest request) {
+ String result = "";
try {
- logger.info("aai fetchNsTemplateData is starting");
- RequestBody requestBody = extractBody(request);
+ logger.info("aai fetchNsTemplateData is starting");
+ RequestBody requestBody = extractBody(request);
Response<ResponseBody> response = vfcService.fetchNsTemplateData(requestBody).execute();
- logger.info("aai fetchNsTemplateData has finished");
+ logger.info("aai fetchNsTemplateData has finished");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
- result=Constant.CONSTANT_FAILED;
+ result=Constant.CONSTANT_FAILED;
logger.error(String.format("Can not fetchNsTemplateData[code=%s, message=%s]", response.code(), response.message()));
}
} catch (Exception e) {
- result=Constant.CONSTANT_FAILED;
- logger.error("fetchNsTemplateData occur exception:"+e);
+ result=Constant.CONSTANT_FAILED;
+ logger.error("fetchNsTemplateData occur exception:"+e);
}
return result;
- }
-
- @Override
- public JSONObject fetchTemplateInfo(HttpServletRequest request) {
- JSONObject result = new JSONObject();;
+ }
+
+ @Override
+ public JSONObject fetchCCVPNTemplateData(HttpServletRequest request, String csarId) {
+ 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())));
+ RequestBody requestBody = extractBody(request);
+ // search template from vfc catalog
+ Response<ResponseBody> getResponse = this.vfcService.servicePackages(csarId).execute();
+
+ if (getResponse.isSuccessful()) {
+ // call vfc template parser
+ logger.info("calling ccvpn template file parser is starting");
+ Response<ResponseBody> response = vfcService.fetchTemplateInfo(requestBody).execute();
+ logger.info("calling ccvpn template file parser 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 parse ccvpn template file. Detail Info [code=%s, message=%s]", response.code(), response.message()));
+ logger.error(String.format("Can not parse ccvpn template file. Detail Info [code=%s, message=%s]", response.code(), response.message()));
+ }
} 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()));
+ // distribute template files to vfc catalog
+ Response<ResponseBody> postResponse = this.vfcService.servicePackages(requestBody).execute();
+ if (postResponse.isSuccessful()) {
+ // call vfc template parser
+ logger.info("calling ccvpn template file parser is starting");
+ Response<ResponseBody> response = vfcService.fetchTemplateInfo(requestBody).execute();
+ logger.info("calling ccvpn template file parser 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 parse ccvpn template file. Detail Info [code=%s, message=%s]", response.code(), response.message()));
+ logger.error(String.format("Can not parse ccvpn template file. Detail Info [code=%s, message=%s]", response.code(), response.message()));
+ }
+ } else {
+ result.put("status", Constant.CONSTANT_FAILED);
+ result.put("error",String.format("Can not distribute ccvpn template file. Detail Info [code=%s, message=%s]", postResponse.code(), postResponse.message()));
+ logger.error(String.format("Can not distribute ccvpn template file. Detail Info [code=%s, message=%s]", postResponse.code(), postResponse.message()));
+ }
}
} catch (Exception e) {
- result.put("status", Constant.CONSTANT_FAILED);
- result.put("errorMessage","fetchTemplateInfo occur exception:"+e);
+ result.put("status", Constant.CONSTANT_FAILED);
+ result.put("errorMessage", "calling ccvpn template parser happened exception:"+e);
}
return result;
- }
-
- @Override
- public String instantiateNetworkServiceInstance(HttpServletRequest request, String serviceInstanceId) {
- String result = "";
- try {
- logger.info("aai instantiateNetworkServiceInstance is starting");
- RequestBody requestBody = extractBody(request);
+ }
+
+ @Override
+ public String instantiateNetworkServiceInstance(HttpServletRequest request, String serviceInstanceId) {
+ String result = "";
+ try {
+ logger.info("aai instantiateNetworkServiceInstance is starting");
+ RequestBody requestBody = extractBody(request);
Response<ResponseBody> response = vfcService.instantiateNetworkServiceInstance(requestBody,serviceInstanceId).execute();
- logger.info("aai instantiateNetworkServiceInstance has finished");
+ logger.info("aai instantiateNetworkServiceInstance has finished");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
- result=Constant.CONSTANT_FAILED;
+ result=Constant.CONSTANT_FAILED;
logger.error(String.format("Can not instantiateNetworkServiceInstance[code=%s, message=%s]", response.code(), response.message()));
}
} catch (Exception e) {
- result=Constant.CONSTANT_FAILED;
- logger.error("instantiateNetworkServiceInstance occur exception:"+e);
+ result=Constant.CONSTANT_FAILED;
+ logger.error("instantiateNetworkServiceInstance occur exception:"+e);
}
return result;
- }
+ }
- @Override
- public String getVnfInfoById(String vnfinstid) {
+ @Override
+ public String getVnfInfoById(String vnfinstid) {
- String result="";
+ String result="";
try {
- logger.info("vfc getVnfInfoById is starting!");
+ logger.info("vfc getVnfInfoById is starting!");
Response<ResponseBody> response = this.vfcService.getVnfInfoById(vnfinstid).execute();
logger.info("vfc getVnfInfoById has finished!");
if (response.isSuccessful()) {
- result=new String(response.body().bytes());
+ result=new String(response.body().bytes());
} else {
logger.info(String.format("Can not get getVnfInfoById[code=%s, message=%s]", response.code(), response.message()));
result=Constant.CONSTANT_FAILED;;
@@ -790,6 +821,6 @@ public class DefaultPackageDistributionService implements PackageDistributionSer
result=Constant.CONSTANT_FAILED;;
}
return result;
-
- }
+
+ }
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
index 92b2755e..6d4cfbb3 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java
@@ -183,23 +183,23 @@ public class DefaultServiceInstanceService implements ServiceInstanceService {
@Override
public String serviceNumByServiceType(String customerId) throws JsonProcessingException{
-
List<AAIServiceSubscription> serviceTypes = customerService.listServiceSubscriptions(customerId);
-
List<Map<String,Object>> list = new ArrayList<>();
-
ObjectMapper omAlarm = new ObjectMapper();
for (AAIServiceSubscription aaiServiceSubscription : serviceTypes) {
-
Map<String,Object> serviceTypeMap = new HashMap<String,Object>();
-
List<String> serviceInstances =this.listServiceInstances(customerId, aaiServiceSubscription.getServiceType());
-
- serviceTypeMap.put(aaiServiceSubscription.getServiceType(),serviceInstances.size());
-
+
+ //serviceTypeMap.put(aaiServiceSubscription.getServiceType(),serviceInstances.size());
+ serviceTypeMap.put("name", aaiServiceSubscription.getServiceType());
+ serviceTypeMap.put("value", serviceInstances.size());
+
list.add(serviceTypeMap);
}
- return omAlarm.writeValueAsString(list);
+
+ Map<String,Object> result = new HashMap();
+ result.put("list", list);
+ return omAlarm.writeValueAsString(result);
}
}
diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java
index a66ea9f0..5c6159eb 100644
--- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java
+++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceLcmService.java
@@ -274,8 +274,14 @@ public class DefaultServiceLcmService implements ServiceLcmService {
Query q = session.createSQLQuery(hql).addEntity(ServiceInstanceOperations.class);
q.setString("serviceId",serviceId);
q.setString("serviceInstanceId",serviceId);
+ q.list();
list = q.list();
- serviceOperation =list.get(0);
+ if (list.size() > 0) {
+ serviceOperation =list.get(0);
+ } else {
+ serviceOperation = new ServiceInstanceOperations();
+ }
+
session.flush();
}catch (Exception e){