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 { Injectable } from '@angular/core';
21 import { HttpClient, HttpResponse } from '@angular/common/http';
22 import { Observable } from 'rxjs';
23 import { map } from 'rxjs/operators';
24 import { E2RanDetails, E2SetupRequest } from '../../interfaces/e2-mgr.types';
25 import { DashboardSuccessTransport } from '../../interfaces/dashboard.types';
31 export class E2ManagerService {
33 private basePath = 'api/e2mgr/nodeb/';
35 constructor(private httpClient: HttpClient) {
36 // injects to variable httpClient
40 * Gets E2 client version details
41 * @returns Observable that should yield a String
43 getVersion(): Observable<string> {
44 const url = this.basePath + 'version';
45 return this.httpClient.get<DashboardSuccessTransport>(url).pipe(
46 // Extract the string here
47 map(res => res['data'])
53 * @returns Observable that should yield an array of objects
55 getRan(): Observable<Array<E2RanDetails>> {
56 return this.httpClient.get<Array<E2RanDetails>>(this.basePath + 'ran');
60 * Sends a request to setup an ENDC/gNodeB connection
61 * @returns Observable. On success there is no data, only a code.
63 endcSetup(req: E2SetupRequest): Observable<HttpResponse<Object>> {
64 return this.httpClient.post(this.basePath + 'endc-setup', req, { observe: 'response' });
68 * Sends a request to setup an X2/eNodeB connection
69 * @returns Observable. On success there is no data, only a code.
71 x2Setup(req: E2SetupRequest): Observable<HttpResponse<Object>> {
72 return this.httpClient.post(this.basePath + 'x2-setup', req, { observe: 'response' });
76 * Sends a request to drop all RAN connections
77 * @returns Observable with body.
79 nodebPut(): Observable<any> {
80 return this.httpClient.put((this.basePath + 'shutdown'), { observe: 'body' });