From 21f98d01948dabb1d6a89b60f5694969e42c9e63 Mon Sep 17 00:00:00 2001 From: "Lott, Christopher (cl778h)" Date: Fri, 17 May 2019 05:46:29 -0400 Subject: [PATCH] Add AC and ANR services Rename services to reflect the corresponding endpoints. Clean many minor code issues identified by TS-Lint. Change-Id: I4efb1142048d18706e10ff4af44cf524517ae0f9 Signed-off-by: Lott, Christopher (cl778h) --- docs/release-notes.rst | 2 + .../dashboard/controller/AcXappController.java | 41 +++--- .../dashboard/controller/AnrXappController.java | 10 +- webapp-frontend/.gitignore | 2 +- webapp-frontend/src/app/admin/admin.component.html | 2 +- webapp-frontend/src/app/admin/admin.component.ts | 4 +- .../src/app/anr-xapp/anr-xapp.component.html | 26 ++++ .../src/app/anr-xapp/anr-xapp.component.scss | 40 ++++++ .../src/app/anr-xapp/anr-xapp.component.spec.ts | 25 ++++ .../src/app/anr-xapp/anr-xapp.component.ts | 15 +++ webapp-frontend/src/app/app-routing.module.ts | 4 +- webapp-frontend/src/app/app.component.ts | 4 +- webapp-frontend/src/app/app.module.ts | 26 ++-- .../src/app/footer/footer.component.spec.ts | 4 +- webapp-frontend/src/app/footer/footer.component.ts | 19 ++- .../src/app/interfaces/ac-xapp.types.ts | 4 +- .../src/app/interfaces/anr-xapp.types.ts | 4 +- .../src/app/interfaces/dashboard.types.ts | 4 +- webapp-frontend/src/app/interfaces/e2-mgr.types.ts | 4 +- .../src/app/interfaces/xapp-mgr.types.ts | 4 +- .../sidenav-list/sidenav-list.component.ts | 4 +- .../app/services/ac-xapp/ac-xapp.service.spec.ts | 12 ++ .../src/app/services/ac-xapp/ac-xapp.service.ts | 56 ++++++++ .../src/app/services/admin/admin.service.spec.ts | 5 +- .../app/services/anr-xapp/anr-xapp.service.spec.ts | 32 +++++ .../src/app/services/anr-xapp/anr-xapp.service.ts | 118 +++++++++++++++++ .../src/app/services/catalog/catalog.service.ts | 10 +- .../src/app/services/control/control.service.ts | 21 ++- .../dashboard.service.spec.ts} | 10 +- .../dashboard.service.ts} | 38 ++++-- .../e2-mgr.service.spec.ts} | 10 +- .../src/app/services/e2-mgr/e2-mgr.service.ts | 65 +++++++++ .../src/app/services/stats/stats.service.ts | 51 ++++--- .../src/app/services/ui/confirm-dialog.service.ts | 8 +- .../app/services/ui/notification.service.spec.ts | 4 +- .../src/app/services/ui/notification.service.ts | 12 +- .../src/app/services/ui/ui.service.spec.ts | 4 +- webapp-frontend/src/app/services/ui/ui.service.ts | 4 +- .../src/app/services/version/version.service.ts | 73 ----------- .../signal/signal.component.ranconnect-dialog.html | 4 +- webapp-frontend/src/app/signal/signal.component.ts | 146 ++++++++++----------- webapp-frontend/src/app/xapp/xapp.component.ts | 4 +- 42 files changed, 638 insertions(+), 297 deletions(-) create mode 100644 webapp-frontend/src/app/anr-xapp/anr-xapp.component.html create mode 100644 webapp-frontend/src/app/anr-xapp/anr-xapp.component.scss create mode 100644 webapp-frontend/src/app/anr-xapp/anr-xapp.component.spec.ts create mode 100644 webapp-frontend/src/app/anr-xapp/anr-xapp.component.ts create mode 100644 webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.spec.ts create mode 100644 webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.ts create mode 100644 webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.spec.ts create mode 100644 webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.ts rename webapp-frontend/src/app/services/{version/version.service.spec.ts => dashboard/dashboard.service.spec.ts} (85%) rename webapp-frontend/src/app/services/{signal/signal.service.ts => dashboard/dashboard.service.ts} (63%) rename webapp-frontend/src/app/services/{signal/signal.service.spec.ts => e2-mgr/e2-mgr.service.spec.ts} (88%) create mode 100644 webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts delete mode 100644 webapp-frontend/src/app/services/version/version.service.ts diff --git a/docs/release-notes.rst b/docs/release-notes.rst index fa2b4601..30e4da9d 100644 --- a/docs/release-notes.rst +++ b/docs/release-notes.rst @@ -27,6 +27,8 @@ Version 1.0.3, 20 May 2019 * Update ANR xApp client to spec version 0.0.5 * Add get-version methods to all controllers * Add simple page footer with copyright and version +* Add AC and ANR xApp services +* Rename signal service to E2 Manager service Version 1.0.2, 13 May 2019 -------------------------- 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 859efb8d..87a783cb 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 @@ -32,7 +32,6 @@ import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.MediaType; import org.springframework.util.Assert; -import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; @@ -44,8 +43,8 @@ import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiParam; /** - * Provides methods to manage policies of the Admission Control xApp. All - * messages go via the A1 Mediatior. + * Provides methods to manage policies of the Admission Control xApp, which + * initially defines just one. All requests go via the A1 Mediatior. */ @RestController @RequestMapping(value = DashboardConstants.ENDPOINT_PREFIX + "/xapp/ac", produces = MediaType.APPLICATION_JSON_VALUE) @@ -53,7 +52,7 @@ public class AcXappController { private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass()); - private static final String POLICY_NAME = "policyname"; + private static final String POLICY_CONTROL_ADMISSION_TIME = "control_admission_time"; // Populated by the autowired constructor private final A1MediatorApi a1MediatorApi; @@ -71,21 +70,29 @@ public class AcXappController { return new SuccessTransport(200, DashboardApplication.getImplementationVersion(A1MediatorApi.class)); } - @ApiOperation(value = "Gets the named policy for AC xApp via the A1 Mediator") - @RequestMapping(value = "policy/{" + POLICY_NAME + "}", method = RequestMethod.GET) - public Object getPolicy(@PathVariable(POLICY_NAME) String policyName) { - logger.debug("getPolicy: policy {}", policyName); - a1MediatorApi.a1ControllerGetHandler(policyName); - return null; - } + /* + * GET policy is not supported at present by A1 Mediator. Keeping this hidden + * until that changes. + * + * @ApiOperation(value = + * "Gets the named policy for AC xApp via the A1 Mediator") + * + * @RequestMapping(value = "policy/{" + POLICY_NAME + "}", method = + * RequestMethod.GET) public Object getPolicy(@PathVariable(POLICY_NAME) String + * policyName) { logger.debug("getPolicy: policy {}", policyName); + * a1MediatorApi.a1ControllerGetHandler(policyName); return null; } + */ - @ApiOperation(value = "Sets the named policy for AC xApp via the A1 Mediator") - @RequestMapping(value = "policy/{" + POLICY_NAME + "}", method = RequestMethod.PUT) - public void putPolicy(@PathVariable(POLICY_NAME) String policyName, // - @ApiParam(value = "JSON formatted policy") @RequestBody JsonNode policy, // + /* + * This controller is deliberately kept ignorant of the + * ACAdmissionIntervalControl data structure. + */ + @ApiOperation(value = "Sets the control admission time for AC xApp via the A1 Mediator") + @RequestMapping(value = "catime", method = RequestMethod.PUT) + public void setControlAdmissionTime(@ApiParam(value = "Control admission time") @RequestBody JsonNode caTime, // HttpServletResponse response) { - logger.debug("putPolicy: policy {}", policyName); - a1MediatorApi.a1ControllerPutHandler(policyName, policy); + logger.debug("setControlAdmissionTime {}", caTime); + a1MediatorApi.a1ControllerPutHandler(POLICY_CONTROL_ADMISSION_TIME, caTime); response.setStatus(a1MediatorApi.getApiClient().getStatusCode().value()); } 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 6c0ca4bd..aa7b443f 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 @@ -101,7 +101,7 @@ public class AnrXappController { @ApiOperation(value = "Query NCRT of all cells, all or one gNB(s)", response = NeighborCellRelationTable.class) @RequestMapping(value = "/cell", method = RequestMethod.GET) - public NeighborCellRelationTable queryNcrtAllCells( // + public NeighborCellRelationTable getNcrtInfo( // @RequestParam(name = GGNBID, required = false) String ggnbId, // @RequestParam(name = START_INDEX, required = false) String startIndex, // @RequestParam(name = LIMIT, required = false) Integer limit) { @@ -111,7 +111,7 @@ public class AnrXappController { @ApiOperation(value = "Query NCRT of a single serving cell", response = NeighborCellRelationTable.class) @RequestMapping(value = "/cell/" + CELL_ID + "/{" + CELL_ID + "}", method = RequestMethod.GET) - public NeighborCellRelationTable queryNcrtServingCell(@PathVariable(CELL_ID) String cellIdentifier, // + public NeighborCellRelationTable getCellNcrtInfo(@PathVariable(CELL_ID) String cellIdentifier, // @RequestParam(name = START_INDEX, required = false) String startIndex, // @RequestParam(name = LIMIT, required = false) Integer limit, @RequestParam(name = NRPCI, required = false) String nrpci, @@ -131,13 +131,17 @@ public class AnrXappController { response.setStatus(healthApi.getApiClient().getStatusCode().value()); } + /* + * TODO: DELETE should not have a body - the path should identify the resource to be deleted. + */ @ApiOperation(value = "Delete neighbor cell relation based on Source Cell NR CGI and Target Cell NR PCI / NR CGI") @RequestMapping(value = "/cell/" + CELL_ID + "/{" + CELL_ID + "}", method = RequestMethod.DELETE) - public void modifyNcrt(@PathVariable(CELL_ID) String cellIdentifier, // + public void deleteNcrt(@PathVariable(CELL_ID) String cellIdentifier, // @RequestBody NeighborCellRelationDelTable ncrtDelTable, // HttpServletResponse response) { logger.debug("modifyNcrt: cellIdentifier {} delTable {}", cellIdentifier, ncrtDelTable); ncrtApi.deleteNcrt(cellIdentifier, ncrtDelTable); response.setStatus(healthApi.getApiClient().getStatusCode().value()); } + } diff --git a/webapp-frontend/.gitignore b/webapp-frontend/.gitignore index 4cfece3d..588ac105 100644 --- a/webapp-frontend/.gitignore +++ b/webapp-frontend/.gitignore @@ -15,7 +15,7 @@ /.settings /target/ /.mvn/wrapper/maven-wrapper.jar -/.vscode +**/.vscode ### STS ### .apt_generated diff --git a/webapp-frontend/src/app/admin/admin.component.html b/webapp-frontend/src/app/admin/admin.component.html index aba337c7..1cc91738 100644 --- a/webapp-frontend/src/app/admin/admin.component.html +++ b/webapp-frontend/src/app/admin/admin.component.html @@ -16,7 +16,7 @@ See the License for the specific language governing permissions and limitations under the License. ========================LICENSE_END=================================== - --> +-->

