use of org.onap.sdnc.northbound.client.model.GenericResourceApiVfmodulerequestinputVfModuleRequestInput in project so by onap.
the class VfModuleTopologyOperationRequestMapper method buildVfModuleRequestInput.
private GenericResourceApiVfmodulerequestinputVfModuleRequestInput buildVfModuleRequestInput(VfModule vfModule, VolumeGroup volumeGroup, CloudRegion cloudRegion, RequestContext requestContext) {
GenericResourceApiVfmodulerequestinputVfModuleRequestInput vfModuleRequestInput = new GenericResourceApiVfmodulerequestinputVfModuleRequestInput();
if (cloudRegion != null) {
vfModuleRequestInput.setTenant(cloudRegion.getTenantId());
vfModuleRequestInput.setAicCloudRegion(cloudRegion.getLcpCloudRegionId());
vfModuleRequestInput.setCloudOwner(cloudRegion.getCloudOwner());
}
if (vfModule.getVfModuleName() != null && !vfModule.getVfModuleName().equals("")) {
vfModuleRequestInput.setVfModuleName(vfModule.getVfModuleName());
}
GenericResourceApiParam vfModuleInputParameters = new GenericResourceApiParam();
if (requestContext != null && requestContext.getUserParams() != null) {
for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
paramItem.setName(entry.getKey());
paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
vfModuleInputParameters.addParamItem(paramItem);
}
}
if (vfModule.getCloudParams() != null) {
for (Map.Entry<String, String> entry : vfModule.getCloudParams().entrySet()) {
GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
paramItem.setName(entry.getKey());
paramItem.setValue(entry.getValue());
vfModuleInputParameters.addParamItem(paramItem);
}
}
if (volumeGroup != null) {
GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
paramItem.setName("volume-group-id");
paramItem.setValue(volumeGroup.getVolumeGroupId());
vfModuleInputParameters.addParamItem(paramItem);
}
vfModuleRequestInput.setVfModuleInputParameters(vfModuleInputParameters);
return vfModuleRequestInput;
}
use of org.onap.sdnc.northbound.client.model.GenericResourceApiVfmodulerequestinputVfModuleRequestInput 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