Search in sources :

Example 1 with GenericResourceApiRequestActionEnumeration

use of org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration 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

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 GenericResourceApiVfmodulerequestinputVfModuleRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiVfmodulerequestinputVfModuleRequestInput)1 GenericResourceApiVnfinformationVnfInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation)1