Fix Bug 2336: Manual Healing option in Ui 78/14278/1
authorSANDHYA.JS <sandhya.j@tataelxsi.co.in>
Tue, 23 Jan 2024 10:22:43 +0000 (15:52 +0530)
committerjssan <sandhya.j@tataelxsi.co.in>
Tue, 26 Mar 2024 09:06:34 +0000 (10:06 +0100)
*In NS Instances page. Click "Manual Healing" in the actions menu.
        *Then a new pop-up page will opened.
        *In the popup there will be drop-down containing membervnfIndex and Day1 operation.
        *When the membervnfIndex and Day1 operation are selected including muti VDU optional can be selected then Click Apply button.
        *The pop-up window is closed and the page is directed to "History of operations" page for this NS.

Change-Id: I3041bcfb56232c6f4b0f56441d89295cc04cfa02
Signed-off-by: SANDHYA.JS <sandhya.j@tataelxsi.co.in>
(cherry picked from commit 319d328d0bbb1e156ac767851c8c33acb518dc94)

17 files changed:
src/app/AppModule.ts
src/app/instances/ns-instances/NSInstancesComponent.html
src/app/instances/ns-instances/NSInstancesComponent.ts
src/app/utilities/healing/HealingComponent.html [new file with mode: 0644]
src/app/utilities/healing/HealingComponent.scss [new file with mode: 0644]
src/app/utilities/healing/HealingComponent.ts [new file with mode: 0644]
src/app/utilities/ns-instances-action/NSInstancesActionComponent.html
src/app/utilities/ns-instances-action/NSInstancesActionComponent.ts
src/app/utilities/scaling/ScalingComponent.html
src/assets/i18n/de.json
src/assets/i18n/en.json
src/assets/i18n/es.json
src/assets/i18n/pt.json
src/assets/scss/app.scss
src/models/CommonModel.ts
src/models/NSInstanceModel.ts
tsconfig.json

index 889f4be..5a9c306 100644 (file)
@@ -45,6 +45,7 @@ import { DeleteComponent } from 'DeleteComponent';
 import { DeviceCheckService } from 'DeviceCheckService';
 import { GoToTopDirective } from 'GoToTopDirective';
 import { HeaderComponent } from 'HeaderComponent';
+import { HealingComponent } from 'HealingComponent';
 import { InstantiateNetSliceTemplateComponent } from 'InstantiateNetSliceTemplate';
 import { InstantiateNsComponent } from 'InstantiateNs';
 import { LayoutComponent } from 'LayoutComponent';
