Feature 10912, 10916: NS Update 48/11948/4
authorSANDHYA.JS <sandhya.j@tataelxsi.co.in>
Wed, 27 Apr 2022 11:52:35 +0000 (17:22 +0530)
committerSANDHYA.JS <sandhya.j@tataelxsi.co.in>
Wed, 25 May 2022 14:18:04 +0000 (19:48 +0530)
*Added NG-UI support to remove VNF and change VNF in NS update
*In NS Instances page. Click "Ns Update" in the actions menu.
        *Then a new pop-up page will opened.
        *In the popup there will be drop-down containing Update Type with 'CHANGE_VNFPKG' & 'REMOVE_VNFPKG', membervnfIndex and text field Vnfd Id.
        *When the fields are selected then Click Apply button.
*For CHANGE_VNFPKG type, the software-version will be checked whether matching or not and corresponding popup will be shown.
        *The pop-up window is closed and the page is directed to "History of operations" page

Change-Id: I135dda039a381b1faa62baa263543e1f210384f7
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
17 files changed:
src/app/AppModule.ts
src/app/utilities/ns-instances-action/NSInstancesActionComponent.html
src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts
src/app/utilities/ns-update/NsUpdateComponent.html [new file with mode: 0644]
src/app/utilities/ns-update/NsUpdateComponent.scss [new file with mode: 0644]
src/app/utilities/ns-update/NsUpdateComponent.ts [new file with mode: 0644]
src/app/utilities/warning/WarningComponent.html [new file with mode: 0644]
src/app/utilities/warning/WarningComponent.scss [new file with mode: 0644]
src/app/utilities/warning/WarningComponent.ts [new file with mode: 0644]
src/assets/i18n/de.json
src/assets/i18n/en.json
src/assets/i18n/es.json
src/assets/i18n/pt.json
src/models/CommonModel.ts
src/models/NSInstanceModel.ts
src/models/VNFDModel.ts
tsconfig.json

index 06d1004..cc9af15 100644 (file)
@@ -65,6 +65,7 @@ import { NetsliceInstancesActionComponent } from 'NetsliceInstancesActionCompone
 import { NetslicePackagesActionComponent } from 'NetslicePackagesAction';
 import { NSInstancesActionComponent } from 'NSInstancesActionComponent';
 import { NsPackagesActionComponent } from 'NsPackagesAction';
+import { NsUpdateComponent } from 'NsUpdateComponent';
 import { PageNotFoundComponent } from 'PageNotFound';
 import { PDUInstancesActionComponent } from 'PDUInstancesActionComponent';
 import { ProjectLinkComponent } from 'ProjectLinkComponent';
@@ -81,6 +82,7 @@ import { VmMigrationComponent } from 'VmMigrationComponent';
 import { VNFInstancesActionComponent } from 'VNFInstancesActionComponent';
 import { VNFLinkComponent } from 'VNFLinkComponent';
 import { VNFPackagesActionComponent } from 'VNFPackagesAction';
