use of org.onap.so.client.adapter.cnf.entities.UpgradeInstanceRequest in project so by onap.
the class CnfAdapterUpgradeTasks method upgradeInstance.
/**
* This method is used for updating the request for an Instance in Multicloud K8s Plugin.
*
* @param execution
* @return
*/
public void upgradeInstance(BuildingBlockExecution execution) {
try {
GeneralBuildingBlock gBBInput = execution.getGeneralBuildingBlock();
ServiceInstance serviceInstance = gBBInput.getCustomer().getServiceSubscription().getServiceInstances().get(0);
GenericVnf genericVnf = extractPojosForBB.extractByKey(execution, ResourceKey.GENERIC_VNF_ID);
VfModule vfModule = extractPojosForBB.extractByKey(execution, ResourceKey.VF_MODULE_ID);
RequestContext requestContext = gBBInput.getRequestContext();
CloudRegion cloudRegion = gBBInput.getCloudRegion();
String sdncVfModuleQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + vfModule.getVfModuleId());
String sdncVnfQueryResponse = execution.getVariable(SDNCQUERY_RESPONSE + genericVnf.getVnfId());
Map<String, Object> paramsMap = vfModuleMapper.buildVfModuleParamsMap(requestContext, serviceInstance, genericVnf, vfModule, sdncVnfQueryResponse, sdncVfModuleQueryResponse);
Map<String, String> sdncDirectives = getSdncDirectives(paramsMap);
UpgradeInstanceRequest upgradeInstanceRequest = upgradeInstanceRequest(vfModule, cloudRegion, sdncDirectives);
UpgradeInstanceResponse response = cnfAdapterClient.upgradeVfModule(upgradeInstanceRequest);
execution.setVariable("heatStackId", response.getId());
} catch (Exception ex) {
logger.error("Exception occurred", ex);
exceptionUtil.buildAndThrowWorkflowException(execution, 7000, ex);
}
}
use of org.onap.so.client.adapter.cnf.entities.UpgradeInstanceRequest in project so by onap.
the class CnfAdapterUpgradeTasks method upgradeInstanceRequest.
protected UpgradeInstanceRequest upgradeInstanceRequest(VfModule vfModule, CloudRegion cloudRegion, Map<String, String> sdncDirectives) {
UpgradeInstanceRequest request = new UpgradeInstanceRequest();
request.setModelInvariantId(vfModule.getModelInfoVfModule().getModelInvariantUUID());
request.setModelCustomizationId(vfModule.getModelInfoVfModule().getModelCustomizationUUID());
request.setCloudRegion(cloudRegion.getLcpCloudRegionId());
request.setVfModuleUUID(vfModule.getVfModuleId());
request.setProfileName(sdncDirectives.get("k8s-rb-profile-name"));
request.setLabels(sdncDirectives);
if (sdncDirectives.containsKey("k8s-rb-instance-status-check"))
request.setStatusCheck(sdncDirectives.get("k8s-rb-instance-status-check").equalsIgnoreCase("true"));
request.setOverrideValues(sdncDirectives);
return request;
}
Aggregations