Search in sources :

Example 11 with HelloInput

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

the class MessageFactoryTest method testCreateHelloInputWoElements.

@Test
public void testCreateHelloInputWoElements() {
    short highestVersion = (short) 0x04;
    long xid = 42L;
    HelloInput helloMsg = MessageFactory.createHelloInput(highestVersion, xid);
    Assert.assertEquals(highestVersion, helloMsg.getVersion().shortValue());
    Assert.assertEquals(xid, helloMsg.getXid().longValue());
    Assert.assertNull(helloMsg.getElements());
}
Also used : HelloInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput) Test(org.junit.Test)

Example 12 with HelloInput

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

the class MessageFactoryTest method testCreateHelloInputWithElements.

@Test
public void testCreateHelloInputWithElements() {
    short highestVersion = (short) 0x04;
    long xid = 42L;
    Boolean[] expectedVersionBitmap = new Boolean[] { false, true, false, false, true };
    HelloInput helloMsg = MessageFactory.createHelloInput(highestVersion, xid, OFConstants.VERSION_ORDER);
    Assert.assertEquals(highestVersion, helloMsg.getVersion().shortValue());
    Assert.assertEquals(xid, helloMsg.getXid().longValue());
    Assert.assertEquals(1, helloMsg.getElements().size());
    Elements actualElement = helloMsg.getElements().get(0);
    Assert.assertEquals(HelloElementType.VERSIONBITMAP, actualElement.getType());
    Assert.assertArrayEquals(expectedVersionBitmap, actualElement.getVersionBitmap().toArray(new Boolean[0]));
}
Also used : HelloInput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput) Elements(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements) Test(org.junit.Test)

Aggregations

HelloInput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInput)10 Test (org.junit.Test)8 HelloInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder)8 ByteBuf (io.netty.buffer.ByteBuf)5 Elements (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.Elements)5 ArrayList (java.util.ArrayList)1 UdpMessageListenerWrapper (org.opendaylight.openflowjava.protocol.impl.core.connection.UdpMessageListenerWrapper)1 ElementsBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.hello.ElementsBuilder)1 RpcError (org.opendaylight.yangtools.yang.common.RpcError)1 RpcResult (org.opendaylight.yangtools.yang.common.RpcResult)1