+import { WarningComponent } from 'WarningComponent';
 import { WIMAccountsActionComponent } from 'WIMAccountsAction';
 
 /**
@@ -129,7 +131,9 @@ const customNotifierOptions: NotifierOptions = {
         GoToTopDirective,
         ScalingComponent,
         ChangePasswordComponent,
-        VmMigrationComponent
+        VmMigrationComponent,
+        NsUpdateComponent,
+        WarningComponent
     ],
     imports: [
         NotifierModule.withConfig(customNotifierOptions),
@@ -204,7 +208,9 @@ const customNotifierOptions: NotifierOptions = {
         SwitchProjectComponent,
         ScalingComponent,
         ChangePasswordComponent,
-        VmMigrationComponent
+        VmMigrationComponent,
+        NsUpdateComponent,
+        WarningComponent
     ]
 })
 
index df5bbd7..92e462f 100644 (file)
@@ -47,6 +47,10 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
                 [disabled]="operationalStatus === 'failed' || configStatus === 'failed'" ngbTooltip="{{'VMMIGRATION' | translate}}">
                 <i class="fas fa-angle-double-left"></i> {{'VMMIGRATION' | translate}}
             </button>
+            <button type="button" class="btn btn-primary dropdown-item" (click)="openNsUpdate()" placement="left" data-container="body"
+                [disabled]="operationalStatus === 'failed' || configStatus === 'failed'" ngbTooltip="{{'NSUPDATE' | translate}}">
+                <i class="fas fa-arrow-alt-circle-up"></i> {{'NSUPDATE' | translate}}
+            </button>
             <button type="button" class="btn btn-primary dropdown-item" (click)="historyOfOperations()" placement="left" container="body" ngbTooltip="{{'HISTORYOFOPERATIONS' | translate}}">
                 <i class="fas fa-history"></i> {{'HISTORYOFOPERATIONS' | translate}}
             </button>
index fb52423..3735df7 100644 (file)
@@ -29,6 +29,7 @@ import { environment } from 'environment';
 import { NSDDetails } from 'NSDModel';
 import { NSDInstanceData } from 'NSInstanceModel';
 import { NSPrimitiveComponent } from 'NSPrimitiveComponent';
+import { NsUpdateComponent } from 'NsUpdateComponent';
 import { RestService } from 'RestService';
 import { forkJoin, Observable } from 'rxjs';
 import { ScalingComponent } from 'ScalingComponent';
@@ -270,6 +271,19 @@ export class NSInstancesActionComponent {
     }).catch();
   }
 
+  /** To open the Ns Update pop-up */
+  public openNsUpdate(): void {
+    const modalRef: NgbModalRef = this.modalService.open(NsUpdateComponent, { backdrop: 'static' });
+    modalRef.componentInstance.params = {
+      id: this.instanceID
+    };
+    modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
+      if (result) {
+        this.sharedService.callData();
+      }
+    }).catch();
+  }
+
   /**
    * Check any changes in the child component @public
    */
