X-Git-Url: https://gerrit.o-ran-sc.org/r/gitweb?a=blobdiff_plain;f=webapp-backend%2Fsrc%2Fmain%2Fjava%2Forg%2Foransc%2Fric%2Fportal%2Fdashboard%2Fcontroller%2FAnrXappController.java;h=7f14cdee0931e63593feef514e583d0bdd3277dc;hb=0d109ab39573a2d912bc1d963ab93f3006730721;hp=36543568a431c120352dc2d2df8c5905e4696f97;hpb=c535d05d9cf44ecee863387b8536211937f9a039;p=portal%2Fric-dashboard.git diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AnrXappController.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AnrXappController.java index 36543568..7f14cdee 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AnrXappController.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AnrXappController.java @@ -25,10 +25,12 @@ import javax.servlet.http.HttpServletResponse; import org.oransc.ric.anrxapp.client.api.HealthApi; import org.oransc.ric.anrxapp.client.api.NcrtApi; -import org.oransc.ric.anrxapp.client.model.NeighborCellRelationDelTable; -import org.oransc.ric.anrxapp.client.model.NeighborCellRelationModTable; +import org.oransc.ric.anrxapp.client.model.GgNodeBTable; +import org.oransc.ric.anrxapp.client.model.NeighborCellRelationMod; import org.oransc.ric.anrxapp.client.model.NeighborCellRelationTable; +import org.oransc.ric.portal.dashboard.DashboardApplication; import org.oransc.ric.portal.dashboard.DashboardConstants; +import org.oransc.ric.portal.dashboard.model.SuccessTransport; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -50,17 +52,18 @@ import io.swagger.annotations.ApiOperation; */ @Configuration @RestController -@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/ncrt", produces = MediaType.APPLICATION_JSON_VALUE) +@RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/xapp/anr", produces = MediaType.APPLICATION_JSON_VALUE) public class AnrXappController { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final String CELL_ID = "cellIdentifier"; - private static final String GGNBID = "ggnbId"; - private static final String START_INDEX = "startIndex"; - private static final String LIMIT = "limit"; - private static final String NRPCI = "neighborCellIdentifierNrpci"; - private static final String NRCGI = "neighborCellIdentifierNrcgi"; + // Query parameters + private static final String QP_NODEB = "ggnodeb"; + private static final String QP_SERVING = "servingCellNrcgi"; + private static final String QP_NEIGHBOR = "neighborCellNrpci"; + // Path parameters + private static final String PP_SERVING = "servingcells"; + private static final String PP_NEIGHBOR = "neighborcells"; // Populated by the autowired constructor private final HealthApi healthApi; @@ -74,6 +77,13 @@ public class AnrXappController { this.ncrtApi = ncrtApi; } + @ApiOperation(value = "Gets the ANR client library MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class) + @RequestMapping(value = DashboardConstants.VERSION_PATH, method = RequestMethod.GET) + public SuccessTransport getVersion() { + logger.debug("getVersion enter"); + return new SuccessTransport(200, DashboardApplication.getImplementationVersion(HealthApi.class)); + } + @ApiOperation(value = "Performs a liveness probe on the ANR xApp, result expressed as the response code.") @RequestMapping(value = "/health/alive", method = RequestMethod.GET) public void getHealthAlive(HttpServletResponse response) { @@ -90,45 +100,45 @@ public class AnrXappController { response.setStatus(healthApi.getApiClient().getStatusCode().value()); } - @ApiOperation(value = "Query NCRT of all cells, all or one gNB(s)", response = NeighborCellRelationTable.class) - @RequestMapping(value = "/cell", method = RequestMethod.GET) - public NeighborCellRelationTable queryNcrtAllCells( // - @RequestParam(name = GGNBID, required = false) String ggnbId, // - @RequestParam(name = START_INDEX, required = false) String startIndex, // - @RequestParam(name = LIMIT, required = false) Integer limit) { - logger.debug("queryNcrtAllCells: ggnbid {}, startIndex {} limit {}", ggnbId, startIndex, limit); - return ncrtApi.getNcrtInfo(ggnbId, startIndex, limit); + @ApiOperation(value = "Returns list of gNodeB IDs based on NCRT in ANR", response = GgNodeBTable.class) + @RequestMapping(value = "/gnodebs", method = RequestMethod.GET) + public GgNodeBTable getGnodebs() { + return ncrtApi.getgNodeB(); } - @ApiOperation(value = "Query NCRT of a single serving cell", response = NeighborCellRelationTable.class) - @RequestMapping(value = "/cell/" + CELL_ID + "/{" + CELL_ID + "}", method = RequestMethod.GET) - public NeighborCellRelationTable queryNcrtServingCell(@PathVariable(CELL_ID) String cellIdentifier, // - @RequestParam(name = START_INDEX, required = false) String startIndex, // - @RequestParam(name = LIMIT, required = false) Integer limit, - @RequestParam(name = NRPCI, required = false) String nrpci, - @RequestParam(name = NRCGI, required = false) String nrcgi) { - logger.debug("queryNcrtAllCells: cellIdentifier {}, startIndex {} limit {} nrpci {} nrcgi {}", cellIdentifier, - startIndex, limit, nrpci, nrcgi); - return ncrtApi.getCellNcrtInfo(cellIdentifier, startIndex, limit, nrpci, nrcgi); + @ApiOperation(value = "Returns neighbor cell relation table for all gNodeBs or based on query parameters", response = NeighborCellRelationTable.class) + @RequestMapping(value = "/ncrt", method = RequestMethod.GET) + public NeighborCellRelationTable getNcrtInfo( // + @RequestParam(name = QP_NODEB, required = false) String ggnbId, // + @RequestParam(name = QP_SERVING, required = false) String servingCellNrcgi, // + @RequestParam(name = QP_NEIGHBOR, required = false) String neighborCellNrpci) { + logger.debug("getNcrtInfo: ggnbid {}, servingCellNrpci {} neighborCellNrcgi {}", ggnbId, servingCellNrcgi, + neighborCellNrpci); + return ncrtApi.getNcrt(ggnbId, servingCellNrcgi, neighborCellNrpci); } - @ApiOperation(value = "Modify neighbor cell relation based on Source Cell NR CGI and Target Cell NR PCI / NR CGI") - @RequestMapping(value = "/cell/" + CELL_ID + "/{" + CELL_ID + "}", method = RequestMethod.PUT) - public void modifyNcrt(@PathVariable(CELL_ID) String cellIdentifier, // - @RequestBody NeighborCellRelationModTable ncrtModTable, // - HttpServletResponse response) { - logger.debug("modifyNcrt: cellIdentifier {} modTable {}", cellIdentifier, ncrtModTable); - ncrtApi.modifyNCRT(cellIdentifier, ncrtModTable, null, null, null, null); + // /ncrt/servingcells/{servCellNrcgi}/neighborcells/{neighCellNrpci} : + @ApiOperation(value = "Modify neighbor cell relation based on Serving Cell NRCGI and Neighbor Cell NRPCI") + @RequestMapping(value = "/ncrt/" + PP_SERVING + "/{" + PP_SERVING + "}/" + PP_NEIGHBOR + "/{" + PP_NEIGHBOR + + "}", method = RequestMethod.PUT) + public void modifyNcrt(@PathVariable(PP_SERVING) String servingCellNrcgi, // + @PathVariable(PP_NEIGHBOR) String neighborCellNrpci, // + @RequestBody NeighborCellRelationMod ncrMod, HttpServletResponse response) { + logger.debug("modifyNcrt: servingCellNrcgi {}, neighborCellNrpci {}, ncrMod {}", servingCellNrcgi, + neighborCellNrpci, ncrMod); + ncrtApi.modifyNcrt(servingCellNrcgi, neighborCellNrpci, ncrMod); response.setStatus(healthApi.getApiClient().getStatusCode().value()); } - @ApiOperation(value = "Delete neighbor cell relation based on Source Cell NR CGI and Target Cell NR PCI / NR CGI") - @RequestMapping(value = "/cell/" + CELL_ID + "/{" + CELL_ID + "}", method = RequestMethod.DELETE) - public void modifyNcrt(@PathVariable(CELL_ID) String cellIdentifier, // - @RequestBody NeighborCellRelationDelTable ncrtDelTable, // + @ApiOperation(value = "Delete neighbor cell relation based on Serving Cell NRCGI and Neighbor Cell NRPCI") + @RequestMapping(value = "/ncrt/" + PP_SERVING + "/{" + PP_SERVING + "}/" + PP_NEIGHBOR + "/{" + PP_NEIGHBOR + + "}", method = RequestMethod.DELETE) + public void deleteNcrt(@PathVariable(PP_SERVING) String servingCellNrcgi, // + @PathVariable(PP_NEIGHBOR) String neighborCellNrpci, // HttpServletResponse response) { - logger.debug("modifyNcrt: cellIdentifier {} delTable {}", cellIdentifier, ncrtDelTable); - ncrtApi.deleteNcrt(cellIdentifier, ncrtDelTable, null, null, null, null); + logger.debug("deleteNcrt: servingCellNrcgi {}, neighborCellNrpci {}", servingCellNrcgi, neighborCellNrpci); + ncrtApi.deleteNcrt(servingCellNrcgi, neighborCellNrpci); response.setStatus(healthApi.getApiClient().getStatusCode().value()); } + }