summaryrefslogtreecommitdiffstats
path: root/vid-webpack-master/src/app/services/aaiService
diff options
context:
space:
mode:
Diffstat (limited to 'vid-webpack-master/src/app/services/aaiService')
-rw-r--r--vid-webpack-master/src/app/services/aaiService/aai.actions.ts75
-rw-r--r--vid-webpack-master/src/app/services/aaiService/aai.epics.ts81
-rw-r--r--vid-webpack-master/src/app/services/aaiService/aai.service.ts189
-rw-r--r--vid-webpack-master/src/app/services/aaiService/responseInterfaces/getAicZonesResponseInterface.ts3
-rw-r--r--vid-webpack-master/src/app/services/aaiService/responseInterfaces/getCategoryParamsResponseInterface.ts10
-rw-r--r--vid-webpack-master/src/app/services/aaiService/responseInterfaces/getServiceModelResponseInterface.ts5
-rw-r--r--vid-webpack-master/src/app/services/aaiService/responseInterfaces/getServicesResponseInterface.ts9
-rw-r--r--vid-webpack-master/src/app/services/aaiService/responseInterfaces/getSubDetailsResponseInterface.ts12
-rw-r--r--vid-webpack-master/src/app/services/aaiService/responseInterfaces/getSubscribersResponseInterface.ts5
9 files changed, 0 insertions, 389 deletions
diff --git a/vid-webpack-master/src/app/services/aaiService/aai.actions.ts b/vid-webpack-master/src/app/services/aaiService/aai.actions.ts
deleted file mode 100644
index 649fb1456..000000000
--- a/vid-webpack-master/src/app/services/aaiService/aai.actions.ts
+++ /dev/null
@@ -1,75 +0,0 @@
-import {Action, ActionCreator} from "redux";
-
-export const LOAD_PRODUCT_FAMILIES = '[PRODUCT_FAMILIES] Load';
-
-export const LOAD_LCP_TENANT = '[LCP_TENANT] Load';
-
-export const LOAD_AIC_ZONES = '[AIC_ZONES] Load';
-
-export const LOAD_CATEGORY_PARAMETERS = '[LOAD_CATEGORY_PARAMETERS] Load';
-
-export const LOAD_SERVICE_MDOEL_BY_UUID = '[LOAD_SERVICE_MDOEL_BY_UUID] Load';
-
-export const LOAD_NETWORK_ACCORDING_TO_NF = '[LOAD_NETWORK_ACCORDING_TO_NF] Load'
-
-export const LOAD_USER_ID = '[LOAD_USER_ID] Load'
-
-
-export interface LoadProductFamiliesAction extends Action {}
-
-interface LoadLcpTenant extends Action {}
-
-interface LoadAicZones extends Action {}
-
-interface LoadCategoryParameters extends Action {}
-
-interface LoadServiceModelByUuid extends Action {}
-
-interface LoadNetworkAccordingToNetworkCF extends Action{}
-
-interface LoadUserId extends Action{}
-
-
-export const loadServiceAccordingToUuid : ActionCreator<LoadServiceModelByUuid> =
- (uuid : string) =>({
- type : LOAD_SERVICE_MDOEL_BY_UUID,
- modelId : uuid
- })
-
-
-export const loadProductFamiliesAction: ActionCreator<LoadProductFamiliesAction> =
- () => ({
- type: LOAD_PRODUCT_FAMILIES,
- });
-
-
-export const loadUserId: ActionCreator<LoadUserId> =
-() => ({
- type: LOAD_USER_ID,
-});
-
-
- export const loadLcpTenant: ActionCreator<LoadLcpTenant> =
- () => ({
- type: LOAD_LCP_TENANT,
- });
-
-
-export const loadAicZones: ActionCreator<LoadAicZones> =
- () => ({
- type: LOAD_AIC_ZONES,
- });
-
-export const loadCategoryParameters: ActionCreator<LoadCategoryParameters> =
- () => ({
- type: LOAD_CATEGORY_PARAMETERS,
- });
-
-
-export const loadAaiNetworkAccordingToNetworkCF: ActionCreator<LoadNetworkAccordingToNetworkCF> =
- (networkFunction,cloudOwner,cloudRegionId) => ({
- type: LOAD_NETWORK_ACCORDING_TO_NF,
- networkFunctions: networkFunction,
- cloudOwner: cloudOwner,
- cloudRegionId: cloudRegionId
- });
diff --git a/vid-webpack-master/src/app/services/aaiService/aai.epics.ts b/vid-webpack-master/src/app/services/aaiService/aai.epics.ts
deleted file mode 100644
index 5249cea82..000000000
--- a/vid-webpack-master/src/app/services/aaiService/aai.epics.ts
+++ /dev/null
@@ -1,81 +0,0 @@
-import {updateServiceInstance} from './../../service.actions';
-import {Injectable} from '@angular/core';
-import {createEpicMiddleware} from 'redux-observable';
-import 'rxjs/add/operator/catch';
-import 'rxjs/add/operator/map';
-import 'rxjs/add/operator/do';
-import 'rxjs/add/operator/startWith';
-import {
- LOAD_PRODUCT_FAMILIES,
- LOAD_LCP_TENANT,
- LOAD_AIC_ZONES,
- LOAD_CATEGORY_PARAMETERS,
- LOAD_SERVICE_MDOEL_BY_UUID,
- LOAD_NETWORK_ACCORDING_TO_NF,
- LOAD_USER_ID
-} from "./aai.actions";
-import {AaiService} from "./aai.service";
-import {
- updateAicZones, updateCategoryParameters, updateLcpRegionsAndTenants, updateNetworkCollectionFunction,
- updateProductFamilies, updateUserId
-} from "../../service.actions";
-import {AppState} from "../../store/reducers";
-
-const notFetchedAlready = (state: AppState): boolean => state.service.productFamilies !== null;
-
-@Injectable()
-export class AAIEpics {
- constructor(private aaiService: AaiService) {
- }
-
- public createEpic() {
- return [createEpicMiddleware(this.loadProductFamiliesEpic)
- , createEpicMiddleware(this.loadLcpTenants)
- , createEpicMiddleware(this.loadAicZones)
- , createEpicMiddleware(this.loadCategoryParameters)
- , createEpicMiddleware(this.loadServiceAccordingToUuid)
- , createEpicMiddleware(this.loadNetworkAccordingToNetworkFunction)
- , createEpicMiddleware(this.loadUserId)
- ];
- }
-
- private loadLcpTenants = (action$, store) =>
- action$
- .ofType(LOAD_LCP_TENANT)
- .switchMap(() => this
- .aaiService
- .getLcpRegionsAndTenants('e433710f-9217-458d-a79d-1c7aff376d89', 'VIRTUAL USP')
- .map(data => updateLcpRegionsAndTenants(data)));
-
- private loadProductFamiliesEpic = (action$, store) => action$
- .ofType(LOAD_PRODUCT_FAMILIES)
- .switchMap(() => this.aaiService.getProductFamilies().map(data => updateProductFamilies(data)));
-
- private loadCategoryParameters = (action$, store) => action$
- .ofType(LOAD_CATEGORY_PARAMETERS)
- .switchMap(() => this.aaiService.getCategoryParameters(null).map(data => updateCategoryParameters(data)));
-
-
- private loadNetworkAccordingToNetworkFunction = (action$, store) => action$
- .ofType(LOAD_NETWORK_ACCORDING_TO_NF)
- .flatMap((action) => this.aaiService.getCRAccordingToNetworkFunctionId(action.networkFunctions, action.cloudOwner, action.cloudRegionId).map((res) =>
- updateNetworkCollectionFunction(action.networkFunctions, res)));
-
- private loadServiceAccordingToUuid = (action$, store) => action$
- .ofType(LOAD_SERVICE_MDOEL_BY_UUID)
- .switchMap((action) => this.aaiService.getServiceModelById(action.modelId)
- .map(data => updateServiceInstance(action.uuid, data)));
-
- private loadUserId = (action$, store) => action$
- .ofType(LOAD_USER_ID)
- .switchMap(() => this.aaiService.getUserId()
- .map(res => updateUserId(res)));
-
-
- private loadAicZones = (action$, store) => action$
- .ofType(LOAD_AIC_ZONES)
- .switchMap(() => this.aaiService.getAicZones().map(data => updateAicZones(data)));
- // .catch(response => of(this.actions.loadFailed(status)))
- // .startWith(this.actions.loadStarted()));
-
-}
diff --git a/vid-webpack-master/src/app/services/aaiService/aai.service.ts b/vid-webpack-master/src/app/services/aaiService/aai.service.ts
deleted file mode 100644
index dd9d9fb29..000000000
--- a/vid-webpack-master/src/app/services/aaiService/aai.service.ts
+++ /dev/null
@@ -1,189 +0,0 @@
-import {Injectable} from '@angular/core';
-import {HttpClient, HttpHeaders} from '@angular/common/http';
-import { Constants } from '../../shared/utils/constants';
-import { ServiceType } from "../../shared/models/serviceType";
-import {GetSubDetailsResponse} from "./responseInterfaces/getSubDetailsResponseInterface";
-import {Observable} from "rxjs/Observable";
-import * as _ from 'lodash';
-import {CategoryParams} from "../../shared/models/categoryParams";
-import {GetCategoryParamsResponseInterface} from "./responseInterfaces/getCategoryParamsResponseInterface";
-import {Project} from "../../shared/models/project";
-import {OwningEntity} from "../../shared/models/owningEntity";
-import {GetServicesResponseInterface} from "./responseInterfaces/getServicesResponseInterface";
-import {Subscriber} from "../../shared/models/subscriber";
-import {GetSubscribersResponse} from "./responseInterfaces/getSubscribersResponseInterface";
-import {AicZone} from "../../shared/models/aicZone";
-import {GetAicZonesResponse} from "./responseInterfaces/getAicZonesResponseInterface";
-import {LcpRegionsAndTenants} from "../../shared/models/lcpRegionsAndTenants";
-import {LcpRegion} from "../../shared/models/lcpRegion";
-import {Tenant} from "../../shared/models/tenant";
-import {ProductFamily} from "../../shared/models/productFamily"
-import {
- updateAicZones, updateCategoryParameters, updateLcpRegionsAndTenants, updateModel, updateProductFamilies,
- updateServiceTypes, updateSubscribers, updateUserId
-} from '../../service.actions';
-import {SelectOption} from '../../shared/models/selectOption';
-import {NgRedux} from "@angular-redux/store";
-import {AppState} from "../../store/reducers";
-import {ResponseContentType, ResponseType} from "@angular/http";
-import 'rxjs/add/operator/do';
-import 'rxjs/add/observable/of';
-import 'rxjs/add/operator/catch';
-
-@Injectable()
-export class AaiService {
-
- constructor (private http: HttpClient, private store: NgRedux<AppState>) {}
-
- public getServiceModelById(serviceModelId: string): Observable<any> {
- if (_.has(this.store.getState().service.serviceHierarchy,serviceModelId)){
- return Observable.of(<any> JSON.parse(JSON.stringify(this.store.getState().service.serviceHierarchy[serviceModelId])));
- }
- let pathQuery: string = Constants.Path.SERVICES_PATH + serviceModelId;
- return this.http.get(pathQuery).map(res => res )
- .do((res) => {
- this.store.dispatch(updateModel(res));
- });
- }
-
- public getUserId() : Observable<any>{
- return this.http.get("../../getuserID",{responseType: 'text'}).do((res)=>this.store.dispatch(updateUserId(res)));
- }
-
-
- public getCRAccordingToNetworkFunctionId(networkCollectionFunction,cloudOwner,cloudRegionId){
- return this.http.get('../../aai_get_instance_groups_by_cloudregion/'+cloudOwner+'/'+cloudRegionId+'/' + networkCollectionFunction)
- .map(res=>res).do((res)=>console.log(res));
- }
-
- public getCategoryParameters(familyName): Observable<CategoryParams> {
- familyName = familyName || Constants.Path.PARAMETER_STANDARDIZATION_FAMILY;
- let pathQuery: string = Constants.Path.GET_CATEGORY_PARAMETERS +"?familyName=" + familyName+ "&r=" + Math.random();
-
- return this.http.get<GetCategoryParamsResponseInterface>(pathQuery)
- .map(this.categoryParametersResponseToProductAndOwningEntity)
- .do(res => {
- this.store.dispatch(updateCategoryParameters(res))
- });
- }
-
-
-
- categoryParametersResponseToProductAndOwningEntity(res: GetCategoryParamsResponseInterface): CategoryParams {
- if (res && res.categoryParameters) {
- const owningEntityList = res.categoryParameters.owningEntity.map(owningEntity => new OwningEntity(owningEntity));
- const projectList = res.categoryParameters.project.map(project => new Project(project));
- const lineOfBusinessList = res.categoryParameters.lineOfBusiness.map(owningEntity => new SelectOption(owningEntity));
- const platformList = res.categoryParameters.platform.map(platform => new SelectOption(platform));
-
- return new CategoryParams(owningEntityList, projectList, lineOfBusinessList, platformList);
- } else {
- return new CategoryParams();
- }
- }
-
- public getProductFamilies(): Observable<ProductFamily[]> {
- return this.getServices().map(res => res.service.map(service => new ProductFamily(service)));
- }
-
- public getServices(): Observable<GetServicesResponseInterface> {
- let pathQuery: string = Constants.Path.AAI_GET_SERVICES + Constants.Path.ASSIGN + Math.random();
-
- return this.http.get<GetServicesResponseInterface>(pathQuery);
- }
-
- public getSubscribers(): Observable<Subscriber[]> {
- if (this.store.getState().service.subscribers){
- return Observable.of(<any> JSON.parse(JSON.stringify(this.store.getState().service.subscribers)));
- }
-
- let pathQuery: string = Constants.Path.AAI_GET_SUBSCRIBERS + Constants.Path.ASSIGN + Math.random();
-
- return this.http.get<GetSubscribersResponse>(pathQuery).map(res =>
- res.customer.map( subscriber => new Subscriber(subscriber))).do((res) => {
- this.store.dispatch(updateSubscribers(res));
- });
- }
-
- public getAicZones(): Observable<AicZone[]> {
- if (this.store.getState().service.aicZones){
- return Observable.of(<any> JSON.parse(JSON.stringify(this.store.getState().service.aicZones)));
- }
-
- let pathQuery: string = Constants.Path.AAI_GET_AIC_ZONES + Constants.Path.ASSIGN + Math.random();
-
- return this.http.get<GetAicZonesResponse>(pathQuery).map(res =>
- res.zone.map(aicZone => new AicZone(aicZone))).do((res) => {
- this.store.dispatch(updateAicZones(res));
- });
- }
-
- public getLcpRegionsAndTenants(globalCustomerId, serviceType): Observable<LcpRegionsAndTenants> {
- if (this.store.getState().service.lcpRegionsAndTenants.lcpRegionList.length !== 0){
- return Observable.of(<any> JSON.parse(JSON.stringify(this.store.getState().service.lcpRegionsAndTenants)));
- }
- let pathQuery: string = Constants.Path.AAI_GET_TENANTS
- + globalCustomerId + Constants.Path.FORWARD_SLASH + serviceType + Constants.Path.ASSIGN + Math.random();
-
- console.log("AaiService:getSubscriptionServiceTypeList: globalCustomerId: "
- + globalCustomerId);
- if (globalCustomerId != null) {
- return this.http.get(pathQuery)
- .map(this.tenantResponseToLcpRegionsAndTenants).do((res) => {
- this.store.dispatch(updateLcpRegionsAndTenants(res));
- });
- }
- }
-
- tenantResponseToLcpRegionsAndTenants(cloudRegionTenantList): LcpRegionsAndTenants {
-
- const lcpRegionsTenantsMap = {};
-
- const lcpRegionList = _.uniqBy(cloudRegionTenantList, 'cloudRegionID').map((cloudRegionTenant) => {
- return new LcpRegion(cloudRegionTenant)
- });
-
- lcpRegionList.forEach(region => {
- lcpRegionsTenantsMap[region.id] = _.filter(cloudRegionTenantList, {'cloudRegionID' : region.id})
- .map((cloudRegionTenant) => {
- return new Tenant(cloudRegionTenant)
- });
- const reducer = (accumulator, currentValue) => {
- accumulator.isPermitted = accumulator.isPermitted || currentValue.isPermitted;
-
- return accumulator;
- };
- region.isPermitted = lcpRegionsTenantsMap[region.id].reduce(reducer).isPermitted;
- });
-
- return new LcpRegionsAndTenants(lcpRegionList, lcpRegionsTenantsMap);
- }
-
- public getServiceTypes(subscriberId): Observable<ServiceType[]> {
- console.log("AaiService:getSubscriptionServiceTypeList: globalCustomerId: " + subscriberId);
- if (_.has(this.store.getState().service.serviceTypes, subscriberId)){
- return Observable.of(<any> JSON.parse(JSON.stringify(this.store.getState().service.serviceTypes[subscriberId])));
- }
-
- return this.getSubscriberDetails(subscriberId)
- .map(this.subDetailsResponseToServiceTypes)
- .do((res) => {this.store.dispatch(updateServiceTypes(res, subscriberId));});
- }
-
- public getSubscriberDetails(subscriberId): Observable<GetSubDetailsResponse> {
- let pathQuery: string = Constants.Path.AAI_SUB_DETAILS_PATH + subscriberId + Constants.Path.ASSIGN + Math.random();
-
- if (subscriberId != null) {
- return this.http.get<GetSubDetailsResponse>(pathQuery);
- }
- }
-
- subDetailsResponseToServiceTypes(res: GetSubDetailsResponse): ServiceType[] {
- if (res && res['service-subscriptions']) {
- const serviceSubscriptions = res['service-subscriptions']['service-subscription'];
- return serviceSubscriptions.map((subscription, index) => new ServiceType(String(index), subscription))
- } else {
- return [];
- }
- }
-}
diff --git a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getAicZonesResponseInterface.ts b/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getAicZonesResponseInterface.ts
deleted file mode 100644
index 62581c9e2..000000000
--- a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getAicZonesResponseInterface.ts
+++ /dev/null
@@ -1,3 +0,0 @@
-export interface GetAicZonesResponse {
- zone: any[];
-}
diff --git a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getCategoryParamsResponseInterface.ts b/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getCategoryParamsResponseInterface.ts
deleted file mode 100644
index 06398904c..000000000
--- a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getCategoryParamsResponseInterface.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-interface CategoryParametersResponse {
- owningEntity: any[],
- project: any[]
- lineOfBusiness: any[]
- platform: any[]
-}
-
-export interface GetCategoryParamsResponseInterface {
- categoryParameters: CategoryParametersResponse;
-}
diff --git a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getServiceModelResponseInterface.ts b/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getServiceModelResponseInterface.ts
deleted file mode 100644
index 87671155d..000000000
--- a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getServiceModelResponseInterface.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import {ServiceModelResponseInterface} from "../../../shared/models/serviceModel";
-
-export interface GetServiceModelResponseInterface {
- service: ServiceModelResponseInterface
-}
diff --git a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getServicesResponseInterface.ts b/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getServicesResponseInterface.ts
deleted file mode 100644
index ae04055e4..000000000
--- a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getServicesResponseInterface.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-export interface ServiceResponseInterface {
- 'service-id': string,
- 'service-description': string
- 'is-permitted': boolean
-}
-
-export interface GetServicesResponseInterface {
- service: ServiceResponseInterface[];
-}
diff --git a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getSubDetailsResponseInterface.ts b/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getSubDetailsResponseInterface.ts
deleted file mode 100644
index dbfb695d0..000000000
--- a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getSubDetailsResponseInterface.ts
+++ /dev/null
@@ -1,12 +0,0 @@
-export interface Subscription {
- 'service-type': string;
- 'is-permitted': boolean;
-}
-
-interface ServiceSubscriptions {
- 'service-subscription': Subscription[];
-}
-
-export interface GetSubDetailsResponse {
- 'service-subscriptions': ServiceSubscriptions;
-}
diff --git a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getSubscribersResponseInterface.ts b/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getSubscribersResponseInterface.ts
deleted file mode 100644
index 065f66e21..000000000
--- a/vid-webpack-master/src/app/services/aaiService/responseInterfaces/getSubscribersResponseInterface.ts
+++ /dev/null
@@ -1,5 +0,0 @@
-import {Subscriber} from "../../../shared/models/subscriber";
-
-export interface GetSubscribersResponse {
- customer: Subscriber[];
-}