diff --git a/src/app/utilities/ns-update/NsUpdateComponent.html b/src/app/utilities/ns-update/NsUpdateComponent.html
new file mode 100644 (file)
index 0000000..e3058d6
--- /dev/null
@@ -0,0 +1,68 @@
+<!--
+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: SANDHYA JS (sandhya.j@tataelxsi.co.in)
+-->
+<div class="modal-header">
+    <h4 class="modal-title" id="modal-basic-title"> {{'NSUPDATE' | translate}} </h4>
+    <button class="button-xs" type="button" class="close" aria-label="Close" (click)="activeModal.close()">
+        <i class="fas fa-times-circle text-danger"></i>
+    </button>
+</div>
+<form [formGroup]="nsUpdateForm" (ngSubmit)="triggerNsUpdate()" autocomplete="off">
+    <div class="modal-body">
+        <div class="form-group row">
+            <label class="col-sm-12 col-form-label mandatory-label"
+                [ngClass]="{'text-danger': nsUpdateForm.invalid === true && submitted === true}">
+                {{'MANDATORYCHECK' | translate}}
+            </label>
+            <div class="col-sm-6">
+                <label for="updateType"> {{'UPDATETYPE' | translate}} *</label>
+            </div>
+            <div class="col-sm-6">
+                <ng-select formControlName="updateType" [clearable]="false" placeholder="{{'SELECT' | translate}}"
+                    [items]="updateTypeList" bindLabel="title" bindValue="value" (change)="terminateVNF($event.value)"
+                    [ngClass]="{ 'is-invalid': submitted && f.updateType.errors }"></ng-select>
+            </div>
+        </div>
+        <div class="form-group row">
+            <div class="col-sm-6">
+                <label for="memberVnfIndex"> {{'MEMBERVNFINDEX' | translate}} *</label>
+            </div>
+            <div class="col-sm-6">
+                <ng-select formControlName="memberVnfIndex" [clearable]="false" [(ngModel)]="memberIndexValue" (change) = 'getSelectedVNF($event.vnfinstanceId)'
+                    placeholder="{{'SELECTMEMBERVNFINDEX' | translate}}" [items]="memberTypes" bindLabel="id"
+                    bindValue="id" [ngClass]="{ 'is-invalid': submitted && f.memberVnfIndex.errors }">
+                </ng-select>
+                <small class="form-text text-muted" *ngIf="selectedvnfId !== ''">vnfd : {{ selectedvnfId }}</small>
+            </div>
+        </div>
+        <div class="form-group row" *ngIf="!vnfdIdShow">
+            <div class="col-sm-6">
+                <label for="vnfdId"> {{'VNFDID' | translate}} *</label>
+            </div>
+            <div class="col-sm-6">
+                <input autocomplete="off" class="form-control" placeholder="{{'VNFDID' | translate}}" type="text"
+                    formControlName="vnfdId" id="computeHost"
+                    [ngClass]="{ 'is-invalid': submitted && f.vnfdId.errors }">
+            </div>
+        </div>
+    </div>
+    <div class="modal-footer">
+        <button type="button" (click)="activeModal.close()" class="btn btn-danger">{{'CANCEL' | translate}}</button>
+        <button type="submit" class="btn btn-primary">{{'APPLY' | translate }}</button>
+    </div>
+</form>
+<app-loader [waitingMessage]="message" *ngIf="isLoadingResults"></app-loader>
\ No newline at end of file
diff --git a/src/app/utilities/ns-update/NsUpdateComponent.scss b/src/app/utilities/ns-update/NsUpdateComponent.scss
new file mode 100644 (file)
index 0000000..c55461a
--- /dev/null
@@ -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: SANDHYA JS (sandhya.j@tataelxsi.co.in)
+*/
\ No newline at end of file
diff --git a/src/app/utilities/ns-update/NsUpdateComponent.ts b/src/app/utilities/ns-update/NsUpdateComponent.ts
new file mode 100644 (file)
index 0000000..80ddbb4
--- /dev/null
@@ -0,0 +1,342 @@
+/*
+ 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: SANDHYA JS (sandhya.j@tataelxsi.co.in)
+*/
+/**
+ * @file Ns Update 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, NgbModal, NgbModalRef } from '@ng-bootstrap/ng-bootstrap';
+import { TranslateService } from '@ngx-translate/core';
+import { APIURLHEADER, CONFIGCONSTANT, ERRORDATA, MODALCLOSERESPONSEDATA, URLPARAMS } from 'CommonModel';
+import { environment } from 'environment';
+import { NSUPDATE, TERMINATEVNF } from 'NSInstanceModel';
+import { RestService } from 'RestService';
+import { SharedService } from 'SharedService';
+import { isNullOrUndefined } from 'util';
+import { VNFD } from 'VNFDModel';
+import { VNFInstanceDetails } from 'VNFInstanceModel';
+import { WarningComponent } from 'WarningComponent';
+
+/**
+ * Creating component
+ * @Component takes NsUpdateComponent.html as template url
+ */
+@Component({
+    selector: 'app-ns-update',
+    templateUrl: './NsUpdateComponent.html',
+    styleUrls: ['./NsUpdateComponent.scss']
+})
+export class NsUpdateComponent 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 nsUpdateForm: FormGroup;
+    /** Items for the member types @public */
+    public memberTypes: {}[];
+    /** Contains objects that is used to hold types of primitive @public */
+    public updateTypeList: {}[] = [];
+    /** Form valid on submit trigger @public */
+    public submitted: boolean = false;
+    /** Give the update type @public */
+    public terminateVnf: string;
+    /** Model value used to hold selected MemberVNFIndex @public */
+    public memberIndexValue: string;
+    /** Form Check vnfdId Section @public */
+    public vnfdIdShow: boolean = false;
+    /** Contains MemberVNFIndex values @public */
+    public memberVnfIndex: {}[] = [];
+    /** Array holds VNFR Data filtered with nsr ID @public */
+    public nsIdFilteredData: {}[] = [];
+    /** Contains vnfdId value @public */
+    public vnfdId: string;
+    /** Contains vnfId value of the selected MemberVnfIndex @public */
+    public vnfID: string;
+    /** Contains version of the selected MemberVnfIndex @public */
+    public version: string;
+    /** Contains version of the vnfId @public */
+    public vnfversion: string;
+    /** Contains vnfInstanceId of the selected MemberVnfIndex  @public */
+    public instanceId: string;
+    /** Selected VNFInstanceId @public */
+    public selectedvnfId: string = '';
+    /** Input contains component objects @private */
+    @Input() private params: URLPARAMS;
+    /** FormBuilder instance added to the formBuilder @private */
+    private formBuilder: FormBuilder;
+    /** Contains tranlsate instance @private */
+    private translateService: TranslateService;
+    /** Instance of the rest service @private */
+    private restService: RestService;
+    /** Controls the header form @private */
+    private headers: HttpHeaders;
+    /** Contains all methods related to shared @private */
+    private sharedService: SharedService;
+    /** Holds the instance of AuthService class of type AuthService @private */
+    private router: Router;
+    /** Instance of the modal service @private */
+    private modalService: NgbModal;
+    constructor(injector: Injector) {
+        this.injector = injector;
+        this.restService = this.injector.get(RestService);
+        this.activeModal = this.injector.get(NgbActiveModal);
+        this.formBuilder = this.injector.get(FormBuilder);
+        this.sharedService = this.injector.get(SharedService);
+        this.translateService = this.injector.get(TranslateService);
+        this.router = this.injector.get(Router);
+        this.modalService = this.injector.get(NgbModal);
+        this.updateTypeList = [
+            {
+                title: this.translateService.instant('VNFPKGCHANGE'),
+                value: 'CHANGE_VNFPKG'
+            },
+            {
+                title: this.translateService.instant('REMOVEVNF'),
+                value: 'REMOVE_VNF'
+            }
+        ];
+    }
+    /** convenience getter for easy access to form fields */
+    get f(): FormGroup['controls'] { return this.nsUpdateForm.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 Ns Update Forms @public */
+    public initializeForm(): void {
+        this.nsUpdateForm = this.formBuilder.group({
+            updateType: [null, [Validators.required]],
+            memberVnfIndex: [null, [Validators.required]],
+            vnfdId: [null, [Validators.required]]
+        });
+    }
+
+    /** Getting MemberVnfIndex using NSDescriptor API @public */
+    public getMemberVnfIndex(): void {
+        const vnfInstanceData: {}[] = [];
+        this.restService.getResource(environment.VNFINSTANCES_URL).subscribe((vnfInstancesData: VNFInstanceDetails[]): void => {
+            vnfInstancesData.forEach((vnfData: VNFInstanceDetails): void => {
+                const vnfDataObj: {} =
+                {
+                    VNFD: vnfData['vnfd-ref'],
+                    VNFInstanceId: vnfData._id,
+                    MemberIndex: vnfData['member-vnf-index-ref'],
+                    NS: vnfData['nsr-id-ref'],
+                    VNFID: vnfData['vnfd-id']
+                };
+                vnfInstanceData.push(vnfDataObj);
+            });
+            const nsId: string = 'NS';
+            this.nsIdFilteredData = vnfInstanceData.filter((vnfdData: {}[]): boolean => vnfdData[nsId] === this.params.id);
+            this.nsIdFilteredData.forEach((resVNF: {}[]): void => {
+                const memberIndex: string = 'MemberIndex';
+                const vnfinstanceID: string = 'VNFInstanceId';
+                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;
+        });
+    }
+
+    /**
+     *  Fetching the VNFR Information filtered with MemberVnfIndex
+     *  Get the selected VNF Instance ID
+     */
+    public getSelectedVNF(id: string): void {
+        this.instanceId = id;
+        let memberIndexFilteredData: {}[] = [];
+        const memberIndex: string = 'MemberIndex';
+        memberIndexFilteredData = this.nsIdFilteredData.filter((vnfdData: {}[]): boolean =>
+            vnfdData[memberIndex] === this.memberIndexValue);
+        const vnfId: string = 'VNFID';
+        const selectedvnfId: string = 'VNFD';
+        for (const data of memberIndexFilteredData) {
+            this.vnfID = data[vnfId];
+            this.selectedvnfId = data[selectedvnfId];
+        }
+    }
+
+    /** Trigger NsUpdate on submit */
+    public triggerNsUpdate(): void {
+        this.submitted = true;
+        this.sharedService.cleanForm(this.nsUpdateForm);
+        if (this.nsUpdateForm.invalid) { return; } // Proceed, onces form is valid
+        this.vnfdId = this.nsUpdateForm.value.vnfdId;
+        this.checkUpdateType();
+    }
+
+    /** Ns Update on submit */
+    public onSubmit(): void {
+        if (this.terminateVnf === 'REMOVE_VNF') {
+            const nsUpdateTerminatePayload: TERMINATEVNF = {
+                lcmOperationType: 'update',
+                updateType: this.nsUpdateForm.value.updateType,
+                nsInstanceId: this.params.id,
+                removeVnfInstanceId: this.instanceId
+            };
+            this.nsUpdateInitialization(nsUpdateTerminatePayload);
+        } else {
+            const nsUpdatePayload: NSUPDATE = {
+                lcmOperationType: 'update',
+                updateType: this.nsUpdateForm.value.updateType,
+                nsInstanceId: this.params.id,
+                changeVnfPackageData: {
+                    vnfInstanceId: this.instanceId,
+                    vnfdId: this.nsUpdateForm.value.vnfdId
+                }
+            };
+            this.nsUpdateInitialization(nsUpdatePayload);
+        }
+    }
+
+    /**
+     *  Open Modal based on selected NS-UPDATE Type
+     */
+    public checkUpdateType(): void {
+        this.isLoadingResults = true;
+        if (this.nsUpdateForm.value.updateType === 'CHANGE_VNFPKG') {
+            this.checkVersion();
+        } else {
+            const modalRef: NgbModalRef = this.modalService.open(WarningComponent, { backdrop: 'static' });
+            modalRef.componentInstance.heading = this.translateService.instant('TERMINATEVNF');
+            modalRef.componentInstance.confirmationMessage = this.translateService.instant('TERMINATEVNFCONTENT');
+            modalRef.componentInstance.submitMessage = this.translateService.instant('TERMINATEVNF');
+            modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
+                if (result.message === CONFIGCONSTANT.done) {
+                    this.onSubmit();
+                }
+            }).catch();
+        }
+        this.isLoadingResults = false;
+    }
+
+    /** To check the versions are matching or not for 'CHANGE_VNFPKG' type */
+    public checkVersion(): void {
+        this.isLoadingResults = true;
+        const vnfDetails: {}[] = [];
+        this.restService.getResource(environment.VNFPACKAGESCONTENT_URL + '/' + this.vnfdId).subscribe((vnfData: VNFD[]): void => {
+            if (!isNullOrUndefined(vnfData['software-version'])) {
+                this.version = vnfData['software-version'];
+            }
+            this.restService.getResource(environment.VNFPACKAGESCONTENT_URL).subscribe((vnfDetail: VNFD[]): void => {
+                vnfDetail.forEach((vnfDatas: VNFD): void => {
+                    const vnfDataObj: {} =
+                    {
+                        VNFID: vnfDatas._id,
+                        version: vnfDatas['software-version']
+                    };
+                    vnfDetails.push(vnfDataObj);
+                });
+                let vnfIdFilteredData: {}[] = [];
+                const vnfID: string = 'VNFID';
+                const version: string = 'version';
+                vnfIdFilteredData = vnfDetails.filter((vnfdData: {}[]): boolean => vnfdData[vnfID] === this.vnfID);
+                for (const data of vnfIdFilteredData) {
+                    this.vnfversion = data[version];
+                }
+                if (this.version === this.vnfversion) {
+                    const modalRef: NgbModalRef = this.modalService.open(WarningComponent, { backdrop: 'static' });
+                    modalRef.componentInstance.heading = this.translateService.instant('UPDATEPOLICIES');
+                    modalRef.componentInstance.confirmationMessage = this.translateService.instant('UPDATEPOLICIESCONTENT');
+                    modalRef.componentInstance.submitMessage = this.translateService.instant('UPDATEPOLICIES');
+                    modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
+                        if (result.message === CONFIGCONSTANT.done) {
+                            this.onSubmit();
+                        }
+                    }).catch();
+                } else {
+                    const modalRef: NgbModalRef = this.modalService.open(WarningComponent, { backdrop: 'static' });
+                    modalRef.componentInstance.heading = this.translateService.instant('REDEPLOY');
+                    modalRef.componentInstance.confirmationMessage = this.translateService.instant('REDEPLOYCONTENT');
+                    modalRef.componentInstance.submitMessage = this.translateService.instant('REDEPLOY');
+                    modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
+                        if (result.message === CONFIGCONSTANT.done) {
+                            this.onSubmit();
+                        }
+                    }).catch();
+                }
+            }, (error: ERRORDATA): void => {
+                this.restService.handleError(error, 'get');
+                this.isLoadingResults = false;
+            });
+            this.isLoadingResults = false;
+        }, (error: ERRORDATA): void => {
+            this.restService.handleError(error, 'get');
+            this.isLoadingResults = false;
+        });
+    }
+
+    /** Initialize the Ns Update @public */
+    public nsUpdateInitialization(nsUpdatePayload: object): void {
+        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, nsUpdatePayload).subscribe((result: {}): void => {
+            this.activeModal.close(modalData);
+            this.router.navigate(['/instances/ns/history-operations/' + this.params.id]).catch();
+        }, (error: ERRORDATA): void => {
+            this.restService.handleError(error, 'post');
+            this.isLoadingResults = false;
+        });
+    }
+
+    /** To enable or disable vnfdId field @public */
+    public terminateVNF(value: string): void {
+        this.terminateVnf = value;
+        if (this.terminateVnf === 'REMOVE_VNF') {
+            this.vnfdIdShow = true;
+            this.getFormControl('vnfdId').disable();
+        } else {
+            this.vnfdIdShow = false;
+            this.getFormControl('vnfdId').enable();
+        }
+    }
+
+    /** Used to get the AbstractControl of controlName passed @private */
+    private getFormControl(controlName: string): AbstractControl {
+        return this.nsUpdateForm.controls[controlName];
+    }
+}
diff --git a/src/app/utilities/warning/WarningComponent.html b/src/app/utilities/warning/WarningComponent.html
new file mode 100644 (file)
index 0000000..9be2656
--- /dev/null
@@ -0,0 +1,33 @@
+<!--
+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: SANDHYA JS (sandhya.j@tataelxsi.co.in)
+-->
+<div class="modal-header">
+    <h4 class="modal-title" id="modal-basic-title">
+        {{heading}}
+    </h4>
+    <button class="button-xs" type="button" class="close" (click)="closeModal('close')">
+        <i class="fas fa-times-circle text-danger"></i>
+    </button>
+</div>
+<div class="modal-body">
+    <span>{{confirmationMessage}} ?</span>
+</div>
+<div class="modal-footer">
+    <button (click)="closeModal('close')" class="btn btn-danger">{{'CANCEL' | translate }}</button>
+    <button (click)="closeModal('done')" class="btn btn-success">{{submitMessage}}</button>
+</div>
+<app-loader [waitingMessage]="message" *ngIf="isLoad"></app-loader>
\ No newline at end of file
diff --git a/src/app/utilities/warning/WarningComponent.scss b/src/app/utilities/warning/WarningComponent.scss
new file mode 100644 (file)
index 0000000..c55461a
--- /dev/null
@@ -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: SANDHYA JS (sandhya.j@tataelxsi.co.in)
+*/
\ No newline at end of file
diff --git a/src/app/utilities/warning/WarningComponent.ts b/src/app/utilities/warning/WarningComponent.ts
new file mode 100644 (file)
index 0000000..0ccb888
--- /dev/null
@@ -0,0 +1,74 @@
+/*
+ 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: SANDHYA JS (sandhya.j@tataelxsi.co.in)
+*/
+/**
+ * @file WarningConfiguration Model
+ */
+import { Component, Injector, Input } from '@angular/core';
+import { NgbActiveModal } from '@ng-bootstrap/ng-bootstrap';
+/**
+ * Creating component
+ * @Component takes WarningComponent.html as template url
+ */
+@Component({
+    selector: 'app-warning',
+    templateUrl: './WarningComponent.html',
+    styleUrls: ['./WarningComponent.scss']
+})
+/** Exporting a class @exports WarningComponent */
+export class WarningComponent {
+    /** To inject services @public */
+    public injector: Injector;
+
+    /** Instance for active modal service @public */
+    public activeModal: NgbActiveModal;
+
+    /** Check the loading results @public */
+    public isLoad: Boolean = false;
+
+    /** Contains title data @public */
+    @Input()
+    public heading: string;
+
+    /** Contains body data @public */
+    @Input()
+    public confirmationMessage: string;
+
+    /** Contains footer data @public */
+    @Input()
+    public submitMessage: string;
+
+    /** Give the message for the loading @public */
+    public message: string = 'PLEASEWAIT';
+
+    constructor(injector: Injector) {
+        this.injector = injector;
+        this.activeModal = this.injector.get(NgbActiveModal);
+    }
+
+    /**
+     * Lifecyle Hooks the trigger before component is instantiate
+     */
+    public ngOnInit(): void {
+        //empty
+    }
+
+    /** Close the modal  @public */
+    public closeModal(getMessage: string): void {
+        this.activeModal.close({ message: getMessage });
+    }
+}
index 6d8f8be..75c1683 100644 (file)
     "COUNTINDEX": "Index zählen",
     "MIGRATETOHOST": "Zum Host migrieren",
     "VMMIGRATION": "VM-Migration",
