From ef2afb662e0051397034e6fd3ece039a04c684c0 Mon Sep 17 00:00:00 2001 From: Nicolas Hu Date: Mon, 18 Nov 2019 12:59:47 -0500 Subject: [PATCH] remove ANR xapp Change-Id: Ia35c87dfee93d92cbdadb236d6070085eaac8d1d Signed-off-by: Jun (Nicolas) Hu --- anr-xapp-client/.gitignore | 4 - anr-xapp-client/README.md | 29 --- anr-xapp-client/pom.xml | 173 --------------- .../src/main/resources/anr_swagger_0.0.8.yaml | 239 --------------------- .../anrxapp/client/test/AnrXappClientTest.java | 49 ----- docs/release-notes.rst | 1 + pom.xml | 5 +- webapp-backend/pom.xml | 5 - .../dashboard/config/AnrXappConfiguration.java | 76 ------- .../dashboard/config/WebSecurityConfiguration.java | 4 - .../dashboard/controller/AnrXappController.java | 165 -------------- .../src/main/resources/application.properties | 3 - .../dashboard/config/AnrXappMockConfiguration.java | 207 ------------------ .../config/AppManagerMockConfiguration.java | 2 +- .../controller/AnrXappControllerTest.java | 103 --------- .../anr-xapp/anr-edit-ncr-dialog.component.html | 53 ----- .../anr-xapp/anr-edit-ncr-dialog.component.scss | 24 --- .../app/anr-xapp/anr-edit-ncr-dialog.component.ts | 93 -------- .../src/app/anr-xapp/anr-xapp.component.html | 96 --------- .../src/app/anr-xapp/anr-xapp.component.scss | 77 ------- .../src/app/anr-xapp/anr-xapp.component.spec.ts | 44 ---- .../src/app/anr-xapp/anr-xapp.component.ts | 151 ------------- .../src/app/anr-xapp/anr-xapp.datasource.ts | 102 --------- .../src/app/app-control/app-control.component.ts | 7 +- webapp-frontend/src/app/rd-routing.module.ts | 2 - webapp-frontend/src/app/rd.module.ts | 5 - .../app/services/anr-xapp/anr-xapp.service.spec.ts | 32 --- .../src/app/services/anr-xapp/anr-xapp.service.ts | 136 ------------ .../ui/catalog-card/catalog-card.component.html | 3 - 29 files changed, 5 insertions(+), 1885 deletions(-) delete mode 100644 anr-xapp-client/.gitignore delete mode 100644 anr-xapp-client/README.md delete mode 100644 anr-xapp-client/pom.xml delete mode 100644 anr-xapp-client/src/main/resources/anr_swagger_0.0.8.yaml delete mode 100644 anr-xapp-client/src/test/java/org/oransc/ric/portal/dashboard/anrxapp/client/test/AnrXappClientTest.java delete mode 100644 webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/AnrXappConfiguration.java delete mode 100644 webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AnrXappController.java delete mode 100644 webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/AnrXappMockConfiguration.java delete mode 100644 webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/controller/AnrXappControllerTest.java delete mode 100644 webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.html delete mode 100644 webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.scss delete mode 100644 webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.ts delete mode 100644 webapp-frontend/src/app/anr-xapp/anr-xapp.component.html delete mode 100644 webapp-frontend/src/app/anr-xapp/anr-xapp.component.scss delete mode 100644 webapp-frontend/src/app/anr-xapp/anr-xapp.component.spec.ts delete mode 100644 webapp-frontend/src/app/anr-xapp/anr-xapp.component.ts delete mode 100644 webapp-frontend/src/app/anr-xapp/anr-xapp.datasource.ts delete mode 100644 webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.spec.ts delete mode 100644 webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.ts diff --git a/anr-xapp-client/.gitignore b/anr-xapp-client/.gitignore deleted file mode 100644 index 10d81e8c..00000000 --- a/anr-xapp-client/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/.classpath -/.project -/.settings/ -/target/ diff --git a/anr-xapp-client/README.md b/anr-xapp-client/README.md deleted file mode 100644 index 658849ac..00000000 --- a/anr-xapp-client/README.md +++ /dev/null @@ -1,29 +0,0 @@ -# ANR xApp Client Generator - -This projects generates a REST client library from the Swagger specification -file stored here and packages it in a jar. - -## Eclipse and STS Users - -The Swagger Codegen maven plugin is not supported in Eclipse/STS. You can -limp along by taking these steps: - -1. Generate the code using maven: - mvn install -2. Add this folder to the project build path: - target/generated-sources/swagger/src/main/java - -## License - -Copyright (C) 2019 AT&T Intellectual Property. 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. diff --git a/anr-xapp-client/pom.xml b/anr-xapp-client/pom.xml deleted file mode 100644 index 5d6eced7..00000000 --- a/anr-xapp-client/pom.xml +++ /dev/null @@ -1,173 +0,0 @@ - - - - 4.0.0 - - org.o-ran-sc.portal.ric-dashboard - ric-dash-parent - 1.3.0-SNAPSHOT - - - org.o-ran-sc.ric.xapp.anr.client - anr-xapp-client - RIC ANR xApp client - 0.0.8-SNAPSHOT - - UTF-8 - UTF-8 - - 0 - - org.oransc.ric.anrxapp.client - - - - - - javax.annotation - javax.annotation-api - - - io.swagger - swagger-annotations - 1.5.15 - - - org.springframework - spring-context - - - - org.springframework - spring-web - - - - com.fasterxml.jackson.core - jackson-core - - - com.fasterxml.jackson.core - jackson-annotations - - - com.fasterxml.jackson.core - jackson-databind - - - com.fasterxml.jackson.jaxrs - jackson-jaxrs-json-provider - - - com.fasterxml.jackson.datatype - jackson-datatype-jsr310 - - - - org.junit.jupiter - junit-jupiter-api - test - - - - - - - io.swagger - swagger-codegen-maven-plugin - 2.4.5 - - - - generate - - - ${project.basedir}/src/main/resources/anr_swagger_0.0.8.yaml - java - - ${project.groupId} - ${project.artifactId} - ${project.version} - resttemplate - true - java8 - Apache 2.0 - https://www.apache.org/licenses/LICENSE-2.0 - - ${client.base.package.name} - ${client.base.package.name}.model - ${client.base.package.name}.api - ${client.base.package.name}.invoker - - - - - - - org.apache.maven.plugins - maven-jar-plugin - - - - true - - - ${project.version}-b${build.number} - - - - - - - - - - org.eclipse.m2e - lifecycle-mapping - 1.0.0 - - - - - - io.swagger - swagger-codegen-maven-plugin - [1.0,) - - generate - - - - - - - - - - - - - - diff --git a/anr-xapp-client/src/main/resources/anr_swagger_0.0.8.yaml b/anr-xapp-client/src/main/resources/anr_swagger_0.0.8.yaml deleted file mode 100644 index 8080b633..00000000 --- a/anr-xapp-client/src/main/resources/anr_swagger_0.0.8.yaml +++ /dev/null @@ -1,239 +0,0 @@ -# ========================LICENSE_START================================= -# O-RAN-SC -# %% -# Copyright (C) 2019 AT&T Intellectual Property -# %% -# 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. -# ========================LICENSE_END=================================== -swagger : '2.0' -info : - description : REST API specification for RIC ANR closed xAPP - version : 0.0.8 - title : RIC ANR - license: - name : Nokia Closed App - url : 'http://www.nokia.com' -host : anr-service -basePath : /ric/v1 -schemes : - - http -paths : - /health/alive : - get : - summary : Health check of ANR - Liveness probe - tags : - - health - operationId : getHealthAlive - responses : - '200' : - description : Status of ANR xApp is ok - /health/ready : - get : - summary : Health check of ANR - Readiness probe - tags : - - health - operationId : getHealthReady - responses : - '200': - description : ANR xApp is ready to serve - /ncrt/gnodebs : - get : - summary : Returns list of gNodeB IDs based on NCRT in ANR - tags : - - ncrt - operationId : getgNodeB - produces : - - application/json - responses : - '200' : - description : successful operation - schema : - $ref : '#/definitions/ggNodeBTable' - '500' : - description : Unable to retrieve gNodeBs - /ncrt/servingcells : - get : - summary : Returns neighbor cell relation table for all gNodeBs or based on query string - tags : - - ncrt - operationId : getNcrt - parameters : - - $ref : '#/parameters/ggnodeb' - - $ref : '#/parameters/servingCellNrcgi' - - $ref : '#/parameters/neighborCellNrpci' - produces : - - application/json - responses : - '200' : - description : successful operation - schema : - $ref : '#/definitions/neighborCellRelationTable' - '500' : - description : Unable to retrieve NCRT - /ncrt/servingcells/{servCellNrcgi}/neighborcells/{neighCellNrpci} : - parameters : - - $ref : '#/parameters/servCellNrcgi' - - $ref : '#/parameters/neighCellNrpci' - put : - summary : Modify neighbor cell relation based on Serving Cell NRCGI and Neighbor Cell NRPCI - tags : - - ncrt - operationId : modifyNcrt - consumes : - - application/json - produces : - - application/json - parameters : - - name : NcrtModificationParameters - in : body - description : Parameters to modify neighbor cell relation - required : true - schema : - $ref : '#/definitions/neighborCellRelationMod' - responses : - '200' : - description : Successfully modified neighbor cell relation - '400' : - description : Modification failed. - { - Non-existent servCellNrcgi in request. | - Non-existent neighCellNrpci in request. - } - '405' : - description : Modification failed. - { - No data to udpate. | - Invalid data in BODY. | - Parameter missing in BODY. - } - '500' : - description : Modification failed. - delete : - summary : Delete neighbor cell relation based on Source Cell NRCGI and Neighbor Cell NRPCI - tags : - - ncrt - operationId : deleteNcrt - responses : - '204' : - description : Successfully deleted neighbor cell relation - '400' : - description : Deletion failed. - { - Non-existent servCellNrcgi in request. | - Non-existent neighCellNrpci in request. - } - '500' : - description : Deletion failed. -parameters : - ggnodeb : - type : string - name : ggnodeb - description : Global gNodeB Identifier - in : query - servingCellNrcgi : - type : string - name : servingCellNrcgi - description : Serving Cell Identifier (NR CGI) - in : query - neighborCellNrpci : - type : string - name : neighborCellNrpci - description : Neighbor Cell Identifier (NR PCI) - in : query - servCellNrcgi : - type : string - name : servCellNrcgi - description : Serving Cell Identifier (NR CGI) - in : path - required : true - neighCellNrpci : - type : string - name : neighCellNrpci - description : Neighbor Cell Identifier (NR PCI) - in : path - required : true -definitions : - ggNodeBTable : - type : object - properties : - gNodeBIds : - type : array - items : - $ref : '#/definitions/ggnodebId' - neighborCellRelationTable : - type : object - properties : - ncrtRelations : - type : array - items : - $ref : '#/definitions/neighborCellRelation' - ggnodebId : - type : string - description : Global gNodeB Identifier - example : ABCDE, EFGHI - neighborCellRelation : - type : object - required : - - servingCellNrcgi - - neighborCellNrpci - - neighborCellNrcgi - - flagNoHo - - flagNoXn - - flagNoRemove - properties : - servingCellNrcgi : - type : string - description : Serving Cell Identifier (NR CGI) - example : E12345 - neighborCellNrpci : - type : string - description : Neighbor Cell Identifier (NR PCI) - example : E12345 - neighborCellNrcgi : - type : string - description : Neighbor Cell Identifier (NR CGI) - example : E12345 - flagNoHo : - type : boolean - description : Flag for HANDOVER NOT ALLOWED - example : True - flagNoXn : - type : boolean - description : Flag for Xn CONNECTION NOT ALLOWED - example : True - flagNoRemove : - type : boolean - description : Flag for DELETION NOT ALLOWED - example : True - neighborCellRelationMod : - type : object - required : - - neighborCellIdentifierType - - action - properties : - neighborCellNrcgi : - type : string - description : Neighbor Cell Identifier (NR CGI) - example : E12345 - flagNoHo : - type : boolean - description : Flag for HANDOVER NOT ALLOWED - example : True - flagNoXn : - type : boolean - description : Flag for Xn CONNECTION NOT ALLOWED - example : True - flagNoRemove : - type : boolean - description : Flag for DELETION NOT ALLOWED - example : True diff --git a/anr-xapp-client/src/test/java/org/oransc/ric/portal/dashboard/anrxapp/client/test/AnrXappClientTest.java b/anr-xapp-client/src/test/java/org/oransc/ric/portal/dashboard/anrxapp/client/test/AnrXappClientTest.java deleted file mode 100644 index c9b435e9..00000000 --- a/anr-xapp-client/src/test/java/org/oransc/ric/portal/dashboard/anrxapp/client/test/AnrXappClientTest.java +++ /dev/null @@ -1,49 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ -package org.oransc.ric.portal.dashboard.anrxapp.client.test; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -import org.oransc.ric.anrxapp.client.api.HealthApi; -import org.oransc.ric.anrxapp.client.invoker.ApiClient; -import org.springframework.web.client.RestClientException; - -/** - * Demonstrates use of the generated ANR xApp client. - * - * The test fails because no server is available. - */ -public class AnrXappClientTest { - - @Test - public void demo() { - ApiClient apiClient = new ApiClient(); - apiClient.setBasePath("http://localhost:30099/"); - HealthApi healthApi = new HealthApi(apiClient); - try { - healthApi.getHealthAlive(); - System.out.println("getHealthAlive answered: " + apiClient.getStatusCode().toString()); - Assertions.assertTrue(apiClient.getStatusCode().is2xxSuccessful()); - } catch (RestClientException e) { - System.err.println("getHealthAlive failed: " + e.toString()); - } - } - -} diff --git a/docs/release-notes.rst b/docs/release-notes.rst index 34f8c85d..9ea7c754 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -30,6 +30,7 @@ Version 1.2.4, 24 Oct 2019 * Repair bug that omitted slashes in CAAS-Ingress URL builder * Improve the dark mode * Show container ready count with total count +* Remove ANR xApp Version 1.2.3, 4 Oct 2019 ------------------------- diff --git a/pom.xml b/pom.xml index 03f8a100..1fbfa42b 100644 --- a/pom.xml +++ b/pom.xml @@ -46,10 +46,9 @@ limitations under the License. a1-med-client - anr-xapp-client app-mgr-client - e2-mgr-client - webapp-frontend + e2-mgr-client + webapp-frontend webapp-backend diff --git a/webapp-backend/pom.xml b/webapp-backend/pom.xml index 3b56e684..892ca6fb 100644 --- a/webapp-backend/pom.xml +++ b/webapp-backend/pom.xml @@ -43,11 +43,6 @@ limitations under the License. - - org.o-ran-sc.ric.xapp.anr.client - anr-xapp-client - 0.0.8-SNAPSHOT - org.o-ran-sc.ric.plt.a1med.client diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/AnrXappConfiguration.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/AnrXappConfiguration.java deleted file mode 100644 index dbb78c7b..00000000 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/AnrXappConfiguration.java +++ /dev/null @@ -1,76 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ -package org.oransc.ric.portal.dashboard.config; - -import java.lang.invoke.MethodHandles; - -import org.oransc.ric.anrxapp.client.api.HealthApi; -import org.oransc.ric.anrxapp.client.api.NcrtApi; -import org.oransc.ric.anrxapp.client.invoker.ApiClient; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.web.client.RestTemplate; -import org.springframework.web.util.DefaultUriBuilderFactory; - -/** - * Creates instances of the ANR xApp client APIs. - */ -@Configuration -@Profile("!test") -public class AnrXappConfiguration { - - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - // Populated by the autowired constructor - private final String anrXappUrl; - - @Autowired - public AnrXappConfiguration(@Value("${anrxapp.url.prefix}") final String urlPrefix, - @Value("${anrxapp.url.suffix}") final String urlSuffix) { - logger.debug("ctor prefix '{}' suffix '{}'", urlPrefix, urlSuffix); - anrXappUrl = new DefaultUriBuilderFactory(urlPrefix.trim()).builder().path(urlSuffix.trim()).build().normalize() - .toString(); - logger.info("Configuring ANR client at URL {}", anrXappUrl); - } - - private ApiClient apiClient() { - ApiClient apiClient = new ApiClient(new RestTemplate()); - apiClient.setBasePath(anrXappUrl); - return apiClient; - } - - @Bean - // The bean (method) name must be globally unique - public HealthApi anrHealthApi() { - return new HealthApi(apiClient()); - } - - @Bean - // The bean (method) name must be globally unique - public NcrtApi anrNcrtApi() { - return new NcrtApi(apiClient()); - } - -} diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/WebSecurityConfiguration.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/WebSecurityConfiguration.java index 0d90e6f5..f4819d30 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/WebSecurityConfiguration.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/config/WebSecurityConfiguration.java @@ -26,7 +26,6 @@ import org.onap.portalsdk.core.onboarding.util.PortalApiConstants; import org.oransc.ric.portal.dashboard.DashboardUserManager; import org.oransc.ric.portal.dashboard.controller.A1MediatorController; import org.oransc.ric.portal.dashboard.controller.AdminController; -import org.oransc.ric.portal.dashboard.controller.AnrXappController; import org.oransc.ric.portal.dashboard.controller.AppManagerController; import org.oransc.ric.portal.dashboard.controller.E2ManagerController; import org.oransc.ric.portal.dashboard.controller.SimpleErrorController; @@ -96,9 +95,6 @@ public class WebSecurityConfiguration extends WebSecurityConfigurerAdapter { A1MediatorController.CONTROLLER_PATH + "/" + A1MediatorController.VERSION_METHOD, // AdminController.CONTROLLER_PATH + "/" + AdminController.HEALTH_METHOD, // AdminController.CONTROLLER_PATH + "/" + AdminController.VERSION_METHOD, // - AnrXappController.CONTROLLER_PATH + "/" + AnrXappController.HEALTH_ALIVE_METHOD, // - AnrXappController.CONTROLLER_PATH + "/" + AnrXappController.HEALTH_READY_METHOD, // - AnrXappController.CONTROLLER_PATH + "/" + AnrXappController.VERSION_METHOD, // AppManagerController.CONTROLLER_PATH + "/" + AppManagerController.HEALTH_ALIVE_METHOD, // AppManagerController.CONTROLLER_PATH + "/" + AppManagerController.HEALTH_READY_METHOD, // AppManagerController.CONTROLLER_PATH + "/" + AppManagerController.VERSION_METHOD, // 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 deleted file mode 100644 index 3d32415a..00000000 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AnrXappController.java +++ /dev/null @@ -1,165 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ -package org.oransc.ric.portal.dashboard.controller; - -import java.lang.invoke.MethodHandles; - -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.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; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.MediaType; -import org.springframework.security.access.annotation.Secured; -import org.springframework.util.Assert; -import org.springframework.web.bind.annotation.DeleteMapping; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PutMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import io.swagger.annotations.ApiOperation; - -/** - * Proxies calls from the front end to the ANR xApp, which manages a Neighbor - * Cell Relation Table (NCRT). - * - * 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. - */ -@Configuration -@RestController -@RequestMapping(value = AnrXappController.CONTROLLER_PATH, produces = MediaType.APPLICATION_JSON_VALUE) -public class AnrXappController { - - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - // Publish paths in constants so tests are easy to write - public static final String CONTROLLER_PATH = DashboardConstants.ENDPOINT_PREFIX + "/xapp/anr"; - // Endpoints - public static final String HEALTH_ALIVE_METHOD = "/health/alive"; - public static final String HEALTH_READY_METHOD = "/health/ready"; - public static final String GNODEBS_METHOD = "/gnodebs"; - public static final String NCRT_METHOD = "/ncrt"; - public static final String VERSION_METHOD = DashboardConstants.VERSION_METHOD; - - // Path parameters - public static final String PP_SERVING = "servingcells"; - public static final String PP_NEIGHBOR = "neighborcells"; - - // Populated by the autowired constructor - private final HealthApi healthApi; - private final NcrtApi ncrtApi; - - @Autowired - public AnrXappController(final HealthApi anrHealthApi, final NcrtApi anrNcrtApi) { - Assert.notNull(anrHealthApi, "API must not be null"); - Assert.notNull(anrNcrtApi, "API must not be null"); - this.healthApi = anrHealthApi; - this.ncrtApi = anrNcrtApi; - if (logger.isDebugEnabled()) - logger.debug("ctor: configured with client types {} and {}", anrHealthApi.getClass().getName(), - anrNcrtApi.getClass().getName()); - } - - @ApiOperation(value = "Gets the ANR client library MANIFEST.MF property Implementation-Version.", response = SuccessTransport.class) - @GetMapping(VERSION_METHOD) - // No role required - public SuccessTransport getClientVersion() { - return new SuccessTransport(200, DashboardApplication.getImplementationVersion(HealthApi.class)); - } - - @ApiOperation(value = "Performs a liveness probe on the ANR xApp, result expressed as the response code.") - @GetMapping(HEALTH_ALIVE_METHOD) - // No role required - public void getHealthAlive(HttpServletResponse response) { - logger.debug("getHealthAlive"); - healthApi.getHealthAlive(); - response.setStatus(healthApi.getApiClient().getStatusCode().value()); - } - - @ApiOperation(value = "Performs a readiness probe on the ANR xApp, result expressed as the response code.") - @GetMapping(HEALTH_READY_METHOD) - // No role required - public void getHealthReady(HttpServletResponse response) { - logger.debug("getHealthReady"); - healthApi.getHealthReady(); - response.setStatus(healthApi.getApiClient().getStatusCode().value()); - } - - @ApiOperation(value = "Returns list of gNodeB IDs based on NCRT in ANR", response = GgNodeBTable.class) - @GetMapping(GNODEBS_METHOD) - @Secured({ DashboardConstants.ROLE_ADMIN, DashboardConstants.ROLE_STANDARD }) - public GgNodeBTable getGnodebs() { - logger.debug("getGnodebs"); - return ncrtApi.getgNodeB(); - } - - @ApiOperation(value = "Returns neighbor cell relation table for all gNodeBs or based on query parameters", response = NeighborCellRelationTable.class) - @GetMapping(NCRT_METHOD) - @Secured({ DashboardConstants.ROLE_ADMIN, DashboardConstants.ROLE_STANDARD }) - public NeighborCellRelationTable getNcrt( // - @RequestParam(required = false) String ggnodeb, // - @RequestParam(required = false) String servingCellNrcgi, // - @RequestParam(required = false) String neighborCellNrpci) { - logger.debug("getNcrt: ggnbid {}, servingCellNrpci {}, neighborCellNrcgi {}", ggnodeb, servingCellNrcgi, - neighborCellNrpci); - return ncrtApi.getNcrt(ggnodeb, servingCellNrcgi, neighborCellNrpci); - } - - // /ncrt/servingcells/{servCellNrcgi}/neighborcells/{neighCellNrpci} : - @ApiOperation(value = "Modify neighbor cell relation based on Serving Cell NRCGI and Neighbor Cell NRPCI") - @PutMapping(NCRT_METHOD + "/" + PP_SERVING + "/{" + PP_SERVING + "}/" + PP_NEIGHBOR + "/{" + PP_NEIGHBOR + "}") - @Secured({ DashboardConstants.ROLE_ADMIN }) - 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(ncrtApi.getApiClient().getStatusCode().value()); - } - - @ApiOperation(value = "Delete neighbor cell relation based on Serving Cell NRCGI and Neighbor Cell NRPCI") - @DeleteMapping(NCRT_METHOD + "/" + PP_SERVING + "/{" + PP_SERVING + "}/" + PP_NEIGHBOR + "/{" + PP_NEIGHBOR + "}") - @Secured({ DashboardConstants.ROLE_ADMIN }) - public void deleteNcrt(@PathVariable(PP_SERVING) String servingCellNrcgi, // - @PathVariable(PP_NEIGHBOR) String neighborCellNrpci, // - HttpServletResponse response) { - logger.debug("deleteNcrt: servingCellNrcgi {}, neighborCellNrpci {}", servingCellNrcgi, neighborCellNrpci); - ncrtApi.deleteNcrt(servingCellNrcgi, neighborCellNrpci); - response.setStatus(ncrtApi.getApiClient().getStatusCode().value()); - } - -} diff --git a/webapp-backend/src/main/resources/application.properties b/webapp-backend/src/main/resources/application.properties index a7406523..a497f09f 100644 --- a/webapp-backend/src/main/resources/application.properties +++ b/webapp-backend/src/main/resources/application.properties @@ -44,9 +44,6 @@ portalapi.password = # A1 Mediator a1med.url.prefix = http://jar-app-props-default-A1-URL-prefix a1med.url.suffix = -# ANR xApp -anrxapp.url.prefix = http://jar-app-props-default-ANR-URL-prefix -anrxapp.url.suffix = # App Manager appmgr.url.prefix = http://jar-app-props-default-Xapp-Mgr-URL appmgr.url.suffix = /ric/v1 diff --git a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/AnrXappMockConfiguration.java b/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/AnrXappMockConfiguration.java deleted file mode 100644 index dac3ff6b..00000000 --- a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/AnrXappMockConfiguration.java +++ /dev/null @@ -1,207 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ -package org.oransc.ric.portal.dashboard.config; - -import static org.mockito.ArgumentMatchers.any; -import static org.mockito.ArgumentMatchers.eq; -import static org.mockito.ArgumentMatchers.isNull; -import static org.mockito.Mockito.doAnswer; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; - -import java.lang.invoke.MethodHandles; - -import org.oransc.ric.anrxapp.client.api.HealthApi; -import org.oransc.ric.anrxapp.client.api.NcrtApi; -import org.oransc.ric.anrxapp.client.invoker.ApiClient; -import org.oransc.ric.anrxapp.client.model.GgNodeBTable; -import org.oransc.ric.anrxapp.client.model.NeighborCellRelation; -import org.oransc.ric.anrxapp.client.model.NeighborCellRelationMod; -import org.oransc.ric.anrxapp.client.model.NeighborCellRelationTable; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Value; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Profile; -import org.springframework.http.HttpStatus; - -/** - * Creates a mock implementation of the ANR xApp client APIs. - */ -@Configuration -@Profile("test") -public class AnrXappMockConfiguration { - - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - // Simulate remote method delay for UI testing - @Value("${mock.config.delay:0}") - private int delayMs; - - private static final String GNODEB1 = "001EF5:0045FE50"; - private static final String GNODEB2 = "001EF6:0045FE51"; - private static final String GNODEB3 = "001EF7:0045FE52"; - - // Sonar wants separate declarations - private final NeighborCellRelationTable ncrt; - private final NeighborCellRelationTable ncrtNodeB1; - private final NeighborCellRelationTable ncrtNodeB2; - private final NeighborCellRelationTable ncrtNodeB3; - private final GgNodeBTable gNodebTable; - - public AnrXappMockConfiguration() { - logger.info("Configuring mock ANR xApp client"); - gNodebTable = new GgNodeBTable(); - gNodebTable.addGNodeBIdsItem(GNODEB1).addGNodeBIdsItem(GNODEB2).addGNodeBIdsItem(GNODEB3); - ncrtNodeB1 = new NeighborCellRelationTable(); - ncrtNodeB2 = new NeighborCellRelationTable(); - ncrtNodeB3 = new NeighborCellRelationTable(); - ncrt = new NeighborCellRelationTable(); - String[] neighbors1 = { "1104", "1105", "1106" }; - for (String n : neighbors1) - ncrtNodeB1.addNcrtRelationsItem( - new NeighborCellRelation().servingCellNrcgi(GNODEB1 + ":1100").neighborCellNrpci(n) - .neighborCellNrcgi(GNODEB1 + ":" + n).flagNoHo(true).flagNoXn(true).flagNoRemove(true)); - String[] neighbors2 = { "1471", "1472", "1473" }; - for (String n : neighbors2) - ncrtNodeB2.addNcrtRelationsItem( - new NeighborCellRelation().servingCellNrcgi(GNODEB2 + ":1400").neighborCellNrpci(n) - .neighborCellNrcgi(GNODEB2 + ":" + n).flagNoHo(false).flagNoXn(false).flagNoRemove(false)); - String[] neighbors3 = { "3601", "3601", "3602" }; - for (String n : neighbors3) - ncrtNodeB3.addNcrtRelationsItem( - new NeighborCellRelation().servingCellNrcgi(GNODEB3 + ":3600").neighborCellNrpci(n) - .neighborCellNrcgi(GNODEB3 + ":" + n).flagNoHo(true).flagNoXn(true).flagNoRemove(true)); - for (NeighborCellRelation ncr : ncrtNodeB1.getNcrtRelations()) - ncrt.addNcrtRelationsItem(ncr); - for (NeighborCellRelation ncr : ncrtNodeB2.getNcrtRelations()) - ncrt.addNcrtRelationsItem(ncr); - for (NeighborCellRelation ncr : ncrtNodeB3.getNcrtRelations()) - ncrt.addNcrtRelationsItem(ncr); - } - - private ApiClient apiClient() { - ApiClient mockClient = mock(ApiClient.class); - when(mockClient.getStatusCode()).thenReturn(HttpStatus.OK); - return mockClient; - } - - @Bean - // Use the same name as regular configuration - public HealthApi anrHealthApi() { - ApiClient apiClient = apiClient(); - HealthApi mockApi = mock(HealthApi.class); - when(mockApi.getApiClient()).thenReturn(apiClient); - doAnswer(i -> null).when(mockApi).getHealthAlive(); - doAnswer(i -> null).when(mockApi).getHealthReady(); - return mockApi; - } - - @Bean - // Use the same name as regular configuration - public NcrtApi anrNcrtApi() { - ApiClient apiClient = apiClient(); - NcrtApi mockApi = mock(NcrtApi.class); - when(mockApi.getApiClient()).thenReturn(apiClient); - doAnswer(inv -> { - if (delayMs > 0) { - logger.debug("getgNodeB sleeping {}", delayMs); - Thread.sleep(delayMs); - } - return gNodebTable; - }).when(mockApi).getgNodeB(); - // Swagger sends nulls; front end sends empty strings - doAnswer(inv -> { - if (delayMs > 0) { - logger.debug("getNcrt (1) sleeping {}", delayMs); - Thread.sleep(delayMs); - } - return ncrt; - }).when(mockApi).getNcrt((String) isNull(), (String) isNull(), (String) isNull()); - doAnswer(inv -> { - if (delayMs > 0) { - logger.debug("getNcrt (2) sleeping {}", delayMs); - Thread.sleep(delayMs); - } - return ncrt; - }).when(mockApi).getNcrt(eq(""), any(String.class), any(String.class)); - doAnswer(inv -> { - if (delayMs > 0) { - logger.debug("getNcrt (3) sleeping {}", delayMs); - Thread.sleep(delayMs); - } - return ncrtNodeB1; - }).when(mockApi).getNcrt(eq(GNODEB1), any(String.class), any(String.class)); - doAnswer(inv -> { - if (delayMs > 0) { - logger.debug("getNcrt (4) sleeping {}", delayMs); - Thread.sleep(delayMs); - } - return ncrtNodeB2; - }).when(mockApi).getNcrt(eq(GNODEB2), any(String.class), any(String.class)); - doAnswer(inv -> { - if (delayMs > 0) { - logger.debug("getNcrt (5) sleeping {}", delayMs); - Thread.sleep(delayMs); - } - return ncrtNodeB3; - }).when(mockApi).getNcrt(eq(GNODEB3), any(String.class), any(String.class)); - doAnswer(inv -> { - if (delayMs > 0) { - logger.debug("deleteNcrt sleeping {}", delayMs); - Thread.sleep(delayMs); - } - String servCellNrcgi = inv.getArgument(0); - String neighCellNrpci = inv.getArgument(1); - for (NeighborCellRelation ncr : ncrt.getNcrtRelations()) { - if (servCellNrcgi.equals(ncr.getServingCellNrcgi()) - && neighCellNrpci.equals(ncr.getNeighborCellNrpci())) { - logger.debug("deleteNcrt: removing {}", ncr); - ncrt.getNcrtRelations().remove(ncr); - break; - } - } - return null; - }).when(mockApi).deleteNcrt(any(String.class), any(String.class)); - doAnswer(inv -> { - if (delayMs > 0) { - logger.debug("modifyNcrt sleeping {}", delayMs); - Thread.sleep(delayMs); - } - String servCellNrcgi = inv.getArgument(0); - String neighCellNrpci = inv.getArgument(1); - NeighborCellRelationMod mod = inv.getArgument(2); - for (NeighborCellRelation ncr : ncrt.getNcrtRelations()) { - if (servCellNrcgi.equals(ncr.getServingCellNrcgi()) - && neighCellNrpci.equals(ncr.getNeighborCellNrpci())) { - logger.debug("modifyNcrt: modifying {} to {}", ncr, mod); - ncr.setFlagNoHo(mod.isFlagNoHo()); - ncr.setFlagNoRemove(mod.isFlagNoRemove()); - ncr.setFlagNoXn(mod.isFlagNoXn()); - break; - } - } - return null; - }).when(mockApi).modifyNcrt(any(String.class), any(String.class), any(NeighborCellRelationMod.class)); - return mockApi; - } - -} diff --git a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/AppManagerMockConfiguration.java b/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/AppManagerMockConfiguration.java index 09a9d098..ba84fd4f 100644 --- a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/AppManagerMockConfiguration.java +++ b/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/config/AppManagerMockConfiguration.java @@ -69,7 +69,7 @@ public class AppManagerMockConfiguration { public AppManagerMockConfiguration() { logger.info("Configuring mock xApp Manager"); - final String[] appNames = { "AdmissionControl", "Automatic Neighbor Relation", "UE Event Collector" }; + final String[] appNames = { "AdmissionControl", "UE Event Collector" }; final String configJson = " { \"config\" : \"example\" }"; final String descriptorJson = " { \"descriptor\" : \"example\" }"; allXappConfigs = new AllXappConfig(); diff --git a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/controller/AnrXappControllerTest.java b/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/controller/AnrXappControllerTest.java deleted file mode 100644 index e0bfde38..00000000 --- a/webapp-backend/src/test/java/org/oransc/ric/portal/dashboard/controller/AnrXappControllerTest.java +++ /dev/null @@ -1,103 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ -package org.oransc.ric.portal.dashboard.controller; - -import java.lang.invoke.MethodHandles; -import java.net.URI; - -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.Test; -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.model.SuccessTransport; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.http.HttpEntity; -import org.springframework.http.HttpMethod; -import org.springframework.http.ResponseEntity; - -public class AnrXappControllerTest extends AbstractControllerTest { - - private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - - @Test - public void versionTest() { - URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.VERSION_METHOD); - logger.info("Invoking {}", uri); - SuccessTransport st = restTemplate.getForObject(uri, SuccessTransport.class); - Assertions.assertFalse(st.getData().toString().isEmpty()); - } - - @Test - public void healthAliveTest() { - URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.HEALTH_ALIVE_METHOD); - logger.info("Invoking {}", uri); - ResponseEntity voidResponse = restTemplate.getForEntity(uri, Void.class); - Assertions.assertTrue(voidResponse.getStatusCode().is2xxSuccessful()); - } - - @Test - public void healthReadyTest() { - URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.HEALTH_READY_METHOD); - logger.info("Invoking {}", uri); - ResponseEntity voidResponse = restTemplate.getForEntity(uri, Void.class); - Assertions.assertTrue(voidResponse.getStatusCode().is2xxSuccessful()); - } - - @Test - public void gnodebsTest() { - URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.GNODEBS_METHOD); - logger.info("Invoking {}", uri); - GgNodeBTable list = testRestTemplateStandardRole().getForObject(uri, GgNodeBTable.class); - Assertions.assertFalse(list.getGNodeBIds().isEmpty()); - } - - @Test - public void ncrtGetTest() { - URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.NCRT_METHOD); - logger.info("Invoking {}", uri); - NeighborCellRelationTable table = testRestTemplateStandardRole().getForObject(uri, - NeighborCellRelationTable.class); - Assertions.assertFalse(table.getNcrtRelations().isEmpty()); - } - - @Test - public void ncrtPutTest() { - URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.NCRT_METHOD, - AnrXappController.PP_SERVING, "serving", AnrXappController.PP_NEIGHBOR, "neighbor"); - logger.info("Invoking {}", uri); - HttpEntity entity = new HttpEntity<>(new NeighborCellRelationMod()); - ResponseEntity voidResponse = testRestTemplateAdminRole().exchange(uri, HttpMethod.PUT, entity, - Void.class); - Assertions.assertTrue(voidResponse.getStatusCode().is2xxSuccessful()); - } - - @Test - public void ncrtDeleteTest() { - URI uri = buildUri(null, AnrXappController.CONTROLLER_PATH, AnrXappController.NCRT_METHOD, - AnrXappController.PP_SERVING, "serving", AnrXappController.PP_NEIGHBOR, "neighbor"); - logger.info("Invoking {}", uri); - ResponseEntity voidResponse = testRestTemplateAdminRole().exchange(uri, HttpMethod.DELETE, null, - Void.class); - Assertions.assertTrue(voidResponse.getStatusCode().is2xxSuccessful()); - } - -} diff --git a/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.html b/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.html deleted file mode 100644 index d4b35c5c..00000000 --- a/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.html +++ /dev/null @@ -1,53 +0,0 @@ - - -
- Edit Neighbor Cell Relation -
- -
-
- - - - - - - - - Example: A12345 - Neighbor cell identifier is required - Valid NRCGI is required - -
- Flag No Handover -
-
- Flag No Xn -
-
- Flag No Remove -
-
- -
diff --git a/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.scss b/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.scss deleted file mode 100644 index 9171531e..00000000 --- a/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.scss +++ /dev/null @@ -1,24 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ - - /* used to place form fields on separate lines/rows in dialog */ -.input-display-block { - display: block; -} diff --git a/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.ts b/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.ts deleted file mode 100644 index 9987ac33..00000000 --- a/webapp-frontend/src/app/anr-xapp/anr-edit-ncr-dialog.component.ts +++ /dev/null @@ -1,93 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ -import { Component, OnInit, Inject } from '@angular/core'; -import { FormGroup, FormControl, Validators } from '@angular/forms'; -import { MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; -import { ANRXappService } from '../services/anr-xapp/anr-xapp.service'; -import { ErrorDialogService } from '../services/ui/error-dialog.service'; -import { ANRNeighborCellRelation, ANRNeighborCellRelationMod } from '../interfaces/anr-xapp.types'; - -@Component({ - selector: 'rd-ncr-edit-dialog', - templateUrl: './anr-edit-ncr-dialog.component.html', - styleUrls: ['./anr-edit-ncr-dialog.component.scss'] -}) - -export class AnrEditNcrDialogComponent implements OnInit { - - private ncrDialogForm: FormGroup; - - constructor( - private dialogRef: MatDialogRef, - private dataService: ANRXappService, - private errorService: ErrorDialogService, - @Inject(MAT_DIALOG_DATA) private data: ANRNeighborCellRelation) { } - - ngOnInit() { - this.ncrDialogForm = new FormGroup({ - servingCellNrcgi: new FormControl(this.data.servingCellNrcgi), // readonly - neighborCellNrpci: new FormControl(this.data.neighborCellNrpci), // readonly - neighborCellNrcgi: new FormControl(this.data.neighborCellNrcgi, [Validators.required]), - flagNoHo: new FormControl(this.data.flagNoHo), - flagNoXn: new FormControl(this.data.flagNoXn), - flagNoRemove: new FormControl(this.data.flagNoRemove) - }); - } - - onCancel() { - this.dialogRef.close(); - } - - modifyNcr = (ncrFormValue: ANRNeighborCellRelation) => { - if (this.ncrDialogForm.valid) { - const ncrm = {} as ANRNeighborCellRelationMod; - // there must be a better way to build the struct - ncrm.neighborCellNrcgi = ncrFormValue.neighborCellNrcgi; - ncrm.neighborCellNrpci = ncrFormValue.neighborCellNrpci; - ncrm.flagNoHo = ncrFormValue.flagNoHo; - ncrm.flagNoXn = ncrFormValue.flagNoXn; - ncrm.flagNoRemove = ncrFormValue.flagNoRemove; - this.dataService.modifyNcr(ncrFormValue.servingCellNrcgi, ncrFormValue.neighborCellNrpci, ncrm).subscribe( - (val: any[]) => { - // Success - }, - (error => { - this.errorService.displayError('NCR update failed: ' + error.message); - }) - ); - this.dialogRef.close(); - } - } - - hasError(controlName: string, errorName: string) { - if (this.ncrDialogForm.controls[controlName].hasError(errorName)) { - return true; - } - return false; - } - - validateControl(controlName: string) { - if (this.ncrDialogForm.controls[controlName].invalid && this.ncrDialogForm.controls[controlName].touched) { - return true; - } - return false; - } - -} diff --git a/webapp-frontend/src/app/anr-xapp/anr-xapp.component.html b/webapp-frontend/src/app/anr-xapp/anr-xapp.component.html deleted file mode 100644 index 9bf24a0d..00000000 --- a/webapp-frontend/src/app/anr-xapp/anr-xapp.component.html +++ /dev/null @@ -1,96 +0,0 @@ - -
-

ANR xApp Neighbor Cell Relation Table

- - - GgNodeB - - - - - - - - - - - - - - Serving Cell NRCGI - {{ncr.servingCellNrcgi}} - - - - Neighbor Cell NRPCI - {{ncr.neighborCellNrpci}} - - - - Neighbor Cell NRCGI - {{ncr.neighborCellNrcgi}} - - - - Flag No Handover - {{ncr.flagNoHo}} - - - - Flag No Xn - {{ncr.flagNoXn}} - - - - Flag No Remove - {{ncr.flagNoRemove}} - - - - Action - - - - - - - - No records found. - - - - - - -
- -
- -
- -
diff --git a/webapp-frontend/src/app/anr-xapp/anr-xapp.component.scss b/webapp-frontend/src/app/anr-xapp/anr-xapp.component.scss deleted file mode 100644 index 2307f8c5..00000000 --- a/webapp-frontend/src/app/anr-xapp/anr-xapp.component.scss +++ /dev/null @@ -1,77 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ - .anr__section { -} - -.spinner-container { - height: 100px; - width: 100px; - } - -.spinner-container mat-spinner { - margin: 130px auto 0 auto; -} - -.input-pad-left { - padding-left: 10px; -} - -.input-width { - min-width: 250px; -} - -.ncr-table { - width: 99%; /* 100% triggers horiz scroll bar */ - min-height: 150px; - margin-top: 10px; - background-color:transparent; -} - -.ncr-table__bg-dark { - color: white; -} - -/* column classes are magically defined by Angular */ -.mat-column-neighborCellNrpci { - max-width: 150px; -} -.mat-column-flagNoHo { - max-width: 75px; -} -.mat-column-flagNoXn { - max-width: 75px; -} -.mat-column-flagNoRemove { - max-width: 75px; -} -.mat-column-action { - max-width: 85px; -} - -.version__text { - color: gray; - letter-spacing: 0.1rem; - font-size: 10px; -} - -.display-none { - display: none; - } - \ No newline at end of file diff --git a/webapp-frontend/src/app/anr-xapp/anr-xapp.component.spec.ts b/webapp-frontend/src/app/anr-xapp/anr-xapp.component.spec.ts deleted file mode 100644 index 49c60b7a..00000000 --- a/webapp-frontend/src/app/anr-xapp/anr-xapp.component.spec.ts +++ /dev/null @@ -1,44 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ -import { async, ComponentFixture, TestBed } from '@angular/core/testing'; - -import { AnrXappComponent } from './anr-xapp.component'; - -describe('AnrXappComponent', () => { - let component: AnrXappComponent; - let fixture: ComponentFixture; - - beforeEach(async(() => { - TestBed.configureTestingModule({ - declarations: [ AnrXappComponent ] - }) - .compileComponents(); - })); - - beforeEach(() => { - fixture = TestBed.createComponent(AnrXappComponent); - component = fixture.componentInstance; - fixture.detectChanges(); - }); - - it('should create', () => { - expect(component).toBeTruthy(); - }); -}); diff --git a/webapp-frontend/src/app/anr-xapp/anr-xapp.component.ts b/webapp-frontend/src/app/anr-xapp/anr-xapp.component.ts deleted file mode 100644 index 98728b21..00000000 --- a/webapp-frontend/src/app/anr-xapp/anr-xapp.component.ts +++ /dev/null @@ -1,151 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ - -import { HttpErrorResponse, HttpResponse } from '@angular/common/http'; -import { AfterViewInit, Component, ElementRef, OnInit, ViewChild } from '@angular/core'; -import { MatSort } from '@angular/material/sort'; -import { MatDialog } from '@angular/material/dialog'; -import { fromEvent } from 'rxjs/observable/fromEvent'; -import { debounceTime, distinctUntilChanged, finalize, tap } from 'rxjs/operators'; -import { ANRNeighborCellRelation } from '../interfaces/anr-xapp.types'; -import { ANRXappService } from '../services/anr-xapp/anr-xapp.service'; -import { ErrorDialogService } from '../services/ui/error-dialog.service'; -import { LoadingDialogService } from '../services/ui/loading-dialog.service'; -import { ConfirmDialogService } from './../services/ui/confirm-dialog.service'; -import { NotificationService } from './../services/ui/notification.service'; -import { AnrEditNcrDialogComponent } from './anr-edit-ncr-dialog.component'; -import { ANRXappDataSource } from './anr-xapp.datasource'; -import { UiService } from '../services/ui/ui.service'; - -@Component({ - selector: 'rd-anr', - templateUrl: './anr-xapp.component.html', - styleUrls: ['./anr-xapp.component.scss'] -}) -export class AnrXappComponent implements AfterViewInit, OnInit { - - darkMode: boolean; - panelClass: string = ""; - dataSource: ANRXappDataSource; - gNodeBIds: string[]; - @ViewChild('ggNodeB', { static: true }) ggNodeB: ElementRef; - @ViewChild('servingCellNrcgi', { static: true }) servingCellNrcgi: ElementRef; - @ViewChild('neighborCellNrpci', { static: true }) neighborCellNrpci: ElementRef; - @ViewChild(MatSort, { static: true }) sort: MatSort; - - displayedColumns = ['cellIdentifierNrcgi', 'neighborCellNrpci', 'neighborCellNrcgi', - 'flagNoHo', 'flagNoXn', 'flagNoRemove', 'action']; - - constructor( - private anrXappService: ANRXappService, - private dialog: MatDialog, - private confirmDialogService: ConfirmDialogService, - private errorDialogService: ErrorDialogService, - private loadingDialogService: LoadingDialogService, - private notificationService: NotificationService, - public ui: UiService) { } - - ngOnInit() { - this.dataSource = new ANRXappDataSource(this.anrXappService, this.sort, this.notificationService); - this.dataSource.loadTable(); - // Empty string occurs first in the array of gNodeBIds - this.anrXappService.getgNodeBs().subscribe((res: string[]) => this.gNodeBIds = res); - this.ui.darkModeState.subscribe((isDark) => { - this.darkMode = isDark; - }); - } - - ngAfterViewInit() { - // the selector event calls loadNcrtPage() directly. - fromEvent(this.servingCellNrcgi.nativeElement, 'keyup') - .pipe( - debounceTime(150), - distinctUntilChanged(), - tap(() => { - this.loadNcrtPage(); - }) - ) - .subscribe(); - fromEvent(this.neighborCellNrpci.nativeElement, 'keyup') - .pipe( - debounceTime(150), - distinctUntilChanged(), - tap(() => { - this.loadNcrtPage(); - }) - ) - .subscribe(); - } - - loadNcrtPage() { - this.dataSource.loadTable( - this.ggNodeB.nativeElement.value, - this.servingCellNrcgi.nativeElement.value, - this.neighborCellNrpci.nativeElement.value); - } - - modifyNcr(ncr: ANRNeighborCellRelation): void { - if (this.darkMode) { - this.panelClass = "dark-theme"; - } else { - this.panelClass = ""; - } - const dialogRef = this.dialog.open(AnrEditNcrDialogComponent, { - panelClass: this.panelClass, - width: '300px', - data: ncr - }); - dialogRef.afterClosed().subscribe( - (result: any) => { - this.loadNcrtPage(); - } - ); - } - - deleteNcr(ncr: ANRNeighborCellRelation): void { - this.confirmDialogService - .openConfirmDialog('Are you sure you want to delete this relation?') - .afterClosed().subscribe( - (res: any) => { - if (res) { - this.loadingDialogService.startLoading("Deleting"); - this.anrXappService.deleteNcr(ncr.servingCellNrcgi, ncr.neighborCellNrpci) - .pipe( - finalize(() => this.loadingDialogService.stopLoading()) - ) - .subscribe( - (response: HttpResponse) => { - switch (response.status) { - case 200: - this.notificationService.success('Delete succeeded!'); - this.loadNcrtPage(); - break; - default: - this.notificationService.warn('Delete failed.'); - } - }, - (error: HttpErrorResponse) => { - this.errorDialogService.displayError(error.message); - }); - } - }); - } - -} diff --git a/webapp-frontend/src/app/anr-xapp/anr-xapp.datasource.ts b/webapp-frontend/src/app/anr-xapp/anr-xapp.datasource.ts deleted file mode 100644 index b31ad03e..00000000 --- a/webapp-frontend/src/app/anr-xapp/anr-xapp.datasource.ts +++ /dev/null @@ -1,102 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ - -import { CollectionViewer, DataSource } from '@angular/cdk/collections'; -import { HttpErrorResponse } from '@angular/common/http'; -import { MatSort } from '@angular/material/sort'; -import { Observable } from 'rxjs/Observable'; -import { BehaviorSubject } from 'rxjs/BehaviorSubject'; -import { of } from 'rxjs/observable/of'; -import { merge } from 'rxjs'; -import { catchError, finalize, map } from 'rxjs/operators'; -import { ANRNeighborCellRelation } from '../interfaces/anr-xapp.types'; -import { ANRXappService } from '../services/anr-xapp/anr-xapp.service'; -import { NotificationService } from '../services/ui/notification.service'; - -export class ANRXappDataSource extends DataSource { - - private relationsSubject = new BehaviorSubject([]); - - private loadingSubject = new BehaviorSubject(false); - - public loading$ = this.loadingSubject.asObservable(); - - public rowCount = 1; // hide footer during intial load - - constructor(private anrXappService: ANRXappService, - private sort: MatSort, - private notificationService: NotificationService) { - super(); - } - - loadTable(ggnodeb: string = '', servingCellNrcgi: string = '', neighborCellNrpci: string = '') { - this.loadingSubject.next(true); - this.anrXappService.getNcrtInfo(ggnodeb, servingCellNrcgi, neighborCellNrpci) - .pipe( - catchError( (her: HttpErrorResponse) => { - console.log('ANRXappDataSource failed: ' + her.message); - this.notificationService.error('Failed to get data: ' + her.message); - return of([]); - }), - finalize(() => this.loadingSubject.next(false)) - ) - .subscribe( (ncrt: ANRNeighborCellRelation[]) => { - this.rowCount = ncrt.length; - this.relationsSubject.next(ncrt); - }); - } - - connect(collectionViewer: CollectionViewer): Observable { - const dataMutations = [ - this.relationsSubject.asObservable(), - this.sort.sortChange - ]; - return merge(...dataMutations).pipe(map(() => { - return this.getSortedData([...this.relationsSubject.getValue()]); - })); - } - - disconnect(collectionViewer: CollectionViewer): void { - this.relationsSubject.complete(); - this.loadingSubject.complete(); - } - - private getSortedData(data: ANRNeighborCellRelation[]) { - if (!this.sort.active || this.sort.direction === '') { - return data; - } - return data.sort((a: ANRNeighborCellRelation, b: ANRNeighborCellRelation) => { - const isAsc = this.sort.direction === 'asc'; - switch (this.sort.active) { - case 'cellIdentifierNrcgi': return compare(a.servingCellNrcgi, b.servingCellNrcgi, isAsc); - case 'neighborCellNrpci': return compare(a.neighborCellNrpci, b.neighborCellNrpci, isAsc); - case 'neighborCellNrcgi': return compare(a.neighborCellNrcgi, b.neighborCellNrcgi, isAsc); - case 'flagNoHo': return compare(a.flagNoHo, b.flagNoHo, isAsc); - case 'flagNoXn': return compare(a.flagNoXn, b.flagNoXn, isAsc); - case 'flagNoRemove': return compare(a.flagNoRemove, b.flagNoRemove, isAsc); - default: return 0; - } - }); - } -} - -function compare(a: any, b: any, isAsc: boolean) { - return (a < b ? -1 : 1) * (isAsc ? 1 : -1); -} diff --git a/webapp-frontend/src/app/app-control/app-control.component.ts b/webapp-frontend/src/app/app-control/app-control.component.ts index 07b931d9..c97a1950 100644 --- a/webapp-frontend/src/app/app-control/app-control.component.ts +++ b/webapp-frontend/src/app/app-control/app-control.component.ts @@ -60,14 +60,9 @@ export class AppControlComponent implements OnInit { // TODO: identify apps without hardcoding to names const acAppPattern0 = /[Aa][Dd][Mm][Ii][Nn]/; const acAppPattern1 = /[Aa][Dd][Mm][Ii][Ss]{2}[Ii][Oo][Nn]/; - const anrAppPattern0 = /ANR/; - const anrAppPattern1 = /[Aa][Uu][Tt][Oo][Mm][Aa][Tt][Ii][Cc]/; - const anrAppPattern2 = /[Nn][Ee][Ii][Gg][Hh][Bb][Oo][Rr]/; if (acAppPattern0.test(app.xapp) || acAppPattern1.test(app.xapp)) { this.router.navigate(['/ac']); - } else if (anrAppPattern0.test(app.xapp) || (anrAppPattern1.test(app.xapp) && anrAppPattern2.test(app.xapp))) { - this.router.navigate(['/anr']); - } else { + } else { this.errorDialogService.displayError('No control available for ' + app.xapp + ' (yet)'); } } diff --git a/webapp-frontend/src/app/rd-routing.module.ts b/webapp-frontend/src/app/rd-routing.module.ts index b82f53dc..af8ec2e4 100644 --- a/webapp-frontend/src/app/rd-routing.module.ts +++ b/webapp-frontend/src/app/rd-routing.module.ts @@ -22,7 +22,6 @@ import { CommonModule } from '@angular/common'; import { Routes, RouterModule } from '@angular/router'; import { AcXappComponent } from './ac-xapp/ac-xapp.component'; -import { AnrXappComponent } from './anr-xapp/anr-xapp.component'; import { CatalogComponent } from './catalog/catalog.component'; import { ControlComponent } from './control/control.component'; import { MainComponent } from './main/main.component'; @@ -35,7 +34,6 @@ const routes: Routes = [ {path: 'catalog', component: CatalogComponent}, {path: 'control', component: ControlComponent}, {path: 'ac', component: AcXappComponent}, - {path: 'anr', component: AnrXappComponent}, {path: 'stats', component: StatsComponent}, {path: 'platform', component: PlatformComponent}, {path: 'user', component: UserComponent}, diff --git a/webapp-frontend/src/app/rd.module.ts b/webapp-frontend/src/app/rd.module.ts index e5337019..440184f8 100644 --- a/webapp-frontend/src/app/rd.module.ts +++ b/webapp-frontend/src/app/rd.module.ts @@ -50,8 +50,6 @@ import { FormsModule, ReactiveFormsModule } from '@angular/forms'; import { ToastrModule } from 'ngx-toastr'; import { AcXappComponent } from './ac-xapp/ac-xapp.component'; import { AddDashboardUserDialogComponent } from './user/add-dashboard-user-dialog/add-dashboard-user-dialog.component'; -import { AnrEditNcrDialogComponent } from './anr-xapp/anr-edit-ncr-dialog.component'; -import { AnrXappComponent } from './anr-xapp/anr-xapp.component'; import { AppConfigurationComponent } from './app-configuration/app-configuration.component'; import { AppControlComponent } from './app-control/app-control.component'; import { AppMgrService } from './services/app-mgr/app-mgr.service'; @@ -86,8 +84,6 @@ import { UserComponent } from './user/user.component'; declarations: [ AcXappComponent, AddDashboardUserDialogComponent, - AnrEditNcrDialogComponent, - AnrXappComponent, AppConfigurationComponent, AppControlComponent, CaasIngressComponent, @@ -167,7 +163,6 @@ import { UserComponent } from './user/user.component'; ], entryComponents: [ AddDashboardUserDialogComponent, - AnrEditNcrDialogComponent, AppConfigurationComponent, ConfirmDialogComponent, EditDashboardUserDialogComponent, diff --git a/webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.spec.ts b/webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.spec.ts deleted file mode 100644 index c47dcd8e..00000000 --- a/webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.spec.ts +++ /dev/null @@ -1,32 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ - - import { TestBed } from '@angular/core/testing'; - -import { ANRXappService } from './anr-xapp.service'; - -describe('ANRXappService', () => { - beforeEach(() => TestBed.configureTestingModule({})); - - it('should be created', () => { - const service: ANRXappService = TestBed.get(ANRXappService); - expect(service).toBeTruthy(); - }); -}); diff --git a/webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.ts b/webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.ts deleted file mode 100644 index e06b7081..00000000 --- a/webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.ts +++ /dev/null @@ -1,136 +0,0 @@ -/*- - * ========================LICENSE_START================================= - * O-RAN-SC - * %% - * Copyright (C) 2019 AT&T Intellectual Property - * %% - * 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. - * ========================LICENSE_END=================================== - */ - -import { Injectable } from '@angular/core'; -import { HttpClient, HttpParams } from '@angular/common/http'; -import { Observable } from 'rxjs'; -import { map } from 'rxjs/operators'; -import { DashboardSuccessTransport } from '../../interfaces/dashboard.types'; -import { ANRNeighborCellRelation, ANRNeighborCellRelationMod } from '../../interfaces/anr-xapp.types'; - -@Injectable({ - providedIn: 'root' -}) -export class ANRXappService { - - // Trailing slashes are confusing so omit them here - private basePath = 'api/xapp/anr'; - private ncrtPath = 'ncrt'; - private servingPath = 'servingcells'; - private neighborPath = 'neighborcells'; - - constructor(private httpClient: HttpClient) { - // injects to variable httpClient - } - - private buildPath(...args: any[]) { - let result = this.basePath; - args.forEach(part => { - result = result + '/' + part; - }); - return result; - } - - /** - * Gets ANR xApp client version details - * @returns Observable that should yield a String - */ - getVersion(): Observable { - const url = this.buildPath('version'); - return this.httpClient.get(url).pipe( - // Extract the string here - map(res => res['data']) - ); - } - - /** - * Performs a liveness probe - * @returns Observable that should yield a response code (no data) - */ - getHealthAlive(): Observable { - const url = this.buildPath('health/alive'); - return this.httpClient.get(url, { observe: 'response' }); - } - - /** - * Performs a readiness probe - * @returns Observable that should yield a response code (no data) - */ - getHealthReady(): Observable { - const url = this.buildPath('health/ready'); - return this.httpClient.get(url, { observe: 'response' }); - } - -/** - * Gets array of gNodeB IDs - * @returns Observable that should yield a string array - */ - getgNodeBs(): Observable { - const url = this.buildPath('gnodebs'); - return this.httpClient.get(url).pipe( - // Extract the array of IDs here - map(res => res['gNodeBIds']) - ); - } - - /** - * Gets the neighbor cell relation table for all gNodeBs or based on query parameters - * @param ggnbId Optional parameter for the gNB ID - * @param servingCellNrcgi Serving cell NRCGI - * @param neighborCellNrpci Neighbor cell NRPCI - * @returns Observable of ANR neighbor cell relation array - */ - getNcrtInfo(ggnodeb: string = '', servingCellNrcgi: string = '', neighborCellNrpci: string = ''): Observable { - const url = this.buildPath(this.ncrtPath); - return this.httpClient.get(url, { - params: new HttpParams() - .set('ggnodeb', ggnodeb) - .set('servingCellNrcgi', servingCellNrcgi) - .set('neighborCellNrpci', neighborCellNrpci) - }).pipe( - // Extract the array of relations here - map(res => res['ncrtRelations']) - ); - } - - /** - * Modify neighbor cell relation based on Serving Cell NRCGI and Neighbor Cell NRPCI - * @param servingCellNrcgi Serving cell NRCGI - * @param neighborCellNrpci Neighbor cell NRPCI - * @param mod Values to store in the specified relation - * @returns Observable that yields a response code only, no data - */ - modifyNcr(servingCellNrcgi: string, neighborCellNrpci: string, mod: ANRNeighborCellRelationMod): Observable { - const url = this.buildPath(this.ncrtPath, this.servingPath, servingCellNrcgi, this.neighborPath, neighborCellNrpci); - return this.httpClient.put(url, mod, { observe: 'response' }); - } - - /** - * Deletes neighbor cell relation based on Serving Cell NRCGI and Neighbor Cell NRPCI - * @param servingCellNrcgi Serving cell NRCGI - * @param neighborCellNrpci Neighbor cell NRPCI - * @returns Observable that yields a response code only, no data - */ - deleteNcr(servingCellNrcgi: string, neighborCellNrpci: string): Observable { - const url = this.buildPath(this.ncrtPath, this.servingPath, servingCellNrcgi, this.neighborPath, neighborCellNrpci); - return this.httpClient.delete(url, { observe: 'response' }); - } - -} diff --git a/webapp-frontend/src/app/ui/catalog-card/catalog-card.component.html b/webapp-frontend/src/app/ui/catalog-card/catalog-card.component.html index 33098710..2587df19 100644 --- a/webapp-frontend/src/app/ui/catalog-card/catalog-card.component.html +++ b/webapp-frontend/src/app/ui/catalog-card/catalog-card.component.html @@ -26,9 +26,6 @@
check_box Admission Control
-
- settings_input_antenna ANR -
open_in_new Deploy
-- 2.16.6