From 52d66fff0881226fe6ae0b1a2cd6c2c2e2837af4 Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Thu, 30 May 2019 09:17:43 -0400 Subject: [PATCH] Add AC xApp control screen Change-Id: I55f0cda8e9207936390aa59b0852a816cce2f2dd Signed-off-by: Lott, Christopher (cl778h) --- docs/release-notes.rst | 1 + .../dashboard/controller/AcXappController.java | 12 +-- .../dashboard/controller/AnrXappController.java | 4 +- .../src/app/ac-xapp/ac-xapp.component.html | 56 ++++++++++++++ .../src/app/ac-xapp/ac-xapp.component.scss | 49 ++++++++++++ .../src/app/ac-xapp/ac-xapp.component.spec.ts | 45 +++++++++++ .../src/app/ac-xapp/ac-xapp.component.ts | 88 ++++++++++++++++++++++ .../anr-xapp/anr-edit-ncr-dialog.component.scss | 4 +- .../app/anr-xapp/anr-edit-ncr-dialog.component.ts | 44 ++++++----- webapp-frontend/src/app/app-routing.module.ts | 2 + webapp-frontend/src/app/app.module.ts | 26 ++++--- .../src/app/control/control.component.ts | 5 +- .../app/ran-connection/ran-connection.component.ts | 9 +-- .../app/services/ac-xapp/ac-xapp.service.spec.ts | 6 +- .../src/app/services/ac-xapp/ac-xapp.service.ts | 38 +++++++--- .../app/services/anr-xapp/anr-xapp.service.spec.ts | 6 +- .../src/app/services/anr-xapp/anr-xapp.service.ts | 14 ++-- 17 files changed, 334 insertions(+), 75 deletions(-) create mode 100644 webapp-frontend/src/app/ac-xapp/ac-xapp.component.html create mode 100644 webapp-frontend/src/app/ac-xapp/ac-xapp.component.scss create mode 100644 webapp-frontend/src/app/ac-xapp/ac-xapp.component.spec.ts create mode 100644 webapp-frontend/src/app/ac-xapp/ac-xapp.component.ts diff --git a/docs/release-notes.rst b/docs/release-notes.rst index c50e4cc3..4ed30c71 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -22,6 +22,7 @@ RIC Dashboard Release Notes Version 1.0.4, 30 May 2019 -------------------------- +* Add AC xApp neighbor control screen * Add ANR xApp neighbor cell relation table * Drop the pendulum xApp control screen * Add column sorting on xApp catalog and xApp control diff --git a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AcXappController.java b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AcXappController.java index 69864d9d..37826564 100644 --- a/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AcXappController.java +++ b/webapp-backend/src/main/java/org/oransc/ric/portal/dashboard/controller/AcXappController.java @@ -44,7 +44,7 @@ import io.swagger.annotations.ApiParam; /** * Provides methods to manage policies of the Admission Control xApp, which - * initially defines just one. All requests go via the A1 Mediatior. + * initially defines just one. All requests go via the A1 Mediator. */ @RestController @RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/xapp/ac", produces = MediaType.APPLICATION_JSON_VALUE) @@ -75,18 +75,18 @@ public class AcXappController { */ @ApiOperation(value = "Gets the admission control policy for AC xApp via the A1 Mediator") @RequestMapping(value = "admctrl", method = RequestMethod.GET) - public Object getAdmissionControlPolicy() { + public Object getAdmissionControlPolicy(HttpServletResponse response) { logger.debug("getAdmissionControlPolicy"); - a1MediatorApi.a1ControllerGetHandler(AC_CONTROL_NAME); + response.setStatus(HttpServletResponse.SC_NOT_IMPLEMENTED); return null; } /* - * This controller is deliberately kept ignorant of the - * ACAdmissionIntervalControl Typescript interface. + * This controller is deliberately kept ignorant of the data expected by AC. The + * fields are defined in the ACAdmissionIntervalControl Typescript interface. */ @ApiOperation(value = "Sets the admission control policy for AC xApp via the A1 Mediator") - @RequestMapping(value = "admctrl", method = RequestMethod.PUT) + @RequestMapping(value = "catime", method = RequestMethod.PUT) public void setAdmissionControlPolicy(@ApiParam(value = "Admission control policy") @RequestBody JsonNode acPolicy, // HttpServletResponse response) { logger.debug("setAdmissionControlPolicy {}", acPolicy); 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 5b1a6e2d..dae8ae25 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 @@ -105,11 +105,11 @@ public class AnrXappController { @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( // + public NeighborCellRelationTable getNcrt( // @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, + logger.debug("getNcrt: ggnbid {}, servingCellNrpci {}, neighborCellNrcgi {}", ggnbId, servingCellNrcgi, neighborCellNrpci); return ncrtApi.getNcrt(ggnbId, servingCellNrcgi, neighborCellNrpci); } diff --git a/webapp-frontend/src/app/ac-xapp/ac-xapp.component.html b/webapp-frontend/src/app/ac-xapp/ac-xapp.component.html new file mode 100644 index 00000000..f8125f55 --- /dev/null +++ b/webapp-frontend/src/app/ac-xapp/ac-xapp.component.html @@ -0,0 +1,56 @@ + +
+

