Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame^] | 1 | import {ServiceInstance} from "../../models/serviceInstance"; |
| 2 | import {RootObject} from "./model/crawledAaiService"; |
| 3 | import {AaiService} from "./aai.service"; |
| 4 | import {instance, mock, when} from "ts-mockito"; |
| 5 | import {FeatureFlagsService, Features} from "../featureFlag/feature-flags.service"; |
| 6 | import {HttpClientTestingModule, HttpTestingController} from "@angular/common/http/testing"; |
| 7 | import {getTestBed, TestBed} from "@angular/core/testing"; |
| 8 | import {NgRedux} from "@angular-redux/store"; |
| 9 | import {Constants} from "../../utils/constants"; |
| 10 | import {AppState} from "../../store/reducers"; |
| 11 | import {setOptionalMembersVnfGroupInstance} from "../../storeUtil/utils/vnfGroup/vnfGroup.actions"; |
| 12 | import each from 'jest-each'; |
| 13 | |
| 14 | class MockAppStore<T> { |
| 15 | dispatch(){} |
| 16 | getState(){} |
| 17 | } |
| 18 | |
| 19 | describe("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"); |
| 68 | expect(result.vnfs["2017-388_ADIOD-vPE 0"].instanceName).toEqual("2017388_ADIODvPEmCaNkinstanceName"); |
| 69 | expect(result.vnfs["2017-488_ADIOD-vPE 0"]. |
| 70 | vfModules["2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0"] |
| 71 | ["2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0uvfot"].instanceName |
| 72 | ).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"); |
| 91 | expect(result.vnfs["2017-388_ADIOD-vPE 0"].instanceName).toEqual("2017388_ADIODvPEmCaNkinstanceName"); |
| 92 | expect(result.vnfs["2017-488_ADIOD-vPE 0"]. |
| 93 | vfModules["2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0"] |
| 94 | ["2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0uvfot"].instanceName |
| 95 | ).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'); |
| 107 | jest.spyOn(store, 'getState').mockReturnValue({ |
| 108 | service :{ |
| 109 | serviceInstance : { |
| 110 | "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 | }); |
| 135 | describe('#cloud owner tests', () => { |
| 136 | let featureFlagToLcpRegionName = [ |
| 137 | ['aai service extract lcpRegion, flag is true=> lcp region include cloud owner', true, 'id (OWNER)' ], |
| 138 | ['aai service extract lcpRegion, flag is false=> lcp region doesnt include cloud owner', false, 'id'] |
| 139 | ]; |
| 140 | |
| 141 | each(featureFlagToLcpRegionName).test("%s", (desc: string, flag: boolean, expectedName: string ) => { |
| 142 | when(mockFeatureFlagsService.getFlagState(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST)).thenReturn(flag); |
| 143 | let name: string = aaiService.extractLcpRegionName("id", "att-owner"); |
| 144 | expect(name).toEqual(expectedName); |
| 145 | }); |
| 146 | |
| 147 | let cloudOwnerFormattingDataProvider = [ |
| 148 | ['classic cloud owner', 'irma-aic', ' (AIC)'], |
| 149 | ['upper case cloud owner', 'IRMA-AIC', ' (AIC)'], |
| 150 | ['no att cloud owner', 'nc', ' (NC)'], |
| 151 | ]; |
| 152 | |
| 153 | each(cloudOwnerFormattingDataProvider).test('test cloudOwner trailer formatting %s', (desc: string, cloudOwner: string, expectedTrailer: string) => { |
| 154 | expect(AaiService.formatCloudOwnerTrailer(cloudOwner)).toEqual(expectedTrailer); |
| 155 | }); |
| 156 | }); |
| 157 | |
| 158 | function getTopology() { |
| 159 | return { |
| 160 | "vnfs": { |
| 161 | "2017-388_ADIOD-vPE 0": { |
| 162 | "vfModules": {}, |
| 163 | "uuid": "afacccf6-397d-45d6-b5ae-94c39734b168", |
| 164 | "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", |
| 165 | "lcpCloudRegionId": "JANET25", |
| 166 | "tenantId": "092eb9e8e4b7412e8787dd091bc58e86", |
| 167 | "lineOfBusiness": "ONAP", |
| 168 | "platformName": "platform", |
| 169 | "modelInfo": { |
| 170 | "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8", |
| 171 | "modelVersionId": "afacccf6-397d-45d6-b5ae-94c39734b168", |
| 172 | "modelName": "2017-388_ADIOD-vPE", |
| 173 | "modelVersion": "4.0", |
| 174 | "modelCustomizationId": "b3c76f73-eeb5-4fb6-9d31-72a889f1811c", |
| 175 | "modelCustomizationName": "2017-388_ADIOD-vPE 0", |
| 176 | "uuid": "afacccf6-397d-45d6-b5ae-94c39734b168" |
| 177 | }, |
| 178 | "instanceName": "2017388_ADIODvPEmCaNkinstanceName", |
| 179 | "legacyRegion": "some legacy region" |
| 180 | }, |
| 181 | "2017-488_ADIOD-vPE 0": { |
| 182 | "vfModules": { |
| 183 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0": { |
| 184 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0uvfot": { |
| 185 | "instanceName": "VFinstancenameZERO", |
| 186 | "modelInfo": { |
| 187 | "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091", |
| 188 | "modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db", |
| 189 | "modelName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0", |
| 190 | "modelVersion": "5", |
| 191 | "modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3", |
| 192 | "modelCustomizationName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0", |
| 193 | "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db" |
| 194 | }, |
| 195 | "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db", |
| 196 | "provStatus": "Prov Status", |
| 197 | "orchStatus": "Active", |
| 198 | "inMaint": true |
| 199 | } |
| 200 | }, |
| 201 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": { |
| 202 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1fshmc": { |
| 203 | "instanceName": "VFinstancename", |
| 204 | "volumeGroupName": "VFinstancename_vol_abc", |
| 205 | "orchStatus": "Create", |
| 206 | "provStatus": "Prov Status", |
| 207 | "inMaint": false, |
| 208 | "modelInfo": { |
| 209 | "modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1", |
| 210 | "modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5", |
| 211 | "modelName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1", |
| 212 | "modelVersion": "6", |
| 213 | "modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401", |
| 214 | "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1", |
| 215 | "uuid": "25284168-24bb-4698-8cb4-3f509146eca5" |
| 216 | }, |
| 217 | "uuid": "25284168-24bb-4698-8cb4-3f509146eca5" |
| 218 | } |
| 219 | } |
| 220 | }, |
| 221 | "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09", |
| 222 | "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", |
| 223 | "lcpCloudRegionId": "JANET25", |
| 224 | "tenantId": "092eb9e8e4b7412e8787dd091bc58e86", |
| 225 | "lineOfBusiness": "ONAP", |
| 226 | "platformName": "platform", |
| 227 | "modelInfo": { |
| 228 | "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8", |
| 229 | "modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09", |
| 230 | "modelName": "2017-488_ADIOD-vPE", |
| 231 | "modelVersion": "5.0", |
| 232 | "modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45", |
| 233 | "modelCustomizationName": "2017-488_ADIOD-vPE 0", |
| 234 | "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09" |
| 235 | }, |
| 236 | "orchStatus": "Created", |
| 237 | "inMaint": false, |
| 238 | "instanceName": "2017488_ADIODvPEVNFinstancename", |
| 239 | "legacyRegion": "some legacy region" |
| 240 | }, |
| 241 | "2017-488_ADIOD-vPE 0:0001": { |
| 242 | "vfModules": { |
| 243 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0": { |
| 244 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0uvfot": { |
| 245 | "instanceName": "VFinstancenameZERO_001", |
| 246 | "provStatus": "Prov Status", |
| 247 | "inMaint": true, |
| 248 | "modelInfo": { |
| 249 | "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091", |
| 250 | "modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db", |
| 251 | "modelName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0", |
| 252 | "modelVersion": "5", |
| 253 | "modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3", |
| 254 | "modelCustomizationName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0", |
| 255 | "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db" |
| 256 | }, |
| 257 | "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db" |
| 258 | } |
| 259 | }, |
| 260 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": { |
| 261 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1fshmc": { |
| 262 | "instanceName": "VFinstancename_001", |
| 263 | "volumeGroupName": "VFinstancename_vol_abc_001", |
| 264 | "modelInfo": { |
| 265 | "modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1", |
| 266 | "modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5", |
| 267 | "modelName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1", |
| 268 | "modelVersion": "6", |
| 269 | "modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401", |
| 270 | "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1", |
| 271 | "uuid": "25284168-24bb-4698-8cb4-3f509146eca5" |
| 272 | }, |
| 273 | "uuid": "25284168-24bb-4698-8cb4-3f509146eca5" |
| 274 | } |
| 275 | } |
| 276 | }, |
| 277 | |
| 278 | "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09", |
| 279 | "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", |
| 280 | "lcpCloudRegionId": "JANET25", |
| 281 | "tenantId": "092eb9e8e4b7412e8787dd091bc58e86", |
| 282 | "lineOfBusiness": "ONAP", |
| 283 | "platformName": "platform", |
| 284 | "modelInfo": { |
| 285 | "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8", |
| 286 | "modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09", |
| 287 | "modelName": "2017-488_ADIOD-vPE", |
| 288 | "modelVersion": "5.0", |
| 289 | "modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45", |
| 290 | "modelCustomizationName": "2017-488_ADIOD-vPE 0", |
| 291 | "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09" |
| 292 | }, |
| 293 | "instanceName": "2017488_ADIODvPEVNFinstancename_001", |
| 294 | "legacyRegion": "some legacy region" |
| 295 | }, |
| 296 | "2017-488_ADIOD-vPE 0:0002": { |
| 297 | "vfModules": { |
| 298 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0": { |
| 299 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_base_vPE_BV..module-0uvfot": { |
| 300 | "instanceName": "VFinstancenameZERO_002", |
| 301 | "modelInfo": { |
| 302 | "modelInvariantId": "b34833bb-6aa9-4ad6-a831-70b06367a091", |
| 303 | "modelVersionId": "f8360508-3f17-4414-a2ed-6bc71161e8db", |
| 304 | "modelName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0", |
| 305 | "modelVersion": "5", |
| 306 | "modelCustomizationId": "a55961b2-2065-4ab0-a5b7-2fcee1c227e3", |
| 307 | "modelCustomizationName": "2017488AdiodVpe..ADIOD_base_vPE_BV..module-0", |
| 308 | "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db" |
| 309 | }, |
| 310 | "uuid": "f8360508-3f17-4414-a2ed-6bc71161e8db" |
| 311 | } |
| 312 | }, |
| 313 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1": { |
| 314 | "2017488_adiodvpe0..2017488AdiodVpe..ADIOD_vRE_BV..module-1fshmc": { |
| 315 | "instanceName": "VFinstancename_002", |
| 316 | "volumeGroupName": "VFinstancename_vol_abc_002", |
| 317 | "modelInfo": { |
| 318 | "modelInvariantId": "7253ff5c-97f0-4b8b-937c-77aeb4d79aa1", |
| 319 | "modelVersionId": "25284168-24bb-4698-8cb4-3f509146eca5", |
| 320 | "modelName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1", |
| 321 | "modelVersion": "6", |
| 322 | "modelCustomizationId": "f7e7c365-60cf-49a9-9ebf-a1aa11b9d401", |
| 323 | "modelCustomizationName": "2017488AdiodVpe..ADIOD_vRE_BV..module-1", |
| 324 | "uuid": "25284168-24bb-4698-8cb4-3f509146eca5" |
| 325 | }, |
| 326 | "uuid": "25284168-24bb-4698-8cb4-3f509146eca5" |
| 327 | } |
| 328 | } |
| 329 | }, |
| 330 | "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09", |
| 331 | "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", |
| 332 | "lcpCloudRegionId": "JANET25", |
| 333 | "tenantId": "092eb9e8e4b7412e8787dd091bc58e86", |
| 334 | "lineOfBusiness": "ONAP", |
| 335 | "platformName": "platform", |
| 336 | "modelInfo": { |
| 337 | "modelInvariantId": "72e465fe-71b1-4e7b-b5ed-9496118ff7a8", |
| 338 | "modelVersionId": "69e09f68-8b63-4cc9-b9ff-860960b5db09", |
| 339 | "modelName": "2017-488_ADIOD-vPE", |
| 340 | "modelVersion": "5.0", |
| 341 | "modelCustomizationId": "1da7b585-5e61-4993-b95e-8e6606c81e45", |
| 342 | "modelCustomizationName": "2017-488_ADIOD-vPE 0", |
| 343 | "uuid": "69e09f68-8b63-4cc9-b9ff-860960b5db09" |
| 344 | }, |
| 345 | "instanceName": "2017488_ADIODvPEVNFinstancename_002", |
| 346 | "legacyRegion": "some legacy region" |
| 347 | } |
| 348 | }, |
| 349 | "vnfGroups": {}, |
| 350 | "existingVnfGroupCounterMap": {}, |
| 351 | "validationCounter": 0, |
| 352 | "existingVNFCounterMap": { |
| 353 | "afacccf6-397d-45d6-b5ae-94c39734b168": 1, |
| 354 | "69e09f68-8b63-4cc9-b9ff-860960b5db09": 3 |
| 355 | }, |
| 356 | "existingNetworksCounterMap": {}, |
| 357 | "instanceName": "mCaNkinstancename", |
| 358 | "globalSubscriberId": "e433710f-9217-458d-a79d-1c7aff376d89", |
| 359 | "subscriptionServiceType": "TYLER SILVIA", |
| 360 | "owningEntityId": "d61e6f2d-12fa-4cc2-91df-7c244011d6fc", |
| 361 | "productFamilyId": "e433710f-9217-458d-a79d-1c7aff376d89", |
| 362 | "lcpCloudRegionId": "hvf6", |
| 363 | "tenantId": "bae71557c5bb4d5aac6743a4e5f1d054", |
| 364 | "aicZoneId": "NFT1", |
| 365 | "projectName": "WATKINS", |
| 366 | "rollbackOnFailure": "true", |
| 367 | "aicZoneName": "NFTJSSSS-NFT1", |
| 368 | "owningEntityName": "WayneHolland", |
| 369 | "tenantName": "AIN Web Tool-15-D-testalexandria", |
| 370 | "modelInfo": { |
| 371 | "modelInvariantId": "e49fbd11-e60c-4a8e-b4bf-30fbe8f4fcc0", |
| 372 | "modelVersionId": "6b528779-44a3-4472-bdff-9cd15ec93450", |
| 373 | "modelName": "action-data", |
| 374 | "modelVersion": "1.0", |
| 375 | "uuid": "6b528779-44a3-4472-bdff-9cd15ec93450" |
| 376 | }, |
| 377 | "isALaCarte": false, |
| 378 | "orchStatus": "Active", |
| 379 | "modelInavariantId": "6b528779-44a3-4472-bdff-9cd15ec93450" |
| 380 | } |
| 381 | } |
| 382 | |
| 383 | const getMockMembers = (): any[] => { |
| 384 | return [ |
| 385 | { |
| 386 | "action":"None", |
| 387 | "instanceName":"VNF1_INSTANCE_NAME", |
| 388 | "instanceId":"VNF1_INSTANCE_ID", |
| 389 | "orchStatus":null, |
| 390 | "productFamilyId":null, |
| 391 | "lcpCloudRegionId":null, |
| 392 | "tenantId":null, |
| 393 | "modelInfo":{ |
| 394 | "modelInvariantId":"vnf-instance-model-invariant-id", |
| 395 | "modelVersionId":"7a6ee536-f052-46fa-aa7e-2fca9d674c44", |
| 396 | "modelVersion":"2.0", |
| 397 | "modelName":"vf_vEPDG", |
| 398 | "modelType":"vnf" |
| 399 | }, |
| 400 | "instanceType":"VNF1_INSTANCE_TYPE", |
| 401 | "provStatus":null, |
| 402 | "inMaint":false, |
| 403 | "uuid":"7a6ee536-f052-46fa-aa7e-2fca9d674c44", |
| 404 | "originalName":null, |
| 405 | "legacyRegion":null, |
| 406 | "lineOfBusiness":null, |
| 407 | "platformName":null, |
| 408 | "trackById":"7a6ee536-f052-46fa-aa7e-2fca9d674c44:002", |
| 409 | "serviceInstanceId":"service-instance-id1", |
| 410 | "serviceInstanceName":"service-instance-name" |
| 411 | }, |
| 412 | { |
| 413 | "action":"None", |
| 414 | "instanceName":"VNF2_INSTANCE_NAME", |
| 415 | "instanceId":"VNF2_INSTANCE_ID", |
| 416 | "orchStatus":null, |
| 417 | "productFamilyId":null, |
| 418 | "lcpCloudRegionId":null, |
| 419 | "tenantId":null, |
| 420 | "modelInfo":{ |
| 421 | "modelInvariantId":"vnf-instance-model-invariant-id", |
| 422 | "modelVersionId":"eb5f56bf-5855-4e61-bd00-3e19a953bf02", |
| 423 | "modelVersion":"1.0", |
| 424 | "modelName":"vf_vEPDG", |
| 425 | "modelType":"vnf" |
| 426 | }, |
| 427 | "instanceType":"VNF2_INSTANCE_TYPE", |
| 428 | "provStatus":null, |
| 429 | "inMaint":true, |
| 430 | "uuid":"eb5f56bf-5855-4e61-bd00-3e19a953bf02", |
| 431 | "originalName":null, |
| 432 | "legacyRegion":null, |
| 433 | "lineOfBusiness":null, |
| 434 | "platformName":null, |
| 435 | "trackById":"eb5f56bf-5855-4e61-bd00-3e19a953bf02:003", |
| 436 | "serviceInstanceId":"service-instance-id2", |
| 437 | "serviceInstanceName":"service-instance-name" |
| 438 | }]; |
| 439 | }; |
| 440 | }); |
| 441 | |
| 442 | |
| 443 | var expectedResult = |
| 444 | { |
| 445 | 'vnfs': { |
| 446 | 'DROR_vsp': { |
| 447 | 'rollbackOnFailure': 'true', |
| 448 | 'vfModules': {}, |
| 449 | 'isMissingData': false, |
| 450 | 'originalName': 'DROR_vsp', |
| 451 | 'orchStatus': 'Created', |
| 452 | 'inMaint': false, |
| 453 | 'vnfStoreKey' : null, |
| 454 | 'trackById' : 'abc', |
| 455 | 'action': 'Create' |
| 456 | } |
| 457 | }, |
| 458 | "vnfGroups" :{}, |
| 459 | "existingVNFCounterMap" : {}, |
| 460 | "existingVnfGroupCounterMap" : {}, |
| 461 | "existingNetworksCounterMap" : {}, |
| 462 | 'instanceParams': {}, |
| 463 | 'validationCounter': 0, |
| 464 | 'existingNames': {}, |
| 465 | 'networks': {}, |
| 466 | 'instanceName': 'Dror123', |
| 467 | 'orchStatus': 'Active', |
| 468 | 'modelInavariantId': '35340388-0b82-4d3a-823d-cbddf842be52', |
| 469 | 'action': 'Create' |
| 470 | }; |
| 471 | |
| 472 | |
| 473 | var aaiServiceInstnace: RootObject = { |
| 474 | "root": { |
| 475 | "type": "service-instance", |
| 476 | "orchestrationStatus": "Active", |
| 477 | "modelVersionId": "4e799efd-fd78-444d-bc25-4a3cde2f8cb0", |
| 478 | "modelCustomizationId": "4e799efd-fd78-444d-bc25-4a3cde2f8cb0", |
| 479 | "modelInvariantId": "35340388-0b82-4d3a-823d-cbddf842be52", |
| 480 | "id": "62888f15-6d24-4f7b-92a7-c3f35beeb215", |
| 481 | "name": "Dror123", |
| 482 | "children": [ |
| 483 | { |
| 484 | "type": "generic-vnf", |
| 485 | "orchestrationStatus": "Created", |
| 486 | "provStatus": "PREPROV", |
| 487 | "inMaint": true, |
| 488 | "modelVersionId": "11c6dc3e-cd6a-41b3-a50e-b5a10f7157d0", |
| 489 | "modelCustomizationId": "11c6dc3e-cd6a-41b3-a50e-b5a10f7157d0", |
| 490 | "modelInvariantId": "55628ce3-ed56-40bd-9b27-072698ce02a9", |
| 491 | "id": "59bde732-9b84-46bd-a59a-3c45fee0538b", |
| 492 | "name": "DROR_vsp", |
| 493 | "children": [] |
| 494 | } |
| 495 | ] |
| 496 | } |
| 497 | }; |