Search in sources :

Example 1 with SendExperimenterInputBuilder

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());
}
Also used : ControlBundleInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleInput) BundleControlSalBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleControlSalBuilder) SalControlDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.bundle.control.sal.SalControlDataBuilder) ControlBundleInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleInputBuilder) SendExperimenterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInputBuilder) Test(org.junit.Test)

Example 2 with SendExperimenterInputBuilder

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);
}
Also used : BundleAddMessageSalBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleAddMessageSalBuilder) Message(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.messages.Message) SalAddMessageDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.bundle.add.message.sal.SalAddMessageDataBuilder) ArrayList(java.util.ArrayList) RpcResult(org.opendaylight.yangtools.yang.common.RpcResult) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) SendExperimenterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInputBuilder)

Example 3 with SendExperimenterInputBuilder

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());
    }
}
Also used : AddBundleMessagesInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInput) BundleAddMessageSalBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleAddMessageSalBuilder) Messages(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.Messages) Message(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.messages.Message) AddBundleMessagesInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInputBuilder) SalAddMessageDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.bundle.add.message.sal.SalAddMessageDataBuilder) SendExperimenterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInputBuilder) MessagesBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.MessagesBuilder) Test(org.junit.Test)

Example 4 with SendExperimenterInputBuilder

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());
}
Also used : BundleControlSalBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleControlSalBuilder) SalControlDataBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.bundle.control.sal.SalControlDataBuilder) SendExperimenterInputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInputBuilder)

Aggregations

SendExperimenterInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.experimenter.message.service.rev151020.SendExperimenterInputBuilder)4 Test (org.junit.Test)2 Message (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.messages.Message)2 BundleAddMessageSalBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleAddMessageSalBuilder)2 BundleControlSalBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.BundleControlSalBuilder)2 SalAddMessageDataBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.bundle.add.message.sal.SalAddMessageDataBuilder)2 SalControlDataBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.send.experimenter.input.experimenter.message.of.choice.bundle.control.sal.SalControlDataBuilder)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 ArrayList (java.util.ArrayList)1 AddBundleMessagesInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInput)1 AddBundleMessagesInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.AddBundleMessagesInputBuilder)1 ControlBundleInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleInput)1 ControlBundleInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.ControlBundleInputBuilder)1 Messages (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.Messages)1 MessagesBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflowplugin.extension.onf.bundle.service.rev170124.add.bundle.messages.input.MessagesBuilder)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1