Search in sources :

Example 1 with GenericResourceApiParamParam

use of org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam in project so by onap.

the class ServiceTopologyOperationMapper method reqMapper.

public GenericResourceApiServiceOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration resourceAction, ServiceInstance serviceInstance, Customer customer, RequestContext requestContext) {
    String sdncReqId = UUID.randomUUID().toString();
    String msoRequestId = UUID.randomUUID().toString();
    if (requestContext != null && requestContext.getMsoRequestId() != null) {
        msoRequestId = requestContext.getMsoRequestId();
    }
    GenericResourceApiServiceOperationInformation servOpInput = new GenericResourceApiServiceOperationInformation();
    GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
    GenericResourceApiRequestinformationRequestInformation reqInfo = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, resourceAction);
    GenericResourceApiServiceinformationServiceInformation servInfo = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
    GenericResourceApiServicerequestinputServiceRequestInput servReqInfo = new GenericResourceApiServicerequestinputServiceRequestInput();
    servReqInfo.setServiceInstanceName(serviceInstance.getServiceInstanceName());
    servOpInput.setSdncRequestHeader(sdncRequestHeader);
    servOpInput.setRequestInformation(reqInfo);
    servOpInput.setServiceInformation(servInfo);
    servOpInput.setServiceRequestInput(servReqInfo);
    if (requestContext != null && requestContext.getUserParams() != null) {
        for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
            GenericResourceApiServicerequestinputServiceRequestInput serviceRequestInput = new GenericResourceApiServicerequestinputServiceRequestInput();
            serviceRequestInput.setServiceInstanceName(serviceInstance.getServiceInstanceName());
            GenericResourceApiParam serviceInputParameters = new GenericResourceApiParam();
            GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
            paramItem.setName(entry.getKey());
            paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
            serviceInputParameters.addParamItem(paramItem);
            serviceRequestInput.serviceInputParameters(serviceInputParameters);
            servOpInput.setServiceRequestInput(serviceRequestInput);
        }
    }
    return servOpInput;
}
Also used : GenericResourceApiServiceinformationServiceInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation) GenericResourceApiSdncrequestheaderSdncRequestHeader(org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader) GenericResourceApiServicerequestinputServiceRequestInput(org.onap.sdnc.northbound.client.model.GenericResourceApiServicerequestinputServiceRequestInput) GenericResourceApiRequestinformationRequestInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation) GenericResourceApiServiceOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation) GenericResourceApiParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParam) GenericResourceApiParamParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam) Map(java.util.Map)

Example 2 with GenericResourceApiParamParam

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

use of org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam in project so by onap.

the class VnfAdapterObjectMapper method buildParamsMapFromSdncParams.

private void buildParamsMapFromSdncParams(Map<String, Object> volumeGroupParams, GenericResourceApiParam sdncParameters) {
    if (sdncParameters != null) {
        List<GenericResourceApiParamParam> sdncParametersList = sdncParameters.getParam();
        if (sdncParametersList != null) {
            for (int i = 0; i < sdncParametersList.size(); i++) {
                GenericResourceApiParamParam param = sdncParametersList.get(i);
                String parameterName = param.getName();
                String parameterValue = param.getValue();
                volumeGroupParams.put(parameterName, parameterValue);
            }
        }
    }
}
Also used : GenericResourceApiParamParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam)

Example 4 with GenericResourceApiParamParam

use of org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam in project so by onap.

the class GeneralTopologyObjectMapperTest method buildGcRequestInformationTest_withInputParams.

@Test
public void buildGcRequestInformationTest_withInputParams() {
    GenericVnf vnf = new GenericVnf();
    vnf.setVnfId("TestVnfId");
    GenericResourceApiParam genericResourceApiParam = new GenericResourceApiParam();
    genericResourceApiParam.addParamItem(new GenericResourceApiParamParam());
    GenericResourceApiGcrequestinputGcRequestInput gcRequestInput = genObjMapper.buildGcRequestInformation(vnf, genericResourceApiParam);
    assertNotNull(gcRequestInput);
    assertEquals(vnf.getVnfId(), gcRequestInput.getVnfId());
    assertNotNull(gcRequestInput.getInputParameters());
}
Also used : GenericVnf(org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf) GenericResourceApiGcrequestinputGcRequestInput(org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput) GenericResourceApiParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParam) GenericResourceApiParamParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam) Test(org.junit.Test)

Example 5 with GenericResourceApiParamParam

