2 * ========================LICENSE_START=================================
5 * Copyright (C) 2019 AT&T Intellectual Property and Nokia
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ========================LICENSE_END===================================
21 import { Injectable } from '@angular/core';
22 import { HttpClient, HttpParams } from '@angular/common/http';
23 import { Observable } from 'rxjs';
24 import { DashboardSuccessTransport } from '../../interfaces/dashboard.types';
25 import { ANRNeighborCellRelation, ANRNeighborCellRelationMod } from '../../interfaces/anr-xapp.types';
30 export class AnrXappService {
32 private basePath = 'api/xapp/anr/';
33 private cellPath = 'cell/cellIdentifier/';
35 constructor(private httpClient: HttpClient) {
36 // injects to variable httpClient
40 * Gets ANR xApp client version details
41 * @returns Observable that should yield a DashboardSuccessTransport
43 getVersion(): Observable<DashboardSuccessTransport> {
44 return this.httpClient.get<DashboardSuccessTransport>(this.basePath + 'version');
48 * Performs a liveness probe
49 * @returns Observable that should yield a response code (no data)
51 getHealthAlive(): Observable<any> {
52 return this.httpClient.get(this.basePath + 'health/alive');
56 * Performs a readiness probe
57 * @returns Observable that should yield a response code (no data)
59 getHealthReady(): Observable<any> {
60 return this.httpClient.get(this.basePath + 'health/ready');
64 * Query NCRT of all cells, all or one gNB(s)
65 * @param ggnbId Optional parameter for the gNB ID
66 * @param startIndex Optional parameter for the start index
67 * @param limit Optional parameter for the limit (page size)
68 * @returns Observable of ANRNeighborCellRelation
70 getNcrtInfo(ggnbId?: string, startIndex?: string, limit?: number): Observable<ANRNeighborCellRelation[]> {
71 const queryParams = new HttpParams();
73 queryParams.set('ggnbid', ggnbId);
76 queryParams.set('startIndex', startIndex);
79 queryParams.set('limit', limit.toString());
81 return this.httpClient.get<ANRNeighborCellRelation[]>(this.basePath + 'cell', { params: queryParams } );
85 * Query NCRT of a single serving cell, all or one gNB(s)
86 * @param cellId cell ID
87 * @param ggnbid Optional parameter for the gNB ID
88 * @param startIndex Optional parameter for the start index
89 * @param limit Optional parameter for the limit (page size)
90 * @returns Observable of ANRNeighborCellRelation
92 getCellNcrtInfo(cellId: string, ggnbId?: string, startIndex?: string, limit?: number): Observable<ANRNeighborCellRelation[]> {
93 const queryParams = new HttpParams();
95 queryParams.set('ggnbid', ggnbId);
98 queryParams.set('startIndex', startIndex);
101 queryParams.set('limit', limit.toString());
103 return this.httpClient.get<ANRNeighborCellRelation[]>(this.basePath + this.cellPath + cellId, { params: queryParams } );
107 * Modify neighbor cell relations based on Source Cell NR CGI and Target Cell NR PCI / NR CGI
108 * @param cellId cell ID
109 * @param table Array of ANRNeighborCellRelationMod
110 * @returns Observable that should yield a response code (no data)
112 modifyNcrt(cellId: string, table: ANRNeighborCellRelationMod []): Observable<any> {
113 return this.httpClient.put(this.basePath + this.cellPath + cellId, table);
116 /** TODO: deleteNcrt */