@@ -134,7 +135,8 @@ const customNotifierOptions: NotifierOptions = {
         NsUpdateComponent,
         WarningComponent,
         StartStopRebuildComponent,
-        VerticalScalingComponent
+        VerticalScalingComponent,
+        HealingComponent
     ],
     imports: [
         NotifierModule.withConfig(customNotifierOptions),
index 523ee44..568ac86 100644 (file)
@@ -32,6 +32,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
                 {{configStateSecondStep}}</span>
             <span><i class="fas fa-times-circle text-danger"></i>{{operationalStateThirdStep}}</span>
             <span><i class="fas fa-compress-alt text-success"></i>{{operationalStateFourthStep}}</span>
+            <span><i class="fas fa-briefcase-medical text-success"></i>{{operationalStateFifthStep}}</span>
         </nav>
     </div>
     <page-per-row class="mr-2" (pagePerRow)="onChange($event)"></page-per-row>
index e7de4a7..14d6349 100644 (file)
@@ -84,6 +84,9 @@ export class NSInstancesComponent implements OnInit {
     /** operational State scaling data @public */
     public operationalStateFourthStep: string = CONFIGCONSTANT.operationalStateFourthStep;
 
+    /** operational State healing data @public */
+    public operationalStateFifthStep: string = CONFIGCONSTANT.operationalStateFifthStep;
+
     /** Config State init data @public */
     public configStateFirstStep: string = CONFIGCONSTANT.configStateFirstStep;
 
@@ -161,27 +164,33 @@ export class NSInstancesComponent implements OnInit {
                             { value: this.operationalStateFirstStep, title: this.operationalStateFirstStep },
                             { value: this.operationalStateSecondStep, title: this.operationalStateSecondStep },
                             { value: this.operationalStateThirdStep, title: this.operationalStateThirdStep },
-                            { value: this.operationalStateFourthStep, title: this.operationalStateFourthStep }
+                            { value: this.operationalStateFourthStep, title: this.operationalStateFourthStep },
+                            { value: this.operationalStateFifthStep, title: this.operationalStateFifthStep }
                         ]
                     }
                 },
                 valuePrepareFunction: (cell: NSDInstanceData, row: NSDInstanceData): string => {
                     if (row.OperationalStatus === this.operationalStateFirstStep) {
                         return `<span class="icon-label" title="${row.OperationalStatus}">
-                        <i class="fas fa-clock text-warning"></i>
-                        </span>`;
+                         <i class="fas fa-clock text-warning"></i>
+                         </span>`;
                     } else if (row.OperationalStatus === this.operationalStateSecondStep) {
                         return `<span class="icon-label" title="${row.OperationalStatus}">
-                        <i class="fas fa-check-circle text-success"></i>
-                        </span>`;
+                         <i class="fas fa-check-circle text-success"></i>
+                         </span>`;
                     } else if (row.OperationalStatus === this.operationalStateThirdStep) {
                         return `<span class="icon-label" title="${row.OperationalStatus}">
-                        <i class="fas fa-times-circle text-danger"></i>
-                        </span>`;
+                         <i class="fas fa-times-circle text-danger"></i>
+                         </span>`;
                     } else if (row.OperationalStatus === this.operationalStateFourthStep) {
                         return `<span class="icon-label" title="${row.OperationalStatus}">
-                        <i class="fas fa-compress-alt text-success"></i>
-                        </span>`;
+                         <i class="fas fa-compress-alt text-success"></i>
+                         </span>`;
+                    }
+                    else if (row.OperationalStatus === this.operationalStateFifthStep) {
+                        return `<span class="icon-label" title="${row.OperationalStatus}">
+                         <i class="fas fa-briefcase-medical text-success"></i>
+                         </span>`;
                     } else {
                         return `<span>${row.OperationalStatus}</span>`;
                     }
@@ -203,16 +212,16 @@ export class NSInstancesComponent implements OnInit {
                 valuePrepareFunction: (cell: NSDInstanceData, row: NSDInstanceData): string => {
                     if (row.ConfigStatus === this.configStateFirstStep) {
                         return `<span class="icon-label" title="${row.ConfigStatus}">
-                        <i class="fas fa-clock text-warning"></i>
-                        </span>`;
+                         <i class="fas fa-clock text-warning"></i>
+                         </span>`;
                     } else if (row.ConfigStatus === this.configStateSecondStep) {
                         return `<span class="icon-label" title="${row.ConfigStatus}">
-                        <i class="fas fa-check-circle text-success"></i>
-                        </span>`;
+                         <i class="fas fa-check-circle text-success"></i>
+                         </span>`;
                     } else if (row.ConfigStatus === this.configStateThirdStep) {
                         return `<span class="icon-label" title="${row.ConfigStatus}">
-                        <i class="fas fa-times-circle text-danger"></i>
-                        </span>`;
+                         <i class="fas fa-times-circle text-danger"></i>
+                         </span>`;
                     } else {
                         return `<span>${row.ConfigStatus}</span>`;
                     }
diff --git a/src/app/utilities/healing/HealingComponent.html b/src/app/utilities/healing/HealingComponent.html
new file mode 100644 (file)
index 0000000..ad22db6
--- /dev/null
@@ -0,0 +1,107 @@
+<!--
+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">{{ 'HEALING' | 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]="healingForm" (ngSubmit)="manualHealingTrigger()" autocomplete="off">
+    <div class="modal-body">
+        <div class="form-group row">
+            <label class="col-sm-12 col-form-label mandatory-label"
+                [ngClass]="{'text-danger': healingForm.invalid === true && submitted === true}">
+                {{'MANDATORYCHECK' | translate}}
+            </label>
+            <div class="col-sm-6">
+                <label for="memberVnfIndex"> {{'MEMBERVNFINDEX' | translate}} *</label>
+            </div>
+            <div class="col-sm-6">
+                <ng-select (change)="getVdu($event.vnfinstanceId)" formControlName="memberIndex" [clearable]="false"
+                    placeholder="{{'SELECTMEMBERVNFINDEX' | translate}} *" [items]="memberTypes" bindLabel="id" bindValue="id"
+                    [ngClass]="{ 'is-invalid': submitted && f.memberIndex.errors }">
+                </ng-select>
+                <small class="form-text text-muted" *ngIf="selectedvnfId !== ''">vnfd-id : {{ selectedvnfId }}</small>
+            </div>
+        </div>
+        <div class="form-group row">
+            <div class="col-sm-6">
+                <label for="memberVnfIndex"> {{'DAY1OPERATION' | translate}}</label>
+            </div>
+            <div class="col-sm-6">
+                <ng-select formControlName="run_day1" [clearable]="false" placeholder="{{'DAY1OPERATION' | translate}}"
+                    [items]="day1Operation" bindLabel="name" bindValue="id">
+                </ng-select>
+            </div>
+        </div>
+        <div class="form-group row p-2 bg-light text-white justify-content-end">
+            <div class="col-5">
+                <button class="button-xs" type="button" class="btn btn-primary" (click)="addVdu()">
+                    <i class="fas fa-plus-circle"></i>{{'SELECTVDU' | translate}}</button>
+            </div>
+        </div>
+        <ng-container>
+            <div formArrayName="vdu" *ngFor="let params of getControls(); let i = index;">
+                <div class="form-group row" [formGroupName]="i">
+                    <div class="card bg-light">
+                        <div class="card-body">
+                            <div class="form-group row">
+                                <label class="col-sm-3 col-md-3 col-form-label" for="vduId_{{i}}">{{'VDUID' |
+                                    translate}}</label>
+                                <div class="col-sm-8 col-md-8">
+                                    <ng-select (change)="getCountIndex($event.VDU)"
+                                        placeholder="{{'SELECT' | translate}}" [items]="vduId" bindLabel="VDU"
+                                        bindValue="VDU" formControlName="vduId" id="vduId_{{i}}"
+                                        [ngClass]="{ 'is-invalid': submitted && params.controls.vduId.errors }">
+                                    </ng-select>
+                                </div>
+                                <label class="col-sm-3 col-md-3 col-form-label" for="countIndex_{{i}}">{{'COUNTINDEX' |
+                                    translate}}</label>
+                                <div class="col-sm-8 col-md-8">
+                                    <ng-select placeholder="{{'SELECT' | translate}}" [items]="countIndex"
+                                        bindLabel="count-index" bindValue="count-index" formControlName="countIndex"
+                                        id="countIndex_{{i}}"
+                                        [ngClass]="{ 'is-invalid': submitted && params.controls.countIndex.errors }">
+                                    </ng-select>
+                                </div>
+                                <label class="col-sm-3 col-md-3 col-form-label" for="runDay1_{{i}}">{{'DAY1OPERATION' |
+                                    translate}}</label>
+                                <div class="col-sm-8 col-md-8">
+                                    <ng-select formControlName="runDay1" [clearable]="false" placeholder="{{'DAY1OPERATION' |
+                                translate}}" [items]="day1Operation" bindLabel="name" bindValue="id">
+                                    </ng-select>
+                                </div>
+                                <div class="col-sm-1">
+                                    <button class="button-xs" type="button" class="close" (click)="removeMapping(i)"
+                                        placement="right" ngbTooltip="{{ 'CANCEL' | translate }}">
+                                        <i class="fas fa-minus-circle text-danger"></i>
+                                    </button>
+                                </div>
+                            </div>
+                        </div>
+                    </div>
+                </div>
+            </div>
+        </ng-container>
+    </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/healing/HealingComponent.scss b/src/app/utilities/healing/HealingComponent.scss
new file mode 100644 (file)
index 0000000..f7fbc0a
--- /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)
+*/
diff --git a/src/app/utilities/healing/HealingComponent.ts b/src/app/utilities/healing/HealingComponent.ts
new file mode 100644 (file)
index 0000000..b3a1072
--- /dev/null
@@ -0,0 +1,300 @@
+/*
+ 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 Healing Component
+ */
+import { isNullOrUndefined } from 'util';
+import { HttpHeaders } from '@angular/common/http';
+import { Component, Injector, Input, OnInit } from '@angular/core';
+import { AbstractControl, FormArray, 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 { APIURLHEADER, ERRORDATA, MODALCLOSERESPONSEDATA, URLPARAMS } from 'CommonModel';
+import { environment } from 'environment';
+import { VDUMAP, VDUMAPPINGS } from 'NSInstanceModel';
+import { RestService } from 'RestService';
+import { SharedService } from 'SharedService';
+import { InstanceData, VDUR, VNFInstanceDetails } from 'VNFInstanceModel';
+/**
+ * Creating component
+ * @Component takes HealingComponent.html as template url
+ */
+@Component({
+    selector: 'app-healing',
+    templateUrl: './HealingComponent.html',
+    styleUrls: ['./HealingComponent.scss']
+})
+export class HealingComponent 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';
+    /** Member index of the NS @public */
+    public memberVNFIndex: {}[] = [];
+    /** Items for the memberVNFIndex @public */
+    public memberTypes: {}[];
+    /** Items for the Day1 operation  @public */
+    public day1Operation: {}[];
+    /** Items for the vdu-Id and count-index @public */
+    public vdu: {}[];
+    /** Selected VNFInstanceId @public */
+    public selectedvnfId: string = '';
+    /** Contains vduId @public */
+    public vduId: {};
+    /** VDU Mapping @public */
+    public vduMap: VDUMAP = {};
+    /** Items for countIndex @public */
+    public countIndex: {}[];
+    /** Contains vnfInstanceId of the selected MemberVnfIndex  @public */
+    public instanceId: string;
+    /** FormGroup instance added to the form @ html @public */
+    public healingForm: FormGroup;
+    /** Form valid on submit trigger @public */
+    public submitted: boolean = false;
+    /** VDU Form array @private */
+    private vduFormArray: FormArray;
+    /** Array holds VNFR Data filtered with nsr ID @private */
+    private nsIdFilteredData: {}[] = [];
+    /** FormBuilder instance added to the formBuilder @private */
+    private formBuilder: FormBuilder;
+    /** Instance of the rest service @private */
+    private restService: RestService;
+    /** Controls the header form @private */
+    private headers: HttpHeaders;
+    /** Contains tranlsate instance @private */
+    private translateService: TranslateService;
+    /** Input contains component objects @private */
+    @Input() private params: URLPARAMS;
+    /** Contains all methods related to shared @private */
+    private sharedService: SharedService;
+    /** Holds teh instance of AuthService class of type AuthService @private */
+    private router: Router;
+
+    constructor(injector: Injector) {
+        this.injector = injector;
+        this.restService = this.injector.get(RestService);
+        this.activeModal = this.injector.get(NgbActiveModal);
+        this.translateService = this.injector.get(TranslateService);
+        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.healingForm.controls; }
+
+    /**
+     * Lifecyle Hooks the trigger before component is instantiate
+     */
+    public ngOnInit(): void {
+        this.initializeForm();
+        this.getmemberIndex();
+        this.day1Operation = [
+            { id: 'true', name: this.translateService.instant('True') },
+            { id: '', name: this.translateService.instant('False') }
+        ];
+        this.headers = new HttpHeaders({
+            'Content-Type': 'application/json',
+            Accept: 'application/json',
+            'Cache-Control': 'no-cache, no-store, must-revalidate, max-age=0'
+        });
+    }
+
+    /** Generate primitive params @public */
+    get vduParamsBuilder(): FormGroup {
+        return this.formBuilder.group({
+            vduId: [null],
+            countIndex: [null],
+            runDay1: [null]
+        });
+    }
+
+    /** Initialize Healing Forms @public */
+    public initializeForm(): void {
+        this.healingForm = this.formBuilder.group({
+            memberIndex: [null, [Validators.required]],
+            run_day1: [null],
+            vdu: this.formBuilder.array([])
+        });
+    }
+
+    /** Handle FormArray Controls @public */
+    public getControls(): AbstractControl[] {
+        return (this.healingForm.get('vdu') as FormArray).controls;
+    }
+
+    /** Get the member-vnf-index from NS Package -> vnf-profile @private */
+    private getmemberIndex(): void {
+        this.isLoadingResults = true;
+        const vnfInstanceData: {}[] = [];
+        this.restService.getResource(environment.VNFINSTANCES_URL).subscribe((vnfInstancesData: VNFInstanceDetails[]): void => {
+            vnfInstancesData.forEach((vnfData: VNFInstanceDetails): void => {
+                const nsrId: string = 'nsr-id-ref';
+                const memberIndex: string = 'member-vnf-index-ref';
+                const vnfDataObj: {} =
+                {
+                    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]
+                };
+                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 {
+        this.isLoadingResults = true;
+        this.vdu = [];
+        const vnfInstanceData: {}[] = [];
+        this.instanceId = id;
+        if (!isNullOrUndefined(id)) {
+            this.restService.getResource(environment.VNFINSTANCES_URL + '/' + id).
+                subscribe((vnfInstanceDetail: VNFInstanceDetails): void => {
+                    this.selectedvnfId = vnfInstanceDetail['vnfd-ref'];
+                    if (!isNullOrUndefined(vnfInstanceDetail.vdur)) {
+                        vnfInstanceDetail.vdur.forEach((vdu: VDUR): void => {
+                            const vnfInstanceDataObj: {} =
+                            {
+                                'count-index': vdu['count-index'],
+                                VDU: vdu['vdu-id-ref']
+                            };
+                            vnfInstanceData.push(vnfInstanceDataObj);
+                        });
+                        this.vdu = vnfInstanceData;
+                        this.vduId = this.vdu.filter((vdu: { VDU?: string }, index: number, self: {}[]): {} =>
+                            index === self.findIndex((t: { VDU?: string }): {} => (
+                                // eslint-disable-next-line security/detect-object-injection
+                                t.VDU === vdu.VDU
+                            ))
+                        );
+                        this.isLoadingResults = false;
+                    }
+                }
+                    , (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);
+    }
+
+
+    /** Add vdu @public */
+    public addVdu(): void {
+        this.vduFormArray = this.healingForm.get('vdu') as FormArray;
+        this.vduFormArray.push(this.vduParamsBuilder);
+    }
+
+    /** Remove vdu @public */
+    public removeMapping(index: number): void {
+        this.vduFormArray.removeAt(index);
+    }
+
+    /** If form is valid and call healInstances method to initialize healing @public */
+    public manualHealingTrigger(): void {
+        this.submitted = true;
+        let healingPayload: object = {};
+        this.sharedService.cleanForm(this.healingForm);
+        if (this.healingForm.invalid) { return; } // Proceed, onces form is valid
+        this.vduMap.vdu_mappings = [];
+        this.healingForm.value.vdu.forEach((res: VDUMAPPINGS): void => {
+            this.vduMap.vdu_mappings.push({ 'vdu-id': res.vduId, 'count-index': res.countIndex, 'run-day1': Boolean(res.runDay1) });
+        });
+        if (this.vduMap.vdu_mappings.length !== 0) {
+            healingPayload = {
+                healVnfData:
+                    [{
+                        vnfInstanceId: this.instanceId,
+                        cause: 'manual',
+                        additionalParams: {
+                            'run-day1': false,
+                            vdu: this.vduMap.vdu_mappings
+                        }
+                    }]
+            };
+        } else {
+            healingPayload = {
+                healVnfData:
+                    [{
+                        vnfInstanceId: this.instanceId,
+                        cause: 'manual',
+                        additionalParams: {
+                            'run-day1': Boolean(this.getFormControl('run_day1').value)
+                        }
+                    }]
+            };
+        }
+        this.healInstances(healingPayload);
+    }
+
+    /** Initialize the healing @public */
+    public healInstances(healingPayload: object): void {
+        this.isLoadingResults = true;
+        const apiURLHeader: APIURLHEADER = {
+            url: environment.NSDINSTANCES_URL + '/' + this.params.id + '/heal',
+            httpOptions: { headers: this.headers }
+        };
+        const modalData: MODALCLOSERESPONSEDATA = {
+            message: 'Done'
+        };
+        this.restService.postResource(apiURLHeader, healingPayload).subscribe((result: {}): void => {
+            this.activeModal.close(modalData);
+            this.router.navigate(['/instances/ns/history-operations/' + this.params.id]).catch((): void => {
+                // Catch Navigation Error
+            });
+        }, (error: ERRORDATA): void => {
+            this.restService.handleError(error, 'post');
+            this.isLoadingResults = false;
+        });
+    }
+
+    /** Used to get the AbstractControl of controlName passed @private */
+    private getFormControl(controlName: string): AbstractControl {
+        // eslint-disable-next-line security/detect-object-injection
+        return this.healingForm.controls[controlName];
+    }
+}
index 517dbde..6a32735 100644 (file)
@@ -70,6 +70,10 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
                 placement="left" data-container="body" ngbTooltip="{{'SCALING' | translate}}">
                 <i class="fas fa-cubes"></i> {{'SCALING' | translate}}
             </button>
+            <button type="button" class="btn btn-primary dropdown-item" [disabled]="operationalStatus === 'healing' || operationalStatus === 'failed' || configStatus === 'failed'" (click)="openHealing()" 
+                placement="left" data-container="body" ngbTooltip="{{'HEALING' | translate}}">
+                <i class="fas fa-user-md"></i> {{'HEALING' | 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}}
index ea7fa61..08e5e97 100644 (file)
@@ -27,6 +27,7 @@ import { NotifierService } from 'angular-notifier';
 import { ERRORDATA, MODALCLOSERESPONSEDATA } from 'CommonModel';
 import { DeleteComponent } from 'DeleteComponent';
 import { environment } from 'environment';
+import { HealingComponent } from 'HealingComponent';
 import { NSDDetails } from 'NSDModel';
 import { NSDInstanceData } from 'NSInstanceModel';
 import { NSPrimitiveComponent } from 'NSPrimitiveComponent';
@@ -170,7 +171,7 @@ export class NSInstancesActionComponent {
       }
     }).catch((): void => {
       // Catch Navigation Error
-  });
+    });
   }
 
   /** History of operations for an Instanace @public */
@@ -285,7 +286,7 @@ export class NSInstancesActionComponent {
       }
     }).catch((): void => {
       // Catch Navigation Error
-  });
+    });
   }
 
   /** To open VM Migration in NS Instances */
@@ -301,7 +302,7 @@ export class NSInstancesActionComponent {
       }
     }).catch((): void => {
       // Catch Navigation Error
-  });
+    });
   }
 
   /** To open the Ns Update pop-up */
@@ -317,7 +318,7 @@ export class NSInstancesActionComponent {
       }
     }).catch((): void => {
       // Catch Navigation Error
-  });
+    });
   }
 
   /** To open the Start, Stop & Rebuild pop-up */
@@ -341,7 +342,7 @@ export class NSInstancesActionComponent {
       }
     }).catch((): void => {
       // Catch Navigation Error
-  });
+    });
   }
 
   /** To open the vertical Scaling pop-up */
@@ -357,7 +358,23 @@ export class NSInstancesActionComponent {
       }
     }).catch((): void => {
       // Catch Navigation Error
-  });
+    });
+  }
+
+  /** Open the Healing pop-up @public */
+  public openHealing(): void {
+    // eslint-disable-next-line security/detect-non-literal-fs-filename
+    const modalRef: NgbModalRef = this.modalService.open(HealingComponent, { backdrop: 'static' });
+    modalRef.componentInstance.params = {
+      id: this.instanceID
+    };
+    modalRef.result.then((result: MODALCLOSERESPONSEDATA): void => {
+      if (result) {
+        this.sharedService.callData();
+      }
+    }).catch((): void => {
+      // Catch Navigation Error
+    });
   }
 
   /**
index 803a320..10d5a16 100644 (file)
@@ -30,7 +30,7 @@ Author: KUMARAN M (kumaran.m@tataelxsi.co.in), RAJESH S (rajesh.s@tataelxsi.co.i
             </label>
             <div class="col-sm-12">
                 <ng-select formControlName="memberIndex" [clearable]="false"
-                    (change)="getScalingGroupDescriptorName($event.vnfdRef)" placeholder="Select Member VNF Index *"
+                    (change)="getScalingGroupDescriptorName($event.vnfdRef)" placeholder="{{'SELECTMEMBERVNFINDEX' | translate}} *"
                     [items]="memberTypes" bindLabel="id" bindValue="id"
                     [ngClass]="{ 'is-invalid': submitted && f.memberIndex.errors }">
                 </ng-select>
index 97527ec..286f750 100644 (file)
     "UPDATENS": "NS aktualisieren",
     "GENERICCONTENT": "Diese Aktion umfasst die Neuerstellung der Ressourcen dieser VNF. Sind Sie sicher, dass Sie fortfahren möchten",
     "VNFDNAME": "Vnfd-Name",
+    "HEALING": "Manuelle Heilung",
+    "DAY1OPERATION": "Tag-1 Operation",
+    "SELECTVDU": "Wählen VDU",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "Instrumententafel",
index c6a419c..7f27b20 100644 (file)
     "UPDATENS": "Update NS",
     "GENERICCONTENT": "This action involves recreating the resources of this VNF. Are you sure you want to proceed",
     "VNFDNAME": "Vnfd Name",
+    "HEALING": "Manual Healing",
+    "DAY1OPERATION": "Day1 operation",
+    "SELECTVDU": "Select VDU",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "Dashboard",
index 9332c26..5f19c04 100644 (file)
     "UPDATENS": "Actualizar NS",
     "GENERICCONTENT": "Esta acción implica recrear los recursos de este VNF. Estas seguro que deseas continuar",
     "VNFDNAME": "Nombre Vnfd",
+    "HEALING": "Curación Manual",
+    "DAY1OPERATION": "Operación día 1",
+    "SELECTVDU": "Seleccionar VDU",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "Tablero",
index a553f38..c1fb1e3 100644 (file)
     "UPDATENS": "Atualizar NS",
     "GENERICCONTENT": "Esta ação envolve a recriação dos recursos desta VNF. Tem certeza de que deseja continuar",
     "VNFDNAME": "Nome Vnfd",
+    "HEALING": "Cura Manual",
+    "DAY1OPERATION": "Operação dia 1",
+    "SELECTVDU": "Selecione VDU",
     "PAGE": {
         "DASHBOARD": {
             "DASHBOARD": "painel de controle",
index cb96c93..337d6aa 100644 (file)
@@ -858,3 +858,34 @@ body {
     border: none;
   }
 }
+
+/****************************************************************************/
+/************************** HEALING STYLE ***********************************/
+/****************************************************************************/
+
+app-healing {
+  .card {
+    border-radius: 15px;
+    width: auto;
+    height: auto;
+    margin-bottom: 5px;
+  }
+
+  .card-body {
+    flex: 1 1 auto;
+    min-height: 1px;
+    padding: 5px;
+  }
+
+  .form-group {
+    margin-bottom: 1px;
+  }
+
+  .col-sm-1 {
+    bottom: 20px;
+  }
+
+  .col-5 {
+    left: 79px;
+  }
+}
index abf0cb6..a3038f1 100644 (file)
@@ -54,6 +54,7 @@ export enum CONFIGCONSTANT {
     operationalStateSecondStep = 'running',
     operationalStateThirdStep = 'failed',
     operationalStateFourthStep = 'scaling',
+    operationalStateFifthStep = 'healing',
     configStateFirstStep = 'init',
     configStateSecondStep = 'configured',
     configStateThirdStep = 'failed',
index 5039cc5..ffa95a2 100644 (file)
@@ -388,3 +388,18 @@ export interface VNFRINFO {
     vnfdId: string;
     memberIndex: string;
 }
+
+/** Interface for vdu mappings */
+export interface VDUMAP {
+    vdu_mappings?: VDUMAPPINGS[];
+}
+
+/** Interface for vdu Mappings */
+export interface VDUMAPPINGS {
+    vduId?: string;
+    'vdu-id'?: string;
+    countIndex?: string;
+    'count-index'?: string;
+    runDay1?: Boolean;
+    'run-day1'?: Boolean;
+}
index b0a4495..e22f60f 100644 (file)
             "NsUpdateComponent":  ["src/app/utilities/ns-update/NsUpdateComponent"],
             "WarningComponent":  ["src/app/utilities/warning/WarningComponent"],
             "StartStopRebuildComponent":  ["src/app/utilities/start-stop-rebuild/StartStopRebuildComponent"],
-            "VerticalScalingComponent":  ["src/app/utilities/vertical-scaling/VerticalScalingComponent"]
+            "VerticalScalingComponent":  ["src/app/utilities/vertical-scaling/VerticalScalingComponent"],
+            "HealingComponent": ["src/app/utilities/healing/HealingComponent"],
         }
     }
 }
\ No newline at end of file