+    "NSUPDATE": "Ns-Update",
+    "UPDATETYPE": "Aktualisierungstyp",
+    "VNFDID": "Vnfd-ID",
+    "UPDATEPOLICIES": "Richtlinien aktualisieren",
+    "REDEPLOY": "Neu bereitstellen und aktualisieren",
+    "TERMINATEVNF": "Beenden Sie VNF",
+    "UPDATEPOLICIESCONTENT": "Diese Aktion umfasst die Neuerstellung der Richtlinien dieser VNF. Sind Sie sicher, dass Sie fortfahren möchten",
+    "REDEPLOYCONTENT": "Diese Aktion umfasst die erneute Bereitstellung aller Ressourcen dieser VNF. Sind Sie sicher, dass Sie fortfahren möchten",
+    "TERMINATEVNFCONTENT": "Diese Aktion beinhaltet das Beenden dieser VNF. Sind Sie sicher, dass Sie fortfahren möchten",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "Instrumententafel",
index cdf97a9..882029d 100644 (file)
     "DEFAULT": "Default",
     "SOURCE": "Source",
     "RESOURCESNOTFOUND": "Resources not found",
+    "VNFPKGCHANGE": "CHANGE_VNFPKG",
+    "REMOVEVNF": "REMOVE_VNF",
     "SELECTMEMBERVNFINDEX": "Select Member VNF Index",
     "MEMBERVNFINDEX": "Member VNF Index",
     "VDUID": "VDU Id",
     "COUNTINDEX": "Count Index",
     "MIGRATETOHOST": "Migrate To Host",
     "VMMIGRATION": "Vm Migration",
