Bugfixes for December 2018
[so.git] / bpmn / so-bpmn-tasks / src / main / java / org / onap / so / bpmn / infrastructure / aai / tasks / AAIUpdateTasks.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  * 
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  * 
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.onap.so.bpmn.infrastructure.aai.tasks;
22
23 import java.util.List;
24 import java.util.Map;
25
26 import org.onap.so.adapters.nwrest.CreateNetworkResponse;
27 import org.onap.so.bpmn.common.BuildingBlockExecution;
28 import org.onap.so.bpmn.servicedecomposition.bbobjects.CloudRegion;
29 import org.onap.so.bpmn.servicedecomposition.bbobjects.Collection;
30 import org.onap.so.bpmn.servicedecomposition.bbobjects.Configuration;
31 import org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf;
32 import org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network;
33 import org.onap.so.bpmn.servicedecomposition.bbobjects.ServiceInstance;
34 import org.onap.so.bpmn.servicedecomposition.bbobjects.Subnet;
35 import org.onap.so.bpmn.servicedecomposition.bbobjects.VfModule;
36 import org.onap.so.bpmn.servicedecomposition.bbobjects.VolumeGroup;
37 import org.onap.so.bpmn.servicedecomposition.entities.GeneralBuildingBlock;
38 import org.onap.so.bpmn.servicedecomposition.entities.ResourceKey;
39 import org.onap.so.bpmn.servicedecomposition.tasks.ExtractPojosForBB;
40 import org.onap.so.client.exception.BBObjectNotFoundException;
41 import org.onap.so.client.exception.ExceptionBuilder;
42 import org.onap.so.client.orchestration.AAICollectionResources;
43 import org.onap.so.client.orchestration.AAIConfigurationResources;
44 import org.onap.so.client.orchestration.AAINetworkResources;
45 import org.onap.so.client.orchestration.AAIServiceInstanceResources;
46 import org.onap.so.client.orchestration.AAIVfModuleResources;
47 import org.onap.so.client.orchestration.AAIVnfResources;
48 import org.onap.so.client.orchestration.AAIVolumeGroupResources;
49 import org.onap.so.db.catalog.beans.OrchestrationStatus;
50 import org.onap.so.logger.MsoLogger;
51 import org.springframework.beans.factory.annotation.Autowired;
52 import org.springframework.stereotype.Component;
53
54 @Component
55 public class AAIUpdateTasks {
56         private static final MsoLogger msoLogger = MsoLogger.getMsoLogger(MsoLogger.Catalog.BPEL, AAIUpdateTasks.class);
57         private static final String ALACARTE = "aLaCarte";
58         private static final String MULTI_STAGE_DESIGN_OFF = "false";
59         private static final String MULTI_STAGE_DESIGN_ON = "true";
60         @Autowired
61         private AAIServiceInstanceResources aaiServiceInstanceResources;
62         @Autowired
63         private AAIVnfResources aaiVnfResources;
64         @Autowired
65         private AAIVfModuleResources aaiVfModuleResources;
66         @Autowired
67         private ExceptionBuilder exceptionUtil;
68         @Autowired
69         private ExtractPojosForBB extractPojosForBB;
70         @Autowired
71         private AAIVolumeGroupResources aaiVolumeGroupResources;
72         @Autowired
73         private AAINetworkResources aaiNetworkResources;
74         @Autowired
75         private AAICollectionResources aaiCollectionResources;
76         @Autowired
77         private AAIConfigurationResources aaiConfigurationResources;
78         
79         public void updateOrchestrationStatusAssignedService(BuildingBlockExecution execution) {
80                 try {
81                         ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
82                         aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ASSIGNED);
83                         execution.setVariable("aaiServiceInstanceRollback", true);
84                 } catch (Exception ex) {
85                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
86                 }
87         }
88         
89         public void updateOrchestrationStatusActiveService(BuildingBlockExecution execution) {
90                 try {
91                         ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
92                         aaiServiceInstanceResources.updateOrchestrationStatusServiceInstance(serviceInstance, OrchestrationStatus.ACTIVE);
93                 } catch (Exception ex) {
94                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
95                 }
96         }
97
98         public void updateOrchestrationStatusAssignedVnf(BuildingBlockExecution execution) {
99                 try {
100                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
101                         aaiVnfResources.updateOrchestrationStatusVnf(vnf,OrchestrationStatus.ASSIGNED);
102                 } catch (Exception ex) {
103                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
104                 }
105         }
106         
107         public void updateOrchestrationStatusActiveVnf(BuildingBlockExecution execution) {
108                 try {
109                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
110                         aaiVnfResources.updateOrchestrationStatusVnf(vnf,OrchestrationStatus.ACTIVE);
111                 } catch (Exception ex) {
112                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
113                 }
114         }
115         
116         public void updateOrchestrationStatusAssignedVolumeGroup(BuildingBlockExecution execution) {
117                 try {
118                         GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
119                         
120                         VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
121                         CloudRegion cloudRegion = gBBInput.getCloudRegion();
122                         volumeGroup.setHeatStackId("");
123                         aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ASSIGNED);
124                 } catch (Exception ex) {
125                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
126                 }
127         }
128         
129         public void updateOrchestrationStatusActiveVolumeGroup(BuildingBlockExecution execution) {
130                 try {
131                         GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
132                         
133                         VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
134                         CloudRegion cloudRegion = gBBInput.getCloudRegion();
135                         
136                         aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.ACTIVE);
137                 } catch (Exception ex) {
138                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
139                 }
140         }
141         
142         public void updateOrchestrationStatusCreatedVolumeGroup(BuildingBlockExecution execution) {
143                 try {
144                         GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
145                         
146                         VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
147                         CloudRegion cloudRegion = gBBInput.getCloudRegion();
148                         
149                         aaiVolumeGroupResources.updateOrchestrationStatusVolumeGroup(volumeGroup, cloudRegion, OrchestrationStatus.CREATED);
150                 } catch (Exception ex) {
151                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
152                 }
153         }
154         
155         public void updateHeatStackIdVolumeGroup(BuildingBlockExecution execution) {
156                 try {
157                         GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
158                         String heatStackId = execution.getVariable("heatStackId");
159                         if (heatStackId == null) {
160                                 heatStackId = "";
161                         }                       
162                         VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
163                         CloudRegion cloudRegion = gBBInput.getCloudRegion();
164                         volumeGroup.setHeatStackId(heatStackId);
165                         
166                         aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
167                 } catch (Exception ex) {
168                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
169                 }
170         }
171         
172         public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
173                 try {
174                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
175                         vfModule.setHeatStackId("");
176                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
177                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED);
178                 } catch (Exception ex) {                        
179                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
180                 }
181         }
182         
183         public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) {
184                 try {
185                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
186                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
187                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION);
188                 } catch (Exception ex) {
189                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
190                 }
191         }
192         
193         public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
194                 try {
195                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
196                         vfModule.setHeatStackId("");
197                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
198                         String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
199                         if (vnf.getModelInfoGenericVnf() != null) {
200                                 multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign();
201                         }
202                         boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
203                         if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
204                                 aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION);
205                         }
206                         else {
207                                 aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED);
208                         }
209                 } catch (Exception ex) {                        
210                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
211                 }
212         }
213         
214         public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {                
215                 try {
216                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
217                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
218                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED);                       
219                 } catch (Exception ex) {
220                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
221                 }
222         }       
223         
224         public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {     
225                 execution.setVariable("aaiDeactivateVfModuleRollback", false);
226                 try {
227                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
228                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
229                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED);
230                         execution.setVariable("aaiDeactivateVfModuleRollback", true);
231                 } catch (Exception ex) {
232                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
233                 }
234         }
235         
236         /**
237          * BPMN access method to update status of L3Network to Assigned in AAI
238          * @param execution
239          * @throws BBObjectNotFoundException 
240          */
241         public void updateOrchestrationStatusAssignedNetwork(BuildingBlockExecution execution) {
242                 updateNetwork(execution, OrchestrationStatus.ASSIGNED);
243         }
244         
245         /**
246          * BPMN access method to update status of L3Network to Active in AAI
247          * @param execution
248          * @throws BBObjectNotFoundException 
249          */
250         public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) {
251                 updateNetwork(execution, OrchestrationStatus.ACTIVE);
252         }
253         
254         /**
255          * BPMN access method to update status of L3Network to Created in AAI
256          * @param execution
257          * @throws BBObjectNotFoundException 
258          */
259         public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) {
260                 updateNetwork(execution, OrchestrationStatus.CREATED);
261         }
262         
263         protected void updateNetwork(BuildingBlockExecution execution, OrchestrationStatus status) {
264                 try {
265                         L3Network l3Network =  extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
266                         updateNetworkAAI(l3Network, status);
267                 } catch (Exception ex) {
268                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
269                 }
270         }
271         
272         protected void updateNetworkAAI(L3Network l3Network, OrchestrationStatus status) {
273                 L3Network copiedl3Network = l3Network.shallowCopyId();
274
275                 copiedl3Network.setOrchestrationStatus(status);
276                 l3Network.setOrchestrationStatus(status);
277                 aaiNetworkResources.updateNetwork(copiedl3Network);
278                 
279                 List<Subnet> subnets = l3Network.getSubnets();
280                 if (subnets != null){
281                         for (Subnet subnet : subnets){
282                                 Subnet copiedSubnet = subnet.shallowCopyId();
283                                 copiedSubnet.setOrchestrationStatus(status);
284                                 aaiNetworkResources.updateSubnet(copiedl3Network, copiedSubnet);
285                         }
286                 }
287         }
288         
289         /**
290          * BPMN access method to update status of L3Network Collection to Active in AAI
291          * @param execution
292          * @throws BBObjectNotFoundException 
293          */
294         public void updateOrchestrationStatusActiveNetworkCollection(BuildingBlockExecution execution) {
295                 execution.setVariable("aaiNetworkCollectionActivateRollback", false);
296                 try {
297                         ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
298                         Collection networkCollection = serviceInstance.getCollection();
299                         Collection copiedNetworkCollection = networkCollection.shallowCopyId();
300
301                         networkCollection.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
302                         copiedNetworkCollection.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
303                         aaiCollectionResources.updateCollection(copiedNetworkCollection);
304                         execution.setVariable("aaiNetworkCollectionActivateRollback", true);
305                 } catch (Exception ex) {
306                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
307                 }
308         }
309         
310         public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
311                 execution.setVariable("aaiActivateVfModuleRollback", false);
312                 try {
313                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
314                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
315                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
316                         execution.setVariable("aaiActivateVfModuleRollback", true);
317                 } catch (Exception ex) {
318                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
319                 }
320         }
321         
322         public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {               
323                 try {
324                         String heatStackId = execution.getVariable("heatStackId");
325                         if (heatStackId == null) {
326                                 heatStackId = "";
327                         }
328                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
329                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
330                         vfModule.setHeatStackId(heatStackId);
331                         aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);                  
332                 } catch (Exception ex) {
333                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
334                 }
335         }
336         
337         /**
338          * BPMN access method to update L3Network after it was created in AIC
339          * @param execution
340          * @throws Exception
341          */
342         public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception {
343                 execution.setVariable("aaiNetworkActivateRollback", false);
344                 L3Network l3network =  extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
345                 L3Network copiedl3network = l3network.shallowCopyId();
346                 CreateNetworkResponse response = execution.getVariable("createNetworkResponse");
347                 try {
348                         if(response.getNetworkFqdn()!=null){
349                         l3network.setContrailNetworkFqdn(response.getNetworkFqdn());
350                         }
351                         l3network.setOrchestrationStatus(OrchestrationStatus.CREATED);
352                         l3network.setHeatStackId(response.getNetworkStackId());
353                         l3network.setNeutronNetworkId(response.getNeutronNetworkId());
354
355                         copiedl3network.setContrailNetworkFqdn(response.getNetworkFqdn());
356                         copiedl3network.setOrchestrationStatus(OrchestrationStatus.CREATED);
357                         copiedl3network.setHeatStackId(response.getNetworkStackId());
358                         copiedl3network.setNeutronNetworkId(response.getNeutronNetworkId());
359
360                         aaiNetworkResources.updateNetwork(copiedl3network);
361                         
362                         Map<String, String> subnetMap = response.getSubnetMap();
363                         List<Subnet> subnets = l3network.getSubnets();
364                         if (subnets != null && subnetMap != null){
365                                 for (Subnet subnet: subnets){
366                                         Subnet copiedSubnet = subnet.shallowCopyId();
367                                         copiedSubnet.setNeutronSubnetId(subnetMap.get(copiedSubnet.getSubnetId()));
368                                         copiedSubnet.setOrchestrationStatus(OrchestrationStatus.CREATED);
369                                         aaiNetworkResources.updateSubnet(copiedl3network, copiedSubnet);
370                                 }
371                         }
372                         
373                         execution.setVariable("aaiNetworkActivateRollback", true);
374                 } catch (Exception ex) {
375                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
376                 }
377         }
378         
379         public void updateObjectNetwork(BuildingBlockExecution execution) {
380                 try {
381                         L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
382                         aaiNetworkResources.updateNetwork(l3network);
383                 } catch(Exception ex) {
384                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
385                 }
386         }
387         
388         /**
389          * BPMN access method to update ServiceInstance
390          * @param execution
391          */
392         public void updateServiceInstance(BuildingBlockExecution execution) {
393                 try {
394                         ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
395                         aaiServiceInstanceResources.updateServiceInstance(serviceInstance);
396                 } catch (Exception ex) {
397                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
398                 }
399         }
400         
401         public void updateObjectVnf(BuildingBlockExecution execution) {
402                 try {
403                         GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
404                         aaiVnfResources.updateObjectVnf(genericVnf);
405                 } catch(Exception ex) {
406                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
407                 }
408         }
409         
410         public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) { 
411                 execution.setVariable("aaiDeleteVfModuleRollback", false);
412                 try {
413                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
414                         vfModule.setHeatStackId("");
415                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
416
417                         VfModule copiedVfModule = vfModule.shallowCopyId();
418                         copiedVfModule.setHeatStackId("");
419                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED);
420                         execution.setVariable("aaiDeleteVfModuleRollback", true);
421                 } catch (Exception ex) {
422                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
423                 }
424         }
425
426         public void updateModelVfModule(BuildingBlockExecution execution) {
427                 try {
428                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
429                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
430                         aaiVfModuleResources.changeAssignVfModule(vfModule, vnf);
431                 } catch (Exception ex) {
432                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
433                 }
434         }
435         public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
436                 try {
437                         Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
438                         aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
439                 } catch (Exception ex) {
440                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
441                 }
442         }
443         
444         public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
445                 try {
446                         Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
447                         aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
448                 } catch (Exception ex) {
449                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
450                 }
451         }
452 }