2 * ========================LICENSE_START=================================
5 * Copyright (C) 2019 AT&T Intellectual Property
7 * Licensed under the Apache License, Version 2.0 (the "License");
8 * you may not use this file except in compliance with the License.
9 * You may obtain a copy of the License at
11 * http://www.apache.org/licenses/LICENSE-2.0
13 * Unless required by applicable law or agreed to in writing, software
14 * distributed under the License is distributed on an "AS IS" BASIS,
15 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16 * See the License for the specific language governing permissions and
17 * limitations under the License.
18 * ========================LICENSE_END===================================
20 import { HttpClient, HttpResponse } from '@angular/common/http';
21 import { Injectable } from '@angular/core';
22 import { Observable } from 'rxjs';
23 import { map } from 'rxjs/operators';
24 import { DashboardSuccessTransport } from '../../interfaces/dashboard.types';
25 import { E2RanDetails } from '../../interfaces/e2-mgr.types';
26 import { DashboardService } from '../dashboard/dashboard.service';
32 export class E2ManagerService {
34 private component = 'e2mgr';
35 private nodebPath = 'nodeb';
38 private dashboardSvc: DashboardService,
39 private httpClient: HttpClient) {
43 * Gets E2 client version details
44 * @returns Observable that yields a String
46 getVersion(instanceKey: string): Observable<string> {
47 const path = this.dashboardSvc.buildPath(this.component, null, 'version');
48 return this.httpClient.get<DashboardSuccessTransport>(path).pipe(
49 // Extract the string here
50 map(res => res['data'])
56 * @returns Observable that yields an array of E2RanDetails objects
58 getRan(instanceKey: string): Observable<Array<E2RanDetails>> {
59 const path = this.dashboardSvc.buildPath(this.component, instanceKey, this.nodebPath, 'ran');
60 return this.httpClient.get<Array<E2RanDetails>>(path);
64 * Sends a request to drop all RAN connections
65 * @returns Observable with body.
67 nodebPut(instanceKey: string): Observable<any> {
68 const path = this.dashboardSvc.buildPath(this.component, instanceKey, this.nodebPath, 'shutdown');
69 return this.httpClient.put(path, { observe: 'body' });