X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=dashboard%2Fwebapp-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fric%2Fportal%2Fdashboard%2Fcontroller%2FE2ManagerController.java;h=06cbc6b7fd914ceeeab30f386a7f5e56cc756d3b;hb=848677173191182d46aa22ab83bee0de84999a81;hp=349a607a0454325ba8a5367426f650da053e03e4;hpb=8b0c1aa1535896ad557d5d685a031208aa1b6dfb;p=portal%2Fric-dashboard.git diff --git a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java index 349a607a..06cbc6b7 100644 --- a/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java +++ b/dashboard/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/E2ManagerController.java @@ -23,6 +23,8 @@ import java.lang.invoke.MethodHandles; import java.util.ArrayList; import java.util.List; +import javax.validation.Valid; + import org.oransc.ric.portal.dashboard.DashboardApplication; import org.oransc.ric.portal.dashboard.DashboardConstants; import org.oransc.ric.portal.dashboard.config.E2ManagerApiBuilder; @@ -32,7 +34,7 @@ import org.oransc.ricplt.e2mgr.client.api.HealthCheckApi; import org.oransc.ricplt.e2mgr.client.api.NodebApi; import org.oransc.ricplt.e2mgr.client.model.GetNodebResponse; import org.oransc.ricplt.e2mgr.client.model.NodebIdentity; -import org.oransc.ricplt.e2mgr.client.model.ResetRequest; +import org.oransc.ricplt.e2mgr.client.model.UpdateGnbRequest; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -41,6 +43,7 @@ import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.security.access.annotation.Secured; import org.springframework.util.Assert; +import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PutMapping; @@ -54,10 +57,9 @@ import io.swagger.annotations.ApiOperation; /** * Proxies calls from the front end to the E2 Manager API. * - * If a method throws RestClientResponseException, it is handled by - * {@link CustomResponseEntityExceptionHandler#handleProxyMethodException(Exception, org.springframework.web.context.request.WebRequest)} - * which returns status 502. All other exceptions are handled by Spring which - * returns status 500. + * If a method throws RestClientResponseException, it is handled by a method in + * {@link CustomResponseEntityExceptionHandler} which returns status 502. All + * other exceptions are handled by Spring which returns status 500. */ @Configuration @RestController @@ -75,8 +77,6 @@ public class E2ManagerController { public static final String RAN_METHOD = NODEB_PREFIX + "/ran"; public static final String NODEB_SHUTDOWN_METHOD = NODEB_PREFIX + "/shutdown"; public static final String NODEB_LIST_METHOD = NODEB_PREFIX + "/ids"; - // Reset uses prefix, adds a path parameter below - public static final String RESET_METHOD = "reset"; // Path parameters private static final String PP_RANNAME = "ranName"; @@ -165,15 +165,16 @@ public class E2ManagerController { return ResponseEntity.status(api.getApiClient().getStatusCode().value()).body(null); } - @ApiOperation(value = "Abort any other ongoing procedures over X2 between the RIC and the RAN.") + @ApiOperation(value = "Update GNB.") @PutMapping(DashboardConstants.RIC_INSTANCE_KEY + "/{" + DashboardConstants.RIC_INSTANCE_KEY + "}/" + NODEB_PREFIX - + "/{" + PP_RANNAME + "}/" + RESET_METHOD) + + "/{" + PP_RANNAME + "}") @Secured({ DashboardConstants.ROLE_ADMIN }) - public ResponseEntity reset(@PathVariable(DashboardConstants.RIC_INSTANCE_KEY) String instanceKey, - @PathVariable(PP_RANNAME) String ranName, @RequestBody ResetRequest resetRequest) { - logger.debug("reset instance {} name {}", instanceKey, ranName); + public ResponseEntity updateGnb(@PathVariable(DashboardConstants.RIC_INSTANCE_KEY) String instanceKey, + @PathVariable(PP_RANNAME) String ranName, // + @Valid @Validated @RequestBody UpdateGnbRequest updateGnbRequest) { + logger.debug("updateGnb instance {} ran {}", instanceKey, ranName); NodebApi api = e2ManagerApiBuilder.getNodebApi(instanceKey); - api.reset(ranName, resetRequest); + api.updateGnb(updateGnbRequest, ranName); return ResponseEntity.status(api.getApiClient().getStatusCode().value()).body(null); }