use of org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam in project so by onap.

the class NetworkTopologyOperationRequestMapper method reqMapper.

public GenericResourceApiNetworkOperationInformation reqMapper(SDNCSvcOperation svcOperation, SDNCSvcAction svcAction, GenericResourceApiRequestActionEnumeration reqAction, L3Network network, ServiceInstance serviceInstance, Customer customer, RequestContext requestContext, CloudRegion cloudRegion) {
    GenericResourceApiNetworkOperationInformation req = new GenericResourceApiNetworkOperationInformation();
    String sdncReqId = UUID.randomUUID().toString();
    String msoRequestId = UUID.randomUUID().toString();
    if (requestContext != null && requestContext.getMsoRequestId() != null) {
        msoRequestId = requestContext.getMsoRequestId();
    }
    GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = generalTopologyObjectMapper.buildSdncRequestHeader(svcAction, sdncReqId);
    GenericResourceApiRequestinformationRequestInformation requestInformation = generalTopologyObjectMapper.buildGenericResourceApiRequestinformationRequestInformation(msoRequestId, reqAction);
    GenericResourceApiServiceinformationServiceInformation serviceInformation = generalTopologyObjectMapper.buildServiceInformation(serviceInstance, requestContext, customer, true);
    GenericResourceApiNetworkinformationNetworkInformation networkInformation = generalTopologyObjectMapper.buildNetworkInformation(network);
    GenericResourceApiNetworkrequestinputNetworkRequestInput networkRequestInput = buildNetworkRequestInput(network, serviceInstance, cloudRegion);
    req.setRequestInformation(requestInformation);
    req.setSdncRequestHeader(sdncRequestHeader);
    req.setServiceInformation(serviceInformation);
    req.setNetworkInformation(networkInformation);
    if (requestContext != null && requestContext.getUserParams() != null) {
        for (Map.Entry<String, Object> entry : requestContext.getUserParams().entrySet()) {
            GenericResourceApiParam networkInputParameters = new GenericResourceApiParam();
            GenericResourceApiParamParam paramItem = new GenericResourceApiParamParam();
            paramItem.setName(entry.getKey());
            paramItem.setValue(generalTopologyObjectMapper.mapUserParamValue(entry.getValue()));
            networkInputParameters.addParamItem(paramItem);
            networkRequestInput.setNetworkInputParameters(networkInputParameters);
        }
    }
    req.setNetworkRequestInput(networkRequestInput);
    return req;
}
Also used : GenericResourceApiServiceinformationServiceInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation) GenericResourceApiSdncrequestheaderSdncRequestHeader(org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader) GenericResourceApiRequestinformationRequestInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation) GenericResourceApiParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParam) GenericResourceApiNetworkOperationInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation) GenericResourceApiParamParam(org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam) Map(java.util.Map) GenericResourceApiNetworkinformationNetworkInformation(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation) GenericResourceApiNetworkrequestinputNetworkRequestInput(org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkrequestinputNetworkRequestInput)

Aggregations

GenericResourceApiParamParam (org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam)7 GenericResourceApiParam (org.onap.sdnc.northbound.client.model.GenericResourceApiParam)5 Map (java.util.Map)4 GenericResourceApiRequestinformationRequestInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation)3 GenericResourceApiSdncrequestheaderSdncRequestHeader (org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader)3 GenericResourceApiServiceinformationServiceInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation)3 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 GenericResourceApiGcrequestinputGcRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiGcrequestinputGcRequestInput)1 GenericResourceApiNetworkOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkOperationInformation)1 GenericResourceApiNetworkinformationNetworkInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkinformationNetworkInformation)1 GenericResourceApiNetworkrequestinputNetworkRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiNetworkrequestinputNetworkRequestInput)1 GenericResourceApiServiceOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation)1 GenericResourceApiServicerequestinputServiceRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiServicerequestinputServiceRequestInput)1 GenericResourceApiVfmodulerequestinputVfModuleRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiVfmodulerequestinputVfModuleRequestInput)1 GenericResourceApiVnfOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfOperationInformation)1 GenericResourceApiVnfinformationVnfInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation)1 GenericResourceApiVnfrequestinputVnfRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfrequestinputVnfRequestInput)1 GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfrequestinputVnfrequestinputVnfNetworkInstanceGroupIds)1 GenericVnf (org.onap.so.bpmn.servicedecomposition.bbobjects.GenericVnf)1