use of org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInputBuilder in project openflowplugin by opendaylight.
the class SalBundleServiceImplTest method testControlBundle.
@Test
public void testControlBundle() {
final ControlBundleInput input = new ControlBundleInputBuilder().setNode(NODE_REF).setBundleId(BUNDLE_ID).setFlags(BUNDLE_FLAGS).setType(BundleControlType.ONFBCTOPENREQUEST).setBundleProperty(properties).build();
final SendExperimenterInputBuilder experimenterBuilder = new SendExperimenterInputBuilder();
experimenterBuilder.setNode(NODE_REF);
experimenterBuilder.setExperimenterMessageOfChoice(new BundleControlSalBuilder().setSalControlData(new SalControlDataBuilder(input).build()).build());
service.controlBundle(input);
Mockito.verify(experimenterMessageService).sendExperimenter(experimenterBuilder.build());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInputBuilder 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.experimenter.message.service.rev151020.SendExperimenterInputBuilder 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());
}
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInputBuilder in project openflowplugin by opendaylight.
the class SalBundleServiceImpl method controlBundle.
@Override
public Future<RpcResult<Void>> controlBundle(ControlBundleInput input) {
final SendExperimenterInputBuilder experimenterInputBuilder = new SendExperimenterInputBuilder();
experimenterInputBuilder.setNode(input.getNode());
experimenterInputBuilder.setExperimenterMessageOfChoice(new BundleControlSalBuilder().setSalControlData(new SalControlDataBuilder(input).build()).build());
return experimenterMessageService.sendExperimenter(experimenterInputBuilder.build());
}
Aggregations