From 52fb178dc3cd639a3efa89803b226ccdc53b287d Mon Sep 17 00:00:00 2001 From: guochuyicmri Date: Fri, 2 Nov 2018 19:31:11 +0800 Subject: heal nsService and vnfService Change-Id: I0d1124221d1b04f4a314c2b93dcf9e0cdce2b3c7 Issue-ID: USECASEUI-163 Signed-off-by: guochuyicmri --- usecaseui-portal/src/app/myhttp.service.ts | 6 ++ .../services-list/services-list.component.html | 56 ++++++++++++- .../services-list/services-list.component.ts | 96 ++++++++++++++++++++-- 3 files changed, 149 insertions(+), 9 deletions(-) (limited to 'usecaseui-portal/src') diff --git a/usecaseui-portal/src/app/myhttp.service.ts b/usecaseui-portal/src/app/myhttp.service.ts index 14d81aef..5cdc67f6 100644 --- a/usecaseui-portal/src/app/myhttp.service.ts +++ b/usecaseui-portal/src/app/myhttp.service.ts @@ -35,6 +35,7 @@ export class MyhttpService { // ns_deleteService: this.baseUrl + "/deleteNsService.json?", // ns_stopService: this.baseUrl + "/stopNsService.json?", // ns_healService: this.baseUrl + "/healNsService.json?", + // vnfInfo: this.baseUrl + "/vnfInfo.json?", // progress:this.baseUrl + "/progress.json?", // nsProgress:this.baseUrl + "nsProgress.json?", @@ -75,6 +76,7 @@ export class MyhttpService { 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=", @@ -221,6 +223,10 @@ export class MyhttpService { // return this.http.get(this.url.ns_stopService); //Local simulation return this.http.post(this.url.ns_stopService + id,requestBody); } + + getVnfInfo(id){ + return this.http.get(this.url.vnfInfo + id) + } healNsService(id,requestBody){ // return this.http.get(this.url.ns_healService); //Local simulation return this.http.post(this.url.ns_healService + id,requestBody); diff --git a/usecaseui-portal/src/app/services/services-list/services-list.component.html b/usecaseui-portal/src/app/services/services-list/services-list.component.html index cfb81703..616d5b39 100644 --- a/usecaseui-portal/src/app/services/services-list/services-list.component.html +++ b/usecaseui-portal/src/app/services/services-list/services-list.component.html @@ -119,9 +119,11 @@ - + - + @@ -137,14 +139,14 @@ - + -

Are you sure delete this instance?

+

Are you sure delete this instance?

Instance ID: {{ thisService["service-instance-id"] || thisService["nsInstanceId"] }}
terminationType: @@ -156,6 +158,52 @@
+ +

Are you sure heal this instance?

+ Instance ID: {{ thisService["service-instance-id"] || thisService["nsInstanceId"] || thisService["vnfInstanceId"]}} + +
+ degreeHealing: + + + + + + +
+ actionsHealing: + +
+
+ +   +
+
+ healScript: + +
+ additionalParamsforNs: + +
+
+ Key:   + Value: + +
+
+
+ +
+ cause: + + action: + + actionvminfo: + + + +
+
diff --git a/usecaseui-portal/src/app/services/services-list/services-list.component.ts b/usecaseui-portal/src/app/services/services-list/services-list.component.ts index aecc6f2c..9da7cf9c 100644 --- a/usecaseui-portal/src/app/services/services-list/services-list.component.ts +++ b/usecaseui-portal/src/app/services/services-list/services-list.component.ts @@ -166,19 +166,88 @@ export class ServicesListComponent implements OnInit { this.getTableData(); } + thisService = {}; //The current service of the operation scaleService(){ console.log("scaleService!"); } updataService(){ console.log("updataService!"); } - stopService(data){ + //heal + healModelVisible = false; + healActions = []; + nsAdditional = []; + nsParams = { + degreeHealing:"HEAL_RESTORE", + actionsHealing: [ + + ], + healScript: "", + additionalParamsforNs: "" } - restartService(data){ - + vnfVms = []; + vmSelected = {}; + vnfParams = { + vnfInstanceId: "", + cause: "", + additionalParams: { + action: "", + actionvminfo: { + vmid: "", + vduid: "", + vmname: "" + } + } } - // + addActionsHealing(){ + this.healActions.push({value:""}) + } + minusActionsHealing(index){ + this.healActions.splice(index,1); + } + addNsAdditional(){ + this.nsAdditional.push({key:"",value:""}) + } + minusNsAdditional(index){ + this.nsAdditional.splice(index,1); + } + healService(service){ + // console.log(service); + this.thisService = service; + this.healModelVisible = true; + if(service.serviceDomain == "vnf"){ + this.vnfParams.vnfInstanceId = service.vnfInstanceId; + this.myhttp.getVnfInfo(service.vnfInstanceId) + .subscribe((data)=>{ + // console.log(data); + this.vnfVms = data.vnfVms; + this.vmSelected = this.vnfVms[0]; + }) + } + } + healOk(){ + this.healModelVisible = false; + // nsParams + this.nsParams.actionsHealing = this.healActions.map((item)=>{return item.value}); + let additional = {}; + this.nsAdditional.forEach((item)=>{ + additional[item.key] = item.value; + }); + this.nsParams.additionalParamsforNs = JSON.stringify(additional); + // vnfParams + this.vnfParams.additionalParams.actionvminfo.vmid = this.vmSelected["vmId"]; + this.vnfParams.additionalParams.actionvminfo.vmname = this.vmSelected["vmName"]; + + let requestBody = this.thisService["serviceDomain"] == "Network Service" ? {healNsData:this.nsParams} : {healVnfData:this.vnfParams}; + console.log(requestBody); + this.healNsVnfService(this.thisService,requestBody); + } + healCancel(){ + this.healModelVisible = false; + } + + // show detail detailshow = false; detailData:Object; serviceDetail(service){ @@ -199,7 +268,6 @@ export class ServicesListComponent implements OnInit { console.log(service); } - thisService = {}; deleteModelVisible = false; terminationType = "graceful"; gracefulTerminationTimeout = 120; @@ -443,6 +511,24 @@ export class ServicesListComponent implements OnInit { return mypromise; } + healNsVnfService(service,requestBody){ + console.log(service); + service.rate = 0; + service.status = "Healing"; + this.myhttp.healNsService(service.nsInstanceId,requestBody) + .subscribe((data)=>{ + let jobid = data.jobId; + let updata = (prodata)=>{ + service.rate = prodata.responseDescriptor.progress; + } + this.queryNsProgress(jobid,updata).then((data1)=>{ + console.log(data1); + service.rate = 100; + service.status = "Active"; + }); + }) + } + deleteService(service){ let allprogress = {}; // let querypros = []; // -- cgit 1.2.3-korg