use of org.onap.so.serviceinstancebeans.ModelType in project so by onap.
the class BBInputSetup method populateObjectsOnAssignAndCreateFlows.
protected void populateObjectsOnAssignAndCreateFlows(BBInputSetupParameter parameter) throws Exception {
parameter.setModelInfo(parameter.getRequestDetails().getModelInfo());
parameter.setInstanceName(parameter.getRequestDetails().getRequestInfo().getInstanceName());
parameter.setProductFamilyId(parameter.getRequestDetails().getRequestInfo().getProductFamilyId());
ModelType modelType = parameter.getModelInfo().getModelType();
parameter.setRelatedInstanceList(parameter.getRequestDetails().getRelatedInstanceList());
parameter.setPlatform(parameter.getRequestDetails().getPlatform());
parameter.setLineOfBusiness(parameter.getRequestDetails().getLineOfBusiness());
String applicationId = "";
if (parameter.getRequestDetails().getRequestInfo().getApplicationId() != null) {
applicationId = parameter.getRequestDetails().getRequestInfo().getApplicationId();
parameter.setApplicationId(applicationId);
}
if (modelType.equals(ModelType.network)) {
parameter.getLookupKeyMap().put(ResourceKey.NETWORK_ID, parameter.getResourceId());
this.populateL3Network(parameter);
} else if (modelType.equals(ModelType.vnf)) {
parameter.getLookupKeyMap().put(ResourceKey.GENERIC_VNF_ID, parameter.getResourceId());
this.populateGenericVnf(parameter);
} else if (modelType.equals(ModelType.volumeGroup) || (modelType.equals(ModelType.vfModule) && (parameter.getBbName().equalsIgnoreCase(AssignFlows.VOLUME_GROUP.toString()) || parameter.getBbName().startsWith(CREATEVOLUME)))) {
parameter.getLookupKeyMap().put(ResourceKey.VOLUME_GROUP_ID, parameter.getResourceId());
this.populateVolumeGroup(parameter);
} else if (modelType.equals(ModelType.vfModule)) {
populateVfModuleOnAssignAndCreateFlows(parameter);
} else if (modelType.equals(ModelType.instanceGroup)) {
parameter.getLookupKeyMap().put(ResourceKey.INSTANCE_GROUP_ID, parameter.getResourceId());
this.populateInstanceGroup(parameter);
} else {
return;
}
}
use of org.onap.so.serviceinstancebeans.ModelType in project so by onap.
the class RequestHandlerUtils method setInstanceIdAndName.
protected void setInstanceIdAndName(InfraActiveRequests infraActiveRequest, InfraActiveRequests currentActiveRequest) throws ApiException {
String requestScope = infraActiveRequest.getRequestScope();
try {
ModelType type = ModelType.valueOf(requestScope);
String instanceName = type.getName(infraActiveRequest);
if (instanceName == null && type.equals(ModelType.vfModule)) {
logger.error("vfModule for requestId: {} being resumed does not have an instanceName.", infraActiveRequest.getRequestId());
ValidateException validateException = new ValidateException.Builder("vfModule for requestId: " + infraActiveRequest.getRequestId() + " being resumed does not have an instanceName.", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).build();
updateStatus(currentActiveRequest, Status.FAILED, validateException.getMessage());
throw validateException;
}
if (instanceName != null) {
type.setName(currentActiveRequest, instanceName);
}
type.setId(currentActiveRequest, type.getId(infraActiveRequest));
} catch (IllegalArgumentException e) {
logger.error("requestScope \"{}\" does not match a ModelType enum. Unable to set instanceId and instanceName from the original request.", requestScope);
}
}
use of org.onap.so.serviceinstancebeans.ModelType in project so by onap.
the class BBInputSetup method getGBB.
protected GeneralBuildingBlock getGBB(ExecuteBuildingBlock executeBB, Map<ResourceKey, String> lookupKeyMap, String requestAction, boolean aLaCarte, String resourceId, String vnfType) throws Exception {
String requestId = executeBB.getRequestId();
this.populateLookupKeyMapWithIds(executeBB.getWorkflowResourceIds(), lookupKeyMap);
RequestDetails requestDetails = executeBB.getRequestDetails();
if (requestDetails == null) {
requestDetails = bbInputSetupUtils.getRequestDetails(requestId);
}
if (requestDetails.getModelInfo() == null) {
return this.getGBBCM(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
} else {
ModelType modelType = requestDetails.getModelInfo().getModelType();
if (aLaCarte && modelType.equals(ModelType.service)) {
return this.getGBBALaCarteService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId);
} else if (aLaCarte && !modelType.equals(ModelType.service)) {
return this.getGBBALaCarteNonService(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
} else {
return this.getGBBMacro(executeBB, requestDetails, lookupKeyMap, requestAction, resourceId, vnfType);
}
}
}
use of org.onap.so.serviceinstancebeans.ModelType in project so by onap.
the class ResumeOrchestrationRequest method setInstanceIdMap.
protected HashMap<String, String> setInstanceIdMap(InfraActiveRequests infraActiveRequest, String requestScope) {
HashMap<String, String> instanceIdMap = new HashMap<>();
ModelType type;
try {
type = ModelType.valueOf(requestScope);
instanceIdMap.put(type.name() + "InstanceId", type.getId(infraActiveRequest));
} catch (IllegalArgumentException e) {
logger.error("requestScope \"{}\" does not match a ModelType enum.", requestScope);
}
return instanceIdMap;
}
use of org.onap.so.serviceinstancebeans.ModelType in project so by onap.
the class ResumeOrchestrationRequest method getInstanceName.
protected String getInstanceName(InfraActiveRequests infraActiveRequest, String requestScope, InfraActiveRequests currentActiveRequest) throws ValidateException, RequestDbFailureException {
ModelType type;
String instanceName = "";
try {
type = ModelType.valueOf(requestScope);
instanceName = type.getName(infraActiveRequest);
} catch (IllegalArgumentException e) {
logger.error("requestScope \"{}\" does not match a ModelType enum.", requestScope);
ValidateException validateException = new ValidateException.Builder("requestScope: \"" + requestScope + "\" from request: " + infraActiveRequest.getRequestId() + " does not match a ModelType enum.", HttpStatus.SC_BAD_REQUEST, ErrorNumbers.SVC_BAD_PARAMETER).cause(e).build();
requestHandlerUtils.updateStatus(currentActiveRequest, Status.FAILED, validateException.getMessage());
throw validateException;
}
return instanceName;
}
Aggregations