diff options
Diffstat (limited to 'vid-webpack-master')
5 files changed, 74 insertions, 98 deletions
diff --git a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts index fa628d4b5..3b42a1ca1 100644 --- a/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/ala-carte.e2e.ts @@ -215,15 +215,20 @@ describe('A la carte', function () { }); }); - it(`VFModule a-la-carte`, () => { - var timeBomb = new Date('12/09/2018'); - if (new Date() < timeBomb) { - return; - } + it(`Add ALaCarte VfModule Without LcpRegion Tenant Id And Legacy`, () => { + addAlacarteVfmoduleByFlag(true, 'redux-a-la-carte-no-lcp-tenant.json'); + }); + + it(`Add ALaCarte VfModule With LcpRegion Tenant Id And Legacy`, () => { + addAlacarteVfmoduleByFlag(false, 'redux-a-la-carte.json'); + }); + + function addAlacarteVfmoduleByFlag (flag: boolean, expectedJsonFile: string) { cy.readFile('cypress/support/jsonBuilders/mocks/jsons/emptyServiceRedux.json').then((res) => { cy.setTestApiParamToGR(); res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.vidNotions.instantiationType = 'ALaCarte'; res.service.serviceHierarchy['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].service.inputs = null; + res.global['flags'] = { 'FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF' : flag }; cy.setReduxState(<any>res); cy.openIframe('app/ui/#/servicePlanning?serviceModelId=2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'); @@ -241,31 +246,30 @@ describe('A la carte', function () { '2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vPFE_BV..module-2', ]; - cy.addALaCarteVfModule(vnfName, vfModulesNames[0], 'mimazepubi', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, false) + cy.addALaCarteVfModule(vnfName, vfModulesNames[0], 'mimazepubi', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, false, flag) + .then(() => { + cy.addALaCarteVfModule(vnfName, vfModulesNames[1], 'puwesovabe', 'AAIAIC25', 'my region', 'USP-SIP-IC-24335-T-01', true, true, false, flag) .then(() => { - cy.addALaCarteVfModule(vnfName, vfModulesNames[1], 'puwesovabe', 'AAIAIC25', 'my region', 'USP-SIP-IC-24335-T-01', true, true, false) - .then(() => { - cy.addALaCarteVfModule(vnfName, vfModulesNames[2], 'bnmgtrx', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, true) - .then(() => { - cy.getReduxState().then((state) => { - const vfModules = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs[vnfName].vfModules; - cy.readFile('../vid-automation/src/test/resources/a-la-carte/redux-a-la-carte.json').then((file) => { - for (let vfModulesName of vfModulesNames) { - const vfModule = vfModules[vfModulesName]; - let vfModuleObject = vfModule[Object.keys(vfModule)[0]]; - file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName].action = "Create"; - cy.deepCompare(vfModuleObject, file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName]); - } - }); - }); - }); + cy.addALaCarteVfModule(vnfName, vfModulesNames[2], 'bnmgtrx', 'hvf6', '', 'AINWebTool-15-D-iftach', false, false, true, flag) + .then(() => { + cy.getReduxState().then((state) => { + const vfModules = state.service.serviceInstance['2f80c596-27e5-4ca9-b5bb-e03a7fd4c0fd'].vnfs[vnfName].vfModules; + cy.readFile('../vid-automation/src/test/resources/a-la-carte/' + expectedJsonFile).then((file) => { + for (let vfModulesName of vfModulesNames) { + const vfModule = vfModules[vfModulesName]; + let vfModuleObject = vfModule[Object.keys(vfModule)[0]]; + file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName].action = "Create"; + cy.deepCompare(vfModuleObject, file.vnfs[vnfName].vfModules[vfModulesName][vfModulesName]); + } + }); }); + }); }); + }); }); }); }); - }); - + }; function changeServiceEcompNamingToTrue(obj: ServiceModel) { obj.service.serviceEcompNaming = "true"; @@ -283,8 +287,5 @@ describe('A la carte', function () { .get('.error').contains(INSTANCE_NAME_NOT_MANDATORY_MESSAGE); } - - - }); }); diff --git a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts index f7419ef33..bb2c01abd 100644 --- a/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/instantiation-templates.e2e.ts @@ -104,16 +104,12 @@ describe('Drawing Board: Instantiation Templates', function () { cy.editNode("node-c5b26cc1-a66f-4b69-aa23-6abc7c647c88-vprobe_nc_vnf0..VprobeNcVnf..FE_base_module..module-0") .getElementByDataTestsId("instanceName").should('have.value', 'hvf6arlba007_lba_Base_01') - .getElementByDataTestsId("lcpRegion").should('contain', 'hvf6') - .getElementByDataTestsId("tenant").should('contain', 'DN5242-Nov21-T1') .getElementByDataTestsId("rollback").should('contain', 'Rollback') .getElementByDataTestsId("cancelButton").click(); cy.editNode("node-c09e4530-8fd8-418f-9483-2f57ce927b05-vprobe_nc_vnf0..VprobeNcVnf..FE_Add_On_Module_vlbagent_eph..module-1") .getElementByDataTestsId("instanceName").should('have.value', 'my_hvf6arlba007_lba_dj_01') .getElementByDataTestsId("volumeGroupName").should('have.value', 'my_special_hvf6arlba007_lba_dj_01_vol') - .getElementByDataTestsId("lcpRegion").should('contain', 'hvf6') - .getElementByDataTestsId("tenant").should('contain', 'DN5242-Nov21-T1') .getElementByDataTestsId("rollback").should('contain', 'Rollback') .getElementByDataTestsId("sdncPreLoad").should('have.value', 'on') .getElementByDataTestsId("cancelButton").click(); @@ -156,8 +152,6 @@ describe('Drawing Board: Instantiation Templates', function () { cy.editNode(`node-c09e4530-8fd8-418f-9483-2f57ce927b05-${module1CustomizationId}`, 1); cy.clearInput("instanceName"); cy.typeToInput("instanceName", newVfModuleName); - cy.selectDropdownOptionByText('lcpRegion', 'hvf6'); - cy.selectDropdownOptionByText('tenant', 'DN5242-Nov21-T1'); cy.getElementByDataTestsId('form-set').click(); // Then... @@ -177,8 +171,6 @@ describe('Drawing Board: Instantiation Templates', function () { { instanceName: newVfModuleName, volumeGroupName: `${newVfModuleName}_vol`, - lcpCloudRegionId: "hvf6", - tenantId: "4914ab0ab3a743e58f0eefdacc1dde77", } ); diff --git a/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts index b87e773f9..cfb8a050a 100644 --- a/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts +++ b/vid-webpack-master/cypress/support/steps/fill.vfModule.step.ts @@ -34,7 +34,7 @@ function addMacroVfModule(vnfName: string, vfModuleName: string, instanceName: s } function addALaCarteVfModule(vnfName: string, vfModuleName: string, instanceName: string, lcpRegion: string, legacyRegion: string, - tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean): Chainable<any> { + tenant: string, rollback: boolean, sdncPreLoad: boolean, deleteVgName: boolean, flag: boolean): Chainable<any> { return cy.getElementByDataTestsId('node-' + vnfName).click({force: true}).then(() => { cy.getElementByDataTestsId('node-' + vfModuleName + '-add-btn').click({force: true}).then(() => { cy.getElementByDataTestsId('instanceName').clear().type(instanceName, {force: true}).then(() => { @@ -42,11 +42,13 @@ function addALaCarteVfModule(vnfName: string, vfModuleName: string, instanceName cy.getElementByDataTestsId('volumeGroupName').clear(); } }).then(() => { - cy.selectDropdownOptionByText('lcpRegion', lcpRegion); - if (legacyRegion) { - cy.typeToInput("lcpRegionText", legacyRegion); + if(!flag) { + cy.selectDropdownOptionByText('lcpRegion', lcpRegion); + if (legacyRegion) { + cy.typeToInput("lcpRegionText", legacyRegion); + } + cy.selectDropdownOptionByText('tenant', tenant); } - cy.selectDropdownOptionByText('tenant', tenant); cy.selectDropdownOptionByText('rollback', String(rollback)); if (sdncPreLoad) { cy.getElementByDataTestsId('sdncPreLoad').check(); diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts index 49deb3a50..154c60f9e 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts @@ -4,7 +4,7 @@ import {NgRedux} from '@angular-redux/store'; import {ControlGeneratorUtil, SDN_C_PRE_LOAD} from "../control.generator.util.service"; import {AaiService} from "../../../../services/aaiService/aai.service"; import {GenericFormService} from "../../generic-form.service"; -import {FormBuilder, FormControl, FormGroup} from "@angular/forms"; +import {FormBuilder} from "@angular/forms"; import {LogService} from "../../../../utils/log/log.service"; import { FormControlModel, @@ -12,12 +12,14 @@ import { ValidatorOptions } from "../../../../models/formControlModels/formControl.model"; import {FormControlNames, VfModuleControlGenerator} from "./vfModule.control.generator"; -import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service"; +import {FeatureFlagsService, Features} from "../../../../services/featureFlag/feature-flags.service"; import {VfModuleInstance} from "../../../../models/vfModuleInstance"; import {VfModule} from "../../../../models/vfModule"; import {SharedControllersService} from "../sharedControlles/shared.controllers.service"; import {AppState} from "../../../../store/reducers"; import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service"; +import {instance, mock, when} from "ts-mockito"; +import each from "jest-each"; class MockAppStore<T> { getState() { @@ -921,6 +923,8 @@ describe('VFModule Control Generator', () => { let service: VfModuleControlGenerator; let httpMock: HttpTestingController; let store : NgRedux<AppState>; + let mockFeatureFlagsService: FeatureFlagsService = mock(FeatureFlagsService); + beforeAll(done => (async () => { TestBed.configureTestingModule({ @@ -933,7 +937,7 @@ describe('VFModule Control Generator', () => { FormBuilder, LogService, SharedTreeService, - {provide:FeatureFlagsService, useClass: MockFeatureFlagsService}, + {provide: FeatureFlagsService, useValue: instance(mockFeatureFlagsService)}, {provide: NgRedux, useClass: MockAppStore}] }); await TestBed.compileComponents(); @@ -946,6 +950,23 @@ describe('VFModule Control Generator', () => { })().then(done).catch(done.fail)); + let formControlsWithoutLcpRegionTenantLegacy : string[] = + [FormControlNames.INSTANCE_NAME, + FormControlNames.VOLUME_GROUP_NAME, + FormControlNames.ROLLBACK_ON_FAILURE, + SDN_C_PRE_LOAD,]; + + let formControlsWithLcpRegionTenantLegacy : string[] = + [FormControlNames.INSTANCE_NAME, + FormControlNames.VOLUME_GROUP_NAME, + FormControlNames.LCPCLOUD_REGION_ID, + FormControlNames.LEGACY_REGION, + FormControlNames.TENANT_ID, + FormControlNames.ROLLBACK_ON_FAILURE, + SDN_C_PRE_LOAD,]; + + + test(' getMacroFormControls gets vnfStoreKey === null', () => { const serviceId: string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44"; const vnfStoreKey: string = null; @@ -1058,20 +1079,15 @@ describe('VFModule Control Generator', () => { expect(console.error).toHaveBeenCalled(); }); - test('getAlaCarteFormControls should return the correct order of controls', () => { + each([ + [true, 4, formControlsWithoutLcpRegionTenantLegacy], + [false, 7,formControlsWithLcpRegionTenantLegacy] + ]). + test('getAlaCarteFormControls should return the correct order of controls', (flag: boolean, controlAmount: number, orderedControls: string[]) => { + when(mockFeatureFlagsService.getFlagState(Features.FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF)).thenReturn(flag); const controls:FormControlModel[] = getAlaCarteFormControls(); - const orderedControls : string[] = [ - FormControlNames.INSTANCE_NAME, - FormControlNames.VOLUME_GROUP_NAME, - FormControlNames.LCPCLOUD_REGION_ID, - FormControlNames.LEGACY_REGION, - FormControlNames.TENANT_ID, - FormControlNames.ROLLBACK_ON_FAILURE, - SDN_C_PRE_LOAD, - ]; - - expect(controls.length).toEqual(7); + expect(controls.length).toEqual(controlAmount); for(let i = 0 ; i < orderedControls.length ; i++) { expect(controls[i].controlName).toEqual(orderedControls[i]); } @@ -1093,26 +1109,6 @@ describe('VFModule Control Generator', () => { return controls; } - test('getAlaCarteFormControls responce with wrong order of controls', () => { - const controls:FormControlModel[] = getAlaCarteFormControls(); - - const orderedControls : string[] = [ - FormControlNames.INSTANCE_NAME, - FormControlNames.VOLUME_GROUP_NAME, - FormControlNames.LCPCLOUD_REGION_ID, - FormControlNames.TENANT_ID, // TENANT_ID must be after LEGACY_REGION - FormControlNames.LEGACY_REGION, - FormControlNames.ROLLBACK_ON_FAILURE, - SDN_C_PRE_LOAD, - ]; - - for(let i = 0 ; i < orderedControls.length ; i++) { - if (controls[i].controlName === 'legacyRegion') { - expect(orderedControls[i]).toEqual('tenantId'); - } - } - }); - test('getMacroFormControls should return the correct order of controls', () => { const serviceId: string = "6e59c5de-f052-46fa-aa7e-2fca9d674c44"; const vnfStoreKey: string = 'VF_vGeraldine 0'; @@ -1149,25 +1145,6 @@ describe('VFModule Control Generator', () => { expect(instanceNameValidator.validatorArg).toEqual(/^[a-zA-Z0-9._-]*$/); }); - test(' getAlaCarteFormControls gets null service', () => { - const controls:FormControlModel[] = getAlaCarteFormControls(); - expect(controls.length).toEqual(7); - - const orderedControls : string[] = [ - FormControlNames.INSTANCE_NAME, - FormControlNames.VOLUME_GROUP_NAME, - FormControlNames.LCPCLOUD_REGION_ID, - FormControlNames.LEGACY_REGION, - FormControlNames.TENANT_ID, - FormControlNames.ROLLBACK_ON_FAILURE, - SDN_C_PRE_LOAD, - ]; - - for(let i = 0 ; i < orderedControls.length ; i++) { - expect(controls[i].controlName).toEqual(orderedControls[i]); - } - }); - test('when flag is active - response should contains upload file', ()=>{ spyOn(store, 'getState').and.returnValue( { diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts index 702181581..b614ecf30 100644 --- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts +++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts @@ -23,6 +23,7 @@ import {SharedControllersService} from "../sharedControlles/shared.controllers.s import {MessageModal} from "../../../messageModal/message-modal.service"; import {ButtonType} from "../../../customModal/models/button.type"; import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service"; +import {FeatureFlagsService, Features} from "../../../../services/featureFlag/feature-flags.service"; export enum FormControlNames { INSTANCE_NAME = 'instanceName', @@ -47,7 +48,8 @@ export class VfModuleControlGenerator { private store: NgRedux<AppState>, private http: HttpClient, private _aaiService: AaiService, - private _logService: LogService) { + private _logService: LogService, + private _featureFlagsService:FeatureFlagsService) { this.aaiService = _aaiService; } @@ -124,9 +126,11 @@ export class VfModuleControlGenerator { const vfModuleInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getVfModuleInstance(serviceId, vnfStoreKey, uuidData, isUpdateMode)); let result: FormControlModel[] = []; this.pushInstanceAndVGToForm(result, vfModuleInstance, serviceId, vnfModel, true); - result.push(this._sharedControllersService.getLcpRegionControl(serviceId, vfModuleInstance, result)); - result.push(this._sharedControllersService.getLegacyRegion(vfModuleInstance)); - result.push(this._sharedControllersService.getTenantControl(serviceId, vfModuleInstance)); + if( !this._featureFlagsService.getFlagState(Features.FLAG_2006_VFMODULE_TAKES_TENANT_AND_REGION_FROM_VNF)) { + result.push(this._sharedControllersService.getLcpRegionControl(serviceId, vfModuleInstance, result)); + result.push(this._sharedControllersService.getLegacyRegion(vfModuleInstance)); + result.push(this._sharedControllersService.getTenantControl(serviceId, vfModuleInstance)); + } result.push(this._sharedControllersService.getRollbackOnFailureControl(vfModuleInstance)); result.push(this._sharedControllersService.getSDNCControl(vfModuleInstance, this.getSdncExtraContents())); if (this.store.getState().global.flags['FLAG_SUPPLEMENTARY_FILE']) { |