diff options
6 files changed, 88 insertions, 2 deletions
@@ -40,7 +40,7 @@ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <hibernate.version>5.0.11.Final</hibernate.version> - <spring.version>4.3.15.RELEASE</spring.version> + <spring.version>4.3.4.RELEASE</spring.version> <javax.persistence.version>1.0.2</javax.persistence.version> <common.csv.version>1.4</common.csv.version> <jackson.version>2.9.0</jackson.version> diff --git a/server/pom.xml b/server/pom.xml index 469b3661..51e83ea7 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -35,7 +35,7 @@ <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> <hibernate.version>5.0.11.Final</hibernate.version> - <spring.version>4.3.15.RELEASE</spring.version> + <spring.version>4.3.4.RELEASE</spring.version> <javax.persistence.version>1.0.2</javax.persistence.version> <common.csv.version>1.4</common.csv.version> <jackson.version>2.9.0</jackson.version> diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java index c79e1dca..5c620cfa 100644 --- a/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java +++ b/server/src/main/java/org/onap/usecaseui/server/controller/lcm/ServiceLcmController.java @@ -62,4 +62,40 @@ public class ServiceLcmController { public DeleteOperationRsp terminateService(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request){ return serviceLcmService.terminateService(serviceId, request); } + + /** + * + * scaleServices + * + * @Auther YYY + * @Date 2018/04/19 16:12:45 + * @Title: scaleServices + * @Description: Scaling out/in + * @param serviceId + * @param request + * @return + */ + @ResponseBody + @RequestMapping(value = {"/uui-lcm/services/scaleServices/{serviceId}"}, method = RequestMethod.POST , produces = "application/json") + public DeleteOperationRsp scaleServices(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request){ + return serviceLcmService.scaleService(serviceId, request); + } + + /** + * + * updateServices + * + * @Auther YYY + * @Date 2018/04/19 16:13:59 + * @Title: updateServices + * @Description: Upgrade + * @param serviceId + * @param request + * @return + */ + @ResponseBody + @RequestMapping(value = {"/uui-lcm/services/updateService/{serviceId}"}, method = RequestMethod.PUT , produces = "application/json") + public DeleteOperationRsp updateServices(@PathVariable(value = "serviceId") String serviceId, HttpServletRequest request){ + return serviceLcmService.scaleService(serviceId, request); + } } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java index 68e89ca8..f2d993af 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/ServiceLcmService.java @@ -28,4 +28,8 @@ public interface ServiceLcmService { OperationProgressInformation queryOperationProgress(String serviceId, String operationId); DeleteOperationRsp terminateService(String serviceId, HttpServletRequest request); + + DeleteOperationRsp scaleService(String serviceId,HttpServletRequest request); + + DeleteOperationRsp updateService(String serviceId,HttpServletRequest request); } diff --git a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java index dbcefcb0..fc414524 100644 --- a/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java +++ b/server/src/main/java/org/onap/usecaseui/server/service/lcm/domain/so/SOService.java @@ -45,4 +45,18 @@ public interface SOService { // @DELETE("/ecomp/mso/infra/e2eServiceInstances/v3/{serviceId}") @HTTP(method="DELETE", path="/ecomp/mso/infra/e2eServiceInstances/v3/{serviceId}", hasBody = true) Call<DeleteOperationRsp> terminateService(@Path("serviceId") String serviceId, @Body RequestBody body); + + @Headers({ + "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", + "Accept: application/json" + }) + @POST("/ecomp/mso/infra/e2eServiceInstances/v3/{serviceId}/scale") + Call<DeleteOperationRsp> scaleService(@Path("serviceId") String serviceId, @Body RequestBody body); + + @Headers({ + "Authorization: Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA==", + "Accept: application/json" + }) + @PUT("/ecomp/mso/infra/e2eServiceInstances/v3/{serviceId}") + Call<DeleteOperationRsp> updateService(@Path("serviceId") String serviceId, @Body RequestBody body); } 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 d1afe6ca..6fc85b3b 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 @@ -98,4 +98,36 @@ public class DefaultServiceLcmService implements ServiceLcmService { throw new SOException("SO Service is not available!", e); } } + + @Override + public DeleteOperationRsp scaleService(String serviceId, HttpServletRequest request) { + try { + RequestBody requestBody = extractBody(request); + Response<DeleteOperationRsp> response = soService.scaleService(serviceId,requestBody).execute(); + if(response.isSuccessful()){ + return response.body(); + }else{ + logger.info(String.format("Can not terminate service[code=%s, message=%s]", response.code(), response.message())); + throw new SOException("SO terminate service failed!"); + } + } catch (IOException e) { + throw new SOException("SO Service is not available!", e); + } + } + + @Override + public DeleteOperationRsp updateService(String serviceId, HttpServletRequest request) { + try { + RequestBody requestBody = extractBody(request); + Response<DeleteOperationRsp> response = soService.updateService(serviceId,requestBody).execute(); + if(response.isSuccessful()){ + return response.body(); + }else{ + logger.info(String.format("Can not terminate service[code=%s, message=%s]", response.code(), response.message())); + throw new SOException("SO terminate service failed!"); + } + } catch (IOException e) { + throw new SOException("SO Service is not available!", e); + } + } } |