blob: f563cbc75e4ec5e0075b00b68d8d6f291c24ebc6 [file] [log] [blame]
Ittay Stern6f900cc2018-08-29 17:01:32 +03001import {ServiceInstance} from "../../models/serviceInstance";
2import {RootObject} from "./model/crawledAaiService";
3import {AaiService} from "./aai.service";
4import {instance, mock, when} from "ts-mockito";
5import {FeatureFlagsService, Features} from "../featureFlag/feature-flags.service";
6import {HttpClientTestingModule, HttpTestingController} from "@angular/common/http/testing";
7import {getTestBed, TestBed} from "@angular/core/testing";
8import {NgRedux} from "@angular-redux/store";
9import {Constants} from "../../utils/constants";
10import {AppState} from "../../store/reducers";
11import {setOptionalMembersVnfGroupInstance} from "../../storeUtil/utils/vnfGroup/vnfGroup.actions";
12import each from 'jest-each';
13
14class MockAppStore<T> {
15 dispatch(){}
16 getState(){}
17}
18
19describe("AaiService", () => {
20
21 let injector;
22 let httpMock: HttpTestingController;
23 let aaiService: AaiService;
24 let mockFeatureFlagsService: FeatureFlagsService = mock(FeatureFlagsService);
25 let store : NgRedux<AppState>;
26
27 beforeAll(done => (async () => {
28 TestBed.configureTestingModule({
29 imports: [HttpClientTestingModule],
30 providers: [
31 AaiService,
32 {provide: NgRedux, useClass: MockAppStore},
33 {provide: FeatureFlagsService, useValue: instance(mockFeatureFlagsService)}
34 ]
35 });
36 await TestBed.compileComponents();
37
38 injector = getTestBed();
39 httpMock = injector.get(HttpTestingController);
40 aaiService = injector.get(AaiService);
41 store = injector.get(NgRedux);
42
43 })().then(done).catch(done.fail));
44
45
46
47 describe('#resolve tests', () => {
48 test('aai service resolve should return the right object', () => {
49 let serviceInstance = new ServiceInstance();
50 aaiService.resolve(aaiServiceInstnace.root, serviceInstance);
51
52 expectedResult.vnfs['DROR_vsp'].trackById = serviceInstance.vnfs['DROR_vsp'].trackById;
53 expect(JSON.parse(JSON.stringify(serviceInstance.vnfs))).toEqual(expectedResult.vnfs);
54 expect(JSON.parse(JSON.stringify(serviceInstance.networks))).toEqual(expectedResult.networks);
55 });
56 });
57
58 describe('#serviceInstanceTopology tests', () => {
59 test('aai service get serviceInstanceTopolgetServiceInstanceTopologyResult.jsonogy from backend, and return ServiceInstance', () => {
60
61 const mockedResult = getTopology();
62 const serviceInstanceId: string = "id";
63 const subscriberId: string = "fakeSunId";
64 const serviceType: string = "justServiceType";
65 aaiService.retrieveServiceInstanceTopology(serviceInstanceId, subscriberId, serviceType).subscribe((result: ServiceInstance) => {
66 expect(result.instanceName).toEqual("mCaNkinstancename");
67 expect(result.modelInavariantId).toEqual("6b528779-44a3-4472-bdff-9cd15ec93450");
Ittay Sternf7926712019-07-07 19:23:03 +030068 expect(result.vnfs["2017-388_PASQUALE-vPE 0"].instanceName).toEqual("2017388_PASQUALEvPEmCaNkinstanceName");
69 expect(result.vnfs["2017-488_PASQUALE-vPE 0"].
70 vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"]
71 ["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot"].instanceName
Ittay Stern6f900cc2018-08-29 17:01:32 +030072 ).toEqual("VFinstancenameZERO");
73 });
74
75 const req = httpMock.expectOne(`${Constants.Path.AAI_GET_SERVICE_INSTANCE_TOPOLOGY_PATH}${subscriberId}/${serviceType}/${serviceInstanceId}`);
76 expect(req.request.method).toEqual('GET');
77 req.flush(mockedResult);
78 });
79 });
80
81
82 describe('#retrieveAndStoreServiceInstanceRetryTopology tests', () => {
83 test('aai service get retrieveAndStoreServiceInstanceRetryTopology.jsonogy from backend, and return ServiceInstance', () => {
84
85 let mockedResult = getTopology();
86
87 const jobId: string = "jobId";
88 aaiService.retrieveServiceInstanceRetryTopology(jobId).subscribe((result: ServiceInstance) => {
89 expect(result.instanceName).toEqual("mCaNkinstancename");
90 expect(result.modelInavariantId).toEqual("6b528779-44a3-4472-bdff-9cd15ec93450");
Ittay Sternf7926712019-07-07 19:23:03 +030091 expect(result.vnfs["2017-388_PASQUALE-vPE 0"].instanceName).toEqual("2017388_PASQUALEvPEmCaNkinstanceName");
92 expect(result.vnfs["2017-488_PASQUALE-vPE 0"].
93 vfModules["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0"]
94 ["2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot"].instanceName
Ittay Stern6f900cc2018-08-29 17:01:32 +030095 ).toEqual("VFinstancenameZERO");
96 });
97
98 const req = httpMock.expectOne(`${Constants.Path.SERVICES_RETRY_TOPOLOGY}/${jobId}`);
99 expect(req.request.method).toEqual('GET');
100 req.flush(mockedResult);
101 });
102 });
103
104 describe('# get optional group members tests', () =>{
105 test('aai service get getOptionalGroupMembers and return list of VnfMember', () => {
106 jest.spyOn(store, 'dispatch');
Ittay Sternf7926712019-07-07 19:23:03 +0300107 jest.spyOn(store, 'getState').mockReturnValue( <any>{
Ittay Stern6f900cc2018-08-29 17:01:32 +0300108 service :{
Ittay Sternf7926712019-07-07 19:23:03 +0300109 serviceInstance :{
Ittay Stern6f900cc2018-08-29 17:01:32 +0300110 "serviceModelId" : {
111 optionalGroupMembersMap : {}
112 }
113 }
114 }
115 });
116 const mockedResult = getMockMembers();
117 const serviceInvariantId: string = "serviceInvariantId";
118 const subscriberId: string = "subscriberId";
119 const serviceType: string = "serviceType";
120 const groupType: string = "groupType";
121 const groupRole: string = "groupRole";
122 const serviceModelId: string = "serviceModelId";
123 aaiService.getOptionalGroupMembers(serviceModelId, subscriberId, serviceType, serviceInvariantId, groupType, groupRole).subscribe((res)=>{
124 const path = `${Constants.Path.AAI_GET_SERVICE_GROUP_MEMBERS_PATH}${subscriberId}/${serviceType}/${serviceInvariantId}/${groupType}/${groupRole}`;
125 expect(store.dispatch).toHaveBeenCalledWith(setOptionalMembersVnfGroupInstance(serviceModelId, path, res));
126 expect(res.length).toEqual(2);
127 });
128
129
130 const req = httpMock.expectOne(`${Constants.Path.AAI_GET_SERVICE_GROUP_MEMBERS_PATH}${subscriberId}/${serviceType}/${serviceInvariantId}/${groupType}/${groupRole}`);
131 expect(req.request.method).toEqual('GET');
132 req.flush(mockedResult);
133 });
134 });
Ittay Sternf7926712019-07-07 19:23:03 +0300135
136
137 describe('# get active networks', () =>{
138 test('aai service get active networks', () => {
139 const mockedResult = getMockActiveNetworks();
140 const cloudRegion: string = "cloudRegion";
141 const tenantId: string = "tenantId";
142 aaiService.retrieveActiveNetwork(cloudRegion, tenantId).subscribe((res)=>{
143 expect(res.length).toEqual(mockedResult.length);
144 });
145
146 const req = httpMock.expectOne(`${Constants.Path.AAI_GET_ACTIVE_NETWORKS_PATH}?cloudRegion=${cloudRegion}&tenantId=${tenantId}`);
147 expect(req.request.method).toEqual('GET');
148 req.flush(mockedResult);
149 });
150 });
151
152
Ittay Stern6f900cc2018-08-29 17:01:32 +0300153 describe('#cloud owner tests', () => {
154 let featureFlagToLcpRegionName = [
155 ['aai service extract lcpRegion, flag is true=> lcp region include cloud owner', true, 'id (OWNER)' ],
156 ['aai service extract lcpRegion, flag is false=> lcp region doesnt include cloud owner', false, 'id']
157 ];
158
159 each(featureFlagToLcpRegionName).test("%s", (desc: string, flag: boolean, expectedName: string ) => {
160 when(mockFeatureFlagsService.getFlagState(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST)).thenReturn(flag);
161 let name: string = aaiService.extractLcpRegionName("id", "att-owner");
162 expect(name).toEqual(expectedName);
163 });
164
165 let cloudOwnerFormattingDataProvider = [
166 ['classic cloud owner', 'irma-aic', ' (AIC)'],
167 ['upper case cloud owner', 'IRMA-AIC', ' (AIC)'],
168 ['no att cloud owner', 'nc', ' (NC)'],
169 ];
170
171 each(cloudOwnerFormattingDataProvider).test('test cloudOwner trailer formatting %s', (desc: string, cloudOwner: string, expectedTrailer: string) => {
172 expect(AaiService.formatCloudOwnerTrailer(cloudOwner)).toEqual(expectedTrailer);
173 });
174 });
175
176 function getTopology() {
177 return {
178 "vnfs": {
Ittay Sternf7926712019-07-07 19:23:03 +0300179 "2017-388_PASQUALE-vPE 0": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300180 "vfModules": {},
181 "uuid": "afacccf6-397d-45d6-b5ae-94c39734b168",
182 "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
Ittay Sternf7926712019-07-07 19:23:03 +0300183 "lcpCloudRegionId": "AAIAIC25",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300184 "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
185 "lineOfBusiness": "ONAP",
186 "platformName": "platform",
187 "modelInfo": {
188 "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
189 "modelVersionId": "afacccf6-397d-45d6-b5ae-94c39734b168",
Ittay Sternf7926712019-07-07 19:23:03 +0300190 "modelName": "2017-388_PASQUALE-vPE",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300191 "modelVersion": "4.0",
192 "modelCustomizationId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c",
Ittay Sternf7926712019-07-07 19:23:03 +0300193 "modelCustomizationName": "2017-388_PASQUALE-vPE 0",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300194 "uuid": "afacccf6-397d-45d6-b5ae-94c39734b168"
195 },
Ittay Sternf7926712019-07-07 19:23:03 +0300196 "instanceName": "2017388_PASQUALEvPEmCaNkinstanceName",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300197 "legacyRegion": "some legacy region"
198 },
Ittay Sternf7926712019-07-07 19:23:03 +0300199 "2017-488_PASQUALE-vPE 0": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300200 "vfModules": {
Ittay Sternf7926712019-07-07 19:23:03 +0300201 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
202 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300203 "instanceName": "VFinstancenameZERO",
204 "modelInfo": {
205 "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
206 "modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
Ittay Sternf7926712019-07-07 19:23:03 +0300207 "modelName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300208 "modelVersion": "5",
209 "modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
Ittay Sternf7926712019-07-07 19:23:03 +0300210 "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300211 "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
212 },
213 "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db",
214 "provStatus": "Prov Status",
215 "orchStatus": "Active",
216 "inMaint": true
217 }
218 },
Ittay Sternf7926712019-07-07 19:23:03 +0300219 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
220 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300221 "instanceName": "VFinstancename",
222 "volumeGroupName": "VFinstancename_vol_abc",
223 "orchStatus": "Create",
224 "provStatus": "Prov Status",
225 "inMaint": false,
226 "modelInfo": {
227 "modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
228 "modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5",
Ittay Sternf7926712019-07-07 19:23:03 +0300229 "modelName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300230 "modelVersion": "6",
231 "modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
Ittay Sternf7926712019-07-07 19:23:03 +0300232 "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300233 "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
234 },
235 "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
236 }
237 }
238 },
239 "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
240 "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
Ittay Sternf7926712019-07-07 19:23:03 +0300241 "lcpCloudRegionId": "AAIAIC25",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300242 "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
243 "lineOfBusiness": "ONAP",
244 "platformName": "platform",
245 "modelInfo": {
246 "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
247 "modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
Ittay Sternf7926712019-07-07 19:23:03 +0300248 "modelName": "2017-488_PASQUALE-vPE",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300249 "modelVersion": "5.0",
250 "modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
Ittay Sternf7926712019-07-07 19:23:03 +0300251 "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300252 "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09"
253 },
254 "orchStatus": "Created",
255 "inMaint": false,
Ittay Sternf7926712019-07-07 19:23:03 +0300256 "instanceName": "2017488_PASQUALEvPEVNFinstancename",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300257 "legacyRegion": "some legacy region"
258 },
Ittay Sternf7926712019-07-07 19:23:03 +0300259 "2017-488_PASQUALE-vPE 0:0001": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300260 "vfModules": {
Ittay Sternf7926712019-07-07 19:23:03 +0300261 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
262 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300263 "instanceName": "VFinstancenameZERO_001",
264 "provStatus": "Prov Status",
265 "inMaint": true,
266 "modelInfo": {
267 "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
268 "modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
Ittay Sternf7926712019-07-07 19:23:03 +0300269 "modelName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300270 "modelVersion": "5",
271 "modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
Ittay Sternf7926712019-07-07 19:23:03 +0300272 "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300273 "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
274 },
275 "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
276 }
277 },
Ittay Sternf7926712019-07-07 19:23:03 +0300278 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
279 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300280 "instanceName": "VFinstancename_001",
281 "volumeGroupName": "VFinstancename_vol_abc_001",
282 "modelInfo": {
283 "modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
284 "modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5",
Ittay Sternf7926712019-07-07 19:23:03 +0300285 "modelName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300286 "modelVersion": "6",
287 "modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
Ittay Sternf7926712019-07-07 19:23:03 +0300288 "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300289 "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
290 },
291 "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
292 }
293 }
294 },
295
296 "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
297 "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
Ittay Sternf7926712019-07-07 19:23:03 +0300298 "lcpCloudRegionId": "AAIAIC25",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300299 "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
300 "lineOfBusiness": "ONAP",
301 "platformName": "platform",
302 "modelInfo": {
303 "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
304 "modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
Ittay Sternf7926712019-07-07 19:23:03 +0300305 "modelName": "2017-488_PASQUALE-vPE",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300306 "modelVersion": "5.0",
307 "modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
Ittay Sternf7926712019-07-07 19:23:03 +0300308 "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300309 "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09"
310 },
Ittay Sternf7926712019-07-07 19:23:03 +0300311 "instanceName": "2017488_PASQUALEvPEVNFinstancename_001",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300312 "legacyRegion": "some legacy region"
313 },
Ittay Sternf7926712019-07-07 19:23:03 +0300314 "2017-488_PASQUALE-vPE 0:0002": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300315 "vfModules": {
Ittay Sternf7926712019-07-07 19:23:03 +0300316 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0": {
317 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0uvfot": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300318 "instanceName": "VFinstancenameZERO_002",
319 "modelInfo": {
320 "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091",
321 "modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db",
Ittay Sternf7926712019-07-07 19:23:03 +0300322 "modelName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300323 "modelVersion": "5",
324 "modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3",
Ittay Sternf7926712019-07-07 19:23:03 +0300325 "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_base_vPE_BV..module-0",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300326 "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
327 },
328 "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db"
329 }
330 },
Ittay Sternf7926712019-07-07 19:23:03 +0300331 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1": {
332 "2017488_pasqualevpe0..2017488PasqualeVpe..PASQUALE_vRE_BV..module-1fshmc": {
Ittay Stern6f900cc2018-08-29 17:01:32 +0300333 "instanceName": "VFinstancename_002",
334 "volumeGroupName": "VFinstancename_vol_abc_002",
335 "modelInfo": {
336 "modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1",
337 "modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5",
Ittay Sternf7926712019-07-07 19:23:03 +0300338 "modelName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300339 "modelVersion": "6",
340 "modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401",
Ittay Sternf7926712019-07-07 19:23:03 +0300341 "modelCustomizationName": "2017488PasqualeVpe..PASQUALE_vRE_BV..module-1",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300342 "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
343 },
344 "uuid": "25284168-24bb-4698-8cb4-3f509146eca5"
345 }
346 }
347 },
348 "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
349 "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
Ittay Sternf7926712019-07-07 19:23:03 +0300350 "lcpCloudRegionId": "AAIAIC25",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300351 "tenantId": "092eb9e8e4b7412e8787dd091bc58e86",
352 "lineOfBusiness": "ONAP",
353 "platformName": "platform",
354 "modelInfo": {
355 "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8",
356 "modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09",
Ittay Sternf7926712019-07-07 19:23:03 +0300357 "modelName": "2017-488_PASQUALE-vPE",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300358 "modelVersion": "5.0",
359 "modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45",
Ittay Sternf7926712019-07-07 19:23:03 +0300360 "modelCustomizationName": "2017-488_PASQUALE-vPE 0",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300361 "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09"
362 },
Ittay Sternf7926712019-07-07 19:23:03 +0300363 "instanceName": "2017488_PASQUALEvPEVNFinstancename_002",
Ittay Stern6f900cc2018-08-29 17:01:32 +0300364 "legacyRegion": "some legacy region"
365 }
366 },
367 "vnfGroups": {},
368 "existingVnfGroupCounterMap": {},
369 "validationCounter": 0,
370 "existingVNFCounterMap": {
371 "afacccf6-397d-45d6-b5ae-94c39734b168": 1,
372 "69e09f68-8b63-4cc9-b9ff-860960b5db09": 3
373 },
374 "existingNetworksCounterMap": {},
375 "instanceName": "mCaNkinstancename",
376 "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89",
377 "subscriptionServiceType": "TYLER SILVIA",
378 "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc",
379 "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89",
380 "lcpCloudRegionId": "hvf6",
381 "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054",
382 "aicZoneId": "NFT1",
383 "projectName": "WATKINS",
384 "rollbackOnFailure": "true",
385 "aicZoneName": "NFTJSSSS-NFT1",
386 "owningEntityName": "WayneHolland",
387 "tenantName": "AIN Web Tool-15-D-testalexandria",
388 "modelInfo": {
389 "modelInvariantId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0",
390 "modelVersionId": "6b528779-44a3-4472-bdff-9cd15ec93450",
391 "modelName": "action-data",
392 "modelVersion": "1.0",
393 "uuid": "6b528779-44a3-4472-bdff-9cd15ec93450"
394 },
395 "isALaCarte": false,
396 "orchStatus": "Active",
397 "modelInavariantId": "6b528779-44a3-4472-bdff-9cd15ec93450"
398 }
399 }
400
Ittay Sternf7926712019-07-07 19:23:03 +0300401 function getMockActiveNetworks(){
402 return [
403 {
404 networkInstanceName: "networkInstanceName",
405 instanceVersion: "instanceVersion",
406 networkModel: "networkModel",
407 instanceUUID: "instanceUUID_1",
408 provStatus: "provStatus",
409 orchStatus: "orchStatus",
410 serviceInstanceName: "serviceInstanceName",
411 serviceUUID: "serviceUUID",
412 roles: ["network role 1", "network role 2"],
413 },
414 {
415 networkInstanceName: "networkInstanceName",
416 instanceVersion: "instanceVersion",
417 networkModel: "networkModel",
418 instanceUUID: "instanceUUID_2",
419 provStatus: "provStatus",
420 orchStatus: "orchStatus",
421 serviceInstanceName: "serviceInstanceName",
422 serviceUUID: "serviceUUID",
423 roles: ["network role 1", "network role 3"],
424 },
425 {
426 networkInstanceName: "networkInstanceName",
427 instanceVersion: "instanceVersion",
428 networkModel: "networkModel",
429 instanceUUID: "instanceUUID_3",
430 provStatus: "provStatus",
431 orchStatus: "orchStatus",
432 serviceInstanceName: "serviceInstanceName",
433 serviceUUID: "serviceUUID",
434 roles: ["network role 4", "network role 8"],
435 },
436 {
437 networkInstanceName: "networkInstanceName",
438 instanceVersion: "instanceVersion",
439 networkModel: "networkModel",
440 instanceUUID: "instanceUUID_4",
441 provStatus: "provStatus",
442 orchStatus: "orchStatus",
443 serviceInstanceName: "serviceInstanceName",
444 serviceUUID: "serviceUUID",
445 roles: [],
446 },
447 {
448 networkInstanceName: "networkInstanceName",
449 instanceVersion: "instanceVersion",
450 networkModel: "networkModel",
451 instanceUUID: "instanceUUID_5",
452 provStatus: "provStatus",
453 orchStatus: "orchStatus",
454 serviceInstanceName: "serviceInstanceName",
455 serviceUUID: "serviceUUID",
456 roles: ["network role 6", "network role 1"],
457 },
458 {
459 networkInstanceName: "networkInstanceName",
460 instanceVersion: "instanceVersion",
461 networkModel: "networkModel",
462 instanceUUID: "instanceUUID_6",
463 provStatus: "provStatus",
464 orchStatus: "orchStatus",
465 serviceInstanceName: "serviceInstanceName",
466 serviceUUID: "serviceUUID",
467 roles: ["network role 5"],
468 },
469 {
470 networkInstanceName: "networkInstanceName",
471 instanceVersion: "instanceVersion",
472 networkModel: "networkModel",
473 instanceUUID: "instanceUUID_7",
474 provStatus: "provStatus",
475 orchStatus: "orchStatus",
476 serviceInstanceName: "serviceInstanceName",
477 serviceUUID: "serviceUUID",
478 roles: ["network role 3"],
479 },
480 {
481 networkInstanceName: "networkInstanceName",
482 instanceVersion: "instanceVersion",
483 networkModel: "networkModel",
484 instanceUUID: "instanceUUID_8",
485 provStatus: "provStatus",
486 orchStatus: "orchStatus",
487 serviceInstanceName: "serviceInstanceName",
488 serviceUUID: "serviceUUID",
489 roles: ["network role 4"],
490 },
491 {
492 networkInstanceName: "networkInstanceName",
493 instanceVersion: "instanceVersion",
494 networkModel: "networkModel",
495 instanceUUID: "instanceUUID_9",
496 provStatus: "provStatus",
497 orchStatus: "orchStatus",
498 serviceInstanceName: "serviceInstanceName",
499 serviceUUID: "serviceUUID",
500 roles: [],
501 }
502 ]
503 }
504
Ittay Stern6f900cc2018-08-29 17:01:32 +0300505 const getMockMembers = (): any[] => {
506 return [
507 {
508 "action":"None",
509 "instanceName":"VNF1_INSTANCE_NAME",
510 "instanceId":"VNF1_INSTANCE_ID",
511 "orchStatus":null,
512 "productFamilyId":null,
513 "lcpCloudRegionId":null,
514 "tenantId":null,
515 "modelInfo":{
516 "modelInvariantId":"vnf-instance-model-invariant-id",
517 "modelVersionId":"7a6ee536-f052-46fa-aa7e-2fca9d674c44",
518 "modelVersion":"2.0",
519 "modelName":"vf_vEPDG",
520 "modelType":"vnf"
521 },
522 "instanceType":"VNF1_INSTANCE_TYPE",
523 "provStatus":null,
524 "inMaint":false,
525 "uuid":"7a6ee536-f052-46fa-aa7e-2fca9d674c44",
526 "originalName":null,
527 "legacyRegion":null,
528 "lineOfBusiness":null,
529 "platformName":null,
530 "trackById":"7a6ee536-f052-46fa-aa7e-2fca9d674c44:002",
531 "serviceInstanceId":"service-instance-id1",
532 "serviceInstanceName":"service-instance-name"
533 },
534 {
535 "action":"None",
536 "instanceName":"VNF2_INSTANCE_NAME",
537 "instanceId":"VNF2_INSTANCE_ID",
538 "orchStatus":null,
539 "productFamilyId":null,
540 "lcpCloudRegionId":null,
541 "tenantId":null,
542 "modelInfo":{
543 "modelInvariantId":"vnf-instance-model-invariant-id",
544 "modelVersionId":"eb5f56bf-5855-4e61-bd00-3e19a953bf02",
545 "modelVersion":"1.0",
546 "modelName":"vf_vEPDG",
547 "modelType":"vnf"
548 },
549 "instanceType":"VNF2_INSTANCE_TYPE",
550 "provStatus":null,
551 "inMaint":true,
552 "uuid":"eb5f56bf-5855-4e61-bd00-3e19a953bf02",
553 "originalName":null,
554 "legacyRegion":null,
555 "lineOfBusiness":null,
556 "platformName":null,
557 "trackById":"eb5f56bf-5855-4e61-bd00-3e19a953bf02:003",
558 "serviceInstanceId":"service-instance-id2",
559 "serviceInstanceName":"service-instance-name"
560 }];
561 };
562});
563
564
565var expectedResult =
566 {
567 'vnfs': {
568 'DROR_vsp': {
Einat Vinouzee1f79742019-08-27 16:01:01 +0300569 'upgradedVFMSonsCounter': 0,
Ittay Stern6f900cc2018-08-29 17:01:32 +0300570 'rollbackOnFailure': 'true',
571 'vfModules': {},
572 'isMissingData': false,
573 'originalName': 'DROR_vsp',
574 'orchStatus': 'Created',
575 'inMaint': false,
576 'vnfStoreKey' : null,
577 'trackById' : 'abc',
578 'action': 'Create'
579 }
580 },
581 "vnfGroups" :{},
582 "existingVNFCounterMap" : {},
583 "existingVnfGroupCounterMap" : {},
584 "existingNetworksCounterMap" : {},
585 'instanceParams': {},
586 'validationCounter': 0,
587 'existingNames': {},
588 'networks': {},
589 'instanceName': 'Dror123',
590 'orchStatus': 'Active',
591 'modelInavariantId': '35340388-0b82-4d3a-823d-cbddf842be52',
592 'action': 'Create'
593 };
594
595
596var aaiServiceInstnace: RootObject = {
597 "root": {
598 "type": "service-instance",
599 "orchestrationStatus": "Active",
600 "modelVersionId": "4e799efd-fd78-444d-bc25-4a3cde2f8cb0",
601 "modelCustomizationId": "4e799efd-fd78-444d-bc25-4a3cde2f8cb0",
602 "modelInvariantId": "35340388-0b82-4d3a-823d-cbddf842be52",
603 "id": "62888f15-6d24-4f7b-92a7-c3f35beeb215",
604 "name": "Dror123",
605 "children": [
606 {
607 "type": "generic-vnf",
608 "orchestrationStatus": "Created",
609 "provStatus": "PREPROV",
610 "inMaint": true,
611 "modelVersionId": "11c6dc3e-cd6a-41b3-a50e-b5a10f7157d0",
612 "modelCustomizationId": "11c6dc3e-cd6a-41b3-a50e-b5a10f7157d0",
613 "modelInvariantId": "55628ce3-ed56-40bd-9b27-072698ce02a9",
614 "id": "59bde732-9b84-46bd-a59a-3c45fee0538b",
615 "name": "DROR_vsp",
616 "children": []
617 }
618 ]
619 }
620};