diff options
author | Liu <yongqiang.liu@nokia-sbell.com> | 2020-01-27 10:59:12 +0800 |
---|---|---|
committer | Taka Cho <takamune.cho@att.com> | 2020-02-05 09:48:24 -0500 |
commit | 700ac8a7ec822f1b7a0505319e4c453ca045d2ed (patch) | |
tree | 628c687faf129b6c3f87fe1e6b9b5c11fc2417ac /src/app/vnfs/build-artifacts | |
parent | 773f970c50772cddf75f7c7918935315e55d4e2d (diff) |
add new action configscalein for cdt
Change-Id: I2f05079b7c2428351332ac84c1ea56f31d4a38d9
Issue-ID: APPC-1760
Signed-off-by: Taka Cho <takamune.cho@att.com>
Diffstat (limited to 'src/app/vnfs/build-artifacts')
8 files changed, 261 insertions, 35 deletions
diff --git a/src/app/vnfs/build-artifacts/build-artifacts.component.ts b/src/app/vnfs/build-artifacts/build-artifacts.component.ts index 4e00341..4ae123b 100644 --- a/src/app/vnfs/build-artifacts/build-artifacts.component.ts +++ b/src/app/vnfs/build-artifacts/build-artifacts.component.ts @@ -28,7 +28,7 @@ import * as _ from 'underscore'; import { NotificationsService } from 'angular2-notifications'; import { appConstants } from '../../../constants/app-constants'; -export const ACTIONS_REQUIRED_DROPDOWN = ['Configure', 'ConfigModify', 'ConfigScaleOut', 'DistributeTraffic', 'DistributeTrafficCheck'] +export const ACTIONS_REQUIRED_DROPDOWN = ['Configure', 'ConfigModify', 'ConfigScaleOut', 'DistributeTraffic', 'DistributeTrafficCheck', 'ConfigScaleIn'] @Component({ selector: 'app-build-design', templateUrl: './build-artifacts.component.html', styleUrls: ['./build-artifacts.component.css'] }) @@ -80,7 +80,7 @@ export class BuildDesignComponent implements OnInit { // if (referenceList.hasOwnProperty('template-id') && referenceList['template-id'] !== undefined && referenceList['template-id'] != '') // this.refDataRequiredFiels = true; // else this.refDataRequiredFiels = false; - if(referenceList.action == 'ConfigScaleOut') { + if(referenceList.action == 'ConfigScaleOut' || referenceList.action == 'ConfigScaleIn') { if(reqObj != undefined && reqObj.hasOwnProperty('reqField') && reqObj.reqField != '') this.refDataRequiredFiels = true; else this.refDataRequiredFiels = false; } @@ -112,7 +112,7 @@ export class BuildDesignComponent implements OnInit { else if (this.refList['device-protocol'] == appConstants.DeviceProtocols.blank) { this.notificationsService.error(appConstants.errors.error, appConstants.errors.noDeviceProtocolError); } - else if (this.refList.action === appConstants.Actions.configScaleOut) { + else if (this.refList.action === appConstants.Actions.configScaleOut || this.refList.action === appConstants.Actions.configScaleIn) { this.notificationsService.error(appConstants.errors.error, appConstants.errors.noValidTemplateIdentifierError); } } diff --git a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.html b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.html index 9cddc8e..2ff2b9b 100644 --- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.html +++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.html @@ -49,7 +49,7 @@ limitations under the License. <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12"> <label>Protocol</label><input class="form-control" type="text" disabled value="{{protocol}}" /> </div> - <div *ngIf="(action === 'ConfigScaleOut')" class="col-lg-3 col-sm-6 col-md-3 col-xs-12"> + <div *ngIf="(action === 'ConfigScaleOut' || action === 'ConfigScaleIn')" class="col-lg-3 col-sm-6 col-md-3 col-xs-12"> <label>Template Identifier</label><input class="form-control" type="text" disabled value="{{template_id}}" /> </div> </div> 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 ad0adf3..64f1159 100644 --- a/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts +++ b/src/app/vnfs/build-artifacts/parameter-definitions/parameter.component.ts @@ -142,7 +142,7 @@ export class ParameterComponent implements OnInit { console.log( this.clName+": "+methName+": have vnfcType:["+ this.vnfcType+"]"); } - if( this.action === 'ConfigScaleOut'){ + if( this.action === 'ConfigScaleOut' || this.action === 'ConfigScaleIn'){ // this.template_id = this.selectedActionReference.templateId; this.template_id = this.mappingEditorService.identifier; } 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 bf1589b..300a598 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 @@ -67,7 +67,7 @@ limitations under the License. </select> </div> - <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="isConfigScaleOut"> + <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="(isConfigScaleOut || isConfigScaleIn)"> <label>Template Identifier</label> <select class="form-control" required id="tempIdentifier" (ngModelChange)="dataModified();idChange($event,userForm)" [(ngModel)]="templateIdentifier" #deviceProtocol="ngModel" name="templateIdentifier"> <option [value]="val" *ngFor="let val of referenceDataObject['template-id-list']">{{val}} @@ -76,8 +76,8 @@ limitations under the License. <!-- <span class="error-message" [hidden]="deviceProtocol.valid || (deviceProtocol.pristine && !userForm.submitted)">Required Field</span> --> </div> - <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="referenceDataObject['action']== 'ConfigScaleOut'" style="margin-top: 30px"> - <span *ngIf="referenceDataObject.action === 'ConfigScaleOut'"> <a style=" color: blue;" + <div class="col-lg-3 col-sm-6 col-md-3 col-xs-12" *ngIf="(referenceDataObject['action']== 'ConfigScaleOut' || referenceDataObject['action']== 'ConfigScaleIn')" style="margin-top: 30px"> + <span *ngIf="(referenceDataObject.action === 'ConfigScaleOut' || referenceDataObject.action === 'ConfigScaleIn')"> <a style=" color: blue;" href="javascript:void(0)" (click)="identifierModal.open()">Assign New Template Identifier</a></span> @@ -142,7 +142,7 @@ limitations under the License. </div> </div> <br/> - <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 =='ConfigScaleIn' || 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"> @@ -153,7 +153,7 @@ limitations under the License. </h5> </div> </div> - <div class="row" *ngIf="(( referenceDataObject.action =='ConfigScaleOut' ||referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined ) && isCollapsedContent) "> + <div class="row" *ngIf="(( referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='ConfigScaleIn' ||referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined ) && isCollapsedContent) "> <div class="col-lg-2 col-sm-6 col-md-2 col-xs-12"> <label style="font-size:12px;">VNFC Type (NFC Function)</label> <input type="text" class="form-control" id="txtVnfcTypeInColl" [(ngModel)]="Sample['vnfc-type']" (blur)="checkVnfcTypeEqual(vnfcType.value)" #vnfcType="ngModel" name="samplevnfcType"> @@ -185,7 +185,7 @@ limitations under the License. </div> </div> <hr> - <div *ngIf="(referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' )" class="row"> + <div *ngIf="(referenceDataObject.action =='ConfigScaleOut' || referenceDataObject.action =='ConfigScaleIn' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' )" class="row"> <div class="col-lg-2 col-md-2 hdden-sm-down"> <label style="margin-top: 17px;" class="headlinesInBold"> Number Of VM(s): </label> @@ -204,7 +204,7 @@ limitations under the License. </div> <div *ngIf="referenceDataObject.vm?.length>0"> <div class="row" *ngFor="let noOfvm of referenceDataObject.vm | vmFiltering:referenceDataObject?.action:templateIdentifier:vnfcIdentifier; trackBy:trackByFn;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 =='ConfigScaleIn' || referenceDataObject.action =='Configure'|| referenceDataObject.action =='' || referenceDataObject.action ==undefined ))" class="col-12"> <div class="row" *ngFor="let item of noOfvm.vnfc;trackBy:trackByFn, let i=index"> <div class="col-md-12" *ngIf="i==0"> <h5 class="headlinesInBold">VM Number: {{j+1}}</h5> 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 8e3dc1b..15b3f99 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 @@ -372,8 +372,33 @@ describe('ReferenceDataformComponent', () => { expect(component.referenceDataObject.action).toBe("ConfigScaleOut"); }); + it('configscalein test', () => { + service.latestAction = { + action: 'ConfigScaleIn', + '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("ConfigScaleIn"); - it('shoud add vms with template id when the acti0on is configscaleout ', () => { + }); + it('shoud add vms with template id when the action is configscaleout ', () => { component.referenceDataObject = { action: 'ConfigScaleOut', 'action-level': 'vnf', @@ -403,7 +428,37 @@ describe('ReferenceDataformComponent', () => { component.addVms() expect(component.referenceDataObject.vm.length).toBe(4); }); - it('shoud add vms with template id when the action is not configscaleout', () => { + it('shoud add vms with template id when the action is configscalein ', () => { + component.referenceDataObject = { + action: 'ConfigScaleIn', + 'action-level': 'vnf', + scope: { + 'vnf-type': '', + 'vnfc-type-list': ['346'] + }, + '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 or configscalein', () => { component.referenceDataObject = { action: 'Config', 'action-level': 'vnf', @@ -591,6 +646,56 @@ describe('ReferenceDataformComponent', () => { }) + it("remove templateIds vm if action is configscalein", () => { + component.referenceDataObject = { + action: 'ConfigScaleIn', + 'action-level': 'vnf', + scope: { + 'vnf-type': '', + 'vnfc-type-list': ['346'] + }, + 'template': 'Y', + "vm": [ + { + "template-id": "klmklj", + "vm-instance": 1, + "vnfc": [ + { + "vnfc-instance": "1", + "vnfc-function-code": "klkl", + "ipaddress-v4-oam-vip": "", + "group-notation-type": "", + "group-notation-value": "", + "vnfc-type": "nnk" + } + ] + }, { + "template-id": "test 12", + "vm-instance": 2, + "vnfc": [ + { + "vnfc-instance": "1", + "vnfc-function-code": "klkl", + "ipaddress-v4-oam-vip": "", + "group-notation-type": "", + "group-notation-value": "", + "vnfc-type": "nnk" + } + ] + } + ], + 'device-protocol': '', + 'user-name': '', + 'port-number': '', + 'artifact-list': [] + }; + + component.removeFeature(0, 0, 'test 12') + + //expect(component.referenceDataObject.vm.length).toBe(2) + + }) + it("should add capabilities", () => { component.uploadedDataArray = [ ['y', 'n'] @@ -693,6 +798,42 @@ describe('ReferenceDataformComponent', () => { expect(component.referenceDataObject.vm.length).toBe(2) }) + it("should switch vms if action is configscalein", () => { + + component.currentAction = "ConfigScaleIn" + 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: "ConfigScaleIn", + vm: [{}, {}] + } + ] + + component.prepareReferenceObject(); + + expect(component.referenceDataObject.vm.length).toBe(2) + }) it("should switch vms if action is configscaleout", () => { component.currentAction = "ConfigScaleOut" @@ -728,16 +869,61 @@ describe('ReferenceDataformComponent', () => { expect(component.referenceDataObject.vm.length).toBe(0) }) + it("should switch vms if action is configscalein", () => { + + component.currentAction = "ConfigScaleIn" + 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', () => { + it('shoud show template identifier when action is configscalein', () => { + let data = 'ConfigScaleIn' + component.toggleIdentifier(data) + expect(component.isConfigScaleIn).toBe(true); + }); + it('shoud show template identifier when action is not configscaleout', () => { let data = 'startApplication' component.toggleIdentifier(data) expect(component.isConfigScaleOut).toBe(false); }); + it('shoud show template identifier when action is not configscalein', () => { + let data = 'startApplication' + component.toggleIdentifier(data) + expect(component.isConfigScaleIn).toBe(false); + }); it('Should call get artifact', () => { @@ -1136,4 +1322,4 @@ describe('ReferenceDataformComponent', () => { // afterEach(function() { // jasmine.DEFAULT_TIMEOUT_INTERVAL = originalTimeout; // }); -});
\ No newline at end of file +}); 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 6223282..10a22fc 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 @@ -133,6 +133,7 @@ export class ReferenceDataformComponent implements OnInit { , 'ConfigModify' , 'ConfigRestore' , 'ConfigScaleOut' + , 'ConfigScaleIn' , 'Configure' , 'DistributeTraffic' , 'DistributeTrafficCheck' @@ -206,6 +207,7 @@ export class ReferenceDataformComponent implements OnInit { public firstArrayElement = []; public remUploadedDataArray = []; isConfigScaleOut = false + isConfigScaleIn = false isConfigOrConfigModify = false displayVnfc = 'false'; isVnfcType: boolean; @@ -371,6 +373,12 @@ export class ReferenceDataformComponent implements OnInit { } else { this.isConfigScaleOut = false } + + if (data == 'ConfigScaleIn') { + this.isConfigScaleIn = true; + } else { + this.isConfigScaleIn = false; + } } //to retrive the data from appc and assign it to the vaiables, if no data display the message reterived from the API @@ -396,6 +404,9 @@ export class ReferenceDataformComponent implements OnInit { if (this.referenceDataObject.action == 'ConfigScaleOut') { this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value', 'existing-group-name']; } + if (this.referenceDataObject.action == 'ConfigScaleIn') { + this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value', 'existing-group-name']; + } this.highlightSelectedActions(referenceDataAll) //chck vnfc or vnfcTypeList @@ -598,21 +609,21 @@ export class ReferenceDataformComponent implements OnInit { let key if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') { key = "vnfcType-id" - } else if (this.referenceDataObject.action == 'ConfigScaleOut') { + } else if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn') { key = "template-id" } - if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') { + if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn' || this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') { let existingVmsLength = this.referenceDataObject.vm.map(obj => { if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') { return obj["vnfcType-id"] == this.templateIdentifier - } else if (this.referenceDataObject.action == 'ConfigScaleOut') { + } else if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn') { return obj["template-id"] == this.templateIdentifier } }).length; //mberOFVm = existingVmsLength + mberOFVm; let index = 0; let identifierValue - if (this.referenceDataObject.action == 'ConfigScaleOut') { + if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn') { identifierValue = this.templateIdentifier } else if (this.referenceDataObject.action == 'Configure' || this.referenceDataObject.action == 'ConfigModify' || this.referenceDataObject.action == 'DistributeTraffic' || this.referenceDataObject.action == 'DistributeTrafficCheck') { identifierValue = this.vnfcIdentifier @@ -627,7 +638,7 @@ export class ReferenceDataformComponent implements OnInit { this.referenceDataObject.vm.push({ 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] }); } - } else if (this.referenceDataObject.action == 'ConfigScaleOut') { + } else if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn') { if (identifierValue && identifierValue != "") { this.referenceDataObject.vm.push({ 'template-id': identifierValue, 'vm-instance': (existingVmsLength + index + 1), vnfc: [Object.assign({}, this.Sample)] }); } @@ -641,7 +652,7 @@ export class ReferenceDataformComponent implements OnInit { let arrlength = this.referenceDataObject.vm.length; mberOFVm = arrlength + mberOFVm; for (var i = (arrlength); i < mberOFVm; i++) { - if (this.referenceDataObject.action == 'ConfigScaleOut') { + if (this.referenceDataObject.action == 'ConfigScaleOut' || this.referenceDataObject.action == 'ConfigScaleIn') { this.referenceDataObject.vm.push({ 'template-id': this.templateIdentifier, 'vm-instance': (i + 1), vnfc: [Object.assign({}, this.Sample)] }); } else { this.referenceDataObject.vm.push({ 'vm-instance': (i + 1), vnfc: [Object.assign({}, this.Sample)] }); @@ -1191,6 +1202,9 @@ export class ReferenceDataformComponent implements OnInit { case 'ConfigScaleOut': this.deviceProtocols = ['', 'CHEF', 'ANSIBLE', 'NETCONF-XML', 'RESTCONF']; break; + case 'ConfigScaleIn': + this.deviceProtocols = ['', 'CHEF', 'ANSIBLE', 'NETCONF-XML', 'RESTCONF']; + break; case 'GetRunningConfig': this.deviceProtocols = ['', 'CHEF', 'ANSIBLE', 'NETCONF-XML', 'RESTCONF', 'CLI', 'REST']; break; @@ -1272,7 +1286,7 @@ export class ReferenceDataformComponent implements OnInit { } // Enable or Block Template and PD Tabs - if (this.currentAction == 'ConfigScaleOut' && this.templateIdentifier && this.templateIdentifier != '') { + if ((this.currentAction == 'ConfigScaleOut' || this.currentAction == 'ConfigScaleIn') && this.templateIdentifier && this.templateIdentifier != '') { // let referenceDataObjectTemp = this.referenceDataObject; // referenceDataObjectTemp['template-id'] = this.templateIdentifier; // this.buildDesignComponent.getRefData(referenceDataObjectTemp); @@ -1293,7 +1307,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.currentAction == 'ConfigScaleOut') && this.templateIdentifier) { // let referenceDataObjectTemp = this.referenceDataObject; // referenceDataObjectTemp['template-id'] = this.templateIdentifier; // this.buildDesignComponent.getRefData(referenceDataObjectTemp); @@ -1310,7 +1324,7 @@ export class ReferenceDataformComponent implements OnInit { configDrp(data) { console.log( this.classNm+": configDrp: start: data:["+data+"]"); - if (data == 'ConfigScaleOut') { + if (data == 'ConfigScaleOut' || data == 'ConfigScaleIn') { this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value', 'existing-group-name']; } else { this.groupAnotationType = ['', 'first-vnfc-name', 'fixed-value', 'relative-value']; @@ -1574,6 +1588,22 @@ export class ReferenceDataformComponent implements OnInit { } } + resetVmsForScaleIn(action) { + //reset currentform vms based on action + if (action == "ConfigScaleIn" || action == "Configure") { + let ConfigScaleInIndex = this.tempAllData.findIndex(obj => { + return obj['action'] == action + }); + if (ConfigScaleInIndex > -1) { + this.referenceDataObject.vm = this.tempAllData[ConfigScaleInIndex].vm + } else { + if (this.actionChanged) { + this.referenceDataObject.vm = [] + } + } + } + } + resetParamsOnVnfcType() { let scopeName: any; let vnfcTypeList = this.referenceDataObject.scope['vnfc-type-list'] @@ -1660,7 +1690,7 @@ export class ReferenceDataformComponent implements OnInit { configTemplate = this.referenceDataFormUtil.createConfigTemplate(config_template_fileName); pdTemplate = this.referenceDataFormUtil.createPdTemplate(pd_fileName); paramValue = this.referenceDataFormUtil.createParamValue(param_fileName); - if (this.referenceDataObject.action != 'ConfigScaleOut') { + if (this.referenceDataObject.action != 'ConfigScaleOut' && this.referenceDataObject.action != 'ConfigScaleIn') { this.referenceDataObject['artifact-list'].push(configTemplate, pdTemplate, paramValue @@ -1692,21 +1722,22 @@ export class ReferenceDataformComponent implements OnInit { // used to remove the added vms for actions other than configure & scaleout deleteVmsforNonActions(newObj, action) { let configureObject = (action == 'Configure'); - let ConfigScaleOut = (action == 'ConfigScaleOut'); + let ConfigScale = (action == 'ConfigScaleOut') || (action == 'ConfigScaleIn'); //delete VM's if selected action is not configure. - if (!ConfigScaleOut && !configureObject && this.tempAllData.length != 0) { - if (ConfigScaleOut) { + if (!ConfigScale && !configureObject && this.tempAllData.length != 0) { + if (ConfigScale) { } else { newObj.vm = []; } } else { - if (ConfigScaleOut) { + if (ConfigScale) { } else { delete newObj['template-id-list']; } } return newObj } + // used to replace the data in tempall obj and form the artifact names pushOrReplaceTempData(newObj, action) { let configTemplate @@ -1737,7 +1768,7 @@ export class ReferenceDataformComponent implements OnInit { pd_artifact: pdTemplate['pd_artifact'], template_artifact: configTemplate['template_artifact'] }); - } else if (newObj.action == "ConfigScaleOut") { + } else if (newObj.action == "ConfigScaleOut" || newObj.action == "ConfigScaleIn") { 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; @@ -1782,7 +1813,7 @@ export class ReferenceDataformComponent implements OnInit { if (actionObjIndex > -1) { this.tempAllData[actionObjIndex] = newObj; this.mappingEditorService.saveLatestAction(this.tempAllData[actionObjIndex]); - if (newObj.action == "ConfigScaleOut") { + if (newObj.action == "ConfigScaleOut" || newObj.action == "ConfigScaleIn") { this.mappingEditorService.saveLatestIdentifier(this.templateIdentifier); } else { @@ -1795,7 +1826,7 @@ export class ReferenceDataformComponent implements OnInit { this.tempAllData.push(newObj); this.mappingEditorService.saveLatestAction(newObj); - if (newObj.action == "ConfigScaleOut") { + if (newObj.action == "ConfigScaleOut" || newObj.action == "ConfigScaleIn") { this.mappingEditorService.saveLatestIdentifier(this.templateIdentifier); } else { @@ -1810,7 +1841,7 @@ export class ReferenceDataformComponent implements OnInit { newObj = JSON.parse(JSON.stringify(newObj)) delete newObj['template-id'] delete newObj['vnfcIdentifier'] - if (newObj.action != "ConfigScaleOut") { + if (newObj.action != "ConfigScaleOut" && newObj.action != "ConfigScaleIn") { delete newObj['template-id-list'] } if (newObj.action != 'HealthCheck') { @@ -1933,7 +1964,9 @@ export class ReferenceDataformComponent implements OnInit { return; } - if (referenceDataObject.action === 'ConfigScaleOut' && !this.templateIdentifier) { + if ((referenceDataObject.action === 'ConfigScaleOut' + || referenceDataObject.action === 'ConfigScaleIn') + && !this.templateIdentifier) { this.nService.error('Error', 'Select a valid Template Identifier'); } @@ -1990,6 +2023,7 @@ export class ReferenceDataformComponent implements OnInit { handleVMBlockDisplay() { switch (this.referenceDataObject.action) { case this.actionList.ConfigScaleOut: + case this.actionList.ConfigScaleIn: case this.actionList.Configure: case undefined: case '': diff --git a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.html b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.html index 55ea90f..3d11d5b 100644 --- a/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.html +++ b/src/app/vnfs/build-artifacts/template-holder/param-name-value/param-name-value.component.html @@ -81,6 +81,9 @@ limitations under the License. <div *ngIf="(action === 'ConfigScaleOut')" class="col-lg-3 col-sm-6 col-md-3 col-xs-12"> <label>Template Identifier</label><input class="form-control" type="text" disabled value="{{identifier}}" /> </div> + <div *ngIf="(action === 'ConfigScaleIn')" class="col-lg-3 col-sm-6 col-md-3 col-xs-12"> + <label>Template Identifier</label><input class="form-control" type="text" disabled value="{{identifier}}" /> + </div> </div> </div> </div> diff --git a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.html b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.html index 67bce4d..7ca978f 100644 --- a/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.html +++ b/src/app/vnfs/build-artifacts/template-holder/template-configuration/template-configuration.component.html @@ -54,6 +54,9 @@ limitations under the License. <div *ngIf="(action === 'ConfigScaleOut')" class="col-lg-3 col-sm-6 col-md-3 col-xs-12"> <label>Template Identifier</label><input class="form-control" type="text" [(ngModel)]="identifier" disabled /> </div> + <div *ngIf="(action === 'ConfigScaleIn')" class="col-lg-3 col-sm-6 col-md-3 col-xs-12"> + <label>Template Identifier</label><input class="form-control" type="text" [(ngModel)]="identifier" disabled /> + </div> </div> </div> </div> |