From 12226e5a7874dcc1d5b4cdb305188391b4b97cc5 Mon Sep 17 00:00:00 2001 From: Kruthi Bhat Date: Fri, 9 Oct 2020 00:37:39 +0530 Subject: Sorting functionality on audit info screen Change-Id: If2fed947ccc0cbcb68ad656fb6010aa9cb829acd Issue-ID: VID-904 Signed-off-by: rachitha.ramappa@att.com --- .../resume/feRequestResumeMacroService.json | 2 + .../vfmodule/delete_1_vfmodule_expected_bulk.json | 2 + .../upgrade_vfmodule_e2e__fe_input_cypress.json | 2 + ...ted_to_current_model_e2e__fe_input_cypress.json | 2 + .../ServiceWithVnfGroupsDeleteRequest.json | 2 + .../VnfGroupCreate1Delete1None1Request.json | 2 + ...With2VnfGroupsRequest_AndThreeGroupMembers.json | 2 + ...ayloadTemplate1VnfGroupWith3MembersRequest.json | 2 + .../vnfGroupWithExistingAndNewVnfMembers.json | 2 + .../vidRequestDelete1Create1Network.json | 2 + .../vidRequestDelete1Create1Vnf.json | 2 + .../integration/iFrames/auditInfo.modal.e2e.ts | 77 ++++++++++++++++++++-- .../jsonBuilders/mocks/jsons/flags.cypress.json | 3 +- .../cypress/support/jsonBuilders/mocks/vid.mock.ts | 15 +++++ .../auditInfoModal/auditInfoModal.component.ts | 12 ++++ 15 files changed, 124 insertions(+), 5 deletions(-) diff --git a/vid-app-common/src/test/resources/payload_jsons/resume/feRequestResumeMacroService.json b/vid-app-common/src/test/resources/payload_jsons/resume/feRequestResumeMacroService.json index c2c84dc9c..4c7f3cd71 100644 --- a/vid-app-common/src/test/resources/payload_jsons/resume/feRequestResumeMacroService.json +++ b/vid-app-common/src/test/resources/payload_jsons/resume/feRequestResumeMacroService.json @@ -38,6 +38,8 @@ "isALaCarte": false, "vnfs": {}, "vrfs": {}, + "pnfs": {}, + "existingPNFCounterMap": {}, "networks": {}, "vnfGroups": {}, "validationCounter": 0, diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/delete_1_vfmodule_expected_bulk.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/delete_1_vfmodule_expected_bulk.json index f7ba34cdc..49de22626 100644 --- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/delete_1_vfmodule_expected_bulk.json +++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/delete_1_vfmodule_expected_bulk.json @@ -1,6 +1,8 @@ { "action": "None", "isDirty": false, + "pnfs": {}, + "existingPNFCounterMap": {}, "vnfs": { "d520268f-7489-4662-be59-f81495b3a069": { "action": "None", diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json index c6f8b6f10..90525604c 100644 --- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json +++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_e2e__fe_input_cypress.json @@ -1,6 +1,8 @@ { "action": "None_Upgrade", "isDirty": true, + "pnfs": {}, + "existingPNFCounterMap": {}, "vnfs": { "d520268f-7489-4662-be59-f81495b3a069": { "action": "None_Upgrade", diff --git a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_not_related_to_current_model_e2e__fe_input_cypress.json b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_not_related_to_current_model_e2e__fe_input_cypress.json index 5ecd78868..0e3f97f72 100644 --- a/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_not_related_to_current_model_e2e__fe_input_cypress.json +++ b/vid-app-common/src/test/resources/payload_jsons/vfmodule/upgrade_vfmodule_not_related_to_current_model_e2e__fe_input_cypress.json @@ -6,6 +6,8 @@ "cloudOwner": null, "collectionResources": { }, + "pnfs": {}, + "existingPNFCounterMap": {}, "existingNames": { "pst-vf-phase-1": "" }, diff --git a/vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json b/vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json index 34805e1d4..583154aec 100644 --- a/vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json +++ b/vid-automation/src/test/resources/VnfGroup/ServiceWithVnfGroupsDeleteRequest.json @@ -2,6 +2,8 @@ "isDirty":true, "vnfs": {}, "vrfs": {}, + "pnfs": {}, + "existingPNFCounterMap": {}, "instanceParams": [], "validationCounter": 0, "existingNames": { diff --git a/vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json b/vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json index 88757da22..e3e9b8e56 100644 --- a/vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json +++ b/vid-automation/src/test/resources/VnfGroup/VnfGroupCreate1Delete1None1Request.json @@ -3,6 +3,8 @@ "isDirty": true, "vnfs": {}, "vrfs": {}, + "pnfs": {}, + "existingPNFCounterMap": {}, "instanceParams": [], "validationCounter": 0, "existingNames": { diff --git a/vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json b/vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json index 7dfe064d0..f424ba602 100644 --- a/vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json +++ b/vid-automation/src/test/resources/VnfGroup/deleteServiceWith2VnfGroupsRequest_AndThreeGroupMembers.json @@ -7,6 +7,8 @@ "existingNetworksCounterMap": {}, "vnfs": {}, "vrfs": {}, + "pnfs": {}, + "existingPNFCounterMap": {}, "vnfGroups": { "VNF_GROUP1_INSTANCE_ID": { "originalName": "groupingservicefortest..ResourceInstanceGroup..0", diff --git a/vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json b/vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json index 5d8843a8c..21efb3c3e 100644 --- a/vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json +++ b/vid-automation/src/test/resources/VnfGroup/payloadTemplate1VnfGroupWith3MembersRequest.json @@ -3,6 +3,8 @@ "isDirty": true, "vnfs": {}, "vrfs": {}, + "pnfs": {}, + "existingPNFCounterMap": {}, "instanceParams": [], "validationCounter": 0, "existingNames": { diff --git a/vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json b/vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json index aeaf6b65d..715c80c08 100644 --- a/vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json +++ b/vid-automation/src/test/resources/VnfGroup/vnfGroupWithExistingAndNewVnfMembers.json @@ -213,5 +213,7 @@ } }, "vnfs": {}, + "pnfs": {}, + "existingPNFCounterMap": {}, "vrfs": {} } \ No newline at end of file diff --git a/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Network.json b/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Network.json index af7ddd27c..5a32965b0 100644 --- a/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Network.json +++ b/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Network.json @@ -7,6 +7,8 @@ "vrfs":{ }, + "pnfs": {}, + "existingPNFCounterMap": {}, "instanceParams":[ { "2017488_pasqualevpe0_ASN":"AV_vPE" diff --git a/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json b/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json index 0dc9321fe..d8ee049c8 100644 --- a/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json +++ b/vid-automation/src/test/resources/asyncInstantiation/vidRequestDelete1Create1Vnf.json @@ -1,6 +1,8 @@ { "action": "None", "isDirty": true, + "pnfs": {}, + "existingPNFCounterMap": {}, "vnfs": { "2017-388_PASQUALE-vPE 0": { "vfModules": {}, diff --git a/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts index c28d77b79..d43b07ecb 100644 --- a/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts +++ b/vid-webpack-master/cypress/integration/iFrames/auditInfo.modal.e2e.ts @@ -22,7 +22,7 @@ describe('Audit information modal', function () { afterEach(() => { cy.screenshot(); - }); + }); it(`should display 2 tables with information's`, function () { cy.initAuditInfoMSOALaCarte(); @@ -81,18 +81,87 @@ describe('Audit information modal', function () { }); it('Refresh link should be visible and clicking refresh should fetch latest data', function () { - cy.initAuditInfoMSOALaCarte(); + cy.initAuditInfoMSOALaCarte(); cy.openIframe('app/ui/#/instantiationStatus'); cy.get('.instantiation-status-data tbody tr').each(function (row, index) { cy.get('.icon-menu').eq(index).click({force: true}).then(()=>{ cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(()=>{ cy.setViewportToSmallPopup(); - cy.get('#refreshButton').should('be.visible'); + cy.get('#refreshButton').should('be.visible') + cy.get('#refreshButton').click({force: true}).then(() => { + cy.initAuditInfoMSOALaCarteNew(); + }) }) - + }) }); }); + it('Check if the table data is sorted in descending order by start time', function () { + const expectedResult = getExpectedResult(); + cy.readFile('../vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarteNew.json').then((res) => { + cy.initAuditInfoMSOALaCarteNew(res); + cy.openIframe('app/ui/#/instantiationStatus'); + cy.get('.icon-menu').eq(7).click({force:true}).then(() => { + cy.getElementByDataTestsId('context-menu-audit-info').click({force:true}).then(() => { + cy.setViewportToSmallPopup(); + cy.get('#service-instantiation-audit-info-mso thead tr th#instanceName').should("be.visible") + .get('#service-instantiation-audit-info-mso tbody tr').each(function (row, index) { + assert.equal(row.find('#msoRequestId').text().trim(), expectedResult[index]['requestId']); + assert.equal(row.find('.msoInstanceName').text().trim(), expectedResult[index]['instanceName']); + assert.equal(row.find('#msostartTime').text().trim(), expectedResult[index]['startTime']); + }); + }); + }) + }); + }); + }); }); + + + +function getExpectedResult() { + return [ + { + "requestId": "1fc2ef3b-26f0-4e62-a00a-6a31502d39e2", + "instanceName": "zrdm54cfmgw01_sup_1", + "modelType": "vfModule", + "instanceType": "createInstance", + "startTime": "Mon, 24 Aug 2020 22:54:29 GMT", + "finishTime": "Mon, 24 Aug 2020 22:56:35 GMT", + "jobStatus": "ROLLED_BACK_TO_ASSIGNED", + "additionalInfo": "Source: VID
StatusMessage:STATUS: Error Source: OPENSTACK, Error Message: Received vfModuleException from VnfAdapter: category='INTERNAL' message='Exception during create VF 400 Bad Request: The server could not comply with the request since it is either malformed or otherwise incorrect., error.type=UserParameterMissing, error.message=The Parameter (VSFO_CP0_compute_node) was not provided.' rolledBack='true'
FlowStatus: All Rollback flows have completed successfully
TestAPI: GR_API
TenantId: ad299b37da30413391e9c28138f0b0cd
TenantName: FNCORE-30052-D-MC-RDM54c
CloudOwner: att-nc
" + }, + { + "requestId": "a4e43d9e-4813-42e4-94bf-c5c6f22ed0bc", + "instanceName": "zrdm54cfmgw01_base", + "modelType": "vfModule", + "instanceType": "createInstance", + "startTime": "Mon, 24 Aug 2020 22:44:42 GMT", + "finishTime": "Mon, 24 Aug 2020 22:54:17 GMT", + "jobStatus": "COMPLETE", + "additionalInfo": "Source: VID
StatusMessage:STATUS: ALaCarte-VfModule-createInstance request was executed correctly.
FlowStatus: Successfully completed all Building Blocks
TestAPI: GR_API
TenantId: ad299b37da30413391e9c28138f0b0cd
TenantName: FNCORE-30052-D-MC-RDM54c
CloudOwner: att-nc
" + }, + { + "requestId": "f1aa7175-c237-4b56-ba64-7cb728a38ff2", + "instanceName": "zrdm54cfmgw01", + "modelType": "vnf", + "instanceType": "createInstance", + "startTime": "Mon, 24 Aug 2020 22:38:18 GMT", + "finishTime": "Mon, 24 Aug 2020 22:44:24 GMT", + "jobStatus": "COMPLETE", + "additionalInfo": "Source: VID
StatusMessage:STATUS: ALaCarte-Vnf-createInstance request was executed correctly.
FlowStatus: Successfully completed all Building Blocks
TestAPI: GR_API
TenantId: ad299b37da30413391e9c28138f0b0cd
TenantName: FNCORE-30052-D-MC-RDM54c
CloudOwner: att-nc
PlatformName: FIRSTNET-DEDICATED,NETWORK-CLOUD
LineOfBusiness: FIRSTNET
" + }, + { + "requestId": "7ba7900c-3e51-4d87-b1b4-3c53bdfaaa7d", + "instanceName": "zrdm54cfmgw01_svc", + "modelType": "service", + "instanceType": "createInstance", + "startTime": "Mon, 24 Aug 2020 22:37:53 GMT", + "finishTime": "Mon, 24 Aug 2020 22:38:10 GMT", + "jobStatus": "COMPLETE", + "additionalInfo": "Source: VID
StatusMessage:STATUS: ALaCarte-Service-createInstance request was executed correctly.
FlowStatus: Successfully completed all Building Blocks
SubscriptionServiceType: FIRSTNET
Alacarte: true
TestAPI: GR_API
ProjectName: FIRSTNET
OwningEntityId: 10c645f5-9924-4b89-bec0-b17cf49d3cad
OwningEntityName: MOBILITY-CORE
" + } + ]; +} diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json index 41f65ff65..52e72504d 100644 --- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json @@ -33,5 +33,6 @@ "FLAG_2008_REMOVE_PAUSE_INSTANTIATION" : true, "FLAG_2008_DISABLE_DRAG_FOR_BASE_MODULE" : true, "FLAG_2008_CREATE_VFMODULE_INSTANTIATION_ORDER_NUMBER": true, - "FLAG_2011_EXPORT_MSO_STATUS": true + "FLAG_2011_EXPORT_MSO_STATUS": true, + "FLAG_EXTENDED_MACRO_PNF_CONFIG": false } diff --git a/vid-webpack-master/cypress/support/jsonBuilders/mocks/vid.mock.ts b/vid-webpack-master/cypress/support/jsonBuilders/mocks/vid.mock.ts index 2569556e2..2b2b36a64 100644 --- a/vid-webpack-master/cypress/support/jsonBuilders/mocks/vid.mock.ts +++ b/vid-webpack-master/cypress/support/jsonBuilders/mocks/vid.mock.ts @@ -7,6 +7,7 @@ declare namespace Cypress { initAuditInfoMSOALaCarte: typeof initAuditInfoMSOALaCarte; initAsyncInstantiation : typeof initAsyncInstantiation; mockLatestVersionForService : typeof mockLatestVersionForService; + initAuditInfoMSOALaCarteNew: typeof initAuditInfoMSOALaCarteNew; } } @@ -94,6 +95,19 @@ function initAuditInfoMSOALaCarte(response? : JSON, delay?: number, status?: num }) } +function initAuditInfoMSOALaCarteNew(response? : JSON, delay?: number, status?: number) : void { + cy.readFile('../vid-automation/src/test/resources/a-la-carte/auditInfoMSOALaCarteNew.json').then((res) => { + cy.server() + .route({ + method: 'GET', + delay : delay ? delay : 0, + status : status ? status : 200, + url : Cypress.config('baseUrl') + "/asyncInstantiation/auditStatus/**/mso**", + response : response ? response : res + }).as('initAuditInfoMSOALaCarteNew'); + }) +} + function initAsyncInstantiation(response? : JSON, delay?: number, status?: number) : void { cy.readFile('cypress/support/jsonBuilders/mocks/jsons/basicAsyncInstantiation.json').then((res) => { cy.server() @@ -137,6 +151,7 @@ Cypress.Commands.add('preventErrorsOnLoading', preventErrorsOnLoading); Cypress.Commands.add('initCategoryParameter', initCategoryParameter); Cypress.Commands.add('initAuditInfoMSO', initAuditInfoMSO); Cypress.Commands.add('initAuditInfoMSOALaCarte', initAuditInfoMSOALaCarte); +Cypress.Commands.add('initAuditInfoMSOALaCarteNew', initAuditInfoMSOALaCarteNew); Cypress.Commands.add('initAsyncInstantiation', initAsyncInstantiation); Cypress.Commands.add('mockLatestVersionForService', mockLatestVersionForService); diff --git a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts index d8d3c32ac..bd2d77d99 100644 --- a/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts +++ b/vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts @@ -151,6 +151,7 @@ export class AuditInfoModalComponent { .subscribe((res: AuditStatus[][]) => { this.vidInfoData = res[0]; this.msoInfoData = res[1]; + this.msoInfoData.sort(this.getSortOrder("startTime")); this.isLoading = false; }); } @@ -186,6 +187,17 @@ export class AuditInfoModalComponent { this.dataIsReady = true; } + + //Comparer Function + getSortOrder(timestamp) { + return (obj1, obj2) =>{ + + let firstObj = obj1[timestamp]; + let secondObj = obj2[timestamp]; + return ((secondObj < firstObj) ? -1 : ((secondObj > firstObj) ? 1 : 0)); + + } + } readOnlyRetryUrl = (): string => `../../serviceModels.htm?more#/servicePlanning/RETRY?serviceModelId=${this.serviceModelId}&jobId=${this.jobId}` -- cgit 1.2.3-korg