+    "NSUPDATE": "Ns Update",
+    "UPDATETYPE": "Update Type",
+    "VNFDID": "Vnfd Id",
+    "UPDATEPOLICIES": "Update Policies",
+    "REDEPLOY": "Redeploy and Update",
+    "TERMINATEVNF": "Terminate VNF",
+    "UPDATEPOLICIESCONTENT": "This action involves recreating the policies of this VNF. Are you sure you want to proceed",
+    "REDEPLOYCONTENT": "This action involves redeploying all resources of this VNF. Are you sure you want to proceed",
+    "TERMINATEVNFCONTENT": "This action involves terminating this VNF. Are you sure you want to proceed",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "Dashboard",
index a6fae2d..65e4167 100644 (file)
     "DEFAULT": "por defecto",
     "SOURCE": "Fuente",
     "RESOURCESNOTFOUND": "Recursos no encontrados",
+    "VNFPKGCHANGE": "CAMBIO_VNFPKG",
+    "REMOVEVNF": "ELIMINAR_VNF",
     "SELECTMEMBERVNFINDEX": "Seleccione el índice VNF de miembros",
     "MEMBERVNFINDEX": "Índice VNF de miembros",
     "VDUID": "Identificación de VDU",
     "COUNTINDEX": "Índice de conteo",
     "MIGRATETOHOST": "Migrar a host",
     "VMMIGRATION": "Migración de máquina virtual",
