aboutsummaryrefslogtreecommitdiffstats
path: root/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts')
-rw-r--r--src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts1479
1 files changed, 777 insertions, 702 deletions
diff --git a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts
index 17a23e2..5cd0e71 100644
--- a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts
+++ b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts
@@ -3,8 +3,7 @@
===================================================================
Copyright (C) 2018 AT&T Intellectual Property. All rights reserved.
===================================================================
-Copyright (C) 2018 IBM.
-===================================================================
+
Unless otherwise specified, all software contained herein is licensed
under the Apache License, Version 2.0 (the License);
you may not use this software except in compliance with the License.
@@ -17,18 +16,20 @@ distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
+
============LICENSE_END============================================
*/
import * as XLSX from 'xlsx';
import * as _ from 'underscore';
+
import { ActivatedRoute, Router } from '@angular/router';
import { Component, OnInit, ViewChild } from '@angular/core';
+import { Observable } from 'rxjs/Observable';
import { BuildDesignComponent } from '../build-artifacts.component';
import { HttpUtilService } from '../../../shared/services/httpUtil/http-util.service';
import { Location } from '@angular/common';
import { MappingEditorService } from '../../..//shared/services/mapping-editor.service';
-import { ModalComponent } from '../../../shared/modal/modal.component';
import { NgProgress } from 'ngx-progressbar';
import { NgbModal } from '@ng-bootstrap/ng-bootstrap';
import { NotificationService } from '../../../shared/services/notification.service';
@@ -36,16 +37,18 @@ import { NotificationsService } from 'angular2-notifications';
import { ParamShareService } from '../../..//shared/services/paramShare.service';
import { environment } from '../../../../environments/environment';
import { saveAs } from 'file-saver';
+import { Jsonp } from '@angular/http';
import { ReferenceDataFormUtil } from './reference-dataform.util';
import { UtilityService } from '../../../shared/services/utilityService/utility.service';
-import { appConstants } from '../../../../constants/app-constants';
+import { APIService } from "../../../shared/services/cdt.apicall";
+
// Common Confirm Modal
import { DialogService } from 'ng2-bootstrap-modal';
import { ConfirmComponent } from "../../../shared/confirmModal/confirm.component";
+
declare var $: any;
type AOA = Array<Array<any>>;
-const REFERENCE_DATA: string = "reference_data";
@Component({
selector: 'reference-dataform',
@@ -54,8 +57,7 @@ const REFERENCE_DATA: string = "reference_data";
providers: [ReferenceDataFormUtil]
})
export class ReferenceDataformComponent implements OnInit {
- public classNm = "ReferenceDataformCompon";
- @ViewChild(ModalComponent) modalComponent: ModalComponent;
+ public classNm= "ReferenceDataformComp";
public showUploadStatus: boolean = false;
public fileUploaded: boolean = false;
public uploadedData: any;
@@ -86,8 +88,8 @@ export class ReferenceDataformComponent implements OnInit {
errorMessage = '';
invalid = true;
fileName: any;
- vnfcIdentifier = '';
- oldVnfcIdentifier: any;
+ vnfcIdentifier;
+ oldVnfcIdentifier: any
public uploadFileName: any;
public addVmClickedFlag: boolean = false;
public getExcelUploadStatus: boolean = false;
@@ -107,13 +109,13 @@ export class ReferenceDataformComponent implements OnInit {
identifierDrpValues: any = [];
//settings for the notifications.
options = {
- timeOut: 1000,
+ timeOut: 4500,
showProgressBar: true,
pauseOnHover: true,
clickToClose: true,
maxLength: 200
};
- //initializing this object to contain all the parameters to be captured
+ //initializing this object to contain all the parameters to be captured later
public referenceDataObject = {
action: '',
'action-level': 'vnf',
@@ -126,31 +128,12 @@ export class ReferenceDataformComponent implements OnInit {
'artifact-list': []
};
public refernceScopeObj = { sourceType: '', from: '', to: '' };
- public actions = [appConstants.Actions.blank,
- appConstants.Actions.configure,
- appConstants.Actions.ConfigModify,
- appConstants.Actions.configBackup,
- appConstants.Actions.configRestore,
- appConstants.Actions.getRunningConfig,
- appConstants.Actions.healthCheck,
- appConstants.Actions.startApplication,
- appConstants.Actions.stopApplication,
- appConstants.Actions.quiesceTraffic,
- appConstants.Actions.resumeTraffic,
- appConstants.Actions.distributeTraffic,
- appConstants.Actions.upgradeBackout,
- appConstants.Actions.upgradeBackup,
- appConstants.Actions.upgradePostCheck,
- appConstants.Actions.upgradePreCheck,
- appConstants.Actions.upgradeSoftware,
- appConstants.Actions.openStackActions,
- appConstants.Actions.configScaleOut
- ];
- public groupAnotationValue = [appConstants.groupAnotationValue.blank, appConstants.groupAnotationValue.pair];
- public groupAnotationType = [appConstants.groupAnotationType.blank, appConstants.groupAnotationType.firstVnfcName, appConstants.groupAnotationType.fixedValue, appConstants.groupAnotationType.relativeValue];
- public deviceProtocols = [appConstants.DeviceProtocols.blank, appConstants.DeviceProtocols.ansible, appConstants.DeviceProtocols.chef, appConstants.DeviceProtocols.netconfXML, appConstants.DeviceProtocols.rest, appConstants.DeviceProtocols.cli, appConstants.DeviceProtocols.restConf];
- public deviceTemplates = [appConstants.deviceTemplates.blank, appConstants.deviceTemplates.y, appConstants.deviceTemplates.n];
- public sourceTypeColl = [appConstants.sourceTypeColl.blank, appConstants.sourceTypeColl.vnfType, appConstants.sourceTypeColl.vnfcType];
+ public actions = ['', 'Configure', 'ConfigModify', 'ConfigBackup', 'ConfigRestore', 'GetRunningConfig', 'HealthCheck', 'StartApplication', 'StopApplication', 'QuiesceTraffic', 'ResumeTraffic', 'DistributeTraffic', 'UpgradeBackout', 'UpgradeBackup', 'UpgradePostCheck', 'UpgradePreCheck', 'UpgradeSoftware', 'OpenStack Actions', 'ConfigScaleOut'];
+ public groupAnotationValue = ['', 'Pair'];
+ public groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value'];
+ public deviceProtocols = ['', 'ANSIBLE', 'CHEF', 'NETCONF-XML', 'REST', 'CLI', 'RESTCONF'];
+ public deviceTemplates = ['', 'Y', 'N'];
+ public sourceTypeColl = ['', 'vnfType', 'vnfcType'];
public ipAddressBoolean = ['', 'Y', 'N'];
public Sample: any = {
'vnfc-instance': '1',
@@ -186,40 +169,54 @@ export class ReferenceDataformComponent implements OnInit {
public firstArrayElement = [];
public remUploadedDataArray = [];
isConfigScaleOut = false
- isConfigureAction = false;
- configScaleOutExist: boolean = true;
+ isConfigOrConfigModify = false
+ configScaleOutExist: boolean
displayVnfc = 'false';
isVnfcType: boolean;
isVnfcTypeList: boolean = true;
- public actionList = {
- "ConfigScaleOut": "ConfigScaleOut",
- "Configure": "Configure"
- };
- public versionNoForApiCall = "0.0.1";
+ public referencDataTab = [
+ {
+
+ name: 'Reference Data',
+ url: 'references',
+ }];
+ public allTabs = [
+ {
+ name: 'Reference Data',
+ url: 'references',
+ }, {
+ name: 'Template',
+ url: 'templates/myTemplates',
+ }, {
+ name: 'Parameter Definition',
+ url: 'parameterDefinitions/create'
+ }/*, {
+ name: "Test",
+ url: 'test',
+ }*/
+ ];
+ public actionList = require('../../../../cdt.application.properties.json').Actions;
+
+ public versionNoForApiCall = require('../../../../cdt.application.properties.json').versionNoForApiCall;
private displayVMBlock: boolean = true;
- constructor (
- private buildDesignComponent: BuildDesignComponent,
- private httpUtils: HttpUtilService,
- private route: Router,
- private location: Location,
- private activeRoutes: ActivatedRoute,
- private notificationService: NotificationService,
- private paramShareService: ParamShareService,
- private mappingEditorService: MappingEditorService,
- private modalService: NgbModal,
- private nService: NotificationsService,
- private ngProgress: NgProgress,
- private utilityService: UtilityService,
- private dialogService: DialogService,
- private referenceDataFormUtil: ReferenceDataFormUtil) {
- console.log(this.classNm + ": new: start.");
+ constructor(
+ 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,
+ private paramShareService: ParamShareService, private mappingEditorService: MappingEditorService, private modalService: NgbModal, private nService: NotificationsService, private ngProgress: NgProgress,
+ private dialogService: DialogService)
+ {
+ console.log(this.classNm+
+ ": new: start: tracelvl="+this.utilityService.getTracelvl() );
}
ngOnInit() {
- let methName = "ngOnInit";
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": " + methName + ": start.");
+ let methName= "ngOnInit";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": ngOnInit: start ");
+ // this.handleVMBlockDisplay();
+
+ //initializing the variables and checking for configscaleout fromm properties file
+ this.configScaleOutExist = require('../../../../cdt.application.properties.json').displayConfigScaleout;
this.displayVnfc = sessionStorage.getItem("vnfcSelectionFlag");
if (this.configScaleOutExist) {
this.actions = ['', 'Configure', 'ConfigModify', 'ConfigBackup', 'ConfigRestore', 'GetRunningConfig', 'HealthCheck', 'StartApplication', 'StopApplication', 'QuiesceTraffic', 'ResumeTraffic', 'DistributeTraffic', 'UpgradeBackout', 'UpgradeBackup', 'UpgradePostCheck', 'UpgradePreCheck', 'UpgradeSoftware', 'OpenStack Actions', 'ConfigScaleOut'];
@@ -229,6 +226,7 @@ export class ReferenceDataformComponent implements OnInit {
this.self = this;
let path = this.location.path;
this.title = 'Reference Data';
+ // setting the structure for the reference data object
this.referenceDataObject = {
action: '',
'action-level': 'vnf',
@@ -240,40 +238,57 @@ export class ReferenceDataformComponent implements OnInit {
'port-number': '',
'artifact-list': []
};
+ //getting the data from session data, calling get Artifact if the data is undefined
this.updateParams = sessionStorage.getItem('updateParams');
+ //getting the data from the referencenameobjects if the nav is changed and assiging it to the cace data
let cacheData = this.mappingEditorService.referenceNameObjects;
- if (cacheData != undefined && cacheData != null && cacheData.length > 0) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": ngOnInit: have cacheData.");
+
+ if (this.utilityService.checkNotNull(cacheData)) {
+ //if cache data exists then assiging the data to the latest temp all data object.
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": ngOnInit: have cacheData.");
this.tempAllData = cacheData;
+ //calling the highligted method to highlight the selected actions in the action dropdown
+ this.highlightSelectedActions(this.tempAllData)
+ // 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
if (this.mappingEditorService.latestAction != undefined) {
+ //adding the latest action to the screen
this.referenceDataObject = this.mappingEditorService.latestAction;
this.toggleIdentifier(this.referenceDataObject.action);
+ //this.referenceDataObject['template-id-list'] = this.mappingEditorService.identifier
+ //use these commented objects to be used in template and pd pages
+ //this.templateIdentifier = this.mappingEditorService.identifier
+ //adding the scope from referencedata obj to referencescopeobject
this.refernceScopeObj.sourceType = this.referenceDataObject['scopeType'];
+ //assigning the latest action fetched to the old action from reference data object
this.oldAction = this.referenceDataObject.action;
+ //this method is called with the action reterived and subsequent values are assigned to refdataobj for displaying
this.populateExistinAction(this.referenceDataObject.action);
this.displayHideVnfc();
}
} else if (this.updateParams != 'undefined') {
+ //calls the get artifact() to reterive the values if cache data is not present
this.getArtifact();
}
+ //getting the appdata & downloadDataObject from mapping editor service and assiging it.
var appData = this.mappingEditorService.appDataObject;
if (appData != null || appData != undefined) this.appData = appData;
var downloadData = this.mappingEditorService.downloadDataObject;
if (downloadData != null || downloadData != undefined) this.downloadData = downloadData;
+
if (sessionStorage.getItem('vnfParams')) {
this.vnfParams = JSON.parse(sessionStorage.getItem('vnfParams'));
}
if (this.vnfParams && this.vnfParams.vnfType) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": " + methName + ": vnfParams.vnfType:[" +
- this.vnfParams.vnfType + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": vnfParams.vnfType:["+
+ this.vnfParams.vnfType+"]");
this.referenceDataObject['scope']['vnf-type'] = this.vnfParams.vnfType;
}
if (this.vnfParams && this.vnfParams.vnfcType) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": " + methName + ": vnfParams.vnfcType:[" +
- this.vnfParams.vnfcType + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": vnfParams.vnfcType:["+
+ this.vnfParams.vnfcType+"]");
this.referenceDataObject['scope']['vnfc-type'] = this.vnfParams.vnfcType;
}
this.uploadedDataArray = [];
@@ -281,23 +296,34 @@ export class ReferenceDataformComponent implements OnInit {
this.firstArrayElement = [];
this.uploadFileName = '';
this.templateIdentifier = this.mappingEditorService.identifier
+ // if (this.mappingEditorService.newObject) {
+ // this.vnfcIdentifier = this.mappingEditorService.newObject.vnfc;
+ // }
+ // else {
+ // this.vnfcIdentifier = '';
+ // this.referenceDataObject['vnfcIdentifier'] = '';
+ // }
this.oldVnfcIdentifier = this.vnfcIdentifier;
- if (this.utilityService.getTracelvl() > 1)
- console.log(this.classNm + ": " + methName + ": displayVnfc:[" +
- this.displayVnfc + "]");
- if (this.utilityService.getTracelvl() > 1)
- console.log(this.classNm + ": " + methName + ": templateIdentifier:[" +
- this.templateIdentifier + "]");
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": "+methName+": displayVnfc:["+
+ this.displayVnfc+"]");
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": "+methName+": templateIdentifier:["+
+ this.templateIdentifier+"]");
// Enable or Block Template and PD Tabs
this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc },
- { reqField: this.templateIdentifier });
+ { ...this.referenceDataObject, displayVnfc: this.displayVnfc },
+ { reqField: this.templateIdentifier });
//.. configure some drop-downs
- this.configDrp(this.referenceDataObject.action)
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": " + methName + ": finish.");
+ this.configDrp(this.referenceDataObject.action);
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": finish.");
}
+ //setting the value to display or hide the template identifier dropdown in the screen
toggleIdentifier(data) {
if (data == 'ConfigScaleOut') {
this.isConfigScaleOut = true
@@ -309,64 +335,42 @@ export class ReferenceDataformComponent implements OnInit {
//to retrive the data from appc and assign it to the vaiables, if no data display the message reterived from the API
getArtifact() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": getArtifact: start.");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": getArtifact: start...");
try {
+ // setting the isVnfcTypeList & isVnfcType to false initially
+ this.isVnfcTypeList = false;
+ this.isVnfcType = false
let data = this.utilityService.createPayloadForRetrieve(true, '', '', '');
this.ngProgress.start();
- this.httpUtils.post({
- url: environment.getDesigns,
- data: data
- }).subscribe(resp => {
- if (this.utilityService.getTracelvl() > 1)
- console.log(this.classNm + ": getArtifact: got response ...");
+ let serviceCall = this.apiService.callGetArtifactsApi(data);
+ serviceCall.subscribe(resp => {
+ //getting the response and assigining it to the variables used and end the progress bar aftr the data is fetched.
if (resp.output.data.block != undefined) {
- if (this.utilityService.getTracelvl() > 1)
- console.log(this.classNm +
- ": getArtifact: output.data.block not empty.");
- this.nService.success(appConstants.notifications.titles.status, appConstants.messages.datafetched);
+ this.nService.success('Status', 'data fetched ');
let artifactInfo = JSON.parse(resp.output.data.block).artifactInfo[0];
+ let referenceDataAll = JSON.parse(artifactInfo['artifact-content'])['reference_data'];
let reference_data = JSON.parse(artifactInfo['artifact-content'])['reference_data'][0];
this.referenceDataObject = reference_data;
this.toggleIdentifier(this.referenceDataObject.action);
- if (this.referenceDataObject.action == appConstants.Actions.configScaleOut) {
- this.groupAnotationType = [appConstants.groupAnotationType.blank, appConstants.groupAnotationType.firstVnfcName, appConstants.groupAnotationType.fixedValue, appConstants.groupAnotationType.relativeValue, appConstants.groupAnotationType.existingGroupName];
+ if (this.referenceDataObject.action == 'ConfigScaleOut') {
+ this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value', 'existing-group-name'];
}
+ this.highlightSelectedActions(referenceDataAll)
+
//chck vnfc or vnfcTypeList
this.displayHideVnfc();
+
// Enable or Block Template and PD Tabs
- this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc });
+ this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
+
this.refernceScopeObj.sourceType = this.referenceDataObject['scopeType'];
this.mappingEditorService.getReferenceList().push(JSON.parse(artifactInfo['artifact-content']));
this.tempAllData = JSON.parse(artifactInfo['artifact-content'])['reference_data'];
this.oldAction = this.referenceDataObject.action;
this.oldVnfcIdentifier = this.vnfcIdentifier;
- if (this.referenceDataObject.action === appConstants.Actions.openStackActions) {
- this.deviceProtocols = [appConstants.DeviceProtocols.blank, appConstants.DeviceProtocols.openStack];
- this.buildDesignComponent.tabs = [
- {
- name: 'Reference Data',
- url: 'references',
- }];
- }
- else {
- this.buildDesignComponent.tabs = [
- {
- name: 'Reference Data',
- url: 'references',
- }, {
- name: 'Template',
- url: 'templates/myTemplates',
- }, {
- name: 'Parameter Definition',
- url: 'parameterDefinitions/create'
- }/*, {
- name: "Test",
- url: 'test',
- }*/
- ];
- }
+
+ this.processReferenceDataAfterRetrieval();
this.getArtifactsOpenStack();
} else {
this.nService.success('Status', 'Sorry !!! I dont have any artifact Named : ' + (JSON.parse(sessionStorage.getItem('updateParams')))['artifact-name']);
@@ -383,19 +387,19 @@ export class ReferenceDataformComponent implements OnInit {
}
displayHideVnfc() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": displayHideVnfc: start...");
- if (this.utilityService.getTracelvl() > 1) {
- if (this.referenceDataObject.scope['vnfc-type-list']) {
- console.log(this.classNm +
- ": displayHideVnfc: refDataObj.scope.vnfc-type-list.length=" +
- this.referenceDataObject.scope['vnfc-type-list'].length);
- } else {
- console.log(this.classNm +
- ": displayHideVnfc: refDataObj.scope.vnfc-type-list not defined");
- };
- console.log(this.classNm + ": displayHideVnfc: scope.vnfc-type:[" +
- this.referenceDataObject.scope['vnfc-type'] + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": displayHideVnfc: start...");
+ if( this.utilityService.getTracelvl() > 1 ) {
+ if( this.referenceDataObject.scope['vnfc-type-list'] ) {
+ console.log( this.classNm+
+ ": displayHideVnfc: refDataObj.scope.vnfc-type-list.length="+
+ this.referenceDataObject.scope['vnfc-type-list'].length );
+ } else {
+ console.log( this.classNm+
+ ": displayHideVnfc: refDataObj.scope.vnfc-type-list not defined");
+ };
+ console.log( this.classNm+": displayHideVnfc: scope.vnfc-type:["+
+ this.referenceDataObject.scope['vnfc-type']+"]");
};
if (this.referenceDataObject.scope['vnfc-type-list'] == undefined && (this.referenceDataObject.scope['vnfc-type'] != undefined || this.referenceDataObject.scope['vnfc-type'] != "")) {
this.isVnfcType = true
@@ -406,20 +410,20 @@ export class ReferenceDataformComponent implements OnInit {
this.isVnfcType = false
this.displayVnfc = 'true'
this.isVnfcTypeList = true
- if (!this.mappingEditorService.newObject.vnfc) {
+ if(!this.mappingEditorService.newObject || !this.mappingEditorService.newObject.vnfc) {
this.vnfcIdentifier = this.referenceDataObject.scope['vnfc-type-list'][0];
// this.mappingEditorService.newObject.vnfc = this.vnfcIdentifier;
- // this.referenceDataObject['vnfcIdentifier'] = this.vnfcIdentifier;
-
} else {
this.vnfcIdentifier = this.mappingEditorService.newObject.vnfc;
}
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": displayHideVnfc: vnfcIdentifier:[" +
- this.vnfcIdentifier + "]");
+ this.referenceDataObject['vnfcIdentifier'] = this.vnfcIdentifier;
+ //this.vnfcChanged(this.vnfcIdentifier, FormData);
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": displayHideVnfc: vnfcIdentifier:["+
+ this.vnfcIdentifier+"]");
}
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) {
- if (this.displayVnfc == 'true') {
+ if(this.displayVnfc == 'true') {
this.isVnfcType = false
this.displayVnfc = 'true'
this.isVnfcTypeList = true
@@ -434,17 +438,14 @@ export class ReferenceDataformComponent implements OnInit {
this.displayVnfc = 'false'
this.isVnfcTypeList = false
}
- if (this.utilityService.getTracelvl() > 1)
- console.log(this.classNm + ": displayHideVnfc: finish. isVnfcType:[" +
- this.isVnfcType + " displayVnfc:[" + this.displayVnfc + "] isVnfcTypeList:[" +
- this.isVnfcTypeList + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": displayHideVnfc: finish. isVnfcType:["+
+ this.isVnfcType+" displayVnfc:["+this.displayVnfc+"] isVnfcTypeList:["+
+ this.isVnfcTypeList+"]");
}
- //reinitializing the required values
+ //reinitializing the required values. when changing to template or pd sending the values to mapping service
ngOnDestroy() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": ngOnDestroy: start:" +
- " vnfcIdentifier:[" + this.vnfcIdentifier + "]");
let referenceObject = this.prepareReferenceObject();
this.mappingEditorService.changeNavAppData(this.appData);
this.mappingEditorService.changeNavDownloadData(this.downloadData);
@@ -453,7 +454,7 @@ export class ReferenceDataformComponent implements OnInit {
this.firstArrayElement = [];
this.uploadFileName = '';
}
-
+ // vaidating the number
numberValidation(event: any) {
if (this.numberTest.test(event) && event != 0) {
this.numberOfVmTest = true;
@@ -464,8 +465,8 @@ export class ReferenceDataformComponent implements OnInit {
}
// update my vnf pop up session values
updateSessionValues(event: any, type: string) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": updateSessionValues: type:[" + type + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": updateSessionValues: type:["+type+"]");
if (type === 'action') {
sessionStorage.setItem('action', event);
}
@@ -473,8 +474,10 @@ export class ReferenceDataformComponent implements OnInit {
sessionStorage.setItem('vnfType', event);
}
}
-
+ // adding vnfc data for each vm
addVnfcData(vmNumber: number) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": addVnfcData: start: vmNumber="+ vmNumber);
var newObj = {
'vnfc-instance': this.referenceDataObject.vm[vmNumber].vnfc.length + 1,
'vnfc-type': this.vnfcTypeData,
@@ -485,11 +488,10 @@ export class ReferenceDataformComponent implements OnInit {
};
this.referenceDataObject.vm[vmNumber].vnfc.push(newObj);
}
-
//validating the vnf and vnfc data in the pop up
validateVnfcName(name) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": validateVnfcName: start: name:[" + name + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": validateVnfcName: start: name:["+name+"]");
if (!name.trim() || name.length < 1) {
this.errorMessage = '';
this.invalid = true;
@@ -508,6 +510,7 @@ export class ReferenceDataformComponent implements OnInit {
}
}
+
//to remove the VM's created by the user
removeFeature(vmNumber: any, index: any, templateId) {
if (this.referenceDataObject.action == "Configure") {
@@ -516,6 +519,8 @@ export class ReferenceDataformComponent implements OnInit {
if (arrIndex >= vmNumber) {
obj["vm-instance"] = obj["vm-instance"] - 1
}
+ // obj["vm-instance"] = arrIndex+1
+
})
} else {
let data = this.referenceDataObject.vm.filter(obj => {
@@ -536,6 +541,7 @@ export class ReferenceDataformComponent implements OnInit {
}
}
+ //utility function while adding VM to check index
findVmindex(data, vmNumber, templateId) {
return this.referenceDataObject.vm.findIndex(obj => {
let x = obj['vm-instance'] == (vmNumber + 1) && templateId == obj['template-id']//true
@@ -544,19 +550,50 @@ export class ReferenceDataformComponent implements OnInit {
}
- //add new VM's to the configure
+ //add new VM's to the configure and configmodify.
addVms() {
let arr = [];
+
let mberOFVm = Number(this.refernceScopeObj.from);
- if (this.referenceDataObject.action == 'ConfigScaleOut') {
- let existingVmsLength = this.referenceDataObject.vm.filter(obj => {
- return obj['template-id'] == this.templateIdentifier
+ let key
+ if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+ key = "vnfcType-id"
+ } else if (this.referenceDataObject.action == 'ConfigScaleOut') {
+ key = "template-id"
+ }
+ if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+ let existingVmsLength = this.referenceDataObject.vm.map(obj => {
+ if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+ return obj["vnfcType-id"] == this.templateIdentifier
+ } else if (this.referenceDataObject.action == 'ConfigScaleOut') {
+ return obj["template-id"] == this.templateIdentifier
+ }
}).length;
- mberOFVm = existingVmsLength + mberOFVm;
+ //mberOFVm = existingVmsLength + mberOFVm;
let index = 0;
- for (var i = (existingVmsLength); i < mberOFVm; i++) {
+ let identifierValue
+ if (this.referenceDataObject.action == 'ConfigScaleOut') {
+ identifierValue = this.templateIdentifier
+ } else if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+ identifierValue = this.vnfcIdentifier
+ }
+
+ for (var i = 0; i < mberOFVm; i++) {
+ if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+
+ if (identifierValue && identifierValue != "") {
+ this.referenceDataObject.vm.push({ 'vnfcType-id': identifierValue, 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] });
+ } else {
+ this.referenceDataObject.vm.push({ 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] });
+ }
+
+ } else if (this.referenceDataObject.action == 'ConfigScaleOut') {
+ if (identifierValue && identifierValue != "") {
+ this.referenceDataObject.vm.push({ 'template-id': identifierValue, 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] });
+ }
+
+ }
- this.referenceDataObject.vm.push({ 'template-id': this.templateIdentifier, 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] });
index++;
}
@@ -573,25 +610,43 @@ export class ReferenceDataformComponent implements OnInit {
}
}
- //Reference object to create reference data
+ //preparing reference obj with required business use cases
prepareReferenceObject(isSaving?: any) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": prepareReferenceObject: start.");
+ let methName= "prepareReferenceObject";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start: isSaving:["+
+ isSaving+"]");
let scopeName = this.resetParamsOnVnfcType();
- let extension = this.decideExtension(this.referenceDataObject);
+ let extension = this.referenceDataFormUtil.decideExtension(this.referenceDataObject);
this.prepareArtifactList(scopeName, extension);
+
if (this.referenceDataObject.action === 'OpenStack Actions') {
this.referenceDataObject['template'] = 'N';
this.referenceDataObject['artifact-list'] = [];
this.referenceDataObject['firstRowVmSpreadSheet'] = this.firstArrayElement;
}
- //detaching the object from the form and processing further
+ else{
+ this.referenceDataObject['firstRowVmSpreadSheet']=undefined;
+ }
+ //ditaching the object from the form and processing pfurther
let newObj = $.extend(true, {}, this.referenceDataObject);
let action = this.referenceDataObject.action;
+ // if (action=="ConfigScaleOut"){
+ // this.referenceDataObject.action="true";
+ // }
+ //preparing Obj for save/download
newObj = this.deleteVmsforNonActions(newObj, action)
+
+ if (newObj['device-protocol'] != 'REST') {
+ delete newObj['url']
+ }
this.pushOrReplaceTempData(newObj, action);
this.addAllActionObj(newObj, scopeName);
this.resetTempData()
+
+
+ //rmove context url
+ //if()
//saving data to service
this.mappingEditorService.getReferenceList().push(JSON.parse(JSON.stringify(this.referenceDataObject)));
this.buildDesignComponent.updateAccessUpdatePages(this.referenceDataObject.action, this.mappingEditorService.getReferenceList());
@@ -601,74 +656,65 @@ export class ReferenceDataformComponent implements OnInit {
return { totlaRefDtaa: this.tempAllData, scopeName: scopeName };
}
+ // utility function to check element existence
public checkIfelementExistsInArray(element, array) {
- //// console.log("Element==" + element)
var result: boolean = false;
array.forEach(function (item) {
- // // console.log("Item==" + item)
if (element === item) {
- // console.log('Element==' + element + 'Item==' + item);
result = true;
}
}
);
return result;
}
-
+ // when uploading the file
upload(evt: any) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": upload: start.");
/* wire up file reader */
const target: DataTransfer = <DataTransfer>(evt.target);
this.uploadFileName = evt.target.files[0].name;
var fileExtension = this.uploadFileName.substr(this.uploadFileName.lastIndexOf('.') + 1);
if (target.files.length != 1) {
- console.log(this.classNm + ": upload: Error: got no file !");
- throw new Error(appConstants.errors.multipleFileUploadError);
+ throw new Error('Cannot upload multiple files on the entry');
}
- console.log(this.classNm + ": upload: filename:[" + evt.target.files[0].name + "]");
if (fileExtension.toUpperCase() === 'XLS' || fileExtension.toUpperCase() === 'XLSX') {
const reader = new FileReader();
reader.onload = (e: any) => {
/* read workbook */
const bstr = e.target.result;
- // // console.log("print 1---" + bstr);
const wb = XLSX.read(bstr, { type: 'binary' });
- // // console.log("print 2---" + JSON.stringify(wb));
/* grab first sheet */
const wsname = wb.SheetNames[0];
- // // console.log("Name:---" + wsname);
const ws = wb.Sheets[wsname];
/* save data */
-
+ this.firstArrayElement = []
let arrData = (<AOA>(XLSX.utils.sheet_to_json(ws, { header: 1 })));
this.uploadedDataArray = arrData;
- this.firstArrayElement = arrData[0];
+ for (var i = 0; i < arrData[0].length; i++) {
+ this.firstArrayElement.push(arrData[0][i].replace(/[\n\r]+/g, ''))
+ }
var remUploadedDataArray = arrData;
remUploadedDataArray.shift();
this.remUploadedDataArray = remUploadedDataArray;
if (arrData != null) {
this.getExcelUploadStatus = true;
- this.nService.success(appConstants.notifications.titles.success, appConstants.messages.vmDataUploadSuccess);
+ this.nService.success('Success', 'Vm capabilities data uploaded successfully');
}
else {
- this.nService.success(appConstants.notifications.titles.error, appConstants.messages.emptyVmUpload);
+ this.nService.success('Error', 'Empty Vm capabilities file uploaded');
}
};
reader.readAsBinaryString(target.files[0]);
}
else {
- this.nService.error(appConstants.notifications.titles.error, appConstants.messages.incorrectVmUpload);
+ this.nService.error('Error', 'Incorrect VM capabilities file uploaded');
}
}
addVmCapabilitiesData() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": addVmCapabilitiesData: start.");
for (var i = 0; i < this.uploadedDataArray.length; i++) {
var vnfcFuncCodeArray = [];
var data = this.uploadedDataArray[i];
@@ -676,6 +722,7 @@ export class ReferenceDataformComponent implements OnInit {
if (data[j] != undefined) {
if (data[j].toUpperCase() === 'Y') {
vnfcFuncCodeArray.push(this.firstArrayElement[j]);
+ //vnfcFuncCodeArray.push({name:this.firstArrayElement[j]});
}
}
}
@@ -686,7 +733,7 @@ export class ReferenceDataformComponent implements OnInit {
'action-level': 'vm',
'scope': {
'vnf-type': this.referenceDataObject['scope']['vnf-type'], //need to confirm what should be this value
- 'vnfc-type': null
+ 'vnfc-type-list': null
},
'vnfc-function-code-list': vnfcFuncCodeArray,
'template': 'N',
@@ -699,88 +746,76 @@ export class ReferenceDataformComponent implements OnInit {
}
}
- //download template
+ //download the templae pd and reference file with all the actions added.
save(form: any, isValid: boolean) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": save: start: referenceDataObject.action:[" +
- this.referenceDataObject.action + "]");
- if (this.referenceDataObject.action === '') {
- this.nService.error(appConstants.notifications.titles.error, appConstants.errors.noActionError);
- return;
- }
- if (this.referenceDataObject['device-protocol'] === '') {
- this.nService.error(appConstants.notifications.titles.error, appConstants.errors.noDeviceProtocolError);
- return;
- }
+ // will show error message
+ this.showValidationErrors(this.referenceDataObject);
if (isValid) {
let referenceObject = this.prepareReferenceObject();
+ let removedKeysArray = []
+ this.tempAllData.forEach((data, index) => {
+ if (data.action) {
+ removedKeysArray.push(JSON.parse(JSON.stringify(this.deleteUnwantedKeys(data))))
+ }
+ });
+ this.tempAllData = removedKeysArray;
+ /* var tempAllData = this.tempAllData;
+ tempAllData=this.removeParamFileNameBeforeSave(tempAllData)*/
+
+ //tempAllData["artifact_list"]=newArtifactList;
let theJSON = JSON.stringify({ 'reference_data': this.tempAllData }, null, '\t');
let uri = 'data:application/json;charset=UTF-8,' + encodeURIComponent(theJSON);
this.downloadData.reference = theJSON;
+ let referenceFileName = 'reference_AllAction_' + this.referenceDataObject.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.json';
+ this.utilityService.downloadArtifactToPc(theJSON, 'json', referenceFileName, 100);
this.validateTempAllData();
- var blob = new Blob([theJSON], {
- type: 'text/plain'
- });
- let fileName = 'reference_AllAction_' + referenceObject.scopeName + '_' + '0.0.1V.json';
- this.downloadFile(blob, fileName, 100)
var templateData = JSON.stringify(this.downloadData.template.templateData);
+ var templateFileName = this.downloadData.template.templateFileName;
+ if (templateFileName != null || templateFileName != '') {
+ var fileExtensionArr = templateFileName.split('.');
+ }
+ var nameValueFileName = this.downloadData.template.nameValueFileName;
+ let pdFileName = this.downloadData.pd.pdFileName;
var nameValueData = JSON.stringify(this.downloadData.template.nameValueData);
var pdData = this.downloadData.pd.pdData;
- if (templateData != '{}' && templateData != null && templateData != undefined) this.downloadTemplate();
- if (nameValueData != '{}' && nameValueData != null && nameValueData != undefined) this.downloadNameValue();
- if (pdData != '' && pdData != null && pdData != undefined) this.downloadPd();
- }
- }
- downloadFile(blob, fileName, delay) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": downloadFile: start.");
- setTimeout(() => {
- saveAs(blob, fileName);
- }, delay)
- }
-
- downloadTemplate() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": downloadTemplate: start.");
- var fileName = this.downloadData.template.templateFileName;
- console.log(this.classNm + ": downloadTemplate: fileName:[" + fileName + "]");
- var theJSON = this.downloadData.template.templateData;
- if (fileName != null || fileName != '') {
- var fileExtensionArr = fileName.split('.');
- var blob = new Blob([theJSON], {
- type: 'text/' + fileExtensionArr[1]
- });
- this.downloadFile(blob, fileName, 130)
+ if (templateData != '{}' && templateData != null && templateData != undefined) this.utilityService.downloadArtifactToPc(this.downloadData.template.templateData, fileExtensionArr[1], templateFileName, 130);
+ if (nameValueData != '{}' && nameValueData != null && nameValueData != undefined) this.utilityService.downloadArtifactToPc(this.downloadData.template.nameValueData, 'json', nameValueFileName, 160);
+ if (pdData != '' && pdData != null && pdData != undefined) this.utilityService.downloadArtifactToPc(pdData, 'yaml', pdFileName, 180);
}
}
- downloadNameValue() {
- var fileName = this.downloadData.template.nameValueFileName;
- var theJSON = this.downloadData.template.nameValueData;
- var blob = new Blob([theJSON], {
- type: 'text/json'
- });
-
- this.downloadFile(blob, fileName, 160)
- }
-
- downloadPd() {
- let fileName = this.downloadData.pd.pdFileName;
- let theJSON = this.downloadData.pd.pdData;
- var blob = new Blob([theJSON], {
- type: 'text/plain'
- });
-
- this.downloadFile(blob, fileName, 180)
- }
-
+ /* removeParamFileNameBeforeSave(tempAllData)
+ {
+ var newArtifactList = [];
+ var element={};
+ for (var i = 0; i < tempAllData.length; i++) {
+ if (this.checkIfelementExistsInArray(tempAllData[i].action,this.actions)) {
+ var artifactList = tempAllData[i]["artifact-list"]
+
+ for (var j = 0; j < artifactList.length; j++) {
+ if (artifactList[j]["artifact-type"] != "param_values") {
+ element = artifactList[j];
+ newArtifactList.push(element);
+ }
+ }
+ tempAllData[i]["artifact-list"] = newArtifactList
+ newArtifactList = [];
+ element={};
+ }
+ }
+ return tempAllData;
+ }*/
// save the values to the cache, on action change without download
- validateDataAndSaveToAppc(valid, form, event) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": validateDataAndSaveToAppc: start: valid:" + valid);
+ validateDataAndSaveToAppc( valid, form, event) {
+ let methName= "validateDataAndSaveToAppc";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start: valid:["+valid+"]");
// will show error message
this.showValidationErrors(this.referenceDataObject);
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
try {
form._submitted = true;
if (valid) {
@@ -810,18 +845,18 @@ export class ReferenceDataformComponent implements OnInit {
this.nService.warn('status', 'unable to save the artifact');
}
}
-
//this method saves reference, template, param and PD data to APPC
saveToAppc() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": saveToAppc: start: vnf-type:[" +
- this.referenceDataObject.scope['vnf-type'] + "]");
- let theJSON = JSON.stringify(this.tempAllData);
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": saveToAppc: tempAllData:[" + theJSON + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": saveToAppc: start: vnf-type:["+
+ this.referenceDataObject.scope['vnf-type']+"]");
+ let theJSON = JSON.stringify( this.tempAllData );
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": saveToAppc: tempAllData:["+theJSON+"]");
let fileName = 'reference_AllAction_' + this.referenceDataObject.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.json';
- this.saveReferenceDataToAppc(
- JSON.stringify({ reference_data: this.tempAllData }), this.referenceDataObject.scope['vnf-type'], fileName);
+ /*var tempAllData=this.removeParamFileNameBeforeSave(this.tempAllData);
+ this.tempAllData=tempAllData;*/
+ this.saveReferenceDataToAppc(JSON.stringify({ reference_data: this.tempAllData }), this.tempAllData[this.tempAllData.length - 1], fileName);
var templateData = JSON.stringify(this.appData.template.templateData);
var nameValueData = JSON.stringify(this.appData.template.nameValueData);
@@ -833,8 +868,6 @@ export class ReferenceDataformComponent implements OnInit {
// valaidation of template data
validateTempAllData() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": validateTempAllData: start.");
if (this.tempAllData) {
var updatedData = [];
this.tempAllData.forEach(data => {
@@ -846,14 +879,12 @@ export class ReferenceDataformComponent implements OnInit {
}
}
- //.. prepare and send the data to the API.
- saveReferenceDataToAppc(artifactData, vnf_type, fileName) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": saveReferenceDataToAppc: start: vnf_type:[" +
- vnf_type + "]");
+ //preparig and send the data to the API.
+ saveReferenceDataToAppc(artifactData, dataJson, fileName) {
let data = [];
let slashedPayload = this.referenceDataFormUtil.appendSlashes(artifactData);
- let payload = this.utilityService.createPayLoadForSave("reference_data", vnf_type, "AllAction", fileName, this.versionNoForApiCall, slashedPayload);
+
+ let payload = this.utilityService.createPayLoadForSave("reference_data", dataJson['scope']['vnf-type'], "AllAction", fileName, this.versionNoForApiCall, slashedPayload);
this.ngProgress.start();
this.httpUtils.post({
url: environment.getDesigns,
@@ -877,9 +908,8 @@ export class ReferenceDataformComponent implements OnInit {
this.ngProgress.done();
}, 3500);
}
-
+ // if no data present in the session, fetching data from API
retriveFromAppc() {
- console.log(this.classNm + ": retriveFromAppc: start.");
if (sessionStorage.getItem('updateParams') != 'undefined') {
this.getArtifact();
this.noCacheData = false;
@@ -888,22 +918,11 @@ export class ReferenceDataformComponent implements OnInit {
}
}
- cloneMessage(servermessage) {
- var clone = {};
- for (var key in servermessage) {
- if (servermessage.hasOwnProperty(key)) //ensure not adding inherited props
- clone[key] = servermessage[key];
- }
- return clone;
- }
-
public showUpload() {
this.selectedUploadType = this.uploadTypes[0].value;
};
-
+ // used when user uploads a file using upload file
public fileChange(input) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": fileChange: start.");
this.fileName = input.target.files[0].name.replace(/C:\\fakepath\\/i, '');
this.fileUploaded = true;
this.disableRetrieve = true;
@@ -925,6 +944,7 @@ export class ReferenceDataformComponent implements OnInit {
return;
}
}
+
this.displayVnfc = 'false';
this.isVnfcType = false;
this.isVnfcTypeList = false;
@@ -934,55 +954,37 @@ export class ReferenceDataformComponent implements OnInit {
this.displayVnfc = 'true';
this.isVnfcTypeList = true;
this.vnfcIdentifier = obj.scope['vnfc-type-list'][0];
+
}
}
- this.oldAction = obj.action;
+ this.oldAction=obj.action;
this.tempAllData = JSON.parse(JSON.stringify(jsonObject));
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": fileChange: read & parsed.");
+ //check vnfc tyoe list for old files
+ // if (this.referenceDataObject.scope['vnfc-type-list'] == undefined) {
+ // this.tempAllData = []
+ // this.referenceDataObject = {
+ // action: '',
+ // 'action-level': 'vnf',
+ // scope: { 'vnf-type': '', 'vnfc-type-list': [] },
+ // 'template': 'Y',
+ // vm: [],
+ // 'device-protocol': '',
+ // 'user-name': '',
+ // 'port-number': '',
+ // 'artifact-list': []
+ // }
+ // this.nService.error('Error', 'Incorrect file format');
+ // return
+ // }
this.notificationService.notifySuccessMessage('Reference Data file successfully uploaded..');
- if (jsonObject instanceof Array) {
- this.referenceDataObject = jsonObject[0];
- jsonObject.forEach(obj => {
- this.selectedActions.push(obj.action);
- });
- } else {
- this.referenceDataObject = jsonObject;
-
- this.selectedActions.push(jsonObject.action);
- }
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": fileChange: " +
- "referenceDataObject.action:[" +
- this.referenceDataObject.action + "]");
+ this.highlightSelectedActions(jsonObject)
this.toggleIdentifier(this.referenceDataObject.action)
+ this.populateExistinAction(this.referenceDataObject.action)
this.configDrp(this.referenceDataObject.action)
- if (this.referenceDataObject.action === 'OpenStack Actions') {
- this.deviceProtocols = ['', 'OpenStack'];
- this.buildDesignComponent.tabs = [
- {
- type: 'dropdown',
- name: 'Reference Data',
- url: 'references',
- }];
- }
- else {
- this.buildDesignComponent.tabs = [
- {
- name: 'Reference Data',
- url: 'references',
- }, {
- name: 'Template',
- url: 'templates/myTemplates',
- }, {
- name: 'Parameter Definition',
- url: 'parameterDefinitions/create'
- } /*, {
- name: "Test",
- url: 'test',
- }*/
- ];
- }
+
+
+ this.processReferenceDataAfterRetrieval();
+
this.getArtifactsOpenStack();
if (this.referenceDataObject.template == null) {
this.referenceDataObject.template = 'Y';
@@ -990,27 +992,37 @@ export class ReferenceDataformComponent implements OnInit {
if (this.referenceDataObject['action-level'] == null) {
this.referenceDataObject['action-level'] = 'VNF';
}
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": fileChange: displayVnfc:[" +
- this.displayVnfc + "]");
+
+
// Enable or Block Template and PD Tabs
- this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc });
+ this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
} catch (e) {
- this.nService.error(appConstants.notifications.titles.error, appConstants.messages.incorrectFileFormat);
+ this.nService.error('Error', 'Incorrect file format');
}
}
this.hideModal = true;
});
} else {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": fileChange: Error: Failed to read file!");
this.notificationService.notifyErrorMessage('Failed to read file..');
}
+
+ }
+
+ // Highlights selected action on new file upload and on existing VNF
+ public highlightSelectedActions(jsonObject) {
+ if (jsonObject instanceof Array) {
+ this.referenceDataObject = jsonObject[0];
+ jsonObject.forEach(obj => {
+ this.selectedActions.push(obj.action);
+ });
+ } else {
+ this.referenceDataObject = jsonObject;
+
+ this.selectedActions.push(jsonObject.action);
+ }
}
public readFile(file, reader, callback) {
- console.log(this.classNm + ": readFile: start.");
// Set a callback funtion to fire after the file is fully loaded
reader.onload = () => {
// callback with the results
@@ -1024,9 +1036,8 @@ export class ReferenceDataformComponent implements OnInit {
fileChangeEvent(fileInput: any) {
let obj: any = fileInput.target.files;
}
-
+ //resetting the values
clearVnfcData() {
- console.log(this.classNm + ": clearVnfcData: start.");
this.Sample = {
'vnfc-instance': '1',
'vnfc-function-code': '',
@@ -1049,10 +1060,9 @@ export class ReferenceDataformComponent implements OnInit {
// this.referenceDataObject.scope['vnfc-type'] = '';
// }
// }
-
+ // resetting the form
resetForm() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": resetForm: start.");
+ console.log( this.classNm+": resetForm: start.");
this.referenceDataObject['action-level'] = 'vnf';
this.referenceDataObject.template = 'Y';
this.referenceDataObject['device-protocol'] = '';
@@ -1064,8 +1074,12 @@ export class ReferenceDataformComponent implements OnInit {
// this method gets called with the action as parameter and the respective action details are fetched and assigned to the current page
populateExistinAction(data) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": populateExistinAction: start.");
+ let methName= "populateExistinAction";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start: data:["+data+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
let existAction = this.tempAllData.findIndex(obj => {
return obj.action == data;
});
@@ -1076,12 +1090,11 @@ export class ReferenceDataformComponent implements OnInit {
this.referenceDataObject.scope['vnfc-type-list'] = obj['scope']['vnfc-type-list'];
this.referenceDataObject['device-protocol'] = obj['device-protocol'];
this.refernceScopeObj['sourceType'] = obj['scopeType'];
- if (obj['scope']['vnfc-type-list'] != undefined && obj['scope']['vnfc-type-list'].length > 0) {
+ if(obj['scope']['vnfc-type-list'] != undefined && obj['scope']['vnfc-type-list'].length >0) {
this.referenceDataObject['vnfcIdentifier'] = obj['scope']['vnfc-type-list'][0];
}
} else {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": populateExistinAction: action not found");
+ console.log( this.classNm+": populateExistinAction: action not found");
this.resetForm();
this.referenceDataObject.action = data;
}
@@ -1093,8 +1106,8 @@ export class ReferenceDataformComponent implements OnInit {
break;
case 'UpgradeBackout':
case 'ResumeTraffic':
- case 'QuiesceTraffic':
case 'DistributeTraffic':
+ case 'QuiesceTraffic':
case 'UpgradeBackup':
case 'UpgradePostCheck':
case 'UpgradePreCheck':
@@ -1120,38 +1133,38 @@ export class ReferenceDataformComponent implements OnInit {
}
}
- //Modal pop up for action change with values entered.
- actionChange(data, userForm) {
- var methName = "actionChange";
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": " + methName + ": start: data:[" + data + "]" +
- " userForm.valid:[" + userForm.valid + "]");
+ //Modal pop up for action change with values entered.
+ actionChange( data, userForm) {
+ let methName= "actionChange";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start: data:["+data+"]"+
+ " userForm.valid:["+userForm.valid+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
this.disableGrpNotationValue = false
if (data == null) {
- console.log(this.classNm + ": " + methName + ": data == null");
+ console.log( this.classNm+": "+methName+": data == null");
return;
}
- if ((userForm.valid) && this.oldAction != '' && this.oldAction != undefined) {
+ if((userForm.valid) && this.oldAction != '' && this.oldAction != undefined) {
this.actionChanged = true;
- console.log(this.classNm + ": " + methName +
- ": userForm valid and oldAction defined");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+
+ ": userForm valid and oldAction defined");
// Calling common Confirmation Modal
let disposable = this.dialogService.addDialog(ConfirmComponent)
- .subscribe((isConfirmed) => {
+ .subscribe((isConfirmed)=>{
//We get dialog result
- console.log(this.classNm + ": " + methName + ": isConfirmed:[" +
- isConfirmed + "]");
- if (isConfirmed) {
+ if(isConfirmed) {
// User clicked on Yes
this.currentAction = this.referenceDataObject.action;
- console.log(this.classNm + ": " + methName +
- ": clicked on Yes: currentAction:[" + this.currentAction +
- "] oldAction:[" + this.oldAction + "]");
this.referenceDataObject.action = this.oldAction;
$('#saveToAppc').click();//make sure the save all is done before the tempall obj is saved form the API
this.toggleIdentifier(data)
this.oldAction = this.currentAction;// this.referenceDataObject.action + '';
- this.referenceDataObject.action = this.currentAction;
+ this.referenceDataObject.action = this.currentAction
+
this.populateExistinAction(data);
if (this.oldAction === 'OpenStack Actions') {
@@ -1173,8 +1186,6 @@ export class ReferenceDataformComponent implements OnInit {
// User clicked on No
this.toggleIdentifier(data)
this.currentAction = this.referenceDataObject.action;
- console.log(this.classNm + ": " + methName +
- ": clicked on No: currentAction:[" + this.currentAction + "]");
this.populateExistinAction(data);
this.resetVmsForScaleout(data);
this.oldAction = this.referenceDataObject.action + '';
@@ -1184,26 +1195,26 @@ export class ReferenceDataformComponent implements OnInit {
}
if (this.referenceDataObject.action === 'Configure' || this.referenceDataObject.action === 'ConfigModify' || this.referenceDataObject.action === 'DistributeTraffic') {
- this.isConfigureAction = true;
+ this.isConfigOrConfigModify = true;
} else {
- this.isConfigureAction = false;
+ this.isConfigOrConfigModify = false;
delete this.mappingEditorService.newObject['vnfc'];
}
-
+
// Enable or Block Template and PD Tabs
if (this.currentAction == 'ConfigScaleOut' && this.templateIdentifier && this.templateIdentifier != '') {
// let referenceDataObjectTemp = this.referenceDataObject;
// referenceDataObjectTemp['template-id'] = this.templateIdentifier;
// this.buildDesignComponent.getRefData(referenceDataObjectTemp);
this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, { reqField: this.templateIdentifier });
-
+
} else {
this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
- }
+ }
});
} else {
- console.log(this.classNm + ": " + methName +
- ": userForm Not valid or oldAction not defined");
+ console.log( this.classNm+": "+methName+
+ ": userForm Not valid or oldAction not defined");
this.actionChanged = true;
this.currentAction = this.referenceDataObject.action;
this.oldAction = this.referenceDataObject.action + '';
@@ -1212,7 +1223,7 @@ export class ReferenceDataformComponent implements OnInit {
this.toggleIdentifier(data);
// Enable or Block Template and PD Tabs
- if (this.currentAction == 'ConfigScaleOut' && this.templateIdentifier) {
+ if(this.currentAction == 'ConfigScaleOut' && this.templateIdentifier) {
// let referenceDataObjectTemp = this.referenceDataObject;
// referenceDataObjectTemp['template-id'] = this.templateIdentifier;
// this.buildDesignComponent.getRefData(referenceDataObjectTemp);
@@ -1221,40 +1232,24 @@ export class ReferenceDataformComponent implements OnInit {
this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
}
}
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
this.configDrp(data)
}
configDrp(data) {
- console.log(this.classNm + ": configDrp: start: data:[" + data + "]");
+ console.log( this.classNm+": configDrp: start: data:["+data+"]");
if (data == 'ConfigScaleOut') {
this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value', 'existing-group-name'];
} else {
this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value'];
}
if (data == 'OpenStack Actions') {
- this.buildDesignComponent.tabs = [
- {
- type: 'dropdown',
- name: 'Reference Data',
- url: 'references',
- }];
+ this.buildDesignComponent.tabs = this.referencDataTab;
}
else {
- this.buildDesignComponent.tabs = [
- {
- name: 'Reference Data',
- url: 'references',
- }, {
- name: 'Template',
- url: 'templates/myTemplates',
- }, {
- name: 'Parameter Definition',
- url: 'parameterDefinitions/create'
- }/*, {
- name: "Test",
- url: 'test',
- }*/
- ];
+ this.buildDesignComponent.tabs = this.allTabs;
}
if (data == 'Configure' || data == 'ConfigModify' || data == 'DistributeTraffic') {
this.nonConfigureAction = false;
@@ -1262,33 +1257,36 @@ export class ReferenceDataformComponent implements OnInit {
this.nonConfigureAction = true;
}
}
-
+ // removing and adding the url key based on the protocol selected
deviceProtocolChange() {
- console.log(this.classNm + ": deviceProtocolChange: start.");
+ let methName= "deviceProtocolChange";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start.");
if (this.referenceDataObject['device-protocol'] == 'REST') {
} else {
delete this.referenceDataObject['context-url']
}
// Enable or Block Template and PD Tabs
- this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc },
- { reqField: this.templateIdentifier });
+ this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, {reqField: this.templateIdentifier})
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
}
// used to call or trigger save object on template Identifier changes
idChange(data, userForm) {
- console.log(this.classNm + ": idChange: start: data:[" + data + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": idChange: start: data:["+data+"]");
if (data == null) {
return;
}
+
// Enable or Block Template and PD Tabs
// let referenceDataObjectTemp = this.referenceDataObject;
// referenceDataObjectTemp['template-id'] = data;
// this.buildDesignComponent.getRefData(referenceDataObjectTemp);
- this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc },
- { reqField: data });
+ this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, { reqField: data });
if ((userForm.valid)) {
this.currentAction = "ConfigScaleOut"
@@ -1296,78 +1294,95 @@ export class ReferenceDataformComponent implements OnInit {
let referenceObject = this.prepareReferenceObject();
this.actionChanged = true;
if (this.templateIdentifier) {
- // Calling common Confirmation Modal
- let disposable = this.dialogService.addDialog(ConfirmComponent)
- .subscribe((isConfirmed) => {
- //We get dialog result
- if (isConfirmed) {
- // User clicked on Yes
- this.validateTempAllData();
- this.saveToAppc();
- this.clearCache();
- this.clearVnfcData();
- this.refernceScopeObj.from = '';
- }
- else {
- // User clicked on No
- this.clearCache();
- this.refernceScopeObj.from = '';
- }
- });
+ // Calling common Confirmation Modal
+ let disposable = this.dialogService.addDialog(ConfirmComponent)
+ .subscribe((isConfirmed)=>{
+ //We get dialog result
+ if(isConfirmed) {
+ // User clicked on Yes
+ this.validateTempAllData();
+ this.saveToAppc();
+ this.clearCache();
+ this.clearVnfcData();
+ this.refernceScopeObj.from = '';
+ }
+ else {
+ // User clicked on No
+ this.clearCache();
+ this.refernceScopeObj.from = '';
+ }
+ });
}
} else {
- this.oldtemplateIdentifier = this.templateIdentifier;
+ this.oldtemplateIdentifier = this.templateIdentifier
}
+
+ // if (this.referenceDataObject.action == 'ConfigScaleOut' && data ) {
+ // let referenceDataObjectTemp = this.referenceDataObject;
+ // referenceDataObjectTemp['selectedTemplateId'] = data;
+ // this.buildDesignComponent.getRefData(referenceDataObjectTemp);
+ // } else {
+ // this.buildDesignComponent.getRefData(this.referenceDataObject);
+ // }
}
// used to call or trigger save object on multiple VNFC's changes
- vnfcChanged(data, userForm) {
- console.log(this.classNm + ": vnfcChanged: new vnfcIdentifier:[" + data + "]");
- console.log(this.classNm + ": vnfcChanged: oldVnfcIdentifier:[" +
- this.oldVnfcIdentifier + "]");
- console.log(this.classNm + ": vnfcChanged: scope.vnfc-type:[" +
- this.referenceDataObject.scope['vnfc-type'] + "]");
+ vnfcChanged( data, userForm) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": vnfcChanged: new vnfcIdentifier:["+data+"]");
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": vnfcChanged: oldVnfcIdentifier:["+
+ this.oldVnfcIdentifier+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": vnfcChanged: scope.vnfc-type:["+
+ this.referenceDataObject.scope['vnfc-type']+"]");
this.vnfcIdentifier = data;
- this.clearCache();
+ //this.clearCache();
if (data == null) {
return;
}
- //.. populate VNFC Type in Sample field
- this.setVnfcTypeInSample(this.vnfcIdentifier);
+
// Enable or Block Template and PD Tabs
let referenceDataObjectTemp = this.referenceDataObject;
referenceDataObjectTemp['vnfcIdentifier'] = data;
- console.log(this.classNm +
- ": vnfcChanged: displayVnfc:[" + this.displayVnfc + "]");
- this.buildDesignComponent.getRefData(
- { ...this.referenceDataObject, displayVnfc: this.displayVnfc },
- { reqField: data });
- console.log(this.classNm +
- ": vnfcChanged: userForm.valid:[" + userForm.valid + "]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+
+ ": vnfcChanged: displayVnfc:["+this.displayVnfc+"]");
+ //this.buildDesignComponent.getRefData(referenceDataObjectTemp);
+ this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc }, { reqField: data });
+
+
+ console.log( this.classNm+
+ ": vnfcChanged: userForm.valid:["+userForm.valid+"]");
if ((userForm.valid) && this.oldVnfcIdentifier != '' && this.oldVnfcIdentifier != undefined) {
this.currentAction = this.referenceDataObject.action
this.oldVnfcIdentifier = this.vnfcIdentifier
let referenceObject = this.prepareReferenceObject();
this.actionChanged = true;
if (this.vnfcIdentifier) {
- // Calling common Confirmation Modal
- let disposable = this.dialogService.addDialog(ConfirmComponent)
- .subscribe((isConfirmed) => {
- //We get dialog result
- if (isConfirmed) {
- // User clicked on Yes
- this.validateTempAllData();
- this.saveToAppc();
- this.clearCache();
- this.clearVnfcData()
- this.refernceScopeObj.from = '';
- }
- else {
- // User clicked on No
- this.clearCache();
- this.refernceScopeObj.from = '';
- }
- });
+ // Calling common Confirmation Modal
+ let disposable = this.dialogService.addDialog(ConfirmComponent)
+ .subscribe((isConfirmed)=>{
+ //We get dialog result
+ if(isConfirmed) {
+ // User clicked on Yes
+ this.validateTempAllData();
+ this.saveToAppc();
+ this.clearCache();
+ this.clearVnfcData()
+ this.refernceScopeObj.from = '';
+ //.. populate VNFC Type in Sample field
+ this.setVnfcTypeInSample( this.vnfcIdentifier );
+ }
+ else {
+ // User clicked on No
+ this.clearCache();
+ this.clearVnfcData()
+ this.refernceScopeObj.from = '';
+ //.. populate VNFC Type in Sample field
+ this.setVnfcTypeInSample( this.vnfcIdentifier );
+ }
+ });
}
} else {
if (data != null) {
@@ -1376,8 +1391,9 @@ export class ReferenceDataformComponent implements OnInit {
}
}
- clearCache() {
- console.log(this.classNm + ": clearCache: start.");
+ clearCache()
+ //needed for the the clearing template cache.
+ {
// get the value and save the userid and persist it.
this.clearTemplateCache();
this.clearPdCache();
@@ -1398,74 +1414,6 @@ export class ReferenceDataformComponent implements OnInit {
this.paramShareService.setSessionParamData(undefined);
}
- saveTemp() {
- console.log(this.classNm + ": saveTemp: start.");
- this
- .httpUtils
- .post(
- { url: environment.getDesigns, data: this.appData.template.templateData })
- .subscribe(resp => {
- if (resp.output.status.code === '400' && resp.output.status.message === 'success') {
- this.nService.success('Status', 'Successfully uploaded the Template Data');
- }
- if (resp.output.status.code === '401') {
- this.nService.warn('Status', 'Error in saving the Template to Appc');
-
- }
- },
- (err) => this.nService.error('Status', 'Error Connecting to the APPC Network'));
- }
-
- saveNameValue() {
- console.log(this.classNm + ": saveNameValue: start.");
- this
- .httpUtils
- .post(
- {
- url: environment.getDesigns, data: this.appData.template.nameValueData
- })
- .subscribe(resp => {
- if (resp.output.status.code === '400' && resp.output.status.message === 'success') {
- this.nService.success('Status', 'Successfully uploaded the Name Value Pairs');
- }
- if (resp.output.status.code === '401') {
- this.nService.warn('Status', 'Error in saving the Name value pairs to Appc');
- }
- },
- error => {
- this.nService.error('Status', 'Error Connecting to the APPC Network');
- return false;
- });
- }
-
- savePd() {
- this
- .httpUtils
- .post(
- {
- url: environment.getDesigns, data: this.appData.pd
- })
- .subscribe(resp => {
- if (resp.output.status.code === '400' && resp.output.status.message === 'success') {
- this.nService.success('Status', 'Successfully uploaded PD file');
- }
- if (resp.output.status.code === '401') {
- this.nService.warn('Status', 'Error in saving the PD to Appc');
- }
- },
- error => {
- this.nService.error('Status', 'Error Connecting to the APPC Network');
- return false;
- });
- }
-
- openModel(toShow: any, message: any, title: any) {
- console.log(this.classNm + ": openModel: start: title:[" + title + "]");
- this.modalComponent.isShow = toShow;
- this.modalComponent.message = message;
- this.modalComponent.title = title;
- }
-
browseOption() {
$('#inputFile').trigger('click');
}
@@ -1474,9 +1422,13 @@ export class ReferenceDataformComponent implements OnInit {
$('#excelInputFile').trigger('click');
}
- showIdentifier() {
- $('#identifierModal').modal();
- }
+ /* showIdentifier() {
+ $('#identifierModal').modal();
+ }
+
+ showVnfcPopup() {
+ $('#vnfcModal').modal();
+ }*/
addToIdentDrp() {
if (!(this.referenceDataObject['template-id-list'])) {
@@ -1485,49 +1437,48 @@ export class ReferenceDataformComponent implements OnInit {
if (!(this.referenceDataObject['template-id-list'].indexOf(this.templateId.trim()) > -1)) {
this.referenceDataObject['template-id-list'].push(this.templateId.trim());
}
- // Changing value to blank otherwise it will show previous value in text box of popup
- this.templateId = '';
- }
+ // Changing newVnfcType value to blank otherwise it will show previous value in text box of popup
+ this.templateId = ''
+ }
// adds the vnfc to the vnfc dropdown list
addVnfc() {
- var newVnfcTypeV = this.newVnfcType.trim();
- console.log(this.classNm +
- ": addVnfc: start: newVnfcTypeV:[" + newVnfcTypeV + "]");
+ var newVnfcTypeV= this.newVnfcType.trim();
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+
+ ": addVnfc: start: newVnfcTypeV:["+newVnfcTypeV+"]");
if (!(this.referenceDataObject.scope['vnfc-type-list'])) {
this.referenceDataObject.scope['vnfc-type-list'] = [];
- // this.vnfcIdentifier = newVnfcTypeV;
- } else if (this.referenceDataObject.scope['vnfc-type-list'].length == 0) {
- // this.vnfcIdentifier = newVnfcTypeV;
+ this.vnfcIdentifier = newVnfcTypeV;
+ } else {
+ this.vnfcIdentifier = newVnfcTypeV;
}
- this.vnfcIdentifier = newVnfcTypeV;
- console.log(this.classNm +
- ": addVnfc: vnfcIdentifier:[" + this.vnfcIdentifier + "]");
+ //this.referenceDataObject['vnfcIdentifier'] = this.vnfcIdentifier;
if (!(this.referenceDataObject.scope['vnfc-type-list'].indexOf(newVnfcTypeV) > -1)) {
this.referenceDataObject.scope['vnfc-type-list'].push(newVnfcTypeV);
}
this.tempAllData.forEach(obj => {
- if (obj.action == "Configure" || obj.action == "ConfigModify" || obj.action == "DistributeTraffic") {
+ if (obj.action == "Configure" || obj.action == "ConfigModify" || obj.action == "DistributeTraffic") {
obj.scope['vnfc-type-list'] = this.referenceDataObject.scope['vnfc-type-list']
}
this.resetArtifactList(obj);
});
- console.log(this.classNm + ": addVnfc: scope vnfc-type:[" +
- this.referenceDataObject.scope['vnfc-type'] + "]");
- this.setVnfcTypeInSample(newVnfcTypeV);
+ //this.buildDesignComponent.getRefData({ ...this.referenceDataObject, displayVnfc: this.displayVnfc });
+ this.setVnfcTypeInSample( newVnfcTypeV );
+ let userForm = {valid: true};
+ this.vnfcChanged(this.newVnfcType, userForm)
// Changing newVnfcType value to blank otherwise it will show previous value in text box of popup
this.newVnfcType = ''
}
resetVms() {
- console.log(this.classNm + ": resetVms: start.");
this.referenceDataObject.vm = [];
}
dataModified() {
// this.referenceDataObject.vm = this.referenceDataObject.vm;
}
-
+ // used to show and hide the group notation value in VNFC information
resetGroupNotation() {
if (this.Sample['group-notation-type'] == "existing-group-name") {
this.Sample['group-notation-value'] = ""
@@ -1554,98 +1505,121 @@ export class ReferenceDataformComponent implements OnInit {
}
resetParamsOnVnfcType() {
- console.log(this.classNm + ": resetParamsOnVnfcType: start:\n " +
- "ref.DataObject.scope vnfc-type:[" +
- this.referenceDataObject.scope['vnfc-type'] + "]");
- let scopeName = '';
- //if only vnf is there
- if (this.referenceDataObject.scope['vnfc-type'] == '' || this.referenceDataObject.scope['vnfc-type'] == null || this.referenceDataObject.scope['vnfc-type'] == 'null') {
- scopeName = this.referenceDataObject.scope['vnf-type'];
+ let scopeName: any;
+ let vnfcTypeList = this.referenceDataObject.scope['vnfc-type-list']
+ let vnfcType = this.referenceDataObject.scope['vnfc-type']
+ let vnfType = this.referenceDataObject.scope['vnf-type'];
+ //called only if only vnf is there
+ if ((this.referenceDataFormUtil.nullCheckForVnfcTypeList(vnfcTypeList)) && (this.referenceDataFormUtil.nullCheckForVnfcType(vnfcType))
+ ) {
+ scopeName = vnfType;
this.referenceDataObject.scope['vnfc-type'] = '';
this.referenceDataObject['action-level'] = 'vnf';
this.referenceDataObject['scopeType'] = 'vnf-type';
+ scopeName = scopeName.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
}
//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
else {
- scopeName = this.referenceDataObject.scope['vnfc-type'];
+ if (this.referenceDataFormUtil.nullCheckForVnfcTypeList(vnfcTypeList)) {
+ scopeName = vnfcType ? vnfcType : "";
+ } else {
+ // scopeName = this.referenceDataObject.scope['vnfc-type-list'];
+ }
+
if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
- this.referenceDataObject['action-level'] = 'vnfc';
+ this.referenceDataObject['action-level'] = 'vnf';
this.referenceDataObject['scopeType'] = 'vnfc-type';
} else {
this.referenceDataObject['action-level'] = 'vnf';
this.referenceDataObject['scopeType'] = 'vnf-type';
}
}
- //replacing / with _ and removing spaces in the scopeName
- if (scopeName) {
- scopeName = scopeName.replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
- }
- console.log(this.classNm + ": resetParamsOnVnfcType: return scopeName:[" +
- scopeName + "]");
+ this.referenceDataObject.scope['vnfc-type'] = this.referenceDataObject.scope['vnfc-type'] ? this.referenceDataObject.scope['vnfc-type'] : "";
return scopeName
}
- decideExtension(obj) {
- //marking the extension based on the device-protocol selected by the user
- let extension = '.json';
- switch (obj['device-protocol']) {
- case 'ANSIBLE':
- case 'CHEF':
- case 'CLI':
- extension = '.json';
- break;
- case 'NETCONF-XML':
- case 'REST':
- extension = '.xml';
- break;
- }
- return extension;
- }
+ //used to form the structure of the reference file
prepareArtifactList(scopeName, extension) {
- console.log(this.classNm + ": prepareArtifactList: start: scopeName:[" +
- scopeName + "] extension:[" + extension + "]");
this.referenceDataObject['artifact-list'] = [];
- //preparing the artifact list array file names along with extension
- let config_template_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V' + extension;
- let pd_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V.yaml';
- let reference_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V.json';
- let configTemplate = {
- 'artifact-name': 'template_' + config_template_fileName,
- 'artifact-type': 'config_template'
- };
- let pdTemplate = {
- 'artifact-name': 'pd_' + pd_fileName,
- 'artifact-type': 'parameter_definitions'
- };
- if (this.referenceDataObject.action != 'ConfigScaleOut') {
- this.referenceDataObject['artifact-list'].push(configTemplate,
- pdTemplate
- );
- } else {
- let identifiers = this.referenceDataObject['template-id-list'];
- if (identifiers) {
- for (var x = 0; x < identifiers.length; x++) {
+ let configTemplate
+ let pdTemplate
+ let paramValue
+ let vnf = this.referenceDataObject.scope['vnf-type']
+ if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic') {
+ let vnfcTypeList = this.referenceDataObject.scope['vnfc-type-list'];
+ let pd_fileName
+ let config_template_fileName
+
+ let param_fileName
+ if (vnfcTypeList && vnfcTypeList.length > 0) {
+
+
+ for (var x = 0; x < vnfcTypeList.length; x++) {
//for replacing spaces and "/" with "_"
- identifiers[x] = identifiers[x].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
- pd_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V_' + identifiers[x] + '.yaml';
- config_template_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V_' + identifiers[x] + extension;
-
- configTemplate = {
- 'artifact-name': 'template_' + config_template_fileName,
- 'artifact-type': 'config_template'
- };
- pdTemplate = {
- 'artifact-name': 'pd_' + pd_fileName,
- 'artifact-type': 'parameter_definitions'
- };
+ let type = vnfcTypeList[x].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
+ pd_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, type, '.yaml')
+ config_template_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, type, extension)
+ param_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, type, '.json')
+ configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
+
this.referenceDataObject['artifact-list'].push(configTemplate,
- pdTemplate
+ pdTemplate, paramValue
);
}
+ } else if (scopeName) {
+ pd_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V.yaml';
+ config_template_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V' + extension;
+ param_fileName = this.referenceDataObject.action + '_' + scopeName + '_' + '0.0.1V.json';
+ configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
+ this.referenceDataObject['artifact-list'].push(configTemplate,
+ pdTemplate, paramValue
+ );
}
+ } else {
+
+ //preparing the artifact list array file names along with extension
+ let config_template_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', extension);
+ let pd_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', '.yaml');
+ let reference_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', '.json');
+ let param_fileName = this.referenceDataFormUtil.createArtifactName(this.referenceDataObject.action, vnf, '', '.json');
+ configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
+ if (this.referenceDataObject.action != 'ConfigScaleOut') {
+
+ this.referenceDataObject['artifact-list'].push(configTemplate,
+ pdTemplate, paramValue
+ );
+
+ } else {
+
+ let identifiers = this.referenceDataObject['template-id-list'];
+ if (identifiers) {
+ for (var x = 0; x < identifiers.length; x++) {
+ //for replacing spaces and "/" with "_"
+ let type = identifiers[x].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
+ pd_fileName = this.referenceDataFormUtil.createArtifactNameForIdentifiers(this.referenceDataObject.action, this.referenceDataObject.scope["vnf-type"], type, '.yaml');
+ config_template_fileName = this.referenceDataFormUtil.createArtifactNameForIdentifiers(this.referenceDataObject.action, this.referenceDataObject.scope["vnf-type"], type, extension);
+ param_fileName = this.referenceDataFormUtil.createArtifactNameForIdentifiers(this.referenceDataObject.action, this.referenceDataObject.scope["vnf-type"], type, '.json');
+ configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValue(param_fileName);
+
+ this.referenceDataObject['artifact-list'].push(configTemplate,
+ pdTemplate, paramValue
+ );
+ }
+ }
+
+ }
}
}
+ // used to remove the added vms for actions other than configure & scaleout
deleteVmsforNonActions(newObj, action) {
let configureObject = (action == 'Configure');
let ConfigScaleOut = (action == 'ConfigScaleOut');
@@ -1663,26 +1637,78 @@ export class ReferenceDataformComponent implements OnInit {
}
return newObj
}
+ // used to replace the data in tempall obj and form the artifact names
pushOrReplaceTempData(newObj, action) {
- console.log(this.classNm + ": pushOrReplaceTempData: start: action:[" +
- action + "]\n newObj.scope vnfc-type:[" + newObj.scope['vnfc-type'] + "]");
- if (newObj.scope['vnfc-type'] == undefined ||
- newObj.scope['vnfc-type'] == null ||
- newObj.scope['vnfc-type'].length < 1) {
- console.log(this.classNm + ": pushOrReplaceTempData: scope vnfc-type" +
- " is empty.\n vnfcIdentifier:[" + this.vnfcIdentifier + "]");
- if (this.vnfcIdentifier != null && this.vnfcIdentifier != undefined &&
- this.vnfcIdentifier.length > 0) {
- newObj.scope['vnfc-type'] = this.vnfcIdentifier;
+ let configTemplate
+ let pdTemplate
+ let paramValue
+ if (newObj.action == "Configure" || newObj.action == "ConfigModify" || newObj.action == "DistributeTraffic") {
+ let extension = this.referenceDataFormUtil.decideExtension(this.referenceDataObject);
+ 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';
+ 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;
+ 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';
+ configTemplate = this.referenceDataFormUtil.createConfigTemplateForPushReplaceData(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplateForPushReplaceData(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValueForPushReplaceData(param_fileName);
+ let idValue = ""
+ if (newObj.scope['vnfc-type']) {
+ idValue = newObj.scope['vnfc-type']
+ } else if (this.vnfcIdentifier) {
+ idValue = this.vnfcIdentifier
}
- };
+
+ let arr = [configTemplate, pdTemplate, paramValue]
+ this.mappingEditorService.selectedObj({
+ action: newObj.action,
+ vnf: newObj.scope['vnf-type'] ? newObj.scope['vnf-type'] : "",
+ vnfc: idValue,
+ protocol: newObj['device-protocol'] ? newObj['device-protocol'] : "",
+ param_artifact: paramValue['param_artifact'],
+ pd_artifact: pdTemplate['pd_artifact'],
+ template_artifact: configTemplate['template_artifact']
+ });
+ } else if (newObj.action == "ConfigScaleOut") {
+ let extension = this.referenceDataFormUtil.decideExtension(newObj);
+ 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";
+ 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;
+ 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';
+ configTemplate = this.referenceDataFormUtil.createConfigTemplateForPushReplaceData(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplateForPushReplaceData(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValueForPushReplaceData(param_fileName);
+ let arr = [configTemplate, pdTemplate, paramValue]
+ this.mappingEditorService.selectedObj({
+ action: newObj.action,
+ vnf: newObj.scope['vnf-type'] ? newObj.scope['vnf-type'] : "",
+ //vnfc: newObj['vnfcIdentifier'] ? newObj['vnfcIdentifier'] : "",
+ protocol: newObj['device-protocol'] ? newObj['device-protocol'] : "",
+ templateId: this.templateIdentifier,
+ param_artifact: paramValue['param_artifact'],
+ pd_artifact: pdTemplate['pd_artifact'],
+ template_artifact: configTemplate['template_artifact']
+ });
+ }
+ else {
+ let extension = this.referenceDataFormUtil.decideExtension(newObj);
+ let pd_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.yaml';
+ let config_template_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V' + extension;
+ let param_fileName = this.referenceDataObject.action + '_' + newObj.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '') + '_' + '0.0.1V.json';
+ configTemplate = this.referenceDataFormUtil.createConfigTemplateForPushReplaceData(config_template_fileName);
+ pdTemplate = this.referenceDataFormUtil.createPdTemplateForPushReplaceData(pd_fileName);
+ paramValue = this.referenceDataFormUtil.createParamValueForPushReplaceData(param_fileName);
+ let arr = [configTemplate, pdTemplate, paramValue]
+ this.mappingEditorService.selectedObj({
+ action: newObj.action,
+ vnf: newObj.scope['vnf-type'] ? newObj.scope['vnf-type'] : "",
+ protocol: newObj['device-protocol'] ? newObj['device-protocol'] : "",
+ param_artifact: paramValue['param_artifact'],
+ pd_artifact: pdTemplate['pd_artifact'],
+ template_artifact: configTemplate['template_artifact']
+ });
+ }
+
let actionObjIndex = this.tempAllData.findIndex(obj => {
return obj['action'] == action;
});
- if (newObj.action != 'HealthCheck') {
- delete newObj['url'];
- }
-
if (actionObjIndex > -1) {
this.tempAllData[actionObjIndex] = newObj;
this.mappingEditorService.saveLatestAction(this.tempAllData[actionObjIndex]);
@@ -1695,8 +1721,10 @@ export class ReferenceDataformComponent implements OnInit {
}
} else {
if (newObj.action != '') {
+
this.tempAllData.push(newObj);
this.mappingEditorService.saveLatestAction(newObj);
+
if (newObj.action == "ConfigScaleOut") {
this.mappingEditorService.saveLatestIdentifier(this.templateIdentifier);
}
@@ -1706,12 +1734,9 @@ export class ReferenceDataformComponent implements OnInit {
}
}
}
-
}
-
// removes the unwanted keys added in the artifact for vnfc level actions
deleteUnwantedKeys(newObj) {
- console.log(this.classNm + ": deleteUnwantedKeys: start.");
newObj = JSON.parse(JSON.stringify(newObj))
delete newObj['template-id']
delete newObj['vnfcIdentifier']
@@ -1721,25 +1746,28 @@ export class ReferenceDataformComponent implements OnInit {
if (newObj.action != 'HealthCheck') {
delete newObj['url'];
}
- if (newObj.action != "Configure" && newObj.action != "ConfigModify" && newObj.action != "DistributeTraffic") {
+ if (newObj.action != "Configure" && newObj.action != "ConfigModify" && newObj.action == "DistributeTraffic") {
newObj.scope['vnfc-type-list'] = [];
}
return newObj
}
addAllActionObj(newObj, scopeName) {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": addAllActionObj: start.");
+
//Creating all action block to allow mulitple actions at once
let allAction = {
action: 'AllAction',
'action-level': 'vnf',
scope: newObj.scope,
- 'artifact-list': [{
- 'artifact-name': 'reference_AllAction' + '_' + scopeName + '_' + '0.0.1V.json',
- 'artifact-type': 'reference_template'
- }]
+ 'artifact-list': []
};
+ let vnfType = this.referenceDataObject.scope['vnf-type'].replace(/ /g, '').replace(new RegExp('/', 'g'), '_').replace(/ /g, '');
+
+ allAction['artifact-list'].push({
+ 'artifact-name': 'reference_AllAction' + '_' + vnfType + '_' + '0.0.1V.json',
+ 'artifact-type': 'reference_template'
+ })
+
let allActionIndex = this.tempAllData.findIndex(obj => {
return obj['action'] == 'AllAction';
});
@@ -1751,12 +1779,18 @@ export class ReferenceDataformComponent implements OnInit {
}
resetTempData() {
- if (this.utilityService.getTracelvl() > 0)
- console.log(this.classNm + ": resetTempData: start.");
- if (this.uploadedDataArray && this.uploadedDataArray != undefined && this.uploadedDataArray.length != 0) {
- if (this.tempAllData && this.tempAllData != undefined) {
+ let methName= "resetTempData";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": start.");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": tempAllData:["+
+ JSON.stringify(this.tempAllData)+"]");
+ if (this.utilityService.checkNotNull(this.uploadedDataArray)) {
+
+ if (this.utilityService.checkNotNull(this.tempAllData)) {
for (var i = 0; i < this.tempAllData.length; i++) {
var result = false;
+
if (this.tempAllData[i].action === 'AllAction') {
result = true;
}
@@ -1775,26 +1809,27 @@ export class ReferenceDataformComponent implements OnInit {
}
trackByFn(index, item) {
- return index;
+ return index; // or item.id
}
-
getArtifactsOpenStack() {
- console.log(this.classNm + ": getArtifactsOpenStack: start: " +
- "tempAllData length=" + this.tempAllData.length);
var array = []
var vnfcFunctionCodeArrayList = [];
var vnfcSetArray = [];
+ // var vnfcSet = new Set();
for (var i = 0; i < this.tempAllData.length; i++) {
if (!this.checkIfelementExistsInArray(this.tempAllData[i].action, this.actions) && (this.tempAllData[i].action != 'AllAction')) {
var vnfcFunctionCodeArray = this.tempAllData[i]["vnfc-function-code-list"]
+ // vnfcSet.add("Actions")
+ /* for (var j = 0; j < vnfcFunctionCodeArray.length; j++) {
+ vnfcSet.add(vnfcFunctionCodeArray[j])
+ }*/
vnfcFunctionCodeArrayList.push([this.tempAllData[i].action].concat(this.tempAllData[i]["vnfc-function-code-list"]))
}
if (this.tempAllData[i].action === 'OpenStack Actions') {
vnfcSetArray = this.tempAllData[i]['firstRowVmSpreadSheet']
}
}
- console.log(this.classNm + ": getArtifactsOpenStack: vnfcSetArray length=" +
- vnfcSetArray.length);
+
if (vnfcSetArray) {
let vnfcSetArrayLen = vnfcSetArray.length;
@@ -1817,54 +1852,6 @@ export class ReferenceDataformComponent implements OnInit {
}
}
- /**
- * Handles the display of VM block based on the action change
- */
- handleVMBlockDisplay() {
- switch (this.referenceDataObject.action) {
- case this.actionList.ConfigScaleOut:
- case this.actionList.Configure:
- case undefined:
- case '':
- this.displayVMBlock = true;
- break;
- default:
- this.displayVMBlock = false;
- }
- }
-
- //.. check VNFC Type equality in Upper Selection vs entered in Sample field
- checkVnfcTypeEqual(vnfctp: string) {
- var methName = "checkVnfcTypeEqual";
- console.log(this.classNm + ": " + methName + ": vnfctp:[" + vnfctp + "]");
- console.log(this.classNm + ": " + methName + ": vnfcIdentifier:[" +
- this.vnfcIdentifier + "]");
- console.log(this.classNm + ": " + methName + ": Sample[vnfc-type]:[" +
- this.Sample['vnfc-type'] + "]");
- if (vnfctp != null && vnfctp.length > 0) {
- if (this.vnfcIdentifier != null && this.vnfcIdentifier.length > 0) {
- console.log(
- this.classNm + ": " + methName + ": compare non empty VNFC Types...");
- if (vnfctp != this.vnfcIdentifier) {
- console.log(this.classNm + ": " + methName + ": Non-match WARNING !");
- //.. display in pop-up
- this.nService.warn('WARNING',
- "The specified VNFC Types don't match." +
- " Can cause discrepancy in the artifacts.", this.options);
- } else {
- console.log(this.classNm + ": checkVnfcTypeEqual: VNFC Types're equal.");
- };
- };
- };
- };
-
- //.. populating VNFC Type in Sample fields
- setVnfcTypeInSample(vnfctp: string) {
- // if( this.utilityService.getTracelvl() > 0 )
- console.log(this.classNm + ": setVnfcTypeInSample: vnfctp:[" + vnfctp + "]");
- this.Sample['vnfc-type'] = vnfctp;
- };
-
// Common method to show validation errors
private showValidationErrors(referenceDataObject) {
if (this.referenceDataObject.action === '') {
@@ -1879,10 +1866,16 @@ export class ReferenceDataformComponent implements OnInit {
if (referenceDataObject.action === 'ConfigScaleOut' && !this.templateIdentifier) {
this.nService.error('Error', 'Select a valid Template Identifier');
}
+
+ // if ((referenceDataObject.action === 'Configure' || referenceDataObject.action === 'ConfigModify') && !this.vnfcIdentifier && this.displayVnfc != 'false') {
+ // this.nService.error('Error', 'Select a valid Vnfc Type');
+ // return;
+ // }
}
resetArtifactList(obj) {
- console.log(this.classNm + ": resetArtifactList: start...");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": resetArtifactList: start...");
let vnfcTypeList = obj.scope['vnfc-type-list'];
let vnf = this.referenceDataObject.scope['vnf-type']
let pd_fileName
@@ -1920,4 +1913,86 @@ export class ReferenceDataformComponent implements OnInit {
);
}
}
+
+ /**
+ * Handles the display of VM block based on the action change
+ */
+ handleVMBlockDisplay() {
+ switch (this.referenceDataObject.action) {
+ case this.actionList.ConfigScaleOut:
+ case this.actionList.Configure:
+ case undefined:
+ case '':
+ this.displayVMBlock = true;
+ break;
+ default:
+ this.displayVMBlock = false;
+ }
+ }
+
+ //.. check VNFC Type equality in Upper Selection vs entered in Sample field
+ checkVnfcTypeEqual( vnfctp: string ) {
+ var methName= "checkVnfcTypeEqual";
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": "+methName+": vnfctp:["+vnfctp+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": vnfcIdentifier:["+
+ this.vnfcIdentifier+"]");
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": "+methName+": Sample[vnfc-type]:["+
+ this.Sample['vnfc-type']+"]");
+ if( vnfctp != null && vnfctp.length > 0 ) {
+ if( this.vnfcIdentifier != null && this.vnfcIdentifier.length > 0 ) {
+ console.log(
+ this.classNm+": "+methName+": compare non empty VNFC Types...");
+ if( vnfctp != this.vnfcIdentifier ) {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": "+methName+": Non-match WARNING !");
+ //.. display in pop-up
+ this.nService.warn( 'WARNING',
+ "The specified VNFC Types don't match."+
+ " Can cause discrepancy in the artifacts.", this.options );
+ } else {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log(this.classNm+": checkVnfcTypeEqual: VNFC Types're equal.");
+ };
+ };
+ };
+ };
+
+ //.. populating VNFC Type in Sample fields
+ setVnfcTypeInSample( vnfctp: string ) {
+ //clear vnfc information samples
+ this.clearVnfcData();
+
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": setVnfcTypeInSample: vnfctp:["+vnfctp+"]");
+ this.Sample['vnfc-type']= vnfctp;
+ };
+
+ /**
+ * Procesess reference data after retrieval from appc or after a reference file has been uploaded from PC.
+ */
+ processReferenceDataAfterRetrieval() {
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": processReferenceDataAfterRetr: start...");
+ if (this.referenceDataObject.action === 'OpenStack Actions') {
+ this.deviceProtocols = ['', 'OpenStack'];
+ this.buildDesignComponent.tabs = this.referencDataTab;
+ } else {
+ this.buildDesignComponent.tabs = this.allTabs;
+ }
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": processReferenceDataAfterRetr: done.");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": vnfcIdentifier:["+this.vnfcIdentifier+"]");
+ if( this.utilityService.getTracelvl() > 1 )
+ console.log( this.classNm+": oldVnfcIdentifier:["+
+ this.oldVnfcIdentifier+"]");
+ if( this.utilityService.getTracelvl() > 0 )
+ console.log( this.classNm+": refDataObj.scope.vnfc-type:["+
+ this.referenceDataObject.scope['vnfc-type']+"]");
+ this.setVnfcTypeInSample( this.vnfcIdentifier );
+ }
+
}