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;
}
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());
}
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());
}
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());
}
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;
}
Aggregations