Search in sources :

Example 1 with GenericResourceApiVfmodulerequestinputVfModuleRequestInput

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;
}
Also used : GenericResourceApiParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParam) GenericResourceApiVfmodulerequestinputVfModuleRequestInput(org.onap.sdnc.northbound.client.model.GenericResourceApiVfmodulerequestinputVfModuleRequestInput) GenericResourceApiParamParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam) Map(java.util.Map)

Example 2 with GenericResourceApiVfmodulerequestinputVfModuleRequestInput

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;
}
Also used : GenericResourceApiSvcActionEnumeration(org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration) GenericResourceApiServiceinformationServiceInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation) GenericResourceApiSdncrequestheaderSdncRequestHeader(org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader) GenericResourceApiRequestActionEnumeration(org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration) GenericResourceApiVnfinformationVnfInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation) GenericResourceApiRequestinformationRequestInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation) GenericResourceApiVfmodulerequestinputVfModuleRequestInput(org.onap.sdnc.northbound.client.model.GenericResourceApiVfmodulerequestinputVfModuleRequestInput) GenericResourceApiVfmoduleinformationVfModuleInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation) GenericResourceApiVfModuleOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)

Aggregations

GenericResourceApiVfmodulerequestinputVfModuleRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiVfmodulerequestinputVfModuleRequestInput)2 Map (java.util.Map)1 GenericResourceApiParam (org.onap.sdnc.northbound.client.model.GenericResourceApiParam)1 GenericResourceApiParamParam (org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam)1 GenericResourceApiRequestActionEnumeration (org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration)1 GenericResourceApiRequestinformationRequestInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation)1 GenericResourceApiSdncrequestheaderSdncRequestHeader (org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader)1 GenericResourceApiServiceinformationServiceInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation)1 GenericResourceApiSvcActionEnumeration (org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration)1 GenericResourceApiVfModuleOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)1 GenericResourceApiVfmoduleinformationVfModuleInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVfmoduleinformationVfModuleInformation)1 GenericResourceApiVnfinformationVnfInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation)1