summaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/core/services/slicingTaskServices.ts
blob: 77b02ba95fbab8024718cf1a18f4cce9e30704af (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
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
/*
    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 { Http } from "../../shared/utils/http";
@Injectable()
export class SlicingTaskServices {
	constructor(private http: HttpClient, private Http: Http) {}
	baseUrl: string = "/api/usecaseui-server/v1/uui-slicing/nsmf";
	url = {
		slicingTaskList:
			this.baseUrl + "/task/business/pageNo/{pageNo}/pageSize/{pageSize}",
		taskProcessingStatus:
			this.baseUrl +
			"/task/{processingStatus}/business/pageNo/{pageNo}/pageSize/{pageSize}",
		auditInfo: this.baseUrl + "/task/{taskId}/auditInfo",
		slicingInstance:
			this.baseUrl +
			"/resource/nsi/instances/pageNo/{pageNo}/pageSize/{pageSize}",
		slicingSubnetInstance:
			this.baseUrl + "/resource/nsi/{nsiId}/nssiInstances",
		subnetInContext:
			this.baseUrl +
			"/resource/nssi/environmentContext/{environmentContext}/instances/pageNo/{pageNo}/pageSize/{pageSize}",
		submitSlicing: this.baseUrl + "/task/auditInfo",
		slicingBasicInfo: this.baseUrl + "/task/{taskId}/taskCreationInfo",
		slicingCreateProgress:
			this.baseUrl + "/task/{taskId}/taskCreationProgress",
		//slicing-business-management
		slicingBusinessList:
			this.baseUrl +
			"/resource/business/pageNo/{pageNo}/pageSize/{pageSize}",
		slicingBusinesQueryOfStatus:
			this.baseUrl +
			"/resource/{businessStatus}/business/pageNo/{pageNo}/pageSize/{pageSize}",
		activateSlicingService: this.baseUrl + "/resource/{serviceId}/activate",
		deactivateSlicingService:
			this.baseUrl + "/resource/{serviceId}/deactivate",
		terminateSlicingService: this.baseUrl + "/resource/{serviceId}",
		queryOperationProgress: this.baseUrl + "/resource/{serviceId}/progress",
		slicingBusinessDetail:
			this.baseUrl + "/resource/business/{businessId}/details",
		//slicing-nsi-management
		slicingNsiList:
			this.baseUrl +
			"/resource/nsi/instances/pageNo/{pageNo}/pageSize/{pageSize}",
		slicingNsiQueryOfStatus:
			this.baseUrl +
			"/resource/nsi/{instanceStatus}/instances/pageNo/{pageNo}/pageSize/{pageSize}",
		slicingNsiDetail: this.baseUrl + "/resource/nsi/{nsiId}/details",
		//slicing-nssi-management
		slicingNssiList:
			this.baseUrl +
			"/resource/nssi/instances/pageNo/{pageNo}/pageSize/{pageSize}",
		slicingNssiQueryOfStatus:
			this.baseUrl +
			"/resource/nssi/instanceStatus/{instanceStatus}/instances/pageNo/{pageNo}/pageSize/{pageSize}",
		slicingNssiDetail: this.baseUrl + "/resource/nssi/{nssiId}/details",
		//csmf
		csmfSlicingBusinessList:
			"/api/usecaseui-server/v1/uui-slicing/csmf/5gSlicing/orders/status/{status}/pageNo/{pageNo}/pageSize/{pageSize}",
		csmfActivate:
			"/api/usecaseui/csmf/5gSlicing/service/{serviceId}/activate",
		csmfDeactivate:
			"/api/usecaseui/csmf/5gSlicing/service/{serviceId}/deactivate",
		csmfTerminate: "/api/usecaseui/csmf/5gSlicing/service/{serviceId}",
		csmfGetProgress:
			"/api/usecaseui/csmf/5gSlicing/service/{serviceId}/progress",
		csmfPurchase: "/api/usecaseui-server/v1/uui-slicing/csmf/5gSlicing",
		//monitor 5G
		fetchTraffic:
			this.baseUrl +
			"/monitoring/queryTimestamp/{queryTimestamp}/trafficData",
		fetchOnlineusers:
			this.baseUrl +
			"/monitoring/queryTimestamp/{queryTimestamp}/onlineUsers",
		fetchBandwidth:
			this.baseUrl +
			"/monitoring/queryTimestamp/{queryTimestamp}/bandwidth",
		getConnectionLinkTable:
			"/api/usecaseui-server/v1/uui-slicing/csmf/5gSlicing/connectionLinks/pageNo/{pageNo}/pageSize/{pageSize}", // :todo
	};

	// Get slicing order task list
	getSlicingTaskList(pageNo: string, pageSize: string, failedCallback?: any) {
		const url = this.url.slicingTaskList
			.replace("{pageNo}", pageNo)
			.replace("{pageSize}", pageSize);
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	// Get list based on task processing status
	getTaskProcessingStatus(
		processingStatus: string,
		pageNo: string,
		pageSize: string,
		failedCallback?: any
	) {
		const url = this.url.taskProcessingStatus
			.replace("{processingStatus}", processingStatus)
			.replace("{pageNo}", pageNo)
			.replace("{pageSize}", pageSize);
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	// Get
	getAuditInfo(taskId: string, failedCallback?: any) {
		const url = this.url.auditInfo.replace("{taskId}", taskId);
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	getSlicingInstance(pageNo: string, pageSize: string, failedCallback?: any) {
		const url = this.url.slicingInstance
			.replace("{pageNo}", pageNo)
			.replace("{pageSize}", pageSize);
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	getSlicingSubnetInstance(nsiId: string, failedCallback?: any) {
		const url = this.url.slicingSubnetInstance.replace("{nsiId}", nsiId);
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	getSubnetInContext(
		context: string,
		pageNo: string,
		pageSize: string,
		failedCallback?: any
	) {
		const url = this.url.subnetInContext
			.replace("{environmentContext}", context)
			.replace("{pageNo}", pageNo)
			.replace("{pageSize}", pageSize);
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	submitSlicing(reqbody, failedCallback?: any) {
		return this.Http.httpAxios(
			"put",
			this.url.submitSlicing,
			reqbody,
			failedCallback
		);
	}
	getSlicingBasicInfo(taskId: string, failedCallback?: any) {
		const url = this.url.slicingBasicInfo.replace("{taskId}", taskId);
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	getSlicingCreateProgress(taskId: string, failedCallback?: any) {
		const url = this.url.slicingCreateProgress.replace("{taskId}", taskId);
		return this.Http.httpAxios("get", url, null, failedCallback);
	}

	// Get slicing business list
	getSlicingBusinessList(
		paramsObj: any,
		isSelect: boolean,
		failedCallback?: any
	) {
		let url = this.url.slicingBusinessList
			.replace("{pageNo}", paramsObj.pageNo)
			.replace("{pageSize}", paramsObj.pageSize);
		if (isSelect) {
			url = this.url.slicingBusinesQueryOfStatus
				.replace("{businessStatus}", paramsObj.businessStatus)
				.replace("{pageNo}", paramsObj.pageNo)
				.replace("{pageSize}", paramsObj.pageSize);
		}
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	// change slicing business activate status
	changeActivateSlicingService(
		paramsObj: any,
		activate: boolean,
		failedCallback?: any
	) {
		let url = this.url.activateSlicingService.replace(
			"{serviceId}",
			paramsObj.serviceId
		);
		if (!activate) {
			url = this.url.deactivateSlicingService.replace(
				"{serviceId}",
				paramsObj.serviceId
			);
		}
		return this.Http.httpAxios("put", url, paramsObj, failedCallback);
	}
	// terminate slicing business
	terminateSlicingService(paramsObj: any, failedCallback?: any) {
		const url = this.url.terminateSlicingService.replace(
			"{serviceId}",
			paramsObj.serviceId
		);
		return this.Http.httpAxios("delete", url, null, failedCallback);
	}
	// query slicing business progress
	getSlicingBusinessProgress(paramsObj: any, failedCallback?: any) {
		let url = this.url.queryOperationProgress.replace(
			"{serviceId}",
			paramsObj.serviceId
		);
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	//get slicingBusinessDetail
	getSlicingBusinessDetail(businessId: string) {
		let url = this.url.slicingBusinessDetail.replace(
			"{businessId}",
			businessId
		);
		return this.Http.httpAxios("get", url);
	}
	// Get slicing nsi list
	getSlicingNsiList(paramsObj, isSelect: boolean, failedCallback?: any) {
		let url = this.url.slicingNsiList
			.replace("{pageNo}", paramsObj.pageNo)
			.replace("{pageSize}", paramsObj.pageSize);
		if (isSelect) {
			url = this.url.slicingNsiQueryOfStatus
				.replace("{instanceStatus}", paramsObj.instanceStatus)
				.replace("{pageNo}", paramsObj.pageNo)
				.replace("{pageSize}", paramsObj.pageSize);
		}
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	//get slicingNsiDetail
	getSlicingNsiDetail(nsiId: string) {
		let url = this.url.slicingNsiDetail.replace("{nsiId}", nsiId);
		return this.Http.httpAxios("get", url);
	}
	// Get slicing nssi list
	getSlicingNssiList(paramsObj, isSelect: boolean, failedCallback?: any) {
		let url = this.url.slicingNssiList
			.replace("{pageNo}", paramsObj.pageNo)
			.replace("{pageSize}", paramsObj.pageSize);
		if (isSelect) {
			url = this.url.slicingNssiQueryOfStatus
				.replace("{instanceStatus}", paramsObj.instanceStatus)
				.replace("{pageNo}", paramsObj.pageNo)
				.replace("{pageSize}", paramsObj.pageSize);
		}
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	//get slicingNssiDetail
	getSlicingNssiDetail(nssiId: string) {
		let url = this.url.slicingNssiDetail.replace("{nssiId}", nssiId);
		return this.Http.httpAxios("get", url);
	}
	// Get CSMF slicing business list
	getCSMFSlicingBusinessList(paramsObj: any, failedCallback?: any) {
		let url = this.url.csmfSlicingBusinessList
			.replace("{status}", paramsObj.status)
			.replace("{pageNo}", paramsObj.pageNo)
			.replace("{pageSize}", paramsObj.pageSize);
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
	// change CSMF slicing business activate status
	csmfChangeActivate(paramsObj, activate: boolean, failedCallback?: any) {
		let url = this.url.csmfActivate.replace(
			"{serviceId}",
			paramsObj.serviceId
		);
		if (!activate) {
			url = this.url.csmfDeactivate.replace(
				"{serviceId}",
				paramsObj.serviceId
			);
		}
		return this.Http.httpAxios("put", url, paramsObj, failedCallback);
	}
	// terminate CSMF slicing business
	// csmfTerminate(paramsObj) {
	//     const url = this.url.csmfTerminate.replace('{serviceId}', paramsObj.serviceId);
	//     return this.http.delete<any>(url);
	// }
	// // query CSMF slicing business progress
	// csmfSlicingProgress(paramsObj) {
	//     let url = this.url.csmfGetProgress.replace("{serviceId}", paramsObj.serviceId);
	//     return this.http.get<any>(url);
	// }
	csmfSlicingPurchase(paramsObj: any, failedCallback?: any) {
		let url = this.url.csmfPurchase;
		return this.Http.httpAxios("post", url, paramsObj, failedCallback);
	}

	//monitor 5G
	getFetchTraffic(service_list, time, failedCallback?: any) {
		let url = this.url.fetchTraffic.replace("{queryTimestamp}", time);
		return this.Http.httpAxios("post", url, service_list, failedCallback);
	}
	getFetchOnlineusers(service_list, time, failedCallback?: any) {
		let url = this.url.fetchOnlineusers.replace("{queryTimestamp}", time);
		return this.Http.httpAxios("post", url, service_list, failedCallback);
	}
	getFetchBandwidth(service_list, time, failedCallback?: any) {
		let url = this.url.fetchBandwidth.replace("{queryTimestamp}", time);
		return this.Http.httpAxios("post", url, service_list, failedCallback);
	}
	// get the detail information of connection links
	getConnectionLinkTable(paramsObj: any, failedCallback?: any) {
		// :todo
		let url = this.url.getConnectionLinkTable
			.replace("{pageNo}", paramsObj.pageNo)
			.replace("{pageSize}", paramsObj.pageSize);
		return this.Http.httpAxios("get", url, null, failedCallback);
	}
}