summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/app/vnfs/build-artifacts/build-artifacts.component.html11
-rw-r--r--src/app/vnfs/build-artifacts/build-artifacts.component.spec.ts29
-rw-r--r--src/app/vnfs/build-artifacts/build-artifacts.component.ts32
-rw-r--r--src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts15
-rw-r--r--src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts10
-rw-r--r--src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts33
-rw-r--r--src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts13
7 files changed, 121 insertions, 22 deletions
diff --git a/src/app/vnfs/build-artifacts/build-artifacts.component.html b/src/app/vnfs/build-artifacts/build-artifacts.component.html
index feb5be8..33d8064 100644
--- a/src/app/vnfs/build-artifacts/build-artifacts.component.html
+++ b/src/app/vnfs/build-artifacts/build-artifacts.component.html
@@ -25,8 +25,15 @@ limitations under the License.
<div class="col-xs-12 col-sm-12 col-md-12 col-lg-12">
<ul class="nav nav-tabs custom-heade-nav" style="margin-bottom: 12px;">
<li [ngClass]="{'active-tab':((router.url.indexOf('/'+item.url))>-1 || router.url.indexOf(item.url)>-1 )}" *ngFor="let item of tabs">
- <a *ngIf="this.refDataRequiredFiels == true" [routerLink]="[item.url]" [type]="item.type" class="nav-link">{{item.name}}</a>
- <a *ngIf="this.refDataRequiredFiels == false" [type]="item.type" class="nav-link">{{item.name}}</a>
+ <a *ngIf="this.refDataRequiredFiels == true"
+ [routerLink]="[item.url]"
+ [type]="item.type"
+ class="nav-link">{{item.name}}</a>
+
+ <a *ngIf="this.refDataRequiredFiels == false"
+ [type]="item.type"
+ class="nav-link"
+ (click)="checkRefDataReqFields()">{{item.name}}</a>
</li>
</ul>
</div>
diff --git a/src/app/vnfs/build-artifacts/build-artifacts.component.spec.ts b/src/app/vnfs/build-artifacts/build-artifacts.component.spec.ts
index 16d7029..48edb99 100644
--- a/src/app/vnfs/build-artifacts/build-artifacts.component.spec.ts
+++ b/src/app/vnfs/build-artifacts/build-artifacts.component.spec.ts
@@ -101,4 +101,33 @@ describe('BuildDesignComponent', () => {
expect(component.refDataRequiredFiels).toBeTruthy();
});
+// Test checkRefDataReqFields Method
+ it('Should notify error message if action is not valid', () => {
+ let spy = spyOn(NotificationsService.prototype, 'error');
+ component.refList = {"action": "", "scope": {"vnf-type": "test 1"}, "device-protocol": "ANSIBLE"};
+
+ component.checkRefDataReqFields();
+
+ expect(spy).toHaveBeenCalled();
+ });
+
+ it('Should notify error message if VNF Type is not valid', () => {
+ let spy = spyOn(NotificationsService.prototype, 'error');
+ component.refList = {"action": "Configure", "scope": {"vnf-type": ""}, "device-protocol": "ANSIBLE"};
+
+ component.checkRefDataReqFields();
+
+ expect(spy).toHaveBeenCalled();
+ });
+
+ it('Should notify error message if Device Protocol is not valid', () => {
+ let spy = spyOn(NotificationsService.prototype, 'error');
+ component.refList = {"action": "Configure", "scope": {"vnf-type": "test 1"}, "device-protocol": ""};
+
+ component.checkRefDataReqFields();
+
+ expect(spy).toHaveBeenCalled();
+ });
+
+
});
diff --git a/src/app/vnfs/build-artifacts/build-artifacts.component.ts b/src/app/vnfs/build-artifacts/build-artifacts.component.ts
index 265fd77..ba88717 100644
--- a/src/app/vnfs/build-artifacts/build-artifacts.component.ts
+++ b/src/app/vnfs/build-artifacts/build-artifacts.component.ts
@@ -23,14 +23,17 @@ limitations under the License.
import { Component, OnInit } from '@angular/core';
import { Router } from '@angular/router';
import * as _ from 'underscore';
+import { NotificationsService } from 'angular2-notifications';
+
@Component({ selector: 'app-build-design', templateUrl: './build-artifacts.component.html', styleUrls: ['./build-artifacts.component.css'] })
export class BuildDesignComponent implements OnInit {
tabs: Array<Object> = [];
private allowOtherUpdates: boolean = true;
public refDataRequiredFiels: boolean = false;
+ public refList;
- constructor(private router: Router) {
+ constructor (private router: Router, private notificationsService: NotificationsService) {
}
ngOnInit() {
@@ -81,12 +84,35 @@ export class BuildDesignComponent implements OnInit {
}
public getRefData(referenceList) {
- if (referenceList.action !== '' && referenceList['vnf-type'] !== '' && referenceList['device-protocol'] !== '') {
- this.refDataRequiredFiels = true;
+ this.refList = referenceList;
+ if(referenceList.action !== '' && referenceList.scope['vnf-type'] !== '' && referenceList['device-protocol'] !== '') {
+ if(referenceList.action === 'ConfigScaleOut') {
+ if(referenceList.hasOwnProperty('template-id') && referenceList['template-id'] !== undefined && referenceList['template-id'] != '')
+ this.refDataRequiredFiels = true;
+ }
+ else this.refDataRequiredFiels = true;
}
else {
this.refDataRequiredFiels = false;
}
}
+ public checkRefDataReqFields() {
+ if(this.refList.action == '' && this.refList.scope['vnf-type'] == '' && this.refList['device-protocol'] == '') {
+ this.notificationsService.error('Error', 'Select Valid Action, VNF Type, Device Protocol');
+ }
+ else if(this.refList.action == '') {
+ this.notificationsService.error('Error', 'Select a valid Action');
+ }
+ else if(this.refList.scope['vnf-type'] == '') {
+ this.notificationsService.error('Error', 'Select a valid VNF Type');
+ }
+ else if(this.refList['device-protocol'] == '') {
+ this.notificationsService.error('Error', 'Select a valid Device Protocol');
+ }
+ else if (this.refList.action === 'ConfigScaleOut') {
+ this.notificationsService.error('Error', 'Select a valid Template Identifier');
+ }
+ }
+
}
diff --git a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts
index e7e60c3..80269cb 100644
--- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts
+++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts
@@ -185,7 +185,7 @@ export class ParameterComponent implements OnInit {
public artifactName;
public appDataObject: any;
public downloadDataObject: any;
- public artifact_fileName;
+ public artifact_fileName="";
identifier: any;
private selectedActionReference: any;
@@ -213,12 +213,13 @@ export class ParameterComponent implements OnInit {
if (artifactList[i]['artifact-type'] === 'parameter_definitions') {
var artifactName = artifactList[i]['artifact-name'];
var artifactNameWithoutExtension = '';
- if (artifactName) artifactNameWithoutExtension = artifactName.substring(0, artifactName.lastIndexOf("."))
- var identifier = artifactNameWithoutExtension.split("_");
- var id = '';
- if (identifier) id = identifier[identifier.length - 1];
- if (this.mappingEditorService.identifier) {
- if (id === this.mappingEditorService.identifier) this.artifact_fileName = artifactName;
+ if (artifactName) {
+ artifactNameWithoutExtension = artifactName.substring(0, artifactName.lastIndexOf("."));
+ }
+ if(this.mappingEditorService.identifier) {
+ if(artifactNameWithoutExtension.endsWith(this.mappingEditorService.identifier)) {
+ this.artifact_fileName = artifactName;
+ }
}
else {
diff --git a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts
index 72f56a7..43a367a 100644
--- a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts
+++ b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts
@@ -972,4 +972,14 @@ describe('ReferenceDataformComponent', () => {
expect(spy).toHaveBeenCalled()
});
+ it('Should return valid data in getArtifactsOpenStack', () => {
+ component.tempAllData = [{"action":"OpenStack Actions","action-level":"vnf","scope":{"vnf-type":"OpenStack test8","vnfc-type":""},"template":"N","vm":[],"device-protocol":"OpenStack","user-name":"","port-number":"","artifact-list":[],"scopeType":"vnf-type"},{"action":"AllAction","action-level":"vnf","scope":{"vnf-type":"OpenStack test8","vnfc-type":""},"artifact-list":[{"artifact-name":"reference_AllAction_OpenStacktest8_0.0.1V.json","artifact-type":"reference_template"}]},{"action":"Migrate","action-level":"vm","scope":{"vnf-type":"OpenStack test8","vnfc-type":null},"vnfc-function-code-list":["First","Second","Third","Fourth","Fifth"],"template":"N","device-protocol":"OS"},{"action":"Reboot","action-level":"vm","scope":{"vnf-type":"OpenStack test8","vnfc-type":null},"vnfc-function-code-list":["First","Second","Fourth","Fifth"],"template":"N","device-protocol":"OS"},{"action":"Rebuild","action-level":"vm","scope":{"vnf-type":"OpenStack test8","vnfc-type":null},"vnfc-function-code-list":["First","Second","Third","Fourth"],"template":"N","device-protocol":"OS"},{"action":"Snapshot","action-level":"vm","scope":{"vnf-type":"OpenStack test8","vnfc-type":null},"vnfc-function-code-list":["First","Third"],"template":"N","device-protocol":"OS"},{"action":"AttachVolume","action-level":"vm","scope":{"vnf-type":"OpenStack test8","vnfc-type":null},"vnfc-function-code-list":["First","Second","Third","Fourth"],"template":"N","device-protocol":"OS"},{"action":"DetachVolume","action-level":"vm","scope":{"vnf-type":"OpenStack test8","vnfc-type":null},"vnfc-function-code-list":["First","Fourth"],"template":"N","device-protocol":"OS"}]
+ let firstArrayElement = ["VM Type","First","Second","Third","Fourth","Fifth"];
+ let remUploadedDataArray = [["Migrate","Y","Y","Y","Y","Y"],["Reboot","Y","Y","","Y","Y"],["Rebuild","Y","Y","Y","Y"],["Snapshot","Y","","Y"],["AttachVolume","Y","Y","Y","Y"],["DetachVolume","Y","","","Y"]];
+
+ component.getArtifactsOpenStack();
+
+ expect(component.firstArrayElement).toEqual(firstArrayElement);
+ expect(component.remUploadedDataArray).toEqual(remUploadedDataArray);
+ });
});
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 72501ab..62b3044 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
@@ -895,15 +895,19 @@ export class ReferenceDataformComponent implements OnInit {
this.toggleIdentifier(data)
this.oldAction = this.currentAction;// this.referenceDataObject.action + '';
this.referenceDataObject.action = this.currentAction
+
this.populateExistinAction(data);
if (this.oldAction === 'OpenStack Actions') {
+
this.uploadedDataArray = [];
this.remUploadedDataArray = [];
this.firstArrayElement = [];
this.uploadFileName = '';
+ //this.tempAllData = [];
}
this.clearCache();
this.refernceScopeObj.from = '';
+ this.getArtifactsOpenStack()
} else {
this.toggleIdentifier(data)
this.currentAction = this.referenceDataObject.action;
@@ -914,8 +918,15 @@ export class ReferenceDataformComponent implements OnInit {
this.clearVnfcData()
this.refernceScopeObj.from = '';
}
+
// Enable or Block Template and PD Tabs
- this.buildDesignComponent.getRefData(this.referenceDataObject);
+ if(this.currentAction == 'ConfigScaleOut' && this.templateIdentifier) {
+ let referenceDataObjectTemp = this.referenceDataObject;
+ referenceDataObjectTemp['template-id'] = this.templateIdentifier;
+ this.buildDesignComponent.getRefData(referenceDataObjectTemp);
+ } else {
+ this.buildDesignComponent.getRefData(this.referenceDataObject);
+ }
});
} else {
this.actionChanged = true;
@@ -923,8 +934,15 @@ export class ReferenceDataformComponent implements OnInit {
this.populateExistinAction(data);
this.resetVmsForScaleout(data);
this.toggleIdentifier(data);
+
// Enable or Block Template and PD Tabs
- this.buildDesignComponent.getRefData(this.referenceDataObject);
+ if(this.currentAction == 'ConfigScaleOut' && this.templateIdentifier) {
+ let referenceDataObjectTemp = this.referenceDataObject;
+ referenceDataObjectTemp['template-id'] = this.templateIdentifier;
+ this.buildDesignComponent.getRefData(referenceDataObjectTemp);
+ } else {
+ this.buildDesignComponent.getRefData(this.referenceDataObject);
+ }
}
this.configDrp(data)
}
@@ -977,6 +995,11 @@ export class ReferenceDataformComponent implements OnInit {
if (data == null) {
return;
}
+ // Enable or Block Template and PD Tabs
+ let referenceDataObjectTemp = this.referenceDataObject;
+ referenceDataObjectTemp['template-id'] = data;
+ this.buildDesignComponent.getRefData(referenceDataObjectTemp);
+
if ((userForm.valid) && this.oldAction != '' && this.oldAction != undefined) {
this.currentAction = "ConfigScaleOut"
let referenceObject = this.prepareReferenceObject();
@@ -1324,22 +1347,24 @@ export class ReferenceDataformComponent implements OnInit {
trackByFn(index, item) {
return index;
}
- getArtifactsOpenStack() {
+ getArtifactsOpenStack() {
var array = []
var vnfcFunctionCodeArrayList = [];
var vnfcSet = new Set();
- vnfcSet.add("VM Type")
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"]))
}
}
+
var vnfcSetArray = Array.from(vnfcSet);
let vnfcSetArrayLen = vnfcSetArray.length;
+
for (let i = 0; i < vnfcFunctionCodeArrayList.length; i++) {
let element = vnfcFunctionCodeArrayList[i];
for (let j = 1; j < element.length; j++) {
diff --git a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
index 3868485..a37834e 100644
--- a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
+++ b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.ts
@@ -188,12 +188,13 @@ export class GoldenConfigurationComponent implements OnInit {
if (artifactList[i]['artifact-type'] === 'config_template') {
var artifactName = artifactList[i]['artifact-name'];
var artifactNameWithoutExtension = '';
- if (artifactName) artifactNameWithoutExtension = artifactName.substring(0, artifactName.lastIndexOf("."))
- var identifier = artifactNameWithoutExtension.split("_");
- var id = '';
- if (identifier) id = identifier[identifier.length - 1];
- if (this.mappingEditorService.identifier) {
- if (id === this.mappingEditorService.identifier) this.artifactName = artifactName;
+ if (artifactName) {
+ artifactNameWithoutExtension = artifactName.substring(0, artifactName.lastIndexOf("."));
+ }
+ if(this.mappingEditorService.identifier) {
+ if(artifactNameWithoutExtension.endsWith(this.mappingEditorService.identifier)) {
+ this.artifactName = artifactName;
+ }
}
else {
this.artifactName = artifactName;