From 523d6758f1b4672cd3f603da0ec4cef4c0e9b5ff Mon Sep 17 00:00:00 2001 From: Isabel Lloret Date: Tue, 29 Apr 2025 08:06:54 +0000 Subject: [PATCH] Feature 11052: support for vms remote console for plugin vcenter Change-Id: I328f4626dda94d9c4322c285b1e9216ed8f03673 Signed-off-by: Isabel Lloret --- src/app/AppModule.ts | 2 + .../ns-instances/NSInstancesComponent.ts | 92 +++-- .../NSInstancesActionComponent.html | 4 + .../NSInstancesActionComponent.ts | 31 ++ .../ShowVduConsoleComponent.html | 71 ++++ .../ShowVduConsoleComponent.scss | 17 + .../ShowVduConsoleComponent.ts | 340 ++++++++++++++++++ src/assets/i18n/de.json | 3 + src/assets/i18n/en.json | 3 + src/assets/i18n/es.json | 3 + src/assets/i18n/pt.json | 3 + src/models/CommonModel.ts | 1 + src/models/NSInstanceModel.ts | 13 + tsconfig.json | 1 + 14 files changed, 549 insertions(+), 35 deletions(-) create mode 100644 src/app/utilities/show-vdu-console/ShowVduConsoleComponent.html create mode 100644 src/app/utilities/show-vdu-console/ShowVduConsoleComponent.scss create mode 100644 src/app/utilities/show-vdu-console/ShowVduConsoleComponent.ts diff --git a/src/app/AppModule.ts b/src/app/AppModule.ts index cd145c3..d8689af 100644 --- a/src/app/AppModule.ts +++ b/src/app/AppModule.ts @@ -73,6 +73,7 @@ import { SharedService } from 'SharedService'; import { ShowInfoComponent } from 'ShowInfoComponent'; import { SidebarComponent } from 'SidebarComponent'; import { StartStopRebuildComponent } from 'StartStopRebuildComponent'; +import { ShowVduConsoleComponent } from 'ShowVduConsoleComponent'; import { SwitchProjectComponent } from 'SwitchProjectComponent'; import { UsersActionComponent } from 'UsersActionComponent'; import { UserSettingsComponent } from 'UserSettingsComponent'; @@ -136,6 +137,7 @@ const customNotifierOptions: NotifierOptions = { NsUpdateComponent, WarningComponent, StartStopRebuildComponent, + ShowVduConsoleComponent, HealingComponent, NSConfigTemplateActionComponent, OkaPackagesActionComponent diff --git a/src/app/instances/ns-instances/NSInstancesComponent.ts b/src/app/instances/ns-instances/NSInstancesComponent.ts index 34719f3..065a56b 100644 --- a/src/app/instances/ns-instances/NSInstancesComponent.ts +++ b/src/app/instances/ns-instances/NSInstancesComponent.ts @@ -30,9 +30,11 @@ import { LocalDataSource, Ng2SmartTableComponent } from 'ng2-smart-table'; import { NSDInstanceData, NSInstanceDetails } from 'NSInstanceModel'; import { NSInstancesActionComponent } from 'NSInstancesActionComponent'; import { RestService } from 'RestService'; -import { Subscription } from 'rxjs'; +import { forkJoin, Subscription } from 'rxjs'; import { isNullOrUndefined } from 'SharedService'; import { SharedService } from 'SharedService'; +import { VimAccountDetails } from 'VimAccountModel'; + /** * Creating component @@ -246,42 +248,62 @@ export class NSInstancesComponent implements OnInit { /** generateData initiate the ns-instance list @public */ public generateData(): void { this.isLoadingResults = true; - this.restService.getResource(environment.NSDINSTANCES_URL).subscribe((nsdInstancesData: NSInstanceDetails[]): void => { - this.nsInstanceData = []; - nsdInstancesData.forEach((nsdInstanceData: NSInstanceDetails): void => { - const nsDataObj: NSDInstanceData = { - name: nsdInstanceData.name, - identifier: nsdInstanceData.id, - NsdName: nsdInstanceData['nsd-name-ref'], - OperationalStatus: nsdInstanceData['operational-status'], - ConfigStatus: nsdInstanceData['config-status'], - DetailedStatus: nsdInstanceData['detailed-status'], - memberIndex: nsdInstanceData.nsd.df, - nsConfig: nsdInstanceData.nsd['ns-configuration'], - adminDetails: nsdInstanceData._admin, - vnfID: nsdInstanceData['vnfd-id'], - nsd: nsdInstanceData.nsd, - 'nsd-id': nsdInstanceData['nsd-id'], - vcaStatus: nsdInstanceData.vcaStatus, - constituent: nsdInstanceData['constituent-vnfr-ref'], - 'create-time': this.sharedService.convertEpochTime(Number(nsdInstanceData['create-time'])) - }; - this.nsInstanceData.push(nsDataObj); - }); - if (this.nsInstanceData.length > 0) { - this.checkDataClass = 'dataTables_present'; - } else { - this.checkDataClass = 'dataTables_empty'; - } - this.dataSource.load(this.nsInstanceData).then((data: {}): void => { + forkJoin([ + this.restService.getResource(environment.VIMACCOUNTS_URL), + this.restService.getResource(environment.NSDINSTANCES_URL) + ]).subscribe({ + next: ([vimAccounts, nsdInstancesData]: [VimAccountDetails[], NSInstanceDetails[]]) => { + // Transforms vimAccounts to a map (will be used to enrich ns instance data) + const vimsMap = this.transformVimListToMap(vimAccounts); + + // Transform nsInstances to the format needed in the web + this.nsInstanceData = []; + nsdInstancesData.forEach((nsdInstanceData: NSInstanceDetails): void => { + const nsDataObj: NSDInstanceData = { + name: nsdInstanceData.name, + identifier: nsdInstanceData.id, + NsdName: nsdInstanceData['nsd-name-ref'], + OperationalStatus: nsdInstanceData['operational-status'], + ConfigStatus: nsdInstanceData['config-status'], + DetailedStatus: nsdInstanceData['detailed-status'], + memberIndex: nsdInstanceData.nsd.df, + nsConfig: nsdInstanceData.nsd['ns-configuration'], + adminDetails: nsdInstanceData._admin, + vnfID: nsdInstanceData['vnfd-id'], + nsd: nsdInstanceData.nsd, + 'nsd-id': nsdInstanceData['nsd-id'], + vcaStatus: nsdInstanceData.vcaStatus, + constituent: nsdInstanceData['constituent-vnfr-ref'], + 'create-time': this.sharedService.convertEpochTime(Number(nsdInstanceData['create-time'])), + vimType: vimsMap.get(nsdInstanceData['datacenter'])?.vim_type + }; + this.nsInstanceData.push(nsDataObj); + }); + if (this.nsInstanceData.length > 0) { + this.checkDataClass = 'dataTables_present'; + } else { + this.checkDataClass = 'dataTables_empty'; + } + this.dataSource.load(this.nsInstanceData).then((data: {}): void => { + this.isLoadingResults = false; + }).catch((): void => { + // Catch Navigation Error + }); + }, + error: (error: ERRORDATA): void => { + this.restService.handleError(error, 'get'); this.isLoadingResults = false; - }).catch((): void => { - // Catch Navigation Error - }); - }, (error: ERRORDATA): void => { - this.restService.handleError(error, 'get'); - this.isLoadingResults = false; + } + }); + } + + /** transforms vim list to map to be able to recover vim data fast by name */ + private transformVimListToMap(vimList: VimAccountDetails[]): Map { + const vimMap = new Map(); + vimList.forEach((vim) => { + vimMap.set(vim._id, vim); }); + return vimMap; } /** smart table listing manipulation @public */ diff --git a/src/app/utilities/ns-instances-action/NSInstancesActionComponent.html b/src/app/utilities/ns-instances-action/NSInstancesActionComponent.html index c2f8a78..c19acc4 100644 --- a/src/app/utilities/ns-instances-action/NSInstancesActionComponent.html +++ b/src/app/utilities/ns-instances-action/NSInstancesActionComponent.html @@ -49,6 +49,10 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i [disabled]="operationalStatus === 'failed' || configStatus === 'failed'" ngbTooltip="{{'VMMIGRATION' | translate}}"> {{'VMMIGRATION' | translate}} +
diff --git a/src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts b/src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts index 8ae776f..2d2575e 100644 --- a/src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts +++ b/src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts @@ -36,6 +36,7 @@ import { forkJoin, Observable } from 'rxjs'; import { ScalingComponent } from 'ScalingComponent'; import { SharedService, isNullOrUndefined } from 'SharedService'; import { ShowInfoComponent } from 'ShowInfoComponent'; +import { ShowVduConsoleComponent } from 'ShowVduConsoleComponent'; import { StartStopRebuildComponent } from 'StartStopRebuildComponent'; import { VmMigrationComponent } from 'VmMigrationComponent'; import { DF, VDU, VNFD } from 'VNFDModel'; @@ -89,6 +90,12 @@ export class NSInstancesActionComponent { /** Contains operational dashboard view @public */ public isShowOperationalDashboard: boolean = false; + /** Controls to show additional operations buttons */ + public showConsoleAction: boolean = false; + + /** Vim types for wich console operation button must be show */ + private static readonly NS_CONSOLE_OPERATION_VIM_TYPES: string[] = ['vcenter']; + /** Instance of the modal service @private */ private modalService: NgbModal; @@ -146,6 +153,15 @@ export class NSInstancesActionComponent { } this.isShowOperationalDashboard = !isNullOrUndefined(this.value.vcaStatus) ? Object.keys(this.value.vcaStatus).length === 0 && typeof this.value.vcaStatus === 'object' : true; + // Check if additional operations buttons must be showns + this.checkShowExtraActionsButtons(); + } + + /** Checks if the console option in the actions dropdown must be shown */ + private checkShowExtraActionsButtons() { + if (NSInstancesActionComponent.NS_CONSOLE_OPERATION_VIM_TYPES.includes(this.value.vimType)) { + this.showConsoleAction = true; + } } /** Shows information using modalservice @public */ @@ -349,6 +365,21 @@ export class NSInstancesActionComponent { }); } + /** Open the show remote console pop-up @public */ + public openConsole(): void { + const modalRef: NgbModalRef = this.modalService.open(ShowVduConsoleComponent, { backdrop: 'static' }); + modalRef.componentInstance.params = { + id: this.instanceID + }; + modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => { + if (result) { + this.sharedService.callData(); + } + }).catch((): void => { + // Catch Navigation Error + }); + } + /** Open the Healing pop-up @public */ public openHealing(): void { // eslint-disable-next-line security/detect-non-literal-fs-filename diff --git a/src/app/utilities/show-vdu-console/ShowVduConsoleComponent.html b/src/app/utilities/show-vdu-console/ShowVduConsoleComponent.html new file mode 100644 index 0000000..613f3cc --- /dev/null +++ b/src/app/utilities/show-vdu-console/ShowVduConsoleComponent.html @@ -0,0 +1,71 @@ + + +
+ + +
+ \ No newline at end of file diff --git a/src/app/utilities/show-vdu-console/ShowVduConsoleComponent.scss b/src/app/utilities/show-vdu-console/ShowVduConsoleComponent.scss new file mode 100644 index 0000000..11a6e59 --- /dev/null +++ b/src/app/utilities/show-vdu-console/ShowVduConsoleComponent.scss @@ -0,0 +1,17 @@ +/* + Copyright 2020 TATA ELXSI + + 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. + + Author: Isabel Lloret (illoret@minsait.com) +*/ \ No newline at end of file diff --git a/src/app/utilities/show-vdu-console/ShowVduConsoleComponent.ts b/src/app/utilities/show-vdu-console/ShowVduConsoleComponent.ts new file mode 100644 index 0000000..47fc2ad --- /dev/null +++ b/src/app/utilities/show-vdu-console/ShowVduConsoleComponent.ts @@ -0,0 +1,340 @@ +/* + Copyright 2020 TATA ELXSI + + 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. + + Author: I.Lloret +*/ +/** + * @file ShowVduConsoleComponent Component + */ +import { HttpHeaders } from '@angular/common/http'; +import { Component, Injector, Input, OnInit } from '@angular/core'; +import { AbstractControl, FormBuilder, FormGroup, Validators } from '@angular/forms'; +import { Router } from '@angular/router'; +import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap'; +import { TranslateService } from '@ngx-translate/core'; +import { NotifierService } from 'angular-notifier'; +import { APIURLHEADER, ERRORDATA, MODALCLOSERESPONSEDATA, URLPARAMS } from 'CommonModel'; +import { environment } from 'environment'; +import { ShowVduConsole, OperateVnfResult } from 'NSInstanceModel'; +import { RestService } from 'RestService'; +import { SharedService, isNullOrUndefined } from 'SharedService'; +import { DF, VNFD } from 'VNFDModel'; +import { InstanceData, VDUR, VNFInstanceDetails } from 'VNFInstanceModel'; + +/** + * Creating component + * @Component takes ShowVduConsoleComponent.html as template url + */ +@Component({ + selector: 'app-show-vdu-console', + templateUrl: './ShowVduConsoleComponent.html', + styleUrls: ['./ShowVduConsoleComponent.scss'] +}) +export class ShowVduConsoleComponent implements OnInit { + /** To inject services @public */ + public injector: Injector; + /** Instance for active modal service @public */ + public activeModal: NgbActiveModal; + /** Check the loading results @public */ + public isLoadingResults: Boolean = false; + /** Give the message for the loading @public */ + public message: string = 'PLEASEWAIT'; + /** FormGroup instance added to the form @ html @public */ + public consoleForm: FormGroup; + /** Items for the memberVNFIndex @public */ + public memberTypes: {}[]; + /** Contains MemberVNFIndex values @public */ + public memberVnfIndex: {}[] = []; + /** Contains vnfInstanceId of the selected MemberVnfIndex @public */ + public instanceId: string; + /** Items for vduId & countIndex @public */ + public vdu: {}[]; + /** Selected VNFInstanceId @public */ + public selectedvnfId: string = ''; + /** Check day1-2 operation @public */ + /** TODO - show remove this probably */ + public 'day1-2': boolean; + /** Array holds VNFR Data filtered with nsr ID @public */ + public nsIdFilteredData: {}[] = []; + /** Form valid on submit trigger @public */ + public submitted: boolean = false; + /** Contains vduId @public */ + public vduId: {}; + /** Items for countIndex @public */ + public countIndex: {}[]; + /** Input contains component objects @private */ + @Input() private params: URLPARAMS; + /** FormBuilder instance added to the formBuilder @private */ + private formBuilder: FormBuilder; + /** Instance of the rest service @private */ + private restService: RestService; + /** Notifier service to popup notification @private */ + private notifierService: NotifierService; + /** Contains tranlsate instance @private */ + private translateService: TranslateService; + /** Controls the header form @private */ + private headers: HttpHeaders; + private consoleRequestStartTime: number; + /** Contains all methods related to shared @private */ + private sharedService: SharedService; + /** Holds the instance of AuthService class of type AuthService @private */ + private router: Router; + constructor(injector: Injector) { + this.injector = injector; + this.restService = this.injector.get(RestService); + this.notifierService = this.injector.get(NotifierService); + this.translateService = this.injector.get(TranslateService); + this.activeModal = this.injector.get(NgbActiveModal); + this.formBuilder = this.injector.get(FormBuilder); + this.sharedService = this.injector.get(SharedService); + this.router = this.injector.get(Router); + } + /** convenience getter for easy access to form fields */ + get f(): FormGroup['controls'] { return this.consoleForm.controls; } + /** + * Lifecyle Hooks the trigger before component is instantiate + */ + public ngOnInit(): void { + this.initializeForm(); + this.getMemberVnfIndex(); + this.headers = new HttpHeaders({ + 'Content-Type': 'application/json', + Accept: 'application/json', + 'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0' + }); + } + /** Initialize start, stop or rebuild Forms @public */ + public initializeForm(): void { + this.consoleForm = this.formBuilder.group({ + memberVnfIndex: [null, [Validators.required]], + vduId: [null, [Validators.required]], + countIndex: [null, [Validators.required]] + }); + } + + /** Getting MemberVnfIndex using VNFInstances API @public */ + public getMemberVnfIndex(): void { + this.isLoadingResults = true; + const vnfInstanceData: {}[] = []; + this.restService.getResource(environment.VNFINSTANCES_URL).subscribe((vnfInstancesData: VNFInstanceDetails[]): void => { + vnfInstancesData.forEach((vnfData: VNFInstanceDetails): void => { + const vnfdRef: string = 'vnfd-ref'; + const memberIndex: string = 'member-vnf-index-ref'; + const nsrId: string = 'nsr-id-ref'; + const vnfId: string = 'vnfd-id'; + const vnfDataObj: {} = + { + // eslint-disable-next-line security/detect-object-injection + VNFD: vnfData[vnfdRef], + VNFInstanceId: vnfData._id, + // eslint-disable-next-line security/detect-object-injection + MemberIndex: vnfData[memberIndex], + // eslint-disable-next-line security/detect-object-injection + NS: vnfData[nsrId], + // eslint-disable-next-line security/detect-object-injection + VNFID: vnfData[vnfId] + }; + vnfInstanceData.push(vnfDataObj); + }); + const nsId: string = 'NS'; + // eslint-disable-next-line security/detect-object-injection + this.nsIdFilteredData = vnfInstanceData.filter((vnfdData: {}[]): boolean => vnfdData[nsId] === this.params.id); + this.nsIdFilteredData.forEach((resVNF: InstanceData): void => { + const assignMemberIndex: {} = { + id: resVNF.MemberIndex, + vnfinstanceId: resVNF.VNFInstanceId + }; + this.memberVnfIndex.push(assignMemberIndex); + }); + this.memberTypes = this.memberVnfIndex; + this.isLoadingResults = false; + }, (error: ERRORDATA): void => { + this.restService.handleError(error, 'get'); + this.isLoadingResults = false; + }); + } + + /** Getting vdu-id & count-index from VNFInstance API */ + public getVdu(id: string): void { + const vnfInstanceData: {}[] = []; + this.getFormControl('vduId').setValue(null); + this.getFormControl('countIndex').setValue(null); + if (!isNullOrUndefined(id)) { + this.restService.getResource(environment.VNFINSTANCES_URL + '/' + id). + subscribe((vnfInstanceDetail: VNFInstanceDetails[]): void => { + this.instanceId = id; + this.selectedvnfId = vnfInstanceDetail['vnfd-ref']; + const VDU: string = 'vdur'; + // eslint-disable-next-line security/detect-object-injection + if (vnfInstanceDetail[VDU] !== undefined) { + // eslint-disable-next-line security/detect-object-injection + vnfInstanceDetail[VDU].forEach((vdu: VDUR): void => { + const vnfInstanceDataObj: {} = + { + 'count-index': vdu['count-index'], + VDU: vdu['vdu-id-ref'] + }; + vnfInstanceData.push(vnfInstanceDataObj); + }); + this.vdu = vnfInstanceData; + const vduName: string = 'VDU'; + this.vduId = this.vdu.filter((vdu: {}, index: number, self: {}[]): {} => + index === self.findIndex((t: {}): {} => ( + // eslint-disable-next-line security/detect-object-injection + t[vduName] === vdu[vduName] + )) + ); + } + this.checkDay12Operation(this.selectedvnfId); + }, (error: ERRORDATA): void => { + this.restService.handleError(error, 'get'); + this.isLoadingResults = false; + }); + } + } + + /** Getting count-index by filtering id */ + public getCountIndex(id: string): void { + const VDU: string = 'VDU'; + // eslint-disable-next-line security/detect-object-injection + this.countIndex = this.vdu.filter((vnfdData: {}[]): boolean => vnfdData[VDU] === id); + } + + /** To check primitve actions from VNFR */ + public checkDay12Operation(id: string): void { + const apiUrl: string = environment.VNFPACKAGES_URL + '?id=' + id; + this.restService.getResource(apiUrl).subscribe((vnfdInfo: VNFD[]): void => { + const vnfInstances: VNFD = vnfdInfo[0]; + if (!isNullOrUndefined(vnfInstances.df)) { + vnfInstances.df.forEach((df: DF): void => { + if (df['lcm-operations-configuration'] !== undefined) { + if (df['lcm-operations-configuration']['operate-vnf-op-config']['day1-2'] !== undefined) { + this['day1-2'] = true; + } + } else { + this['day1-2'] = false; + } + }); + } + }, (error: ERRORDATA): void => { + this.isLoadingResults = false; + this.restService.handleError(error, 'get'); + }); + } + + /** Check and sends a request to get console */ + public prepareGetConsole(): void { + this.submitted = true; + this.sharedService.cleanForm(this.consoleForm); + if (this.consoleForm.invalid) { return; } // Proceed, onces form is valid + const prepareConsolePayload: ShowVduConsole = { + updateType: 'OPERATE_VNF', + operateVnfData: { + vnfInstanceId: this.instanceId, + changeStateTo: 'console', + additionalParam: { + 'run-day1': false, + vdu_id: this.consoleForm.value.vduId, + 'count-index': this.consoleForm.value.countIndex + } + } + }; + this.startGetConsole(prepareConsolePayload); + } + + /** Initialize get console operation @public */ + public startGetConsole(prepareConsolePayload: object): void { + this.message = 'LAUNCHINGCONSOLE'; + this.consoleRequestStartTime = Date.now(); + this.isLoadingResults = true; + const apiURLHeader: APIURLHEADER = { + url: environment.NSDINSTANCES_URL + '/' + this.params.id + '/update', + httpOptions: { headers: this.headers } + }; + const modalData: MODALCLOSERESPONSEDATA = { + message: 'Done' + }; + this.restService.postResource(apiURLHeader, prepareConsolePayload).subscribe((result: OperateVnfResult): void => { + // Start waiting for the operation to complete + this.waitOperationCompleted(result.id); + }, (error: ERRORDATA): void => { + this.restService.handleError(error, 'post'); + this.isLoadingResults = false; + }); + } + + private waitOperationCompleted(operationId: string): void { + let elapsedTime = 0; + const interval = 3000; // 3 seconds interval between status checks + const maxWaitTime = 2 * 60 * 1000; // 2 minutes in milliseconds + + // Set interval to periodically check if the operation is completed + const checkInterval = setInterval(() => { + if (elapsedTime >= maxWaitTime) { + clearInterval(checkInterval); // Stop polling after 2 minutes + this.notifierService.notify('error', this.translateService.instant('OPERATIONFAILED')); + this.isLoadingResults = false; + return; + } + + this.getOperationStatus(operationId).subscribe((operationData: any) => { + if (operationData && operationData.operationState === 'COMPLETED') { + clearInterval(checkInterval); // Stop polling when operation is completed + elapsedTime = (Date.now() - this.consoleRequestStartTime); + this.openVmrcConsole(operationData.operationResultData.url); + // Close the modal window now + const modalData: MODALCLOSERESPONSEDATA = { + message: 'Done' + }; + this.activeModal.close(modalData); + this.router.navigate(['/instances/ns/']).catch((): void => { + // Catch Navigation Error + }); + } else if (operationData && operationData.operationState === 'FAILED') { + clearInterval(checkInterval); // Stop polling on error + this.notifierService.notify('error', this.translateService.instant('OPERATIONFAILED')); + this.isLoadingResults = false; + } + }, (error: ERRORDATA) => { + clearInterval(checkInterval); // Stop polling on error + this.restService.handleError(error, 'post'); + this.isLoadingResults = false; + }); + elapsedTime += interval; + }, interval); + } + + /** obtain the status of the getconsole operation */ + private getOperationStatus(operationId: string) { + const operationQueryUrl: string = environment.NSHISTORYOPERATIONS_URL + '/' + operationId; + // Make GET request to check operation status + return this.restService.getResource(operationQueryUrl); + } + + private openVmrcConsole(vmrcUrl) { + const link = document.createElement('a'); + link.href = vmrcUrl; + link.style.display = 'none'; + document.body.appendChild(link); + link.click(); + document.body.removeChild(link); + } + + /** Used to get the AbstractControl of controlName passed @private */ + private getFormControl(controlName: string): AbstractControl { + // eslint-disable-next-line security/detect-object-injection + return this.consoleForm.controls[controlName]; + } +} diff --git a/src/assets/i18n/de.json b/src/assets/i18n/de.json index c53e157..ac668eb 100644 --- a/src/assets/i18n/de.json +++ b/src/assets/i18n/de.json @@ -83,6 +83,9 @@ "RECENTLY": "Vor kurzem", "TOPOLOGY": "Topologie", "PLEASEWAIT": "Warten Sie mal", + "LAUNCHINGCONSOLE": "Konsole wird gestartet, bitte warten", + "OPERATIONFAILED": "Operation fehlgeschlagen", + "CONSOLE": "Console", "RESOURCEORCHESTRATOR": "Ressource Orchestrator", "VIEW": "Aussicht", "DROP": "Fallen", diff --git a/src/assets/i18n/en.json b/src/assets/i18n/en.json index 19be970..427561d 100644 --- a/src/assets/i18n/en.json +++ b/src/assets/i18n/en.json @@ -83,6 +83,9 @@ "RECENTLY": "Recently", "TOPOLOGY": "Topology", "PLEASEWAIT": "Please Wait", + "LAUNCHINGCONSOLE": "Launching console, please wait", + "OPERATIONFAILED": "Operation failed", + "CONSOLE": "Console", "RESOURCEORCHESTRATOR": "Resource Orchestrator", "VIEW": "View", "DROP": "Drop", diff --git a/src/assets/i18n/es.json b/src/assets/i18n/es.json index 01b7a99..c5a9959 100644 --- a/src/assets/i18n/es.json +++ b/src/assets/i18n/es.json @@ -83,6 +83,9 @@ "RECENTLY": "Recientemente", "TOPOLOGY": "Topología", "PLEASEWAIT": "Por favor, espere", + "LAUNCHINGCONSOLE": "Lanzando consola, por favor espere", + "OPERATIONFAILED": "Error en la operacion", + "CONSOLE": "Consola", "RESOURCEORCHESTRATOR": "Orquestador de recursos", "VIEW": "Ver", "DROP": "soltar", diff --git a/src/assets/i18n/pt.json b/src/assets/i18n/pt.json index f96300d..538661a 100644 --- a/src/assets/i18n/pt.json +++ b/src/assets/i18n/pt.json @@ -83,6 +83,9 @@ "RECENTLY": "Recentemente", "TOPOLOGY": "Topologia", "PLEASEWAIT": "Por favor, espere", + "LAUNCHINGCONSOLE": "Iniciando o console, por favor aguarde", + "OPERATIONFAILED": "A operação falhou", + "CONSOLE": "Console", "RESOURCEORCHESTRATOR": "Orquestrador de Recursos", "VIEW": "Visão", "DROP": "Solta", diff --git a/src/models/CommonModel.ts b/src/models/CommonModel.ts index 8595e4f..001d970 100644 --- a/src/models/CommonModel.ts +++ b/src/models/CommonModel.ts @@ -376,3 +376,4 @@ export interface UNLOCKPARAMS { unlock?: boolean; renew?: boolean; } + diff --git a/src/models/NSInstanceModel.ts b/src/models/NSInstanceModel.ts index 569e1ac..3604a27 100644 --- a/src/models/NSInstanceModel.ts +++ b/src/models/NSInstanceModel.ts @@ -199,6 +199,12 @@ export interface StartStopRebuild { operateVnfData: OPERATEVNFDATA; } +/** Interface for Show Vdu Console */ +export interface ShowVduConsole { + updateType: string; + operateVnfData: OPERATEVNFDATA; +} + /** Interface for operateVnfData in Start, Stop and Rebuild */ export interface OPERATEVNFDATA { additionalParam: ADDITIONALPARAMS; @@ -213,6 +219,12 @@ export interface ADDITIONALPARAMS { 'count-index': string; } +/** Interface for the result of an operate vnf operation */ +export interface OperateVnfResult { + id: string, + nsName: string +} + /** Interface for VerticalScaling */ export interface VerticalScaling { lcmOperationType: string; @@ -277,6 +289,7 @@ export interface NSDInstanceData { 'nsd-id': string; constituent: string[]; 'create-time'?: string; + vimType?: string; } /** Interface for the operationparams */ diff --git a/tsconfig.json b/tsconfig.json index 29b63f5..576198b 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -157,6 +157,7 @@ "NsUpdateComponent": ["src/app/utilities/ns-update/NsUpdateComponent"], "WarningComponent": ["src/app/utilities/warning/WarningComponent"], "StartStopRebuildComponent": ["src/app/utilities/start-stop-rebuild/StartStopRebuildComponent"], + "ShowVduConsoleComponent": ["src/app/utilities/show-vdu-console/ShowVduConsoleComponent"], "HealingComponent": ["src/app/utilities/healing/HealingComponent"], "NSCONFIGTEMPLATE": ["src/app/packages/ns-config-template/NSConfigTemplateComponent"], "NSCONFIGTEMPLATEACTION" :["src/app/utilities/ns-config-template-action/NSConfigTemplateActionComponent"], -- 2.25.1