Search in sources :

Example 1 with GenericResourceApiSdncrequestheaderSdncRequestHeader

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

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

the class GeneralTopologyObjectMapperTest method buildSdncRequestHeaderDeleteTest.

@Test
public void buildSdncRequestHeaderDeleteTest() {
    GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.DELETE, "sdncReqId");
    assertEquals(GenericResourceApiSvcActionEnumeration.DELETE, requestHeader.getSvcAction());
    assertEquals("sdncReqId", requestHeader.getSvcRequestId());
}
Also used : GenericResourceApiSdncrequestheaderSdncRequestHeader(org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader) Test(org.junit.Test)

Example 3 with GenericResourceApiSdncrequestheaderSdncRequestHeader

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

the class GeneralTopologyObjectMapperTest method buildSdncRequestHeaderAssignTest.

@Test
public void buildSdncRequestHeaderAssignTest() {
    GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.ASSIGN, "sdncReqId");
    assertEquals(GenericResourceApiSvcActionEnumeration.ASSIGN, requestHeader.getSvcAction());
    assertEquals("sdncReqId", requestHeader.getSvcRequestId());
}
Also used : GenericResourceApiSdncrequestheaderSdncRequestHeader(org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader) Test(org.junit.Test)

Example 4 with GenericResourceApiSdncrequestheaderSdncRequestHeader

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

the class GeneralTopologyObjectMapperTest method buildSdncRequestHeaderActivateTest.

@Test
public void buildSdncRequestHeaderActivateTest() {
    GenericResourceApiSdncrequestheaderSdncRequestHeader requestHeader = genObjMapper.buildSdncRequestHeader(SDNCSvcAction.ACTIVATE, "sdncReqId");
    assertEquals(GenericResourceApiSvcActionEnumeration.ACTIVATE, requestHeader.getSvcAction());
    assertEquals("sdncReqId", requestHeader.getSvcRequestId());
}
Also used : GenericResourceApiSdncrequestheaderSdncRequestHeader(org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader) Test(org.junit.Test)

Example 5 with GenericResourceApiSdncrequestheaderSdncRequestHeader

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

the class GeneralTopologyObjectMapper method buildSdncRequestHeader.

public GenericResourceApiSdncrequestheaderSdncRequestHeader buildSdncRequestHeader(SDNCSvcAction svcAction, String sdncReqId, String callbackUrl) {
    GenericResourceApiSdncrequestheaderSdncRequestHeader sdncRequestHeader = new GenericResourceApiSdncrequestheaderSdncRequestHeader();
    sdncRequestHeader.setSvcAction(svcAction.getSdncApiAction());
    sdncRequestHeader.setSvcRequestId(sdncReqId);
    sdncRequestHeader.setSvcNotificationUrl(callbackUrl);
    return sdncRequestHeader;
}
Also used : GenericResourceApiSdncrequestheaderSdncRequestHeader(org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader)

Aggregations

GenericResourceApiSdncrequestheaderSdncRequestHeader (org.onap.sdnc.northbound.client.model.GenericResourceApiSdncrequestheaderSdncRequestHeader)13 GenericResourceApiRequestinformationRequestInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiRequestinformationRequestInformation)6 GenericResourceApiServiceinformationServiceInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceinformationServiceInformation)6 Test (org.junit.Test)5 Map (java.util.Map)3 GenericResourceApiParam (org.onap.sdnc.northbound.client.model.GenericResourceApiParam)3 GenericResourceApiParamParam (org.onap.sdnc.northbound.client.model.GenericResourceApiParamParam)3 GenericResourceApiConfigurationinformationConfigurationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiConfigurationinformationConfigurationInformation)2 GenericResourceApiGcTopologyOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiGcTopologyOperationInformation)2 GenericResourceApiVnfinformationVnfInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVnfinformationVnfInformation)2 ArrayList (java.util.ArrayList)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 GenericResourceApiRequestActionEnumeration (org.onap.sdnc.northbound.client.model.GenericResourceApiRequestActionEnumeration)1 GenericResourceApiServiceOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiServiceOperationInformation)1 GenericResourceApiServicerequestinputServiceRequestInput (org.onap.sdnc.northbound.client.model.GenericResourceApiServicerequestinputServiceRequestInput)1 GenericResourceApiSvcActionEnumeration (org.onap.sdnc.northbound.client.model.GenericResourceApiSvcActionEnumeration)1 GenericResourceApiVfModuleOperationInformation (org.onap.sdnc.northbound.client.model.GenericResourceApiVfModuleOperationInformation)1