Upgrade xapp manager to spec 0.1.3
[portal/ric-dashboard.git] / webapp-backend / src / main / java / org / oransc / ric / portal / dashboard / controller / AnrXappController.java
index 3654356..aa7b443 100644 (file)
@@ -28,7 +28,9 @@ 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.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,7 +52,7 @@ 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());
@@ -74,6 +76,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) {
@@ -92,7 +101,7 @@ public class AnrXappController {
 
        @ApiOperation(value = "Query NCRT of all cells, all or one gNB(s)", response = NeighborCellRelationTable.class)
        @RequestMapping(value = "/cell", method = RequestMethod.GET)
-       public NeighborCellRelationTable queryNcrtAllCells( //
+       public NeighborCellRelationTable getNcrtInfo( //
                        @RequestParam(name = GGNBID, required = false) String ggnbId, //
                        @RequestParam(name = START_INDEX, required = false) String startIndex, //
                        @RequestParam(name = LIMIT, required = false) Integer limit) {
@@ -102,7 +111,7 @@ public class AnrXappController {
 
        @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, //
+       public NeighborCellRelationTable getCellNcrtInfo(@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,
@@ -118,17 +127,21 @@ public class AnrXappController {
                        @RequestBody NeighborCellRelationModTable ncrtModTable, //
                        HttpServletResponse response) {
                logger.debug("modifyNcrt: cellIdentifier {} modTable {}", cellIdentifier, ncrtModTable);
-               ncrtApi.modifyNCRT(cellIdentifier, ncrtModTable, null, null, null, null);
+               ncrtApi.modifyNcrt(cellIdentifier, ncrtModTable);
                response.setStatus(healthApi.getApiClient().getStatusCode().value());
        }
 
+       /*
+        * TODO: DELETE should not have a body - the path should identify the resource to be deleted.
+        */
        @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, //
+       public void deleteNcrt(@PathVariable(CELL_ID) String cellIdentifier, //
                        @RequestBody NeighborCellRelationDelTable ncrtDelTable, //
                        HttpServletResponse response) {
                logger.debug("modifyNcrt: cellIdentifier {} delTable {}", cellIdentifier, ncrtDelTable);
-               ncrtApi.deleteNcrt(cellIdentifier, ncrtDelTable, null, null, null, null);
+               ncrtApi.deleteNcrt(cellIdentifier, ncrtDelTable);
                response.setStatus(healthApi.getApiClient().getStatusCode().value());
        }
+
 }