summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGangarajula, Uday Bhasker (ug0221) <ug0221@us.att.com>2018-03-14 16:49:03 -0400
committerGangarajula, Uday Bhasker (ug0221) <ug0221@att.com>2018-03-14 17:00:00 -0400
commitd138be953cfa6308b510ad304cea9effdfa78b03 (patch)
treefffb2a869baea8a3314084013621b98d2bfd6564
parentf1e61ce405cf11ea77fe98abd5e10f7ed2d72611 (diff)
made changes to version info and defects
Change-Id: I90fb87f1f32365e44180615f9be1eb6d11060dcf Issue-ID: APPC-707 Signed-off-by: Gangarajula, Uday Bhasker (ug0221) <ug0221@att.com>
-rw-r--r--src/app/about-us/appVersion.json2
-rw-r--r--src/app/about-us/versionLog.txt101
-rw-r--r--src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html43
-rw-r--r--src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.spec.ts819
-rw-r--r--src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.ts252
5 files changed, 930 insertions, 287 deletions
diff --git a/src/app/about-us/appVersion.json b/src/app/about-us/appVersion.json
index 5972822..9e9f709 100644
--- a/src/app/about-us/appVersion.json
+++ b/src/app/about-us/appVersion.json
@@ -1,4 +1,4 @@
{
- "versionNo": "2.0.7",
+ "versionNo": "1.0.0",
"releaseName": "1806"
} \ No newline at end of file
diff --git a/src/app/about-us/versionLog.txt b/src/app/about-us/versionLog.txt
index af9808a..56abe31 100644
--- a/src/app/about-us/versionLog.txt
+++ b/src/app/about-us/versionLog.txt
@@ -1,104 +1,3 @@
-Version 2.0.7
-===========================================================
-1. Fixed issues raised by ST in test screen.
-2. Added few test cases to increase code coverage.
-
-Version 2.0.6
-===========================================================
-1. Fixed issues raised by ST in test screen.
-2. Added test spec file
-
-Version 2.0.5
-===========================================================
-1. Changed the location of Assign new Template Identifier.
-2. Fixed an issue with retaining the selected value in the dropdown for Template Id's.
-3. Added Artifact Name to the Filter box.
-4. Added empty value validations on create new VNF pop up box.
-
-Version 2.0.4
-===========================================================
-1. Added test cases to golden configuration spec file
-2. Fixed defect in test screen regarding request id while polling using getTestResponse method
-3. Added validation to template configuration tab for accepting only xml and json files
-4. Added validation to param values tab to accept only json files
-
-Version 2.0.3
-===========================================================
-1. Fixed E2E defect 430809 in 1802 : Space is not getting ignored in param configure artifact
- generated by CDT tool if VNF name / vnfc - type has spaces
-
-Version 2.0.2
-===========================================================
-1. Added Licence Info to Reference Data Screen.
-2. Added Config ScaleOut Action and Template Identifiers to the Reference screen.
-3. resolved a defect where the configscale out file uploaded doesnt populate the template is dropdown.
-
-Version 2.0.1
-===========================================================
-1. Added Licence Info to golden config/ My VNF and other modules for ONAP- Only Reference Page remaining.
-2. Added Test screen to the main menu.
-3. Created HTML for Test Screen and integrated ts code.
-
-Version 2.0.0
-===========================================================
-1. 18/06 Major release.
-
-Version 1.1.1
-===========================================================
-1. Defect 416768 Block Name should not be merged. Do not allow a merge with a value that double quotes around it, possibly a space and a colon at the end.
-2. Populating PD using name/value pairs when Uploading key file.
-
-Version 1.1.0
-===========================================================
-1. Added functionality for entering names in template through modal.
-2. Enabled test screen and added basic test functionality.
-
-Version 1.0.9
-===========================================================
-1. Allow user to upload of Key Data Files multiple times.
-2. Removing INSTAR and its properties using key file.
-
-Version 1.0.8
-===========================================================
-1. Changed the color code for merge successful/ unsuccessful messages.
-
-Version 1.0.7
-===========================================================
-1. Fixed defect in reference screen where previous vm actions where not getting replaced on uploading the new ones.
-
-Version 1.0.6
-===========================================================
-1. Fixed defect 396019- Added functionality for syncing template from parameters.
-
-Version 1.0.5
-===========================================================
-1. Fixed protocol field while uploading reference artifact file for OpenStack Actions.
-
-Version 1.0.4
-===========================================================
-1. Fixed defect: Changed artifact-list to [] and vnfc-type to null in case of reference artifact generated for OpenStack Actions.
-
-Version 1.0.3
-===========================================================
-1. Fix for Defect#399542 Merge from Params should not Merge the commented section of the base template ( CDT Version : 1.2.1).
-2. Fix for Defect#402786 While changing back to Manual from other sources, other fields is not return to previous.
-3. With some minor ST issues on PD source, ruletype manipulation.
-
-Version 1.0.2
-===========================================================
-1. Added functionality for hiding template and PD tabs on selection of OpenStack Actions in reference screen
-2. Fixed ST defect raised by Ed, wherein the user autoretrieves refrence data with multiple actions from myvnfs,
- comes to reference screen, and navigates to template and pd pages and comes back to reference page, the data for the
- multiple actions are saving and retrieving correctly now.
-
-Version 1.0.1
-===========================================================
-Story#330094 - Fixed the defects and left over tasks from this story.
- 1. Source Manual/INSTAR/A&AI selection handled properly.
- 2. Disabling INSTAR to avoid manual selection of INSTAR.
- 3. "" empty quates in PD file when we select empty value in dropdowns.
- 4. Retrieval of A&AI, ruletype, filter columns.
-
Version 1.0.0(18/02 Release)
==========================================================
diff --git a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html
index d38620a..7fcb9df 100644
--- a/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html
+++ b/src/app/vnfs/build-artifacts/reference-dataform/reference-dataform.component.html
@@ -22,36 +22,31 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
-->
<simple-notifications [options]="options"></simple-notifications>
-<ng-progress [positionUsing]="'marginLeft'" [minimum]="0.15" [maximum]="1" [speed]="200" [showSpinner]="false" [direction]="'leftToRightIncreased'" [color]="'#6ab344'"
- [trickleSpeed]="250" [thick]="true" [ease]="'linear'"></ng-progress>
+<ng-progress [positionUsing]="'marginLeft'" [minimum]="0.15" [maximum]="1" [speed]="200" [showSpinner]="false" [direction]="'leftToRightIncreased'" [color]="'#6ab344'" [trickleSpeed]="250" [thick]="true" [ease]="'linear'"></ng-progress>
<form class="" novalidate #userForm="ngForm" (ngSubmit)="save(userForm.value,userForm.valid)">
<div class="card">
-
<div class="card-block" style=" border-top: 5px solid #6ab344; border-top-right-radius: 7px;border-top-left-radius: 7px;">
<div class="row" style="padding: 15px 25px">
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
<label>Action*</label>
- <select class="form-control" required id="cmbAction" [(ngModel)]="referenceDataObject.action" (ngModelChange)="updateSessionValues($event,'action');actionChange($event,content,userForm);"
- #action="ngModel" name="action">
+ <select class="form-control" required id="cmbAction" [(ngModel)]="referenceDataObject.action" (ngModelChange)="updateSessionValues($event,'action');actionChange($event,content,userForm);" #action="ngModel" name="action">
<option [value]="actionType"
[ngClass]="{'selectedAction':selectedActions.indexOf(actionType)>-1}"
[selected]="referenceDataObject.action===actionType"
*ngFor="let actionType of actions ">{{actionType}}
</option>
</select>
-
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
<label>VNF Type* </label>
- <input type="text" [readonly]="updateParams !='undefined' || vnfParams?.vnfType " class="form-control" id="txtVnfType" required [(ngModel)]="referenceDataObject['scope']['vnf-type']"
- (ngModelChange)="updateSessionValues($event,'vnfType')" #vnftype="ngModel" name="vnftype">
+ <input type="text" [readonly]="updateParams !='undefined' || vnfParams?.vnfType " class="form-control" id="txtVnfType" required [(ngModel)]="referenceDataObject['scope']['vnf-type']" (ngModelChange)="updateSessionValues($event,'vnfType')" #vnftype="ngModel"
+ name="vnftype">
<span class="error-message" [hidden]="vnfParams?.vnfType || vnftype.valid || (vnftype.pristine && !userForm.submitted)">Required Field</span>
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
<label>VNFC Type</label>
- <input type="text" class="form-control" [disabled]="nonConfigureAction || updateParams !='undefined' || vnfParams?.vnfType" id="txtVnfcType" [(ngModel)]="referenceDataObject.scope['vnfc-type']"
- (blur)="setVnfcType($event.target.value)" (ngModelChange)="updateSessionValues($event,'vnfcType')" #vnfcType="ngModel" name="vnfcType"
- disabled="disabled">
+ <input type="text" class="form-control" [disabled]="nonConfigureAction || updateParams !='undefined' || vnfParams?.vnfType" id="txtVnfcType" [(ngModel)]="referenceDataObject.scope['vnfc-type']" (blur)="setVnfcType($event.target.value)" (ngModelChange)="updateSessionValues($event,'vnfcType')"
+ #vnfcType="ngModel" name="vnfcType" disabled="disabled">
</div>
<div class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
<label>Device Protocol*</label>
@@ -60,9 +55,8 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
*ngFor="let device of deviceProtocols">{{device}}
</option>
</select>
-
</div>
- <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="referenceDataObject['action']== 'ConfigScaleOut'">
+ <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="isConfigScaleOut">
<label>Template Identifier</label>
<select class="form-control" required id="tempIdentifier" (ngModelChange)="dataModified()" [(ngModel)]="templateIdentifier" #deviceProtocol="ngModel" name="templateIdentifier">
<option [value]="val" *ngFor="let val of referenceDataObject['template-id-list']">{{val}}
@@ -90,8 +84,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<div class="input-group">
<input id="excelInputFile" #myInput1 class="file" type="file" (change)="upload($event)">
<input [(ngModel)]="uploadFileName" type="text" class="input-lg" disabled placeholder="Upload VM Capabilities File" name="uploadFileName" style="width:80%">
- <button (click)="excelBrowseOption($event)" class="browse mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary input-lg"
- type="button">Upload VM Capabilities File
+ <button (click)="excelBrowseOption($event)" class="browse mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary input-lg" type="button">Upload VM Capabilities File
</button>
</div>
</div>
@@ -131,11 +124,10 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
</div>
<div *ngIf="actionHealthCheck && referenceDataObject['device-protocol'] =='REST' " class="col-lg-3 col-sm-6 col-md-3 col-xs-12">
<label>Context Url</label>
- <input type="text" class="form-control" id="txtIpaddress" [(ngModel)]="referenceDataObject['context-url']" name="portNumber">
+ <input type="text" class="form-control" id="txtIpaddress" [(ngModel)]="referenceDataObject['url']" name="contextUrl">
</div>
</div>
- <div class="card-block" *ngIf="(referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined)"
- style="border-top: 5px solid #6ab344;border-top-right-radius: 7px;border-top-left-radius: 7px;">
+ <div class="card-block" *ngIf="(referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined)" style="border-top: 5px solid #6ab344;border-top-right-radius: 7px;border-top-left-radius: 7px;">
<div class="col-12">
<h5 style="margin-top: 0.5rem;font-family: Roboto"> VNFC Information
<span class="pull-right">
@@ -164,13 +156,13 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
</div>
<div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
<label style="font-size:12px;">Group Notation Type</label>
- <select class="form-control" id="cmbGroupType" [(ngModel)]="Sample['group-notation-type']" name="sampleGroupNotation">
+ <select class="form-control" id="cmbGroupType" [(ngModel)]="Sample['group-notation-type']" name="sampleGroupNotation" (change)="resetGroupNotation()">
<option [value]="type" *ngFor="let type of groupAnotationType">{{type}}</option>
</select>
</div>
<div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
<label style="font-size:12px;">Group Notation Value</label>
- <input type="text" class="form-control" id="txtGroupValue" [(ngModel)]="Sample['group-notation-value']" name="sampleGroupValue">
+ <input type="text" class="form-control" [readonly]="disableGrpNotationValue" id="txtGroupValue" [(ngModel)]="Sample['group-notation-value']" name="sampleGroupValue">
</div>
<div class="col-lg-2 col-sm-6 col-md-2 col-xs-12">
<button type="button" class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--accent clear-btn" (click)="clearVnfcData()">Clear VNFC Info
@@ -184,22 +176,19 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
</div>
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-6">
<div class="form-group">
- <input type="text" placeholder="Number of VM(s)" class="form-control" id="txtVmnumber22" [(ngModel)]="refernceScopeObj.from" (ngModelChange)="numberValidation($event)"
- name="txtNumber23">
+ <input type="text" placeholder="Number of VM(s)" class="form-control" id="txtVmnumber22" [(ngModel)]="refernceScopeObj.from" (ngModelChange)="numberValidation($event)" name="txtNumber23">
</div>
</div>
<div class="col-lg-5 col-md-5 col-sm-6 col-xs-6 text-right">
<div class="form-group">
- <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" type="button" [disabled]="!refernceScopeObj.from || !numberOfVmTest"
- (click)="addVms()">Add VM Information
+ <button class="mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect mdl-button--primary" type="button" [disabled]="!refernceScopeObj.from || !numberOfVmTest" (click)="addVms()">Add VM Information
</button>
</div>
</div>
</div>
<div *ngIf="referenceDataObject.vm?.length>0">
<div class="row" *ngFor="let noOfvm of referenceDataObject.vm | vmFiltering:referenceDataObject?.action:templateIdentifier; let j=index">
- <div *ngIf="((referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined ))"
- class="col-12">
+ <div *ngIf="((referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined ))" class="col-12">
<div class="row" *ngFor="let item of noOfvm.vnfc; let i=index">
<div class="col-md-12" *ngIf="i==0">
<h5 class="headlinesInBold">VM Number: {{j+1}}</h5>
@@ -319,7 +308,7 @@ ECOMP is a trademark and service mark of AT&T Intellectual Property.
<div class="modal-body">
<div>
<div>
- <input name="test" type="text" class="" [(ngModel)]="templateId" placeholder="identifier">
+ <input pattern=".*[^ ].*" name="test" type="text" class="" [(ngModel)]="templateId" placeholder="identifier">
</div>
<div>
<button style="padding: 10px" class="btn btn-primary" data-dismiss="modal" (click)="addToIdentDrp()">submit
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 67ba8f5..1570e9c 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
@@ -20,48 +20,821 @@ limitations under the License.
ECOMP is a trademark and service mark of AT&T Intellectual Property.
============LICENSE_END============================================
*/
-
/* tslint:disable:no-unused-variable */
-import {async, ComponentFixture, TestBed} from '@angular/core/testing';
+
+import {ComponentFixture, TestBed, async, inject} from '@angular/core/testing';
+import {Http, Response, ResponseOptions, XHRBackend} from '@angular/http';
+import {BuildDesignComponent} from '../build-artifacts.component';
+import {DialogService} from 'ng2-bootstrap-modal';
+import {FormsModule} from '@angular/forms';
+import {HttpModule} from '@angular/http';
+import {HttpUtilService} from '../../../shared/services/httpUtil/http-util.service';
+import {MappingEditorService} from '../../..//shared/services/mapping-editor.service';
import {NO_ERRORS_SCHEMA} from '@angular/core';
+import {NgModule} from '@angular/core';
+import {NgProgress} from 'ngx-progressbar';
+import {NgbModule} from '@ng-bootstrap/ng-bootstrap';
+import {NotificationService} from '../../../shared/services/notification.service';
+import {Observable} from 'rxjs/Observable';
+import {ParamShareService} from '../../..//shared/services/paramShare.service';
import {ReferenceDataformComponent} from './reference-dataform.component';
-import {FormsModule} from '@angular/forms';
-import { NotificationService } from '../../../shared/services/notification.service';
-import { ParamShareService } from '../../..//shared/services/paramShare.service';
-import { MappingEditorService } from '../../..//shared/services/mapping-editor.service';
-import {DialogService} from 'ng2-bootstrap-modal';
import {RouterTestingModule} from '@angular/router/testing';
-import { HttpUtilService } from '../../../shared/services/httpUtil/http-util.service';
-import { NgModule } from '@angular/core';
-import { NgProgress } from 'ngx-progressbar';
-import { HttpModule } from '@angular/http';
-import { NgbModule } from '@ng-bootstrap/ng-bootstrap';
-import { SharedModule } from '../../../shared/shared.module';
-
+import {SharedModule} from '../../../shared/shared.module';
+import {environment} from '../../../../environments/environment';
describe('ReferenceDataformComponent', () => {
- let component: ReferenceDataformComponent;
- let fixture: ComponentFixture<ReferenceDataformComponent>;
-
+ let component : ReferenceDataformComponent;
+ let fixture : ComponentFixture < ReferenceDataformComponent >;
+ let service : MockMappingService;
+
+ let httpMock : HttpUtilService
+ //mockingthe data for mappingEditorService
+
+ class HttpMock {
+ post(req) {
+ if(req.url==""){
+
+ return Observable.of({
+ output: {
+ data: {block:'{"artifactInfo": [ {"artifact-content": "{"reference_data": [{ "action": "Configure","scopeType":"tetsScope"}] }" } ]}'},
+ status:{code:"400",message:"success"}
+ }
+ })
+ } }
+ }
+ class MockMappingService {
+ public latestAction; // = {"action":"Configure"}
+ appDataObject= { reference: {}, template: { templateData: {}, nameValueData: {} }, pd: {} };
+ downloadDataObject={reference: {},
+ template: { templateData: {}, nameValueData: {}, templateFileName: '', nameValueFileName: '' },
+ pd: { pdData: '', pdFileName: '' }}
+ referenceNameObjects = [
+ {
+ action: "Configure"
+ }, {
+ action: "StartApplication"
+ }
+ ]
+
+ setTemplateMappingDataFromStore(data){
+ return "test"
+ }
+ getReferenceList() {
+ return ["test data"]
+ }
+ changeNav() {
+ return "test data"
+ }
+ setParamContent(data){
+ return "test"
+ }
+ setSessionParamData(data){
+ return "test"
+ }
+
+ saveLatestAction() {}
+ saveLatestIdentifier() {}
+ changeNavDownloadData() {}
+ changeNavAppData() {}
+ }
+ class MockreferenceDataObject {}
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ReferenceDataformComponent],
schemas: [NO_ERRORS_SCHEMA],
- imports: [FormsModule, RouterTestingModule,HttpModule,NgbModule.forRoot()],
- providers: [NgProgress, ParamShareService, DialogService, NotificationService, HttpUtilService, MappingEditorService]
-
- })
- .compileComponents();
- }));
+ imports: [
+
+ FormsModule, RouterTestingModule, HttpModule, NgbModule.forRoot(),
+ SharedModule.forRoot()
+ ],
+ providers: [
+ BuildDesignComponent, {
+ provide: MappingEditorService,
+ useClass: MockMappingService
+ },
+ ParamShareService,
+ DialogService,
+ NotificationService, {
+ provide: HttpUtilService,
+ useClass: HttpMock
+ }
+ ]
+ }).compileComponents();
+ }));
beforeEach(() => {
fixture = TestBed.createComponent(ReferenceDataformComponent);
component = fixture.componentInstance;
+ // component = new ReferenceDataformComponent(service)
fixture.detectChanges();
+ service = TestBed.get(MappingEditorService)
+ httpMock = TestBed.get(HttpUtilService)
+ sessionStorage.setItem('vnfParams',JSON.stringify({vnfType:"test",vnfcType:"testVnfcType"}));
+ // component = new ReferenceDataformComponent(service)
+ });
+ it('should create reference component', () => {
+ expect(component).toBeTruthy();
});
+ it('Should load data from mapping sevice', () => {
+ component.ngOnInit()
+ expect(component.tempAllData.length).toBe(2)
+ })
+ it('testing init method', () => {
+ component.ngOnInit()
+ expect(component.tempAllData.length).toBe(2)
+ })
+
+ it("should set app data from service", ()=>{
+ component.ngOnInit()
+ expect(component.appData).not.toBe(undefined)
+ })
+ it("should set download from service", ()=>{
+ component.ngOnInit()
+ expect(component.downloadData).not.toBe(undefined)
+ })
+ it('Should reset form', () => {
+ component.resetForm()
+ expect(component.referenceDataObject['device-protocol']).toBe('')
+ expect(component.referenceDataObject['action-level']).toBe('vnf')
+ expect(component.referenceDataObject.template).toBe('Y')
+ expect(component.referenceDataObject['user-name']).toBe('')
+ expect(component.Sample['vnfc-type']).toBe('')
+ expect(component.refernceScopeObj.sourceType).toBe('')
+ expect(component.referenceDataObject['port-number']).toBe('')
+ })
+ it("prepare reference method at vnf level", () => {
+
+ component.referenceDataObject = {
+ action: 'Configure',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+ component.prepareReferenceObject();
+ expect(component.referenceDataObject['action-level']).toBe("vnf")
+ })
+
+ it("prepare reference method at vnf level", () => {
+
+ component.referenceDataObject = {
+ action: 'Configure',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '123',
+ 'vnfc-type': '346'
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+
+ component.prepareReferenceObject();
+ expect(component.referenceDataObject['action-level']).toBe("vnfc")
+ })
+
+ it("prepare reference method at vnf and vnfc level", () => {
+
+ component.referenceDataObject = {
+ action: 'starttApplication',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '123',
+ 'vnfc-type': '346'
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': 'ANSIBLE',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+ component.prepareReferenceObject();
+
+ expect(component.referenceDataObject['action-level']).toBe("vnf")
+ })
+ //deviceprotocols netconf
+ it("prepare reference method testing with netconf", () => {
+
+ component.referenceDataObject = {
+ action: 'starttApplication',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '123',
+ 'vnfc-type': '346'
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': 'NETCONF-XML',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+
+ component.prepareReferenceObject();
+ expect(component.referenceDataObject['action-level']).toBe("vnf")
+ })
+ //template id list
+ it("prepare reference method at template id list", () => {
+
+ component.referenceDataObject = {
+ action: 'ConfigScaleOut',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '123',
+ 'vnfc-type': '346'
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': 'NETCONF-XML',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+
+ }
+
+ component.referenceDataObject['template-id-list'] = ['id1', 'id2']
+
+ component.prepareReferenceObject();
+
+ expect(component.referenceDataObject['action-level']).toBe("vnf")
+ })
+ it("prepare reference method at vnfc level", () => {
+
+ component.referenceDataObject = {
+ action: 'startApplication',
+ 'action-level': 'vnfc',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+ component.prepareReferenceObject();
+ expect(component.referenceDataObject['action-level']).toBe("vnf")
+ })
+ it("prepare reference method at vnf level", () => {
+
+ component.referenceDataObject = {
+ action: 'ConfigScaleOut',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+ component.prepareReferenceObject();
+ expect(component.referenceDataObject['action-level']).toBe("vnf")
+ })
it('should create reference component', () => {
+
expect(component).toBeTruthy();
});
+ it('configscaleout test', () => {
+ service.latestAction = {
+ action: 'ConfigScaleOut',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+ service.referenceNameObjects = [
+ {
+ action: "Configure"
+ }, {
+ action: "StartApplication"
+ }
+ ]
+ component.ngOnInit()
+ expect(component.referenceDataObject.action).toBe("ConfigScaleOut");
+
+ });
+
+ it('shoud add vms with template id when the acti0on is configscaleout ', () => {
+ component.referenceDataObject = {
+ action: 'ConfigScaleOut',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [
+ {
+ vnfc: [
+ {
+ test: "123"
+ }
+ ]
+
+ }
+ ],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+
+ component.refernceScopeObj.from = "3"
+ // let arr = [1, 2];
+ component.addVms()
+ expect(component.referenceDataObject.vm.length).toBe(4);
+ });
+ it('shoud add vms with template id when the action is not configscaleout', () => {
+ component.referenceDataObject = {
+ action: 'Config',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [
+ {
+ vnfc: [
+ {
+ test: "123"
+ }
+ ]
+
+ }
+ ],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+
+ component.refernceScopeObj.from = "3"
+ // let arr = [1, 2];
+ component.addVms()
+ expect(component.referenceDataObject.vm[0]['template-id']).toBe(undefined);
+ });
+
+ it('testing ngdestroy', () => {
+ this.uploadFileName = 'testing'
+ component.ngOnDestroy()
+ expect(component.uploadedDataArray.length).toBe(0);
+ expect(component.uploadFileName).toBe('');
+ });
+ it('should validate numbers', () => {
+
+ component.numberValidation(1)
+ expect(component.numberOfVmTest).toBe(true);
+
+ });
+
+ it('should validate numbers if input is string', () => {
+
+ component.numberValidation('test')
+ expect(component.numberOfVmTest).toBe(false);
+
+ });
+
+ it('testing check if elements exixts in an array', () => {
+
+ let x = component.checkIfelementExistsInArray(2, [1, 2, 3])
+ expect(x).toBeTruthy();
+ });
+
+ it('should set action in session if type is action', () => {
+
+ component.updateSessionValues("test event for action", "action")
+
+ expect(sessionStorage.getItem('action')).toBe('test event for action');
+ });
+ it('should set action in session if type is vnfType', () => {
+
+ component.updateSessionValues("test event for vnfType", "vnfType")
+
+ expect(sessionStorage.getItem('vnfType')).toBe('test event for vnfType');
+ });
+
+ it('should add vnfs on to reference Object ', () => {
+
+ component.referenceDataObject = {
+ action: '',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [
+ {
+ vnfc: [
+ {
+ test: "123"
+ }
+ ]
+
+ }
+ ],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ };
+
+ component.addVnfcData(0)
+
+ expect(component.referenceDataObject.vm[0].vnfc.length).toBe(2);
+ });
+
+ it("should remove feature from the reference object ", () => {
+ component.referenceDataObject = {
+ action: '',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [
+ {
+ vnfc: [
+ {
+ test: "123"
+ }
+ ]
+
+ }, {
+ vnfc: [
+ {
+ test: "123"
+ }
+ ]
+
+ }
+ ],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ };
+
+ component.removeFeature(0, 0)
+
+ expect(component.referenceDataObject.vm.length).toBe(1)
+ })
+
+ it("should add capabilities", () => {
+ component.uploadedDataArray = [
+ ['y', 'n']
+ ]
+ component.addVmCapabilitiesData()
+
+ expect(component.tempAllData.length).toBe(3)
+ })
+ it("should add capabilities", () => {
+ service.latestAction = {
+ action: 'OpenStack Actions',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+ service.referenceNameObjects = [
+ {
+ action: "Configure"
+ }, {
+ action: "StartApplication"
+ }
+ ]
+
+ component.prepareReferenceObject();
+
+ expect(component.referenceDataObject['action-level']).toBe("vnf")
+ })
+
+ it("should add capabilities", () => {
+ service.latestAction = {
+ action: 'OpenStack Actions',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+
+ component.referenceDataObject.action="OpenStack Actions"
+ service.referenceNameObjects = [
+ {
+ action: "Configure"
+ }, {
+ action: "StartApplication"
+ }
+ ]
+
+ component.prepareReferenceObject();
+
+ expect(component.referenceDataObject['action-level']).toBe("vnf")
+ })
+
+ it("should switch vms if action is configscaleout", () => {
+
+ component.currentAction = "ConfigScaleOut"
+ service.latestAction = {
+ action: 'OpenStack Actions',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+ service.referenceNameObjects = [
+ {
+ action: "Configure"
+ }, {
+ action: "StartApplication"
+ }
+ ]
+
+ component.tempAllData = [
+ {
+ action: "ConfigScaleOut",
+ vm: [{}, {}]
+ }
+ ]
+
+ component.prepareReferenceObject();
+
+ expect(component.referenceDataObject.vm.length).toBe(2)
+ })
+ it("should switch vms if action is configscaleout", () => {
+
+ component.currentAction = "ConfigScaleOut"
+ service.latestAction = {
+ action: 'OpenStack Actions',
+ 'action-level': 'vnf',
+ scope: {
+ 'vnf-type': '',
+ 'vnfc-type': ''
+ },
+ 'template': 'Y',
+ vm: [],
+ 'device-protocol': '',
+ 'user-name': '',
+ 'port-number': '',
+ 'artifact-list': []
+ }
+ service.referenceNameObjects = [
+ {
+ action: "Configure"
+ }, {
+ action: "StartApplication"
+ }
+ ]
+
+ component.tempAllData = [
+ {
+ action: "startAplicaton"
+ }
+ ]
+
+ component.prepareReferenceObject();
+
+ expect(component.referenceDataObject.vm.length).toBe(0)
+ })
+ it('shoud show template identifier when action is config scaleout', () => {
+ let data = 'ConfigScaleOut'
+ component.toggleIdentifier(data)
+ expect(component.isConfigScaleOut).toBe(true);
+ });
+ it('shoud show template identifier when action is config scaleout', () => {
+ let data = 'startApplication'
+ component.toggleIdentifier(data)
+ expect(component.isConfigScaleOut).toBe(false);
+ });
+
+ it('Should call get artifact', () => {
+
+ service.referenceNameObjects = undefined
+ component.ngOnInit()
+ expect(component.tempAllData.length).toBe(2)
+ })
+
+ it('Should call get artifact', () => {
+ sessionStorage.setItem('updateParams', JSON.stringify({vnf: 123, userID: 'testUser'}))
+ component.getArtifact()
+ expect(component.tempAllData.length).toBe(2)
+ })
+
+ it('Save file - should not process if action is null ', () => {
+ component.referenceDataObject.action =""
+ let fileSaved = component.save({},true)
+ expect(fileSaved).toBe(undefined)
+ })
+ it('Save file - should not process if device protocol is null ', () => {
+ component.referenceDataObject['device-protocol'] =""
+ let fileSaved = component.save({},true)
+ expect(fileSaved).toBe(undefined)
+ })
+ it('Save file - should not process if device protocol is null ', () => {
+ component.referenceDataObject.action ="Configure"
+ component.referenceDataObject['device-protocol'] ="test"
+ let fileSaved = component.save({},true)
+ //expect(fileSaved).toBe(undefined)
+ })
+
+ it('Save to appc file - should not process if action is null ', () => {
+ component.referenceDataObject.action =""
+ let fileSaved = component.saveToAppc(true,{})
+ expect(fileSaved).toBe(undefined)
+ })
+ it('Save to app cfile - should not process if device protocol is null ', () => {
+ component.referenceDataObject['device-protocol'] =""
+ let fileSaved = component.saveToAppc(true,{})
+ expect(fileSaved).toBe(undefined)
+ })
+ it('Save to appc file - should not process if device protocol is null ', () => {
+ component.referenceDataObject.action ="Configure"
+ component.referenceDataObject['device-protocol'] ="test"
+ let fileSaved = component.saveToAppc(true,{})
+ //expect(fileSaved).toBe(undefined)
+ })
+
+ // it('uploadfile ', () => {
+
+ // let files = { 0: {name:'foo.XLS', size: 500001} };
+ // var mockEVet = {
+ // target:{files:files}
+ // }
+ // component.upload(mockEVet)
+ // //expect(fileSaved).toBe(undefined)
+ // })
+
+ it('downloadTemplate() of reference dataform',()=>{
+ component.downloadTemplate()
+
+ })
+ it('downloadNameValue() of reference dataform',()=>{
+ component.downloadNameValue()
+ })
+
+ it('downloadPd() of reference dataform',()=>{
+ component.downloadPd()
+ })
+ it('validateTempAllData() of reference dataform',()=>{
+ component.validateTempAllData()
+ })
+ it('retriveFromAppc() of reference dataform',()=>{
+ sessionStorage.setItem('updateParams', JSON.stringify({vnf: 123, userID: 'testUser'}))
+ component.retriveFromAppc()
+ expect(component.noCacheData).toBeFalsy()
+ })
+ it('retriveFromAppc() of reference dataform for false',()=>{
+
+ component.retriveFromAppc()
+ expect(component.noCacheData).toBeFalsy()
+ })
+ it(' cloneMessage(servermessage) of reference dataform',()=>{
+ let servermessage = {test:"test"}
+ component.cloneMessage(servermessage)
+ })
+
+ it('resetGroupNotation() of reference dataform for false case',()=>{
+ component.resetGroupNotation()
+ expect(component.disableGrpNotationValue).toBeFalsy()
+ })
+ it('resetGroupNotation() of reference dataform for true case',()=>{
+ component.Sample['group-notation-type'] == "existing-group-name"
+ component.resetGroupNotation()
+ expect(component.disableGrpNotationValue).toBeTruthy()
+ })
+ it('resetVms() of reference dataform',()=>{
+ component.resetVms()
+ expect(component.referenceDataObject.vm).toBe([])
+ })
+ it('dataModified() of reference dataform',()=>{
+ component.dataModified()
+ expect(component.referenceDataObject.vm).toBe(this.referenceDataObject.vm)
+ })
+
+ it('Clear cache ', () => {
+ component.clearCache()
+ expect(component.downloadData.reference['name']).toBe(undefined);
+ //expect(fileSaved).toBe(undefined)
+ })
+
+ it('sholud reset group notification ', () => {
+ component.Sample['group-notation-type'] = "existing-group-name"
+ component.resetGroupNotation()
+ expect(component.disableGrpNotationValue).toBe(true);
+ //expect(fileSaved).toBe(undefined)
+ })
+ it('sholud reset group notification if value does not match ', () => {
+ component.Sample['group-notation-type'] = "123"
+ component.resetGroupNotation()
+ expect(component.disableGrpNotationValue).toBe(false);
+ //expect(fileSaved).toBe(undefined)
+ })
+ it('add identity group', () => {
+ component.referenceDataObject['template-id-list'] = undefined
+ component.templateId="test"
+ component.addToIdentDrp()
+ expect(component.referenceDataObject['template-id-list'].length).toBe(1);
+ //expect(fileSaved).toBe(undefined)
+ })
+
+ it('add identity group', () => {
+
+ component.resetVms()
+ expect(component.referenceDataObject.vm.length).toBe(0);
+ //expect(fileSaved).toBe(undefined)
+ })
+ it('data modified', () => {
+
+ component.dataModified()
+
+ component.referenceDataObject.vm =[1,2]
+ expect(component.referenceDataObject.vm.length).toBe(2);
+ //expect(fileSaved).toBe(undefined)
+ })
+
+ it("should set values on action change ConfigScaleOut",()=>{
+ component.actionChange("ConfigScaleOut","",{})
+
+ expect(component.groupAnotationType.length).toBe(5)
+ })
+
+ it("should set values on action change when action is HealthCheck ",()=>{
+ component.populateExistinAction("HealthCheck")
+
+ expect(component.deviceProtocols.length).toBe(4)
+
+
+ })
+ it("should set values on action change when action is UpgradeBackout",()=>{
+ component.populateExistinAction("UpgradeBackout")
+
+ expect(component.deviceProtocols.length).toBe(3)
+
+
+ })
+ it("should set values on action change when action is OpenStack Actions",()=>{
+ component.populateExistinAction("OpenStack Actions")
+
+ expect(component.deviceProtocols.length).toBe(2)
+
+
+ })
+ it("should set values on action change when action is Configure",()=>{
+
+ component.tempAllData=[{action:"Configure",scope:{'vnf-type':"testVnf"}}]
+ component.populateExistinAction("Configure")
+
+ expect(component.referenceDataObject.scope['vnf-type']).toBe('testVnf')
+
+
+ })
});
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 c66a003..2e5d39e 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
@@ -61,6 +61,7 @@ export class ReferenceDataformComponent implements OnInit {
numberTest: RegExp = /^[^.a-z]+$/;
public numberOfVmTest: boolean = true;
public tempAllData = [];
+ disableGrpNotationValue: boolean;
public noRefData = false;
public disableRetrieve = false;
public getRefStatus = false;
@@ -152,8 +153,9 @@ export class ReferenceDataformComponent implements OnInit {
public vnfParams: any;
public firstArrayElement = [];
public remUploadedDataArray = [];
+ isConfigScaleOut = false
- constructor (private buildDesignComponent: BuildDesignComponent, private httpUtils: HttpUtilService, private route: Router, private location: Location, private activeRoutes: ActivatedRoute, private notificationService: NotificationService,
+ 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) {
}
@@ -176,8 +178,11 @@ export class ReferenceDataformComponent implements OnInit {
let cacheData = this.mappingEditorService.referenceNameObjects;
if (cacheData != undefined && cacheData != null && cacheData.length > 0) {
this.tempAllData = cacheData;
+ // console.log("latest action")
+ // console.log(this.mappingEditorService.latestAction)
if (this.mappingEditorService.latestAction != undefined) {
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
@@ -206,6 +211,14 @@ export class ReferenceDataformComponent implements OnInit {
this.templateIdentifier = this.mappingEditorService.identifier
//this.tempAllData = [];
}
+ toggleIdentifier(data) {
+ if (data == 'ConfigScaleOut') {
+ this.isConfigScaleOut = true
+
+ } else {
+ this.isConfigScaleOut = false
+ }
+ }
//to retrive the data from appc and assign it to the vaiables, if no data display the message reterived from the API
getArtifact() {
@@ -232,7 +245,7 @@ export class ReferenceDataformComponent implements OnInit {
let artifactInfo = JSON.parse(resp.output.data.block).artifactInfo[0];
let reference_data = JSON.parse(artifactInfo['artifact-content'])['reference_data'][0];
this.referenceDataObject = reference_data;
- console.log('reference data obj==' + JSON.stringify(this.referenceDataObject));
+ // console.log('reference data obj==' + JSON.stringify(this.referenceDataObject));
this.refernceScopeObj.sourceType = this.referenceDataObject['scopeType'];
this.mappingEditorService.getReferenceList().push(JSON.parse(artifactInfo['artifact-content']));
this.tempAllData = JSON.parse(artifactInfo['artifact-content'])['reference_data'];
@@ -263,7 +276,7 @@ export class ReferenceDataformComponent implements OnInit {
}*/
];
}
- console.log('tempalldata===' + JSON.stringify(this.tempAllData));
+ // console.log('tempalldata===' + JSON.stringify(this.tempAllData));
} else {
this.nService.success('Status', 'Sorry !!! I dont have any artifact Named : ' + (JSON.parse(payload))['artifact-name']);
}
@@ -288,11 +301,11 @@ export class ReferenceDataformComponent implements OnInit {
this.firstArrayElement = [];
this.uploadFileName = '';
// this.tempAllData = [];
- console.log('temp all data===' + JSON.stringify(this.tempAllData));
+ // console.log('temp all data===' + JSON.stringify(this.tempAllData));
}
numberValidation(event: any) {
- // console.log(this.numberTest.test(event));
+ // // console.log(this.numberTest.test(event));
if (this.numberTest.test(event) && event != 0) {
this.numberOfVmTest = true;
}
@@ -310,79 +323,7 @@ export class ReferenceDataformComponent implements OnInit {
}
}
- checkConfigure(data) {
- if (data == null) {
- return;
- }
- if (this.fileUploaded && this.actionType == 'update') {
- let refObject = this.uploadedData.find(obj => {
- return obj.action == data;
- });
- this.referenceDataObject = JSON.parse(JSON.stringify(refObject));
- if (data == 'HealthCheck') {
- //show additional fileds user name port number and others
- this.actionHealthCheck = true;
- } else {
- this.actionHealthCheck = false;
- if (data == 'StartApplication' || data == 'StopApplication') {
- this.disableVnftype = true;
- } else {
-
- this.otherActions = true;
- }
- }
- return;
- }
- this.buildDesignComponent.updateAccessUpdatePages(data, this.mappingEditorService.getReferenceList());
- let configureObject = _.find(this.tempAllData, function (obj) {
- return obj['action'] == 'Configure';
- });
- if (data != 'Configure') {
- if (!configureObject) {
- this.allowAction = false;
- $('#messageModal').modal();
- } else {
- this.allowAction = true;
- }
- if (this.referenceDataObject.action == 'Configure') {
- this.allowAction = true;
- }
- }
- //dont allow any action second time
- let y = _.find(this.tempAllData, function (obj) {
- return obj['action'] == data;
- });
- if (y) {
- this.actionExist = true;
- $('#messageModal').modal();
- } else {
- this.actionExist = false;
- }
- //populate configure values for other actions
- if (data != 'Configure' && configureObject != undefined) {
- if (data == 'HealthCheck') {
- //show additional fileds user name port number and others
- this.actionHealthCheck = true;
- } else {
- this.actionHealthCheck = false;
- if (data == 'StartApplication' || data == 'StopApplication') {
- this.disableVnftype = true;
- } else {
- this.otherActions = true;
- }
- }
- this.referenceDataObject.scope['vnf-type'] = configureObject['scope']['vnf-type'];
- this.referenceDataObject.scope['vnfc-type'] = configureObject['scope']['vnfc-type'];
- this.referenceDataObject['device-protocol'] = configureObject['device-protocol'];
- this.refernceScopeObj['sourceType'] = configureObject['scopeType'];
- } else {
- this.actionHealthCheck = false;
- this.otherActions = false;
- this.disableVnftype = false;
- }
- //set default values for further actions
- }
-
+
addVnfcData(vmNumber: number) {
var newObj = {
'vnfc-instance': this.referenceDataObject.vm[vmNumber].vnfc.length + 1,
@@ -421,7 +362,7 @@ export class ReferenceDataformComponent implements OnInit {
//Reference object to create reference data
prepareReferenceObject() {
- // console.log("this temp all data before=="+ JSON.stringify(this.tempAllData))
+ // // console.log("this temp all data before=="+ JSON.stringify(this.tempAllData))
this.referenceDataObject['artifact-list'] = [];
let scopeName = '';
@@ -477,8 +418,6 @@ export class ReferenceDataformComponent implements OnInit {
} else {
let identifiers = this.referenceDataObject['template-id-list'];
if (identifiers) {
-
-
for (var x = 0; x < identifiers.length; x++) {
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;
@@ -510,10 +449,15 @@ export class ReferenceDataformComponent implements OnInit {
let action = this.referenceDataObject.action;
let configureObject = (newObj.action == 'Configure');
let ConfigScaleOut = (newObj.action == 'ConfigScaleOut');
- //delete VM's if selected action is configure.
+ //delete VM's if selected action is not configure.
if (!ConfigScaleOut && !configureObject && this.tempAllData.length != 0) {
// delete newObj.vm
- newObj.vm = [];
+
+ if (ConfigScaleOut) {
+ //
+ } else {
+ newObj.vm = [];
+ }
//this.tempAllData.push(newObj);
} else {
if (ConfigScaleOut) {
@@ -535,7 +479,7 @@ export class ReferenceDataformComponent implements OnInit {
return obj['action'] == action;
});
if (newObj.action != 'HealthCheck') {
- delete newObj['context-url'];
+ delete newObj['url'];
}
if (actionObjIndex > -1) {
this.tempAllData[actionObjIndex] = newObj;
@@ -548,6 +492,19 @@ export class ReferenceDataformComponent implements OnInit {
this.mappingEditorService.saveLatestIdentifier(this.templateIdentifier);
}
}
+ //reset currentform vms based on action
+ if (this.currentAction == "ConfigScaleOut") {
+ //this.referenceDataObject.vm = []
+
+ let ConfigScaleOutIndex = this.tempAllData.findIndex(obj => {
+ return obj['action'] == this.currentAction;
+ });
+ if (ConfigScaleOutIndex > -1) {
+ this.referenceDataObject.vm = this.tempAllData[ConfigScaleOutIndex].vm
+ } else {
+ this.referenceDataObject.vm = []
+ }
+ }
//Creating all action block to allow mulitple actions at once
let allAction = {
action: 'AllAction',
@@ -566,14 +523,14 @@ export class ReferenceDataformComponent implements OnInit {
} else {
this.tempAllData.push(allAction);
}
- console.log('This uploaded array===' + JSON.stringify(this.uploadedDataArray));
+ // console.log('This uploaded array===' + JSON.stringify(this.uploadedDataArray));
if (this.uploadedDataArray && this.uploadedDataArray != undefined && this.uploadedDataArray.length != 0) {
/*for (var i = 0; i < this.uploadedDataArray.length; i++) {
var actionData = this.uploadedDataArray[i][0];
- // console.log("Action data=="+ actionData);
+ // // console.log("Action data=="+ actionData);
for (var j = 0; j < this.tempAllData.length; j++) {
- //console.log("Actions from temp all data=="+ this.tempAllData[j].action)
- //console.log("Matched=="+ (actionData === this.tempAllData[j].action))
+ //// console.log("Actions from temp all data=="+ this.tempAllData[j].action)
+ //// console.log("Matched=="+ (actionData === this.tempAllData[j].action))
if (actionData === this.tempAllData[j].action) {
this.tempAllData.splice(j,1);
@@ -592,7 +549,7 @@ export class ReferenceDataformComponent implements OnInit {
result = this.checkIfelementExistsInArray(this.tempAllData[i].action, this.actions);
}
if (!result) {
- console.log('Removing VM action==' + this.tempAllData[i].action);
+ // console.log('Removing VM action==' + this.tempAllData[i].action);
this.tempAllData.splice(i, 1);
i = i - 1;
}
@@ -601,8 +558,8 @@ export class ReferenceDataformComponent implements OnInit {
}
this.addVmCapabilitiesData();
}
- // console.log("this temp all data after=="+ JSON.stringify(this.tempAllData))
- //console.log("temp all data from save to appc=="+JSON.stringify(this.tempAllData))
+ // // console.log("this temp all data after=="+ JSON.stringify(this.tempAllData))
+ //// console.log("temp all data from save to appc=="+JSON.stringify(this.tempAllData))
this.mappingEditorService.getReferenceList().push(JSON.parse(JSON.stringify(this.referenceDataObject)));
this.buildDesignComponent.updateAccessUpdatePages(this.referenceDataObject.action, this.mappingEditorService.getReferenceList());
this.mappingEditorService.changeNav(this.tempAllData);
@@ -610,13 +567,13 @@ export class ReferenceDataformComponent implements OnInit {
}
public checkIfelementExistsInArray(element, array) {
- //console.log("Element==" + element)
+ //// console.log("Element==" + element)
var result: boolean = false;
array.forEach(function (item) {
- // console.log("Item==" + item)
+ // // console.log("Item==" + item)
if (element === item) {
- console.log('Element==' + element + 'Item==' + item);
+ // console.log('Element==' + element + 'Item==' + item);
result = true;
}
}
@@ -625,15 +582,15 @@ export class ReferenceDataformComponent implements OnInit {
}
upload(evt: any) {
- /* console.log("This uploaded array==" + JSON.stringify(this.uploadedDataArray))
- // console.log("This template data before==" + JSON.stringify(this.tempAllData))
+ /* // console.log("This uploaded array==" + JSON.stringify(this.uploadedDataArray))
+ // // console.log("This template data before==" + JSON.stringify(this.tempAllData))
if (this.uploadedDataArray && this.uploadedDataArray != undefined && this.uploadedDataArray.length!=0) {
/* for (var i = 0; i < this.uploadedDataArray.length; i++) {
var action = this.uploadedDataArray[i][0];
for (var j = 0; j < this.tempAllData.length; j++) {
if (action === this.tempAllData[j].action) {
this.tempAllData.splice(j);
- console.log("This template data===" + this.tempAllData[j]);
+ // console.log("This template data===" + this.tempAllData[j]);
}
}
}
@@ -643,18 +600,18 @@ export class ReferenceDataformComponent implements OnInit {
var result = this.checkIfelementExistsInArray(this.tempAllData[i].action, this.actions);
if (this.tempAllData[i].action === "AllAction") result = true;
if (!result) {
- console.log("Removing VM action==" + this.tempAllData[i].action)
+ // console.log("Removing VM action==" + this.tempAllData[i].action)
this.tempAllData.splice(i, 1);
}
}
}
}
- // console.log("This template data after==" + JSON.stringify(this.tempAllData))
+ // // console.log("This template data after==" + JSON.stringify(this.tempAllData))
/* wire up file reader */
const target: DataTransfer = <DataTransfer>(evt.target);
- //console.log("filename========" + evt.target.files[0].name)
+ //// console.log("filename========" + evt.target.files[0].name)
this.uploadFileName = evt.target.files[0].name;
var fileExtension = this.uploadFileName.substr(this.uploadFileName.lastIndexOf('.') + 1);
if (target.files.length != 1) {
@@ -665,19 +622,19 @@ export class ReferenceDataformComponent implements OnInit {
reader.onload = (e: any) => {
/* read workbook */
const bstr = e.target.result;
- // console.log("print 1---" + bstr);
+ // // console.log("print 1---" + bstr);
const wb = XLSX.read(bstr, { type: 'binary' });
- // console.log("print 2---" + JSON.stringify(wb));
+ // // console.log("print 2---" + JSON.stringify(wb));
/* grab first sheet */
const wsname = wb.SheetNames[0];
- // console.log("Name:---" + wsname);
+ // // console.log("Name:---" + wsname);
const ws = wb.Sheets[wsname];
/* save data */
let arrData = (<AOA>(XLSX.utils.sheet_to_json(ws, { header: 1 })));
- //console.log("row======" + (XLSX.utils.sheet_to_json(ws, { header: 1 })).toString())
- // console.log("Array data---" + JSON.stringify(arrData));
+ //// console.log("row======" + (XLSX.utils.sheet_to_json(ws, { header: 1 })).toString())
+ // // console.log("Array data---" + JSON.stringify(arrData));
this.uploadedDataArray = arrData;
this.firstArrayElement = arrData[0];
var remUploadedDataArray = arrData;
@@ -693,7 +650,7 @@ export class ReferenceDataformComponent implements OnInit {
}
};
reader.readAsBinaryString(target.files[0]);
- console.log('TARGET files---' + JSON.stringify(evt.target));
+ // console.log('TARGET files---' + JSON.stringify(evt.target));
}
else {
this.nService.error('Error', 'Incorrect VM capabilities file uploaded');
@@ -705,10 +662,10 @@ export class ReferenceDataformComponent implements OnInit {
for (var i = 0; i < this.uploadedDataArray.length; i++) {
var vnfcFuncCodeArray = [];
var data = this.uploadedDataArray[i];
- // console.log("Data is "+ JSON.stringify(data))
- //console.log("Data length: "+ data.length)
+ // // console.log("Data is "+ JSON.stringify(data))
+ //// console.log("Data length: "+ data.length)
for (var j = 1; j < data.length; j++) {
- // console.log("Data " +j +" is "+ JSON.stringify(data[j]))
+ // // console.log("Data " +j +" is "+ JSON.stringify(data[j]))
if (data[j] != undefined) {
if (data[j].toUpperCase() === 'Y') {
vnfcFuncCodeArray.push(this.firstArrayElement[j]);
@@ -814,9 +771,9 @@ export class ReferenceDataformComponent implements OnInit {
if (valid) {
let referenceObject = this.prepareReferenceObject();
- console.log('##########');
+ // console.log('##########');
- console.log(referenceObject);
+ // console.log(referenceObject);
this.validateTempAllData();
let theJSON = JSON.stringify(this.tempAllData, null, '\t');
let fileName = 'reference_AllAction_' + referenceObject.scopeName + '_' + '0.0.1V.json';
@@ -1051,16 +1008,15 @@ export class ReferenceDataformComponent implements OnInit {
if (data == 'HealthCheck') {
this.deviceProtocols = ['', 'ANSIBLE', 'CHEF', 'REST'];
this.actionHealthCheck = true;
- } else if (data == 'UpgradeBackout' || data == 'ResumeTraffic' || data == 'QuiesceTraffic' || data == 'UpgradeBackup' || data == 'UpgradePostCheck' || data == 'UpgradePreCheck' || data == 'UpgradeSoftware' || data == 'ConfigBackup' || data == 'ConfigRestore' || data == 'StartApplication' || data == 'StopApplication') {
+ } else if (data == 'UpgradeBackout' || data == 'ResumeTraffic' || data == 'QuiesceTraffic' || data == 'UpgradeBackup' || data == 'UpgradePostCheck' || data == 'UpgradePreCheck' || data == 'UpgradeSoftware' || data == 'ConfigBackup' || data == 'ConfigRestore' || data == 'StartApplication' || data == 'StopApplication' || data == 'GetRunningConfig') {
this.deviceProtocols = ['', 'CHEF', 'ANSIBLE'];
} else if (data == 'OpenStack Actions') {
this.deviceProtocols = ['', 'OpenStack'];
- } else if (data == 'ConfigScaleOut' || data == 'Configure' || data == 'ConfigModify') {
+ } else if (data == 'ConfigScaleOut') {
this.deviceProtocols = ['', 'CHEF', 'ANSIBLE', 'NETCONF'];
- } else if (data == 'GetRunningConfig') {
- this.deviceProtocols = ['', 'NETCONF'];
- } else {
- this.deviceProtocols = ['', 'ANSIBLE', 'CHEF', 'NETCONF-XML', 'REST', 'RESTCONF', 'CLI'];
+ }
+ else {
+ this.deviceProtocols = ['', 'ANSIBLE', 'CHEF', 'NETCONF-XML', 'RESTCONF', 'CLI'];
this.actionHealthCheck = false;
}
}
@@ -1068,6 +1024,7 @@ export class ReferenceDataformComponent implements OnInit {
//Modal pop up for action change with values entered.
actionChange(data, content, userForm) {
// this.actionChanged = true;
+ this.disableGrpNotationValue = false
if (data == null) {
return;
}
@@ -1078,7 +1035,11 @@ export class ReferenceDataformComponent implements OnInit {
this.currentAction = this.referenceDataObject.action;
this.referenceDataObject.action = this.oldAction;
$('#saveToAppc').click();//make sure the save all is done before the tempall obj is saved form the API
- this.oldAction = this.referenceDataObject.action + '';
+ 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 = [];
@@ -1089,6 +1050,8 @@ export class ReferenceDataformComponent implements OnInit {
}
this.clearCache();
} else {
+ this.toggleIdentifier(data)
+ this.currentAction = this.referenceDataObject.action;
this.populateExistinAction(data);
this.oldAction = this.referenceDataObject.action + '';
this.clearCache();
@@ -1100,6 +1063,12 @@ export class ReferenceDataformComponent implements OnInit {
}
+ if (data == 'ConfigScaleOut') {
+ this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value', 'existing-group-name'];
+ }
+
+ this.toggleIdentifier(data)
+
if (data == 'OpenStack Actions') {
this.buildDesignComponent.tabs = [
{
@@ -1150,7 +1119,7 @@ export class ReferenceDataformComponent implements OnInit {
this
.httpUtils
.post(
- { url: environment.getDesigns, data: this.appData.template.templateData })
+ { 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');
@@ -1160,16 +1129,16 @@ export class ReferenceDataformComponent implements OnInit {
}
},
- (err) => this.nService.error('Status', 'Error Connecting to the APPC Network'));
+ (err) => this.nService.error('Status', 'Error Connecting to the APPC Network'));
}
saveNameValue() {
this
.httpUtils
.post(
- {
- url: environment.getDesigns, data: this.appData.template.nameValueData
- })
+ {
+ 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');
@@ -1178,19 +1147,19 @@ export class ReferenceDataformComponent implements OnInit {
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;
- });
+ error => {
+ this.nService.error('Status', 'Error Connecting to the APPC Network');
+ return false;
+ });
}
savePd() {
this
.httpUtils
.post(
- {
- url: environment.getDesigns, data: this.appData.pd
- })
+ {
+ 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');
@@ -1199,10 +1168,10 @@ export class ReferenceDataformComponent implements OnInit {
this.nService.warn('Status', 'Error in saving the PD to Appc');
}
},
- error => {
- this.nService.error('Status', 'Error Connecting to the APPC Network');
- return false;
- });
+ error => {
+ this.nService.error('Status', 'Error Connecting to the APPC Network');
+ return false;
+ });
}
openModel(toShow: any, message: any, title: any) {
@@ -1227,7 +1196,10 @@ export class ReferenceDataformComponent implements OnInit {
if (!(this.referenceDataObject['template-id-list'])) {
this.referenceDataObject['template-id-list'] = [];
}
- this.referenceDataObject['template-id-list'].push(this.templateId);
+ if(!(this.referenceDataObject['template-id-list'].indexOf(this.templateId.trim())>-1)){
+ this.referenceDataObject['template-id-list'].push(this.templateId.trim());
+ }
+
// this.referenceDataObject['template-id-list'] = this.identifierDrpValues
//this.identifierDrp = ""
}
@@ -1239,4 +1211,14 @@ export class ReferenceDataformComponent implements OnInit {
dataModified() {
this.referenceDataObject.vm = this.referenceDataObject.vm;
}
+
+ resetGroupNotation() {
+ if (this.Sample['group-notation-type'] == "existing-group-name") {
+ this.Sample['group-notation-value'] = ""
+
+ this.disableGrpNotationValue = true
+ } else {
+ this.disableGrpNotationValue = false
+ }
+ }
} \ No newline at end of file