blob: a62fec673d6e9ae022abff6401f30825a303c1b3 [file] [log] [blame]
Sonsino, Ofir (os0695)ff76b5e2018-07-10 15:57:37 +03001import { Action, ActionCreator } from "redux";
2import { LcpRegionsAndTenants } from "./shared/models/lcpRegionsAndTenants";
3import { ServiceInstance } from "./shared/models/serviceInstance";
4import { SelectOptionInterface } from "./shared/models/selectOption";
5import { ServiceType } from "./shared/models/serviceType";
6import { VnfInstance } from "./shared/models/vnfInstance";
7
8export const UPDATE_MODEL = "[MODEL] Update";
9export const UPDATE_SERVICE_INSTANCE = "[SERVICE INSTANCE] Update";
10export const UPDATE_VNF_INSTANCE = "[VNF INSTANCE] Update";
11export const UPDATE_VF_MODULE = "[VF MODULE] Update";
12export const CREATE_VF_MODULE = "[VF MODULE] Create";
13
14export const UPDATE_LCP_REGIONS_AND_TENANTS = "[LCP_REGIONS_AND_TENANTS] Update";
15export const UPDATE_SUBSCRIBERS = "[SUBSCRIBERS] Update";
16export const UPDATE_PRODUCT_FAMILIES = "[PRODUCT_FAMILIES] Update";
17export const UPDATE_SERVICE_TYPES = "[SERVICE_TYPE] Update";
18export const UPDATE_AIC_ZONES = "[AIC_ZONES] Update";
19export const DELETE_SERVICE_INSTANCE = "[SERVICE_INSTANCE] Delete";
20export const DELETE_VNF_INSTANCE = "[VNF_INSTANCE] Delete";
21export const DELETE_VNF_MODULE_INSTANCE = "[VNF_MODULE_INSTANCE] Delete";
22export const UPDATE_CATEGORY_PARAMETERS = "[CATEGORY_PARAMETERS] Update";
23export const UPDATE_NETWORK_FUNCTION = "[UPDATE_NETWORK_FUNCTION] Update";
24export const UPDATE_USER_ID = "[UPDATE_USER_ID] Update";
25
26
27export interface UpdateServiceModelAction extends Action {
28 serviceHierarchy?: any;
29}
30
31export interface UpdateNetworkCollectionFunction extends Action {
32 networksAccordingToNetworkCollection: any;
33 network_function: any;
34}
35
36export interface UpdateServiceInstanceAction extends Action {
37 serviceUuid?: string;
38 serviceInstance?: ServiceInstance;
39}
40
41export interface UpdateVFModuleInstanceAction extends Action {
42 vfInstance: any;
43 vfId: string;
44 serviceUuid: string;
45}
46
47export interface CreateVFModuleInstanceAction extends Action {
48 vfInstance: any;
49 vfId: string;
50 serviceUuid: string;
51 index : number
52}
53
54export interface UpdateUserIdAction extends Action {
55 userId: string;
56}
57
58export interface UpdateVnfInstanceAction extends Action {
59 vnfInstance?: VnfInstance;
60 vnfModelName?: string;
61 serviceUuid?: string;
62}
63
64export interface UpdateLcpRegionsAndTenantsAction extends Action {
65 lcpRegionsAndTenants?: LcpRegionsAndTenants;
66}
67
68export interface UpdateSubscribersAction extends Action {
69 subscribers?: SelectOptionInterface[];
70}
71
72export interface UpdateProductFamiliesAction extends Action {
73 productFamilies?: SelectOptionInterface[];
74}
75
76export interface UpdateAicZonesAction extends Action {
77 aicZones?: SelectOptionInterface[];
78}
79
80export interface UpdateServiceTypesAction extends Action {
81 serviceTypes?: ServiceType[];
82 subscriberId: string;
83}
84
85export interface DeleteServiceInstanceAction extends Action {
86 serviceUuid?: string;
87}
88
89export interface DeleteVnfInstanceAction extends Action {
90 modelName?: string;
91 serviceModelId: string;
92}
93
94export interface DeleteVfModuleInstanceAction extends Action {
95 modelName?: string;
96 serviceModelId?: string;
97 vfName?: string;
98}
99
100export interface UpdateCategoryParametersAction extends Action {
101 categoryParameters?: string;
102}
103
104export const updateModel: ActionCreator<UpdateServiceModelAction> = serviceHierarchy => ({
105 type: UPDATE_MODEL,
106 serviceHierarchy: serviceHierarchy
107});
108
109export const updateServiceInstance: ActionCreator<UpdateServiceInstanceAction> = (serviceInstance, serviceUuid) => ({
110 type: UPDATE_SERVICE_INSTANCE,
111 serviceInstance: serviceInstance,
112 serviceUuid: serviceUuid
113});
114
115export const updateVFModuleInstance: ActionCreator<UpdateVFModuleInstanceAction> = (vfInstance, vfId, serviceUuid) => ({
116 type: UPDATE_VF_MODULE,
117 vfInstance: vfInstance,
118 vfId: vfId,
119 serviceUuid: serviceUuid
120})
121
122export const createVFModuleInstance: ActionCreator<CreateVFModuleInstanceAction> = (vfInstance, vfId, serviceUuid, index) => ({
123 type: CREATE_VF_MODULE,
124 vfInstance: vfInstance,
125 vfId: vfId,
126 serviceUuid: serviceUuid,
127 index : index
128})
129
130
131
132export const updateVNFInstance: ActionCreator<UpdateVnfInstanceAction> = (vnfInstance, vnfModelName, serviceUuid) => ({
133 type: UPDATE_VNF_INSTANCE,
134 vnfInstance: vnfInstance,
135 vnfModelName: vnfModelName,
136 serviceUuid: serviceUuid
137});
138
139export const updateLcpRegionsAndTenants: ActionCreator<UpdateLcpRegionsAndTenantsAction> = lcpRegionsAndTenants => ({
140 type: UPDATE_LCP_REGIONS_AND_TENANTS,
141 lcpRegionsAndTenants: lcpRegionsAndTenants
142});
143
144export const updateSubscribers: ActionCreator<UpdateSubscribersAction> = subscribers => ({
145 type: UPDATE_SUBSCRIBERS,
146 subscribers: subscribers
147});
148
149export const updateProductFamilies: ActionCreator<UpdateProductFamiliesAction> = productFamilies => ({
150 type: UPDATE_PRODUCT_FAMILIES,
151 productFamilies: productFamilies
152});
153
154export const updateAicZones: ActionCreator<UpdateAicZonesAction> = aicZones => ({
155 type: UPDATE_AIC_ZONES,
156 aicZones: aicZones
157});
158
159export const updateUserId: ActionCreator<UpdateUserIdAction> = userId => ({
160 type: UPDATE_USER_ID,
161 userId: userId
162});
163
164export const updateCategoryParameters: ActionCreator<UpdateCategoryParametersAction> = categoryParameters => ({
165 type: UPDATE_CATEGORY_PARAMETERS,
166 categoryParameters: categoryParameters
167});
168
169export const updateServiceTypes: ActionCreator<UpdateServiceTypesAction> = (serviceTypes, subscriberId) => ({
170 type: UPDATE_SERVICE_TYPES,
171 serviceTypes: serviceTypes,
172 subscriberId: subscriberId
173});
174
175export const updateNetworkCollectionFunction: ActionCreator<UpdateNetworkCollectionFunction> = (ncf, networksAccordingToNetworkCollection) => ({
176 type: UPDATE_NETWORK_FUNCTION,
177 networksAccordingToNetworkCollection: networksAccordingToNetworkCollection["results"],
178 network_function: ncf
179});
180
181export const deleteServiceInstance: ActionCreator<DeleteServiceInstanceAction> = serviceUuid => ({
182 type: DELETE_SERVICE_INSTANCE,
183 serviceUuid: serviceUuid
184});
185
186export const deleteVnfInstance: ActionCreator<DeleteVnfInstanceAction> = (modelName, serviceModelId) => ({
187 type: DELETE_VNF_INSTANCE,
188 modelName: modelName,
189 serviceModelId: serviceModelId
190});
191
192export const deleteVfModuleInstance: ActionCreator<DeleteVfModuleInstanceAction> = (modelName, serviceModelId, vfName) => ({
193 type: DELETE_VNF_MODULE_INSTANCE,
194 modelName: modelName,
195 serviceModelId: serviceModelId,
196 vfName: vfName
197});