Search in sources :

Example 6 with ErrorMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage in project openflowplugin by opendaylight.

the class AbstractRequestCallbackTest method testOnFailureWithDeviceRequestFailedException.

@Test
public void testOnFailureWithDeviceRequestFailedException() throws Exception {
    ErrorMessage dummyErrorMessage = new ErrorMessageBuilder().build();
    abstractRequestCallback.onFailure(new DeviceRequestFailedException(DUMMY_EXCEPTION_DESCRIPTION, dummyErrorMessage));
    final ListenableFuture futureResult = dummyRequestContext.getFuture();
    RpcError rpcError = provideRpcError(futureResult);
    assertEquals("Device reported error type null code null", rpcError.getMessage());
}
Also used : ErrorMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessageBuilder) RpcError(org.opendaylight.yangtools.yang.common.RpcError) DeviceRequestFailedException(org.opendaylight.openflowjava.protocol.api.connection.DeviceRequestFailedException) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) ErrorMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage) Test(org.junit.Test)

Example 7 with ErrorMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage in project openflowplugin by opendaylight.

the class ConnectionAdapterImplTest method testConsume.

/**
 * Tests {@link ConnectionAdapterImpl#consume(DataObject)} with notifications.
 */
@Test
public void testConsume() {
    DataObject message = new EchoRequestMessageBuilder().build();
    adapter.consume(message);
    verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);
    message = new ErrorMessageBuilder().build();
    adapter.consume(message);
    verify(messageListener, times(1)).onErrorMessage((ErrorMessage) message);
    message = new ExperimenterMessageBuilder().build();
    adapter.consume(message);
    verify(messageListener, times(1)).onExperimenterMessage((ExperimenterMessage) message);
    message = new FlowRemovedMessageBuilder().build();
    adapter.consume(message);
    verify(messageListener, times(1)).onFlowRemovedMessage((FlowRemovedMessage) message);
    message = new HelloMessageBuilder().build();
    adapter.consume(message);
    verify(messageListener, times(1)).onHelloMessage((HelloMessage) message);
    message = new MultipartReplyMessageBuilder().build();
    adapter.consume(message);
    verify(messageListener, times(1)).onMultipartReplyMessage((MultipartReplyMessage) message);
    message = new PacketInMessageBuilder().build();
    adapter.consume(message);
    verify(messageListener, times(1)).onPacketInMessage((PacketInMessage) message);
    message = new PortStatusMessageBuilder().build();
    adapter.consume(message);
    verify(messageListener, times(1)).onPortStatusMessage((PortStatusMessage) message);
    message = new SwitchIdleEventBuilder().build();
    adapter.consume(message);
    verify(systemListener, times(1)).onSwitchIdleEvent((SwitchIdleEvent) message);
    message = new DisconnectEventBuilder().build();
    adapter.consume(message);
    verify(systemListener, times(1)).onDisconnectEvent((DisconnectEvent) message);
    message = new EchoRequestMessageBuilder().build();
    adapter.consume(message);
    verify(messageListener, times(1)).onEchoRequestMessage((EchoRequestMessage) message);
}
Also used : ErrorMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessageBuilder) DisconnectEventBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.DisconnectEventBuilder) ExperimenterMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ExperimenterMessageBuilder) PacketInMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PacketInMessageBuilder) DataObject(org.opendaylight.yangtools.yang.binding.DataObject) SwitchIdleEventBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.system.rev130927.SwitchIdleEventBuilder) PortStatusMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.PortStatusMessageBuilder) HelloMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloMessageBuilder) MultipartReplyMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.MultipartReplyMessageBuilder) FlowRemovedMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.FlowRemovedMessageBuilder) EchoRequestMessageBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.EchoRequestMessageBuilder) Test(org.junit.Test)

Example 8 with ErrorMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage in project openflowplugin by opendaylight.

the class ErrorMessageFactoryTest method testWithoutData2.

/**
 * Test of {@link ErrorMessageFactory} for correct translation into POJO
 * - not existing code used.
 */
@Test
public void testWithoutData2() {
    ByteBuf bb = BufferHelper.buildBuffer("00 00 FF FF");
    ErrorMessage builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 0, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "HELLOFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 01 FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 1, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "BADREQUEST", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 02 FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 2, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "BADACTION", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 03 FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 3, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "BADINSTRUCTION", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 04 FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 4, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "BADMATCH", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 05 FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 5, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "FLOWMODFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 06 FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 6, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "GROUPMODFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 07 FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 7, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "PORTMODFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 08 FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 8, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "TABLEMODFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 09 FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 9, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "QUEUEOPFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 0A FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 10, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "SWITCHCONFIGFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 0B FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 11, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "ROLEREQUESTFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 0C FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 12, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "METERMODFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 0D FF FF");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 13, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 65535, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "TABLEFEATURESFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) ErrorMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage) Test(org.junit.Test)

