use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class CreateNetwork method buildCreateNetworkRequest.
/**
* BPMN access method to build CreateNetworkRequest object
*/
public void buildCreateNetworkRequest(BuildingBlockExecution execution) throws Exception {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
L3Network l3Network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
Map<String, String> userInput = gBBInput.getUserInput();
String cloudRegionPo = execution.getVariable("cloudRegionPo");
CreateNetworkRequest createNetworkRequest = networkAdapterObjectMapper.createNetworkRequestMapper(gBBInput.getRequestContext(), gBBInput.getCloudRegion(), gBBInput.getOrchContext(), serviceInstance, l3Network, userInput, cloudRegionPo, gBBInput.getCustomer());
// set CreateNetowrkRequest object on execution to be re-used within current BB
execution.setVariable("createNetworkRequest", createNetworkRequest);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class NamingServiceCreateTasks method createVpnBondingServiceName.
public void createVpnBondingServiceName(BuildingBlockExecution execution) throws BBObjectNotFoundException {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
L3Network network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
VpnBinding vpnBinding = extractPojosForBB.extractByKey(execution, ResourceKey.VPN_ID);
NamingRequestObject namingRequestObject = new NamingRequestObject();
namingRequestObject.setExternalKeyValue(serviceInstance.getServiceInstanceId());
namingRequestObject.setPolicyInstanceNameValue(serviceInstance.getModelInfoServiceInstance().getNamingPolicy());
namingRequestObject.setNamingTypeValue(NamingServiceConstants.NAMING_TYPE_SERVICE);
namingRequestObject.setServiceModelNameValue(serviceInstance.getModelInfoServiceInstance().getModelName());
namingRequestObject.setModelVersionValue(serviceInstance.getModelInfoServiceInstance().getModelVersion());
namingRequestObject.setNetworkNameValue(network.getNetworkName());
namingRequestObject.setVpnNameValue(vpnBinding.getVpnName());
namingRequestObject.setResourceNameValue(NamingServiceConstants.RESOURCE_NAME_SERVICE_INSTANCE_NAME);
String generatedVpnBondingServiceName = "";
try {
generatedVpnBondingServiceName = namingServiceResources.generateServiceInstanceName(namingRequestObject);
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
serviceInstance.setServiceInstanceName(generatedVpnBondingServiceName);
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class SDNCDeactivateTasks method deactivateNetwork.
/**
* BPMN access method to invoke deactivate on a L3Network object
*
* @param execution
*/
public void deactivateNetwork(BuildingBlockExecution execution) {
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.deactivateNetwork(l3Network, 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 SDNCDeactivateTasks deactivateNetwork", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class UnassignNetworkBB method checkRelationshipRelatedTo.
/**
* BPMN access method to prepare overall error messages.
*
* @param execution - BuildingBlockExecution
* @param relatedToValue - String, ex: vf-module
* @return void - nothing
*/
public void checkRelationshipRelatedTo(BuildingBlockExecution execution, String relatedToValue) {
try {
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
AAIResultWrapper aaiResultWrapper = aaiNetworkResources.queryNetworkWrapperById(l3network);
Optional<org.onap.aai.domain.yang.L3Network> network = aaiResultWrapper.asBean(org.onap.aai.domain.yang.L3Network.class);
if (networkBBUtils.isRelationshipRelatedToExists(network, relatedToValue)) {
String msg = messageCannotPerformUnassign + relatedToValue;
execution.setVariable("ErrorUnassignNetworkBB", msg);
logger.error("ErrorUnassignNetworkBB: {}", msg);
throw new UnassignNetworkException(msg);
}
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.bpmn.servicedecomposition.bbobjects.L3Network in project so by onap.
the class AAICreateTasks method connectNetworkToNetworkCollectionInstanceGroup.
/**
* BPMN access method to establish relationships in AAI
*
* @param execution
* @throws Exception
*/
public void connectNetworkToNetworkCollectionInstanceGroup(BuildingBlockExecution execution) {
try {
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
L3Network l3network = extractPojosForBB.extractByKey(execution, ResourceKey.NETWORK_ID);
// connect network only if Instance Group / Collection objects exist
if (serviceInstance.getCollection() != null && serviceInstance.getCollection().getInstanceGroup() != null)
aaiNetworkResources.connectNetworkToNetworkCollectionInstanceGroup(l3network, serviceInstance.getCollection().getInstanceGroup());
} catch (Exception ex) {
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
Aggregations