diff options
author | hekeguang <hekeguang@chinamobile.com> | 2020-02-20 11:13:20 +0800 |
---|---|---|
committer | hekeguang <hekeguang@chinamobile.com> | 2020-02-20 11:13:28 +0800 |
commit | d730a42b1bb8b9911b0f142a6e35125c7a5d3982 (patch) | |
tree | c0e51b8f474d9298f4d819b85e828b329150c94c | |
parent | 0f3598eb320d019c71059fb08f83f8ece4833237 (diff) |
Add controller related to nsmf.
Issue-ID: USECASEUI-374
Change-Id: I185503fcc92d2209633249d70f96a0fda8610cb6
Signed-off-by: hekeguang <hekeguang@chinamobile.com>
4 files changed, 366 insertions, 0 deletions
diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/csmf/SlicingController.java b/server/src/main/java/org/onap/usecaseui/server/controller/csmf/SlicingController.java new file mode 100644 index 00000000..89ee912d --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/controller/csmf/SlicingController.java @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2020 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.controller.csmf; + +import javax.annotation.Resource; +import org.onap.usecaseui.server.bean.csmf.SlicingOrder; +import org.onap.usecaseui.server.bean.nsmf.common.ServiceResult; +import org.onap.usecaseui.server.service.csmf.SlicingService; +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.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +@CrossOrigin(origins = "*") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +@RequestMapping("/uui-slicing/csmf") +public class SlicingController { + + @Resource(name = "SlicingService") + private SlicingService slicingService; + + public void setSlicingService(SlicingService slicingService) { + this.slicingService = slicingService; + } + + @ResponseBody + @RequestMapping( + value = {"/5gSlicing"}, + method = RequestMethod.POST, + produces = "application/json") + public ServiceResult createSlicingService(@RequestBody SlicingOrder slicingOrder) { + return slicingService.createSlicingService(slicingOrder); + } + + @ResponseBody + @RequestMapping( + value = {"/5gSlicing/orders/status/{status}/pageNo/{pageNo}/pageSize/{pageSize}"}, + method = RequestMethod.GET, + produces = "application/json") + public ServiceResult querySlicingServiceOrder( + @PathVariable(value="status") String status, + @PathVariable(value="pageNo") String pageNo, + @PathVariable(value="pageSize") String pageSize) { + return slicingService.querySlicingOrderList(status, pageNo, pageSize); + } + +} diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMgtController.java b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMgtController.java new file mode 100644 index 00000000..40adc9c9 --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMgtController.java @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.controller.nsmf; + +import javax.annotation.Resource; +import org.onap.usecaseui.server.bean.nsmf.common.ServiceResult; +import org.onap.usecaseui.server.service.nsmf.ResourceMgtService; +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; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +@CrossOrigin(origins = "*") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +@RequestMapping("/uui-slicing/nsmf/resource") +public class ResourceMgtController { + + @Resource(name = "ResourceMgtService") + private ResourceMgtService resourceMgtService; + + public void setResourceMgtService(ResourceMgtService resourceMgtService) { + this.resourceMgtService = resourceMgtService; + } + + @ResponseBody + @RequestMapping(value = { + "/business/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult querySlicingBusiness(@PathVariable int pageNo, @PathVariable int pageSize) { + return resourceMgtService.querySlicingBusiness(pageNo, pageSize); + } + + @ResponseBody + @RequestMapping(value = { + "/{businessStatus}/business/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult querySlicingBusinessByStatus(@PathVariable String businessStatus, @PathVariable int pageNo, + @PathVariable int pageSize) { + return resourceMgtService.querySlicingBusinessByStatus(businessStatus, pageNo, pageSize); + } + + @ResponseBody + @RequestMapping(value = { + "/business/{businessId}/details"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult querySlicingBusinessDetails(@PathVariable String businessId) { + return resourceMgtService.querySlicingBusinessDetails(businessId); + } + + @ResponseBody + @RequestMapping(value = { + "/nsi/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryNsiInstances(@PathVariable int pageNo, @PathVariable int pageSize) { + return resourceMgtService.queryNsiInstances(pageNo, pageSize); + } + + @ResponseBody + @RequestMapping(value = { + "/nsi/{instanceStatus}/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryNsiInstancesByStatus(@PathVariable String instanceStatus, @PathVariable int pageNo, + @PathVariable int pageSize) { + return resourceMgtService.queryNsiInstancesByStatus(instanceStatus, pageNo, pageSize); + } + + @ResponseBody + @RequestMapping(value = {"/nsi/{nsiId}/details"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryNsiDetails(@PathVariable String nsiId) { + return resourceMgtService.queryNsiDetails(nsiId); + } + + @ResponseBody + @RequestMapping(value = {"/nsi/{nsiId}/nssiInstances"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryNsiRelatedNssiInfo(@PathVariable String nsiId) { + return resourceMgtService.queryNsiRelatedNssiInfo(nsiId); + } + + @ResponseBody + @RequestMapping(value = { + "/nssi/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryNssiInstances(@PathVariable int pageNo, @PathVariable int pageSize) { + return resourceMgtService.queryNssiInstances(pageNo, pageSize); + } + + @ResponseBody + @RequestMapping(value = { + "/nssi/instanceStatus/{instanceStatus}/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryNssiInstancesByStatus(@PathVariable String instanceStatus, @PathVariable int pageNo, + @PathVariable int pageSize) { + return resourceMgtService.queryNssiInstancesByStatus(instanceStatus, pageNo, pageSize); + } + + @ResponseBody + @RequestMapping(value = { + "/nssi/environmentContext/{environmentContext}/instances/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryNssiInstancesByEnvironment(@PathVariable String environmentContext, + @PathVariable int pageNo, @PathVariable int pageSize) { + return resourceMgtService.queryNssiInstancesByEnvironment(environmentContext, pageNo, pageSize); + } + + @ResponseBody + @RequestMapping(value = {"/nssi/{nssiId}/details"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryNssiDetails(@PathVariable String nssiId) { + return resourceMgtService.queryNssiDetails(nssiId); + } + + @ResponseBody + @RequestMapping(value = {"/{serviceId}/activate"}, method = RequestMethod.PUT, produces = "application/json") + public ServiceResult activateSlicingService(@PathVariable(value = "serviceId") String serviceId) { + return resourceMgtService.activateSlicingService(serviceId); + } + + @ResponseBody + @RequestMapping(value = {"/{serviceId}/deactivate"}, method = RequestMethod.PUT, produces = "application/json") + public ServiceResult deactivateSlicingService(@PathVariable(value = "serviceId") String serviceId) { + return resourceMgtService.deactivateSlicingService(serviceId); + } + + @ResponseBody + @RequestMapping(value = {"/{serviceId}"}, method = RequestMethod.DELETE, produces = "application/json") + public ServiceResult terminateSlicingService(@PathVariable(value = "serviceId") String serviceId) { + return resourceMgtService.terminateSlicingService(serviceId); + } + + @ResponseBody + @RequestMapping(value = {"/{serviceId}/progress"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryOperationProgress(@PathVariable(value = "serviceId") String serviceId) { + return resourceMgtService.queryOperationProgress(serviceId); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMonitorController.java b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMonitorController.java new file mode 100644 index 00000000..3431412e --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/ResourceMonitorController.java @@ -0,0 +1,71 @@ +/* + * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.controller.nsmf; + +import javax.annotation.Resource; +import org.onap.usecaseui.server.bean.nsmf.common.ServiceResult; +import org.onap.usecaseui.server.bean.nsmf.monitor.ServiceList; +import org.onap.usecaseui.server.service.nsmf.ResourceMonitorService; +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.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +@CrossOrigin(origins = "*") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +@RequestMapping("/uui-slicing/nsmf/monitoring") +public class ResourceMonitorController { + + @Resource(name = "ResourceMonitorService") + private ResourceMonitorService resourceMonitorService; + + public void setResourceMonitorService(ResourceMonitorService resourceMonitorService) { + this.resourceMonitorService = resourceMonitorService; + } + + @ResponseBody + @RequestMapping(value = { + "/queryTimestamp/{queryTimestamp}/trafficData"}, method = RequestMethod.POST, produces = "application/json") + public ServiceResult querySlicingUsageTraffic(@PathVariable(value = "queryTimestamp") String queryTimestamp, + @RequestBody + ServiceList serviceList) { + return resourceMonitorService.querySlicingUsageTraffic(queryTimestamp, serviceList); + } + + @ResponseBody + @RequestMapping(value = { + "/queryTimestamp/{queryTimestamp}/onlineUsers"}, method = RequestMethod.POST, produces = "application/json") + public ServiceResult querySlicingOnlineUserNumber(@PathVariable(value = "queryTimestamp") String queryTimestamp, + @RequestBody + ServiceList serviceList) { + return resourceMonitorService.querySlicingOnlineUserNumber(queryTimestamp, serviceList); + } + + @ResponseBody + @RequestMapping(value = { + "/queryTimestamp/{queryTimestamp}/bandwidth"}, method = RequestMethod.POST, produces = "application/json") + public ServiceResult querySlicingTotalBandwidth(@PathVariable(value = "queryTimestamp") String queryTimestamp, + @RequestBody + ServiceList serviceList) { + return resourceMonitorService.querySlicingTotalBandwidth(queryTimestamp, serviceList); + } +} diff --git a/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/TaskMgtController.java b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/TaskMgtController.java new file mode 100644 index 00000000..07c2cadf --- /dev/null +++ b/server/src/main/java/org/onap/usecaseui/server/controller/nsmf/TaskMgtController.java @@ -0,0 +1,85 @@ +/* + * Copyright (C) 2019 CMCC, Inc. and others. All rights reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.onap.usecaseui.server.controller.nsmf; + +import javax.annotation.Resource; +import org.onap.usecaseui.server.bean.nsmf.common.ServiceResult; +import org.onap.usecaseui.server.bean.nsmf.task.SlicingTaskAuditInfo; +import org.onap.usecaseui.server.service.nsmf.TaskMgtService; +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.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.annotation.ResponseBody; + +@Controller +@CrossOrigin(origins = "*") +@org.springframework.context.annotation.Configuration +@EnableAspectJAutoProxy +@RequestMapping("/uui-slicing/nsmf/task") +public class TaskMgtController { + + @Resource(name = "TaskMgtService") + private TaskMgtService taskMgtService; + + public void setTaskMgtService(TaskMgtService taskMgtService) { + this.taskMgtService = taskMgtService; + } + + @ResponseBody + @RequestMapping(value = { + "/business/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult querySlicingTask(@PathVariable int pageNo, @PathVariable int pageSize) { + return taskMgtService.querySlicingTask(pageNo, pageSize); + } + + @ResponseBody + @RequestMapping(value = { + "/{processingStatus}/business/pageNo/{pageNo}/pageSize/{pageSize}"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult querySlicingTaskByStatus(@PathVariable String processingStatus, @PathVariable int pageNo, + @PathVariable int pageSize) { + return taskMgtService.querySlicingTaskByStatus(processingStatus, pageNo, pageSize); + } + + @ResponseBody + @RequestMapping(value = {"/{taskId}/auditInfo"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryTaskAuditInfo(@PathVariable String taskId) { + return taskMgtService.queryTaskAuditInfo(taskId); + } + + @ResponseBody + @RequestMapping(value = {"/auditInfo"}, method = RequestMethod.PUT, produces = "application/json") + public ServiceResult updateTaskAuditInfo(@RequestBody SlicingTaskAuditInfo slicingTaskAuditInfo) { + return taskMgtService.updateTaskAuditInfo(slicingTaskAuditInfo); + } + + @ResponseBody + @RequestMapping(value = {"/{taskId}/taskCreationInfo"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryTaskCreationInfo(@PathVariable String taskId) { + return taskMgtService.queryTaskCreationInfo(taskId); + } + + @ResponseBody + @RequestMapping(value = { + "/{taskId}/taskCreationProgress"}, method = RequestMethod.GET, produces = "application/json") + public ServiceResult queryTaskCreationProgress(@PathVariable String taskId) { + return taskMgtService.queryTaskCreationProgress(taskId); + } + +} |