diff options
Diffstat (limited to 'vid-webpack-master')
7 files changed, 223 insertions, 11 deletions
diff --git a/vid-webpack-master/cypress/integration/iFrames/viewEditNetwork.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewEditNetwork.e2e.ts new file mode 100644 index 000000000..084680acd --- /dev/null +++ b/vid-webpack-master/cypress/integration/iFrames/viewEditNetwork.e2e.ts @@ -0,0 +1,83 @@ +///<reference path="../../../node_modules/cypress/types/index.d.ts"/> / <reference types="Cypress" /> + + +import {JsonBuilder} from "../../support/jsonBuilders/jsonBuilder"; +import {ServiceModel} from "../../support/jsonBuilders/models/service.model"; +import {AaiServiceInstancesModel} from "../../support/jsonBuilders/models/serviceInstances.model"; +import {AAISubViewEditModel} from "../../support/jsonBuilders/models/aaiSubViewEdit.model"; + +const jsonBuilderAndMock: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>(); +let jsonBuilderAAIService: JsonBuilder<ServiceModel> = new JsonBuilder<ServiceModel>(); +let jsonBuilderAaiServiceInstances: JsonBuilder<AaiServiceInstancesModel> = new JsonBuilder<AaiServiceInstancesModel>(); +let jsonBuilderAAISubViewEditModel: JsonBuilder<AAISubViewEditModel> = new JsonBuilder<AAISubViewEditModel>(); + + +describe('View Edit page: Add network', () =>{ + beforeEach(() => { + cy.clearSessionStorage(); + cy.initGetAAISubDetails(); + cy.initAAIServices(); + cy.initTenants(); + cy.setTestApiParamToGR(); + cy.initVidMock(); + cy.login(); + + }); + + afterEach(() => { + cy.screenshot(); + }); + + it(`Add new network to service with one existing network `, () =>{ + const serviceType = 'Emanuel'; + const subscriberId = 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb'; + const serviceModelId = 'f93e72e1-77fc-4f54-b207-298d766d0886'; + const serviceInstanceId = 'ce2821fc-3b28-4759-9613-1e514d7563c0'; + const serviceInvariantUuid = "8c364754-4c76-4abc-b8f3-88da5f67d588"; + + cy.initDrawingBoardUserPermission(); + cy.route(`**/rest/models/services/${serviceModelId}`, + 'fixture:../support/jsonBuilders/mocks/jsons/add_Network/add_network_model.json') + .as('serviceModelAddNetwork'); + + cy.route(`**/aai_get_service_instance_topology/${subscriberId}/${serviceType}/${serviceInstanceId}`, + 'fixture:../support/jsonBuilders/mocks/jsons/add_Network/add_network_instance.json') + .as('serviceInstanceAddNetwork'); + + cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${serviceModelId}&subscriberId=${subscriberId}&serviceType=${serviceType}&serviceInstanceId=${serviceInstanceId}`); + + cy.getElementByDataTestsId('node-OVS Provider-add-btn').click({force: true}).then(() => { + + cy.fillNetworkPopup(); + }); + + mockAsyncBulkResponse(); + //click update + cy.getElementByDataTestsId('deployBtn').should('have.text', 'UPDATE').click(); + + cy.getReduxState().then((state) => { + + const networks = state.service.serviceInstance['f93e72e1-77fc-4f54-b207-298d766d0886'].networks; + cy.wait('@expectedPostAsyncInstantiation').then(xhr => { + cy.readFile('../vid-app-common/src/test/resources/payload_jsons/Network/one_network_exists_add_another_network_expected_bulk.json').then((expectedResult) => { + + //set randomized trackById into bulk expected file + expectedResult.networks['OVS Provider'].trackById = networks['OVS Provider'].trackById; + + cy.deepCompare(xhr.request.body, expectedResult); + }); + }); + }); + + }); + + function mockAsyncBulkResponse() { + cy.server().route({ + url: Cypress.config('baseUrl') + '/asyncInstantiation/bulk', + method: 'POST', + status: 200, + response: "[]", + }).as("expectedPostAsyncInstantiation"); + } + +}); diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/add_Network/add_network_instance.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/add_Network/add_network_instance.json new file mode 100644 index 000000000..d21ac103b --- /dev/null +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/add_Network/add_network_instance.json @@ -0,0 +1,69 @@ +{ + "action": "None", + "instanceName": "oam_protected_net_svc1", + "instanceId": "ce2821fc-3b28-4759-9613-1e514d7563c0", + "orchStatus": "Active", + "productFamilyId": null, + "lcpCloudRegionId": null, + "tenantId": null, + "cloudOwner": null, + "modelInfo": { + "modelInvariantId": "8c364754-4c76-4abc-b8f3-88da5f67d588", + "modelVersionId": "f93e72e1-77fc-4f54-b207-298d766d0886", + "modelName": "oam_protected_net NC OVS network 1", + "modelType": "service", + "modelVersion": "2.0" + }, + "globalSubscriberId": "a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb", + "subscriptionServiceType": "Emanuel", + "owningEntityId": null, + "owningEntityName": null, + "tenantName": null, + "aicZoneId": null, + "aicZoneName": null, + "projectName": null, + "rollbackOnFailure": null, + "isALaCarte": true, + "vnfs": {}, + "networks": { + "ca61e4c9-982b-4d5f-b9eb-eaaf1cf23b9e": { + "action": "None", + "instanceName": "GRP-29576-T-E2E-16-SDN_oam_protected_net_2", + "instanceId": "ca61e4c9-982b-4d5f-b9eb-eaaf1cf23b9e", + "orchStatus": "Active", + "lcpCloudRegionId": "olson59a", + "tenantId": "11981b4f7fc4426d905edb1487b53bff", + "cloudOwner": "irma-aic", + "modelInfo": { + "modelCustomizationName": "OVS Provider", + "modelCustomizationId": "23c382c9-9405-4780-8794-e57eb015883d", + "modelInvariantId": "ffb9e45c-e674-4289-aad3-00040ad746e4", + "modelVersionId": "01f4c475-3f89-4f00-a2f4-39a873dba0ae", + "modelName": "NETWORK_CLOUD_PROVIDER_NETWORK", + "modelType": "network", + "modelVersion": "1.0" + }, + "instanceType": "NEUTRON-PROVIDER", + "inMaint": false, + "uuid": "01f4c475-3f89-4f00-a2f4-39a873dba0ae", + "originalName": "OVS Provider", + "trackById": "ca61e4c9-982b-4d5f-b9eb-eaaf1cf23b9e", + "role": "oam_protected_net_2", + "physicalName": "oam", + "serviceName": "oam_protected_net_svc1", + "serviceUUID": "ce2821fc-3b28-4759-9613-1e514d7563c0", + "tenantName": "GRP-29576-T-E2E-16-SDN", + "boundToVpn": false + } + }, + "vrfs": {}, + "vnfGroups": {}, + "collectionResources": {}, + "validationCounter": 0, + "existingVNFCounterMap": {}, + "existingNetworksCounterMap": { + "23c382c9-9405-4780-8794-e57eb015883d": 1 + }, + "existingVnfGroupCounterMap": {}, + "existingVRFCounterMap": {} +} diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/add_Network/add_network_model.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/add_Network/add_network_model.json new file mode 100644 index 000000000..576202a0a --- /dev/null +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/add_Network/add_network_model.json @@ -0,0 +1,58 @@ +{ + "service": { + "uuid": "f93e72e1-77fc-4f54-b207-298d766d0886", + "invariantUuid": "8c364754-4c76-4abc-b8f3-88da5f67d588", + "name": "oam_protected_net NC OVS network 1", + "version": "2.0", + "toscaModelURL": null, + "category": "Network Service", + "serviceType": "INFRASTRUCTURE", + "serviceRole": "PROVIDER-NETWORK", + "description": "OVS Provider Network service model for NC for oam_protected_net_2", + "serviceEcompNaming": "false", + "instantiationType": "A-La-Carte", + "inputs": {}, + "vidNotions": { + "instantiationUI": "anyAlacarteWhichNotExcluded", + "modelCategory": "5G Provider Network", + "viewEditUI": "legacy", + "instantiationType": "ALaCarte" + } + }, + "vnfs": {}, + "networks": { + "OVS Provider": { + "uuid": "01f4c475-3f89-4f00-a2f4-39a873dba0ae", + "invariantUuid": "ffb9e45c-e674-4289-aad3-00040ad746e4", + "description": "NETWORK_CLOUD_PROVIDER_NETWORK", + "name": "NETWORK_CLOUD_PROVIDER_NETWORK", + "version": "1.0", + "customizationUuid": "23c382c9-9405-4780-8794-e57eb015883d", + "inputs": {}, + "commands": {}, + "properties": { + "network_role": "oam_protected_net_2", + "network_assignments": "{is_external_network=false, is_shared_network=true, is_trunked=false, ipv4_subnet_default_assignment={dhcp_enabled=false, ip_version=4, min_subnets_count=1, use_ipv4=true}, ecomp_generated_network_assignment=false, ipv6_subnet_default_assignment={dhcp_enabled=false, use_ipv6=true, ip_version=6, min_subnets_count=1}, related_networks=[{related_network_role=oam_protected_net_2_tenant}]}", + "exVL_naming": "{ecomp_generated_naming=false}", + "network_flows": "{is_network_policy=false, is_bound_to_vpn=false}", + "network_scope": "GLOBAL", + "ecomp_generated_naming": "false", + "network_type": "NEUTRON-PROVIDER", + "provider_network": "{physical_network_name=oam, is_provider_network=true}", + "network_technology": "OVS", + "network_homing": "{ecomp_selected_instance_node_target=false}" + }, + "type": "VL", + "modelCustomizationName": "OVS Provider" + } + }, + "collectionResources": {}, + "configurations": {}, + "fabricConfigurations": {}, + "serviceProxies": {}, + "vfModules": {}, + "volumeGroups": {}, + "pnfs": {}, + "vnfGroups": {}, + "vrfs": {} +} diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts index 2e04f53bb..2014be99d 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/available-models-tree/available-models-tree.component.ts @@ -24,7 +24,6 @@ import {createVnfGroupInstance} from "../../../shared/storeUtil/utils/vnfGroup/v import {VnfGroupControlGenerator} from "../../../shared/components/genericForm/formControlsServices/vnfGroupGenerator/vnfGroup.control.generator"; import {HighlightPipe} from "../../../shared/pipes/highlight/highlight-filter.pipe"; import * as _ from 'lodash'; -import {DrawingBoardTreeComponent} from "../drawing-board-tree/drawing-board-tree.component"; import {ComponentInfoModel} from "../component-info/component-info-model"; import {ComponentInfoService} from "../component-info/component-info.service"; import {FeatureFlagsService, Features} from "../../../shared/services/featureFlag/feature-flags.service"; @@ -166,12 +165,12 @@ export class AvailableModelsTreeComponent { let vnfGroup = this._defaultDataGeneratorService.generateVnfGroupInstance(this.serviceHierarchy.vnfGroups[node.data.name], isEcompGeneratedNaming, isAlaCarte, instanceName); this._store.dispatch(changeInstanceCounter(node.data.modelUniqueId, serviceId, 1 , <any> {data: {type: 'VnfGroup'}})); this._store.dispatch(createVnfGroupInstance(vnfGroup, node.data.name, serviceId, node.data.name)); - DrawingBoardTreeComponent.triggerreCalculateIsDirty.next(this.serviceModelId); + DrawingBoardTreeService.triggerCheckIsDirty.next(this.serviceModelId); } else { let vfModule = this._defaultDataGeneratorService.generateVFModule(this.serviceHierarchy.vnfs[node.parent.data.name].vfModules[node.data.name], dynamicInputs, isEcompGeneratedNaming, isAlaCarte); if (this._sharedTreeService.selectedVNF) { this.store.dispatch(createVFModuleInstance(vfModule, node.data.name, this.serviceModelId, null, this._sharedTreeService.selectedVNF)); - DrawingBoardTreeComponent.triggerreCalculateIsDirty.next(this.serviceModelId); + DrawingBoardTreeService.triggerCheckIsDirty.next(this.serviceModelId); } else if (this._availableModelsTreeService.getOptionalVNFs(this.serviceModelId, node.parent.data.modelUniqueId).length === 1) { let existVnf = this._store.getState().service.serviceInstance[this.serviceModelId].vnfs; if(!_.isNil(existVnf)){ @@ -179,7 +178,7 @@ export class AvailableModelsTreeComponent { const modelUniqueId = this._sharedTreeService.modelUniqueId(existVnf[vnfKey]); if(modelUniqueId === node.parent.data.id){ this.store.dispatch(createVFModuleInstance(vfModule, node.data.name, this.serviceModelId, null, vnfKey)); - DrawingBoardTreeComponent.triggerreCalculateIsDirty.next(this.serviceModelId); + DrawingBoardTreeService.triggerCheckIsDirty.next(this.serviceModelId); } } } diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts index 1a42db403..18c3f72de 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.component.ts @@ -51,7 +51,6 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit { @Input() pageMode : DrawingBoardModes; static triggerDeleteActionService: Subject<string> = new Subject<string>(); static triggerUndoDeleteActionService: Subject<string> = new Subject<string>(); - static triggerreCalculateIsDirty: Subject<string> = new Subject<string>(); @ViewChild(ContextMenuComponent, {static: false}) public contextMenu: ContextMenuComponent; constructor(private _contextMenuService: ContextMenuService, @@ -87,12 +86,12 @@ export class DrawingBoardTreeComponent implements OnInit, AfterViewInit { }); }); - DrawingBoardTreeComponent.triggerUndoDeleteActionService.subscribe((serviceModelId) => { - this.drawingBoardTreeService.undoDeleteActionService(this.nodes, serviceModelId); + DrawingBoardTreeService.triggerCheckIsDirty.subscribe((serviceModelId)=>{ this.store.dispatch(changeServiceIsDirty(this.nodes, serviceModelId)); - }); + }) - DrawingBoardTreeComponent.triggerreCalculateIsDirty.subscribe((serviceModelId) => { + DrawingBoardTreeComponent.triggerUndoDeleteActionService.subscribe((serviceModelId) => { + this.drawingBoardTreeService.undoDeleteActionService(this.nodes, serviceModelId); this.store.dispatch(changeServiceIsDirty(this.nodes, serviceModelId)); }); diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts index 28b6e51b1..dfd89ca79 100644 --- a/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts +++ b/vid-webpack-master/src/app/drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service.ts @@ -5,9 +5,13 @@ import {NgRedux} from "@angular-redux/store"; import {AppState} from "../../../shared/store/reducers"; import {FeatureFlagsService, Features} from "../../../shared/services/featureFlag/feature-flags.service"; import {ServiceInstanceActions} from "../../../shared/models/serviceInstanceActions"; +import {Subject} from "rxjs"; @Injectable() export class DrawingBoardTreeService { + + static triggerCheckIsDirty : Subject<string> = new Subject<string>(); + constructor(private store: NgRedux<AppState>){} isVFModuleMissingData(node: ITreeNode, serviceModelId : string): boolean { if(node.data.type === 'VFmodule' &&!_.isNil(this.store.getState().service.serviceInstance[serviceModelId].vnfs) && !_.isNil(this.store.getState().service.serviceInstance[serviceModelId].vnfs[node.parent.data.vnfStoreKey])){ diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts index 7368dd698..1d8d827df 100644 --- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts +++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.component.ts @@ -13,9 +13,8 @@ import {AaiService} from "../../services/aaiService/aai.service"; import {GenericFormPopupService} from "./generic-form-popup.service"; import {FormControlModel} from "../../models/formControlModels/formControl.model"; import {FormGeneralErrorsService} from "../formGeneralErrors/formGeneralErrors.service"; -import {FeatureFlagsService, Features} from "../../services/featureFlag/feature-flags.service"; -import {InstantiationTemplatesModalComponent} from "./instantiationTemplatesModal/instantiation.templates.modal.component"; import {updateCurrentModalModeAction} from "../../storeUtil/utils/global/global.actions"; +import {DrawingBoardTreeService} from "../../../drawingBoard/service-planning/drawing-board-tree/drawing-board-tree.service"; export interface PopupModel { @@ -98,6 +97,7 @@ export class GenericFormPopupComponent extends DialogComponent<PopupModel, boole if (!_.isNil(this.uuidData)) { this.uuidData.popupService.closeDialogEvent.subscribe((that) => { + DrawingBoardTreeService.triggerCheckIsDirty.next(that.uuidData.serviceId); this.closeDialog(that); }); |