From 700ac8a7ec822f1b7a0505319e4c453ca045d2ed Mon Sep 17 00:00:00 2001 From: Liu Date: Mon, 27 Jan 2020 10:59:12 +0800 Subject: add new action configscalein for cdt Change-Id: I2f05079b7c2428351332ac84c1ea56f31d4a38d9 Issue-ID: APPC-1760 Signed-off-by: Taka Cho --- src/app/pipes/vm-filtering.pipe.ts | 4 +- src/app/shared/pipes/vm-filtering.pipe.spec.ts | 10 ++ src/app/shared/pipes/vm-filtering.pipe.ts | 4 +- .../build-artifacts/build-artifacts.component.ts | 6 +- .../parameter-definitions/parameter.component.html | 2 +- .../parameter-definitions/parameter.component.ts | 2 +- .../reference-dataform.component.html | 14 +- .../reference-dataform.component.spec.ts | 194 ++++++++++++++++++++- .../reference-dataform.component.ts | 72 ++++++-- .../param-name-value.component.html | 3 + .../template-configuration.component.html | 3 + src/cdt.application.properties.json | 1 + src/constants/app-constants.ts | 3 +- 13 files changed, 278 insertions(+), 40 deletions(-) diff --git a/src/app/pipes/vm-filtering.pipe.ts b/src/app/pipes/vm-filtering.pipe.ts index 6da7840..ec1aaa3 100644 --- a/src/app/pipes/vm-filtering.pipe.ts +++ b/src/app/pipes/vm-filtering.pipe.ts @@ -25,12 +25,12 @@ export class VmFilteringPipe implements PipeTransform { transform(value: any, action: any, templateId, newVnfc): any { let filterValue - if(action == 'ConfigScaleOut'){ + if(action == 'ConfigScaleOut' || action == 'ConfigScaleIn'){ filterValue= templateId } else if(action == 'Configure' || action == 'ConfigModify' || action == 'DistributeTraffic' || action == 'DistributeTrafficCheck'){ filterValue= newVnfc } - if (action == 'ConfigScaleOut') { + if (action == 'ConfigScaleOut' || action == 'ConfigScaleIn' ) { let x = value.filter(obj => { //return value return obj['template-id'] == filterValue; diff --git a/src/app/shared/pipes/vm-filtering.pipe.spec.ts b/src/app/shared/pipes/vm-filtering.pipe.spec.ts index 9c544cb..08df4de 100644 --- a/src/app/shared/pipes/vm-filtering.pipe.spec.ts +++ b/src/app/shared/pipes/vm-filtering.pipe.spec.ts @@ -37,6 +37,16 @@ describe('VmFilteringPipe', () => { ] expect(pipe.transform(objArray,"ConfigScaleOut",1, {})[0].type,).toBe("conScale") + }); + it('should return configscalein values if template id matches',()=>{ + const pipe = new VmFilteringPipe(); + + let objArray = [ + {action:"Configure","template-id":2,"type":"con"}, + {action:"ConfigScaleIn","template-id":1,"type":"conScale"} + ] + expect(pipe.transform(objArray,"ConfigScaleIn",1, {})[0].type,).toBe("conScale") + }); it('should return configure calues',()=>{ const pipe = new VmFilteringPipe(); diff --git a/src/app/shared/pipes/vm-filtering.pipe.ts b/src/app/shared/pipes/vm-filtering.pipe.ts index 6da7840..4c49eb3 100644 --- a/src/app/shared/pipes/vm-filtering.pipe.ts +++ b/src/app/shared/pipes/vm-filtering.pipe.ts @@ -25,12 +25,12 @@ export class VmFilteringPipe implements PipeTransform { transform(value: any, action: any, templateId, newVnfc): any { let filterValue - if(action == 'ConfigScaleOut'){ + if(action == 'ConfigScaleOut' || action == 'ConfigScaleIn'){ filterValue= templateId } else if(action == 'Configure' || action == 'ConfigModify' || action == 'DistributeTraffic' || action == 'DistributeTrafficCheck'){ filterValue= newVnfc } - if (action == 'ConfigScaleOut') { + if (action == 'ConfigScaleOut' || action == 'ConfigScaleIn') { let x = value.filter(obj => { //return value return obj['template-id'] == filterValue; 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.
-
+
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. -
+
@@ -185,7 +185,7 @@ limitations under the License.

-
+
@@ -204,7 +204,7 @@ limitations under the License.
-
+
VM Number: {{j+1}}
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.
+
+ +
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.
+
+ +
diff --git a/src/cdt.application.properties.json b/src/cdt.application.properties.json index 61f9e1e..a47fe20 100644 --- a/src/cdt.application.properties.json +++ b/src/cdt.application.properties.json @@ -8,6 +8,7 @@ "password": "admin", "Actions": { "ConfigScaleOut": "ConfigScaleOut", + "ConfigScaleIn": "ConfigScaleIn", "Configure": "Configure" }, "versionNoForApiCall": "0.0.1" diff --git a/src/constants/app-constants.ts b/src/constants/app-constants.ts index 68ff6c4..b5c4ab2 100644 --- a/src/constants/app-constants.ts +++ b/src/constants/app-constants.ts @@ -71,7 +71,8 @@ export const appConstants = { "upgradePreCheck": "UpgradePreCheck", "upgradeSoftware": "UpgradeSoftware", "openStackActions": "OpenStack Actions", - "configScaleOut": "ConfigScaleOut" + "configScaleOut": "ConfigScaleOut", + "configScaleIn": "ConfigScaleIn" }, "DeviceProtocols": { "blank": '', -- cgit 1.2.3-korg