use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleAddMessageSalBuilder in project openflowplugin by opendaylight.
the class BundleAddMessageConverterTest method createMessage.
private static BundleAddMessageSal createMessage(final boolean withProperty, final BundleInnerMessage innerMessage) {
final SalAddMessageDataBuilder dataBuilder = new SalAddMessageDataBuilder();
dataBuilder.setBundleId(new BundleId(1L));
dataBuilder.setFlags(new BundleFlags(true, false));
List<BundleProperty> properties = new ArrayList<>();
if (withProperty) {
properties.add(BundleTestUtils.createExperimenterProperty(Mockito.mock(BundlePropertyExperimenterData.class)));
}
dataBuilder.setBundleProperty(properties);
dataBuilder.setBundleInnerMessage(innerMessage);
return new BundleAddMessageSalBuilder().setSalAddMessageData(dataBuilder.build()).build();
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleAddMessageSalBuilder in project openflowplugin by opendaylight.
the class SalBundleServiceImpl method addBundleMessages.
@Override
public Future<RpcResult<Void>> addBundleMessages(AddBundleMessagesInput input) {
final List<ListenableFuture<RpcResult<Void>>> partialResults = new ArrayList<>();
final SendExperimenterInputBuilder experimenterInputBuilder = new SendExperimenterInputBuilder();
final BundleAddMessageSalBuilder bundleAddMessageBuilder = new BundleAddMessageSalBuilder();
final SalAddMessageDataBuilder dataBuilder = new SalAddMessageDataBuilder();
experimenterInputBuilder.setNode(input.getNode());
dataBuilder.setNode(input.getNode());
dataBuilder.setBundleId(input.getBundleId());
dataBuilder.setFlags(input.getFlags());
dataBuilder.setBundleProperty(input.getBundleProperty());
for (Message message : input.getMessages().getMessage()) {
dataBuilder.setBundleInnerMessage(message.getBundleInnerMessage());
experimenterInputBuilder.setExperimenterMessageOfChoice(bundleAddMessageBuilder.setSalAddMessageData(dataBuilder.build()).build());
ListenableFuture<RpcResult<Void>> res = JdkFutureAdapters.listenInPoolThread(experimenterMessageService.sendExperimenter(experimenterInputBuilder.build()));
partialResults.add(res);
}
return processResults(partialResults);
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleAddMessageSalBuilder in project openflowplugin by opendaylight.
the class SalBundleServiceImplTest method testAddBundleMessages.
@Test
public void testAddBundleMessages() throws Exception {
final List<Message> innerMessages = createMessages();
final Messages messages = new MessagesBuilder().setMessage(innerMessages).build();
final AddBundleMessagesInput input = new AddBundleMessagesInputBuilder().setNode(NODE_REF).setBundleId(BUNDLE_ID).setFlags(BUNDLE_FLAGS).setBundleProperty(properties).setMessages(messages).build();
final SalAddMessageDataBuilder dataBuilder = new SalAddMessageDataBuilder();
dataBuilder.setBundleId(BUNDLE_ID).setFlags(BUNDLE_FLAGS).setBundleProperty(properties);
final BundleAddMessageSalBuilder addMessageBuilder = new BundleAddMessageSalBuilder();
final SendExperimenterInputBuilder experimenterBuilder = new SendExperimenterInputBuilder().setNode(NODE_REF);
Mockito.when(experimenterMessageService.sendExperimenter(Matchers.any())).thenReturn(SettableFuture.create());
service.addBundleMessages(input);
for (Message msg : innerMessages) {
Mockito.verify(experimenterMessageService).sendExperimenter(experimenterBuilder.setExperimenterMessageOfChoice(addMessageBuilder.setSalAddMessageData(dataBuilder.setNode(NODE_REF).setBundleInnerMessage(msg.getBundleInnerMessage()).build()).build()).build());
}
}
Aggregations