Users

diff --git a/webapp-frontend/src/app/admin/admin.component.ts b/webapp-frontend/src/app/admin/admin.component.ts index 6669079e..33ce1e79 100644 --- a/webapp-frontend/src/app/admin/admin.component.ts +++ b/webapp-frontend/src/app/admin/admin.component.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/anr-xapp/anr-xapp.component.html b/webapp-frontend/src/app/anr-xapp/anr-xapp.component.html new file mode 100644 index 00000000..0684ac74 --- /dev/null +++ b/webapp-frontend/src/app/anr-xapp/anr-xapp.component.html @@ -0,0 +1,26 @@ + +
+

ANR xApp

+ + + +
+ diff --git a/webapp-frontend/src/app/anr-xapp/anr-xapp.component.scss b/webapp-frontend/src/app/anr-xapp/anr-xapp.component.scss new file mode 100644 index 00000000..183d90dc --- /dev/null +++ b/webapp-frontend/src/app/anr-xapp/anr-xapp.component.scss @@ -0,0 +1,40 @@ +/*- + * ========================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=================================== + */ + .anr__section { + position: relative; + top: -150px; +} + +.anr__header { + text-align: center; + color: #432c85; + font-size: 50px; + font-weight: 200; + letter-spacing: .1em; + transform: translate(149 56); +} + +:host /deep/ ng2-smart-table tbody > tr > td{ + text-align: left; +} + +:host /deep/ ng2-smart-table thead th{ + text-align: left; +} 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 new file mode 100644 index 00000000..681aa20f --- /dev/null +++ b/webapp-frontend/src/app/anr-xapp/anr-xapp.component.spec.ts @@ -0,0 +1,25 @@ +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 new file mode 100644 index 00000000..63b4e31c --- /dev/null +++ b/webapp-frontend/src/app/anr-xapp/anr-xapp.component.ts @@ -0,0 +1,15 @@ +import { Component, OnInit } from '@angular/core'; + +@Component({ + selector: 'app-anr-xapp', + templateUrl: './anr-xapp.component.html', + styleUrls: ['./anr-xapp.component.scss'] +}) +export class AnrXappComponent implements OnInit { + + constructor() { } + + ngOnInit() { + } + +} diff --git a/webapp-frontend/src/app/app-routing.module.ts b/webapp-frontend/src/app/app-routing.module.ts index 3620c0e5..edfe38f3 100644 --- a/webapp-frontend/src/app/app-routing.module.ts +++ b/webapp-frontend/src/app/app-routing.module.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/app.component.ts b/webapp-frontend/src/app/app.component.ts index 796d6b3e..15c8832c 100644 --- a/webapp-frontend/src/app/app.component.ts +++ b/webapp-frontend/src/app/app.component.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/app.module.ts b/webapp-frontend/src/app/app.module.ts index fabd2585..e9dc34d8 100644 --- a/webapp-frontend/src/app/app.module.ts +++ b/webapp-frontend/src/app/app.module.ts @@ -7,9 +7,9 @@ * 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. @@ -20,13 +20,13 @@ import { BrowserModule } from '@angular/platform-browser'; // tslint:disable-next-line:max-line-length import { MatIconModule, MatCardModule, MatListModule, MatSidenavModule, - MatButtonToggleModule, MatSliderModule, MatGridListModule, MatSlideToggleModule, - MatExpansionModule, MatTabsModule, MatDialogModule, MatFormFieldModule, + MatButtonToggleModule, MatSliderModule, MatGridListModule, MatSlideToggleModule, + MatExpansionModule, MatTabsModule, MatDialogModule, MatFormFieldModule, MatButtonModule, MatInputModule, MatSnackBarModule} from '@angular/material'; import { BrowserAnimationsModule} from '@angular/platform-browser/animations'; import { NgModule } from '@angular/core'; import { Ng2SmartTableModule } from 'ng2-smart-table'; -import { MatRadioModule } from '@angular/material/radio'; +import { MatRadioModule } from '@angular/material/radio'; import { ChartsModule } from 'ng2-charts'; import { MDBBootstrapModule } from 'angular-bootstrap-md'; import { FormsModule, ReactiveFormsModule } from '@angular/forms'; @@ -39,10 +39,11 @@ import { UiService } from './services/ui/ui.service'; import { AdminService } from './services/admin/admin.service'; import { CatalogService } from './services/catalog/catalog.service'; import { ControlService } from './services/control/control.service'; -import { SignalService } from './services/signal/signal.service'; +import { DashboardService } from './services/dashboard/dashboard.service'; +import { E2ManagerService } from './services/e2-mgr/e2-mgr.service'; import { SidenavListComponent } from './navigation/sidenav-list/sidenav-list.component'; import { ControlComponent } from './control/control.component'; -import { SignalComponent, AppRANConnectDialog } from './signal/signal.component'; +import { SignalComponent, RANConnectDialogComponent } from './signal/signal.component'; import { StatsComponent } from './stats/stats.component'; import { AdminComponent } from './admin/admin.component'; import { CatalogCardComponent } from './ui/catalog-card/catalog-card.component'; @@ -53,6 +54,7 @@ import { XappComponent } from './xapp/xapp.component'; import { ConfigEventComponent } from './ui/config-event/config-event.component'; import { ConfirmDialogComponent } from './ui/confirm-dialog/confirm-dialog.component'; import { FooterComponent } from './footer/footer.component'; +import { AnrXappComponent } from './anr-xapp/anr-xapp.component'; @NgModule({ @@ -71,9 +73,10 @@ import { FooterComponent } from './footer/footer.component'; ModalEventComponent, XappComponent, ConfigEventComponent, - AppRANConnectDialog, + RANConnectDialogComponent, ConfirmDialogComponent, FooterComponent, + AnrXappComponent, ], imports: [ BrowserModule, @@ -119,17 +122,18 @@ import { FooterComponent } from './footer/footer.component'; MatInputModule ], entryComponents: [ - AppRANConnectDialog, ConfirmDialogComponent, + RANConnectDialogComponent ], providers: [ UiService, AdminService, CatalogService, ControlService, - SignalService + DashboardService, + E2ManagerService ], bootstrap: [AppComponent] }) -export class AppModule { }; +export class AppModule { } diff --git a/webapp-frontend/src/app/footer/footer.component.spec.ts b/webapp-frontend/src/app/footer/footer.component.spec.ts index 7f64be64..2658fc89 100644 --- a/webapp-frontend/src/app/footer/footer.component.spec.ts +++ b/webapp-frontend/src/app/footer/footer.component.spec.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/footer/footer.component.ts b/webapp-frontend/src/app/footer/footer.component.ts index f01b6b01..1dbd4b6d 100644 --- a/webapp-frontend/src/app/footer/footer.component.ts +++ b/webapp-frontend/src/app/footer/footer.component.ts @@ -7,9 +7,9 @@ * 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. @@ -17,10 +17,9 @@ * limitations under the License. * ========================LICENSE_END=================================== */ -import { Component, OnInit } from '@angular/core' -import { Observable } from 'rxjs/Rx' -import { VersionService } from '../services/version/version.service' -import { DashboardSuccessTransport } from '../interfaces/dashboard.types' +import { Component, OnInit } from '@angular/core'; +import { DashboardService } from '../services/dashboard/dashboard.service'; +import { DashboardSuccessTransport } from '../interfaces/dashboard.types'; @Component({ selector: 'app-footer', @@ -33,13 +32,13 @@ import { DashboardSuccessTransport } from '../interfaces/dashboard.types' */ export class FooterComponent implements OnInit { - public dashboardVersion : string - + dashboardVersion: string; + // Inject the service - constructor(public versionService: VersionService) { } + constructor(private dashboardService: DashboardService) { } ngOnInit() { - this.versionService.getDashboardVersion().subscribe((res : DashboardSuccessTransport) => this.dashboardVersion = res.data) + this.dashboardService.getVersion().subscribe((res: DashboardSuccessTransport) => this.dashboardVersion = res.data); } } diff --git a/webapp-frontend/src/app/interfaces/ac-xapp.types.ts b/webapp-frontend/src/app/interfaces/ac-xapp.types.ts index 5c3cf3fb..4aa833b3 100644 --- a/webapp-frontend/src/app/interfaces/ac-xapp.types.ts +++ b/webapp-frontend/src/app/interfaces/ac-xapp.types.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/interfaces/anr-xapp.types.ts b/webapp-frontend/src/app/interfaces/anr-xapp.types.ts index 0e07ceb8..f0a5a43d 100644 --- a/webapp-frontend/src/app/interfaces/anr-xapp.types.ts +++ b/webapp-frontend/src/app/interfaces/anr-xapp.types.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/interfaces/dashboard.types.ts b/webapp-frontend/src/app/interfaces/dashboard.types.ts index 6bb75340..01a9d72a 100644 --- a/webapp-frontend/src/app/interfaces/dashboard.types.ts +++ b/webapp-frontend/src/app/interfaces/dashboard.types.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/interfaces/e2-mgr.types.ts b/webapp-frontend/src/app/interfaces/e2-mgr.types.ts index 1790bf96..70256d2f 100644 --- a/webapp-frontend/src/app/interfaces/e2-mgr.types.ts +++ b/webapp-frontend/src/app/interfaces/e2-mgr.types.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/interfaces/xapp-mgr.types.ts b/webapp-frontend/src/app/interfaces/xapp-mgr.types.ts index 1fa4c33d..999ddb33 100644 --- a/webapp-frontend/src/app/interfaces/xapp-mgr.types.ts +++ b/webapp-frontend/src/app/interfaces/xapp-mgr.types.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/navigation/sidenav-list/sidenav-list.component.ts b/webapp-frontend/src/app/navigation/sidenav-list/sidenav-list.component.ts index d94b39bd..6ebd79bd 100644 --- a/webapp-frontend/src/app/navigation/sidenav-list/sidenav-list.component.ts +++ b/webapp-frontend/src/app/navigation/sidenav-list/sidenav-list.component.ts @@ -7,9 +7,9 @@ * 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. 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 new file mode 100644 index 00000000..4b043747 --- /dev/null +++ b/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.spec.ts @@ -0,0 +1,12 @@ +import { TestBed } from '@angular/core/testing'; + +import { AcXappService } from './ac-xapp.service'; + +describe('AcXappService', () => { + beforeEach(() => TestBed.configureTestingModule({})); + + it('should be created', () => { + 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 new file mode 100644 index 00000000..740fcbcb --- /dev/null +++ b/webapp-frontend/src/app/services/ac-xapp/ac-xapp.service.ts @@ -0,0 +1,56 @@ +/*- + * ========================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 { Injectable } from '@angular/core'; + import { HttpClient } from '@angular/common/http'; + import { Observable } from 'rxjs'; +import { ACAdmissionIntervalControl, ACAdmissionIntervalControlAck } from '../../interfaces/ac-xapp.types'; +import { DashboardSuccessTransport } from '../../interfaces/dashboard.types'; + +@Injectable({ + providedIn: 'root' +}) +export class AcXappService { + + private basePath = 'api/xapp/ac/'; + + constructor(private httpClient: HttpClient) { + // injects to variable httpClient + } + + /** + * Gets A1 Mediator client version details + * @returns Observable that should yield a SuccessTransport object + */ + getVersion() { + // Remember that AC traffic goes via A1! + return this.httpClient.get(this.basePath + 'version'); + } + + /** + * Puts control admission time parameters to AC via A1 + * @param policy an instance of ACAdmissionIntervalControl + * @returns Observable that should yield an ACAdmissionIntervalControlAck + */ + putCaTime(policy: ACAdmissionIntervalControl): Observable { + return this.httpClient.put(this.basePath + 'catime', policy); + } + +} diff --git a/webapp-frontend/src/app/services/admin/admin.service.spec.ts b/webapp-frontend/src/app/services/admin/admin.service.spec.ts index 2d3de0fa..acc9f437 100644 --- a/webapp-frontend/src/app/services/admin/admin.service.spec.ts +++ b/webapp-frontend/src/app/services/admin/admin.service.spec.ts @@ -7,9 +7,9 @@ * 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. @@ -17,6 +17,7 @@ * limitations under the License. * ========================LICENSE_END=================================== */ + import { TestBed } from '@angular/core/testing'; import { AdminService } from './admin.service'; 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 new file mode 100644 index 00000000..a36dd8b3 --- /dev/null +++ b/webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.spec.ts @@ -0,0 +1,32 @@ +/*- + * ========================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 { 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 new file mode 100644 index 00000000..f9403f1f --- /dev/null +++ b/webapp-frontend/src/app/services/anr-xapp/anr-xapp.service.ts @@ -0,0 +1,118 @@ +/*- + * ========================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 { Injectable } from '@angular/core'; +import { HttpClient, HttpParams } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { DashboardSuccessTransport } from '../../interfaces/dashboard.types'; +import { ANRNeighborCellRelation, ANRNeighborCellRelationMod } from '../../interfaces/anr-xapp.types'; + +@Injectable({ + providedIn: 'root' +}) +export class AnrXappService { + + private basePath = 'api/xapp/anr/'; + private cellPath = 'cell/cellIdentifier/'; + + constructor(private httpClient: HttpClient) { + // injects to variable httpClient + } + + /** + * Gets ANR xApp client version details + * @returns Observable that should yield a DashboardSuccessTransport + */ + getVersion(): Observable { + return this.httpClient.get(this.basePath + 'version'); + } + + /** + * Performs a liveness probe + * @returns Observable that should yield a response code (no data) + */ + getHealthAlive(): Observable { + return this.httpClient.get(this.basePath + 'health/alive'); + } + + /** + * Performs a readiness probe + * @returns Observable that should yield a response code (no data) + */ + getHealthReady(): Observable { + return this.httpClient.get(this.basePath + 'health/ready'); + } + + /** + * Query NCRT of all cells, all or one gNB(s) + * @param ggnbId Optional parameter for the gNB ID + * @param startIndex Optional parameter for the start index + * @param limit Optional parameter for the limit (page size) + * @returns Observable of ANRNeighborCellRelation + */ + getNcrtInfo(ggnbId?: string, startIndex?: string, limit?: number): Observable { + const queryParams = new HttpParams(); + if (ggnbId) { + queryParams.set('ggnbid', ggnbId); + } + if (startIndex) { + queryParams.set('startIndex', startIndex); + } + if (limit) { + queryParams.set('limit', limit.toString()); + } + return this.httpClient.get(this.basePath + 'cell', { params: queryParams } ); + } + + /** + * Query NCRT of a single serving cell, all or one gNB(s) + * @param cellId cell ID + * @param ggnbid Optional parameter for the gNB ID + * @param startIndex Optional parameter for the start index + * @param limit Optional parameter for the limit (page size) + * @returns Observable of ANRNeighborCellRelation + */ + getCellNcrtInfo(cellId: string, ggnbId?: string, startIndex?: string, limit?: number): Observable { + const queryParams = new HttpParams(); + if (ggnbId) { + queryParams.set('ggnbid', ggnbId); + } + if (startIndex) { + queryParams.set('startIndex', startIndex); + } + if (limit) { + queryParams.set('limit', limit.toString()); + } + return this.httpClient.get(this.basePath + this.cellPath + cellId, { params: queryParams } ); + } + + /** + * Modify neighbor cell relations based on Source Cell NR CGI and Target Cell NR PCI / NR CGI + * @param cellId cell ID + * @param table Array of ANRNeighborCellRelationMod + * @returns Observable that should yield a response code (no data) + */ + modifyNcrt(cellId: string, table: ANRNeighborCellRelationMod []): Observable { + return this.httpClient.put(this.basePath + this.cellPath + cellId, table); + } + + /** TODO: deleteNcrt */ + +} diff --git a/webapp-frontend/src/app/services/catalog/catalog.service.ts b/webapp-frontend/src/app/services/catalog/catalog.service.ts index 586df92e..4946f24b 100644 --- a/webapp-frontend/src/app/services/catalog/catalog.service.ts +++ b/webapp-frontend/src/app/services/catalog/catalog.service.ts @@ -7,9 +7,9 @@ * 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. @@ -33,10 +33,8 @@ export class CatalogService { return this.httpClient.get('api/xappmgr/xapps'); } - deployXapp(name) { - let xappInfo: XMXappInfo = { - xAppName: name - }; + deployXapp(name: string) { + const xappInfo: XMXappInfo = { xAppName: name }; return this.httpClient.post('api/xappmgr/xapps', xappInfo, { observe: 'response' }); } diff --git a/webapp-frontend/src/app/services/control/control.service.ts b/webapp-frontend/src/app/services/control/control.service.ts index 41819c44..24b4024a 100644 --- a/webapp-frontend/src/app/services/control/control.service.ts +++ b/webapp-frontend/src/app/services/control/control.service.ts @@ -7,9 +7,9 @@ * 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. @@ -26,28 +26,27 @@ export class ControlService { constructor(private http: HttpClient) { } - getxAppInstances(xAppInstances) { + getxAppInstances(xAppInstances) { return this.http.get('api/xappmgr/xapps').subscribe( (val: any[]) => { xAppInstances(this.fetchInstance(val)); - } + } ); - } undeployxApp(xapp) { - return this.http.delete(('api/xappmgr/xapps/' + xapp),{ observe: 'response' }) + return this.http.delete(('api/xappmgr/xapps/' + xapp), { observe: 'response' }); } fetchInstance(allxappdata) { - var xAppInstances = [] - for (const xappindex in allxappdata) { - var instancelist = allxappdata[xappindex].instances; + const xAppInstances = []; + for (const xappindex in allxappdata) { + const instancelist = allxappdata[xappindex].instances; for (const instanceindex in instancelist) { - var instance = instancelist[instanceindex]; + const instance = instancelist[instanceindex]; instance.xapp = allxappdata[xappindex].name; xAppInstances.push(instance); - } + } } return xAppInstances; } diff --git a/webapp-frontend/src/app/services/version/version.service.spec.ts b/webapp-frontend/src/app/services/dashboard/dashboard.service.spec.ts similarity index 85% rename from webapp-frontend/src/app/services/version/version.service.spec.ts rename to webapp-frontend/src/app/services/dashboard/dashboard.service.spec.ts index 184a0f23..25ad4a1d 100644 --- a/webapp-frontend/src/app/services/version/version.service.spec.ts +++ b/webapp-frontend/src/app/services/dashboard/dashboard.service.spec.ts @@ -7,9 +7,9 @@ * 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. @@ -19,13 +19,13 @@ */ import { TestBed } from '@angular/core/testing'; -import { VersionService } from './version.service'; +import { DashboardService } from './dashboard.service'; -describe('VersionService', () => { +describe('DashboardService', () => { beforeEach(() => TestBed.configureTestingModule({})); it('should be created', () => { - const service: VersionService = TestBed.get(VersionService); + const service: DashboardService = TestBed.get(DashboardService); expect(service).toBeTruthy(); }); }); diff --git a/webapp-frontend/src/app/services/signal/signal.service.ts b/webapp-frontend/src/app/services/dashboard/dashboard.service.ts similarity index 63% rename from webapp-frontend/src/app/services/signal/signal.service.ts rename to webapp-frontend/src/app/services/dashboard/dashboard.service.ts index 45a4dc81..9a79f143 100644 --- a/webapp-frontend/src/app/services/signal/signal.service.ts +++ b/webapp-frontend/src/app/services/dashboard/dashboard.service.ts @@ -7,9 +7,9 @@ * 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. @@ -20,23 +20,35 @@ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -@Injectable() -export class SignalService { - +@Injectable({ + providedIn: 'root' +}) + +/** + * Services to query the dashboard's healthcheck controller. + */ +export class DashboardService { + + private basePath = 'api/dashboard/'; + constructor(private httpClient: HttpClient) { // injects to variable httpClient } - getAll() { - return this.httpClient.get('api/e2mgr/setup'); - } - - x2Setup(req) { - return this.httpClient.post('api/e2mgr/x2Setup', req); + /** + * Checks app health + * @returns Observable that should yield a DashboardSuccessTransport + */ + getHealth() { + return this.httpClient.get(this.basePath + 'health'); } - endcSetup(req) { - return this.httpClient.post('api/e2mgr/endcSetup', req); + /** + * Gets Dashboard version details + * @returns Observable that should yield a DashboardSuccessTransport object + */ + getVersion() { + return this.httpClient.get(this.basePath + 'version'); } } diff --git a/webapp-frontend/src/app/services/signal/signal.service.spec.ts b/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.spec.ts similarity index 88% rename from webapp-frontend/src/app/services/signal/signal.service.spec.ts rename to webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.spec.ts index d454ff32..5ee0488f 100644 --- a/webapp-frontend/src/app/services/signal/signal.service.spec.ts +++ b/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.spec.ts @@ -7,9 +7,9 @@ * 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. @@ -19,13 +19,15 @@ */ import { TestBed } from '@angular/core/testing'; -import { SignalService } from './signal.service'; +import { E2ManagerService } from './e2-mgr.service'; describe('CatalogService', () => { beforeEach(() => TestBed.configureTestingModule({})); it('should be created', () => { - const service: SignalService = TestBed.get(SignalService); + const service: E2ManagerService + = TestBed.get(E2ManagerService + ); expect(service).toBeTruthy(); }); }); diff --git a/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts b/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts new file mode 100644 index 00000000..1c1a534d --- /dev/null +++ b/webapp-frontend/src/app/services/e2-mgr/e2-mgr.service.ts @@ -0,0 +1,65 @@ +/*- + * ========================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 { Injectable } from '@angular/core'; +import { HttpClient } from '@angular/common/http'; +import { E2SetupRequest } from '../../interfaces/e2-mgr.types'; + +@Injectable() +export class E2ManagerService { + + private basePath = 'api/e2mgr/'; + + constructor(private httpClient: HttpClient) { + // injects to variable httpClient + } + + /** + * Gets E2 manager client version details + * @returns Observable that should yield a DashboardSuccessTransport object + */ + getE2ManagerVersion() { + return this.httpClient.get(this.basePath + 'version'); + } + + /** + * Gets setup request history + * @returns Observable that should yield an array of objects + */ + getAll() { + return this.httpClient.get(this.basePath + 'setup'); + } + + /** + * Sends a request to setup an ENDC/gNodeB connection + * @returns Observable + */ + endcSetup(req: E2SetupRequest) { + return this.httpClient.post(this.basePath + 'endcSetup', req); + } + + /** + * Sends a request to setup an X2/eNodeB connection + * @returns Observable + */ + x2Setup(req: E2SetupRequest) { + return this.httpClient.post(this.basePath + 'x2Setup', req); + } + +} diff --git a/webapp-frontend/src/app/services/stats/stats.service.ts b/webapp-frontend/src/app/services/stats/stats.service.ts index 1dcce6f1..255dbca7 100644 --- a/webapp-frontend/src/app/services/stats/stats.service.ts +++ b/webapp-frontend/src/app/services/stats/stats.service.ts @@ -7,9 +7,9 @@ * 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. @@ -19,9 +19,9 @@ */ import { Injectable } from '@angular/core'; import { HttpClient } from '@angular/common/http'; -import { HttpHeaders } from "@angular/common/http"; -import { Observable } from "rxjs"; -import { HttpErrorResponse } from "@angular/common/http"; +import { HttpHeaders } from '@angular/common/http'; +import { Observable } from 'rxjs'; +import { HttpErrorResponse } from '@angular/common/http'; @Injectable({ providedIn: 'root' @@ -49,11 +49,10 @@ export class StatsService { 'Access-Control-Allow-Headers': 'Origin, X-Requested-With, Content-Type, Accept, Authorization' }) }; - - constructor(private httpClient: HttpClient) { - //this.loadConfig(); - //this.getLoad(); - + + constructor(private httpClient: HttpClient) { + // this.loadConfig(); + // this.getLoad(); } getMetrics() { @@ -67,7 +66,7 @@ export class StatsService { } getLoad(): Observable { - //this.loadMetrics = this.getRandomValue(); + // this.loadMetrics = this.getRandomValue(); this.httpClient.get(this.hostURL + this.loadPath).subscribe((res) => { console.log(res); console.log('stats.service.getLoad(): ' + res['load']); @@ -76,9 +75,9 @@ export class StatsService { }); return this.load; } - + putLoad(value: number) { - //this.loadMetrics = this.getRandomValue(); + // this.loadMetrics = this.getRandomValue(); const jsonValue = '{ "load": ' + value + ' }'; console.log(jsonValue); this.httpClient.put(this.hostURL + this.loadPath, jsonValue , this.httpOptions).subscribe((res) => { @@ -87,14 +86,14 @@ export class StatsService { } putDelay(value: number) { - //this.loadMetrics = this.getRandomValue(); + // this.loadMetrics = this.getRandomValue(); const jsonValue = '{ "delay": ' + value + ' }'; console.log(jsonValue); this.httpClient.put(this.hostURL + this.delayPath, jsonValue , this.httpOptions).subscribe((res) => { console.log(res); }); } - + getCpuMetrics() { this.cpuMetrics = this.getRandomValue(); return this.cpuMetrics; @@ -103,23 +102,23 @@ export class StatsService { getRandomValue() { return Math.round((Math.random() * (20 - 0)) + 0); } - + saveConfig(key: string, value: string) { - if(key == 'jsonURL') + if (key === 'jsonURL') { this.baseJSONServerUrl = value; + } + console.log('save this.baseJSONServerUrl ' + this.baseJSONServerUrl); + const jsonValue = '{"id": "' + key + '", "value": "' + value + '"}'; + console.log(jsonValue); + this.httpClient.put(this.baseJSONServerUrl + '/config/' + key , jsonValue, this.httpOptions).subscribe((res) => { + console.log(res); + }); - console.log('save this.baseJSONServerUrl '+this.baseJSONServerUrl); - const jsonValue = '{"id": "' + key + '", "value": "' + value + '"}'; - console.log(jsonValue); - this.httpClient.put(this.baseJSONServerUrl + '/config/' + key , jsonValue, this.httpOptions).subscribe((res) => { - console.log(res); - }); - } - + loadConfig() { - console.log('load this.baseJSONServerUrl '+this.baseJSONServerUrl); + console.log('load this.baseJSONServerUrl ' + this.baseJSONServerUrl); const httpOptions = { headers: new HttpHeaders({ 'Content-Type': 'application/json' diff --git a/webapp-frontend/src/app/services/ui/confirm-dialog.service.ts b/webapp-frontend/src/app/services/ui/confirm-dialog.service.ts index 0eccc631..2c38c319 100644 --- a/webapp-frontend/src/app/services/ui/confirm-dialog.service.ts +++ b/webapp-frontend/src/app/services/ui/confirm-dialog.service.ts @@ -7,9 +7,9 @@ * 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. @@ -20,7 +20,7 @@ import { Injectable } from '@angular/core'; import { MatDialog } from '@angular/material'; -import { ConfirmDialogComponent } from './../../ui/confirm-dialog/confirm-dialog.component' +import { ConfirmDialogComponent } from './../../ui/confirm-dialog/confirm-dialog.component'; @Injectable({ providedIn: 'root' @@ -32,7 +32,7 @@ export class ConfirmDialogService { openConfirmDialog(msg) { return this.dialog.open(ConfirmDialogComponent, { width: '480px', - position: { top: "100px" }, + position: { top: '100px' }, data: { message: msg } diff --git a/webapp-frontend/src/app/services/ui/notification.service.spec.ts b/webapp-frontend/src/app/services/ui/notification.service.spec.ts index 0c2c2fbe..3760229e 100644 --- a/webapp-frontend/src/app/services/ui/notification.service.spec.ts +++ b/webapp-frontend/src/app/services/ui/notification.service.spec.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/services/ui/notification.service.ts b/webapp-frontend/src/app/services/ui/notification.service.ts index 36d8742e..30f80214 100644 --- a/webapp-frontend/src/app/services/ui/notification.service.ts +++ b/webapp-frontend/src/app/services/ui/notification.service.ts @@ -7,9 +7,9 @@ * 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. @@ -32,20 +32,20 @@ export class NotificationService { duration: 3000, horizontalPosition: 'right', verticalPosition: 'top' - } + }; - success(msg) { + success(msg: string) { this.config['panelClass'] = ['notification', 'success', 'default']; this.snackBar.open(msg, '', this.config); } - warn(msg) { + warn(msg: string) { this.config['panelClass'] = ['notification', 'warn', 'default']; this.snackBar.open(msg, '', this.config); } - error(msg) { + error(msg: string) { this.config['panelClass'] = ['notification', 'error', 'default']; this.snackBar.open(msg, '', this.config); } diff --git a/webapp-frontend/src/app/services/ui/ui.service.spec.ts b/webapp-frontend/src/app/services/ui/ui.service.spec.ts index 8547e77f..ab082af1 100644 --- a/webapp-frontend/src/app/services/ui/ui.service.spec.ts +++ b/webapp-frontend/src/app/services/ui/ui.service.spec.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/services/ui/ui.service.ts b/webapp-frontend/src/app/services/ui/ui.service.ts index a496c708..617cff9d 100644 --- a/webapp-frontend/src/app/services/ui/ui.service.ts +++ b/webapp-frontend/src/app/services/ui/ui.service.ts @@ -7,9 +7,9 @@ * 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. diff --git a/webapp-frontend/src/app/services/version/version.service.ts b/webapp-frontend/src/app/services/version/version.service.ts deleted file mode 100644 index 2a3ec5e6..00000000 --- a/webapp-frontend/src/app/services/version/version.service.ts +++ /dev/null @@ -1,73 +0,0 @@ -/*- - * ========================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 { Injectable } from '@angular/core' -import { HttpClient } from '@angular/common/http' - -@Injectable({ - providedIn: 'root' -}) -export class VersionService { - - constructor(private httpClient : HttpClient) { - // injects to variable httpClient - } - - /** - * Gets an Observable with version details - * @returns {Observable} with Dashboard version - */ - getDashboardVersion() { - return this.httpClient.get('api/dashboard/version') - } - - /** - * Gets an Observable with version details - * @returns {Observable} with A1 Mediator version - */ - getA1MediatorVersion() { - // Remember that AC traffic goes via A1 - return this.httpClient.get('api/xapp/ac/version') - } - - /** - * Gets an Observable with version details - * @returns {Observable} with ANR xApp version - */ - getAnrXappVersion() { - return this.httpClient.get('api/xapp/anr/version') - } - - /** - * Gets an Observable with version details - * @returns {Observable} with E2 Manager version - */ - getE2ManagerVersion() { - return this.httpClient.get('api/e2mgr/version') - } - - /** - * Gets an Observable with version details - * @returns {Observable} with XApp Manager version - */ - getXappManagerVersion(){ - return this.httpClient.get('api/xappmgr/version') - } - -} diff --git a/webapp-frontend/src/app/signal/signal.component.ranconnect-dialog.html b/webapp-frontend/src/app/signal/signal.component.ranconnect-dialog.html index c0b0d862..a8e17ce2 100644 --- a/webapp-frontend/src/app/signal/signal.component.ranconnect-dialog.html +++ b/webapp-frontend/src/app/signal/signal.component.ranconnect-dialog.html @@ -25,8 +25,8 @@
- - + + EN-DC X2 diff --git a/webapp-frontend/src/app/signal/signal.component.ts b/webapp-frontend/src/app/signal/signal.component.ts index 5a9b9252..77593ece 100644 --- a/webapp-frontend/src/app/signal/signal.component.ts +++ b/webapp-frontend/src/app/signal/signal.component.ts @@ -7,9 +7,9 @@ * 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. @@ -22,13 +22,76 @@ import { LocalDataSource } from 'ng2-smart-table'; import { Router } from '@angular/router'; import { MatDialog, MatDialogConfig, MatDialogRef, MAT_DIALOG_DATA } from '@angular/material/dialog'; import { MatFormFieldModule } from '@angular/material'; -import { MatRadioModule } from '@angular/material/radio'; +import { MatRadioModule } from '@angular/material/radio'; import { FormGroup, FormControl, FormBuilder, ReactiveFormsModule, Validators } from '@angular/forms'; import { HttpClient } from '@angular/common/http'; -import { Observable } from 'rxjs/Rx'; -import { SignalService } from '../services/signal/signal.service'; +import { E2ManagerService } from '../services/e2-mgr/e2-mgr.service'; import { E2SetupRequest } from '../interfaces/e2-mgr.types'; +@Component({ + selector: 'app-signal-ranconnect-dialog', + templateUrl: 'signal.component.ranconnect-dialog.html', + styleUrls: ['signal.component.css'] +}) + +export class RANConnectDialogComponent implements OnInit { + + public ranDialogForm: FormGroup; + + constructor( + public dialogRef: MatDialogRef, + private service: E2ManagerService + , + @Inject(MAT_DIALOG_DATA) public data: E2SetupRequest) { } + + ngOnInit() { + const namePattern = /^([A-Z]){4}([0-9]){6}$/; + const ipPattern = /((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))/; + const portPattern = /^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$/; + this.ranDialogForm = new FormGroup({ + ranType: new FormControl('endc'), + ranName: new FormControl('', [Validators.required, Validators.pattern(namePattern)]), + ranIp: new FormControl('', [Validators.required, Validators.pattern(ipPattern)]), + ranPort: new FormControl('', [Validators.required, Validators.pattern(portPattern)]) + }); + } + + onCancel() { + this.dialogRef.close(); + } + + public setupConnection = (ranFormValue) => { + if (this.ranDialogForm.valid) { + this.executeSetupConnection(ranFormValue); + } + } + + private executeSetupConnection = (ranFormValue) => { + const setupRequest: E2SetupRequest = { + ranName: ranFormValue.ranName, + ranIp: ranFormValue.ranIp, + ranPort: ranFormValue.ranPort + }; + if (ranFormValue.ranType === 'endc') { + this.service.endcSetup(setupRequest).subscribe((val: any[]) => {}); + } else { + this.service.x2Setup(setupRequest).subscribe((val: any[]) => {}); + } + this.dialogRef.close(); + } + + public hasError(controlName: string, errorName: string) { + if (this.ranDialogForm.controls[controlName].hasError(errorName)) { return true; } + return false; + } + + public validateControl(controlName: string) { + if (this.ranDialogForm.controls[controlName].invalid && this.ranDialogForm.controls[controlName].touched) { return true; } + return false; + } + +} // class RANConnectDialogComponent + @Component({ selector: 'app-signal', templateUrl: 'signal.component.html', @@ -75,15 +138,16 @@ export class SignalComponent { source: LocalDataSource = new LocalDataSource(); - constructor(private service: SignalService, public dialog: MatDialog, private http: HttpClient) { + constructor(private service: E2ManagerService + , public dialog: MatDialog, private http: HttpClient) { this.service.getAll().subscribe((val: any[]) => this.source.load(val)); } openRanConnectDialog() { - const dialogRef = this.dialog.open(AppRANConnectDialog, { + const dialogRef = this.dialog.open(RANConnectDialogComponent, { width: '450px', data: { } - }) + }); dialogRef.afterClosed().subscribe(result => { this.service.getAll().subscribe((val: any[]) => this.source.load(val)); }); @@ -91,69 +155,3 @@ export class SignalComponent { }// class SignalComponent -@Component({ - selector: 'app-signal-ranconnect-dialog', - templateUrl: 'signal.component.ranconnect-dialog.html', - styleUrls: ['signal.component.css'] -}) - -export class AppRANConnectDialog implements OnInit { - - public ranDialogForm: FormGroup; - - constructor( - public dialogRef: MatDialogRef, - private service: SignalService, - @Inject(MAT_DIALOG_DATA) public data: E2SetupRequest) { - } - - ngOnInit() { - const namePattern = /^([A-Z]){4}([0-9]){6}$/; - const ipPattern = /((^\s*((([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5])\.){3}([0-9]|[1-9][0-9]|1[0-9]{2}|2[0-4][0-9]|25[0-5]))\s*$)|(^\s*((([0-9A-Fa-f]{1,4}:){7}([0-9A-Fa-f]{1,4}|:))|(([0-9A-Fa-f]{1,4}:){6}(:[0-9A-Fa-f]{1,4}|((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){5}(((:[0-9A-Fa-f]{1,4}){1,2})|:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3})|:))|(([0-9A-Fa-f]{1,4}:){4}(((:[0-9A-Fa-f]{1,4}){1,3})|((:[0-9A-Fa-f]{1,4})?:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){3}(((:[0-9A-Fa-f]{1,4}){1,4})|((:[0-9A-Fa-f]{1,4}){0,2}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){2}(((:[0-9A-Fa-f]{1,4}){1,5})|((:[0-9A-Fa-f]{1,4}){0,3}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(([0-9A-Fa-f]{1,4}:){1}(((:[0-9A-Fa-f]{1,4}){1,6})|((:[0-9A-Fa-f]{1,4}){0,4}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:))|(:(((:[0-9A-Fa-f]{1,4}){1,7})|((:[0-9A-Fa-f]{1,4}){0,5}:((25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)(\.(25[0-5]|2[0-4]\d|1\d\d|[1-9]?\d)){3}))|:)))(%.+)?\s*$))/; - const portPattern = /^([0-9]{1,4}|[1-5][0-9]{4}|6[0-4][0-9]{3}|65[0-4][0-9]{2}|655[0-2][0-9]|6553[0-5])$/; - this.ranDialogForm = new FormGroup({ - ranType: new FormControl('endc'), - ranName: new FormControl('', [Validators.required, Validators.pattern(namePattern)]), - ranIp: new FormControl('', [Validators.required, Validators.pattern(ipPattern)]), - ranPort: new FormControl('', [Validators.required, Validators.pattern(portPattern)]) - }); - } - - onCancel() { - this.dialogRef.close(); - } - - public setupConnection = (ranFormValue) => { - if (this.ranDialogForm.valid) { - this.executeSetupConnection(ranFormValue); - } - } - - private executeSetupConnection = (ranFormValue) => { - let setupRequest: E2SetupRequest = { - ranName: ranFormValue.ranName, - ranIp: ranFormValue.ranIp, - ranPort: ranFormValue.ranPort - } - if (ranFormValue.ranType === 'endc') { - this.service.endcSetup(setupRequest).subscribe((val: any[]) => {}); - } - else { - this.service.x2Setup(setupRequest).subscribe((val: any[]) => {}); - } - this.dialogRef.close(); - } - - public hasError(controlName: string, errorName: string) { - if (this.ranDialogForm.controls[controlName].hasError(errorName)) - return true; - return false; - } - - public validateControl(controlName: string) { - if (this.ranDialogForm.controls[controlName].invalid && this.ranDialogForm.controls[controlName].touched) - return true; - return false; - } - -} // class AppRANConnectDialog diff --git a/webapp-frontend/src/app/xapp/xapp.component.ts b/webapp-frontend/src/app/xapp/xapp.component.ts index 6e95b438..f337b730 100644 --- a/webapp-frontend/src/app/xapp/xapp.component.ts +++ b/webapp-frontend/src/app/xapp/xapp.component.ts @@ -7,9 +7,9 @@ * 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. -- 2.16.6