Ittay Stern | 6f900cc | 2018-08-29 17:01:32 +0300 | [diff] [blame^] | 1 | import {NgRedux} from "@angular-redux/store"; |
| 2 | import {HttpClient} from '@angular/common/http'; |
| 3 | import {Injectable} from '@angular/core'; |
| 4 | import * as _ from 'lodash'; |
| 5 | import 'rxjs/add/operator/catch'; |
| 6 | import 'rxjs/add/operator/do'; |
| 7 | import {of} from "rxjs"; |
| 8 | |
| 9 | import {AicZone} from "../../models/aicZone"; |
| 10 | import {CategoryParams} from "../../models/categoryParams"; |
| 11 | import {LcpRegion} from "../../models/lcpRegion"; |
| 12 | import {LcpRegionsAndTenants} from "../../models/lcpRegionsAndTenants"; |
| 13 | import {OwningEntity} from "../../models/owningEntity"; |
| 14 | import {ProductFamily} from "../../models/productFamily"; |
| 15 | import {Project} from "../../models/project"; |
| 16 | import {SelectOption} from '../../models/selectOption'; |
| 17 | import {ServiceType} from "../../models/serviceType"; |
| 18 | import {Subscriber} from "../../models/subscriber"; |
| 19 | import {Tenant} from "../../models/tenant"; |
| 20 | import {Constants} from '../../utils/constants'; |
| 21 | import {AppState} from "../../store/reducers"; |
| 22 | import {GetAicZonesResponse} from "./responseInterfaces/getAicZonesResponseInterface"; |
| 23 | import {GetCategoryParamsResponseInterface} from "./responseInterfaces/getCategoryParamsResponseInterface"; |
| 24 | import {GetServicesResponseInterface} from "./responseInterfaces/getServicesResponseInterface"; |
| 25 | import {GetSubDetailsResponse} from "./responseInterfaces/getSubDetailsResponseInterface"; |
| 26 | import {GetSubscribersResponse} from "./responseInterfaces/getSubscribersResponseInterface"; |
| 27 | import {Root} from "./model/crawledAaiService"; |
| 28 | import {VnfInstance} from "../../models/vnfInstance"; |
| 29 | import {VfModuleInstance} from "../../models/vfModuleInstance"; |
| 30 | import {ServiceInstance} from "../../models/serviceInstance"; |
| 31 | import {VfModuleMap} from "../../models/vfModulesMap"; |
| 32 | import { |
| 33 | updateAicZones, |
| 34 | updateCategoryParameters, |
| 35 | updateLcpRegionsAndTenants, |
| 36 | updateServiceTypes, |
| 37 | updateSubscribers, |
| 38 | updateUserId |
| 39 | } from "../../storeUtil/utils/general/general.actions"; |
| 40 | import {updateModel, createServiceInstance} from "../../storeUtil/utils/service/service.actions"; |
| 41 | import {FeatureFlagsService, Features} from "../featureFlag/feature-flags.service"; |
| 42 | import {VnfMember} from "../../models/VnfMember"; |
| 43 | import {setOptionalMembersVnfGroupInstance} from "../../storeUtil/utils/vnfGroup/vnfGroup.actions"; |
| 44 | import {Observable} from "rxjs"; |
| 45 | |
| 46 | @Injectable() |
| 47 | export class AaiService { |
| 48 | constructor(private http: HttpClient, private store: NgRedux<AppState>, private featureFlagsService:FeatureFlagsService) { |
| 49 | |
| 50 | } |
| 51 | |
| 52 | getServiceModelById = (serviceModelId: string): Observable<any> => { |
| 53 | if (_.has(this.store.getState().service.serviceHierarchy, serviceModelId)) { |
| 54 | return of(<any> JSON.parse(JSON.stringify(this.store.getState().service.serviceHierarchy[serviceModelId]))); |
| 55 | } |
| 56 | let pathQuery: string = Constants.Path.SERVICES_PATH + serviceModelId; |
| 57 | return this.http.get(pathQuery).map(res => res) |
| 58 | .do((res) => { |
| 59 | this.store.dispatch(updateModel(res)); |
| 60 | }); |
| 61 | }; |
| 62 | |
| 63 | getUserId = (): Observable<any> => { |
| 64 | return this.http.get("../../getuserID", {responseType: 'text'}).do((res) => this.store.dispatch(updateUserId(res))); |
| 65 | }; |
| 66 | |
| 67 | |
| 68 | resolve = (root: Root, serviceInstance: ServiceInstance) => { |
| 69 | if (root.type === 'service-instance') { |
| 70 | serviceInstance.instanceName = root.name; |
| 71 | serviceInstance.orchStatus = root.orchestrationStatus; |
| 72 | serviceInstance.modelInavariantId = root.modelInvariantId; |
| 73 | for (let i = 0; i < root.children.length; i++) { |
| 74 | let child = root.children[i]; |
| 75 | if (child.type === 'generic-vnf') { |
| 76 | let vnf = new VnfInstance(); |
| 77 | vnf.originalName = child.name; |
| 78 | vnf.orchStatus = child.orchestrationStatus |
| 79 | if (child.children.length > 0) { |
| 80 | let vfModuleMap = new VfModuleMap(); |
| 81 | for (let j = 0; j < child.children.length; j++) { |
| 82 | let child = root.children[i]; |
| 83 | if (child.type === 'vf-module') { |
| 84 | let vfModule = new VfModuleInstance(); |
| 85 | vfModule.instanceName = child.name; |
| 86 | vfModule.orchStatus = child.orchestrationStatus; |
| 87 | vfModuleMap.vfModules[child.name] = vfModule; |
| 88 | } |
| 89 | } |
| 90 | vnf.vfModules = {"a": vfModuleMap}; |
| 91 | } |
| 92 | serviceInstance.vnfs[child.name] = vnf; |
| 93 | |
| 94 | } |
| 95 | } |
| 96 | |
| 97 | } |
| 98 | }; |
| 99 | |
| 100 | |
| 101 | getCRAccordingToNetworkFunctionId = (networkCollectionFunction, cloudOwner, cloudRegionId) => { |
| 102 | return this.http.get('../../aai_get_instance_groups_by_cloudregion/' + cloudOwner + '/' + cloudRegionId + '/' + networkCollectionFunction) |
| 103 | .map(res => res).do((res) => console.log(res)); |
| 104 | }; |
| 105 | |
| 106 | getCategoryParameters = (familyName): Observable<CategoryParams> => { |
| 107 | familyName = familyName || Constants.Path.PARAMETER_STANDARDIZATION_FAMILY; |
| 108 | let pathQuery: string = Constants.Path.GET_CATEGORY_PARAMETERS + "?familyName=" + familyName + "&r=" + Math.random(); |
| 109 | |
| 110 | return this.http.get<GetCategoryParamsResponseInterface>(pathQuery) |
| 111 | .map(this.categoryParametersResponseToProductAndOwningEntity) |
| 112 | .do(res => { |
| 113 | this.store.dispatch(updateCategoryParameters(res)) |
| 114 | }); |
| 115 | }; |
| 116 | |
| 117 | |
| 118 | categoryParametersResponseToProductAndOwningEntity = (res: GetCategoryParamsResponseInterface): CategoryParams => { |
| 119 | if (res && res.categoryParameters) { |
| 120 | const owningEntityList = res.categoryParameters.owningEntity.map(owningEntity => new OwningEntity(owningEntity)); |
| 121 | const projectList = res.categoryParameters.project.map(project => new Project(project)); |
| 122 | const lineOfBusinessList = res.categoryParameters.lineOfBusiness.map(owningEntity => new SelectOption(owningEntity)); |
| 123 | const platformList = res.categoryParameters.platform.map(platform => new SelectOption(platform)); |
| 124 | |
| 125 | return new CategoryParams(owningEntityList, projectList, lineOfBusinessList, platformList); |
| 126 | } else { |
| 127 | return new CategoryParams(); |
| 128 | } |
| 129 | }; |
| 130 | |
| 131 | getProductFamilies = (): Observable<ProductFamily[]> => { |
| 132 | |
| 133 | let pathQuery: string = Constants.Path.AAI_GET_SERVICES + Constants.Path.ASSIGN + Math.random(); |
| 134 | |
| 135 | return this.http.get<GetServicesResponseInterface>(pathQuery).map(res => res.service.map(service => new ProductFamily(service))); |
| 136 | }; |
| 137 | |
| 138 | getServices = (): Observable<GetServicesResponseInterface> => { |
| 139 | let pathQuery: string = Constants.Path.AAI_GET_SERVICES + Constants.Path.ASSIGN + Math.random(); |
| 140 | |
| 141 | return this.http.get<GetServicesResponseInterface>(pathQuery); |
| 142 | }; |
| 143 | |
| 144 | getSubscribers = (): Observable<Subscriber[]> => { |
| 145 | |
| 146 | if (this.store.getState().service.subscribers) { |
| 147 | return of(<any> JSON.parse(JSON.stringify(this.store.getState().service.subscribers))); |
| 148 | } |
| 149 | |
| 150 | let pathQuery: string = Constants.Path.AAI_GET_SUBSCRIBERS + Constants.Path.ASSIGN + Math.random(); |
| 151 | |
| 152 | return this.http.get<GetSubscribersResponse>(pathQuery).map(res => |
| 153 | res.customer.map(subscriber => new Subscriber(subscriber))).do((res) => { |
| 154 | this.store.dispatch(updateSubscribers(res)); |
| 155 | }); |
| 156 | }; |
| 157 | |
| 158 | getAicZones = (): Observable<AicZone[]> => { |
| 159 | if (this.store.getState().service.aicZones) { |
| 160 | return of(<any> JSON.parse(JSON.stringify(this.store.getState().service.aicZones))); |
| 161 | } |
| 162 | |
| 163 | let pathQuery: string = Constants.Path.AAI_GET_AIC_ZONES + Constants.Path.ASSIGN + Math.random(); |
| 164 | |
| 165 | return this.http.get<GetAicZonesResponse>(pathQuery).map(res => |
| 166 | res.zone.map(aicZone => new AicZone(aicZone))).do((res) => { |
| 167 | this.store.dispatch(updateAicZones(res)); |
| 168 | }); |
| 169 | }; |
| 170 | |
| 171 | getLcpRegionsAndTenants = (globalCustomerId, serviceType): Observable<LcpRegionsAndTenants> => { |
| 172 | |
| 173 | let pathQuery: string = Constants.Path.AAI_GET_TENANTS |
| 174 | + globalCustomerId + Constants.Path.FORWARD_SLASH + serviceType + Constants.Path.ASSIGN + Math.random(); |
| 175 | |
| 176 | console.log("AaiService:getSubscriptionServiceTypeList: globalCustomerId: " |
| 177 | + globalCustomerId); |
| 178 | if (globalCustomerId != null) { |
| 179 | return this.http.get(pathQuery) |
| 180 | .map(this.tenantResponseToLcpRegionsAndTenants).do((res) => { |
| 181 | this.store.dispatch(updateLcpRegionsAndTenants(res)); |
| 182 | }); |
| 183 | } |
| 184 | }; |
| 185 | |
| 186 | tenantResponseToLcpRegionsAndTenants = (cloudRegionTenantList): LcpRegionsAndTenants => { |
| 187 | |
| 188 | const lcpRegionsTenantsMap = {}; |
| 189 | |
| 190 | const lcpRegionList = _.uniqBy(cloudRegionTenantList, 'cloudRegionID').map((cloudRegionTenant) => { |
| 191 | const cloudOwner:string = cloudRegionTenant["cloudOwner"]; |
| 192 | const cloudRegionId:string = cloudRegionTenant["cloudRegionID"]; |
| 193 | const name:string = this.extractLcpRegionName(cloudRegionId, cloudOwner); |
| 194 | const isPermitted:boolean = cloudRegionTenant["is-permitted"]; |
| 195 | return new LcpRegion(cloudRegionId, name, isPermitted, cloudOwner); |
| 196 | }); |
| 197 | |
| 198 | lcpRegionList.forEach(region => { |
| 199 | lcpRegionsTenantsMap[region.id] = _.filter(cloudRegionTenantList, {'cloudRegionID': region.id}) |
| 200 | .map((cloudRegionTenant) => { |
| 201 | return new Tenant(cloudRegionTenant) |
| 202 | }); |
| 203 | const reducer = (accumulator, currentValue) => { |
| 204 | accumulator.isPermitted = accumulator.isPermitted || currentValue.isPermitted; |
| 205 | |
| 206 | return accumulator; |
| 207 | }; |
| 208 | region.isPermitted = lcpRegionsTenantsMap[region.id].reduce(reducer).isPermitted; |
| 209 | }); |
| 210 | |
| 211 | return new LcpRegionsAndTenants(lcpRegionList, lcpRegionsTenantsMap); |
| 212 | }; |
| 213 | |
| 214 | public extractLcpRegionName(cloudRegionId: string, cloudOwner: string):string { |
| 215 | return this.featureFlagsService.getFlagState(Features.FLAG_1810_CR_ADD_CLOUD_OWNER_TO_MSO_REQUEST) ? |
| 216 | cloudRegionId+AaiService.formatCloudOwnerTrailer(cloudOwner) : cloudRegionId; |
| 217 | }; |
| 218 | |
| 219 | public static formatCloudOwnerTrailer(cloudOwner: string):string { |
| 220 | return " ("+ cloudOwner.trim().toLowerCase().replace(/^att-/, "").toUpperCase() + ")"; |
| 221 | } |
| 222 | |
| 223 | getServiceTypes = (subscriberId): Observable<ServiceType[]> => { |
| 224 | |
| 225 | console.log("AaiService:getSubscriptionServiceTypeList: globalCustomerId: " + subscriberId); |
| 226 | if (_.has(this.store.getState().service.serviceTypes, subscriberId)) { |
| 227 | return of(<ServiceType[]> JSON.parse(JSON.stringify(this.store.getState().service.serviceTypes[subscriberId]))); |
| 228 | } |
| 229 | |
| 230 | return this.getSubscriberDetails(subscriberId) |
| 231 | .map(this.subDetailsResponseToServiceTypes) |
| 232 | .do((res) => { |
| 233 | this.store.dispatch(updateServiceTypes(res, subscriberId)); |
| 234 | }); |
| 235 | }; |
| 236 | |
| 237 | getSubscriberDetails = (subscriberId): Observable<GetSubDetailsResponse> => { |
| 238 | let pathQuery: string = Constants.Path.AAI_SUB_DETAILS_PATH + subscriberId + Constants.Path.ASSIGN + Math.random(); |
| 239 | |
| 240 | if (subscriberId != null) { |
| 241 | return this.http.get<GetSubDetailsResponse>(pathQuery); |
| 242 | } |
| 243 | }; |
| 244 | |
| 245 | subDetailsResponseToServiceTypes = (res: GetSubDetailsResponse): ServiceType[] => { |
| 246 | if (res && res['service-subscriptions']) { |
| 247 | const serviceSubscriptions = res['service-subscriptions']['service-subscription']; |
| 248 | return serviceSubscriptions.map((subscription, index) => new ServiceType(String(index), subscription)) |
| 249 | } else { |
| 250 | return []; |
| 251 | } |
| 252 | }; |
| 253 | |
| 254 | |
| 255 | public retrieveServiceInstanceTopology(serviceInstanceId : string, subscriberId: string, serviceType: string):Observable<ServiceInstance> { |
| 256 | let pathQuery: string = `${Constants.Path.AAI_GET_SERVICE_INSTANCE_TOPOLOGY_PATH}${subscriberId}/${serviceType}/${serviceInstanceId}`; |
| 257 | return this.http.get<ServiceInstance>(pathQuery); |
| 258 | } |
| 259 | |
| 260 | public retrieveAndStoreServiceInstanceTopology(serviceInstanceId: string, subscriberId: string, serviceType: string, serviceModeId: string):Observable<ServiceInstance> { |
| 261 | return this.retrieveServiceInstanceTopology(serviceInstanceId, subscriberId, serviceType).do((service:ServiceInstance) => { |
| 262 | this.store.dispatch(createServiceInstance(service, serviceModeId)); |
| 263 | }); |
| 264 | }; |
| 265 | |
| 266 | |
| 267 | public retrieveServiceInstanceRetryTopology(jobId : string) :Observable<ServiceInstance> { |
| 268 | let pathQuery: string = `${Constants.Path.SERVICES_RETRY_TOPOLOGY}/${jobId}`; |
| 269 | return this.http.get<ServiceInstance>(pathQuery); |
| 270 | |
| 271 | // return of( |
| 272 | // <any>{ |
| 273 | // "action": "None", |
| 274 | // "instanceName": "LXzQMx9clZl7D6ckJ", |
| 275 | // "instanceId": "service-instance-id", |
| 276 | // "orchStatus": "GARBAGE DATA", |
| 277 | // "productFamilyId": null, |
| 278 | // "lcpCloudRegionId": null, |
| 279 | // "tenantId": null, |
| 280 | // "modelInfo": { |
| 281 | // "modelInvariantId": "d27e42cf-087e-4d31-88ac-6c4b7585f800", |
| 282 | // "modelVersionId": "6e59c5de-f052-46fa-aa7e-2fca9d674c44", |
| 283 | // "modelName": "vf_vEPDG", |
| 284 | // "modelType": "service", |
| 285 | // "modelVersion": "5.0" |
| 286 | // }, |
| 287 | // "globalSubscriberId": "global-customer-id", |
| 288 | // "subscriptionServiceType": "service-instance-type", |
| 289 | // "owningEntityId": null, |
| 290 | // "owningEntityName": null, |
| 291 | // "tenantName": null, |
| 292 | // "aicZoneId": null, |
| 293 | // "aicZoneName": null, |
| 294 | // "projectName": null, |
| 295 | // "rollbackOnFailure": null, |
| 296 | // "isALaCarte": false, |
| 297 | // "vnfs": { |
| 298 | // "1e918ade-3dc6-4cec-b952-3ff94ed82d1c": { |
| 299 | // "action": "None", |
| 300 | // "instanceName": "DgZuxjJy5LMIc3755", |
| 301 | // "instanceId": "1e918ade-3dc6-4cec-b952-3ff94ed82d1c", |
| 302 | // "orchStatus": null, |
| 303 | // "productFamilyId": null, |
| 304 | // "lcpCloudRegionId": null, |
| 305 | // "tenantId": null, |
| 306 | // "modelInfo": { |
| 307 | // "modelInvariantId": "vnf-instance-model-invariant-id", |
| 308 | // "modelVersionId": "vnf-instance-model-version-id", |
| 309 | // "modelType": "vnf" |
| 310 | // }, |
| 311 | // "instanceType": "SXDBMhwdR9iO0g1Uv", |
| 312 | // "provStatus": null, |
| 313 | // "inMaint": false, |
| 314 | // "uuid": "vnf-instance-model-version-id", |
| 315 | // "originalName": null, |
| 316 | // "legacyRegion": null, |
| 317 | // "lineOfBusiness": null, |
| 318 | // "platformName": null, |
| 319 | // "trackById": "1e918ade-3dc6-4cec-b952-3ff94ed82d1c", |
| 320 | // "vfModules": {}, |
| 321 | // "networks": { |
| 322 | // "ff464c97-ea9c-4165-996a-fe400499af3e": { |
| 323 | // "action": "None", |
| 324 | // "instanceName": "ZI0quzIpu8TNXS7nl", |
| 325 | // "instanceId": "ff464c97-ea9c-4165-996a-fe400499af3e", |
| 326 | // "orchStatus": "Assigned", |
| 327 | // "productFamilyId": null, |
| 328 | // "lcpCloudRegionId": null, |
| 329 | // "tenantId": null, |
| 330 | // "modelInfo": { |
| 331 | // "modelInvariantId": "network-instance-model-invariant-id", |
| 332 | // "modelVersionId": "network-instance-model-version-id", |
| 333 | // "modelType": "network" |
| 334 | // }, |
| 335 | // "instanceType": "CONTRAIL30_BASIC", |
| 336 | // "provStatus": "prov", |
| 337 | // "inMaint": false, |
| 338 | // "uuid": "network-instance-model-version-id", |
| 339 | // "originalName": null, |
| 340 | // "legacyRegion": null, |
| 341 | // "lineOfBusiness": null, |
| 342 | // "platformName": null, |
| 343 | // "trackById": "ff464c97-ea9c-4165-996a-fe400499af3e", |
| 344 | // "isFailed": true |
| 345 | // }, |
| 346 | // "3e41d57c-8bb4-443e-af02-9f86487ba938": { |
| 347 | // "action": "None", |
| 348 | // "instanceName": "0i9asscqSLm7Poeb8", |
| 349 | // "instanceId": "3e41d57c-8bb4-443e-af02-9f86487ba938", |
| 350 | // "orchStatus": "Created", |
| 351 | // "productFamilyId": null, |
| 352 | // "lcpCloudRegionId": null, |
| 353 | // "tenantId": null, |
| 354 | // "modelInfo": { |
| 355 | // "modelInvariantId": "network-instance-model-invariant-id", |
| 356 | // "modelVersionId": "network-instance-model-version-id", |
| 357 | // "modelType": "network" |
| 358 | // }, |
| 359 | // "instanceType": "CONTRAIL30_BASIC", |
| 360 | // "provStatus": "prov", |
| 361 | // "inMaint": false, |
| 362 | // "uuid": "network-instance-model-version-id", |
| 363 | // "originalName": null, |
| 364 | // "legacyRegion": null, |
| 365 | // "lineOfBusiness": null, |
| 366 | // "platformName": null, |
| 367 | // "trackById": "3e41d57c-8bb4-443e-af02-9f86487ba938", |
| 368 | // "isFailed": true |
| 369 | // } |
| 370 | // }, |
| 371 | // "isFailed": true |
| 372 | // }, |
| 373 | // "9a9b2705-c569-4f1b-9a67-13e9f86e6c55": { |
| 374 | // "isFailed": true, |
| 375 | // "action": "None", |
| 376 | // "instanceName": "TFn0SYhrCUs7L3qWS", |
| 377 | // "instanceId": "9a9b2705-c569-4f1b-9a67-13e9f86e6c55", |
| 378 | // "orchStatus": null, |
| 379 | // "productFamilyId": null, |
| 380 | // "lcpCloudRegionId": null, |
| 381 | // "tenantId": null, |
| 382 | // "modelInfo": { |
| 383 | // "modelCustomizationName": "VF_vMee 0", |
| 384 | // "modelInvariantId": "vnf-instance-model-invariant-id", |
| 385 | // "modelVersionId": "d6557200-ecf2-4641-8094-5393ae3aae60", |
| 386 | // "modelType": "vnf" |
| 387 | // }, |
| 388 | // "instanceType": "WIT68GUnH34VaGZgp", |
| 389 | // "provStatus": null, |
| 390 | // "inMaint": true, |
| 391 | // "uuid": "d6557200-ecf2-4641-8094-5393ae3aae60", |
| 392 | // "originalName": "VF_vMee 0", |
| 393 | // "legacyRegion": null, |
| 394 | // "lineOfBusiness": null, |
| 395 | // "platformName": null, |
| 396 | // "trackById": "9a9b2705-c569-4f1b-9a67-13e9f86e6c55", |
| 397 | // "vfModules": { |
| 398 | // "vf_vmee0..VfVmee..vmme_vlc..module-1": { |
| 399 | // "2c1ca484-cbc2-408b-ab86-25a2c15ce280": { |
| 400 | // "action": "None", |
| 401 | // "instanceName": "ss820f_0918_db", |
| 402 | // "instanceId": "2c1ca484-cbc2-408b-ab86-25a2c15ce280", |
| 403 | // "orchStatus": "deleted", |
| 404 | // "productFamilyId": null, |
| 405 | // "lcpCloudRegionId": null, |
| 406 | // "tenantId": null, |
| 407 | // "modelInfo": { |
| 408 | // "modelCustomizationName": "VfVmee..vmme_vlc..module-1", |
| 409 | // "modelCustomizationId": "b200727a-1bf9-4e7c-bd06-b5f4c9d920b9", |
| 410 | // "modelInvariantId": "09edc9ef-85d0-4b26-80de-1f569d49e750", |
| 411 | // "modelVersionId": "522159d5-d6e0-4c2a-aa44-5a542a12a830", |
| 412 | // "modelType": "vfModule" |
| 413 | // }, |
| 414 | // "instanceType": null, |
| 415 | // "provStatus": null, |
| 416 | // "inMaint": true, |
| 417 | // "uuid": "522159d5-d6e0-4c2a-aa44-5a542a12a830", |
| 418 | // "originalName": "VfVmee..vmme_vlc..module-1", |
| 419 | // "legacyRegion": null, |
| 420 | // "lineOfBusiness": null, |
| 421 | // "platformName": null, |
| 422 | // "trackById": "2c1ca484-cbc2-408b-ab86-25a2c15ce280", |
| 423 | // "isBase": false, |
| 424 | // "volumeGroupName": null, |
| 425 | // "isFailed": true |
| 426 | // } |
| 427 | // }, |
| 428 | // "dc229cd8-c132-4455-8517-5c1787c18b14": { |
| 429 | // "3ef042c4-259f-45e0-9aba-0989bd8d1cc5": { |
| 430 | // "action": "None", |
| 431 | // "instanceName": "ss820f_0918_base", |
| 432 | // "instanceId": "3ef042c4-259f-45e0-9aba-0989bd8d1cc5", |
| 433 | // "orchStatus": "Assigned", |
| 434 | // "productFamilyId": null, |
| 435 | // "lcpCloudRegionId": null, |
| 436 | // "tenantId": null, |
| 437 | // "modelInfo": { |
| 438 | // "modelCustomizationId": "8ad8670b-0541-4499-8101-275bbd0e8b6a", |
| 439 | // "modelInvariantId": "1e463c9c-404d-4056-ba56-28fd102608de", |
| 440 | // "modelVersionId": "dc229cd8-c132-4455-8517-5c1787c18b14", |
| 441 | // "modelType": "vfModule" |
| 442 | // }, |
| 443 | // "instanceType": null, |
| 444 | // "provStatus": null, |
| 445 | // "inMaint": false, |
| 446 | // "uuid": "dc229cd8-c132-4455-8517-5c1787c18b14", |
| 447 | // "originalName": null, |
| 448 | // "legacyRegion": null, |
| 449 | // "lineOfBusiness": null, |
| 450 | // "platformName": null, |
| 451 | // "trackById": "3ef042c4-259f-45e0-9aba-0989bd8d1cc5", |
| 452 | // "isBase": true, |
| 453 | // "volumeGroupName": null |
| 454 | // } |
| 455 | // } |
| 456 | // }, |
| 457 | // "networks": {} |
| 458 | // } |
| 459 | // }, |
| 460 | // "networks": { |
| 461 | // "e1edb09e-e68b-4ebf-adb8-e2587be56257": { |
| 462 | // "action": "None", |
| 463 | // "instanceName": "cNpGlYQDsmrUDK5iG", |
| 464 | // "instanceId": "e1edb09e-e68b-4ebf-adb8-e2587be56257", |
| 465 | // "orchStatus": "Created", |
| 466 | // "productFamilyId": null, |
| 467 | // "lcpCloudRegionId": null, |
| 468 | // "tenantId": null, |
| 469 | // "modelInfo": { |
| 470 | // "modelInvariantId": "network-instance-model-invariant-id", |
| 471 | // "modelVersionId": "ddc3f20c-08b5-40fd-af72-c6d14636b986", |
| 472 | // "modelType": "network" |
| 473 | // }, |
| 474 | // "instanceType": "CONTRAIL30_HIMELGUARD", |
| 475 | // "provStatus": "preprov", |
| 476 | // "inMaint": false, |
| 477 | // "uuid": "ddc3f20c-08b5-40fd-af72-c6d14636b986", |
| 478 | // "originalName": null, |
| 479 | // "legacyRegion": null, |
| 480 | // "lineOfBusiness": null, |
| 481 | // "platformName": null, |
| 482 | // "trackById": "e1edb09e-e68b-4ebf-adb8-e2587be56257" |
| 483 | // }, |
| 484 | // "de4b5203-ad1c-4f2b-8843-5236fb8dc9ba": { |
| 485 | // "action": "None", |
| 486 | // "instanceName": "EI9QlSRVK0lon54Cb", |
| 487 | // "instanceId": "de4b5203-ad1c-4f2b-8843-5236fb8dc9ba", |
| 488 | // "orchStatus": "Assigned", |
| 489 | // "productFamilyId": null, |
| 490 | // "lcpCloudRegionId": null, |
| 491 | // "tenantId": null, |
| 492 | // "modelInfo": { |
| 493 | // "modelInvariantId": "network-instance-model-invariant-id", |
| 494 | // "modelVersionId": "ddc3f20c-08b5-40fd-af72-c6d14636b986", |
| 495 | // "modelType": "network" |
| 496 | // }, |
| 497 | // "instanceType": "CONTRAIL30_BASIC", |
| 498 | // "provStatus": "nvtprov", |
| 499 | // "inMaint": false, |
| 500 | // "uuid": "ddc3f20c-08b5-40fd-af72-c6d14636b986", |
| 501 | // "originalName": null, |
| 502 | // "legacyRegion": null, |
| 503 | // "lineOfBusiness": null, |
| 504 | // "platformName": null, |
| 505 | // "trackById": "de4b5203-ad1c-4f2b-8843-5236fb8dc9ba", |
| 506 | // "isFailed": true |
| 507 | // } |
| 508 | // }, |
| 509 | // "vnfGroups": {}, |
| 510 | // "validationCounter": 0, |
| 511 | // "existingVNFCounterMap": { |
| 512 | // "vnf-instance-model-version-id": 1, |
| 513 | // "d6557200-ecf2-4641-8094-5393ae3aae60": 1 |
| 514 | // }, |
| 515 | // "existingNetworksCounterMap": { |
| 516 | // "ddc3f20c-08b5-40fd-af72-c6d14636b986": 2 |
| 517 | // }, |
| 518 | // "existingVnfGroupCounterMap": {} |
| 519 | // } |
| 520 | // ); |
| 521 | |
| 522 | } |
| 523 | |
| 524 | public retrieveAndStoreServiceInstanceRetryTopology(jobId: string, serviceModeId : string):Observable<ServiceInstance> { |
| 525 | return this.retrieveServiceInstanceRetryTopology(jobId).do((service:ServiceInstance) => { |
| 526 | this.store.dispatch(createServiceInstance(service, serviceModeId)); |
| 527 | }); |
| 528 | }; |
| 529 | |
| 530 | public getOptionalGroupMembers(serviceModelId: string, subscriberId: string, serviceType: string, serviceInvariantId: string, groupType: string, groupRole: string): Observable<VnfMember[]> { |
| 531 | let pathQuery: string = `${Constants.Path.AAI_GET_SERVICE_GROUP_MEMBERS_PATH}${subscriberId}/${serviceType}/${serviceInvariantId}/${groupType}/${groupRole}`; |
| 532 | if(_.has(this.store.getState().service.serviceInstance[serviceModelId].optionalGroupMembersMap,pathQuery)){ |
| 533 | return of(<VnfMember[]> JSON.parse(JSON.stringify(this.store.getState().service.serviceInstance[serviceModelId].optionalGroupMembersMap[pathQuery]))); |
| 534 | } |
| 535 | return this.http.get<VnfMember[]>(pathQuery) |
| 536 | .do((res) => { |
| 537 | this.store.dispatch(setOptionalMembersVnfGroupInstance(serviceModelId, pathQuery, res)) |
| 538 | }); |
| 539 | // let res = Observable.of((JSON.parse(JSON.stringify(this.loadMockMembers())))); |
| 540 | // return res; |
| 541 | |
| 542 | } |
| 543 | |
| 544 | //TODO: make other places use this function |
| 545 | extractSubscriberNameBySubscriberId(subscriberId: string) { |
| 546 | let result: string = null; |
| 547 | let filteredArray: any = _.filter(this.store.getState().service.subscribers, function (o: Subscriber) { |
| 548 | return o.id === subscriberId |
| 549 | }); |
| 550 | if (filteredArray.length > 0) { |
| 551 | result = filteredArray[0].name; |
| 552 | } |
| 553 | return result; |
| 554 | } |
| 555 | |
| 556 | loadMockMembers(): any { |
| 557 | return [ |
| 558 | { |
| 559 | "action":"None", |
| 560 | "instanceName":"VNF1_INSTANCE_NAME", |
| 561 | "instanceId":"VNF1_INSTANCE_ID", |
| 562 | "orchStatus":null, |
| 563 | "productFamilyId":null, |
| 564 | "lcpCloudRegionId":"mtn23b", |
| 565 | "tenantId":"3e9a20a3e89e45f884e09df0cc2d2d2a", |
| 566 | "tenantName":"APPC-24595-T-IST-02C", |
| 567 | "modelInfo":{ |
| 568 | "modelInvariantId":"vnf-instance-model-invariant-id", |
| 569 | "modelVersionId":"7a6ee536-f052-46fa-aa7e-2fca9d674c44", |
| 570 | "modelVersion":"2.0", |
| 571 | "modelName":"vf_vEPDG", |
| 572 | "modelType":"vnf" |
| 573 | }, |
| 574 | "instanceType":"VNF1_INSTANCE_TYPE", |
| 575 | "provStatus":null, |
| 576 | "inMaint":false, |
| 577 | "uuid":"7a6ee536-f052-46fa-aa7e-2fca9d674c44", |
| 578 | "originalName":null, |
| 579 | "legacyRegion":null, |
| 580 | "lineOfBusiness":null, |
| 581 | "platformName":null, |
| 582 | "trackById":"7a6ee536-f052-46fa-aa7e-2fca9d674c44:002", |
| 583 | "serviceInstanceId":"service-instance-id1", |
| 584 | "serviceInstanceName":"service-instance-name" |
| 585 | }, |
| 586 | { |
| 587 | "action":"None", |
| 588 | "instanceName":"VNF2_INSTANCE_NAME", |
| 589 | "instanceId":"VNF2_INSTANCE_ID", |
| 590 | "orchStatus":null, |
| 591 | "productFamilyId":null, |
| 592 | "lcpCloudRegionId":"mtn23b", |
| 593 | "tenantId":"3e9a20a3e89e45f884e09df0cc2d2d2a", |
| 594 | "tenantName":"APPC-24595-T-IST-02C", |
| 595 | "modelInfo":{ |
| 596 | "modelInvariantId":"vnf-instance-model-invariant-id", |
| 597 | "modelVersionId":"eb5f56bf-5855-4e61-bd00-3e19a953bf02", |
| 598 | "modelVersion":"1.0", |
| 599 | "modelName":"vf_vEPDG", |
| 600 | "modelType":"vnf" |
| 601 | }, |
| 602 | "instanceType":"VNF2_INSTANCE_TYPE", |
| 603 | "provStatus":null, |
| 604 | "inMaint":true, |
| 605 | "uuid":"eb5f56bf-5855-4e61-bd00-3e19a953bf02", |
| 606 | "originalName":null, |
| 607 | "legacyRegion":null, |
| 608 | "lineOfBusiness":null, |
| 609 | "platformName":null, |
| 610 | "trackById":"eb5f56bf-5855-4e61-bd00-3e19a953bf02:003", |
| 611 | "serviceInstanceId":"service-instance-id2", |
| 612 | "serviceInstanceName":"service-instance-name" |
| 613 | } |
| 614 | ] |
| 615 | |
| 616 | } |
| 617 | |
| 618 | |
| 619 | } |