aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-02-04 14:13:24 +0200
committerIttay Stern <ittay.stern@att.com>2020-02-04 15:13:22 +0200
commitf84164f29eb0c314580f0c44de3d513d9e7b0e5a (patch)
tree62a1b50a2dece5def3a8ea18965fe46a8bf6e370 /vid-webpack-master/src/app/drawingBoard
parentce9d4e748b56fab270f9a697e6705dc410650bd9 (diff)
upgrade VFM is not enabled when other VFM in the same VNF is already upgraded (fix)
Also fixes a bug in modelUniqueNameOrId when `instance` contains inner vfModule object. Issue-ID: VID-771 Change-Id: Ie7326780c968fe334dfe3888c518eeb5a8e1919f Signed-off-by: Ittay Stern <ittay.stern@att.com>
Diffstat (limited to 'vid-webpack-master/src/app/drawingBoard')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts3
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts28
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts59
3 files changed, 69 insertions, 21 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts
index 69d530d90..5cf6e96f7 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts
@@ -2586,6 +2586,7 @@ describe('Model Tree Generator service', () => {
{
"action": 'None',
"modelId": "afacccf6-397d-45d6-b5ae-94c39734b168",
+ "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
"modelCustomizationId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
"modelUniqueId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
"missingData": true,
@@ -2638,6 +2639,7 @@ describe('Model Tree Generator service', () => {
"parentType": 'VNF',
"action": 'None',
"modelId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
+ "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
"modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
"modelUniqueId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
"missingData": true,
@@ -2741,6 +2743,7 @@ describe('Model Tree Generator service', () => {
"parentType": '',
"action": 'None',
"modelId": "ddc3f20c-08b5-40fd-af72-c6d14636b986",
+ "modelInvariantId": "379f816b-a7aa-422f-be30-17114ff50b7c",
"modelCustomizationId": "94fdd893-4a36-4d70-b16a-ec29c54c184f",
"modelUniqueId": "94fdd893-4a36-4d70-b16a-ec29c54c184f",
"missingData": false,
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
index 2ff729d61..8905d4110 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts
@@ -340,13 +340,21 @@ describe('Shared Tree Service', () => {
});
- const isDiffCustomizationUuidProvider = [
- ['currentVfModule customizationUuid and customizationUuid vfModuleHierarchy are diff' ,true, 'mDNS 01222020 0', 'mdns012220200..Mdns01222020..base_dns..module-0', '82160e6e-d9c4-45ef-bd19-01573ab11b61'],
- ['currentVfModule customizationUuid and customizationUuid vfModuleHierarchy are same' , false, 'mDNS 01222020 0', 'mdns012220200..Mdns01222020..base_dns..module-0', 'c9b32003-febc-44e0-a97f-7630fa7fa4a0'],
- ['vnfHierarchy is not part of the current model' , true, 'VNF_NOT_PART_OF_THE_MODEL', 'mdns012220200..Mdns01222020..base_dns..module-0', 'c9b32003-febc-44e0-a97f-7630fa7fa4a0'],
- ['vfModuleHierarchy is not part of the current model', true, 'mDNS 01222020 1', 'VFM_NOT_PART_OF_THE_MODEL', 'c9b32003-febc-44e0-a97f-7630fa7fa4a0']];
+ const isVfmoduleAlmostPartOfModelOnlyCustomizationUuidDifferProvider = [
+ ['node is part of model, but vfmodule diff by customization',
+ true, 'mDNS 01222020 0', '9fdc68e9-9f53-431c-b8a2-7e337b9a0d0a', '82160e6e-d9c4-45ef-bd19-01573ab11b61'],
- each(isDiffCustomizationUuidProvider).test('isDiffCustomizationUuid: when %s should return %s', (description, expected, vnfModelName, vfModuleModelName, customizationUuid) => {
+ ['vnf model-name not found',
+ false, 'mDNS 01222020 1', '9fdc68e9-9f53-431c-b8a2-7e337b9a0d0a', '82160e6e-d9c4-45ef-bd19-01573ab11b61'],
+
+ ['vfmodule invariant-id not found',
+ false, 'mDNS 01222020 0', 'wrong invariant-id', '82160e6e-d9c4-45ef-bd19-01573ab11b61'],
+
+ ['vfmodule customization-id match',
+ false, 'mDNS 01222020 0', '9fdc68e9-9f53-431c-b8a2-7e337b9a0d0a', 'c9b32003-febc-44e0-a97f-7630fa7fa4a0'],
+ ];
+
+ each(isVfmoduleAlmostPartOfModelOnlyCustomizationUuidDifferProvider).test('isVfmoduleAlmostPartOfModelOnlyCustomizationUuidDiffer: when %s should return %s', (description, expected, vnfModelName, invariantUuid, customizationUuid) => {
const serviceModelId : string = 'a243da28-c11e-45a8-9f26-0284a9a789bc';
spyOn(store, 'getState').and.returnValue({
service : {
@@ -355,7 +363,8 @@ describe('Shared Tree Service', () => {
vnfs : {
[vnfModelName] : {
vfModules : {
- [vfModuleModelName] : {
+ vfModuleModelName : {
+ invariantUuid : invariantUuid,
customizationUuid : customizationUuid
}
}
@@ -368,8 +377,9 @@ describe('Shared Tree Service', () => {
const node = <any>{
data:{
+ modelInvariantId : '9fdc68e9-9f53-431c-b8a2-7e337b9a0d0a',
modelCustomizationId : 'c9b32003-febc-44e0-a97f-7630fa7fa4a0',
- modelName : vfModuleModelName
+ modelName : 'vfModuleModelName'
},
parent : {
data : {
@@ -378,7 +388,7 @@ describe('Shared Tree Service', () => {
}
};
- const isDiffCustomizationUuidResponse : boolean = service.isDiffCustomizationUuid(node, serviceModelId);
+ const isDiffCustomizationUuidResponse : boolean = service.isVfmoduleAlmostPartOfModelOnlyCustomizationUuidDiffer(node, serviceModelId);
expect(isDiffCustomizationUuidResponse).toEqual(expected);
});
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 964e1202f..9e7a0211e 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
@@ -53,8 +53,18 @@ export class SharedTreeService {
: (nodeInstance.modelInfo.modelCustomizationId || nodeInstance.modelInfo.modelInvariantId);
};
- modelUniqueNameOrId = (instance): string =>
- instance.originalName ? instance.originalName : this.modelUniqueId(instance);
+ modelUniqueNameOrId = (instance): string => {
+ if (_.isNil(instance)) {
+ return null;
+ }
+
+ const innerInstance = _.find(instance) || {};
+
+ return instance.originalName
+ || this.modelUniqueId(instance)
+ || innerInstance.originalName
+ || this.modelUniqueId(innerInstance);
+ };
/**
* Finds a model inside a full service model
@@ -207,7 +217,7 @@ export class SharedTreeService {
****************************************************/
shouldShowUpgrade(node, serviceModelId): boolean {
if (FeatureFlagsService.getFlagState(Features.FLAG_FLASH_REPLACE_VF_MODULE, this._store) &&
- (this.isThereAnUpdatedLatestVersion(serviceModelId)) || this.isDiffCustomizationUuid(node, serviceModelId)) {
+ (this.isThereAnUpdatedLatestVersion(serviceModelId)) || this.isVfmoduleAlmostPartOfModelOnlyCustomizationUuidDiffer(node, serviceModelId)) {
return this.shouldShowButtonGeneric(node, VNFMethods.UPGRADE, serviceModelId);
}
else {
@@ -216,18 +226,43 @@ export class SharedTreeService {
}
- isDiffCustomizationUuid(node, serviceModelId) : boolean {
- const vfModuleServiceHierarchy = this.getVfModuleHierarchyThroughParentModelName(node, serviceModelId);
- if(_.isNil(vfModuleServiceHierarchy)){
- return true;
+ isVfmoduleAlmostPartOfModelOnlyCustomizationUuidDiffer(vfModuleNode, serviceModelId) : boolean {
+ /*
+ for `true`, should all:
+ 1. parent vnf found by model-mane
+ 2. vfmodule found by invariant
+ 3. vfmodule diff by customization
+ */
+
+ if (_.isNil(vfModuleNode.data)) {
+ return false;
+ }
+
+ const vnfHierarchy = this.getParentVnfHierarchy(vfModuleNode, serviceModelId);
+ if (_.isNil(vnfHierarchy)) {
+ return false;
+ }
+
+ const vfModuleHierarchyByInvariantId = this.getVfModuleHFromVnfHierarchyByInvariantId(vfModuleNode, vnfHierarchy);
+ if(_.isNil(vfModuleHierarchyByInvariantId)){
+ return false;
+ }
+
+ return vfModuleHierarchyByInvariantId.customizationUuid
+ && (vfModuleHierarchyByInvariantId.customizationUuid !== vfModuleNode.data.modelCustomizationId);
+ }
+
+ getParentVnfHierarchy(vfModuleNode, serviceModelId) {
+ if (vfModuleNode.parent && vfModuleNode.parent.data) {
+ return this._store.getState().service.serviceHierarchy[serviceModelId].vnfs[vfModuleNode.parent.data.modelName];
+ } else {
+ return null;
}
- return node.data && !_.isNil(vfModuleServiceHierarchy) && vfModuleServiceHierarchy.customizationUuid && (vfModuleServiceHierarchy.customizationUuid !== node.data.modelCustomizationId);
}
- getVfModuleHierarchyThroughParentModelName(node, serviceModelId) {
- if(node.parent && node.parent.data && node.data){
- const vnfHierarchy = this._store.getState().service.serviceHierarchy[serviceModelId].vnfs[node.parent.data.modelName];
- return vnfHierarchy ? vnfHierarchy.vfModules[node.data.modelName] : null;
+ getVfModuleHFromVnfHierarchyByInvariantId(vfModuleNode, parentVnfHierarchy) {
+ if(vfModuleNode.data.modelInvariantId && parentVnfHierarchy && parentVnfHierarchy.vfModules){
+ return _.find(parentVnfHierarchy.vfModules, o => o.invariantUuid === vfModuleNode.data.modelInvariantId);
}
return null;
}