summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/shared/services/aaiService/aai.service.spec.ts
diff options
context:
space:
mode:
authorAmichai Hemli <ah0398@intl.att.com>2019-07-09 14:23:37 +0000
committerGerrit Code Review <gerrit@onap.org>2019-07-09 14:23:37 +0000
commit58d22b526418ffeb89337fed9e20406da420bc6f (patch)
tree4357c9cfe1c92d57ac0a3f90167cade7af505b95 /vid-webpack-master/src/app/shared/services/aaiService/aai.service.spec.ts
parent302b02a847e7aa8ccf3ff4bc14ff8a9cf67511b0 (diff)
parent97d9f66df456ef4573047a90baa3cc3ee4bfb0b7 (diff)
Merge changes Ib4430bf2,Icc0bdb9e,I2736b984
* changes: Merge from ecomp 718fd196 - Ext. Services Simulator Merge from ecomp 718fd196 - Integration Tests Merge from ecomp 718fd196 - Modern UI
Diffstat (limited to 'vid-webpack-master/src/app/shared/services/aaiService/aai.service.spec.ts')
-rw-r--r--vid-webpack-master/src/app/shared/services/aaiService/aai.service.spec.ts230
1 files changed, 176 insertions, 54 deletions
diff --git a/vid-webpack-master/src/app/shared/services/aaiService/aai.service.spec.ts b/vid-webpack-master/src/app/shared/services/aaiService/aai.service.spec.ts
index 9f19f6259..5cff00b7e 100644
--- a/vid-webpack-master/src/app/shared/services/aaiService/aai.service.spec.ts
+++ b/vid-webpack-master/src/app/shared/services/aaiService/aai.service.spec.ts
@@ -65,10 +65,10 @@ describe("AaiService", () => {
aaiService.retrieveServiceInstanceTopology(serviceInstanceId, subscriberId, serviceType).subscribe((result: ServiceInstance) => {
expect(result.instanceName).toEqual("mCaNkinstancename");
expect(result.modelInavariantId).toEqual("6b528779-44a3-4472-bdff-9cd15ec93450");
- expect(result.vnfs["2017-388_ADIOD-vPE 0"].instanceName).toEqual("2017388_ADIODvPEmCaNkinstanceName");
- expect(result.vnfs["2017-488_ADIOD-vPE 0"].
- vfModules["2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0"]
- ["2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0uvfot"].instanceName
+ expect(result.vnfs["2017-388_PASQUALE-vPE 0"].instanceName).toEqual("2017388_PASQUALEvPEmCaNkinstanceName");
+ expect(result.vnfs["2017-488_PASQUALE-vPE 0"].
+ vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"]
+ ["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot"].instanceName
).toEqual("VFinstancenameZERO");
});
@@ -88,10 +88,10 @@ describe("AaiService", () => {
aaiService.retrieveServiceInstanceRetryTopology(jobId).subscribe((result: ServiceInstance) => {
expect(result.instanceName).toEqual("mCaNkinstancename");
expect(result.modelInavariantId).toEqual("6b528779-44a3-4472-bdff-9cd15ec93450");
- expect(result.vnfs["2017-388_ADIOD-vPE 0"].instanceName).toEqual("2017388_ADIODvPEmCaNkinstanceName");
- expect(result.vnfs["2017-488_ADIOD-vPE 0"].
- vfModules["2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0"]
- ["2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0uvfot"].instanceName
+ expect(result.vnfs["2017-388_PASQUALE-vPE 0"].instanceName).toEqual("2017388_PASQUALEvPEmCaNkinstanceName");
+ expect(result.vnfs["2017-488_PASQUALE-vPE 0"].
+ vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"]
+ ["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot"].instanceName
).toEqual("VFinstancenameZERO");
});
@@ -104,9 +104,9 @@ describe("AaiService", () => {
describe('# get optional group members tests', () =>{
test('aai service get getOptionalGroupMembers and return list of VnfMember', () => {
jest.spyOn(store, 'dispatch');
- jest.spyOn(store, 'getState').mockReturnValue({
+ jest.spyOn(store, 'getState').mockReturnValue( <any>{
service :{
- serviceInstance : {
+ serviceInstance :{
"serviceModelId" : {
optionalGroupMembersMap : {}
}
@@ -132,6 +132,24 @@ describe("AaiService", () => {
req.flush(mockedResult);
});
});
+
+
+ describe('# get active networks', () =>{
+ test('aai service get active networks', () => {
+ const mockedResult = getMockActiveNetworks();
+ const cloudRegion: string = "cloudRegion";
+ const tenantId: string = "tenantId";
+ aaiService.retrieveActiveNetwork(cloudRegion, tenantId).subscribe((res)=>{
+ expect(res.length).toEqual(mockedResult.length);
+ });
+
+ const req = httpMock.expectOne(`${Constants.Path.AAI_GET_ACTIVE_NETWORKS_PATH}?cloudRegion=${cloudRegion}&tenantId=${tenantId}`);
+ expect(req.request.method).toEqual('GET');
+ req.flush(mockedResult);
+ });
+ });
+
+
describe('#cloud owner tests', () => {
let featureFlagToLcpRegionName = [
['aai service extract lcpRegion, flag is true=> lcp region include cloud owner', true, 'id (OWNER)' ],
@@ -158,38 +176,38 @@ describe("AaiService", () => {
function getTopology() {
return {
"vnfs": {
- "2017-388_ADIOD-vPE 0": {
+ "2017-388_PASQUALE-vPE 0": {
"vfModules": {},
"uuid": "afacccf6-397d-45d6-b5ae-94c39734b168",
"productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
- "lcpCloudRegionId": "JANET25",
+ "lcpCloudRegionId": "AAIAIC25",
"tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
"lineOfBusiness": "ONAP",
"platformName": "platform",
"modelInfo": {
"modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
"modelVersionId": "afacccf6-397d-45d6-b5ae-94c39734b168",
- "modelName": "2017-388_ADIOD-vPE",
+ "modelName": "2017-388_PASQUALE-vPE",
"modelVersion": "4.0",
"modelCustomizationId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
- "modelCustomizationName": "2017-388_ADIOD-vPE 0",
+ "modelCustomizationName": "2017-388_PASQUALE-vPE 0",
"uuid": "afacccf6-397d-45d6-b5ae-94c39734b168"
},
- "instanceName": "2017388_ADIODvPEmCaNkinstanceName",
+ "instanceName": "2017388_PASQUALEvPEmCaNkinstanceName",
"legacyRegion": "some legacy region"
},
- "2017-488_ADIOD-vPE 0": {
+ "2017-488_PASQUALE-vPE 0": {
"vfModules": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0uvfot": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot": {
"instanceName": "VFinstancenameZERO",
"modelInfo": {
"modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
"modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
- "modelName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "modelName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"modelVersion": "5",
"modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
},
"uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db",
@@ -198,8 +216,8 @@ describe("AaiService", () => {
"inMaint": true
}
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1fshmc": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc": {
"instanceName": "VFinstancename",
"volumeGroupName": "VFinstancename_vol_abc",
"orchStatus": "Create",
@@ -208,10 +226,10 @@ describe("AaiService", () => {
"modelInfo": {
"modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5",
- "modelName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"modelVersion": "6",
"modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
},
"uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
@@ -220,54 +238,54 @@ describe("AaiService", () => {
},
"uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
"productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
- "lcpCloudRegionId": "JANET25",
+ "lcpCloudRegionId": "AAIAIC25",
"tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
"lineOfBusiness": "ONAP",
"platformName": "platform",
"modelInfo": {
"modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
"modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
- "modelName": "2017-488_ADIOD-vPE",
+ "modelName": "2017-488_PASQUALE-vPE",
"modelVersion": "5.0",
"modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
- "modelCustomizationName": "2017-488_ADIOD-vPE 0",
+ "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
"uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09"
},
"orchStatus": "Created",
"inMaint": false,
- "instanceName": "2017488_ADIODvPEVNFinstancename",
+ "instanceName": "2017488_PASQUALEvPEVNFinstancename",
"legacyRegion": "some legacy region"
},
- "2017-488_ADIOD-vPE 0:0001": {
+ "2017-488_PASQUALE-vPE 0:0001": {
"vfModules": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0uvfot": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot": {
"instanceName": "VFinstancenameZERO_001",
"provStatus": "Prov Status",
"inMaint": true,
"modelInfo": {
"modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
"modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
- "modelName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "modelName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"modelVersion": "5",
"modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
},
"uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
}
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1fshmc": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc": {
"instanceName": "VFinstancename_001",
"volumeGroupName": "VFinstancename_vol_abc_001",
"modelInfo": {
"modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5",
- "modelName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"modelVersion": "6",
"modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
},
"uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
@@ -277,50 +295,50 @@ describe("AaiService", () => {
"uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
"productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
- "lcpCloudRegionId": "JANET25",
+ "lcpCloudRegionId": "AAIAIC25",
"tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
"lineOfBusiness": "ONAP",
"platformName": "platform",
"modelInfo": {
"modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
"modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
- "modelName": "2017-488_ADIOD-vPE",
+ "modelName": "2017-488_PASQUALE-vPE",
"modelVersion": "5.0",
"modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
- "modelCustomizationName": "2017-488_ADIOD-vPE 0",
+ "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
"uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09"
},
- "instanceName": "2017488_ADIODvPEVNFinstancename_001",
+ "instanceName": "2017488_PASQUALEvPEVNFinstancename_001",
"legacyRegion": "some legacy region"
},
- "2017-488_ADIOD-vPE 0:0002": {
+ "2017-488_PASQUALE-vPE 0:0002": {
"vfModules": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0uvfot": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot": {
"instanceName": "VFinstancenameZERO_002",
"modelInfo": {
"modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
"modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
- "modelName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "modelName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"modelVersion": "5",
"modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
"uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
},
"uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
}
},
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": {
- "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1fshmc": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
+ "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc": {
"instanceName": "VFinstancename_002",
"volumeGroupName": "VFinstancename_vol_abc_002",
"modelInfo": {
"modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
"modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5",
- "modelName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"modelVersion": "6",
"modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
- "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1",
+ "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
"uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
},
"uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
@@ -329,20 +347,20 @@ describe("AaiService", () => {
},
"uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
"productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
- "lcpCloudRegionId": "JANET25",
+ "lcpCloudRegionId": "AAIAIC25",
"tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
"lineOfBusiness": "ONAP",
"platformName": "platform",
"modelInfo": {
"modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
"modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
- "modelName": "2017-488_ADIOD-vPE",
+ "modelName": "2017-488_PASQUALE-vPE",
"modelVersion": "5.0",
"modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
- "modelCustomizationName": "2017-488_ADIOD-vPE 0",
+ "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
"uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09"
},
- "instanceName": "2017488_ADIODvPEVNFinstancename_002",
+ "instanceName": "2017488_PASQUALEvPEVNFinstancename_002",
"legacyRegion": "some legacy region"
}
},
@@ -380,6 +398,110 @@ describe("AaiService", () => {
}
}
+ function getMockActiveNetworks(){
+ return [
+ {
+ networkInstanceName: "networkInstanceName",
+ instanceVersion: "instanceVersion",
+ networkModel: "networkModel",
+ instanceUUID: "instanceUUID_1",
+ provStatus: "provStatus",
+ orchStatus: "orchStatus",
+ serviceInstanceName: "serviceInstanceName",
+ serviceUUID: "serviceUUID",
+ roles: ["network role 1", "network role 2"],
+ },
+ {
+ networkInstanceName: "networkInstanceName",
+ instanceVersion: "instanceVersion",
+ networkModel: "networkModel",
+ instanceUUID: "instanceUUID_2",
+ provStatus: "provStatus",
+ orchStatus: "orchStatus",
+ serviceInstanceName: "serviceInstanceName",
+ serviceUUID: "serviceUUID",
+ roles: ["network role 1", "network role 3"],
+ },
+ {
+ networkInstanceName: "networkInstanceName",
+ instanceVersion: "instanceVersion",
+ networkModel: "networkModel",
+ instanceUUID: "instanceUUID_3",
+ provStatus: "provStatus",
+ orchStatus: "orchStatus",
+ serviceInstanceName: "serviceInstanceName",
+ serviceUUID: "serviceUUID",
+ roles: ["network role 4", "network role 8"],
+ },
+ {
+ networkInstanceName: "networkInstanceName",
+ instanceVersion: "instanceVersion",
+ networkModel: "networkModel",
+ instanceUUID: "instanceUUID_4",
+ provStatus: "provStatus",
+ orchStatus: "orchStatus",
+ serviceInstanceName: "serviceInstanceName",
+ serviceUUID: "serviceUUID",
+ roles: [],
+ },
+ {
+ networkInstanceName: "networkInstanceName",
+ instanceVersion: "instanceVersion",
+ networkModel: "networkModel",
+ instanceUUID: "instanceUUID_5",
+ provStatus: "provStatus",
+ orchStatus: "orchStatus",
+ serviceInstanceName: "serviceInstanceName",
+ serviceUUID: "serviceUUID",
+ roles: ["network role 6", "network role 1"],
+ },
+ {
+ networkInstanceName: "networkInstanceName",
+ instanceVersion: "instanceVersion",
+ networkModel: "networkModel",
+ instanceUUID: "instanceUUID_6",
+ provStatus: "provStatus",
+ orchStatus: "orchStatus",
+ serviceInstanceName: "serviceInstanceName",
+ serviceUUID: "serviceUUID",
+ roles: ["network role 5"],
+ },
+ {
+ networkInstanceName: "networkInstanceName",
+ instanceVersion: "instanceVersion",
+ networkModel: "networkModel",
+ instanceUUID: "instanceUUID_7",
+ provStatus: "provStatus",
+ orchStatus: "orchStatus",
+ serviceInstanceName: "serviceInstanceName",
+ serviceUUID: "serviceUUID",
+ roles: ["network role 3"],
+ },
+ {
+ networkInstanceName: "networkInstanceName",
+ instanceVersion: "instanceVersion",
+ networkModel: "networkModel",
+ instanceUUID: "instanceUUID_8",
+ provStatus: "provStatus",
+ orchStatus: "orchStatus",
+ serviceInstanceName: "serviceInstanceName",
+ serviceUUID: "serviceUUID",
+ roles: ["network role 4"],
+ },
+ {
+ networkInstanceName: "networkInstanceName",
+ instanceVersion: "instanceVersion",
+ networkModel: "networkModel",
+ instanceUUID: "instanceUUID_9",
+ provStatus: "provStatus",
+ orchStatus: "orchStatus",
+ serviceInstanceName: "serviceInstanceName",
+ serviceUUID: "serviceUUID",
+ roles: [],
+ }
+ ]
+ }
+
const getMockMembers = (): any[] => {
return [
{