use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class SDNCActivateTasks method activateNetwork.
/**
* BPMN access method to perform Assign action on SDNC for L3Network
*
* @param execution
* @throws BBObjectNotFoundException
*/
public void activateNetwork(BuildingBlockExecution execution) throws BBObjectNotFoundException {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Customer customer = gBBInput.getCustomer();
RequestContext requestContext = gBBInput.getRequestContext();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.activateNetwork(l3network, serviceInstance, customer, requestContext, cloudRegion);
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class SDNCChangeAssignTasks method changeAssignNetwork.
public void changeAssignNetwork(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.changeAssignNetwork(network, serviceInstance, gBBInput.getCustomer(), gBBInput.getRequestContext(), gBBInput.getCloudRegion());
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class SDNCUnassignTasks method unassignNetwork.
/**
* This method is used to prepare a SDNC request and set it to the execution Object.
*
* Which is used for unassign the Network.
*
* @param execution
*/
public void unassignNetwork(BuildingBlockExecution execution) throws Exception {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
Customer customer = gBBInput.getCustomer();
RequestContext requestContext = gBBInput.getRequestContext();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
String cloudRegionSdnc = execution.getVariable("cloudRegionSdnc");
cloudRegion.setLcpCloudRegionId(cloudRegionSdnc);
GenericResourceApiNetworkOperationInformation req = sdncNetworkResources.unassignNetwork(network, serviceInstance, customer, requestContext, cloudRegion);
SDNCRequest sdncRequest = new SDNCRequest();
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.NETWORK);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
logger.error("Exception occurred in SDNCUnassignTasks unassignNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class OrchestrationStatusValidator method getOrchestrationStatus.
private OrchestrationStatus getOrchestrationStatus(BuildingBlockExecution execution, String buildingBlockFlowName, BuildingBlockDetail buildingBlockDetail) throws BBObjectNotFoundException, OrchestrationStatusValidationException {
OrchestrationStatus orchestrationStatus = null;
switch(buildingBlockDetail.getResourceType()) {
case SERVICE:
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
orchestrationStatus = serviceInstance.getOrchestrationStatus();
break;
case VNF:
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
orchestrationStatus = genericVnf.getOrchestrationStatus();
break;
case VF_MODULE:
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
orchestrationStatus = vfModule.getOrchestrationStatus();
break;
case VOLUME_GROUP:
VolumeGroup volumeGroup = extractPojosForBB.extractByKey(execution, ResourceKey.VOLUME_GROUP_ID);
orchestrationStatus = volumeGroup.getOrchestrationStatus();
break;
case NETWORK:
L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
orchestrationStatus = network.getOrchestrationStatus();
break;
case NETWORK_COLLECTION:
Collection networkCollection = getNetworkCollection(execution);
orchestrationStatus = networkCollection.getOrchestrationStatus();
break;
case CONFIGURATION:
Configuration configuration = extractPojosForBB.extractByKey(execution, ResourceKey.CONFIGURATION_ID);
orchestrationStatus = configuration.getOrchestrationStatus();
break;
case INSTANCE_GROUP:
InstanceGroup instanceGroup = extractPojosForBB.extractByKey(execution, ResourceKey.INSTANCE_GROUP_ID);
orchestrationStatus = instanceGroup.getOrchestrationStatus();
break;
case NO_VALIDATE:
// short circuit and exit method
execution.setVariable(ORCHESTRATION_STATUS_VALIDATION_RESULT, OrchestrationStatusValidationDirective.VALIDATION_SKIPPED);
break;
default:
// code
throw new OrchestrationStatusValidationException(String.format(UNKNOWN_RESOURCE_TYPE, buildingBlockFlowName, buildingBlockDetail.getResourceType(), buildingBlockDetail.getTargetAction()));
}
return orchestrationStatus;
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class AAIObjectMapperTest method networkMap.
@Test
public void networkMap() throws Exception {
L3Network l3Network = new L3Network();
l3Network.setNetworkId("networkId");
l3Network.setOrchestrationStatus(OrchestrationStatus.ASSIGNED);
l3Network.setNetworkName("networkName");
l3Network.setNetworkRole("networkRole");
l3Network.setNetworkTechnology("networkTechnology");
l3Network.setNeutronNetworkId("neutronNetworkId");
l3Network.setNetworkRoleInstance(0L);
l3Network.setContrailNetworkFqdn("contrailNetworkFqdn");
l3Network.setIsBoundToVpn(false);
l3Network.setIsCascaded(false);
l3Network.setIsSharedNetwork(false);
l3Network.setHeatStackId("heatStackId");
l3Network.setOperationalStatus("operationalStatus");
l3Network.setPhysicalNetworkName("physicalNetworkName");
l3Network.setIsProviderNetwork(false);
l3Network.setSelflink("selflink");
l3Network.setServiceId("serviceId");
ModelInfoNetwork modelInfoNetwork = new ModelInfoNetwork();
modelInfoNetwork.setModelCustomizationUUID("modelCustomizationUUID");
modelInfoNetwork.setModelInvariantUUID("modelInvariantUUID");
modelInfoNetwork.setModelUUID("modelUUID");
l3Network.setModelInfoNetwork(modelInfoNetwork);
org.onap.aai.domain.yang.L3Network aaiL3Network = aaiObjectMapper.mapNetwork(l3Network);
ObjectMapper omapper = new ObjectMapper();
org.onap.aai.domain.yang.L3Network network = omapper.readValue(getJson("aaiL3NetworkMapped.json"), org.onap.aai.domain.yang.L3Network.class);
com.shazam.shazamcrest.MatcherAssert.assertThat(aaiL3Network, sameBeanAs(network));
}
Aggregations