use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.
the class SalEchoServiceImplTest method testSendEcho.
@Test
public void testSendEcho() throws Exception {
final EchoOutput echoOut = new EchoOutputBuilder().setData(DUMMY_DATA).build();
final RpcResult<EchoOutput> replyRpcResult = RpcResultBuilder.success(echoOut).build();
final ListenableFuture<RpcResult<EchoOutput>> replyFt = Futures.immediateFuture(replyRpcResult);
Mockito.when(mockedRequestContext.getFuture()).thenReturn(replyFt);
SendEchoInput sendEchoInput = new SendEchoInputBuilder().setData(DUMMY_DATA).build();
final Future<RpcResult<SendEchoOutput>> echoOutput = salEchoService.sendEcho(sendEchoInput);
Assert.assertNotNull(echoOutput);
Assert.assertTrue(echoOutput.isDone());
Assert.assertTrue(echoOutput.get().isSuccessful());
verify(mockedRequestContextStack).createRequestContext();
verify(mockedOutboundQueue).commitEntry(Matchers.eq(2121L), Matchers.<OfHeader>any(), Matchers.<FutureCallback<OfHeader>>any());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.
the class SalTableServiceImplTest method setup.
@Override
public void setup() {
handleResultFuture = SettableFuture.create();
when(mockedRequestContext.getFuture()).thenReturn(handleResultFuture);
Mockito.doAnswer((Answer<Void>) invocation -> {
final FutureCallback<OfHeader> callback = (FutureCallback<OfHeader>) invocation.getArguments()[2];
callback.onSuccess(null);
return null;
}).when(mockedOutboundQueue).commitEntry(Matchers.anyLong(), Matchers.<OfHeader>any(), Matchers.<FutureCallback<OfHeader>>any());
final ConvertorManager convertorManager = ConvertorManagerFactory.createDefaultManager();
salTableService = new SalTableServiceImpl(mockedRequestContextStack, mockedDeviceContext, convertorManager, MultipartWriterProviderFactory.createDefaultProvider(mockedDeviceContext));
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.
the class SingleLayerGroupServiceTest method buildRequest.
@Test
public void buildRequest() throws Exception {
final AddGroupInput input = new AddGroupInputBuilder().setGroupId(new GroupId(GROUP_ID)).build();
final OfHeader ofHeader = service.buildRequest(DUMMY_XID, input);
assertEquals(GroupMessage.class, ofHeader.getImplementedInterface());
final GroupMessage result = GroupMessage.class.cast(ofHeader);
assertEquals(GroupModCommand.OFPGCADD, result.getCommand());
assertEquals(GROUP_ID, result.getGroupId().getValue().longValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.
the class PortStatsServiceTest method testBuildRequest.
@Test
public void testBuildRequest() throws Exception {
Xid xid = new Xid(42L);
GetNodeConnectorStatisticsInputBuilder input = new GetNodeConnectorStatisticsInputBuilder().setNodeConnectorId(new NodeConnectorId("junitProto:11:12")).setNode(createNodeRef("junitProto:11"));
final OfHeader request = portStatsService.buildRequest(xid, input.build());
Assert.assertTrue(request instanceof MultipartRequestInput);
final MultipartRequestInput mpRequest = (MultipartRequestInput) request;
Assert.assertTrue(mpRequest.getMultipartRequestBody() instanceof MultipartRequestPortStatsCase);
final MultipartRequestPortStatsCase mpRequestBody = (MultipartRequestPortStatsCase) mpRequest.getMultipartRequestBody();
Assert.assertEquals(12L, mpRequestBody.getMultipartRequestPortStats().getPortNo().longValue());
}
use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.OfHeader in project openflowplugin by opendaylight.
the class StatisticsGatheringServiceTest method testBuildRequest.
@Test
public void testBuildRequest() throws Exception {
final long xidValue = 21L;
Xid xid = new Xid(xidValue);
for (MultipartType mpType : MultipartType.values()) {
final OfHeader request = statisticsGatheringService.buildRequest(xid, mpType);
Assert.assertEquals(MultipartRequestInput.class, request.getImplementedInterface());
Assert.assertEquals(xidValue, request.getXid().longValue());
Assert.assertNotNull(request);
}
}
Aggregations