aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKruthi Bhat <krutbhat@att.com>2020-11-23 23:31:56 +0530
committerIkram Ikramullah <ikram@research.att.com>2020-11-25 22:40:59 +0000
commit3e558222d300ff70ff490914cc2245cf2a59e72a (patch)
treebd95cf9eebb9dc28ac64a4d31066f2e212265244
parente139ae6a162a7882d6d40203287a3e906a42564c (diff)
Prevent upgrade for base vf module with add on
Change-Id: Ie8139056ae560f734f2ae70d6a2ddb97f4c2dfaa Issue-ID: VID-925 Signed-off-by: krutbhat@att.com
-rw-r--r--vid-app-common/src/main/java/org/onap/vid/properties/Features.java3
-rw-r--r--vid-automation/src/main/java/vid/automation/test/infra/Features.java1
-rw-r--r--vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts39
-rw-r--r--vid-webpack-master/cypress/support/jsonBuilders/mocks/jsons/flags.cypress.json3
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts35
-rw-r--r--vid-webpack-master/src/app/shared/components/auditInfoModal/auditInfoModal.component.ts31
-rw-r--r--vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts3
7 files changed, 89 insertions, 26 deletions
diff --git a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
index ffb7f43b3..48b0d69ee 100644
--- a/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
+++ b/vid-app-common/src/main/java/org/onap/vid/properties/Features.java
@@ -104,7 +104,8 @@ public enum Features implements Feature {
FLAG_2008_REMOVE_PAUSE_INSTANTIATION,
FLAG_2008_PAUSE_VFMODULE_INSTANTIATION_FAILURE,
FLAG_2011_EXPORT_MSO_STATUS,
- FLAG_EXTENDED_MACRO_PNF_CONFIG;
+ FLAG_EXTENDED_MACRO_PNF_CONFIG,
+ FLAG_2012_UPGRADE_BASE_MODULE_FLAG;
public boolean isActive() {
return FeatureContext.getFeatureManager().isActive(this);
diff --git a/vid-automation/src/main/java/vid/automation/test/infra/Features.java b/vid-automation/src/main/java/vid/automation/test/infra/Features.java
index b6afed582..4d7919671 100644
--- a/vid-automation/src/main/java/vid/automation/test/infra/Features.java
+++ b/vid-automation/src/main/java/vid/automation/test/infra/Features.java
@@ -73,6 +73,7 @@ public enum Features implements Feature {
FLAG_2008_REMOVE_PAUSE_INSTANTIATION,
FLAG_2008_PAUSE_VFMODULE_INSTANTIATION_FAILURE,
FLAG_2011_EXPORT_MSO_STATUS,
+ FLAG_2012_UPGRADE_BASE_MODULE_FLAG,
;
public boolean isActive() {
return FeatureContext.getFeatureManager().isActive(this);
diff --git a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
index 7f469d889..9de94161f 100644
--- a/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
+++ b/vid-webpack-master/cypress/integration/iFrames/viewEditUpgradeVfModule.e2e.ts
@@ -281,6 +281,45 @@ describe('View Edit Page: Upgrade VFModule', function () {
});
});
});
+
+ it(`Upgrade a VFModule: Upgrade option should not be visible for the base module with add on`, function () {
+
+ const serviceType = 'Emanuel';
+ const subscriberId = 'a9a77d5a-123e-4ca2-9eb9-0b015d2ee0fb';
+ const serviceModelId = 'a243da28-c11e-45a8-9f26-0284a9a789bc';
+ const serviceInstanceId = 'b153e8ce-2d00-4466-adc0-14bad70f150c';
+ const serviceInvariantUuid = "dd5a69b7-c50c-4dde-adc2-966b79bb8fd6";
+
+ cy.initDrawingBoardUserPermission();
+
+ cy.route(`**/rest/models/services/${serviceModelId}`,
+ 'fixture:../support/jsonBuilders/mocks/jsons/upgradeVfModule/upgrade_vfmodule_when_service_vnf_and_brother_vfmodule_alredy_upgraded_e2e__service_model.json')
+ .as('serviceModel2');
+
+ cy.route(`**/aai_get_service_instance_topology/${subscriberId}/${serviceType}/${serviceInstanceId}`,
+ 'fixture:../support/jsonBuilders/mocks/jsons/upgradeVfModule/upgrade_vfmodule_when_service_vnf_and_brother_vfmodule_alredy_upgraded_e2e__service_instance.json')
+ .as('serviceInstance2');
+
+ cy.route(`**/aai_get_newest_model_version_by_invariant/${serviceInvariantUuid}`, {
+ "modelVersionId": "a243da28-c11e-45a8-9f26-0284a9a789bc",
+ "modelName": "CHARLOTTE 01222020 Svc",
+ "modelVersion": "3.0",
+ "distributionStatus": "DISTRIBUTION_COMPLETE_OK",
+ "resourceVersion": "1580246673596",
+ "modelDescription": "test model for VF module replacement",
+ "orchestrationType": null
+ }
+ ).as("newestModelVersion2");
+
+ cy.openIframe(`app/ui/#/servicePlanning/EDIT?serviceModelId=${serviceModelId}&subscriberId=${subscriberId}&serviceType=${serviceType}&serviceInstanceId=${serviceInstanceId}`);
+
+ cy.wait('@newestModelVersion2');
+ cy.getElementByDataTestsId('node-803fdb3e-b4c9-451c-a020-f15cd1fda041-CHARLOTTE 01222020 0-menu-btn').click({force: true}).then(() => {
+ cy.getElementByDataTestsId('context-menu-upgrade').should('not.exist');
+
+ });
+
+ });
});
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 52e72504d..09f17007f 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
@@ -34,5 +34,6 @@
"FLAG_2008_DISABLE_DRAG_FOR_BASE_MODULE" : true,
"FLAG_2008_CREATE_VFMODULE_INSTANTIATION_ORDER_NUMBER": true,
"FLAG_2011_EXPORT_MSO_STATUS": true,
- "FLAG_EXTENDED_MACRO_PNF_CONFIG": false
+ "FLAG_EXTENDED_MACRO_PNF_CONFIG": false,
+ "FLAG_2012_UPGRADE_BASE_MODULE_FLAG" :true
}
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
index 26776d05d..84703170f 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts
@@ -254,7 +254,10 @@ export class SharedTreeService {
isVfMoudleCouldBeUpgraded(node, serviceModelId): boolean{
return (FeatureFlagsService.getFlagState(Features.FLAG_FLASH_REPLACE_VF_MODULE, this._store) &&
- (this.isThereAnUpdatedLatestVersion(serviceModelId) || this.isVfModuleCustomizationIdNotExistsOnModel(node, serviceModelId)))
+ (this.isThereAnUpdatedLatestVersion(serviceModelId) || this.isVfModuleCustomizationIdNotExistsOnModel(node, serviceModelId)) &&
+ (this.upgradeAllowedForBm(node,serviceModelId)))
+
+
}
isVfModuleCustomizationIdNotExistsOnModel(vfModuleNode, serviceModelId) {
@@ -564,4 +567,34 @@ export class SharedTreeService {
isAddPositionFlagTrue():boolean{
return FeatureFlagsService.getFlagState(Features.FLAG_2008_CREATE_VFMODULE_INSTANTIATION_ORDER_NUMBER, this._store);
}
+
+ upgradeAllowedForBm(node, serviceModelId):boolean {
+
+ if(FeatureFlagsService.getFlagState(Features.FLAG_2012_UPGRADE_BASE_MODULE_FLAG, this._store)){
+ let returnValue = false;
+ if(node.data.type == 'VFmodule') {
+ let serviceHierarchy = this._store.getState().service.serviceHierarchy[serviceModelId];
+ let vnf = node.parent.data.modelName;
+ let baseModuleFlag= (serviceHierarchy.vnfs[vnf].vfModules[node.data.modelName].properties.baseModule) ? true: false;
+
+ if(baseModuleFlag) {
+ if(node.parent.children.length >1) {
+ return returnValue;
+ }
+ else {
+ returnValue = true;
+ }
+ }else {
+ returnValue = true;
+ }
+
+ } else {
+ returnValue= true
+ }
+
+ return returnValue;
+ } else {
+ return true;
+ }
+ }
}
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 27593cabf..df05fe2a6 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
@@ -59,11 +59,10 @@ export class AuditInfoModalComponent {
private spacetoUnderscore: SpaceToUnderscorePipe,
private store: NgRedux<AppState>) {
this.auditInfoModalComponentService = this._auditInfoModalComponentService;
- this.exportMSOStatusFeatureEnabled = _featureFlagsService.getFlagState(Features.FLAG_2011_EXPORT_MSO_STATUS);
AuditInfoModalComponent.openModal.subscribe((jobData: ServiceInfoModel) => {
this.isALaCarteFlagOn = this.store.getState().global.flags['FLAG_A_LA_CARTE_AUDIT_INFO'];
this.showMoreAuditInfoLink = _featureFlagsService.getFlagState(Features.FLAG_MORE_AUDIT_INFO_LINK_ON_AUDIT_INFO);
-
+ this.exportMSOStatusFeatureEnabled = _featureFlagsService.getFlagState(Features.FLAG_2011_EXPORT_MSO_STATUS);
this.initializeProperties();
this.showVidStatus = true;
if (jobData) {
@@ -85,6 +84,7 @@ export class AuditInfoModalComponent {
});
AuditInfoModalComponent.openInstanceAuditInfoModal.subscribe(({instanceId , type , model, instance}) => {
+ this.exportMSOStatusFeatureEnabled = _featureFlagsService.getFlagState(Features.FLAG_2011_EXPORT_MSO_STATUS);
this.showVidStatus = false;
this.showMoreAuditInfoLink = false;
this.isDrawingBoard = true;
@@ -95,11 +95,7 @@ export class AuditInfoModalComponent {
this.typeFromDrawingBoard = type;
this.callApi(instance, type);
-
- if(this.msoInfoData && Array.isArray(this.msoInfoData)) {
- this.sortMsoInfo();
- }
-
+ this.sortMsoInfo();
this.modelInfoItems = this.auditInfoModalComponentService.getModelInfo(model, instance, instanceId);
_iframeService.addClassOpenModal(this.parentElementClassName);
@@ -198,23 +194,14 @@ 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));
-
- }
- }
sortMsoInfo() {
- this.msoInfoData.sort(this.getSortOrder("startTime"));
- this.msoInfoData.forEach((element ) => {
- element.instanceColumn = element.instanceName + " | " +"<br>" + element.instanceId;
- });
+ if(this.msoInfoData && Array.isArray(this.msoInfoData)) {
+ this.msoInfoData.sort((a, b) => new Date(b.startTime).getTime() - new Date(a.startTime).getTime());
+ this.msoInfoData.forEach((element ) => {
+ element.instanceColumn = element.instanceName + " | " +"<br>" + element.instanceId;
+ });
+ }
}
callApi(instance, type) {
diff --git a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts
index 206738095..0135ff89b 100644
--- a/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts
+++ b/vid-webpack-master/src/app/shared/services/featureFlag/feature-flags.service.ts
@@ -28,7 +28,8 @@ export enum Features {
FLAG_2008_DISABLE_DRAG_FOR_BASE_MODULE ='FLAG_2008_DISABLE_DRAG_FOR_BASE_MODULE',
FLAG_2008_CREATE_VFMODULE_INSTANTIATION_ORDER_NUMBER ='FLAG_2008_CREATE_VFMODULE_INSTANTIATION_ORDER_NUMBER',
FLAG_2011_EXPORT_MSO_STATUS = 'FLAG_2011_EXPORT_MSO_STATUS',
- FLAG_EXTENDED_MACRO_PNF_CONFIG = 'FLAG_EXTENDED_MACRO_PNF_CONFIG'
+ FLAG_EXTENDED_MACRO_PNF_CONFIG = 'FLAG_EXTENDED_MACRO_PNF_CONFIG',
+ FLAG_2012_UPGRADE_BASE_MODULE_FLAG = 'FLAG_2012_UPGRADE_BASE_MODULE_FLAG'
}
@Injectable()