use of org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation in project so by onap.
the class SDNCDeactivateTasks method deactivateVfModule.
/**
* This method is used to prepare a SDNC request and set it to the execution Object. Which is used for deactivate
* VfModule.
*
* @param execution
*/
public void deactivateVfModule(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
RequestContext requestContext = gBBInput.getRequestContext();
ServiceInstance serviceInstance = extractPojosForBB.extractByKey(execution, ResourceKey.SERVICE_INSTANCE_ID);
GenericVnf vnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
Customer customer = gBBInput.getCustomer();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
SDNCRequest sdncRequest = new SDNCRequest();
GenericResourceApiVfModuleOperationInformation req = sdncVfModuleResources.deactivateVfModule(vfModule, vnf, serviceInstance, customer, cloudRegion, requestContext, buildCallbackURI(sdncRequest));
sdncRequest.setSDNCPayload(req);
sdncRequest.setTopology(SDNCTopology.VFMODULE);
execution.setVariable(SDNC_REQUEST, sdncRequest);
} catch (Exception ex) {
logger.error("Exception occurred in SDNCDeactivateTasks deactivateVfModule", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation in project so by onap.
the class VfModuleTopologyOperationRequestMapper method reqMapper.
public GenericResourceApiVfModuleOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, VfModule vfModule, VolumeGroup volumeGroup, GenericVnf vnf, ServiceInstance serviceInstance, Customer customer, CloudRegion cloudRegion, RequestContext requestContext, String sdncAssignResponse, URI callbackURL) throws MapperException {
GenericResourceApiVfModuleOperationInformation req = new GenericResourceApiVfModuleOperationInformation();
boolean includeModelInformation = false;
GenericResourceApiRequestActionEnumeration requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE;
GenericResourceApiSvcActionEnumeration genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ASSIGN;
if (svcAction.equals(SDNCSvcAction.ACTIVATE)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ACTIVATE;
requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE;
includeModelInformation = true;
} else if (svcAction.equals(SDNCSvcAction.ASSIGN)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.ASSIGN;
requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE;
includeModelInformation = true;
} else if (svcAction.equals(SDNCSvcAction.DEACTIVATE)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.DEACTIVATE;
requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE;
includeModelInformation = false;
} else if (svcAction.equals(SDNCSvcAction.DELETE)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.DELETE;
requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE;
includeModelInformation = false;
} else if (svcAction.equals(SDNCSvcAction.UNASSIGN)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.UNASSIGN;
requestAction = GenericResourceApiRequestActionEnumeration.DELETEVFMODULEINSTANCE;
includeModelInformation = false;
} else if (svcAction.equals(SDNCSvcAction.CHANGE_ASSIGN)) {
genericResourceApiSvcAction = GenericResourceApiSvcActionEnumeration.CHANGEASSIGN;
requestAction = GenericResourceApiRequestActionEnumeration.CREATEVFMODULEINSTANCE;
includeModelInformation = true;
}
String sdncReqId = UUID.randomUUID().toString();
String msoRequestId = UUID.randomUUID().toString();
if (requestContext != null && requestContext.getMsoRequestId() != null) {
msoRequestId = requestContext.getMsoRequestId();
}
GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, requestAction);
GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, includeModelInformation);
GenericResourceApiVnfinformationVnfInformation vnfInformation = generalTopologyObjectMapper.buildVnfInformation(vnf, serviceInstance, includeModelInformation);
GenericResourceApiVfmoduleinformationVfModuleInformation vfModuleInformation = generalTopologyObjectMapper.buildVfModuleInformation(vfModule, vnf, serviceInstance, requestContext, includeModelInformation);
GenericResourceApiVfmodulerequestinputVfModuleRequestInput vfModuleRequestInput = buildVfModuleRequestInput(vfModule, volumeGroup, cloudRegion, requestContext);
GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = buildVfModuleSdncRequestHeader(sdncReqId, genericResourceApiSvcAction, callbackURL);
req.setRequestInformation(requestInformation);
req.setSdncRequestHeader(sdncRequestHeader);
req.setServiceInformation(serviceInformation);
req.setVnfInformation(vnfInformation);
req.setVfModuleInformation(vfModuleInformation);
req.setVfModuleRequestInput(vfModuleRequestInput);
return req;
}
Aggregations