+    "NSUPDATE": "Actualización de Ns",
+    "UPDATETYPE": "Tipo de actualización",
+    "VNFDID": "ID de vnfd",
+    "UPDATEPOLICIES": "Políticas de actualización",
+    "REDEPLOY": "Reimplementar y actualizar",
+    "TERMINATEVNF": "Terminar VNF",
+    "UPDATEPOLICIESCONTENT": "Esta acción implica recrear las políticas de este VNF. Estas seguro que deseas continuar",
+    "REDEPLOYCONTENT": "Esta acción implica redistribuir todos los recursos de este VNF. Estas seguro que deseas continuar",
+    "TERMINATEVNFCONTENT": "Esta acción implica la terminación de este VNF. Estas seguro que deseas continuar",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "Tablero",
index c7f3125..c4c4e4f 100644 (file)
     "DEFAULT": "Padrão",
     "SOURCE": "Fonte",
     "RESOURCESNOTFOUND": "Recursos não encontrados",
+    "VNFPKGCHANGE": "CHANGE_VNFPKG",
+    "REMOVEVNF": "REMOVE_VNF",
     "SELECTMEMBERVNFINDEX": "Selecione o Índice VNF do Membro",
     "MEMBERVNFINDEX": "Índice VNF de Membro",
     "VDUID": "'VDUID': 'ID Vdu'",
     "COUNTINDEX": "Índice de contagem",
     "MIGRATETOHOST": "Migrar para o host",
     "VMMIGRATION": "Migração de VM",
