Update the SO release notes
[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                         
160                         VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID, execution.getLookupMap().get(ResourceKey.VOLUME_GROUP_ID));
161                         CloudRegion cloudRegion = gBBInput.getCloudRegion();
162                         volumeGroup.setHeatStackId(heatStackId);
163                         
164                         aaiVolumeGroupResources.updateHeatStackIdVolumeGroup(volumeGroup, cloudRegion);
165                 } catch (Exception ex) {
166                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
167                 }
168         }
169         
170         public void updateOrchestrationStatusAssignedVfModule(BuildingBlockExecution execution) {
171                 try {
172                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
173                         vfModule.setHeatStackId("");
174                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
175                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED);
176                 } catch (Exception ex) {                        
177                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
178                 }
179         }
180         
181         public void updateOrchestrationStatusPendingActivationVfModule(BuildingBlockExecution execution) {
182                 try {
183                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
184                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
185                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION);
186                 } catch (Exception ex) {
187                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
188                 }
189         }
190         
191         public void updateOrchestrationStatusAssignedOrPendingActivationVfModule(BuildingBlockExecution execution) {
192                 try {
193                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
194                         vfModule.setHeatStackId("");
195                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
196                         String multiStageDesign = MULTI_STAGE_DESIGN_OFF;
197                         if (vnf.getModelInfoGenericVnf() != null) {
198                                 multiStageDesign = vnf.getModelInfoGenericVnf().getMultiStageDesign();
199                         }
200                         boolean aLaCarte = (boolean) execution.getVariable(ALACARTE);
201                         if (aLaCarte && multiStageDesign != null && multiStageDesign.equalsIgnoreCase(MULTI_STAGE_DESIGN_ON)) {
202                                 aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.PENDING_ACTIVATION);
203                         }
204                         else {
205                                 aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED);
206                         }
207                 } catch (Exception ex) {                        
208                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
209                 }
210         }
211         
212         public void updateOrchestrationStatusCreatedVfModule(BuildingBlockExecution execution) {                
213                 try {
214                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
215                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
216                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED);                       
217                 } catch (Exception ex) {
218                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
219                 }
220         }       
221         
222         public void updateOrchestrationStatusDeactivateVfModule(BuildingBlockExecution execution) {     
223                 execution.setVariable("aaiDeactivateVfModuleRollback", false);
224                 try {
225                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
226                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
227                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.CREATED);
228                         execution.setVariable("aaiDeactivateVfModuleRollback", true);
229                 } catch (Exception ex) {
230                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
231                 }
232         }
233         
234         /**
235          * BPMN access method to update status of L3Network to Assigned in AAI
236          * @param execution
237          * @throws BBObjectNotFoundException 
238          */
239         public void updateOrchestrationStatusAssignedNetwork(BuildingBlockExecution execution) {
240                 updateNetwork(execution, OrchestrationStatus.ASSIGNED);
241         }
242         
243         /**
244          * BPMN access method to update status of L3Network to Active in AAI
245          * @param execution
246          * @throws BBObjectNotFoundException 
247          */
248         public void updateOrchestrationStatusActiveNetwork(BuildingBlockExecution execution) {
249                 updateNetwork(execution, OrchestrationStatus.ACTIVE);
250         }
251         
252         /**
253          * BPMN access method to update status of L3Network to Created in AAI
254          * @param execution
255          * @throws BBObjectNotFoundException 
256          */
257         public void updateOrchestrationStatusCreatedNetwork(BuildingBlockExecution execution) {
258                 updateNetwork(execution, OrchestrationStatus.CREATED);
259         }
260         
261         protected void updateNetwork(BuildingBlockExecution execution, OrchestrationStatus status) {
262                 try {
263                         L3Network l3Network =  extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
264                         updateNetworkAAI(l3Network, status);
265                 } catch (Exception ex) {
266                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
267                 }
268         }
269         
270         protected void updateNetworkAAI(L3Network l3Network, OrchestrationStatus status) {
271                 L3Network copiedl3Network = l3Network.shallowCopyId();
272
273                 copiedl3Network.setOrchestrationStatus(status);
274                 l3Network.setOrchestrationStatus(status);
275                 aaiNetworkResources.updateNetwork(copiedl3Network);
276                 
277                 List<Subnet> subnets = l3Network.getSubnets();
278                 if (subnets != null){
279                         for (Subnet subnet : subnets){
280                                 Subnet copiedSubnet = subnet.shallowCopyId();
281                                 copiedSubnet.setOrchestrationStatus(status);
282                                 aaiNetworkResources.updateSubnet(copiedl3Network, copiedSubnet);
283                         }
284                 }
285         }
286         
287         /**
288          * BPMN access method to update status of L3Network Collection to Active in AAI
289          * @param execution
290          * @throws BBObjectNotFoundException 
291          */
292         public void updateOrchestrationStatusActiveNetworkCollection(BuildingBlockExecution execution) {
293                 execution.setVariable("aaiNetworkCollectionActivateRollback", false);
294                 try {
295                         ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
296                         Collection networkCollection = serviceInstance.getCollection();
297                         Collection copiedNetworkCollection = networkCollection.shallowCopyId();
298
299                         networkCollection.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
300                         copiedNetworkCollection.setOrchestrationStatus(OrchestrationStatus.ACTIVE);
301                         aaiCollectionResources.updateCollection(copiedNetworkCollection);
302                         execution.setVariable("aaiNetworkCollectionActivateRollback", true);
303                 } catch (Exception ex) {
304                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
305                 }
306         }
307         
308         public void updateOrchestrationStatusActivateVfModule(BuildingBlockExecution execution) {
309                 execution.setVariable("aaiActivateVfModuleRollback", false);
310                 try {
311                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
312                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
313                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule, vnf, OrchestrationStatus.ACTIVE);
314                         execution.setVariable("aaiActivateVfModuleRollback", true);
315                 } catch (Exception ex) {
316                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
317                 }
318         }
319         
320         public void updateHeatStackIdVfModule(BuildingBlockExecution execution) {               
321                 try {
322                         String heatStackId = execution.getVariable("heatStackId");
323                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
324                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
325                         vfModule.setHeatStackId(heatStackId);
326                         aaiVfModuleResources.updateHeatStackIdVfModule(vfModule, vnf);                  
327                 } catch (Exception ex) {
328                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
329                 }
330         }
331         
332         /**
333          * BPMN access method to update L3Network after it was created in AIC
334          * @param execution
335          * @throws Exception
336          */
337         public void updateNetworkCreated(BuildingBlockExecution execution) throws Exception {
338                 execution.setVariable("aaiNetworkActivateRollback", false);
339                 L3Network l3network =  extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
340                 L3Network copiedl3network = l3network.shallowCopyId();
341                 CreateNetworkResponse response = execution.getVariable("createNetworkResponse");
342                 try {
343                         if(response.getNetworkFqdn()!=null){
344                         l3network.setContrailNetworkFqdn(response.getNetworkFqdn());
345                         }
346                         l3network.setOrchestrationStatus(OrchestrationStatus.CREATED);
347                         l3network.setHeatStackId(response.getNetworkStackId());
348                         l3network.setNeutronNetworkId(response.getNeutronNetworkId());
349
350                         copiedl3network.setContrailNetworkFqdn(response.getNetworkFqdn());
351                         copiedl3network.setOrchestrationStatus(OrchestrationStatus.CREATED);
352                         copiedl3network.setHeatStackId(response.getNetworkStackId());
353                         copiedl3network.setNeutronNetworkId(response.getNeutronNetworkId());
354
355                         aaiNetworkResources.updateNetwork(copiedl3network);
356                         
357                         Map<String, String> subnetMap = response.getSubnetMap();
358                         List<Subnet> subnets = l3network.getSubnets();
359                         if (subnets != null && subnetMap != null){
360                                 for (Subnet subnet: subnets){
361                                         Subnet copiedSubnet = subnet.shallowCopyId();
362                                         copiedSubnet.setNeutronSubnetId(subnetMap.get(copiedSubnet.getSubnetId()));
363                                         copiedSubnet.setOrchestrationStatus(OrchestrationStatus.CREATED);
364                                         aaiNetworkResources.updateSubnet(copiedl3network, copiedSubnet);
365                                 }
366                         }
367                         
368                         execution.setVariable("aaiNetworkActivateRollback", true);
369                 } catch (Exception ex) {
370                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
371                 }
372         }
373         
374         public void updateObjectNetwork(BuildingBlockExecution execution) {
375                 try {
376                         L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID, execution.getLookupMap().get(ResourceKey.NETWORK_ID));
377                         aaiNetworkResources.updateNetwork(l3network);
378                 } catch(Exception ex) {
379                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
380                 }
381         }
382         
383         /**
384          * BPMN access method to update ServiceInstance
385          * @param execution
386          */
387         public void updateServiceInstance(BuildingBlockExecution execution) {
388                 try {
389                         ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID, execution.getLookupMap().get(ResourceKey.SERVICE_INSTANCE_ID));
390                         aaiServiceInstanceResources.updateServiceInstance(serviceInstance);
391                 } catch (Exception ex) {
392                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
393                 }
394         }
395         
396         public void updateObjectVnf(BuildingBlockExecution execution) {
397                 try {
398                         GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
399                         aaiVnfResources.updateObjectVnf(genericVnf);
400                 } catch(Exception ex) {
401                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
402                 }
403         }
404         
405         public void updateOrchestrationStatusDeleteVfModule(BuildingBlockExecution execution) { 
406                 execution.setVariable("aaiDeleteVfModuleRollback", false);
407                 try {
408                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
409                         vfModule.setHeatStackId("");
410                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
411
412                         VfModule copiedVfModule = vfModule.shallowCopyId();
413                         copiedVfModule.setHeatStackId("");
414                         aaiVfModuleResources.updateOrchestrationStatusVfModule(vfModule,vnf,OrchestrationStatus.ASSIGNED);
415                         execution.setVariable("aaiDeleteVfModuleRollback", true);
416                 } catch (Exception ex) {
417                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
418                 }
419         }
420
421         public void updateModelVfModule(BuildingBlockExecution execution) {
422                 try {
423                         VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID, execution.getLookupMap().get(ResourceKey.VF_MODULE_ID));
424                         GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID, execution.getLookupMap().get(ResourceKey.GENERIC_VNF_ID));
425                         aaiVfModuleResources.changeAssignVfModule(vfModule, vnf);
426                 } catch (Exception ex) {
427                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
428                 }
429         }
430         public void updateOrchestrationStatusActivateFabricConfiguration(BuildingBlockExecution execution) {
431                 try {
432                         Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
433                         aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ACTIVE);
434                 } catch (Exception ex) {
435                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
436                 }
437         }
438         
439         public void updateOrchestrationStatusDeactivateFabricConfiguration(BuildingBlockExecution execution) {
440                 try {
441                         Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID, execution.getLookupMap().get(ResourceKey.CONFIGURATION_ID));
442                         aaiConfigurationResources.updateOrchestrationStatusConfiguration(configuration, OrchestrationStatus.ASSIGNED);
443                 } catch (Exception ex) {
444                         exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
445                 }
446         }
447 }