summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorguochuyicmri <guochuyi@chinamobile.com>2018-11-18 16:44:25 +0800
committerguochuyicmri <guochuyi@chinamobile.com>2018-11-18 16:44:46 +0800
commit1679133aeba5efcb89848e89503d42b2ad15fcba (patch)
tree6a43baae1f472e3244e2fb06bfa2c830f12cf72d
parent2fe1f35bef747eceb4262e5c38607708c60dfa95 (diff)
modify create sql for service_instances
Change-Id: Id6bad34ac7e71a726b9c07b7cad04c138753bd6e Issue-ID: USECASEUI-160 Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionController.java23
-rw-r--r--server/src/main/java/org/onap/usecaseui/server/service/lcm/impl/DefaultServiceInstanceService.java2
-rw-r--r--standalone/src/main/assembly/resources/dbscripts/mysql/usecase-ui-createobj.sql14
3 files changed, 29 insertions, 10 deletions
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 8fd59c26..ed6bfcf8 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
@@ -116,7 +116,21 @@ public class PackageDistributionController {
@RequestMapping(value = {"/uui-lcm/jobs/getNsLcmJobStatus/{jobId}"}, method = RequestMethod.GET , produces = "application/json")
public JobStatus getNsLcmJobStatus(@PathVariable(value="jobId") String jobId, HttpServletRequest request){
String responseId = request.getParameter("responseId");
- return packageDistributionService.getNsLcmJobStatus(jobId, responseId);
+ String serviceInstanceId = request.getParameter("serviceInstanceId");
+ JobStatus jobStatus = packageDistributionService.getNsLcmJobStatus(jobId, responseId);
+ if(UuiCommonUtil.isNotNullOrEmpty(jobStatus)&&UuiCommonUtil.isNotNullOrEmpty(jobStatus.getResponseDescriptor())&&UuiCommonUtil.isNotNullOrEmpty(jobStatus.getResponseDescriptor().getProgress())){
+ String processNum = jobStatus.getResponseDescriptor().getProgress();
+ String status="processing";
+ if(Integer.parseInt(processNum)==100){
+ status = "finished";
+ }else if(Integer.parseInt(processNum)>100){
+ status="error";
+ }else{
+ status="processing";
+ }
+ serviceLcmService.updateServiceInstanceStatusById(status,serviceInstanceId);
+ }
+ return jobStatus;
}
@ResponseBody
@@ -231,9 +245,12 @@ public class PackageDistributionController {
String serviceType = request.getParameter("serviceType");
String serviceDomain = request.getParameter("serviceDomain");
String ns_instance_id = request.getParameter("ns_instance_id");
- ServiceBean serviceBean = new ServiceBean(UuiCommonUtil.getUUID(),ns_instance_id,customerId,serviceType,serviceDomain,null,null,null);
+ 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,jobId,null,null);
serviceLcmService.saveOrUpdateServiceBean(serviceBean);
- return packageDistributionService.instantiateNetworkServiceInstance(request,ns_instance_id);
+ return object;
}
@RequestMapping(value = {"/uui-lcm/terminateNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json")
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 88a516ff..04561302 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
@@ -114,6 +114,8 @@ public class DefaultServiceInstanceService implements ServiceInstanceService {
}
String serviceDomain = serviceBean.getServiceDomain();
object.put("serviceDomain",serviceDomain);
+ object.put("serviceStatus",serviceBean.getStatus());
+ object.put("operationId",serviceBean.getOperationId());
if("SOTN".equals(serviceDomain)||"CCVPN".equals(serviceDomain)||"E2E Service".equals(serviceDomain)||"Network Service".equals(serviceDomain)){
List<String> parentIds = serviceLcmService.getServiceInstanceIdByParentId(serviceInstanceId);
List<String> parentServiceInstances = new ArrayList<>();
diff --git a/standalone/src/main/assembly/resources/dbscripts/mysql/usecase-ui-createobj.sql b/standalone/src/main/assembly/resources/dbscripts/mysql/usecase-ui-createobj.sql
index a8f7c21f..59d51a80 100644
--- a/standalone/src/main/assembly/resources/dbscripts/mysql/usecase-ui-createobj.sql
+++ b/standalone/src/main/assembly/resources/dbscripts/mysql/usecase-ui-createobj.sql
@@ -121,13 +121,13 @@ ALTER TABLE `performance_commoneventheader` ADD INDEX `performance_commoneventhe
DROP TABLE IF EXISTS `service_instances`;
CREATE TABLE `service_instances` (
`id` varchar(100) NOT NULL,
- `serviceInstanceId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `customerId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `serviceType` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `serviceDomain` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `operationId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `parentServiceInstanceId` varchar(50) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
- `status` varchar(20) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `serviceInstanceId` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `customerId` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `serviceType` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `serviceDomain` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `operationId` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `parentServiceInstanceId` varchar(500) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
+ `status` varchar(200) CHARACTER SET utf8 COLLATE utf8_general_ci NULL DEFAULT NULL,
PRIMARY KEY (`id`)
) ENGINE=InnoDB DEFAULT CHARSET=utf8;