+    "NSUPDATE": "Atualização Ns",
+    "UPDATETYPE": "Tipo de atualização",
+    "VNFDID": "ID de Vnfd",
+    "UPDATEPOLICIES": "Atualizar políticas",
+    "REDEPLOY": "Reimplantar e atualizar",
+    "TERMINATEVNF": "Encerrar VNF",
+    "UPDATEPOLICIESCONTENT": "Esta ação envolve a recriação das políticas desta VNF. Tem certeza de que deseja continuar",
+    "REDEPLOYCONTENT": "Esta ação envolve a redistribuição de todos os recursos desta VNF. Tem certeza de que deseja continuar",
+    "TERMINATEVNFCONTENT": "Esta ação envolve encerrar este VNF. Tem certeza de que deseja continuar",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "painel de controle",
index 437899a..a33e6f3 100644 (file)
@@ -71,7 +71,9 @@ export enum CONFIGCONSTANT {
     sdnOperationalStateThirdStep = 'ERROR',
     k8OperationalStateFirstStep = 'PROCESSING',
     k8OperationalStateStateSecondStep = 'ENABLED',
-    k8OperationalStateThirdStep = 'ERROR'
+    k8OperationalStateThirdStep = 'ERROR',
+    done = 'done',
+    close = 'close'
 }
 /** Interface for Post options */
 export interface POSTAPIRESOURCE {
index 1d5fba3..66a6da8 100644 (file)
@@ -163,6 +163,28 @@ export interface VDUPARAM {
     vduCountIndex?: string;
 }
 
+/** Interface for Ns Update */
+export interface NSUPDATE {
+    lcmOperationType: string;
+    updateType: string;
+    nsInstanceId: string;
+    changeVnfPackageData: CHANGEVNFDATA;
+}
+
+/** Interface for changeVnfPackageData in Ns Update */
+export interface CHANGEVNFDATA {
+    vnfdId: string;
+    vnfInstanceId: string;
+}
+
+/** Interface for terminate vnf in Ns Update */
+export interface TERMINATEVNF {
+    lcmOperationType: string;
+    updateType: string;
+    nsInstanceId: string;
+    removeVnfInstanceId: string;
+}
+
 /** Interface for InstantiateParam */
 interface InstantiateParam {
     nsdId: string;
index 5f2cc05..339dd02 100644 (file)
@@ -65,6 +65,7 @@ export interface VNFD {
     usageState?: string;
     vdu?: VDU[];
     version?: string;
+    'software-version'?: string;
     'virtual-compute-desc'?: string;
     'virtual-storage-desc'?: string[];
     _admin?: VNFDAdminDetails;
index eea875a..cba3c42 100644 (file)
             "SharedModule": ["src/app/vim-accounts/Resources-Overview/SharedModule"],
             "ChangePasswordComponent": ["src/app/utilities/change-password/ChangePasswordComponent"],
             "ChangePasswordModule": ["src/app/utilities/change-password/ChangePasswordModule"],
-            "VmMigrationComponent":  ["src/app/utilities/vm-migration/VmMigrationComponent"]
+            "VmMigrationComponent":  ["src/app/utilities/vm-migration/VmMigrationComponent"],
+            "NsUpdateComponent":  ["src/app/utilities/ns-update/NsUpdateComponent"],
+            "WarningComponent":  ["src/app/utilities/warning/WarningComponent"],
         }
     }
 }
\ No newline at end of file