aboutsummaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/drawingBoard
diff options
context:
space:
mode:
authorIttay Stern <ittay.stern@att.com>2020-01-21 12:20:37 +0200
committerIttay Stern <ittay.stern@att.com>2020-01-21 15:48:40 +0200
commit6b1e53d593a958254481f2043f6da8c6c96d4a0b (patch)
tree69f66ce6d3961c66fec2fc55618a426776715604 /vid-webpack-master/src/app/drawingBoard
parentb96cada06214d609d32a38ca89d71cc53169324c (diff)
originalName may be model's "entry name", customizationId or invariantId
The classic originalName is the "entry name". So two more options were added through SharedTreeService::modelByIdentifier() function. Issue-ID: VID-724 Change-Id: I9f192d2b24c9c1659a95baabd21252bed392e9da 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/models/collectionResource/collectionResource.model.info.spec.ts9
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts2
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.spec.ts6
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts7
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts15
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.spec.ts13
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts7
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts2
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts7
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts18
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts2
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts2
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts4
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.spec.ts30
-rw-r--r--vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/shared.tree.service.ts19
15 files changed, 110 insertions, 33 deletions
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.spec.ts
index f8ce819f7..f3f951870 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.spec.ts
@@ -24,7 +24,7 @@ describe('Collection Resource Model Info', () => {
let collectionResourceModel: CollectionResourceModelInfo;
let _sharedTreeService : SharedTreeService;
- beforeEach(() => {
+ beforeEach(done => (async () => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, NgReduxTestingModule],
providers: [
@@ -38,16 +38,17 @@ describe('Collection Resource Model Info', () => {
FeatureFlagsService,
ComponentInfoService,
IframeService]
- }).compileComponents();
-
+ });
+ await TestBed.compileComponents();
injector = getTestBed();
_store = injector.get(NgRedux);
_componentInfoService = injector.get(ComponentInfoService);
+ _sharedTreeService = injector.get(SharedTreeService);
collectionResourceModel = new CollectionResourceModelInfo(_store, _sharedTreeService);
- });
+ })().then(done).catch(done.fail));
test('collection resource should be defined', () => {
expect(collectionResourceModel).toBeDefined();
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts
index 564e04bc2..339951de5 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/collectionResource/collectionResource.model.info.ts
@@ -30,7 +30,7 @@ export class CollectionResourceModelInfo implements ILevelNodeInfo{
getModel = (collectionResourceModelId: string, instance: CollectionResourceInstance, serviceHierarchy): CollectionResourceModel => {
const originalModelName = instance.originalName ? instance.originalName : collectionResourceModelId;
- return new CollectionResourceModel(serviceHierarchy[this.name][originalModelName]);
+ return new CollectionResourceModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
};
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.spec.ts
index 6b67de6aa..d1d6817bf 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.spec.ts
@@ -1,11 +1,12 @@
import {HttpClientTestingModule} from "@angular/common/http/testing";
-import {TestBed} from "@angular/core/testing";
+import {getTestBed, TestBed} from "@angular/core/testing";
import {MockNgRedux, NgReduxTestingModule} from "@angular-redux/store/testing";
import {DynamicInputsService} from "../../dynamicInputs.service";
import {ConfigurationModelInfo} from "./configuration.model.info";
import {SharedTreeService} from "../../shared.tree.service";
describe('Vnf Model Info', () => {
+ let injector;
let _dynamicInputsService : DynamicInputsService;
let _sharedTreeService : SharedTreeService;
@@ -18,6 +19,9 @@ describe('Vnf Model Info', () => {
DynamicInputsService]
});
await TestBed.compileComponents();
+
+ injector = getTestBed();
+ _sharedTreeService = injector.get(SharedTreeService);
})().then(done).catch(done.fail));
test('ConfigurationModelInfo should be defined', () => {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts
index 0d1a9aade..d9702b4c4 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/configuration/configuration.model.info.ts
@@ -31,10 +31,9 @@ export class ConfigurationModelInfo implements ILevelNodeInfo{
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (configurationModelId : string, serviceHierarchy) : any =>{
- if(!_.isNil(serviceHierarchy)){
- if(!_.isNil(serviceHierarchy[this.name]) && !_.isNil(serviceHierarchy[this.name][configurationModelId])){
- return serviceHierarchy[this.name][configurationModelId];
- }
+ const model = this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, configurationModelId);
+ if (!_.isNil(model)) {
+ return model;
}
return {};
};
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts
index b03d37f50..7c240a9b9 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/network/network.model.info.ts
@@ -7,7 +7,10 @@ import {SharedTreeService} from "../../shared.tree.service";
import {InputType} from "../../../../../shared/models/inputTypes";
import {NgRedux} from "@angular-redux/store";
import {AppState} from "../../../../../shared/store/reducers";
-import {GenericFormPopupComponent, PopupType} from "../../../../../shared/components/genericFormPopup/generic-form-popup.component";
+import {
+ GenericFormPopupComponent,
+ PopupType
+} from "../../../../../shared/components/genericFormPopup/generic-form-popup.component";
import {DialogService} from "ng2-bootstrap-modal";
import {NetworkPopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/network/network.popup.service";
import * as _ from "lodash";
@@ -18,7 +21,11 @@ import {changeInstanceCounter, removeInstance} from "../../../../../shared/store
import {IframeService} from "../../../../../shared/utils/iframe.service";
import {DuplicateService} from "../../../duplicate/duplicate.service";
import {ServiceInstanceActions} from "../../../../../shared/models/serviceInstanceActions";
-import {deleteActionNetworkInstance, undoDeleteActionNetworkInstance, updateNetworkPosition} from "../../../../../shared/storeUtil/utils/network/network.actions";
+import {
+ deleteActionNetworkInstance,
+ undoDeleteActionNetworkInstance,
+ updateNetworkPosition
+} from "../../../../../shared/storeUtil/utils/network/network.actions";
import {IModalConfig} from "onap-ui-angular/dist/modals/models/modal-config";
import {ComponentInfoType} from "../../../component-info/component-info-model";
import {ModelInformationItem} from "../../../../../shared/components/model-information/model-information.component";
@@ -65,7 +72,9 @@ export class NetworkModelInfo implements ILevelNodeInfo {
************************************************************/
getModel = (networkModelId: string, instance: NetworkInstance, serviceHierarchy): NetworkModel => {
const originalModelName = instance.originalName ? instance.originalName : networkModelId;
- return new NetworkModel(serviceHierarchy[this.name][originalModelName], this._featureFlagsService.getAllFlags());
+ return new NetworkModel(
+ this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName),
+ this._featureFlagsService.getAllFlags());
};
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.spec.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.spec.ts
index ca041e045..8a09372e0 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.spec.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.spec.ts
@@ -20,8 +20,9 @@ describe('PNF model info', () => {
let injector;
let _componentInfoService: ComponentInfoService;
let _store: NgRedux<AppState>;
- let pnfModel: PnfModelInfo = new PnfModelInfo();
- beforeEach(() => {
+ let _sharedTreeService;
+ let pnfModel: PnfModelInfo;
+ beforeEach(done => (async () => {
TestBed.configureTestingModule({
imports: [HttpClientTestingModule, NgReduxTestingModule],
providers: [
@@ -35,12 +36,14 @@ describe('PNF model info', () => {
FeatureFlagsService,
ComponentInfoService,
IframeService]
- }).compileComponents();
-
+ });
+ await TestBed.compileComponents();
injector = getTestBed();
_store = injector.get(NgRedux);
+ _sharedTreeService = injector.get(SharedTreeService);
+ pnfModel = new PnfModelInfo(_sharedTreeService);
_componentInfoService = injector.get(ComponentInfoService);
- });
+ })().then(done).catch(done.fail));
test('pnf model should be defined', () => {
expect(pnfModel).toBeDefined();
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts
index dc01b87ef..05e05a744 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/pnf/pnf.model.info.ts
@@ -6,11 +6,14 @@ import {AvailableNodeIcons} from "../../../available-models-tree/available-model
import {PnfInstance} from "app/shared/models/pnfInstance";
import {PNFModel} from "../../../../../shared/models/pnfModel";
import {PnfTreeNode} from "../../../../../shared/models/pnfTreeNode";
+import {SharedTreeService} from "../../shared.tree.service";
export class PnfModelInfo implements ILevelNodeInfo{
- constructor(){}
+ constructor(
+ private _sharedTreeService: SharedTreeService,
+ ){}
name: string = 'pnfs';
type: string ='PNF';
@@ -30,7 +33,7 @@ export class PnfModelInfo implements ILevelNodeInfo{
getModel = (pnfModelId: string, instance: PnfInstance, serviceHierarchy): PNFModel => {
const originalModelName = instance.originalName ? instance.originalName : pnfModelId;
- return new PNFModel(serviceHierarchy[this.name][originalModelName]);
+ return new PNFModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
};
getNextLevelObject(): any { return null; }
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts
index c8807e87d..86455ce60 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/relatedVnfMember/relatedVnfMember.info.model.ts
@@ -55,7 +55,7 @@ export class RelatedVnfMemberInfoModel implements ILevelNodeInfo {
************************************************************/
getModel = (vnfModelId: string, instance: VnfInstance, serviceHierarchy): VNFModel => {
const originalModelName = instance.originalName ? instance.originalName : vnfModelId;
- return new VNFModel(serviceHierarchy[this.name][originalModelName]);
+ return new VNFModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
};
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts
index 36b5ed072..1b92eb81b 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vfModule/vfModule.model.info.ts
@@ -79,10 +79,9 @@ export class VFModuleModelInfo implements ILevelNodeInfo {
* @param serviceHierarchy - serviceHierarchy
************************************************************/
getModel = (vfModuleModelId: string, instance, serviceHierarchy): Partial<VfModule> => {
- if (!_.isNil(serviceHierarchy)) {
- if (!_.isNil(serviceHierarchy[this.name]) && !_.isNil(serviceHierarchy[this.name][vfModuleModelId])) {
- return new VfModule(serviceHierarchy[this.name][vfModuleModelId], this._featureFlagsService.getAllFlags());
- }
+ const model = this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, vfModuleModelId);
+ if (!_.isNil(model)) {
+ return new VfModule(model, this._featureFlagsService.getAllFlags());
}
return {};
};
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts
index c3c33a1be..1215bb80e 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnf/vnf.model.info.ts
@@ -9,7 +9,10 @@ import {SharedTreeService} from "../../shared.tree.service";
import {NgRedux} from "@angular-redux/store";
import {AppState} from "../../../../../shared/store/reducers";
import {DefaultDataGeneratorService} from "../../../../../shared/services/defaultDataServiceGenerator/default.data.generator.service";
-import {GenericFormPopupComponent, PopupType} from "../../../../../shared/components/genericFormPopup/generic-form-popup.component";
+import {
+ GenericFormPopupComponent,
+ PopupType
+} from "../../../../../shared/components/genericFormPopup/generic-form-popup.component";
import {DialogService} from 'ng2-bootstrap-modal';
import {VnfPopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vnf/vnf.popup.service";
import {VfModulePopupService} from "../../../../../shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service";
@@ -17,13 +20,18 @@ import {ITreeNode} from "angular-tree-component/dist/defs/api";
import {AvailableNodeIcons} from "../../../available-models-tree/available-models-tree.service";
import {DuplicateService} from "../../../duplicate/duplicate.service";
import {DuplicateVnfComponent} from "../../../duplicate/duplicate-vnf.component";
-import {SdcUiServices} from "onap-ui-angular";
import {IframeService} from "../../../../../shared/utils/iframe.service";
import {changeInstanceCounter, removeInstance} from "../../../../../shared/storeUtil/utils/general/general.actions";
import {MessageBoxData} from "../../../../../shared/components/messageBox/messageBox.data";
import {MessageBoxService} from "../../../../../shared/components/messageBox/messageBox.service";
import {ServiceInstanceActions} from "../../../../../shared/models/serviceInstanceActions";
-import {deleteActionVnfInstance, undoDeleteActionVnfInstance, undoUpgradeVnf, updateVnfPosition, upgradeVnf} from "../../../../../shared/storeUtil/utils/vnf/vnf.actions";
+import {
+ deleteActionVnfInstance,
+ undoDeleteActionVnfInstance,
+ undoUpgradeVnf,
+ updateVnfPosition,
+ upgradeVnf
+} from "../../../../../shared/storeUtil/utils/vnf/vnf.actions";
import * as _ from 'lodash';
import {IModalConfig} from "onap-ui-angular/dist/modals/models/modal-config";
import {ComponentInfoType} from "../../../component-info/component-info-model";
@@ -81,7 +89,9 @@ export class VnfModelInfo implements ILevelNodeInfo {
************************************************************/
getModel = (vnfModelId: string, instance: VnfInstance, serviceHierarchy): VNFModel => {
const originalModelName = instance.originalName ? instance.originalName : vnfModelId;
- return new VNFModel(serviceHierarchy[this.name][originalModelName], this._featureFlagsService.getAllFlags());
+ return new VNFModel(
+ this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName),
+ this._featureFlagsService.getAllFlags());
};
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts
index 148ce22c7..fa785bc73 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vnfGrouping/vnfGrouping.model.info.ts
@@ -97,7 +97,7 @@ export class VnfGroupingModelInfo implements ILevelNodeInfo {
getModel(modelId: string, instance: any, serviceHierarchy): any {
const originalModelName = instance.originalName ? instance.originalName : modelId;
- return new VnfGroupModel(serviceHierarchy[this.name][originalModelName]);
+ return new VnfGroupModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
}
hasMissingData(instance, dynamicInputs: any, isEcompGeneratedNaming: boolean): boolean {
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts
index 3dbc60adb..03f60211c 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/models/vrf/vrf.model.info.ts
@@ -52,7 +52,7 @@ export class VrfModelInfo implements ILevelNodeInfo {
getModel = (vrfModelId: string, instance: VrfInstance, serviceHierarchy): VrfModel => {
const originalModelName = instance.originalName ? instance.originalName : vrfModelId;
- return new VrfModel(serviceHierarchy[this.name][originalModelName]);
+ return new VrfModel(this._sharedTreeService.modelByIdentifier(serviceHierarchy, this.name, originalModelName));
};
diff --git a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts
index 8eef4a08d..a70b7efeb 100644
--- a/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts
+++ b/vid-webpack-master/src/app/drawingBoard/service-planning/objectsToTree/objectToTree.service.ts
@@ -23,7 +23,7 @@ import {AaiService} from "../../../shared/services/aaiService/aai.service";
import {VrfModelInfo} from "./models/vrf/vrf.model.info";
import {NetworkStepService} from "./models/vrf/vrfModal/networkStep/network.step.service";
import {VpnStepService} from "./models/vrf/vrfModal/vpnStep/vpn.step.service";
-import { VfModuleUpgradePopupService } from "../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service";
+import {VfModuleUpgradePopupService} from "../../../shared/components/genericFormPopup/genericFormServices/vfModuleUpgrade/vfModule.upgrade.popuop.service";
import {FeatureFlagsService} from "../../../shared/services/featureFlag/feature-flags.service";
import {ModalService} from "../../../shared/components/customModal/services/modal.service";
@@ -56,7 +56,7 @@ export class ObjectToTreeService {
getFirstLevelOptions(): ILevelNodeInfo[] {
return [new VnfModelInfo(this._dynamicInputsService, this._sharedTreeService, this._defaultDataGeneratorService, this._dialogService, this._vnfPopupService, this._vfModulePopupService, this._vfModuleUpgradePopupService,this._duplicateService, this._modalService, this._iframeService, this._componentInfoService, this._featureFlagsService, this._store)
, new NetworkModelInfo(this._dynamicInputsService, this._sharedTreeService, this._dialogService, this._networkPopupService, this._duplicateService, this._modalService, this._iframeService, this._featureFlagsService, this._store),
- new PnfModelInfo(),
+ new PnfModelInfo(this._sharedTreeService),
new VrfModelInfo(this._store, this._sharedTreeService, this._dialogService, this._iframeService, this._featureFlagsService, this._networkStepService, this._vpnStepService),
new CollectionResourceModelInfo(this._store, this._sharedTreeService),
new ConfigurationModelInfo(this._dynamicInputsService, this._sharedTreeService),
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 f89950c61..87094e3bb 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
@@ -166,6 +166,36 @@ describe('Shared Tree Service', () => {
expect(MessageBoxService.openModal.next).toHaveBeenCalled();
});
+ each([
+ ['volumeGroups by entry name', "volumeGroups",
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1", "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1"],
+ ['vfmodule by customizationUuid', "vfModules",
+ "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401", "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1"],
+ ['vnf by customizationUuid', "vnfs",
+ "1da7b585-5e61-4993-b95e-8e6606c81e45", "2017-488_PASQUALE-vPE 0"],
+ ['vnfGroups by invariantUuid because no customizationUuid', "vnfGroups",
+ "4bb2e27e-ddab-4790-9c6d-1f731bc14a45", "groupingservicefortest..ResourceInstanceGroup..0"],
+ ]).test('modelByIdentifier should success: %s', (description, modelTypeName, modelUniqueIdOrName, expectedModelCustomizationName) => {
+ let serviceModelFromHierarchy =
+ getStore().service.serviceHierarchy["1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"];
+
+ expect(service.modelByIdentifier(serviceModelFromHierarchy, modelTypeName, modelUniqueIdOrName))
+ .toHaveProperty("modelCustomizationName", expectedModelCustomizationName);
+ });
+
+ each([
+ ['vfmodule by invariantUuid when there is customizationUuid', "vfModules", "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1"],
+ ['network by non-existing modelUniqueIdOrName', "networks", "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1"],
+ ['collectionResource has no resource', "collectionResources", "whatever"],
+ ['non-existing model-type', "fooBar", "whatever"],
+ ]).test('modelByIdentifier should fail: %s', (description, modelTypeName, modelUniqueIdOrName) => {
+ let serviceModelFromHierarchy =
+ getStore().service.serviceHierarchy["1a80c596-27e5-4ca9-b5bb-e03a7fd4c0fd"];
+
+ expect(service.modelByIdentifier(serviceModelFromHierarchy, modelTypeName, modelUniqueIdOrName))
+ .toBeUndefined();
+ });
+
test('openAuditInfoModal should open modal for failed instance', () => {
jest.spyOn(AuditInfoModalComponent.openInstanceAuditInfoModal, 'next');
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 1115d1bc6..6c985ec6a 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
@@ -54,6 +54,25 @@ export class SharedTreeService {
: (nodeInstance.modelInfo.modelCustomizationId || nodeInstance.modelInfo.modelInvariantId);
};
+ /**
+ * Finds a model inside a full service model
+ * @param serviceModelFromHierarchy
+ * @param modelTypeName "vnfs" | "networks" | "vfModules" | "collectionResources" | ...
+ * @param modelUniqueIdOrName Either an entry name (i.e. "originalName"), modelCustomizationId or modelInvariantId.
+ * Note that modelInvariantId will work only where model lacks a modelCustomizationId.
+ */
+ modelByIdentifier = (serviceModelFromHierarchy, modelTypeName: string, modelUniqueIdOrName: string): any => {
+ if (_.isNil(serviceModelFromHierarchy)) return undefined;
+
+ const modelsOfType = serviceModelFromHierarchy[modelTypeName];
+ if (_.isNil(modelsOfType)) return undefined;
+
+ const modelIfModelIdentifierIsEntryName = modelsOfType[modelUniqueIdOrName];
+ return _.isNil(modelIfModelIdentifierIsEntryName)
+ ? _.find(modelsOfType, o => (o.customizationUuid || o.invariantUuid) === modelUniqueIdOrName)
+ : modelIfModelIdentifierIsEntryName;
+ };
+
hasMissingData(instance, dynamicInputs: any, isEcompGeneratedNaming: boolean, requiredFields: string[]): boolean {
if (!isEcompGeneratedNaming && _.isEmpty(instance.instanceName)) {
return true;