aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app
diff options
context:
space:
mode:
authorAlexey Sandler <alexey.sandler@intl.att.com>2020-02-29 22:11:26 +0200
committerAlexey Sandler <alexey.sandler@intl.att.com>2020-03-01 20:11:47 +0200
commit4e32415b9d34fcd8b18cf278b92c441e5044feab (patch)
tree8873834358afc4814df85fc90c82f342dcba4525 /vid-webpack-master/src/app
parentdecd21f501cbd5df2ec7436cce98b0a75f61ee29 (diff)
Component-info: show version and customization id from instance
Issue-ID: Issue-ID: VID-771 Change-Id: If172a0aa6555087edabff3c112c565a768169b5c Signed-off-by: Alexey Sandler <alexey.sandler@intl.att.com>
Diffstat (limited to 'vid-webpack-master/src/app')
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToInstanceTree/objectToInstanceTree.service.spec.ts28
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts92
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts31
-rw-r--r--vid-webpack-master/src/app/shared/models/treeNodeModel.ts3
4 files changed, 95 insertions, 59 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 43c3d2677..a81c86025 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
@@ -2592,6 +2592,15 @@ describe('Model Tree Generator service', () => {
"modelUniqueId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
"missingData": true,
"id": "u5mtsvzmq6p",
+ "instanceModelInfo": {
+ "modelCustomizationId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
+ "modelCustomizationName": "2017-388_PASQUALE-vPE 0",
+ "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
+ "modelName": "2017-388_PASQUALE-vPE",
+ "modelType": "VF",
+ "modelVersion": "4.0",
+ "modelVersionId": "afacccf6-397d-45d6-b5ae-94c39734b168"
+ },
"orchStatus": 'Active',
"provStatus": 'prov',
"inMaint": true,
@@ -2645,6 +2654,16 @@ describe('Model Tree Generator service', () => {
"modelUniqueId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
"missingData": true,
"id": "v2egx1b8i1l",
+ "instanceModelInfo": {
+ "modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
+ "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
+ "modelName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
+ "modelType": "VFmodule",
+ "modelUniqueId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
+ "modelVersion": "5",
+ "modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db"
+ },
"statusMessage": "Failed vfModel message",
"name": "&lt;Automatically Assigned&gt;",
"modelName": "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
@@ -2749,6 +2768,15 @@ describe('Model Tree Generator service', () => {
"modelUniqueId": "94fdd893-4a36-4d70-b16a-ec29c54c184f",
"missingData": false,
"id": "sf3zth68xjf",
+ "instanceModelInfo": {
+ "modelCustomizationId": "94fdd893-4a36-4d70-b16a-ec29c54c184f",
+ "modelCustomizationName": "ExtVL 0",
+ "modelInvariantId": "379f816b-a7aa-422f-be30-17114ff50b7c",
+ "modelName": "ExtVL",
+ "modelVersion": "37.0",
+ "modelVersionId": "ddc3f20c-08b5-40fd-af72-c6d14636b986",
+ "uuid": "ddc3f20c-08b5-40fd-af72-c6d14636b986"
+ },
"name": "&lt;Automatically Assigned&gt;",
"routeTargetId": "mock-global-1",
"routeTargetRole": "mock-role-x",
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 dc4c2d3de..c0a159142 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
@@ -44,6 +44,7 @@ import {VfModuleUpgradePopupService} from "../../../shared/components/genericFor
import {SharedControllersService} from "../../../shared/components/genericForm/formControlsServices/sharedControlles/shared.controllers.service";
import {ModalService} from "../../../shared/components/customModal/services/modal.service";
import {CreateDynamicComponentService} from "../../../shared/components/customModal/services/create-dynamic-component.service";
+import {instance} from "ts-mockito";
class MockAppStore<T> {
getState() {
@@ -251,11 +252,11 @@ describe('Shared Tree Service', () => {
let specificNetworkInfo = [
ModelInformationItem.createInstance('Network role', "network role 1, network role 2")
];
- const actualInfoModel: ComponentInfoModel = service.addGeneralInfoItems(specificNetworkInfo,ComponentInfoType.NETWORK, getNetworkModel(),getNetworkInstance());
+ const actualInfoModel: ComponentInfoModel = service.addGeneralInfoItems(specificNetworkInfo,ComponentInfoType.NETWORK, getNetworkModelInfoFromHierarchy(),getNetworkInstance());
let expectedGeneralInfo = [
- ModelInformationItem.createInstance('Model version', '37.0'),
- ModelInformationItem.createInstance('Model customization ID', '94fdd893-4a36-4d70-b16a-ec29c54c184f'),
+ ModelInformationItem.createInstance('Model version', '2.0'),
+ ModelInformationItem.createInstance('Model customization ID', 'customization-id-from-hierarchy'),
ModelInformationItem.createInstance('Instance ID', 'NETWORK4_INSTANCE_ID'),
ModelInformationItem.createInstance('Instance type', 'CONTRAIL30_HIMELGUARD'),
ModelInformationItem.createInstance('In maintenance', false),
@@ -264,6 +265,29 @@ describe('Shared Tree Service', () => {
expect(actualInfoModel.modelInfoItems).toEqual(expectedGeneralInfo);
});
+ each([
+ ['model version from hierarchy', null, getNetworkModelInfoFromHierarchy(), '2.0'],
+ ['undefined model', null, null, undefined],
+ ['model version from instance', getSelectedModelInfo(), null, '5.0'],
+ ['model version from instance', getSelectedModelInfo(), getNetworkModelInfoFromHierarchy(), '5.0'],
+ ]).
+ test ('getModelVersionEitherFromInstanceOrFromHierarchy should return %s ' ,
+ (description, instance, model, expectedResult) =>{
+ let actualResult = service.getModelVersionEitherFromInstanceOrFromHierarchy(instance, model);
+ expect(actualResult).toEqual(expectedResult);
+ });
+
+ each([
+ ['model CustomizationId from hierarchy', null, getNetworkModelInfoFromHierarchy(), 'customization-id-from-hierarchy'],
+ ['undefined model', null, null, undefined],
+ ['model CustomizationId from instance', getSelectedModelInfo(), null, 'model-customization-id-from-instance'],
+ ['model CustomizationId from instance', getSelectedModelInfo(), getNetworkModelInfoFromHierarchy(), 'model-customization-id-from-instance'],
+ ]).
+ test ('getCustomizationIdEitherFromInstanceOrFromHierarchy should return %s ' ,
+ (description, instance, model, expectedResult) =>{
+ let actualResult = service.getModelCustomizationIdEitherFromInstanceOrFromHierarchy(instance, model);
+ expect(actualResult).toEqual(expectedResult);
+ });
test('statusProperties should be prop on node according to node properties', () => {
let node = service.addingStatusProperty({orchStatus: 'completed', provStatus: 'inProgress', inMaint: false});
@@ -1506,62 +1530,26 @@ function getStore() {
}
}
-function getNetworkModel(){
- return {
- "customizationUuid":"94fdd893-4a36-4d70-b16a-ec29c54c184f",
- "name":"ExtVL",
- "version":"37.0",
- "description":"ECOMP generic virtual link (network) base type for all other service-level and global networks",
- "uuid":"ddc3f20c-08b5-40fd-af72-c6d14636b986",
- "invariantUuid":"379f816b-a7aa-422f-be30-17114ff50b7c",
- "max":1,
- "min":0,
- "isEcompGeneratedNaming":false,
- "type":"VL",
- "modelCustomizationName":"ExtVL 0",
- "roles":["network role 1"," network role 2"],
- "properties":{
- "network_role":"network role 1, network role 2",
- "network_assignments":
- "{is_external_network=false, ipv4_subnet_default_assignment={min_subnets_count=1}, ecomp_generated_network_assignment=false, ipv6_subnet_default_assignment={min_subnets_count=1}}",
- "exVL_naming":"{ecomp_generated_naming=true}","network_flows":"{is_network_policy=false, is_bound_to_vpn=false}",
- "network_homing":"{ecomp_selected_instance_node_target=false}"
- }
- };
+function getNetworkModelInfoFromHierarchy(){
+ return {
+ "version": "2.0",
+ "customizationUuid":"customization-id-from-hierarchy"
+ }
}
+function getSelectedModelInfo() {
+ return {
+ "instanceModelInfo": {
+ "modelVersion": "5.0",
+ "modelCustomizationId": "model-customization-id-from-instance"
+ }
+ }
+}
function getNetworkInstance() {
return {
- "modelCustomizationId": "94fdd893-4a36-4d70-b16a-ec29c54c184f",
- "modelId": "ddc3f20c-08b5-40fd-af72-c6d14636b986",
- "modelUniqueId": "94fdd893-4a36-4d70-b16a-ec29c54c184f",
- "missingData": true,
- "id": "NETWORK4_INSTANCE_ID",
- "action": "None",
- "orchStatus": "Created",
- "provStatus": "preprov",
"inMaint": false,
"instanceId": "NETWORK4_INSTANCE_ID",
"instanceType": "CONTRAIL30_HIMELGUARD",
- "instanceName": "NETWORK4_INSTANCE_NAME",
- "name": "NETWORK4_INSTANCE_NAME",
- "modelName": "ExtVL 0",
- "type": "VL",
- "isEcompGeneratedNaming": false,
- "networkStoreKey": "NETWORK4_INSTANCE_ID",
- "typeName": "N",
- "menuActions": {"edit": {}, "showAuditInfo": {}, "duplicate": {}, "remove": {}, "delete": {}, "undoDelete": {}},
- "isFailed": false,
- "statusMessage": "",
- "statusProperties": [{"key": "Prov Status:", "value": "preprov", "testId": "provStatus"}, {
- "key": "Orch Status:",
- "value": "Created",
- "testId": "orchStatus"
- }],
- "trackById": "1wvr73xl999",
- "parentType": "",
- "componentInfoType": "Network",
- "errors": {}
};
}
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 864472505..d543991b5 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
@@ -477,17 +477,34 @@ export class SharedTreeService {
});
}
+ getModelVersionEitherFromInstanceOrFromHierarchy(selectedNodeData, model): string | undefined {
+ if (selectedNodeData && selectedNodeData.instanceModelInfo && selectedNodeData.instanceModelInfo.modelVersion) {
+ return selectedNodeData.instanceModelInfo.modelVersion;
+ } else if (model && model.version) {
+ return model.version;
+ }
+ return undefined;
+ }
+
+ getModelCustomizationIdEitherFromInstanceOrFromHierarchy(selectedNodeData, model): string | undefined {
+ if (selectedNodeData && selectedNodeData.instanceModelInfo && selectedNodeData.instanceModelInfo.modelCustomizationId) {
+ return selectedNodeData.instanceModelInfo.modelCustomizationId;
+ } else if (model && model.customizationUuid) {
+ return model.customizationUuid;
+ }
+ return undefined;
+ }
- addGeneralInfoItems(modelInfoSpecificItems: ModelInformationItem[], type: ComponentInfoType, model, instance):ComponentInfoModel {
+ addGeneralInfoItems(modelInfoSpecificItems: ModelInformationItem[], type: ComponentInfoType, model, selectedNodeData):ComponentInfoModel {
let modelInfoItems: ModelInformationItem[] = [
- ModelInformationItem.createInstance("Model version", model ? model.version : null),
- ModelInformationItem.createInstance("Model customization ID", model ? model.customizationUuid : null),
- ModelInformationItem.createInstance("Instance ID", instance ? instance.instanceId : null),
- ModelInformationItem.createInstance("Instance type", instance ? instance.instanceType : null),
- ModelInformationItem.createInstance("In maintenance", instance? instance.inMaint : null),
+ ModelInformationItem.createInstance("Model version", this.getModelVersionEitherFromInstanceOrFromHierarchy(selectedNodeData, model)),
+ ModelInformationItem.createInstance("Model customization ID", this.getModelCustomizationIdEitherFromInstanceOrFromHierarchy(selectedNodeData, model)),
+ ModelInformationItem.createInstance("Instance ID", selectedNodeData ? selectedNodeData.instanceId : null),
+ ModelInformationItem.createInstance("Instance type", selectedNodeData ? selectedNodeData.instanceType : null),
+ ModelInformationItem.createInstance("In maintenance", selectedNodeData? selectedNodeData.inMaint : null),
];
modelInfoItems = modelInfoItems.concat(modelInfoSpecificItems);
- return this.getComponentInfoModelByModelInformationItems(modelInfoItems, type, instance);
+ return this.getComponentInfoModelByModelInformationItems(modelInfoItems, type, selectedNodeData);
}
getComponentInfoModelByModelInformationItems(modelInfoItems: ModelInformationItem[], type: ComponentInfoType, instance){
diff --git a/vid-webpack-master/src/app/shared/models/treeNodeModel.ts b/vid-webpack-master/src/app/shared/models/treeNodeModel.ts
index 8da204ce6..d25850dbb 100644
--- a/vid-webpack-master/src/app/shared/models/treeNodeModel.ts
+++ b/vid-webpack-master/src/app/shared/models/treeNodeModel.ts
@@ -3,6 +3,7 @@ import {NodeModel} from "./nodeModel";
import {ServiceNodeTypes} from "./ServiceNodeTypes";
import * as _ from 'lodash';
import {ServiceInstanceActions} from "./serviceInstanceActions";
+import {ModelInfo} from "./modelInfo";
export enum TreeLevel {
Level_0 , Level_1, Level_2
@@ -23,6 +24,7 @@ export class TreeNodeModel {
id: string;
name: string;
modelName: string;
+ instanceModelInfo?: ModelInfo;
missingData: boolean;
isEcompGeneratedNaming: boolean;
orchStatus?:string;
@@ -36,6 +38,7 @@ export class TreeNodeModel {
constructor(instance: ChildNodeInstance, nodeModel: NodeModel){
this.modelInvariantId = nodeModel.invariantUuid;
+ this.instanceModelInfo = instance.modelInfo;
if (instance.modelInfo) {
this.modelCustomizationId = instance.modelInfo.modelCustomizationId;
this.modelId = instance.modelInfo.modelVersionId;