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