summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/core/services/onboard.service.ts
blob: 20d9c244673db51a9fd683f04bc50af40b55adfb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
/*
    Copyright (C) 2019 CMCC, Inc. and others. All rights reserved.

    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.
*/
import { Injectable } from '@angular/core';
import { HttpClient, HttpHeaders, HttpParams, HttpResponse } from '@angular/common/http';
import { Observable } from 'rxjs/Observable';
import { baseUrl } from '../models/dataInterface';

@Injectable()
export class onboardService {
    constructor(private http: HttpClient) { }

    baseUrl = baseUrl.baseUrl;
    url = {
        onboardTableData: this.baseUrl + "/uui-lcm/ns-packages",
        onboardDataVNF: this.baseUrl + "/uui-lcm/vnf-packages",
        onboardDataPNF: this.baseUrl + "/uui-lcm/pnf-packages",
        onboardDataModel: this.baseUrl + "/intent/listModel",
        sdc_nsListData: this.baseUrl + "/uui-lcm/sdc-ns-packages", // GET
        sdc_vnfListData: this.baseUrl + "/uui-lcm/sdc-vf-packages", // GET
        onboardNs: this.baseUrl + "/uui-lcm/ns-packages", //POST
        analysisInput: this.baseUrl + "/intent/predict", //POST
        onboardVNF: this.baseUrl + "/uui-lcm/vf-packages", //POST
        deleteNspack: this.baseUrl + "/uui-lcm/deleteNsdPackage",
        deleteModelpack: this.baseUrl + "/intent/deleteModel",
        // Delete Vnf vfc package
        deleteVnfPack: this.baseUrl + "/uui-lcm/deleteVnfPackage",
        // Delete Pnf package
        deletePnfPack: this.baseUrl + "/uui-lcm/deletePnfPackage",
        creatensData: this.baseUrl + "/uui-lcm/_jsonData", //POST
        progress: this.baseUrl + "/uui-lcm/jobs/_jobId" ,
    };

    //The following APIs function are optimizable------------------------

    /* Query data list */
    // NS Data
    getOnboardTableData() {
        return this.http.get<any>(this.url["onboardTableData"]);
    }
    // NS SDC Data
    getSDC_NSTableData() {
        return this.http.get<any>(this.url["sdc_nsListData"]);
    }
    // VNF Data
    getOnboardTableVnfData() {
        return this.http.get<any>(this.url.onboardDataVNF);
    }
    // onboard VNF sdc Data
    getSDC_VNFTableData() {
        return this.http.get<any>(this.url["sdc_vnfListData"]);
    }
    // PNF Data
    getOnboardTablePnfData() {
        return this.http.get<any>(this.url.onboardDataPNF);
    }
    // MODEL Data
    getOnboardTableModelData() {
      return this.http.get<any>(this.url.onboardDataModel);
    }
     // MODEL Data
    getOnboardTableActiveModelData(url) {
      return this.http.get<any>(url);
    }
    analysisInputText(requestBody) {
      return this.http.post<any>(this.url["analysisInput"], requestBody);
    }
    //onboard sdc ns
    getNsonboard(requestBody) {
        return this.http.post<any>(this.url["onboardNs"], requestBody);
    }
    //onboard sdc vnf
    getVnfonboard(requestBody) {
        return this.http.post<any>(this.url["onboardVNF"], requestBody);
    }
    // Delete ns vfc package
    deleteNsIdData(paramsObj) {
        let params = new HttpParams({ fromObject: {"nsdInfoId":paramsObj }});
        return this.http.delete<any>(this.url.deleteNspack,{params});
    }
    // Delete Vnf vfc package
    deleteVnfIdData(paramsObj) {
        let params = new HttpParams({ fromObject: {"vnfPkgId":paramsObj }});
        return this.http.delete<any>(this.url.deleteVnfPack, {params});
    }
    // Delete Pnf package
    deletePnfIdData(paramsObj) {
        let params = new HttpParams({ fromObject: {"pnfdInfoId":paramsObj }});
        return this.http.delete<any>(this.url.deletePnfPack , {params});
    }
    // Delete model package
    deleteModelIdData(paramsObj) {
      let params = new HttpParams({ fromObject: { "modelId": paramsObj }});
      return this.http.delete<any>(this.url.deleteModelpack,{params});
    }
    // The following APIs function are not optimizable-------------------

    //create--Get the id after dragging the file before uploading
    getCreatensData(url_upId, requestBody) {
        return this.http.post<any>(this.url.creatensData.replace("_jsonData", url_upId), requestBody);
    }
    //onboard progress
    getProgress(jobid, responseId) {
        let params = new HttpParams({fromObject: {"responseId": responseId}})
        let url = this.url.progress.replace("_jobId", jobid) + responseId;
        return this.http.get<any>(url,{params});
    }

}