diff options
Diffstat (limited to 'usecaseui-portal/src/app/core')
-rw-r--r-- | usecaseui-portal/src/app/core/services/myhttp.service.ts | 174 |
1 files changed, 73 insertions, 101 deletions
diff --git a/usecaseui-portal/src/app/core/services/myhttp.service.ts b/usecaseui-portal/src/app/core/services/myhttp.service.ts index 9ed75b00..bcb83e21 100644 --- a/usecaseui-portal/src/app/core/services/myhttp.service.ts +++ b/usecaseui-portal/src/app/core/services/myhttp.service.ts @@ -24,77 +24,111 @@ export class MyhttpService { constructor(private http: HttpClient) { } baseUrl = baseUrl.baseUrl; url = { + // The following APIs are optimizable listSortMasters: this.baseUrl + "/listSortMasters", customers: this.baseUrl + "/uui-lcm/customers", orchestrators: this.baseUrl + "/uui-lcm/orchestrators", - serviceType: this.baseUrl + "/uui-lcm/customers/" + "*_*" + "/service-subscriptions", servicesTableData: this.baseUrl + '/uui-lcm/service-instances', serviceTemplates: this.baseUrl + "/uui-lcm/service-templates", - templateParameters: this.baseUrl + "/uui-lcm/fetchCCVPNTemplateData/*_*", - e2etemplateParameters: this.baseUrl + "/uui-lcm/service-templates/" + "*_*" + "?toscaModelPath=", - nstemplateParameters: this.baseUrl + "/uui-lcm/fetchNsTemplateData", vimInfo: this.baseUrl + "/uui-lcm/locations/", sdnControllers: this.baseUrl + "/uui-lcm/sdnc-controllers/", - addressData: this.baseUrl + "/uui-sotn/getOssInvenory", createService: this.baseUrl + "/uui-lcm/services", ns_createService: this.baseUrl + "/uui-lcm/createNetworkServiceInstance", ns_createService2: this.baseUrl + "/uui-lcm/instantiateNetworkServiceInstance", - deleteService: this.baseUrl + "/uui-lcm/services/", ns_deleteService: this.baseUrl + "/uui-lcm/deleteNetworkServiceInstance?ns_instance_id=", ns_stopService: this.baseUrl + "/uui-lcm/terminateNetworkServiceInstance?ns_instance_id=", ns_healService: this.baseUrl + "/uui-lcm/healNetworkServiceInstance?ns_instance_id=", + allottedResource: this.baseUrl + "/uui-sotn/getAllottedResources", + // The following APIs are not optimizable + serviceType: this.baseUrl + "/uui-lcm/customers/" + "*_*" + "/service-subscriptions", + templateParameters: this.baseUrl + "/uui-lcm/fetchCCVPNTemplateData/*_*", + e2etemplateParameters: this.baseUrl + "/uui-lcm/service-templates/" + "*_*" + "?toscaModelPath=", + nstemplateParameters: this.baseUrl + "/uui-lcm/fetchNsTemplateData", + deleteService: this.baseUrl + "/uui-lcm/services/", vnfInfo: this.baseUrl + "/uui-lcm/VnfInfo/", progress: this.baseUrl + "/uui-lcm/services/" + "*_*" + "/operations/", nsProgress: this.baseUrl + "/uui-lcm/jobs/getNsLcmJobStatus/" + "*_*" + "?responseId=0&serviceInstanceId=", e2eScale: this.baseUrl + "/services/scaleServices/", e2e_nsdata: this.baseUrl + "/getServiceInstanceById/customerId/", updateccvpn: this.baseUrl + "/uui-lcm/services/updateService/", - - allottedResource: this.baseUrl + "/uui-sotn/getAllottedResources", pnfDetail: this.baseUrl + "/uui-sotn/getPnfInfo/", connectivity: this.baseUrl + "/uui-sotn/getConnectivityInfo/", vpnBinding: this.baseUrl + "/uui-sotn/getPinterfaceByVpnId/", - } + }; - // serviceTable list - getServicesTableData(paramsObj): Observable<HttpResponse<servicesTableData>> { - let params = new HttpParams({ fromObject: paramsObj }); - return this.http.get<servicesTableData>(this.url.servicesTableData, { observe: 'response', params }); - } - //--------------------------------------------------------------------------------- + //The following APIs are optimizable - // Get all customers - getAllCustomers() { - return this.http.get<any>(this.url.customers); - } + // Get all customers + getAllCustomers() { + return this.http.get<any>(this.url.customers); + } + // Get all Orchestrators + getAllOrchestrators() { + return this.http.get<any>(this.url.orchestrators); + } + // serviceTable list + getServicesTableData(paramsObj): Observable<HttpResponse<servicesTableData>> { + let params = new HttpParams({ fromObject: paramsObj }); + return this.http.get<servicesTableData>(this.url.servicesTableData, { observe: 'response', params }); + } + // Get all template types + getAllServiceTemplates(type) { + if (type == "Network Service") { + let nsUrl = this.url.serviceTemplates.replace("service-templates", "listNsTemplates").replace("serviceTemplates2", "serviceTemplates-ns"); + console.log(nsUrl); + return this.http.get<any>(nsUrl); + } + return this.http.get<any>(this.url.serviceTemplates); + } + // Get Vim Info + getVimInfo() { + return this.http.get<any>(this.url.vimInfo); + }; + //Get SdnControllers + getSdnControllers() { + return this.http.get<any>(this.url.sdnControllers); + } + // Create interface + createInstance(requestBody, createParams) { + return this.http.post<any>(this.url.createService + createParams, requestBody); + } + // NS CreateInstance step one + nsCreateInstance(requestBody) { + return this.http.post<any>(this.url.ns_createService, requestBody); + } + // NS CreateInstance step two + nsCreateInstance2(params, requestBody) { + return this.http.post<any>(this.url.ns_createService2 + params, requestBody); + } + //Delete ns Service + nsDeleteInstance(id) { + return this.http.delete<any>(this.url.ns_deleteService + id); + } + //stop ns Service + stopNsService(id, requestBody) { //You need to terminate before deleting + return this.http.post<any>(this.url.ns_stopService + id, requestBody); + } + //heal ns Service + healNsService(id, requestBody) { + return this.http.post<any>(this.url.ns_healService + id, requestBody); + } + //Get allotted-resource to get tp and pnf values + getAllottedResource(obj) { + let params = new HttpParams({ fromObject: obj }); + let url = this.url.allottedResource; + return this.http.get<any>(url, { params }); + } - // Get all Orchestrators - getAllOrchestrators() { - return this.http.get<any>(this.url.orchestrators); - } + //The following APIs are not optimizable --------------------------------- // Get relevant serviceType getServiceTypes(customer) { let url = this.url.serviceType.replace("*_*", customer.id); return this.http.get<any>(url); } - - - // Get all template types - getAllServiceTemplates(type) { - if (type == "Network Service") { - let nsUrl = this.url.serviceTemplates.replace("service-templates", "listNsTemplates").replace("serviceTemplates2", "serviceTemplates-ns"); - console.log(nsUrl); - return this.http.get<any>(nsUrl); - } - return this.http.get<any>(this.url.serviceTemplates); - } - - //Get template input parameters getTemplateParameters(type, template) { - // let url = this.url.templateParameters.replace("*_*",type) + template.toscaModelURL; //Local simulation if (type == "ns") { let body = { csarId: template.id, @@ -114,32 +148,8 @@ export class MyhttpService { return this.http.post<any>(url, body); } } - - getVimInfo() { - return this.http.get<any>(this.url.vimInfo); - }; - getSdnControllers() { - return this.http.get<any>(this.url.sdnControllers); - } - - // Create interface - createInstance(requestBody, createParams) { - // return this.http.get<any>(this.url.createService + createParams); //Local simulation - return this.http.post<any>(this.url.createService + createParams, requestBody); - } - nsCreateInstance(requestBody) { - // return this.http.get<any>(this.url.ns_createService); //Local simulation - return this.http.post<any>(this.url.ns_createService, requestBody); - } - nsCreateInstance2(params, requestBody) { - // return this.http.get<any>(this.url.ns_createService2 + params); //Local simulation - return this.http.post<any>(this.url.ns_createService2 + params, requestBody); - } - + // ccvpn update updateccvpn(id, requestBody) { - console.log(id); - console.log(requestBody); - //return this.http.get<any>(this.url.updateccvpn + id); //local return this.http.put<any>(this.url.updateccvpn + id, requestBody);// online } // Delete interface @@ -155,36 +165,20 @@ export class MyhttpService { 'serviceType': obj.serviceType.name } }; - // return this.http.get<any>(this.url.deleteService); //Local simulation return this.http.delete<any>(this.url.deleteService + obj.serviceInstanceId, httpOptions); } - nsDeleteInstance(id) { - // return this.http.get<any>(this.url.ns_deleteService); //Local simulation - return this.http.delete<any>(this.url.ns_deleteService + id); - } - stopNsService(id, requestBody) { //You need to terminate before deleting - // return this.http.get<any>(this.url.ns_stopService); //Local simulation - return this.http.post<any>(this.url.ns_stopService + id, requestBody); - } - + // Get Vnf Info getVnfInfo(id) { return this.http.get<any>(this.url.vnfInfo + id); } - healNsService(id, requestBody) { - // return this.http.get<any>(this.url.ns_healService); //Local simulation - return this.http.post<any>(this.url.ns_healService + id, requestBody); - } - // scale scaleE2eService(id, requestBody) { - // return this.http.get<any>(this.url.e2eScale + id); return this.http.post<any>(this.url.e2eScale + id, requestBody); } getE2e_nsData(paramsObj) { let params = new HttpParams({ fromObject: paramsObj }); return this.http.get<any>(this.url.e2e_nsdata, { params }); } - // Query progress interface getProgress(obj) { let url = this.url.progress.replace("*_*", obj.serviceId) + obj.operationId + "?operationType=" + obj.operationType; @@ -195,12 +189,6 @@ export class MyhttpService { return this.http.get<any>(url); } - // Get allotted-resource to get tp and pnf values - getAllottedResource(obj) { - let params = new HttpParams({ fromObject: obj }); - let url = this.url.allottedResource; - return this.http.get<any>(url, { params }); - } //Get the corresponding domain (network-resource) by pnf value getPnfDetail(name) { let url = this.url.pnfDetail + name; @@ -216,20 +204,4 @@ export class MyhttpService { let url = this.url.vpnBinding + id; return this.http.get<any>(url); } - // Time formatting milliseconds to normal - dateformater(vmstime) { - if (!vmstime) { - return '' - } - let mstime = Number((vmstime + '').slice(0, 13)); - let time = new Date(mstime); - let year = time.getFullYear(); - let month = time.getMonth() + 1; - let day = time.getDate(); - let hours = time.getHours(); - let minutes = time.getMinutes(); - let seconds = time.getSeconds(); - let formattime = year + '-' + month + '-' + day + ' ' + hours + ':' + minutes + ':' + seconds; - return formattime; - } } |