add new action configscalein for cdt
[appc/cdt.git] / src / app / vnfs / build-artifacts / reference-dataform / reference-dataform.component.ts
1 /*
2 ============LICENSE_START==========================================
3 ===================================================================
4 Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
5 ===================================================================
6
7 Unless otherwise specified, all software contained herein is licensed
8 under the Apache License, Version 2.0 (the License);
9 you may not use this software except in compliance with the License.
10 You may obtain a copy of the License at
11
12     http://www.apache.org/licenses/LICENSE-2.0
13
14 Unless required by applicable law or agreed to in writing, software
15 distributed under the License is distributed on an "AS IS" BASIS,
16 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 See the License for the specific language governing permissions and
18 limitations under the License.
19
20 ============LICENSE_END============================================
21 */
22
23 import * as XLSX from 'xlsx';
24 import * as _ from 'underscore';
25
26 import { ActivatedRoute, Router } from '@angular/router';
27 import { Component, OnInit, ViewChild } from '@angular/core';
28 import { Observable } from 'rxjs/Observable';
29 import { BuildDesignComponent } from '../build-artifacts.component';
30 import { HttpUtilService } from '../../../shared/services/httpUtil/http-util.service';
31 import { Location } from '@angular/common';
32 import { MappingEditorService } from '../../..//shared/services/mapping-editor.service';
33 import { NgProgress } from 'ngx-progressbar';
34 import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
35 import { NotificationService } from '../../../shared/services/notification.service';
36 import { NotificationsService } from 'angular2-notifications';
37 import { ParamShareService } from '../../..//shared/services/paramShare.service';
38 import { environment } from '../../../../environments/environment';
39 import { saveAs } from 'file-saver';
40 import { Jsonp } from '@angular/http';
41 import { ReferenceDataFormUtil } from './reference-dataform.util';
42 import { UtilityService } from '../../../shared/services/utilityService/utility.service';
43 import { APIService } from "../../../shared/services/cdt.apicall";
44
45 // Common Confirm Modal
46 import { DialogService } from 'ng2-bootstrap-modal';
47 import { ConfirmComponent } from "../../../shared/confirmModal/confirm.component";
48
49
50 declare var $: any;
51 type AOA = Array<Array<any>>;
52
53 @Component({
54     selector: 'reference-dataform',
55     templateUrl: './reference-dataform.component.html',
56     styleUrls: ['./reference-dataform.component.css'],
57     providers: [ReferenceDataFormUtil]
58 })
59 export class ReferenceDataformComponent implements OnInit {
60     public classNm= "ReferenceDataformComp";
61     public showUploadStatus: boolean = false;
62     public fileUploaded: boolean = false;
63     public uploadedData: any;
64     public statusMsg: string;
65     public uploadStatus: boolean = false;
66     public isCollapsedContent: boolean = true;
67     public vnfcCollLength: number = 0;
68     public vfncCollection = [];
69     public userForm: any;
70     public actionType: any;
71     numberTest: RegExp = /^[^.a-z]+$/;
72     public numberOfVmTest: boolean = true;
73     public tempAllData = [];
74     disableGrpNotationValue: boolean;
75     public noRefData = false;
76     public disableRetrieve = false;
77     public getRefStatus = false;
78     public uploadStatusError: boolean;
79     public showUploadErrorStatus: boolean;
80     public noData: string;
81     selectedActions = [];
82     public appData = { reference: {}, template: { templateData: {}, nameValueData: {} }, pd: {} };
83     public downloadData = {
84         reference: {},
85         template: { templateData: {}, nameValueData: {}, templateFileName: '', nameValueFileName: '' },
86         pd: { pdData: '', pdFileName: '' }
87     };
88     errorMessage = '';
89     invalid = true;
90     fileName: any;
91     vnfcIdentifier;
92     oldVnfcIdentifier: any
93     public uploadFileName: any;
94     public addVmClickedFlag: boolean = false;
95     public getExcelUploadStatus: boolean = false;
96     public uploadedDataArray: any;
97     public actionFlag = false;
98     currentAction: any;
99     oldAction: any;
100     nonConfigureAction: any;
101     templateId;
102     newVnfcType;
103     templateIdentifier;
104     public actionLevels = [
105         'vnfc', 'vnf'
106     ];
107     oldtemplateIdentifier: any
108     identifierDrp: any;
109     identifierDrpValues: any = [];
110     //settings for the notifications.
111     options = {
112         timeOut: 4500,
113         showProgressBar: true,
114         pauseOnHover: true,
115         clickToClose: true,
116         maxLength: 200
117     };
118     //initializing this object to contain all the parameters to be captured later
119     public referenceDataObject = {
120         action: '',
121         'action-level': 'vnf',
122         scope: { 'vnf-type': '', 'vnfc-type-list': [] },
123         'template': 'Y',
124         vm: [],
125         'device-protocol': '',
126         'user-name': '',
127         'port-number': '',
128         'artifact-list': []
129     };
130     public refernceScopeObj = { sourceType: '', from: '', to: '' };
131     public actions = ['', // using comma as prefix hereafter for easy reordering
132         , 'ConfigBackup'
133         , 'ConfigModify'
134         , 'ConfigRestore'
135         , 'ConfigScaleOut'
136         , 'ConfigScaleIn'
137         , 'Configure'
138         , 'DistributeTraffic'
139         , 'DistributeTrafficCheck'
140         , 'GetConfig'
141         , 'GetRunningConfig'
142         , 'HealthCheck'
143         , 'LicenseManagement'
144         , 'PostConfigure'
145         , 'PostEvacuate'
146         , 'PostMigrate'
147         , 'PostRebuild'
148         , 'PreConfigCheck'
149         , 'PreConfigure'
150         , 'PreEvacuate'
151         , 'PreMigrate'
152         , 'PreRebuild'
153         , 'ProvisionConfig'
154         , 'ProvisionData'
155         , 'Provisioning'
156         , 'QuiesceTraffic'
157         , 'ResumeTraffic'
158         , 'StartApplication'
159         , 'StartTraffic'
160         , 'StatusTraffic'
161         , 'StopApplication'
162         , 'StopTraffic'
163         , 'UpgradeBackout'
164         , 'UpgradeBackup'
165         , 'UpgradePostCheck'
166         , 'UpgradePreCheck'
167         , 'UpgradeSoftware'
168         , 'OpenStack Actions'
169         ]; //.. manual ordering
170     public groupAnotationValue = ['', 'Pair'];
171     public groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value'];
172     public deviceProtocols = ['', 'ANSIBLE', 'CHEF', 'NETCONF-XML', 'REST', 'CLI', 'RESTCONF'];
173     public deviceTemplates = ['', 'Y', 'N'];
174     public sourceTypeColl = ['', 'vnfType', 'vnfcType'];
175     public ipAddressBoolean = ['', 'Y', 'N'];
176     public Sample: any = {
177         'vnfc-instance': '1',
178         'vnfc-function-code': '',
179         'ipaddress-v4-oam-vip': '',
180         'group-notation-type': '',
181         'group-notation-value': ''
182     };
183     hideModal: boolean = false;
184     public self: any;
185     public uploadTypes = [{
186         value: 'Reference Data',
187         display: 'Sample Json Param File'
188     },
189     {
190         value: 'Mapping Data',
191         display: 'Sample Json Param File'
192     }
193     ];
194     public selectedUploadType: string = this.uploadTypes[0].value;
195     public vnfcTypeData: string = '';
196     public title: string;
197     public allowAction: boolean = true;
198     public actionExist: boolean = false;
199     public disableVnftype: boolean = false;
200     public otherActions: boolean = false;
201     public actionHealthCheck: boolean = false;
202     public actionChanged: boolean = false;
203     public initialAction: string = '';
204     public noCacheData: boolean;
205     public updateParams: any;
206     public vnfParams: any;
207     public firstArrayElement = [];
208     public remUploadedDataArray = [];
209     isConfigScaleOut = false
210     isConfigScaleIn = false
211     isConfigOrConfigModify = false
212     displayVnfc = 'false';
213     isVnfcType: boolean;
214     isVnfcTypeList: boolean = true;
215     public referencDataTab = [
216         {
217
218             name: 'Reference Data',
219             url: 'references',
220         }];
221     public allTabs = [
222         {
223             name: 'Reference Data',
224             url: 'references',
225         }, {
226             name: 'Template',
227             url: 'templates/myTemplates',
228         }, {
229             name: 'Parameter Definition',
230             url: 'parameterDefinitions/create'
231         }/*, {
232                     name: "Test",
233                     url: 'test',
234                 }*/
235     ];
236     public actionList = require('../../../../cdt.application.properties.json').Actions;
237     
238     public versionNoForApiCall = require('../../../../cdt.application.properties.json').versionNoForApiCall;
239     private displayVMBlock: boolean = true;
240
241     constructor(
242       private buildDesignComponent: BuildDesignComponent, private apiService: APIService, private utilityService: UtilityService, private httpUtils: HttpUtilService, private referenceDataFormUtil: ReferenceDataFormUtil, private route: Router, private location: Location, private activeRoutes: ActivatedRoute, private notificationService: NotificationService,
243         private paramShareService: ParamShareService, private mappingEditorService: MappingEditorService, private modalService: NgbModal, private nService: NotificationsService, private ngProgress: NgProgress,
244         private dialogService: DialogService)
245     {
246       console.log(this.classNm+
247         ": new: start: tracelvl="+this.utilityService.getTracelvl() );
248     }
249
250     ngOnInit() {
251       let methName= "ngOnInit";
252       if( this.utilityService.getTracelvl() > 0 )
253         console.log( this.classNm+": "+methName+": start ");
254         // this.handleVMBlockDisplay();
255       if( this.utilityService.getTracelvl() > 0 ) {
256         console.log( this.classNm+": "+methName+
257           ": actions: count="+this.actions.length );
258         for( var i0=0; i0 < this.actions.length; i0++ ) {
259           console.log( this.classNm+": "+methName+
260             ": action #"+i0+" ["+this.actions[i0]+"]");
261         };
262       };
263       this.self = this;
264         let path = this.location.path;
265         this.title = 'Reference Data';
266       this.displayVnfc = sessionStorage.getItem("vnfcSelectionFlag");
267       this.vnfcIdentifier= ' ';
268       if( this.utilityService.getTracelvl() > 0 )
269         console.log( this.classNm+": "+methName+
270           ": from storage: displayVnfc:["+this.displayVnfc+"]");
271       //.. setting the structure for the reference data object 
272         this.referenceDataObject = {
273             action: '',
274             'action-level': 'vnf',
275             scope: { 'vnf-type': '', 'vnfc-type-list': [] },
276             'template': 'Y',
277             vm: [],
278             'device-protocol': '',
279             'user-name': '',
280             'port-number': '',
281             'artifact-list': []
282         };
283         //getting the data from session data, calling get Artifact if the data is undefined
284         this.updateParams = sessionStorage.getItem('updateParams');
285         //getting the data from the referencenameobjects if the nav is changed and assiging it to the cace data
286         let cacheData = this.mappingEditorService.referenceNameObjects;
287
288         if (this.utilityService.checkNotNull(cacheData)) {
289             //if cache data exists then assiging the data to the latest temp all data object.
290           if( this.utilityService.getTracelvl() > 0 )
291             console.log( this.classNm+": ngOnInit: have cacheData.");
292             this.tempAllData = cacheData;
293             //calling the highligted method to highlight the selected actions in the action dropdown
294             this.highlightSelectedActions(this.tempAllData)
295             // getting the latest action that the user has selected and assiging it to the reference data object once the user toggles between tabs from reference
296             if (this.mappingEditorService.latestAction != undefined) {
297                 //adding the latest action to the screen
298                 this.referenceDataObject = this.mappingEditorService.latestAction;
299                 this.toggleIdentifier(this.referenceDataObject.action);
300                 //this.referenceDataObject['template-id-list'] = this.mappingEditorService.identifier
301                 //use these commented objects to be used in template and pd pages
302                 //this.templateIdentifier = this.mappingEditorService.identifier
303                 //adding the scope from referencedata obj to referencescopeobject
304                 this.refernceScopeObj.sourceType = this.referenceDataObject['scopeType'];
305                 //assigning the latest action fetched to the old action from reference data object
306                 this.oldAction = this.referenceDataObject.action;
307                 //this method is called with the action reterived and subsequent values are assigned to refdataobj for displaying
308                 this.populateExistinAction(this.referenceDataObject.action);
309                 this.displayHideVnfc();
310             }
311         } else if (this.updateParams != 'undefined') {
312             //calls the get artifact() to reterive the values if cache data is not present
313             this.getArtifact();
314         }
315         //getting the appdata & downloadDataObject from mapping editor service and assiging it.
316         var appData = this.mappingEditorService.appDataObject;
317         if (appData != null || appData != undefined) this.appData = appData;
318         var downloadData = this.mappingEditorService.downloadDataObject;
319         if (downloadData != null || downloadData != undefined) this.downloadData = downloadData;
320
321         if (sessionStorage.getItem('vnfParams')) {
322             this.vnfParams = JSON.parse(sessionStorage.getItem('vnfParams'));
323         }
324         if (this.vnfParams && this.vnfParams.vnfType) {
325           if( this.utilityService.getTracelvl() > 0 )
326             console.log( this.classNm+": "+methName+": vnfParams.vnfType:["+
327               this.vnfParams.vnfType+"]");
328             this.referenceDataObject['scope']['vnf-type'] = this.vnfParams.vnfType;
329         }
330         if (this.vnfParams && this.vnfParams.vnfcType) {
331           if( this.utilityService.getTracelvl() > 0 )
332             console.log( this.classNm+": "+methName+": vnfParams.vnfcType:["+
333               this.vnfParams.vnfcType+"]");
334             this.referenceDataObject['scope']['vnfc-type'] = this.vnfParams.vnfcType;
335         }
336         this.uploadedDataArray = [];
337         this.remUploadedDataArray = [];
338         this.firstArrayElement = [];
339         this.uploadFileName = '';
340         this.templateIdentifier = this.mappingEditorService.identifier
341         // if (this.mappingEditorService.newObject) {
342         //     this.vnfcIdentifier = this.mappingEditorService.newObject.vnfc;
343         // }
344         // else {
345         //     this.vnfcIdentifier = '';
346         //     this.referenceDataObject['vnfcIdentifier'] = '';
347         // }
348         this.oldVnfcIdentifier = this.vnfcIdentifier;
349         if( this.utilityService.getTracelvl() > 1 )
350           console.log( this.classNm+": "+methName+": displayVnfc:["+
351             this.displayVnfc+"]");
352         if( this.utilityService.getTracelvl() > 1 )
353           console.log( this.classNm+": "+methName+": templateIdentifier:["+
354             this.templateIdentifier+"]");
355         // Enable or Block Template and PD Tabs
356         this.buildDesignComponent.getRefData(
357           { ...this.referenceDataObject, displayVnfc: this.displayVnfc },
358           { reqField: this.templateIdentifier });
359         //.. configure some drop-downs
360         this.configDrp(this.referenceDataObject.action);
361         if( this.utilityService.getTracelvl() > 0 )
362           console.log( this.classNm+": "+methName+": tempAllData:["+
363             JSON.stringify(this.tempAllData)+"]");
364         if( this.utilityService.getTracelvl() > 0 )
365           console.log( this.classNm+": "+methName+": finish.");
366     }
367
368     //setting the value to display or hide the template identifier dropdown in the screen
369     toggleIdentifier(data) {
370         if (data == 'ConfigScaleOut') {
371             this.isConfigScaleOut = true
372
373         } else {
374             this.isConfigScaleOut = false
375         }
376
377         if (data == 'ConfigScaleIn') {
378             this.isConfigScaleIn = true;
379         } else {
380             this.isConfigScaleIn = false;
381         }
382     }
383
384     //to retrive the data from appc and assign it to the vaiables, if no data display the message reterived from the API
385     getArtifact() {
386         if( this.utilityService.getTracelvl() > 0 )
387           console.log(this.classNm+": getArtifact: start...");
388         try {
389             // setting the isVnfcTypeList & isVnfcType to false initially
390             this.isVnfcTypeList = false;
391             this.isVnfcType = false
392             let data = this.utilityService.createPayloadForRetrieve(true, '', '', '');
393             this.ngProgress.start();
394             let serviceCall = this.apiService.callGetArtifactsApi(data);
395             serviceCall.subscribe(resp => {
396                 //getting the response and assigining it to the variables used and end the progress bar aftr the data is fetched.
397                 if (resp.output.data.block != undefined) {
398                     this.nService.success('Status', 'data fetched ');
399                     let artifactInfo = JSON.parse(resp.output.data.block).artifactInfo[0];
400                     let referenceDataAll = JSON.parse(artifactInfo['artifact-content'])['reference_data'];
401                     let reference_data = JSON.parse(artifactInfo['artifact-content'])['reference_data'][0];
402                     this.referenceDataObject = reference_data;
403                     this.toggleIdentifier(this.referenceDataObject.action);
404                     if (this.referenceDataObject.action == 'ConfigScaleOut') {
405                         this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value', 'existing-group-name'];
406                     }
407                     if (this.referenceDataObject.action == 'ConfigScaleIn') {
408                         this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value', 'existing-group-name'];
409                     }
410                     this.highlightSelectedActions(referenceDataAll)
411                     
412                     //chck vnfc or vnfcTypeList
413                     this.displayHideVnfc();
414                     
415                     // Enable or Block Template and PD Tabs
416                     this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
417
418                     this.refernceScopeObj.sourceType = this.referenceDataObject['scopeType'];
419                     this.mappingEditorService.getReferenceList().push(JSON.parse(artifactInfo['artifact-content']));
420                     this.tempAllData = JSON.parse(artifactInfo['artifact-content'])['reference_data'];
421                     this.oldAction = this.referenceDataObject.action;
422                     this.oldVnfcIdentifier = this.vnfcIdentifier;
423
424                     this.processReferenceDataAfterRetrieval();
425                     this.getArtifactsOpenStack();
426                 } else {
427                     this.nService.success('Status', 'Sorry !!! I dont have any artifact Named : ' + (JSON.parse(sessionStorage.getItem('updateParams')))['artifact-name']);
428                 }
429                 this.ngProgress.done();
430             });
431         }
432         catch (e) {
433             this.nService.warn('status', 'error while reteriving artifact');
434         }
435         setTimeout(() => {
436             this.ngProgress.done();
437         }, 3500);
438     }
439
440     displayHideVnfc() {
441         if( this.utilityService.getTracelvl() > 0 )
442           console.log(this.classNm+": displayHideVnfc: start...");
443         if( this.utilityService.getTracelvl() > 1 ) {
444           if( this.referenceDataObject.scope['vnfc-type-list'] ) {
445             console.log( this.classNm+
446               ": displayHideVnfc: refDataObj.scope.vnfc-type-list.length="+
447               this.referenceDataObject.scope['vnfc-type-list'].length );
448           } else {
449             console.log( this.classNm+
450               ": displayHideVnfc: refDataObj.scope.vnfc-type-list not defined");
451           };
452           console.log( this.classNm+": displayHideVnfc: scope.vnfc-type:["+
453             this.referenceDataObject.scope['vnfc-type']+"]");
454         };
455         if (this.referenceDataObject.scope['vnfc-type-list'] == undefined && (this.referenceDataObject.scope['vnfc-type'] != undefined || this.referenceDataObject.scope['vnfc-type'] != "")) {
456             this.isVnfcType = true
457             this.displayVnfc = 'true'
458             this.isVnfcTypeList = false
459         }
460         if (this.referenceDataObject.scope['vnfc-type-list'] != undefined && this.referenceDataObject.scope['vnfc-type-list'].length != 0 && (this.referenceDataObject.scope['vnfc-type'] == undefined || this.referenceDataObject.scope['vnfc-type'] == "")) {
461             this.isVnfcType = false
462             this.displayVnfc = 'true'
463             this.isVnfcTypeList = true
464             if(!this.mappingEditorService.newObject || !this.mappingEditorService.newObject.vnfc) {
465                 this.vnfcIdentifier = this.referenceDataObject.scope['vnfc-type-list'][0];
466                 // this.mappingEditorService.newObject.vnfc = this.vnfcIdentifier;
467             } else {
468                 this.vnfcIdentifier = this.mappingEditorService.newObject.vnfc;
469             }
470             this.referenceDataObject['vnfcIdentifier'] = this.vnfcIdentifier;
471             //this.vnfcChanged(this.vnfcIdentifier, FormData);
472             if( this.utilityService.getTracelvl() > 0 )
473               console.log(this.classNm+": displayHideVnfc: vnfcIdentifier:["+
474                 this.vnfcIdentifier+"]");
475         }
476         if (this.referenceDataObject.scope['vnfc-type-list'] != undefined && this.referenceDataObject.scope['vnfc-type-list'].length == 0 && this.referenceDataObject.scope['vnfc-type'] != undefined && this.referenceDataObject.scope['vnfc-type'].length == 0) {
477             if(this.displayVnfc == 'true') {
478                 this.isVnfcType = false
479                 this.displayVnfc = 'true'
480                 this.isVnfcTypeList = true
481             } else {
482                 this.isVnfcType = false
483                 this.displayVnfc = 'false'
484                 this.isVnfcTypeList = false
485             }
486         }
487         if (this.referenceDataObject.scope['vnfc-type-list'] == undefined && this.referenceDataObject.scope['vnfc-type'] == '') {
488             this.isVnfcType = false
489             this.displayVnfc = 'false'
490             this.isVnfcTypeList = false
491         }
492       if( this.utilityService.getTracelvl() > 0 )
493         console.log(this.classNm+": displayHideVnfc: finish. isVnfcType:["+
494           this.isVnfcType+" displayVnfc:["+this.displayVnfc+"] isVnfcTypeList:["+
495           this.isVnfcTypeList+"]");
496     }
497
498     //reinitializing the required values. when changing to template or pd sending the values to mapping service
499     ngOnDestroy() {
500         let referenceObject = this.prepareReferenceObject();
501         this.mappingEditorService.changeNavAppData(this.appData);
502         this.mappingEditorService.changeNavDownloadData(this.downloadData);
503         this.uploadedDataArray = [];
504         this.remUploadedDataArray = [];
505         this.firstArrayElement = [];
506         this.uploadFileName = '';
507     }
508     // vaidating the number
509     numberValidation(event: any) {
510         if (this.numberTest.test(event) && event != 0) {
511             this.numberOfVmTest = true;
512         }
513         else {
514             this.numberOfVmTest = false;
515         }
516     }
517     // update my vnf pop up session values
518     updateSessionValues(event: any, type: string) {
519       if( this.utilityService.getTracelvl() > 0 )
520         console.log(this.classNm+": updateSessionValues: type:["+type+"]");
521         if (type === 'action') {
522             sessionStorage.setItem('action', event);
523         }
524         if (type === 'vnfType') {
525             sessionStorage.setItem('vnfType', event);
526         }
527     }
528     // adding vnfc data for each vm
529     addVnfcData(vmNumber: number) {
530       if( this.utilityService.getTracelvl() > 0 )
531         console.log(this.classNm+": addVnfcData: start: vmNumber="+ vmNumber);
532         var newObj = {
533             'vnfc-instance': this.referenceDataObject.vm[vmNumber].vnfc.length + 1,
534             'vnfc-type': this.vnfcTypeData,
535             'vnfc-function-code': '',
536             'ipaddress-v4-oam-vip': '',
537             'group-notation-type': '',
538             'group-notation-value': ''
539         };
540         this.referenceDataObject.vm[vmNumber].vnfc.push(newObj);
541     }
542     //validating the vnf and vnfc data in the pop up
543     validateVnfcName(name) {
544       if( this.utilityService.getTracelvl() > 0 )
545         console.log( this.classNm+": validateVnfcName: start: name:["+name+"]");
546         if (!name.trim() || name.length < 1) {
547             this.errorMessage = '';
548             this.invalid = true;
549         } else if (name.startsWith(' ') || name.endsWith(' ')) {
550             this.errorMessage = 'Leading and trailing spaces are not allowed';
551             this.invalid = true;
552         } else if (name.includes('  ')) {
553             this.errorMessage = 'More than one space is not allowed in VNFC Type';
554             this.invalid = true;
555         } else if (name.length > 50) {
556             this.errorMessage = 'VNFC Type should be of minimum one character and maximum 50 character';
557             this.invalid = true;
558         } else {
559             this.invalid = false;
560             this.errorMessage = '';
561         }
562     }
563
564
565     //to remove the VM's created by the user
566     removeFeature(vmNumber: any, index: any, templateId) {
567         if (this.referenceDataObject.action == "Configure") {
568             this.referenceDataObject.vm.splice(vmNumber, 1);
569             this.referenceDataObject.vm.forEach((obj, arrIndex) => {
570                 if (arrIndex >= vmNumber) {
571                     obj["vm-instance"] = obj["vm-instance"] - 1
572                 }
573                 // obj["vm-instance"] = arrIndex+1
574
575             })
576         } else {
577             let data = this.referenceDataObject.vm.filter(obj => {
578                 return obj['template-id'] == templateId;
579             })
580
581             let vmIndex = this.findVmindex(data, vmNumber, templateId)
582             this.referenceDataObject.vm.splice(vmIndex, 1);
583             let index = 0
584             this.referenceDataObject.vm.forEach((obj, arrIndex) => {
585                 if (obj['template-id'] == templateId) {
586
587                     obj["vm-instance"] = index + 1
588                     index++
589                 }
590
591             })
592         }
593
594     }
595     //utility function while adding VM to check index
596     findVmindex(data, vmNumber, templateId) {
597         return this.referenceDataObject.vm.findIndex(obj => {
598             let x = obj['vm-instance'] == (vmNumber + 1) && templateId == obj['template-id']//true
599             return x
600         })
601
602     }
603
604     //add new VM's to the configure and configmodify. 
605     addVms() {
606         let arr = [];
607
608         let mberOFVm = Number(this.refernceScopeObj.from);
609         let key
610         if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') {
611             key = "vnfcType-id"
612         } else if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn') {
613             key = "template-id"
614         }
615         if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn' || this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') {
616             let existingVmsLength = this.referenceDataObject.vm.map(obj => {
617                 if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') {
618                     return obj["vnfcType-id"] == this.templateIdentifier
619                 } else if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn') {
620                     return obj["template-id"] == this.templateIdentifier
621                 }
622             }).length;
623             //mberOFVm = existingVmsLength + mberOFVm;
624             let index = 0;
625             let identifierValue
626             if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn') {
627                 identifierValue = this.templateIdentifier
628             } else if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify'  || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') {
629                 identifierValue = this.vnfcIdentifier
630             }
631
632             for (var i = 0; i < mberOFVm; i++) {
633                 if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') {
634
635                     if (identifierValue && identifierValue != "") {
636                         this.referenceDataObject.vm.push({ 'vnfcType-id': identifierValue, 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] });
637                     } else {
638                         this.referenceDataObject.vm.push({ 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] });
639                     }
640
641                 } else if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn') {
642                     if (identifierValue && identifierValue != "") {
643                         this.referenceDataObject.vm.push({ 'template-id': identifierValue, 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] });
644                     }
645
646                 }
647
648                 index++;
649             }
650
651         } else {
652             let arrlength = this.referenceDataObject.vm.length;
653             mberOFVm = arrlength + mberOFVm;
654             for (var i = (arrlength); i < mberOFVm; i++) {
655                 if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn') {
656                     this.referenceDataObject.vm.push({ 'template-id': this.templateIdentifier, 'vm-instance': (i + 1), vnfc: [Object.assign({}, this.Sample)] });
657                 } else {
658                     this.referenceDataObject.vm.push({ 'vm-instance': (i + 1), vnfc: [Object.assign({}, this.Sample)] });
659                 }
660             }
661         }
662     }
663
664     //preparing reference obj with required business use cases
665     prepareReferenceObject(isSaving?: any) {
666       let methName= "prepareReferenceObject";
667       if( this.utilityService.getTracelvl() > 0 )
668         console.log( this.classNm+": "+methName+": start: isSaving:["+
669           isSaving+"]");
670         let scopeName = this.resetParamsOnVnfcType();
671         let extension = this.referenceDataFormUtil.decideExtension(this.referenceDataObject);
672         this.prepareArtifactList(scopeName, extension);
673
674         if (this.referenceDataObject.action === 'OpenStack Actions') {
675             this.referenceDataObject['template'] = 'N';
676             this.referenceDataObject['artifact-list'] = [];
677             this.referenceDataObject['firstRowVmSpreadSheet'] = this.firstArrayElement;
678         }
679         else{
680             this.referenceDataObject['firstRowVmSpreadSheet']=undefined;
681         }
682         //ditaching the object from the form and processing pfurther
683         let newObj = $.extend(true, {}, this.referenceDataObject);
684         let action = this.referenceDataObject.action;
685         // if (action=="ConfigScaleOut"){
686         //     this.referenceDataObject.action="true";
687         // }
688         //preparing Obj for save/download
689         newObj = this.deleteVmsforNonActions(newObj, action)
690
691         if (newObj['device-protocol'] != 'REST') {
692             delete newObj['url']
693         }
694         this.pushOrReplaceTempData(newObj, action);
695         this.addAllActionObj(newObj, scopeName);
696         this.resetTempData()
697
698
699         //rmove context url
700         //if()
701         //saving data to service
702         this.mappingEditorService.getReferenceList().push(JSON.parse(JSON.stringify(this.referenceDataObject)));
703         this.buildDesignComponent.updateAccessUpdatePages(this.referenceDataObject.action, this.mappingEditorService.getReferenceList());
704         this.mappingEditorService.changeNav(this.tempAllData);
705         //on action change or template identifier change reset the form by restting values of Reference data object
706         this.resetVmsForScaleout(this.currentAction)
707         return { totlaRefDtaa: this.tempAllData, scopeName: scopeName };
708     }
709
710     // utility function to check element existence
711     public checkIfelementExistsInArray(element, array) {
712         var result: boolean = false;
713
714         array.forEach(function (item) {
715             if (element === item) {
716                 result = true;
717             }
718         }
719         );
720         return result;
721     }
722     // when uploading the file 
723     upload(evt: any) {
724         /* wire up file reader */
725         const target: DataTransfer = <DataTransfer>(evt.target);
726         this.uploadFileName = evt.target.files[0].name;
727         var fileExtension = this.uploadFileName.substr(this.uploadFileName.lastIndexOf('.') + 1);
728         if (target.files.length != 1) {
729             throw new Error('Cannot upload multiple files on the entry');
730         }
731         if (fileExtension.toUpperCase() === 'XLS' || fileExtension.toUpperCase() === 'XLSX') {
732             const reader = new FileReader();
733             reader.onload = (e: any) => {
734                 /* read workbook */
735                 const bstr = e.target.result;
736                 const wb = XLSX.read(bstr, { type: 'binary' });
737                 /* grab first sheet */
738                 const wsname = wb.SheetNames[0];
739                 const ws = wb.Sheets[wsname];
740
741                 /* save data */
742                 this.firstArrayElement = []
743                 let arrData = (<AOA>(XLSX.utils.sheet_to_json(ws, { header: 1 })));
744                 this.uploadedDataArray = arrData;
745                 for (var i = 0; i < arrData[0].length; i++) {
746                     this.firstArrayElement.push(arrData[0][i].replace(/[\n\r]+/g, ''))
747                 }
748                 var remUploadedDataArray = arrData;
749                 remUploadedDataArray.shift();
750                 this.remUploadedDataArray = remUploadedDataArray;
751                 if (arrData != null) {
752                     this.getExcelUploadStatus = true;
753                     this.nService.success('Success', 'Vm capabilities data uploaded successfully');
754
755                 }
756                 else {
757                     this.nService.success('Error', 'Empty Vm capabilities file uploaded');
758                 }
759             };
760             reader.readAsBinaryString(target.files[0]);
761         }
762         else {
763             this.nService.error('Error', 'Incorrect VM capabilities file uploaded');
764         }
765
766     }
767
768     addVmCapabilitiesData() {
769         for (var i = 0; i < this.uploadedDataArray.length; i++) {
770             var vnfcFuncCodeArray = [];
771             var data = this.uploadedDataArray[i];
772             for (var j = 1; j < data.length; j++) {
773                 if (data[j] != undefined) {
774                     if (data[j].toUpperCase() === 'Y') {
775                         vnfcFuncCodeArray.push(this.firstArrayElement[j]);
776                         //vnfcFuncCodeArray.push({name:this.firstArrayElement[j]});
777                     }
778                 }
779             }
780             var action = this.uploadedDataArray[i][0];
781             if (action && action != undefined) {
782                 var json = {
783                     'action': action,
784                     'action-level': 'vm',
785                     'scope': {
786                         'vnf-type': this.referenceDataObject['scope']['vnf-type'], //need to confirm what should be this value
787                         'vnfc-type-list': null
788                     },
789                     'vnfc-function-code-list': vnfcFuncCodeArray,
790                     'template': 'N',
791                     'device-protocol': 'OS'
792                 };
793
794                 this.tempAllData.push(json);
795             }
796
797         }
798     }
799
800     //download the templae pd and reference file with all the actions added.
801     save(form: any, isValid: boolean) {
802         // will show error message
803         this.showValidationErrors(this.referenceDataObject);
804
805         if (isValid) {
806             let referenceObject = this.prepareReferenceObject();
807             let removedKeysArray = []
808             this.tempAllData.forEach((data, index) => {
809                 if (data.action) {
810                     removedKeysArray.push(JSON.parse(JSON.stringify(this.deleteUnwantedKeys(data))))
811                 }
812             });
813             this.tempAllData = removedKeysArray;
814            /* var tempAllData = this.tempAllData;
815             tempAllData=this.removeParamFileNameBeforeSave(tempAllData)*/
816             
817             //tempAllData["artifact_list"]=newArtifactList;
818             let theJSON = JSON.stringify({ 'reference_data': this.tempAllData }, null, '\t');
819             let uri = 'data:application/json;charset=UTF-8,' + encodeURIComponent(theJSON);
820             this.downloadData.reference = theJSON;
821             let referenceFileName = 'reference_AllAction_' + this.referenceDataObject.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.json';
822             this.utilityService.downloadArtifactToPc(theJSON, 'json', referenceFileName, 100);
823             this.validateTempAllData();
824             var templateData = JSON.stringify(this.downloadData.template.templateData);
825             var templateFileName = this.downloadData.template.templateFileName;
826             if (templateFileName != null || templateFileName != '') {
827                 var fileExtensionArr = templateFileName.split('.');
828             }
829             var nameValueFileName = this.downloadData.template.nameValueFileName;
830             let pdFileName = this.downloadData.pd.pdFileName;
831             var nameValueData = JSON.stringify(this.downloadData.template.nameValueData);
832             var pdData = this.downloadData.pd.pdData;
833             if (templateData != '{}' && templateData != null && templateData != undefined) this.utilityService.downloadArtifactToPc(this.downloadData.template.templateData, fileExtensionArr[1], templateFileName, 130);
834             if (nameValueData != '{}' && nameValueData != null && nameValueData != undefined) this.utilityService.downloadArtifactToPc(this.downloadData.template.nameValueData, 'json', nameValueFileName, 160);
835             if (pdData != '' && pdData != null && pdData != undefined) this.utilityService.downloadArtifactToPc(pdData, 'yaml', pdFileName, 180);
836         }
837     }
838
839   /*  removeParamFileNameBeforeSave(tempAllData)
840     {
841         var newArtifactList = [];
842             var element={};
843             for (var i = 0; i < tempAllData.length; i++) {
844                 if (this.checkIfelementExistsInArray(tempAllData[i].action,this.actions)) {
845                     var artifactList = tempAllData[i]["artifact-list"]
846                     
847                     for (var j = 0; j < artifactList.length; j++) {
848                         if (artifactList[j]["artifact-type"] != "param_values") {
849                             element = artifactList[j];
850                             newArtifactList.push(element);
851                         }
852                     }
853                     tempAllData[i]["artifact-list"] = newArtifactList
854                     newArtifactList = [];
855                     element={};
856                 }
857             }
858             return tempAllData;
859     }*/
860     // save the values to the cache, on action change without download
861     validateDataAndSaveToAppc( valid, form, event) {
862       let methName= "validateDataAndSaveToAppc";
863       if( this.utilityService.getTracelvl() > 0 )
864         console.log( this.classNm+": "+methName+": start: valid:["+valid+"]");
865         // will show error message
866         this.showValidationErrors(this.referenceDataObject);
867       if( this.utilityService.getTracelvl() > 0 )
868         console.log( this.classNm+": "+methName+": tempAllData:["+
869           JSON.stringify(this.tempAllData)+"]");
870         try {
871             form._submitted = true;
872             if (valid) {
873                 let referenceObject = this.prepareReferenceObject(true);
874                 let removedKeysArray = []
875                 this.tempAllData.forEach((data, index) => {
876                     if (data.action) {
877                         removedKeysArray.push(JSON.parse(JSON.stringify(this.deleteUnwantedKeys(data))))
878                     }
879                 });
880                 this.tempAllData = removedKeysArray;
881
882                 this.validateTempAllData();
883                 this.saveToAppc();
884                 if (this.actionChanged) {
885                     this.clearVnfcData()
886                     if (this.currentAction) {
887                         this.referenceDataObject.action = this.currentAction;
888                     }
889
890                     this.populateExistinAction(this.referenceDataObject.action);
891                     this.actionChanged = false;
892                 }
893             }
894         }
895         catch (e) {
896             this.nService.warn('status', 'unable to save the artifact');
897         }
898     }
899     //this method saves reference, template, param and PD data to APPC
900     saveToAppc() {
901       if( this.utilityService.getTracelvl() > 0 )
902         console.log( this.classNm+": saveToAppc: start: vnf-type:["+
903           this.referenceDataObject.scope['vnf-type']+"]");
904         let theJSON = JSON.stringify( this.tempAllData );
905       if( this.utilityService.getTracelvl() > 0 )
906         console.log( this.classNm+": saveToAppc: tempAllData:["+theJSON+"]");
907         let fileName = 'reference_AllAction_' + this.referenceDataObject.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.json';
908         /*var tempAllData=this.removeParamFileNameBeforeSave(this.tempAllData);
909         this.tempAllData=tempAllData;*/
910         this.saveReferenceDataToAppc(JSON.stringify({ reference_data: this.tempAllData }), this.tempAllData[this.tempAllData.length - 1], fileName);
911
912         var templateData = JSON.stringify(this.appData.template.templateData);
913         var nameValueData = JSON.stringify(this.appData.template.nameValueData);
914         var pdData = JSON.stringify(this.appData.pd);
915         if (templateData != '{}' && templateData != null && templateData != undefined) this.referenceDataFormUtil.handleApiData(this.appData.template.templateData, 'template data');
916         if (nameValueData != '{}' && nameValueData != null && nameValueData != undefined) this.referenceDataFormUtil.handleApiData(this.appData.template.nameValueData, 'name value pairs');
917         if (pdData != '{}' && pdData != null && pdData != undefined) this.referenceDataFormUtil.handleApiData(this.appData.pd, 'PD file');
918     }
919
920     // valaidation of template data
921     validateTempAllData() {
922         if (this.tempAllData) {
923             var updatedData = [];
924             this.tempAllData.forEach(data => {
925                 if (data.action) {
926                     updatedData.push(data);
927                 }
928             });
929             this.tempAllData = updatedData;
930         }
931     }
932
933     //preparig and send the data to the API.
934     saveReferenceDataToAppc(artifactData, dataJson, fileName) {
935         let data = [];
936         let slashedPayload = this.referenceDataFormUtil.appendSlashes(artifactData);
937
938         let payload = this.utilityService.createPayLoadForSave("reference_data", dataJson['scope']['vnf-type'], "AllAction", fileName, this.versionNoForApiCall, slashedPayload);
939         this.ngProgress.start();
940         this.httpUtils.post({
941             url: environment.getDesigns,
942             data: payload
943         }).subscribe((resp) => {
944             if (resp != null && resp.output.status.code == '400') {
945                 window.scrollTo(0, 0);
946                 this.nService.success('Status', 'successfully uploaded the Reference Data');
947             } else {
948                 this.nService.warn('Status', 'Error while saving Reference Data');
949             }
950             this.uploadStatusError = false;
951             this.getRefStatus = false;
952             this.ngProgress.done();
953         }, (err) => {
954             this.nService.error('Status', 'Error Connecting to the APPC Network');
955             window.scrollTo(0, 0);
956         });
957         this.appData.reference = payload;
958         setTimeout(() => {
959             this.ngProgress.done();
960         }, 3500);
961     }
962     // if no data present in the session, fetching data from API
963     retriveFromAppc() {
964         if (sessionStorage.getItem('updateParams') != 'undefined') {
965             this.getArtifact();
966             this.noCacheData = false;
967         } else {
968             this.noCacheData = true;
969         }
970     }
971
972     public showUpload() {
973         this.selectedUploadType = this.uploadTypes[0].value;
974     };
975     // used when user uploads a file using upload file
976     public fileChange(input) {
977         this.fileName = input.target.files[0].name.replace(/C:\\fakepath\\/i, '');
978         this.fileUploaded = true;
979         this.disableRetrieve = true;
980         if (input.target.files && input.target.files[0]) {
981             // Create the file reader
982             let reader = new FileReader();
983             this.readFile(input.target.files[0], reader, (result) => {
984                 // After the callback fires do:
985                 if ('Reference Data' === this.selectedUploadType) {
986                     try {
987                         let obj: any;
988                         let jsonObject = (JSON.parse(result))['reference_data'];
989                         this.uploadedData = JSON.parse(JSON.stringify(jsonObject));
990                         //check for legacy artifact and do not allow it
991                         for (let i = 0; i < this.uploadedData.length; i++) {
992                             obj = this.uploadedData[i];
993                             if (obj.scope['vnfc-type'] != undefined && obj.scope['vnfc-type'] != '') {
994                                 this.nService.error('Error', 'The legacy reference artifact not supported');
995                                 return;
996                             }
997                         }
998
999                         this.displayVnfc = 'false';
1000                         this.isVnfcType = false;
1001                         this.isVnfcTypeList = false;
1002                         for (let i = 0; i < this.uploadedData.length; i++) {
1003                             obj = this.uploadedData[i];
1004                             if (obj.scope['vnfc-type-list'] && obj.scope['vnfc-type-list'].length > 0) {
1005                                 this.displayVnfc = 'true';
1006                                 this.isVnfcTypeList = true;
1007                                 this.vnfcIdentifier = obj.scope['vnfc-type-list'][0];
1008                                 
1009                             }
1010                         }
1011                         this.oldAction=obj.action;
1012                         this.tempAllData = JSON.parse(JSON.stringify(jsonObject));
1013                         //check vnfc tyoe list for old files
1014                         // if (this.referenceDataObject.scope['vnfc-type-list'] == undefined) {
1015                         //     this.tempAllData = []
1016                         //     this.referenceDataObject = {
1017                         //         action: '',
1018                         //         'action-level': 'vnf',
1019                         //         scope: { 'vnf-type': '', 'vnfc-type-list': [] },
1020                         //         'template': 'Y',
1021                         //         vm: [],
1022                         //         'device-protocol': '',
1023                         //         'user-name': '',
1024                         //         'port-number': '',
1025                         //         'artifact-list': []
1026                         //     }
1027                         //     this.nService.error('Error', 'Incorrect file format');
1028                         //     return
1029                         // }
1030                         this.notificationService.notifySuccessMessage('Reference Data file successfully uploaded..');
1031                         this.highlightSelectedActions(jsonObject)
1032                         this.toggleIdentifier(this.referenceDataObject.action)
1033                         this.populateExistinAction(this.referenceDataObject.action)
1034                         this.configDrp(this.referenceDataObject.action)
1035
1036
1037                         this.processReferenceDataAfterRetrieval();
1038
1039                         this.getArtifactsOpenStack();
1040                         if (this.referenceDataObject.template == null) {
1041                             this.referenceDataObject.template = 'Y';
1042                         }
1043                         if (this.referenceDataObject['action-level'] == null) {
1044                             this.referenceDataObject['action-level'] = 'VNF';
1045                         }
1046
1047                         
1048                         // Enable or Block Template and PD Tabs
1049                         this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
1050                     } catch (e) {
1051                         this.nService.error('Error', 'Incorrect file format');
1052                     }
1053                 }
1054                 this.hideModal = true;
1055             });
1056         } else {
1057             this.notificationService.notifyErrorMessage('Failed to read file..');
1058         }
1059
1060     }
1061
1062     // Highlights selected action on new file upload and on existing VNF 
1063     public highlightSelectedActions(jsonObject) {
1064         if (jsonObject instanceof Array) {
1065             this.referenceDataObject = jsonObject[0];
1066             jsonObject.forEach(obj => {
1067                 this.selectedActions.push(obj.action);
1068             });
1069         } else {
1070             this.referenceDataObject = jsonObject;
1071
1072             this.selectedActions.push(jsonObject.action);
1073         }
1074     }
1075
1076     public readFile(file, reader, callback) {
1077         // Set a callback funtion to fire after the file is fully loaded
1078         reader.onload = () => {
1079             // callback with the results
1080             callback(reader.result);
1081         };
1082         this.notificationService.notifySuccessMessage('Uploading File ' + file.name + ':' + file.type + ':' + file.size);
1083         // Read the file
1084         reader.readAsText(file, 'UTF-8');
1085     }
1086
1087     fileChangeEvent(fileInput: any) {
1088         let obj: any = fileInput.target.files;
1089     }
1090     //resetting the values
1091     clearVnfcData() {
1092         this.Sample = {
1093             'vnfc-instance': '1',
1094             'vnfc-function-code': '',
1095             'ipaddress-v4-oam-vip': '',
1096             'group-notation-type': '',
1097             'group-notation-value': ''
1098         };
1099     }
1100
1101     setVmInstance(index) {
1102         this.referenceDataObject.vm[index]['vm-instance'] = index + 1;
1103     }
1104
1105     // setVnfcType(str: String) {
1106     //     this.Sample['vnfc-type'] = str;
1107     // }
1108
1109     // getChange(value: String) {
1110     //     if (value === 'vnfType') {
1111     //         this.referenceDataObject.scope['vnfc-type'] = '';
1112     //     }
1113     // }
1114     // resetting the form
1115     resetForm() {
1116         console.log( this.classNm+": resetForm: start.");
1117         this.referenceDataObject['action-level'] = 'vnf';
1118         this.referenceDataObject.template = 'Y';
1119         this.referenceDataObject['device-protocol'] = '';
1120         this.referenceDataObject['user-name'] = '';
1121         this.referenceDataObject['port-number'] = '';
1122         this.refernceScopeObj.sourceType = '';
1123         this.Sample['vnfc-type'] = '';
1124     }
1125
1126     //.. this method gets called with the action as parameter and
1127     // the respective action details are fetched and assigned to the current page
1128     populateExistinAction( action) {
1129       let methName= "populateExistinAction";
1130       if( this.utilityService.getTracelvl() > 0 )
1131         console.log( this.classNm+": "+methName+": start: action:["+action+"]");
1132       if( this.utilityService.getTracelvl() > 0 )
1133         console.log( this.classNm+": "+methName+": tempAllData:["+
1134           JSON.stringify(this.tempAllData)+"]");
1135       let existAction = this.tempAllData.findIndex(obj => {
1136         return obj.action == action;
1137       });
1138       if( this.utilityService.getTracelvl() > 0 )
1139         console.log( this.classNm+": "+methName+": existAction="+existAction );
1140       if( existAction > -1) {
1141         let obj = $.extend(true, {}, this.tempAllData[existAction]);
1142         this.referenceDataObject = obj;
1143         this.referenceDataObject.scope['vnf-type'] = obj['scope']['vnf-type'];
1144         this.referenceDataObject.scope['vnfc-type-list'] = obj['scope']['vnfc-type-list'];
1145         this.referenceDataObject['device-protocol'] = obj['device-protocol'];
1146         this.refernceScopeObj['sourceType'] = obj['scopeType'];
1147         if( obj['scope']['vnfc-type-list'] != undefined &&
1148             obj['scope']['vnfc-type-list'].length >0)
1149         {
1150           this.referenceDataObject['vnfcIdentifier']=
1151             obj['scope']['vnfc-type-list'][0];
1152         };
1153       }
1154       else {
1155         console.log( this.classNm+": populateExistinAction: action not found");
1156         this.resetForm();
1157         this.referenceDataObject.action = action;
1158       }
1159       //# iof healthCeck change deviceprotocol drp vaues
1160       switch( action) {
1161         case 'HealthCheck':
1162           this.deviceProtocols = ['', 'ANSIBLE', 'CHEF', 'REST'];
1163           this.actionHealthCheck = true;
1164           break;
1165         case 'UpgradeBackout':
1166         case 'ResumeTraffic':
1167         case 'DistributeTraffic':
1168         case 'DistributeTrafficCheck':
1169         case 'QuiesceTraffic':
1170         case 'UpgradeBackup':
1171         case 'UpgradePostCheck':
1172         case 'UpgradePreCheck':
1173         case 'UpgradeSoftware':
1174         case 'ConfigRestore':
1175         case 'StartApplication':
1176         case 'StopApplication':
1177         case 'ConfigBackup':
1178           this.deviceProtocols = ['', 'CHEF', 'ANSIBLE'];
1179           break;
1180         case 'GetConfig':
1181         case 'LicenseManagement':
1182         case 'PostConfigure':
1183         case 'PostEvacuate':
1184         case 'PostMigrate':
1185         case 'PostRebuild':
1186         case 'PreConfigCheck':
1187         case 'PreConfigure':
1188         case 'PreEvacuate':
1189         case 'PreMigrate':
1190         case 'PreRebuild':
1191         case 'ProvisionConfig':
1192         case 'ProvisionData':
1193         case 'Provisioning':
1194         case 'StartTraffic':
1195         case 'StatusTraffic':
1196         case 'StopTraffic':
1197           this.deviceProtocols = ['', 'ANSIBLE'];
1198           break;
1199         case 'OpenStack Actions':
1200           this.deviceProtocols = ['', 'OpenStack'];
1201           break;
1202         case 'ConfigScaleOut':
1203           this.deviceProtocols = ['', 'CHEF', 'ANSIBLE', 'NETCONF-XML', 'RESTCONF'];
1204           break;
1205         case 'ConfigScaleIn':
1206             this.deviceProtocols = ['', 'CHEF', 'ANSIBLE', 'NETCONF-XML', 'RESTCONF'];
1207             break;
1208         case 'GetRunningConfig':
1209           this.deviceProtocols = ['', 'CHEF', 'ANSIBLE', 'NETCONF-XML', 'RESTCONF', 'CLI', 'REST'];
1210           break;
1211         default:
1212           this.deviceProtocols = ['', 'ANSIBLE', 'CHEF', 'NETCONF-XML', 'RESTCONF', 'CLI'];
1213           this.actionHealthCheck = false;
1214       };
1215       if( this.utilityService.getTracelvl() > 0 )
1216         console.log( this.classNm+": "+methName+
1217           ": deviceProtocols count="+this.deviceProtocols.length+" finish.");
1218     }
1219
1220     //Modal pop up for action change with values entered. 
1221     actionChange( data, userForm) {
1222       let methName= "actionChange";
1223       if( this.utilityService.getTracelvl() > 0 )
1224         console.log( this.classNm+": "+methName+": start: data:["+data+"]"+
1225           " userForm.valid:["+userForm.valid+"]");
1226       if( this.utilityService.getTracelvl() > 0 )
1227         console.log( this.classNm+": "+methName+": tempAllData:["+
1228           JSON.stringify(this.tempAllData)+"]");
1229         this.disableGrpNotationValue = false
1230         if (data == null) {
1231             console.log( this.classNm+": "+methName+": data == null");
1232             return;
1233         }
1234         if((userForm.valid) && this.oldAction != '' && this.oldAction != undefined) {
1235             this.actionChanged = true;
1236           if( this.utilityService.getTracelvl() > 0 )
1237             console.log( this.classNm+": "+methName+
1238               ": userForm valid and oldAction defined");
1239             // Calling common Confirmation Modal
1240             let disposable = this.dialogService.addDialog(ConfirmComponent)
1241                 .subscribe((isConfirmed)=>{
1242                     //We get dialog result
1243                     if(isConfirmed) {
1244                         // User clicked on Yes
1245                         this.currentAction = this.referenceDataObject.action;
1246                         this.referenceDataObject.action = this.oldAction;
1247                         $('#saveToAppc').click();//make sure the save all is done before the tempall obj is saved form the API
1248                         this.toggleIdentifier(data)
1249                         this.oldAction = this.currentAction;// this.referenceDataObject.action + '';
1250                         this.referenceDataObject.action = this.currentAction
1251
1252                         this.populateExistinAction(data);
1253                         if (this.oldAction === 'OpenStack Actions') {
1254
1255                             this.uploadedDataArray = [];
1256                             this.remUploadedDataArray = [];
1257                             this.firstArrayElement = [];
1258                             this.uploadFileName = '';
1259                             //this.tempAllData = [];
1260                         }
1261                         this.clearCache();
1262                         this.refernceScopeObj.from = '';
1263                         this.getArtifactsOpenStack();
1264
1265                         // Clears VNFC Information data on action change
1266                         this.clearVnfcData()
1267                         this.resetVmsForScaleout(data);
1268                     }
1269                     else {
1270                         // User clicked on No
1271                         this.toggleIdentifier(data)
1272                         this.currentAction = this.referenceDataObject.action;
1273                         this.populateExistinAction(data);
1274                         this.resetVmsForScaleout(data);
1275                         this.oldAction = this.referenceDataObject.action + '';
1276                         this.clearCache();
1277                         this.clearVnfcData()
1278                         this.refernceScopeObj.from = '';
1279                     }
1280
1281                     if (this.referenceDataObject.action === 'Configure' || this.referenceDataObject.action === 'ConfigModify' || this.referenceDataObject.action === 'DistributeTraffic' || this.referenceDataObject.action === 'DistributeTrafficCheck') {
1282                         this.isConfigOrConfigModify = true;
1283                     } else {
1284                         this.isConfigOrConfigModify = false;
1285                         delete this.mappingEditorService.newObject['vnfc'];
1286                     }
1287     
1288                     // Enable or Block Template and PD Tabs
1289                     if ((this.currentAction == 'ConfigScaleOut' || this.currentAction == 'ConfigScaleIn') && this.templateIdentifier && this.templateIdentifier != '') {
1290                         // let referenceDataObjectTemp = this.referenceDataObject;
1291                         // referenceDataObjectTemp['template-id'] = this.templateIdentifier;
1292                         // this.buildDesignComponent.getRefData(referenceDataObjectTemp);
1293                         this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, { reqField: this.templateIdentifier });
1294     
1295                     } else {
1296                         this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
1297                     }    
1298                 });
1299         } else {
1300             console.log( this.classNm+": "+methName+
1301               ": userForm Not valid or oldAction not defined");
1302             this.actionChanged = true;
1303             this.currentAction = this.referenceDataObject.action;
1304             this.oldAction = this.referenceDataObject.action + '';
1305             this.populateExistinAction(data);
1306             this.resetVmsForScaleout(data);
1307             this.toggleIdentifier(data);
1308
1309             // Enable or Block Template and PD Tabs
1310             if((this.currentAction == 'ConfigScaleOut' || this.currentAction == 'ConfigScaleOut') && this.templateIdentifier) {
1311                 // let referenceDataObjectTemp = this.referenceDataObject;
1312                 // referenceDataObjectTemp['template-id'] = this.templateIdentifier;
1313                 // this.buildDesignComponent.getRefData(referenceDataObjectTemp);
1314                 this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, { reqField: this.templateIdentifier });
1315             } else {
1316                 this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
1317             }
1318         }
1319         if( this.utilityService.getTracelvl() > 0 )
1320           console.log( this.classNm+": "+methName+": tempAllData:["+
1321             JSON.stringify(this.tempAllData)+"]");
1322         this.configDrp(data)
1323     }
1324
1325     configDrp(data) {
1326         console.log( this.classNm+": configDrp: start: data:["+data+"]");
1327         if (data == 'ConfigScaleOut' || data == 'ConfigScaleIn') {
1328             this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value', 'existing-group-name'];
1329         } else {
1330             this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value'];
1331         }
1332         if (data == 'OpenStack Actions') {
1333             this.buildDesignComponent.tabs = this.referencDataTab;
1334         }
1335         else {
1336             this.buildDesignComponent.tabs = this.allTabs;
1337         }
1338         if (data == 'Configure' || data == 'ConfigModify' || data == 'DistributeTraffic' || data == 'DistributeTrafficCheck') {
1339             this.nonConfigureAction = false;
1340         } else {
1341             this.nonConfigureAction = true;
1342         }
1343     }
1344     // removing and adding the url key based on the protocol selected
1345     deviceProtocolChange() {
1346       let methName= "deviceProtocolChange";
1347       if( this.utilityService.getTracelvl() > 0 )
1348         console.log( this.classNm+": "+methName+": start.");
1349         if (this.referenceDataObject['device-protocol'] == 'REST') {
1350
1351         } else {
1352             delete this.referenceDataObject['context-url']
1353         }
1354         // Enable or Block Template and PD Tabs
1355         this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, {reqField: this.templateIdentifier})
1356         if( this.utilityService.getTracelvl() > 0 )
1357           console.log( this.classNm+": "+methName+": tempAllData:["+
1358             JSON.stringify(this.tempAllData)+"]");
1359     }
1360
1361     // used to call or trigger save object on template Identifier changes
1362     idChange(data, userForm) {
1363       if( this.utilityService.getTracelvl() > 0 )
1364         console.log( this.classNm+": idChange: start: data:["+data+"]");
1365         if (data == null) {
1366             return;
1367         }
1368
1369         // Enable or Block Template and PD Tabs
1370         // let referenceDataObjectTemp = this.referenceDataObject;
1371         // referenceDataObjectTemp['template-id'] = data;
1372         // this.buildDesignComponent.getRefData(referenceDataObjectTemp);
1373         this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, { reqField: data });
1374
1375         if ((userForm.valid)) {
1376             this.currentAction = "ConfigScaleOut"
1377             this.oldtemplateIdentifier = this.templateIdentifier
1378             let referenceObject = this.prepareReferenceObject();
1379             this.actionChanged = true;
1380             if (this.templateIdentifier) {
1381                  // Calling common Confirmation Modal
1382                  let disposable = this.dialogService.addDialog(ConfirmComponent)
1383                  .subscribe((isConfirmed)=>{
1384                      //We get dialog result
1385                      if(isConfirmed) {
1386                          // User clicked on Yes
1387                          this.validateTempAllData();
1388                          this.saveToAppc();
1389                          this.clearCache();
1390                          this.clearVnfcData();
1391                          this.refernceScopeObj.from = '';
1392                      }
1393                      else {
1394                          // User clicked on No
1395                          this.clearCache();
1396                          this.refernceScopeObj.from = '';
1397                      }
1398                  });
1399             }
1400         } else {
1401             this.oldtemplateIdentifier = this.templateIdentifier
1402         }
1403
1404         // if (this.referenceDataObject.action == 'ConfigScaleOut' && data ) {
1405         //     let referenceDataObjectTemp = this.referenceDataObject;
1406         //     referenceDataObjectTemp['selectedTemplateId'] = data;
1407         //     this.buildDesignComponent.getRefData(referenceDataObjectTemp);
1408         // } else {
1409         //     this.buildDesignComponent.getRefData(this.referenceDataObject);
1410         // }
1411     }
1412
1413     // used to call or trigger save object on multiple VNFC's changes
1414     vnfcChanged( data, userForm) {
1415       if( this.utilityService.getTracelvl() > 0 )
1416         console.log( this.classNm+": vnfcChanged: new vnfcIdentifier:["+data+"]");
1417       if( this.utilityService.getTracelvl() > 1 )
1418         console.log( this.classNm+": vnfcChanged: oldVnfcIdentifier:["+
1419           this.oldVnfcIdentifier+"]");
1420       if( this.utilityService.getTracelvl() > 0 )
1421         console.log(this.classNm+": vnfcChanged:  scope.vnfc-type:["+
1422           this.referenceDataObject.scope['vnfc-type']+"]");
1423         this.vnfcIdentifier = data;
1424         //this.clearCache();
1425         if (data == null) {
1426             return;
1427         }
1428       
1429         // Enable or Block Template and PD Tabs
1430         let referenceDataObjectTemp = this.referenceDataObject;
1431         referenceDataObjectTemp['vnfcIdentifier'] = data;
1432       if( this.utilityService.getTracelvl() > 0 )
1433         console.log( this.classNm+
1434           ": vnfcChanged: displayVnfc:["+this.displayVnfc+"]");
1435         //this.buildDesignComponent.getRefData(referenceDataObjectTemp);
1436         this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, { reqField: data });
1437
1438       
1439         console.log( this.classNm+
1440           ": vnfcChanged: userForm.valid:["+userForm.valid+"]");
1441         if ((userForm.valid) && this.oldVnfcIdentifier != '' && this.oldVnfcIdentifier != undefined) {
1442             this.currentAction = this.referenceDataObject.action
1443             this.oldVnfcIdentifier = this.vnfcIdentifier
1444             let referenceObject = this.prepareReferenceObject();
1445             this.actionChanged = true;
1446             if (this.vnfcIdentifier) {
1447                  // Calling common Confirmation Modal
1448                  let disposable = this.dialogService.addDialog(ConfirmComponent)
1449                  .subscribe((isConfirmed)=>{
1450                      //We get dialog result
1451                      if(isConfirmed) {
1452                          // User clicked on Yes
1453                          this.validateTempAllData();
1454                          this.saveToAppc();
1455                          this.clearCache();
1456                          this.clearVnfcData()
1457                          this.refernceScopeObj.from = '';
1458                          //.. populate VNFC Type in Sample field
1459                          this.setVnfcTypeInSample( this.vnfcIdentifier );
1460                      }
1461                      else {
1462                          // User clicked on No
1463                          this.clearCache();
1464                          this.clearVnfcData()
1465                          this.refernceScopeObj.from = '';
1466                          //.. populate VNFC Type in Sample field
1467                          this.setVnfcTypeInSample( this.vnfcIdentifier );
1468                      }
1469                  });
1470             }
1471         } else {
1472             if (data != null) {
1473                 this.oldVnfcIdentifier = this.vnfcIdentifier
1474             }
1475         }
1476     }
1477
1478     clearCache()
1479     //needed for the the clearing template cache.
1480     {
1481         // get the value and save the userid and persist it.
1482         this.clearTemplateCache();
1483         this.clearPdCache();
1484         this.appData = { reference: {}, template: { templateData: {}, nameValueData: {} }, pd: {} };
1485         this.downloadData = {
1486             reference: {},
1487             template: { templateData: {}, nameValueData: {}, templateFileName: '', nameValueFileName: '' },
1488             pd: { pdData: '', pdFileName: '' }
1489         };
1490     }
1491
1492     clearTemplateCache() {
1493         this.mappingEditorService.setTemplateMappingDataFromStore(undefined);
1494         localStorage['paramsContent'] = '{}';
1495     }
1496     clearPdCache() {
1497         this.mappingEditorService.setParamContent(undefined);
1498         this.paramShareService.setSessionParamData(undefined);
1499     }
1500
1501     browseOption() {
1502         $('#inputFile').trigger('click');
1503     }
1504
1505     excelBrowseOption() {
1506         $('#excelInputFile').trigger('click');
1507     }
1508
1509     /* showIdentifier() {
1510          $('#identifierModal').modal();
1511      }
1512  
1513      showVnfcPopup() {
1514          $('#vnfcModal').modal();
1515      }*/
1516
1517     addToIdentDrp() {
1518         if (!(this.referenceDataObject['template-id-list'])) {
1519             this.referenceDataObject['template-id-list'] = [];
1520         }
1521         if (!(this.referenceDataObject['template-id-list'].indexOf(this.templateId.trim()) > -1)) {
1522             this.referenceDataObject['template-id-list'].push(this.templateId.trim());
1523         }
1524
1525         // Changing newVnfcType value to blank otherwise it will show previous value in text box of popup
1526         this.templateId = ''
1527     }
1528     // adds the vnfc to the vnfc dropdown list
1529     addVnfc() {
1530       var newVnfcTypeV= this.newVnfcType.trim();
1531       if( this.utilityService.getTracelvl() > 0 )
1532         console.log(this.classNm+
1533           ": addVnfc: start: newVnfcTypeV:["+newVnfcTypeV+"]");
1534         if (!(this.referenceDataObject.scope['vnfc-type-list'])) {
1535             this.referenceDataObject.scope['vnfc-type-list'] = [];
1536             this.vnfcIdentifier = newVnfcTypeV;
1537         } else {
1538             this.vnfcIdentifier = newVnfcTypeV;
1539         }
1540         //this.referenceDataObject['vnfcIdentifier'] = this.vnfcIdentifier;
1541         if (!(this.referenceDataObject.scope['vnfc-type-list'].indexOf(newVnfcTypeV) > -1)) {
1542             this.referenceDataObject.scope['vnfc-type-list'].push(newVnfcTypeV);
1543         }
1544         this.tempAllData.forEach(obj => {
1545             if (obj.action == "Configure" || obj.action == "ConfigModify" || obj.action == "DistributeTraffic" || obj.action == "DistributeTrafficCheck") {
1546                 obj.scope['vnfc-type-list'] = this.referenceDataObject.scope['vnfc-type-list']
1547             }
1548             this.resetArtifactList(obj);
1549         });
1550         //this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
1551       this.setVnfcTypeInSample( newVnfcTypeV );
1552       let userForm = {valid: true};
1553       this.vnfcChanged(this.newVnfcType, userForm)
1554         // Changing newVnfcType value to blank otherwise it will show previous value in text box of popup
1555         this.newVnfcType = ''
1556     }
1557
1558     resetVms() {
1559         this.referenceDataObject.vm = [];
1560     }
1561
1562     dataModified() {
1563         //  this.referenceDataObject.vm = this.referenceDataObject.vm;
1564     }
1565     // used to show and hide the group notation value in VNFC information
1566     resetGroupNotation() {
1567         if (this.Sample['group-notation-type'] == "existing-group-name") {
1568             this.Sample['group-notation-value'] = ""
1569             this.disableGrpNotationValue = true
1570         } else {
1571             this.disableGrpNotationValue = false
1572         }
1573     }
1574
1575     resetVmsForScaleout(action) {
1576         //reset currentform vms based on action
1577         if (action == "ConfigScaleOut" || action == "Configure") {
1578             let ConfigScaleOutIndex = this.tempAllData.findIndex(obj => {
1579                 return obj['action'] == action
1580             });
1581             if (ConfigScaleOutIndex > -1) {
1582                 this.referenceDataObject.vm = this.tempAllData[ConfigScaleOutIndex].vm
1583             } else {
1584                 if (this.actionChanged) {
1585                     this.referenceDataObject.vm = []
1586                 }
1587             }
1588         }
1589     }
1590
1591     resetVmsForScaleIn(action) {
1592         //reset currentform vms based on action
1593         if (action == "ConfigScaleIn" || action == "Configure") {
1594             let ConfigScaleInIndex = this.tempAllData.findIndex(obj => {
1595                 return obj['action'] == action
1596             });
1597             if (ConfigScaleInIndex > -1) {
1598                 this.referenceDataObject.vm = this.tempAllData[ConfigScaleInIndex].vm
1599             } else {
1600                 if (this.actionChanged) {
1601                     this.referenceDataObject.vm = []
1602                 }
1603             }
1604         }
1605     }
1606
1607     resetParamsOnVnfcType() {
1608         let scopeName: any;
1609         let vnfcTypeList = this.referenceDataObject.scope['vnfc-type-list']
1610         let vnfcType = this.referenceDataObject.scope['vnfc-type']
1611         let vnfType = this.referenceDataObject.scope['vnf-type'];
1612         //called only if only vnf is there
1613         if ((this.referenceDataFormUtil.nullCheckForVnfcTypeList(vnfcTypeList)) && (this.referenceDataFormUtil.nullCheckForVnfcType(vnfcType))
1614         ) {
1615             scopeName = vnfType;
1616             this.referenceDataObject.scope['vnfc-type'] = '';
1617             this.referenceDataObject['action-level'] = 'vnf';
1618             this.referenceDataObject['scopeType'] = 'vnf-type';
1619             scopeName = scopeName.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
1620         }
1621         //if VNFC is entered set action level & Scope type to VNFC for configure and configure modify, and default the values to vnf and vnf type for all other actions  
1622         else {
1623             if (this.referenceDataFormUtil.nullCheckForVnfcTypeList(vnfcTypeList)) {
1624                 scopeName = vnfcType ? vnfcType : "";
1625             } else {
1626                 //    scopeName = this.referenceDataObject.scope['vnfc-type-list'];
1627             }
1628
1629             if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') {
1630                 this.referenceDataObject['action-level'] = 'vnf';
1631                 this.referenceDataObject['scopeType'] = 'vnfc-type';
1632             } else {
1633                 this.referenceDataObject['action-level'] = 'vnf';
1634                 this.referenceDataObject['scopeType'] = 'vnf-type';
1635             }
1636         }
1637         this.referenceDataObject.scope['vnfc-type'] = this.referenceDataObject.scope['vnfc-type'] ? this.referenceDataObject.scope['vnfc-type'] : "";
1638         return scopeName
1639     }
1640
1641     //used to form the structure of the reference file
1642     prepareArtifactList(scopeName, extension) {
1643         this.referenceDataObject['artifact-list'] = [];
1644         let configTemplate
1645         let pdTemplate
1646         let paramValue
1647         let vnf = this.referenceDataObject.scope['vnf-type']
1648         if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') {
1649             let vnfcTypeList = this.referenceDataObject.scope['vnfc-type-list'];
1650             let pd_fileName
1651             let config_template_fileName
1652
1653             let param_fileName
1654             if (vnfcTypeList && vnfcTypeList.length > 0) {
1655
1656
1657                 for (var x = 0; x < vnfcTypeList.length; x++) {
1658                     //for replacing spaces and "/" with "_"
1659                     let type = vnfcTypeList[x].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
1660                     pd_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, type, '.yaml')
1661                     config_template_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, type, extension)
1662                     param_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, type, '.json')
1663                     configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
1664                     pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
1665                     paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
1666
1667                     this.referenceDataObject['artifact-list'].push(configTemplate,
1668                         pdTemplate, paramValue
1669                     );
1670                 }
1671             } else if (scopeName) {
1672                 pd_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V.yaml';
1673                 config_template_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V' + extension;
1674                 param_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V.json';
1675                 configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
1676                 pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
1677                 paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
1678                 this.referenceDataObject['artifact-list'].push(configTemplate,
1679                     pdTemplate, paramValue
1680                 );
1681             }
1682
1683         } else {
1684
1685             //preparing the artifact list array file names along with extension
1686             let config_template_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', extension);
1687             let pd_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', '.yaml');
1688             let reference_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', '.json');
1689             let param_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', '.json');
1690             configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
1691             pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
1692             paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
1693             if (this.referenceDataObject.action != 'ConfigScaleOut' && this.referenceDataObject.action != 'ConfigScaleIn') {
1694
1695                 this.referenceDataObject['artifact-list'].push(configTemplate,
1696                     pdTemplate, paramValue
1697                 );
1698
1699             } else {
1700
1701                 let identifiers = this.referenceDataObject['template-id-list'];
1702                 if (identifiers) {
1703                     for (var x = 0; x < identifiers.length; x++) {
1704                         //for replacing spaces and "/" with "_"
1705                         let type = identifiers[x].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
1706                         pd_fileName = this.referenceDataFormUtil.createArtifactNameForIdentifiers(this.referenceDataObject.action, this.referenceDataObject.scope["vnf-type"], type, '.yaml');
1707                         config_template_fileName = this.referenceDataFormUtil.createArtifactNameForIdentifiers(this.referenceDataObject.action, this.referenceDataObject.scope["vnf-type"], type, extension);
1708                         param_fileName = this.referenceDataFormUtil.createArtifactNameForIdentifiers(this.referenceDataObject.action, this.referenceDataObject.scope["vnf-type"], type, '.json');
1709                         configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
1710                         pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
1711                         paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
1712
1713                         this.referenceDataObject['artifact-list'].push(configTemplate,
1714                             pdTemplate, paramValue
1715                         );
1716                     }
1717                 }
1718
1719             }
1720         }
1721     }
1722     // used to remove the added vms for actions other than configure & scaleout
1723     deleteVmsforNonActions(newObj, action) {
1724         let configureObject = (action == 'Configure');
1725         let ConfigScale = (action == 'ConfigScaleOut') || (action == 'ConfigScaleIn');
1726         //delete VM's if selected action is not configure.
1727         if (!ConfigScale && !configureObject && this.tempAllData.length != 0) {
1728             if (ConfigScale) {
1729             } else {
1730                 newObj.vm = [];
1731             }
1732         } else {
1733             if (ConfigScale) {
1734             } else {
1735                 delete newObj['template-id-list'];
1736             }
1737         }
1738         return newObj
1739     }
1740     
1741     // used to replace the data in tempall obj and form the artifact names
1742     pushOrReplaceTempData(newObj, action) {
1743         let configTemplate
1744         let pdTemplate
1745         let paramValue
1746         if (newObj.action == "Configure" || newObj.action == "ConfigModify" || newObj.action == "DistributeTraffic" || newObj.action == "DistributeTrafficCheck") {
1747             let extension = this.referenceDataFormUtil.decideExtension(this.referenceDataObject);
1748             let pd_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + (newObj['vnfcIdentifier'] ? (newObj['vnfcIdentifier'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_') : "") + '0.0.1V.yaml';
1749             let config_template_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + (newObj['vnfcIdentifier'] ? (newObj['vnfcIdentifier'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_') : "") + '0.0.1V' + extension;
1750             let param_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + (newObj['vnfcIdentifier'] ? (newObj['vnfcIdentifier'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_') : "") + '0.0.1V.json';
1751             configTemplate = this.referenceDataFormUtil.createConfigTemplateForPushReplaceData(config_template_fileName);
1752             pdTemplate = this.referenceDataFormUtil.createPdTemplateForPushReplaceData(pd_fileName);
1753             paramValue = this.referenceDataFormUtil.createParamValueForPushReplaceData(param_fileName);
1754             let idValue = ""
1755             if (newObj.scope['vnfc-type']) {
1756                 idValue = newObj.scope['vnfc-type']
1757             } else if (this.vnfcIdentifier) {
1758                 idValue = this.vnfcIdentifier
1759             }
1760
1761             let arr = [configTemplate, pdTemplate, paramValue]
1762             this.mappingEditorService.selectedObj({
1763                 action: newObj.action,
1764                 vnf: newObj.scope['vnf-type'] ? newObj.scope['vnf-type'] : "",
1765                 vnfc: idValue,
1766                 protocol: newObj['device-protocol'] ? newObj['device-protocol'] : "",
1767                 param_artifact: paramValue['param_artifact'],
1768                 pd_artifact: pdTemplate['pd_artifact'],
1769                 template_artifact: configTemplate['template_artifact']
1770             });
1771         } else if (newObj.action == "ConfigScaleOut" || newObj.action == "ConfigScaleIn") {
1772             let extension = this.referenceDataFormUtil.decideExtension(newObj);
1773             let pd_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_0.0.1V' + '_' + (this.templateIdentifier ? (this.templateIdentifier.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '')) : "") + ".yaml";
1774             let config_template_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V_' + (this.templateIdentifier ? (this.templateIdentifier.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '') : "") + extension;
1775             let param_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V_' + (this.templateIdentifier ? (this.templateIdentifier.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '') : "") + '.json';
1776             configTemplate = this.referenceDataFormUtil.createConfigTemplateForPushReplaceData(config_template_fileName);
1777             pdTemplate = this.referenceDataFormUtil.createPdTemplateForPushReplaceData(pd_fileName);
1778             paramValue = this.referenceDataFormUtil.createParamValueForPushReplaceData(param_fileName);
1779             let arr = [configTemplate, pdTemplate, paramValue]
1780             this.mappingEditorService.selectedObj({
1781                 action: newObj.action,
1782                 vnf: newObj.scope['vnf-type'] ? newObj.scope['vnf-type'] : "",
1783                 //vnfc: newObj['vnfcIdentifier'] ? newObj['vnfcIdentifier'] : "",
1784                 protocol: newObj['device-protocol'] ? newObj['device-protocol'] : "",
1785                 templateId: this.templateIdentifier,
1786                 param_artifact: paramValue['param_artifact'],
1787                 pd_artifact: pdTemplate['pd_artifact'],
1788                 template_artifact: configTemplate['template_artifact']
1789             });
1790         }
1791         else {
1792             let extension = this.referenceDataFormUtil.decideExtension(newObj);
1793             let pd_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.yaml';
1794             let config_template_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V' + extension;
1795             let param_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.json';
1796             configTemplate = this.referenceDataFormUtil.createConfigTemplateForPushReplaceData(config_template_fileName);
1797             pdTemplate = this.referenceDataFormUtil.createPdTemplateForPushReplaceData(pd_fileName);
1798             paramValue = this.referenceDataFormUtil.createParamValueForPushReplaceData(param_fileName);
1799             let arr = [configTemplate, pdTemplate, paramValue]
1800             this.mappingEditorService.selectedObj({
1801                 action: newObj.action,
1802                 vnf: newObj.scope['vnf-type'] ? newObj.scope['vnf-type'] : "",
1803                 protocol: newObj['device-protocol'] ? newObj['device-protocol'] : "",
1804                 param_artifact: paramValue['param_artifact'],
1805                 pd_artifact: pdTemplate['pd_artifact'],
1806                 template_artifact: configTemplate['template_artifact']
1807             });
1808         }
1809
1810         let actionObjIndex = this.tempAllData.findIndex(obj => {
1811             return obj['action'] == action;
1812         });
1813         if (actionObjIndex > -1) {
1814             this.tempAllData[actionObjIndex] = newObj;
1815             this.mappingEditorService.saveLatestAction(this.tempAllData[actionObjIndex]);
1816             if (newObj.action == "ConfigScaleOut" || newObj.action == "ConfigScaleIn") {
1817                 this.mappingEditorService.saveLatestIdentifier(this.templateIdentifier);
1818             }
1819             else {
1820                 this.templateIdentifier = ('')
1821                 this.mappingEditorService.saveLatestIdentifier(this.templateIdentifier)
1822             }
1823         } else {
1824             if (newObj.action != '') {
1825
1826                 this.tempAllData.push(newObj);
1827                 this.mappingEditorService.saveLatestAction(newObj);
1828
1829                 if (newObj.action == "ConfigScaleOut" || newObj.action == "ConfigScaleIn") {
1830                     this.mappingEditorService.saveLatestIdentifier(this.templateIdentifier);
1831                 }
1832                 else {
1833                     this.templateIdentifier = ('')
1834                     this.mappingEditorService.saveLatestIdentifier(this.templateIdentifier)
1835                 }
1836             }
1837         }
1838     }
1839     // removes the unwanted keys added in the artifact for vnfc level actions
1840     deleteUnwantedKeys(newObj) {
1841         newObj = JSON.parse(JSON.stringify(newObj))
1842         delete newObj['template-id']
1843         delete newObj['vnfcIdentifier']
1844         if (newObj.action != "ConfigScaleOut" && newObj.action != "ConfigScaleIn") {
1845             delete newObj['template-id-list']
1846         }
1847         if (newObj.action != 'HealthCheck') {
1848             delete newObj['url'];
1849         }
1850         if (newObj.action != "Configure" && newObj.action != "ConfigModify" && newObj.action != "DistributeTraffic" && newObj.action != "DistributeTrafficCheck") {
1851             newObj.scope['vnfc-type-list'] = [];
1852         }
1853         return newObj
1854     }
1855
1856     addAllActionObj(newObj, scopeName) {
1857
1858         //Creating all action block to allow mulitple actions at once
1859         let allAction = {
1860             action: 'AllAction',
1861             'action-level': 'vnf',
1862             scope: newObj.scope,
1863             'artifact-list': []
1864         };
1865         let vnfType = this.referenceDataObject.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
1866
1867         allAction['artifact-list'].push({
1868             'artifact-name': 'reference_AllAction' + '_' + vnfType + '_' + '0.0.1V.json',
1869             'artifact-type': 'reference_template'
1870         })
1871
1872         let allActionIndex = this.tempAllData.findIndex(obj => {
1873             return obj['action'] == 'AllAction';
1874         });
1875         if (allActionIndex > -1) {
1876             this.tempAllData[allActionIndex] = allAction;
1877         } else {
1878             this.tempAllData.push(allAction);
1879         }
1880     }
1881
1882     resetTempData() {
1883       let methName= "resetTempData";
1884       if( this.utilityService.getTracelvl() > 0 )
1885         console.log( this.classNm+": "+methName+": start.");
1886       if( this.utilityService.getTracelvl() > 0 )
1887         console.log( this.classNm+": "+methName+": tempAllData:["+
1888           JSON.stringify(this.tempAllData)+"]");
1889         if (this.utilityService.checkNotNull(this.uploadedDataArray)) {
1890
1891             if (this.utilityService.checkNotNull(this.tempAllData)) {
1892                 for (var i = 0; i < this.tempAllData.length; i++) {
1893                     var result = false;
1894
1895                     if (this.tempAllData[i].action === 'AllAction') {
1896                         result = true;
1897                     }
1898                     else {
1899                         result = this.checkIfelementExistsInArray(this.tempAllData[i].action, this.actions);
1900                     }
1901                     if (!result) {
1902                         this.tempAllData.splice(i, 1);
1903                         i = i - 1;
1904                     }
1905
1906                 }
1907             }
1908             this.addVmCapabilitiesData();
1909         }
1910     }
1911
1912     trackByFn(index, item) {
1913         return index; // or item.id
1914     }
1915     getArtifactsOpenStack() {
1916         var array = []
1917         var vnfcFunctionCodeArrayList = [];
1918         var vnfcSetArray = [];
1919         //  var vnfcSet = new Set();
1920         for (var i = 0; i < this.tempAllData.length; i++) {
1921             if (!this.checkIfelementExistsInArray(this.tempAllData[i].action, this.actions) && (this.tempAllData[i].action != 'AllAction')) {
1922                 var vnfcFunctionCodeArray = this.tempAllData[i]["vnfc-function-code-list"]
1923                 // vnfcSet.add("Actions")
1924                 /*  for (var j = 0; j < vnfcFunctionCodeArray.length; j++) {
1925                       vnfcSet.add(vnfcFunctionCodeArray[j])
1926                   }*/
1927                 vnfcFunctionCodeArrayList.push([this.tempAllData[i].action].concat(this.tempAllData[i]["vnfc-function-code-list"]))
1928             }
1929             if (this.tempAllData[i].action === 'OpenStack Actions') {
1930                 vnfcSetArray = this.tempAllData[i]['firstRowVmSpreadSheet']
1931             }
1932         }
1933
1934         if (vnfcSetArray) {
1935             let vnfcSetArrayLen = vnfcSetArray.length;
1936
1937             for (let i = 0; i < vnfcFunctionCodeArrayList.length; i++) {
1938                 let element = vnfcFunctionCodeArrayList[i];
1939                 for (let j = 1; j < element.length; j++) {
1940                     for (let k = j; k < vnfcSetArrayLen; k++) {
1941                         if (element[j] === vnfcSetArray[k]) {
1942                             element[j] = 'Y';
1943                         }
1944                         else {
1945                             element.splice(j, 0, '');
1946                         }
1947                         break;
1948                     }
1949                 }
1950             }
1951             this.firstArrayElement = vnfcSetArray;
1952             this.remUploadedDataArray = vnfcFunctionCodeArrayList;
1953         }
1954     }
1955
1956     // Common method to show validation errors
1957     private showValidationErrors(referenceDataObject) {
1958         if (this.referenceDataObject.action === '') {
1959             this.nService.error('Error', 'Select a valid Action');
1960             return;
1961         }
1962         if (this.referenceDataObject['device-protocol'] === '') {
1963             this.nService.error('Error', 'Select a valid Device protocol');
1964             return;
1965         }
1966
1967         if ((referenceDataObject.action === 'ConfigScaleOut' 
1968         || referenceDataObject.action === 'ConfigScaleIn') 
1969         && !this.templateIdentifier) {
1970             this.nService.error('Error', 'Select a valid Template Identifier');
1971         }
1972
1973         // if ((referenceDataObject.action === 'Configure' || referenceDataObject.action === 'ConfigModify') && !this.vnfcIdentifier && this.displayVnfc != 'false') {
1974         //     this.nService.error('Error', 'Select a valid Vnfc Type');
1975         //     return;
1976         // }
1977     }
1978
1979     resetArtifactList(obj) {
1980       if( this.utilityService.getTracelvl() > 0 )
1981         console.log( this.classNm+": resetArtifactList: start...");
1982         let vnfcTypeList = obj.scope['vnfc-type-list'];
1983         let vnf = this.referenceDataObject.scope['vnf-type']
1984         let pd_fileName
1985         let config_template_fileName
1986         let configTemplate
1987         let pdTemplate
1988         let paramValue
1989         let param_fileName
1990         obj['artifact-list'] = [];
1991         for (var x = 0; x < vnfcTypeList.length; x++) {
1992             let extension = this.referenceDataFormUtil.decideExtension(obj)
1993             //for replacing spaces and "/" with "_"
1994             let type = vnfcTypeList[x].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
1995             pd_fileName = this.referenceDataObject.action + '_' + vnf.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + type + '_' + '0.0.1V.yaml';
1996             config_template_fileName = this.referenceDataObject.action + '_' + vnf.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + type + '_' + '0.0.1V' + extension;
1997             param_fileName = this.referenceDataObject.action + '_' + vnf.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + type + '_' + '0.0.1V.json';
1998             configTemplate = {
1999                 'artifact-name': 'template_' + config_template_fileName,
2000                 'artifact-type': 'config_template'
2001             };
2002             pdTemplate = {
2003                 'artifact-name': 'pd_' + pd_fileName,
2004                 'artifact-type': 'parameter_definitions'
2005             };
2006             paramValue = {
2007                 'artifact-name': 'param_' + param_fileName,
2008                 'artifact-type': 'param_values'
2009             };
2010
2011             this.referenceDataObject['artifact-list'].push(configTemplate,
2012                 pdTemplate, paramValue
2013             );
2014             obj['artifact-list'].push(configTemplate,
2015                 pdTemplate, paramValue
2016             );
2017         }
2018     }
2019
2020     /**
2021      * Handles the display of VM block based on the action change
2022      */
2023     handleVMBlockDisplay() {
2024         switch (this.referenceDataObject.action) {
2025             case this.actionList.ConfigScaleOut:
2026             case this.actionList.ConfigScaleIn:
2027             case this.actionList.Configure:
2028             case undefined:
2029             case '':
2030                 this.displayVMBlock = true;
2031                 break;
2032             default:
2033                 this.displayVMBlock = false;
2034         }
2035     }
2036
2037   //.. check VNFC Type equality in Upper Selection vs entered in Sample field
2038   checkVnfcTypeEqual( vnfctp: string ) {
2039     var methName= "checkVnfcTypeEqual";
2040     if( this.utilityService.getTracelvl() > 0 )
2041       console.log(this.classNm+": "+methName+": vnfctp:["+vnfctp+"]");
2042     if( this.utilityService.getTracelvl() > 0 )
2043       console.log( this.classNm+": "+methName+": vnfcIdentifier:["+
2044         this.vnfcIdentifier+"]");
2045     if( this.utilityService.getTracelvl() > 1 )
2046       console.log( this.classNm+": "+methName+":  Sample[vnfc-type]:["+
2047         this.Sample['vnfc-type']+"]");
2048     if( vnfctp != null && vnfctp.length > 0 ) {
2049       if( this.vnfcIdentifier != null && this.vnfcIdentifier.length > 0 ) {
2050         console.log(
2051           this.classNm+": "+methName+": compare non empty VNFC Types...");
2052         if( vnfctp != this.vnfcIdentifier ) {
2053           if( this.utilityService.getTracelvl() > 0 )
2054             console.log( this.classNm+": "+methName+": Non-match WARNING !");
2055           //.. display in pop-up
2056           this.nService.warn( 'WARNING',
2057             "The specified VNFC Types don't match."+
2058             " Can cause discrepancy in the artifacts.", this.options );
2059         } else {
2060           if( this.utilityService.getTracelvl() > 0 )
2061             console.log(this.classNm+": checkVnfcTypeEqual: VNFC Types're equal.");
2062         };
2063       };
2064     };
2065   };
2066
2067   //.. populating VNFC Type in Sample fields
2068   setVnfcTypeInSample( vnfctp: string ) {
2069     //clear vnfc information samples
2070       this.clearVnfcData();
2071
2072     if( this.utilityService.getTracelvl() > 0 )
2073       console.log( this.classNm+": setVnfcTypeInSample: vnfctp:["+vnfctp+"]");
2074     this.Sample['vnfc-type']= vnfctp;
2075   };
2076
2077     /**
2078      * Procesess reference data after retrieval from appc or after a reference file has been uploaded from PC.
2079     */
2080     processReferenceDataAfterRetrieval() {
2081       if( this.utilityService.getTracelvl() > 0 )
2082         console.log( this.classNm+": processReferenceDataAfterRetr: start...");
2083         if (this.referenceDataObject.action === 'OpenStack Actions') {
2084             this.deviceProtocols = ['', 'OpenStack'];
2085             this.buildDesignComponent.tabs = this.referencDataTab;
2086         } else {
2087             this.buildDesignComponent.tabs = this.allTabs;
2088         }
2089       if( this.utilityService.getTracelvl() > 1 )
2090         console.log( this.classNm+": processReferenceDataAfterRetr: done.");
2091       if( this.utilityService.getTracelvl() > 0 )
2092         console.log( this.classNm+":  vnfcIdentifier:["+this.vnfcIdentifier+"]");
2093       if( this.utilityService.getTracelvl() > 1 )
2094         console.log( this.classNm+":  oldVnfcIdentifier:["+
2095           this.oldVnfcIdentifier+"]");
2096       if( this.utilityService.getTracelvl() > 0 )
2097         console.log( this.classNm+":  refDataObj.scope.vnfc-type:["+
2098           this.referenceDataObject.scope['vnfc-type']+"]");
2099       this.setVnfcTypeInSample( this.vnfcIdentifier );
2100     }
2101
2102 }