AC xApp Policy

+ +
+
+ Enforce +
+ + + Sliding window length in minutes for measurement, range 1..60. + Number is required + + Valid number is required + + + + Connections to block if above trigger threshold, range 1..100. + Number is required + + Valid number is required + + + + Number of events in window to trigger blocking, minimum 1. + Number is + required + Valid number is required + +
+ +
+
+ AC API version {{acVersion}} +
+
+ +
\ No newline at end of file diff --git a/webapp-frontend/src/app/ac-xapp/ac-xapp.component.scss b/webapp-frontend/src/app/ac-xapp/ac-xapp.component.scss new file mode 100644 index 00000000..42bf59c8 --- /dev/null +++ b/webapp-frontend/src/app/ac-xapp/ac-xapp.component.scss @@ -0,0 +1,49 @@ +/*- + * ========================LICENSE_START================================= + * O-RAN-SC + * %% + * Copyright (C) 2019 AT&T Intellectual Property and Nokia + * %% + * 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=================================== + */ + + .ac__section { + position: relative; + top: -50px; +} + +.ac__header { + text-align: center; + color: #432c85; + font-size: 50px; + font-weight: 200; + letter-spacing: .1em; + transform: translate(149 56); +} + + /* used to place form fields on separate lines/rows */ +.input-display-block { + display: block; + width: 400px; +} + +.version__text { + color: gray; + font-size: 10px; +} + +.update-button { + margin-top: 10px; + float: right; +} diff --git a/webapp-frontend/src/app/ac-xapp/ac-xapp.component.spec.ts b/webapp-frontend/src/app/ac-xapp/ac-xapp.component.spec.ts new file mode 100644 index 00000000..d42065f2 --- /dev/null +++ b/webapp-frontend/src/app/ac-xapp/ac-xapp.component.spec.ts @@ -0,0 +1,45 @@ +/*- + * ========================LICENSE_START================================= + * O-RAN-SC + * %% + * Copyright (C) 2019 AT&T Intellectual Property and Nokia + * %% + * 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 { AcXappComponent } from './ac-xapp.component'; + +describe('AcXappComponent', () => { + let component: AcXappComponent; + let fixture: ComponentFixture; + + beforeEach(async(() => { + TestBed.configureTestingModule({ + declarations: [ AcXappComponent ] + }) + .compileComponents(); + })); + + beforeEach(() => { + fixture = TestBed.createComponent(AcXappComponent); + component = fixture.componentInstance; + fixture.detectChanges(); + }); + + it('should create', () => { + expect(component).toBeTruthy(); + }); +}); diff --git a/webapp-frontend/src/app/ac-xapp/ac-xapp.component.ts b/webapp-frontend/src/app/ac-xapp/ac-xapp.component.ts new file mode 100644 index 00000000..a0b4327d --- /dev/null +++ b/webapp-frontend/src/app/ac-xapp/ac-xapp.component.ts @@ -0,0 +1,88 @@ +/*- + * ========================LICENSE_START================================= + * O-RAN-SC + * %% + * Copyright (C) 2019 AT&T Intellectual Property and Nokia + * %% + * 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 } from '@angular/core'; +import { FormGroup, FormControl, Validators } from '@angular/forms'; +import { ACAdmissionIntervalControl, ACAdmissionIntervalControlAck } from '../interfaces/ac-xapp.types'; +import { ACXappService } from '../services/ac-xapp/ac-xapp.service'; +import { ErrorDialogService } from '../services/ui/error-dialog.service'; +import { NotificationService } from './../services/ui/notification.service'; + +@Component({ + selector: 'app-ac-xapp', + templateUrl: './ac-xapp.component.html', + styleUrls: ['./ac-xapp.component.scss'] +}) +export class AcXappComponent implements OnInit { + + private acForm: FormGroup; + + // this is probably the A1 version string + acVersion: string; + + constructor( + private acXappService: ACXappService, + private errorDialogService: ErrorDialogService, + private notificationService: NotificationService) { } + + ngOnInit() { + const windowLengthPattern = /^([0-9]{1}|[1-5][0-9]{1}|60)$/; + const blockingRatePattern = /^([0-9]{1,2}|100)$/; + const triggerPattern = /^([0-9]+)$/; + // No way to fetch current settings via A1 at present + this.acForm = new FormGroup({ + enforce: new FormControl(true, [Validators.required]), + windowLength: new FormControl('', [Validators.required, Validators.pattern(windowLengthPattern)]), + blockingRate: new FormControl('', [Validators.required, Validators.pattern(blockingRatePattern)]), + triggerThreshold: new FormControl('', [Validators.required, Validators.pattern(triggerPattern)]) + }); + this.acXappService.getVersion().subscribe((res: string) => this.acVersion = res); + } + + updateAc = (acFormValue: ACAdmissionIntervalControl) => { + if (this.acForm.valid) { + this.acXappService.putPolicy(acFormValue).subscribe( + response => { + if (response.status === 200 ) { + this.notificationService.success('AC update policy succeeded!'); + } + }, + (error => { + this.errorDialogService.displayError('AC update policy failed: ' + error.message); + }) + ); + } + } + + hasError(controlName: string, errorName: string) { + if (this.acForm.controls[controlName].hasError(errorName)) { + return true; + } + return false; + } + + validateControl(controlName: string) { + if (this.acForm.controls[controlName].invalid && this.acForm.controls[controlName].touched) { + return true; + } + return false; + } + +} 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 index 400600c7..b0a8a94e 100644 --- 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 @@ -20,5 +20,5 @@ /* used to place form fields on separate lines/rows in dialog */ .input-display-block { - display: block; - } \ No newline at end of file + 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 index 2857f55d..046a624b 100644 --- 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 @@ -23,7 +23,6 @@ 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'; -import { modelGroupProvider } from '@angular/forms/src/directives/ng_model_group'; @Component({ selector: 'app-ncr-edit-dialog', @@ -37,10 +36,9 @@ export class ANREditNCRDialogComponent implements OnInit { constructor( private dialogRef: MatDialogRef, - private dataService: ANRXappService, private errorService: ErrorDialogService, - @Inject(MAT_DIALOG_DATA) private data: ANRNeighborCellRelation) { - console.log('constructed with data ' + data); - } + private dataService: ANRXappService, + private errorService: ErrorDialogService, + @Inject(MAT_DIALOG_DATA) private data: ANRNeighborCellRelation) { } ngOnInit() { const namePattern = /^([A-Z])+([0-9])+$/; @@ -59,31 +57,31 @@ export class ANREditNCRDialogComponent implements OnInit { } modifyNcr = (ncrFormValue: ANRNeighborCellRelation) => { - if (this.ncrDialogForm.valid) { - const ncrm = {} as ANRNeighborCellRelationMod; - // there must be a btter way - 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[]) => {}, - (error => { - this.errorService.displayError('NCR update failed: ' + error.message); - }) - ); - this.dialogRef.close(); - } + if (this.ncrDialogForm.valid) { + const ncrm = {} as ANRNeighborCellRelationMod; + // there must be a better way + 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[]) => { }, + (error => { + this.errorService.displayError('NCR update failed: ' + error.message); + }) + ); + this.dialogRef.close(); + } } - public hasError(controlName: string, errorName: string) { + hasError(controlName: string, errorName: string) { if (this.ncrDialogForm.controls[controlName].hasError(errorName)) { - return true; + return true; } return false; } - public validateControl(controlName: string) { + validateControl(controlName: string) { if (this.ncrDialogForm.controls[controlName].invalid && this.ncrDialogForm.controls[controlName].touched) { return true; } diff --git a/webapp-frontend/src/app/app-routing.module.ts b/webapp-frontend/src/app/app-routing.module.ts index 130703ce..10f329e2 100644 --- a/webapp-frontend/src/app/app-routing.module.ts +++ b/webapp-frontend/src/app/app-routing.module.ts @@ -26,6 +26,7 @@ import { ControlComponent } from './control/control.component'; import { RANConnectionComponent } from './ran-connection/ran-connection.component'; import { StatsComponent } from './stats/stats.component'; import { AdminComponent } from './admin/admin.component'; +import { AcXappComponent } from './ac-xapp/ac-xapp.component'; import { AnrXappComponent } from './anr-xapp/anr-xapp.component'; const routes: Routes = [ @@ -36,6 +37,7 @@ const routes: Routes = [ {path: 'ran-connection', component: RANConnectionComponent}, {path: 'stats', component: StatsComponent}, {path: 'admin', component: AdminComponent}, + {path: 'ac', component: AcXappComponent}, {path: 'anr', component: AnrXappComponent}, ]; diff --git a/webapp-frontend/src/app/app.module.ts b/webapp-frontend/src/app/app.module.ts index ab3afd0d..b170af39 100644 --- a/webapp-frontend/src/app/app.module.ts +++ b/webapp-frontend/src/app/app.module.ts @@ -61,28 +61,30 @@ import { FooterComponent } from './footer/footer.component'; import { AnrXappComponent } from './anr-xapp/anr-xapp.component'; import { ErrorDialogComponent } from './ui/error-dialog/error-dialog.component'; import { ErrorDialogService } from './services/ui/error-dialog.service'; +import { AcXappComponent } from './ac-xapp/ac-xapp.component'; @NgModule({ declarations: [ + AcXappComponent, + AdminComponent, + ANREditNCRDialogComponent, + AnrXappComponent, AppComponent, - LoginComponent, CatalogComponent, - SidenavListComponent, CatalogCardComponent, + ConfigEventComponent, + ConfirmDialogComponent, ControlCardComponent, - StatCardComponent, ControlComponent, - RANConnectionComponent, - StatsComponent, - AdminComponent, + ErrorDialogComponent, + FooterComponent, + LoginComponent, ModalEventComponent, - ConfigEventComponent, - AnrXappComponent, + RANConnectionComponent, RANConnectionDialogComponent, - ANREditNCRDialogComponent, - ConfirmDialogComponent, - FooterComponent, - ErrorDialogComponent + SidenavListComponent, + StatCardComponent, + StatsComponent ], imports: [ AppRoutingModule, diff --git a/webapp-frontend/src/app/control/control.component.ts b/webapp-frontend/src/app/control/control.component.ts index 755625c7..88359469 100644 --- a/webapp-frontend/src/app/control/control.component.ts +++ b/webapp-frontend/src/app/control/control.component.ts @@ -53,8 +53,11 @@ export class ControlComponent implements OnInit { } controlApp(app: XappControlRow): void { + const acXappPattern = /[Aa][Dd][Mm][Ii][Ss]{2}[Ii][Oo][Nn]/; const anrXappPattern = /[Aa][Nn][Rr]/; - if (anrXappPattern.test(app.xapp)) { + if (acXappPattern.test(app.xapp)) { + this.router.navigate(['/ac']); + } else if (anrXappPattern.test(app.xapp)) { this.router.navigate(['/anr']); } else { this.errorDialogService.displayError('No control available for ' + app.xapp + ' (yet)'); diff --git a/webapp-frontend/src/app/ran-connection/ran-connection.component.ts b/webapp-frontend/src/app/ran-connection/ran-connection.component.ts index ee1d4c6b..932bca6f 100644 --- a/webapp-frontend/src/app/ran-connection/ran-connection.component.ts +++ b/webapp-frontend/src/app/ran-connection/ran-connection.component.ts @@ -24,11 +24,8 @@ import { E2ManagerService } from '../services/e2-mgr/e2-mgr.service'; import { ErrorDialogService } from '../services/ui/error-dialog.service'; import { ConfirmDialogService } from './../services/ui/confirm-dialog.service'; import { NotificationService } from './../services/ui/notification.service'; -import { E2SetupRequest } from '../interfaces/e2-mgr.types'; import { RANConnectionDataSource } from './ran-connection.datasource'; import { HttpErrorResponse } from '@angular/common/http'; -import { Observable } from 'rxjs'; - @Component({ selector: 'app-ran-connection', @@ -39,8 +36,10 @@ export class RANConnectionComponent implements OnInit { displayedColumns: string[] = ['requestType', 'ranName', 'ranIp', 'ranPort', 'responseCode', 'timeStamp']; dataSource: RANConnectionDataSource; - constructor(private e2MgrSvc: E2ManagerService, private errorSvc: ErrorDialogService, - private confirmDialogService: ConfirmDialogService, private notification: NotificationService, + constructor(private e2MgrSvc: E2ManagerService, + private errorSvc: ErrorDialogService, + private confirmDialogService: ConfirmDialogService, + private notification: NotificationService, public dialog: MatDialog) { } ngOnInit() { diff --git a/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.spec.ts b/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.spec.ts index 669f261e..008538fe 100644 --- a/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.spec.ts +++ b/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.spec.ts @@ -19,13 +19,13 @@ */ import { TestBed } from '@angular/core/testing'; -import { AcXappService } from './ac-xapp.service'; +import { ACXappService } from './ac-xapp.service'; -describe('AcXappService', () => { +describe('ACXappService', () => { beforeEach(() => TestBed.configureTestingModule({})); it('should be created', () => { - const service: AcXappService = TestBed.get(AcXappService); + const service: ACXappService = TestBed.get(ACXappService); expect(service).toBeTruthy(); }); }); diff --git a/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.ts b/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.ts index 740fcbcb..907c3258 100644 --- a/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.ts +++ b/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.ts @@ -21,36 +21,52 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; import { Observable } from 'rxjs'; + import { map } from 'rxjs/operators'; import { ACAdmissionIntervalControl, ACAdmissionIntervalControlAck } from '../../interfaces/ac-xapp.types'; import { DashboardSuccessTransport } from '../../interfaces/dashboard.types'; +/** + * Services for calling the Dashboard's AC endpoints. + */ @Injectable({ providedIn: 'root' }) -export class AcXappService { +export class ACXappService { + + private basePath = 'api/xapp/ac'; - private basePath = 'api/xapp/ac/'; + private buildPath(...args: any[]) { + let result = this.basePath; + args.forEach(part => { + result = result + '/' + part; + }); + return result; + } constructor(private httpClient: HttpClient) { // injects to variable httpClient } /** - * Gets A1 Mediator client version details - * @returns Observable that should yield a SuccessTransport object + * Gets version details + * @returns Observable that should yield a String */ - getVersion() { - // Remember that AC traffic goes via A1! - return this.httpClient.get(this.basePath + 'version'); + getVersion(): Observable { + const url = this.buildPath('version'); + return this.httpClient.get(url).pipe( + // Extract the string here + map(res => res['data']) + ); } /** - * Puts control admission time parameters to AC via A1 + * Puts admission control parameters. * @param policy an instance of ACAdmissionIntervalControl - * @returns Observable that should yield an ACAdmissionIntervalControlAck + * @returns Observable that should yield a response code, no data */ - putCaTime(policy: ACAdmissionIntervalControl): Observable { - return this.httpClient.put(this.basePath + 'catime', policy); + putPolicy(policy: ACAdmissionIntervalControl): Observable { + const url = this.buildPath('catime'); + return this.httpClient.put(url, policy, { observe: 'response' }); } } 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 index a36dd8b3..ea0cb22b 100644 --- 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 @@ -20,13 +20,13 @@ import { TestBed } from '@angular/core/testing'; -import { AnrXappService } from './anr-xapp.service'; +import { ANRXappService } from './anr-xapp.service'; -describe('AnrXappService', () => { +describe('ANRXappService', () => { beforeEach(() => TestBed.configureTestingModule({})); it('should be created', () => { - const service: AnrXappService = TestBed.get(AnrXappService); + 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 index a2dfb75e..759ad7e7 100644 --- a/webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.ts +++ b/webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.ts @@ -50,7 +50,7 @@ export class ANRXappService { /** * Gets ANR xApp client version details - * @returns Observable that should yield a DashboardSuccessTransport + * @returns Observable that should yield a String */ getVersion(): Observable { const url = this.buildPath('version'); @@ -66,7 +66,7 @@ export class ANRXappService { */ getHealthAlive(): Observable { const url = this.buildPath('health/alive'); - return this.httpClient.get(url); + return this.httpClient.get(url, { observe: 'response' }); } /** @@ -75,13 +75,13 @@ export class ANRXappService { */ getHealthReady(): Observable { const url = this.buildPath('health/ready'); - return this.httpClient.get(url); + return this.httpClient.get(url, { observe: 'response' }); } - /** - * Gets ANR xApp client version details - * @returns Observable that should yield a DashboardSuccessTransport - */ +/** + * 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( -- 2.16.6