summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json4
-rw-r--r--vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json4
-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
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts8
-rw-r--r--vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts16
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts2
-rw-r--r--vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts2
21 files changed, 137 insertions, 42 deletions
diff --git a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json
index d2e1d6d07..15d506b47 100644
--- a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json
+++ b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_from_template__set_without_modify1.json
@@ -75,7 +75,7 @@
"action": "Create",
"instanceId": null,
"instanceName": "hvf6arlba007",
- "originalName": "vProbe_NC_VNF 0",
+ "originalName": "024a417d-ca46-40bf-95ce-809c6a269011",
"vnfStoreKey": "vProbe_NC_VNF 0",
"instanceParams": [
{
@@ -169,7 +169,7 @@
},
"productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
"instanceName": "hvf6arlba008",
- "originalName": "vProbe_NC_VNF 0",
+ "originalName": "024a417d-ca46-40bf-95ce-809c6a269011",
"vnfStoreKey": "vProbe_NC_VNF 0_1",
"action": "Create",
"platformName": "xxx1",
diff --git a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json
index 296ad311c..daccff0be 100644
--- a/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json
+++ b/vid-automation/src/test/resources/asyncInstantiation/templates__instance_template.json
@@ -45,7 +45,7 @@
},
"productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
"instanceName": "hvf6arlba007",
- "originalName": "vProbe_NC_VNF 0",
+ "originalName": "024a417d-ca46-40bf-95ce-809c6a269011",
"action": "Create",
"platformName": "xxx1",
"lcpCloudRegionId": "hvf6",
@@ -123,7 +123,7 @@
},
"productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
"instanceName": "hvf6arlba008",
- "originalName": "vProbe_NC_VNF 0",
+ "originalName": "024a417d-ca46-40bf-95ce-809c6a269011",
"action": "Create",
"platformName": "xxx1",
"lcpCloudRegionId": "hvf6",
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;
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts
index f3d32b9bb..b3bb1fe54 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.spec.ts
@@ -6,12 +6,17 @@ import {AaiService} from "../../../../services/aaiService/aai.service";
import {GenericFormService} from "../../generic-form.service";
import {FormBuilder} from "@angular/forms";
import {LogService} from "../../../../utils/log/log.service";
-import {FormControlModel, ValidatorModel, ValidatorOptions} from "../../../../models/formControlModels/formControl.model";
+import {
+ FormControlModel,
+ ValidatorModel,
+ ValidatorOptions
+} from "../../../../models/formControlModels/formControl.model";
import {FormControlNames, VfModuleControlGenerator} from "./vfModule.control.generator";
import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flags.service";
import {VfModuleInstance} from "../../../../models/vfModuleInstance";
import {VfModule} from "../../../../models/vfModule";
import {SharedControllersService} from "../sharedControlles/shared.controllers.service";
+import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
class MockAppStore<T> {
getState() {
@@ -925,6 +930,7 @@ describe('VFModule Control Generator', () => {
AaiService,
FormBuilder,
LogService,
+ SharedTreeService,
{provide:FeatureFlagsService, useClass: MockFeatureFlagsService},
{provide: NgRedux, useClass: MockAppStore}]
});
diff --git a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
index 60ffc3e96..b00312d5f 100644
--- a/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
+++ b/vid-webpack-master/src/app/shared/components/genericForm/formControlsServices/vfModuleGenerator/vfModule.control.generator.ts
@@ -20,6 +20,7 @@ import {VNFModel} from "../../../../models/vnfModel";
import {VnfInstance} from "../../../../models/vnfInstance";
import * as _ from 'lodash';
import {SharedControllersService} from "../sharedControlles/shared.controllers.service";
+import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
export enum FormControlNames {
INSTANCE_NAME = 'instanceName',
@@ -40,6 +41,7 @@ export class VfModuleControlGenerator {
constructor(private genericFormService: GenericFormService,
private _basicControlGenerator: ControlGeneratorUtil,
private _sharedControllersService: SharedControllersService,
+ private _sharedTreeService: SharedTreeService,
private store: NgRedux<AppState>,
private http: HttpClient,
private _aaiService: AaiService,
@@ -76,8 +78,7 @@ export class VfModuleControlGenerator {
const vfModuleInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getVfModuleInstance(serviceId, vnfStoreKey, uuidData, isUpdateMode));
const vfModuleModel = this.vfModuleModel;
const vnf: VnfInstance = this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey];
- const vnfModelName: string = vnf.originalName;
- const vnfModel = new VNFModel(this.store.getState().service.serviceHierarchy[serviceId].vnfs[vnfModelName]);
+ const vnfModel = this.newVNFModel(serviceId, vnf);
let result: FormControlModel[] = [];
@@ -90,6 +91,14 @@ export class VfModuleControlGenerator {
return result;
}
+ private newVNFModel(serviceId: string, vnf: VnfInstance) {
+ const vnfModelName: string = vnf.originalName;
+
+ const serviceModelFromHierarchy = this.store.getState().service.serviceHierarchy[serviceId];
+ const model = this._sharedTreeService.modelByIdentifier(serviceModelFromHierarchy, "vnfs", vnfModelName);
+ return new VNFModel(model);
+ }
+
pushInstanceAndVGToForm(result: FormControlModel[], vfModuleElement: any, serviceId: string, vnfModel: any, isALaCarte: boolean) :FormControlModel[]{
result.push(this.getInstanceName(vfModuleElement, serviceId, vnfModel.isEcompGeneratedNaming));
if (this.vfModuleModel.volumeGroupAllowed) {
@@ -108,8 +117,7 @@ export class VfModuleControlGenerator {
}
}
const vnf: VnfInstance = this.store.getState().service.serviceInstance[serviceId].vnfs[vnfStoreKey] ;
- const vnfModelName: string = vnf.originalName;
- const vnfModel = new VNFModel(this.store.getState().service.serviceHierarchy[serviceId].vnfs[vnfModelName]);
+ const vnfModel = this.newVNFModel(serviceId, vnf);
const vfModuleInstance = this._basicControlGenerator.retrieveInstanceIfUpdateMode(this.store, this.getVfModuleInstance(serviceId, vnfStoreKey, uuidData, isUpdateMode));
let result: FormControlModel[] = [];
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
index 9680c0655..e69cd5692 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/generic-form-popup.service.spec.ts
@@ -24,6 +24,7 @@ import {VfModuleUpgradePopupService} from "./genericFormServices/vfModuleUpgrade
import {SharedControllersService} from "../genericForm/formControlsServices/sharedControlles/shared.controllers.service";
import {AppState} from "../../store/reducers";
import each from 'jest-each';
+import {SharedTreeService} from "../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
class MockAppStore<T>{
getState() {
@@ -977,6 +978,7 @@ describe('Generic Form popup Service', () => {
VfModuleUpgradePopupService,
VfModuleControlGenerator,
FeatureFlagsService,
+ SharedTreeService,
{provide: ActivatedRoute, useClass: ActivatedRouteMock},
{provide: NgRedux, useClass: MockAppStore}]
});
diff --git a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts
index 85626528b..b8a592247 100644
--- a/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/components/genericFormPopup/genericFormServices/vfModule/vfModule.popup.service.spec.ts
@@ -14,6 +14,7 @@ import {FeatureFlagsService} from "../../../../services/featureFlag/feature-flag
import {getTestBed, TestBed} from "@angular/core/testing";
import {SharedControllersService} from "../../../genericForm/formControlsServices/sharedControlles/shared.controllers.service";
import {ModalService} from "../../../customModal/services/modal.service";
+import {SharedTreeService} from "../../../../../drawingBoard/service-planning/objectsToTree/shared.tree.service";
class MockModalService<T> {}
@@ -1993,6 +1994,7 @@ describe('VFModule popup service', () => {
AaiService,
LogService,
BasicPopupService,
+ SharedTreeService,
{provide:FeatureFlagsService, useClass: MockFeatureFlagsService},
{provide: NgRedux, useClass: MockReduxStore},
{provide: HttpClient, useClass: MockAppStore},