Upgrade Angular and Spring-Boot
[portal/ric-dashboard.git] / webapp-frontend / src / app / services / e2-mgr / e2-mgr.service.ts
1 /*-
2  * ========================LICENSE_START=================================
3  * O-RAN-SC
4  * %%
5  * Copyright (C) 2019 AT&T Intellectual Property and Nokia
6  * %%
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
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
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===================================
19  */
20 import { Injectable } from '@angular/core';
21 import { HttpClient } from '@angular/common/http';
22 import { E2SetupRequest } from '../../interfaces/e2-mgr.types';
23
24 @Injectable({
25   providedIn: 'root'
26 })
27
28 export class E2ManagerService {
29
30   private basePath = 'api/e2mgr/';
31
32   constructor(private httpClient: HttpClient) {
33     // injects to variable httpClient
34   }
35
36   /**
37    * Gets E2 manager client version details
38    * @returns Observable that should yield a DashboardSuccessTransport object
39    */
40   getE2ManagerVersion() {
41     return this.httpClient.get(this.basePath + 'version');
42   }
43
44   /**
45    * Gets setup request history
46    * @returns Observable that should yield an array of objects
47    */
48   getAll() {
49     return this.httpClient.get(this.basePath + 'setup');
50   }
51
52   /**
53    * Sends a request to setup an ENDC/gNodeB connection
54    * @returns Observable
55    */
56   endcSetup(req: E2SetupRequest) {
57     return this.httpClient.post(this.basePath + 'endcSetup', req);
58   }
59
60   /**
61    * Sends a request to setup an X2/eNodeB connection
62    * @returns Observable
63    */
64   x2Setup(req: E2SetupRequest) {
65     return this.httpClient.post(this.basePath + 'x2Setup', req);
66   }
67
68   /**
69    * Sends a request to drop all RAN connections
70    * @returns Observable
71    */
72   nodebDelete() {
73     return this.httpClient.delete((this.basePath + 'nodeb'), { observe: 'response' });
74   }
75
76 }