Example 9 with ErrorMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage in project openflowplugin by opendaylight.

the class ErrorMessageFactoryTest method testWithIncorrectCodeEnum.

/**
 * Test of {@link ErrorMessageFactory} for correct translation into POJO.
 */
@Test
public void testWithIncorrectCodeEnum() {
    ByteBuf bb = BufferHelper.buildBuffer("00 03 00 10 00 01 02 03");
    ErrorMessage builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 3, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 16, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "BADINSTRUCTION", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN_CODE", builtByFactory.getCodeString());
    Assert.assertArrayEquals("Wrong data", new byte[] { 0x00, 0x01, 0x02, 0x03 }, builtByFactory.getData());
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) ErrorMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage) Test(org.junit.Test)

Example 10 with ErrorMessage

use of org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage in project openflowplugin by opendaylight.

the class ErrorMessageFactoryTest method testWithoutData.

/**
 * Test of {@link ErrorMessageFactory} for correct translation into POJO.
 */
@Test
public void testWithoutData() {
    ByteBuf bb = BufferHelper.buildBuffer("00 00 00 00");
    ErrorMessage builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 0, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "HELLOFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "INCOMPATIBLE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 01 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 1, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "BADREQUEST", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "BADVERSION", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 02 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 2, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "BADACTION", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "BADTYPE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 03 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 3, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "BADINSTRUCTION", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWNINST", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 04 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 4, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "BADMATCH", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "BADTYPE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 05 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 5, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "FLOWMODFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 06 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 6, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "GROUPMODFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "GROUPEXISTS", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 07 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 7, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "PORTMODFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "BADPORT", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 08 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 8, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "TABLEMODFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "BADTABLE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 09 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 9, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "QUEUEOPFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "BADPORT", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 0A 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 10, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "SWITCHCONFIGFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "BADFLAGS", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 0B 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 11, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "ROLEREQUESTFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "STALE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 0C 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 12, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "METERMODFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "UNKNOWN", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
    bb = BufferHelper.buildBuffer("00 0D 00 00");
    builtByFactory = BufferHelper.deserialize(errorFactory, bb);
    BufferHelper.checkHeaderV13(builtByFactory);
    Assert.assertEquals("Wrong type", 13, builtByFactory.getType().intValue());
    Assert.assertEquals("Wrong code", 0, builtByFactory.getCode().intValue());
    Assert.assertEquals("Wrong type string", "TABLEFEATURESFAILED", builtByFactory.getTypeString());
    Assert.assertEquals("Wrong code string", "BADTABLE", builtByFactory.getCodeString());
    Assert.assertNull("Data is not null", builtByFactory.getData());
}
Also used : ByteBuf(io.netty.buffer.ByteBuf) ErrorMessage(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)17 ErrorMessage (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessage)17 ByteBuf (io.netty.buffer.ByteBuf)14 ErrorMessageBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.ErrorMessageBuilder)7 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)6 ReadFailedException (org.opendaylight.controller.md.sal.common.api.data.ReadFailedException)5 Uuid (org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.Uuid)5 RpcError (org.opendaylight.yangtools.yang.common.RpcError)5 ArrayList (java.util.ArrayList)4 VpnInstance (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstance)4 ExecutionException (java.util.concurrent.ExecutionException)3 TransactionCommitFailedException (org.opendaylight.controller.md.sal.common.api.data.TransactionCommitFailedException)3 ErrorType (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.ErrorType)2 ListenableFuture (com.google.common.util.concurrent.ListenableFuture)1 SuppressFBWarnings (edu.umd.cs.findbugs.annotations.SuppressFBWarnings)1 DeviceRequestFailedException (org.opendaylight.openflowjava.protocol.api.connection.DeviceRequestFailedException)1 VpnInstanceKey (org.opendaylight.yang.gen.v1.urn.huawei.params.xml.ns.yang.l3vpn.rev140815.vpn.instances.VpnInstanceKey)1 AssociateNetworksOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.AssociateNetworksOutput)1 AssociateNetworksOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.AssociateNetworksOutputBuilder)1 CreateEVPNOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.netvirt.neutronvpn.rev150602.CreateEVPNOutputBuilder)1