use of org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInput in project openflowplugin by opendaylight.
the class SalExperimenterMessageServiceImpl method buildRequest.
@Override
protected OfHeader buildRequest(Xid xid, SendExperimenterInput input) throws ServiceException {
final TypeVersionKey key = new TypeVersionKey(input.getExperimenterMessageOfChoice().getImplementedInterface(), getVersion());
final ConverterMessageToOFJava<ExperimenterMessageOfChoice, ExperimenterDataOfChoice> messageConverter = extensionConverterProvider.getMessageConverter(key);
if (messageConverter == null) {
throw new ServiceException(new ConverterNotFoundException(key.toString()));
}
final ExperimenterInputBuilder experimenterInputBld;
if (messageConverter instanceof BundleMessageDataInjector) {
((BundleMessageDataInjector) messageConverter).setNode(input.getNode());
((BundleMessageDataInjector) messageConverter).setXid(xid.getValue());
}
try {
experimenterInputBld = new ExperimenterInputBuilder().setExperimenter(messageConverter.getExperimenterId()).setExpType(messageConverter.getType()).setExperimenterDataOfChoice(messageConverter.convert(input.getExperimenterMessageOfChoice())).setVersion(getVersion()).setXid(xid.getValue());
} catch (ConversionException e) {
throw new ServiceException(e);
}
return experimenterInputBld.build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInput in project openflowplugin by opendaylight.
the class SalExperimenterMessageServiceImplTest method testBuildRequest.
@Test
public void testBuildRequest() throws Exception {
SendExperimenterInput sendExperimenterInput = buildSendExperimenterInput();
final OfHeader request = salExperimenterMessageService.buildRequest(new Xid(DUMMY_XID_VALUE), sendExperimenterInput);
assertEquals(DUMMY_XID_VALUE, request.getXid());
assertTrue(request instanceof ExperimenterInput);
final ExperimenterInput input = (ExperimenterInput) request;
assertEquals(43L, input.getExperimenter().getValue().longValue());
assertEquals(44L, input.getExpType().longValue());
Mockito.verify(extensionConverter).convert(sendExperimenterInput.getExperimenterMessageOfChoice());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInput in project openflowplugin by opendaylight.
the class SalExperimenterMessageServiceImplTest method testSendExperimenter.
@Test
public void testSendExperimenter() throws Exception {
SendExperimenterInput sendExperimenterInput = buildSendExperimenterInput();
salExperimenterMessageService.sendExperimenter(sendExperimenterInput);
verify(mockedRequestContextStack).createRequestContext();
}
Aggregations