aboutsummaryrefslogtreecommitdiffstats
path: root/usecaseui-portal/src/app/core
diff options
context:
space:
mode:
authorcyuamber <xuranyjy@chinamobile.com>2019-08-22 16:55:57 +0800
committercyuamber <xuranyjy@chinamobile.com>2019-08-22 16:56:09 +0800
commitd0f5347dc16b5aa9fc95eb520fbc9a1c7b672b09 (patch)
treeb3891d8de290d755d7f0f00d35bb77d3b89ad747 /usecaseui-portal/src/app/core
parent56923755c761897cc86ca2457667fcc3e6a0e43f (diff)
feat: change the project structure and add mock data function
Change-Id: I381845bff5eb37d1fab3eba8cf1ae7838df523b7 Issue-ID: USECASEUI-307 Signed-off-by: cyuamber <xuranyjy@chinamobile.com>
Diffstat (limited to 'usecaseui-portal/src/app/core')
-rw-r--r--usecaseui-portal/src/app/core/models/dataInterface.ts57
-rw-r--r--usecaseui-portal/src/app/core/services/homes.service.spec.ts15
-rw-r--r--usecaseui-portal/src/app/core/services/homes.service.ts131
-rw-r--r--usecaseui-portal/src/app/core/services/managemencs.service.ts91
-rw-r--r--usecaseui-portal/src/app/core/services/myhttp.service.ts235
-rw-r--r--usecaseui-portal/src/app/core/services/networkHttpservice.service.ts122
-rw-r--r--usecaseui-portal/src/app/core/services/onboard.service.ts182
-rw-r--r--usecaseui-portal/src/app/core/services/text.service.spec.ts15
-rw-r--r--usecaseui-portal/src/app/core/services/text.service.ts43
9 files changed, 891 insertions, 0 deletions
diff --git a/usecaseui-portal/src/app/core/models/dataInterface.ts b/usecaseui-portal/src/app/core/models/dataInterface.ts
new file mode 100644
index 00000000..e092bd03
--- /dev/null
+++ b/usecaseui-portal/src/app/core/models/dataInterface.ts
@@ -0,0 +1,57 @@
+enum baseUrl{
+ baseUrl = '/api/usecaseui-server/v1' //online
+ // baseUrl = 'http://172.19.44.223/api/usecaseui-server/v1' //local one
+ // baseUrl = 'http://10.73.191.100:8082' //local two
+}
+interface homeData {
+ services:{
+ number:number,
+ chartdata:Object[]
+ },
+ performance:{
+ per_Vnf:number,
+ per_VmPm:number
+ },
+ alarm:{
+ chartdata:Object[]
+ },
+ Vm_performance:{
+ names:string[]
+ }
+};
+
+interface homeVmLineData {
+ CPU:number[],
+ Memory:number[]
+}
+
+interface servicesSelectData {
+ customer:string[],
+ serviceType:string[]
+}
+
+interface servicesTableData {
+ total:number,
+ tableList:string[]
+}
+
+interface creatensData {
+ total:number,
+ tableList:string[]
+}
+
+interface onboardTableData {
+ total:number,
+ tableList:string[]
+}
+
+interface onboardDataVNF {
+ total:number,
+ tableList:string[]
+}
+
+interface onboardDataPNF {
+ total:number,
+ tableList:string[]
+}
+export {homeData, homeVmLineData, servicesSelectData, servicesTableData, creatensData, onboardTableData, onboardDataVNF, onboardDataPNF , baseUrl}
diff --git a/usecaseui-portal/src/app/core/services/homes.service.spec.ts b/usecaseui-portal/src/app/core/services/homes.service.spec.ts
new file mode 100644
index 00000000..9c03dcb2
--- /dev/null
+++ b/usecaseui-portal/src/app/core/services/homes.service.spec.ts
@@ -0,0 +1,15 @@
+import { TestBed, inject } from '@angular/core/testing';
+
+import { HomesService } from './homes.service';
+
+describe('HomesService', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [HomesService]
+ });
+ });
+
+ it('should be created', inject([HomesService], (service: HomesService) => {
+ expect(service).toBeTruthy();
+ }));
+});
diff --git a/usecaseui-portal/src/app/core/services/homes.service.ts b/usecaseui-portal/src/app/core/services/homes.service.ts
new file mode 100644
index 00000000..8d3f4684
--- /dev/null
+++ b/usecaseui-portal/src/app/core/services/homes.service.ts
@@ -0,0 +1,131 @@
+/*
+ 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 { homeData, homeVmLineData, servicesSelectData, servicesTableData, creatensData, onboardTableData, onboardDataVNF, onboardDataPNF, baseUrl } from '../models/dataInterface';
+
+@Injectable()
+export class HomesService {
+
+ constructor(private http: HttpClient) { }
+ baseUrl = baseUrl.baseUrl;
+ baseUrlbar = baseUrl.baseUrl + "/uui-lcm/";
+ url = {
+ home_serviceData: this.baseUrl + "/uui-lcm/serviceNumByCustomer",
+ home_performanceData: this.baseUrl + "/performance/queryAllSourceNames",
+ home_alarmData: this.baseUrl + "/alarm/statusCount",
+ home_alarmChartData: this.baseUrl + "/alarm/diagram",
+ home_servicebarData: this.baseUrl + "",
+ home_servicebarnsData: this.baseUrlbar + "ns-packages",
+ home_servicebarvnfData: this.baseUrlbar + "vnf-packages",
+ home_servicebarpnfData: this.baseUrlbar + "pnf-packages",
+ sourceNames: this.baseUrl + "/alarm/getSourceNames",
+ listSortMasters: this.baseUrl + "/listSortMasters",
+ currentLanguage: "/api/portal-auxapi/languageSetting/user/",
+ }
+
+ // 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;
+ }
+
+
+ // home
+ getHomeServiceData() {
+ return this.http.get<any>(this.url.home_serviceData);
+ }
+ getHomePerformanceData() {
+ return this.http.get<String[]>(this.url.home_performanceData);
+ }
+ getHomeAlarmData() {
+ return this.http.get<any>(this.url.home_alarmData);
+ }
+ getHomeAlarmChartData(paramsObj) {
+ let params = new HttpParams({ fromObject: paramsObj });
+ return this.http.get<any>(this.url.home_alarmChartData, { params });
+ }
+
+ getHomeServiceBarData() {
+ return this.http.get<any>(this.url.home_servicebarData);
+ }
+ getHomeServiceBarNsData() {
+ return this.http.get<any>(this.url.home_servicebarnsData);
+ }
+ getHomeServiceBarVnfData() {
+ return this.http.get<any>(this.url.home_servicebarvnfData);
+ }
+ getHomeServiceBarPnfData() {
+ return this.http.get<any>(this.url.home_servicebarpnfData);
+ }
+
+ // alarm data
+ getAlarmFormData(currentPage: number, pageSize: number, sourceName?: string, priority?: string, startTime?: string, endTime?: string, vfStatus?: string) {
+ return this.http.get<any>(this.baseUrl + '/alarm/' + '/' + currentPage + '/' + pageSize + '?sourceName=' + sourceName + '&priority=' + priority + '&startTime=' + startTime + '&endTime=' + endTime + '&vfStatus=' + vfStatus);
+ }
+
+ getSourceNames() {
+ return this.http.get<any>(this.baseUrl + '/alarm/getSourceNames/');
+ }
+
+ getstatuscount() {
+ let httpurl = this.baseUrl + '/alarm/statusCount';
+ return this.http.get<any>(httpurl);
+ }
+ getAlarmDetailData(id) {
+ let httpurl = this.baseUrl + '/alarm/getAlarmsHeaderDetail/' + id;
+ return this.http.get<any>(httpurl);
+ }
+
+ // performance data
+ getqueryAllSourceNames() {
+ let httpurl = this.baseUrl + "/performance/queryAllSourceNames";
+ return this.http.get<any>(httpurl);
+ }
+ getperformanceSourceNames(currentPage: number, pageSize: number, sourceName: string) {
+ let httpurl = this.baseUrl + "/performanceSsourceNames" + "/" + currentPage + "/" + pageSize + "?sourceName=" + sourceName;
+ return this.http.get<any>(httpurl);
+ }
+ getPerformanceFormData(currentPage: number, pageSize: number, sourceName?: string, startTime?: string, endTime?: string) {
+ return this.http.get<any>(this.baseUrl + '/performance' + '/' + currentPage + '/' + pageSize + '?sourceName=' + sourceName + '&startTime=' + startTime + '&endTime=' + endTime);
+ }
+ getPerformanceHeaderDetail(id) {
+ let httpurl = this.baseUrl + '/performance/getPerformanceHeaderDetail/' + id;
+ return this.http.get<any>(httpurl);
+ }
+
+
+ getListSortMasters() {
+ return this.http.get<any>(this.url.listSortMasters);
+ }
+
+ getCurrentLanguage(currentloginId) {
+ let url = this.url.currentLanguage + currentloginId;
+ return this.http.get<any>(url);
+ }
+}
diff --git a/usecaseui-portal/src/app/core/services/managemencs.service.ts b/usecaseui-portal/src/app/core/services/managemencs.service.ts
new file mode 100644
index 00000000..a28885d8
--- /dev/null
+++ b/usecaseui-portal/src/app/core/services/managemencs.service.ts
@@ -0,0 +1,91 @@
+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 ManagemencsService {
+
+ constructor(private http: HttpClient) { }
+ baseUrl = baseUrl.baseUrl;
+
+
+
+
+ /* line up */
+ url = {
+ customers: this.baseUrl + "/uui-lcm/customers", /* get */
+ serviceType: this.baseUrl + "/uui-lcm/customers/" + "*_*" + "/service-subscriptions", /* get */
+ CustomersPir: this.baseUrl + "/uui-lcm/serviceNumByCustomer", /* get */
+ CustomersColumn: this.baseUrl + "/uui-lcm/serviceNumByServiceType/" + "*_*", /* get */
+ createCustomer: this.baseUrl + "/uui-lcm/customers/", /* put */
+ createServiceType: this.baseUrl + "/uui-lcm/customers/*_*/service-subscriptions/*+*", /* put */
+ getCustomerresourceVersion: this.baseUrl + "/uui-lcm/customers/*_*", /* put */
+ deleteCustomer: this.baseUrl + "/uui-lcm/customers?customerId=*_*&resourceVersion=*+*",
+ getServiceTypeResourceVersion: this.baseUrl + "/uui-lcm/customers/*_*/service-subscriptions/*+*",
+ deleteServiceType: this.baseUrl + "/uui-lcm/customers/*_*/service-subscriptions/*+*?resourceVersion=*@* ",
+ };
+
+
+ // Get all customers
+ getAllCustomers() {
+ return this.http.get<any>(this.url.customers);
+ }
+ // get all servicetype
+ getServiceTypes(customer) {
+ let url = this.url.serviceType.replace("*_*", customer.id);
+ console.log(url)
+ return this.http.get<any>(url);
+ }
+ // get Customer Pir
+ getCustomersPie() {
+ return this.http.get<any>(this.url.CustomersPir);
+ }
+ // get Customer ber
+ getCustomersColumn(customer) {
+ let url = this.url.CustomersColumn.replace("*_*", customer.id);
+ return this.http.get<any>(url);
+ }
+ // create New Customer
+ createCustomer(customer, createParams) {
+ let url = this.url.createCustomer + customer;
+ // return this.http.get(url, createParams);//location
+ return this.http.put(url, createParams);//online
+ }
+
+ createServiceType(createParams) {
+ let customerId = createParams.customer.id,
+ ServiceType = createParams.ServiceType;
+ let url = this.url.createServiceType.replace("*_*", customerId).replace("*+*", ServiceType);
+ // return this.http.get(url,createParams);//location
+ return this.http.put(url, createParams);//online
+ }
+
+ getdeleteCustomerVersion(thisdeleteCustomer) {
+ let url = this.url.getCustomerresourceVersion.replace("*_*", thisdeleteCustomer.id);
+ return this.http.get(url);
+ }
+
+ deleteSelectCustomer(params) {
+ let customerId = params.customerId,
+ version = params.version;
+ let url = this.url.deleteCustomer.replace("*_*", customerId).replace("*+*", version);
+ return this.http.delete(url);
+ }
+
+ getdeleteServiceTypeVersion(params) {
+ let customerId = params.customerId.id,
+ ServiceType = params.ServiceType;
+ let url = this.url.getServiceTypeResourceVersion.replace("*_*", customerId).replace("*+*", ServiceType);
+ return this.http.get(url);
+ }
+
+ deleteSelectServiceType(params) {
+ let customerId = params.customerId.id,
+ ServiceType = params.ServiceType,
+ version = params.version;
+ let url = this.url.deleteServiceType.replace("*_*", customerId).replace("*+*", ServiceType).replace("*@*", version);
+ return this.http.delete(url);
+ }
+}
diff --git a/usecaseui-portal/src/app/core/services/myhttp.service.ts b/usecaseui-portal/src/app/core/services/myhttp.service.ts
new file mode 100644
index 00000000..9ed75b00
--- /dev/null
+++ b/usecaseui-portal/src/app/core/services/myhttp.service.ts
@@ -0,0 +1,235 @@
+/*
+ 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 { homeData, homeVmLineData, servicesSelectData, servicesTableData, creatensData, onboardTableData, onboardDataVNF, onboardDataPNF, baseUrl } from '../models/dataInterface';
+
+@Injectable()
+export class MyhttpService {
+
+ constructor(private http: HttpClient) { }
+ baseUrl = baseUrl.baseUrl;
+ url = {
+ 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=",
+ 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 });
+ }
+
+ //---------------------------------------------------------------------------------
+
+ // Get all customers
+ getAllCustomers() {
+ return this.http.get<any>(this.url.customers);
+ }
+
+ // Get all Orchestrators
+ getAllOrchestrators() {
+ return this.http.get<any>(this.url.orchestrators);
+ }
+
+ // 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,
+ inputs: ""
+ };
+ return this.http.post<any>(this.url.nstemplateParameters, body);
+ } else if (type == "e2e") {
+ let url = this.url.e2etemplateParameters.replace("*_*", template.uuid) + template.toscaModelURL;
+ return this.http.get<any>(url);
+ } else {
+ let body = {
+ csarId: template.uuid,
+ packageType: "Service",
+ inputs: ""
+ };
+ let url = this.url.templateParameters.replace("*_*", template.uuid);
+ 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);
+ }
+
+ 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
+ deleteInstance(obj) {
+ let httpOptions = {
+ headers: new HttpHeaders({
+ 'Content-Type': 'application/json',
+ 'Accept': 'application/json',
+ 'Authorization': 'Basic SW5mcmFQb3J0YWxDbGllbnQ6cGFzc3dvcmQxJA=='
+ }),
+ body: {
+ 'globalSubscriberId': obj.globalSubscriberId,
+ '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);
+ }
+
+ 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;
+ return this.http.get<any>(url);
+ }
+ getNsProgress(jobid, serviceId, operationType) {
+ let url = this.url.nsProgress.replace("*_*", jobid) + serviceId + "&operationType=" + operationType;
+ 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;
+ return this.http.get<any>(url);
+ }
+ //Get connectivity by sotn, find vpn-id
+ getSotnConnectivity(id) {
+ let url = this.url.connectivity + id;
+ return this.http.get<any>(url);
+ }
+ //Find tp and pnf by vpn-id
+ getVpnBinding(id) {
+ 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;
+ }
+}
diff --git a/usecaseui-portal/src/app/core/services/networkHttpservice.service.ts b/usecaseui-portal/src/app/core/services/networkHttpservice.service.ts
new file mode 100644
index 00000000..8af6d292
--- /dev/null
+++ b/usecaseui-portal/src/app/core/services/networkHttpservice.service.ts
@@ -0,0 +1,122 @@
+/*
+ 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 { baseUrl } from '../models/dataInterface';
+
+
+@Injectable()
+export class networkHttpservice {
+
+ constructor(private http: HttpClient) { }
+
+ // baseUrl = "./assets/json/";//Local environment
+ // url={
+ // "getNetworkD3Data":this.baseUrl + "netWorkD3Data.json",
+ // "getLogicalLinksData":this.baseUrl + "LogicalLinksData.json",
+ // "getPInterfacesData1":this.baseUrl + "netWorkD3Data.json",
+ // "getPInterfacesData2":this.baseUrl + "p_interfaces1.json",
+ // "createLink":this.baseUrl + "status.json",
+ // "querySpecificLinkInfo":this.baseUrl + "specific_link _nfo.json",
+ // "queryCloudUrl":this.baseUrl + "url.json",
+ // "createNetwrok":this.baseUrl + "status.json",
+ // "createPnf":this.baseUrl + "status.json",
+ // "createTp":this.baseUrl + "status.json",
+ // "createCloudLink":this.baseUrl + "status.json",
+ // "createCloudUrl":this.baseUrl + "status.json",
+ // "deleteLink":this.baseUrl + "status.json",
+ // };
+ // baseUrl = "http://10.73.242.244:8082/uui-sotn/";//Online environment
+ // baseUrl = "http://172.19.44.223/api/usecaseui-server/v1/uui-sotn/";//Online environment
+ baseUrl = baseUrl.baseUrl + "/uui-sotn/";//Online environment
+ url = {
+ "getNetworkD3Data": this.baseUrl + "getNetWorkResources",
+ "getLogicalLinksData": this.baseUrl + "getLogicalLinks",
+ "getPInterfacesData1": this.baseUrl + "getPinterfaceByPnfName/",
+ "getPInterfacesData2": this.baseUrl + "getPinterfaceByPnfName/",
+ "createLink": this.baseUrl + "createLink/",
+ "querySpecificLinkInfo": this.baseUrl + "getSpecificLogicalLink/",
+ "queryCloudUrl": this.baseUrl + "getHostUrl/",
+ "queryExtAAIIdVersion": this.baseUrl + "getExtAaiId/",
+ "createNetwrok": this.baseUrl + "createTopoNetwork/",
+ "createPnf": this.baseUrl + "createPnf/",
+ "createTp": this.baseUrl + "pnf/",
+ "createCloudLink": this.baseUrl + "createLink/",
+ "createCloudUrl": this.baseUrl + "createHostUrl/",
+ "deleteLink": this.baseUrl + "deleteLink/",
+ "deleteCloud": this.baseUrl + "deleteExtNetWork"
+ };
+ //d3data
+ getNetworkD3Data() {
+ return this.http.get<any>(this.url["getNetworkD3Data"]);
+ }
+ //Initialize the connection logical-links
+ getLogicalLinksData() {
+ return this.http.get<any>(this.url["getLogicalLinksData"]);
+ }
+ //Query the tp data corresponding to the specified node
+ getPInterfacesData1(paramsObj) {
+ return this.http.get<any>(this.url['getPInterfacesData1'] + paramsObj["pnfName"]);
+ }
+ getPInterfacesData2(paramsObj) {
+ return this.http.get<any>(this.url["getPInterfacesData2"] + paramsObj["pnfName"]);
+ }
+ //Create a connection interface
+ createLink(paramsObj) {
+ return this.http.put<any>(this.url["createLink"] + paramsObj["link-name"], paramsObj);
+ }
+ //Query the specified single cable interface
+ querySpecificLinkInfo(paramsObj) {
+ return this.http.get<any>(this.url["querySpecificLinkInfo"] + paramsObj["link-name"]);
+ }
+ //Query external cloud host this.url address interface
+ queryCloudUrl(aaiId) {
+ return this.http.get<any>(this.url["queryCloudUrl"] + aaiId);
+ }
+ queryExtAAIIdVersion(aaiId) {
+ return this.http.get<any>(this.url["queryExtAAIIdVersion"] + aaiId);
+ }
+ //Create an external cloud newwork interface
+ createNetwrok(paramsObj) {
+ return this.http.put<any>(this.url["createNetwrok"] + paramsObj["network-id"], paramsObj);
+ }
+ //Create an external cloud pnf interface
+ createPnf(paramsObj) {
+ return this.http.put<any>(this.url["createPnf"] + paramsObj["pnf-name"], paramsObj);
+ }
+ //Create an external cloud Tp interface
+ createTp(paramsObj, cloudNodeName) {
+ let str = cloudNodeName + "/p-interfaces/p-interface/" + paramsObj["interface-name"] + "/createTerminationPoint";
+ return this.http.put<any>(this.url["createTp"] + str, paramsObj);
+ }
+ //Create an external cloud link interface
+ createCloudLink(paramsObj) {
+ return this.http.put<any>(this.url["createCloudLink"] + paramsObj["link-name"], paramsObj);
+ }
+ //Create an external cloud host url interface
+ createCloudUrl(paramsObj) {
+ return this.http.put<any>(this.url["createCloudUrl"] + paramsObj["aai-id"], paramsObj);
+ }
+ //Delete connection
+ deleteLink(paramsObj) {
+ let str = paramsObj["logical-link"] + "/" + paramsObj["resource-version"];
+ return this.http.delete<any>((this.url["deleteLink"] + str));
+ }
+ deleteCloudLink(paramsObj) {
+ let str = "?extNetworkId=" + paramsObj["aaiId"] + "&resourceVersion=" + paramsObj["version"];
+ return this.http.delete<any>((this.url["deleteCloud"] + str));
+ }
+}
diff --git a/usecaseui-portal/src/app/core/services/onboard.service.ts b/usecaseui-portal/src/app/core/services/onboard.service.ts
new file mode 100644
index 00000000..fb5107b4
--- /dev/null
+++ b/usecaseui-portal/src/app/core/services/onboard.service.ts
@@ -0,0 +1,182 @@
+/*
+ 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 { onboardTableData, onboardDataVNF, onboardDataPNF, baseUrl } from '../models/dataInterface';
+
+@Injectable()
+export class onboardService {
+ constructor(private http: HttpClient) { }
+ /* location */
+ // baseUrl = "./assets/json";
+ // url = {
+ // // list data
+ // onboardTableData: this.baseUrl + "/onboard-vnf-mf/onboardTableData.json",
+ // onboardDataVNF: this.baseUrl + "/onboard-vnf-mf/onboardDataVNF.json",
+ // onboardDataPNF: this.baseUrl + "/onboard-vnf-mf/onboardDataPNF.json",
+ // //ns sdc
+ // sdc_nsListData: this.baseUrl + "/onboard-vnf-mf/listData/SDC_NS.json",
+ // // vnf sdc
+ // sdc_vnfListData: this.baseUrl + "/onboard-vnf-mf/listData/SDC_VNF.json",
+
+
+ // //create nspackages
+ // creatensData: this.baseUrl + "/onboard-vnf-mf/_jsonData.json",
+
+ // //onboard ns sdc data
+ // onboardNs: this.baseUrl + "/onboard-vnf-mf/listData/onboardNs.json",
+ // //onboard VNF sdc data
+ // onboardVNF: this.baseUrl + "/onboard-vnf-mf/listData/onboardVNF.json",
+
+ // // Delete ns package
+ // deleteNspack: this.baseUrl + "/onboard-vnf-mf/listData/deleteNspack.json",
+ // // Delete ns sdc package
+ // // deleteNssdcData: this.baseUrl + "/onboard-vnf-mf/listData/deleteNssdcData.json",
+
+ // // Delete Vnf vfc package
+ // deleteVnfPack: this.baseUrl + "/onboard-vnf-mf/listData/deleteVnfPack.json",
+ // // Delete Vnf sdc package
+ // // deleteVnfsdcData: this.baseUrl + "/onboard-vnf-mf/listData/deleteVnfsdcData.json",
+
+ // // Delete Pnf package
+ // deletePnfPack: this.baseUrl + "/onboard-vnf-mf/listData/deletePnfPack.json",
+
+ // // // download ns package
+ // // downloadNsData: this.baseUrl + "/downloadData.json",
+ // // //download vnf package
+ // // downloadVnfData: this.baseUrl + "/listData/downloadVnfData.json"
+
+ // }
+
+ //---------------------------------------------------------------------------------------
+ /* line up*/
+ baseUrl = baseUrl.baseUrl + "/uui-lcm/";
+ url = {
+ // list Data
+ onboardTableData: this.baseUrl + "ns-packages",
+ onboardDataVNF: this.baseUrl + "vnf-packages",
+ onboardDataPNF: this.baseUrl + "pnf-packages",
+ //ns sdc
+ sdc_nsListData: this.baseUrl + "sdc-ns-packages", // GET
+ // vnf sdc
+ sdc_vnfListData: this.baseUrl + "sdc-vf-packages", // GET
+
+ // createnspackages ? TODO
+ creatensData: this.baseUrl + "_jsonData", //POST
+
+ // onboard ns sdc data
+ onboardNs: this.baseUrl + "ns-packages", //POST
+ //onboard VNF sdc data
+ onboardVNF: this.baseUrl + "vf-packages", //POST
+
+ //Delete ns package
+ deleteNspack: this.baseUrl + "deleteNsdPackage?nsdInfoId=",
+ // Delete Vnf vfc package
+ deleteVnfPack: this.baseUrl + "deleteVnfPackage?vnfPkgId=",
+ // Delete Pnf package
+ deletePnfPack: this.baseUrl + "deletePnfPackage?pnfdInfoId=",
+
+ //Progress interface
+ progress: this.baseUrl + "jobs/" + "_jobId" + "?responseId="
+
+
+ // // download ns package
+ // downloadNsData: this.baseUrl + "downLoadNsPackage?nsdInfoId=XXXXX",
+ // //download vnf package
+ // downloadVnfData: this.baseUrl + "downLoadVnfPackage?vnfPkgId=XXXXX"
+
+ }
+
+ //-----------------------------------Function-local-start------------------------------------------------------
+ /* Query data list */
+ // NS Data
+ getOnboardTableData() {
+ // return this.http.get<any>(this.url.onboardTableData);
+ return this.http.get<any>(this.url["onboardTableData"]);
+ }
+ // NS SDC Data
+ getSDC_NSTableData() {
+ // return this.http.get<any>(this.url.sdc_nsListData);
+ 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);
+ }
+ //-------------------------------------------------------------------------------------
+
+ //create--Get the id after dragging the file before uploading //on-line post
+ getCreatensData(url_upId, requestBody) {
+ return this.http.post<any>(this.url.creatensData.replace("_jsonData", url_upId), requestBody); //on-line
+ }
+
+ //create--Get the id after dragging the file before uploading //local json get
+ // getCreatensData(url_upId) {
+ // return this.http.get<any>(this.url.creatensData.replace("_jsonData", url_upId));
+ // }
+
+ //------------------------------------------------------------------------------
+ //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);
+ }
+
+ //onboard progress
+ getProgress(jobid, responseId) {
+ let url = this.url.progress.replace("_jobId", jobid) + responseId;
+ return this.http.get<any>(url);
+ }
+ //--------------------------------------------------------------------------
+ // Delete ns vfc package
+ deleteNsIdData(paramsObj) {
+ // local test
+ // return this.http.get<any>(this.url.deleteNspack);
+ // Online test
+ return this.http.delete<any>(this.url.deleteNspack + paramsObj);
+ }
+
+ // Delete Vnf vfc package
+ deleteVnfIdData(paramsObj) {
+ // return this.http.get<any>(this.url.deleteVnfPack);
+ //online test
+ return this.http.delete<any>(this.url.deleteVnfPack + paramsObj);
+ }
+
+ // Delete Pnf package
+ deletePnfIdData(paramsObj) {
+ //Local test
+ // return this.http.get<any>(this.url.deletePnfPack);
+ //online test
+ return this.http.delete<any>(this.url.deletePnfPack + paramsObj);
+ }
+
+ //---------------------------------Function-end-------------------------------------------
+
+}
diff --git a/usecaseui-portal/src/app/core/services/text.service.spec.ts b/usecaseui-portal/src/app/core/services/text.service.spec.ts
new file mode 100644
index 00000000..7b4d9efc
--- /dev/null
+++ b/usecaseui-portal/src/app/core/services/text.service.spec.ts
@@ -0,0 +1,15 @@
+import { TestBed, inject } from '@angular/core/testing';
+
+import { TextService } from './text.service';
+
+describe('TextService', () => {
+ beforeEach(() => {
+ TestBed.configureTestingModule({
+ providers: [TextService]
+ });
+ });
+
+ it('should be created', inject([TextService], (service: TextService) => {
+ expect(service).toBeTruthy();
+ }));
+});
diff --git a/usecaseui-portal/src/app/core/services/text.service.ts b/usecaseui-portal/src/app/core/services/text.service.ts
new file mode 100644
index 00000000..26a2caad
--- /dev/null
+++ b/usecaseui-portal/src/app/core/services/text.service.ts
@@ -0,0 +1,43 @@
+/*
+ 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 } from '@angular/common/http';
+
+@Injectable()
+export class TextService {
+ constructor(private http: HttpClient) { }
+ //---------------------------------------------------------------------------------------
+ /* line up*/
+ baseUrl = "/api";
+ url = {
+ textInterface: this.baseUrl + "/user/login",
+ singleInterface: this.baseUrl + "/home",
+ doubleInterface: this.baseUrl + "/customer/info",
+ multipleInterface: this.baseUrl + "/alarm/formdata/multiple",
+ jsonInterface: this.baseUrl + "/xuran/test/data",
+ }
+
+ //-----------------------------------Function-local-start------------------------------------------------------
+ /* Query data list */
+ getfakeData() {
+ return this.http.get<any>(this.url["singleInterface"]);
+ }
+ getjsonData() {
+ return this.http.get<any>(this.url["jsonInterface"]);
+ }
+ //-------------------------------------------------------------------------------------
+
+}