diff options
author | guochuyicmri <guochuyi@chinamobile.com> | 2019-04-08 16:02:34 +0800 |
---|---|---|
committer | guochuyicmri <guochuyi@chinamobile.com> | 2019-04-08 16:02:49 +0800 |
commit | 4c5187d5ff53b9e674f2600dcc0284bae217d3ea (patch) | |
tree | 2acb54638c3a45f33a6933f36fad0f1b5a87b8b0 | |
parent | b6e75980322117dd69884de8b81be360b4ebfcd3 (diff) |
Enhancement of NS Instance Healing
Change-Id: Ia2681c3604ea98d042945d9f3565cec2e17c1199
Issue-ID: USECASEUI-254
Signed-off-by: guochuyicmri <guochuyi@chinamobile.com>
2 files changed, 11 insertions, 3 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 9ed16110..732291d0 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 @@ -273,8 +273,16 @@ public class PackageDistributionController { } @RequestMapping(value = {"/uui-lcm/healNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json") - public String healNetworkServiceInstance(HttpServletRequest request,@RequestParam String ns_instance_id){ - return packageDistributionService.healNetworkServiceInstance(request,ns_instance_id); + 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; } @RequestMapping(value = {"/uui-lcm/scaleNetworkServiceInstance"}, method = RequestMethod.POST , produces = "application/json") diff --git a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java index 00a133d8..cfed3cc9 100644 --- a/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java +++ b/server/src/test/java/org/onap/usecaseui/server/controller/lcm/PackageDistributionControllerTest.java @@ -315,7 +315,7 @@ public class PackageDistributionControllerTest { } @Test - public void testHealNetworkServiceInstance() throws IOException { + public void testHealNetworkServiceInstance() throws IOException, ParseException{ String ns_instance_id="1"; HttpServletRequest request = mockRequest(); controller.healNetworkServiceInstance(request,ns_instance_id); |