Search in sources :

Example 21 with SerializerRegistry

use of org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry in project openflowplugin by opendaylight.

the class EchoOutputMessageFactoryTest method startUp.

@Before
public void startUp() {
    SerializerRegistry registry = new SerializerRegistryImpl();
    registry.init();
    factory = registry.getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, EchoOutput.class));
}
Also used : SerializerRegistry(org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry) SerializerRegistryImpl(org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl) MessageTypeKey(org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey) Before(org.junit.Before)

Example 22 with SerializerRegistry

use of org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry in project openflowplugin by opendaylight.

the class ExperimenterInputMessageFactoryTest method startUp.

/**
 * Sets up ExperimenterInputMessageFactory.
 * @param real true if setup should use real registry, false when mock is desired
 */
public void startUp(boolean real) {
    MockitoAnnotations.initMocks(this);
    expFactory = new ExperimenterInputMessageFactory();
    if (real) {
        SerializerRegistry realRegistry = new SerializerRegistryImpl();
        realRegistry.init();
        ((SerializerRegistryInjector) expFactory).injectSerializerRegistry(realRegistry);
    } else {
        ((SerializerRegistryInjector) expFactory).injectSerializerRegistry(registry);
    }
}
Also used : SerializerRegistry(org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry) SerializerRegistryInjector(org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector) SerializerRegistryImpl(org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl)

Example 23 with SerializerRegistry

use of org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry in project openflowplugin by opendaylight.

the class OF10PortStatusMessageFactoryTest method startUp.

@Before
public void startUp() {
    SerializerRegistry registry = new SerializerRegistryImpl();
    registry.init();
    factory = registry.getSerializer(new MessageTypeKey<>(EncodeConstants.OF10_VERSION_ID, PortStatusMessage.class));
}
Also used : SerializerRegistry(org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry) SerializerRegistryImpl(org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl) MessageTypeKey(org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey) Before(org.junit.Before)

Example 24 with SerializerRegistry

use of org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry in project openflowplugin by opendaylight.

the class GetAsyncReplyMessageFactoryTest method testSetAsyncInputWithNullMasks.

@Test
public void testSetAsyncInputWithNullMasks() throws Exception {
    GetAsyncOutputBuilder builder = new GetAsyncOutputBuilder();
    BufferHelper.setupHeader(builder, EncodeConstants.OF13_VERSION_ID);
    builder.setPacketInMask(null);
    builder.setPortStatusMask(null);
    builder.setFlowRemovedMask(null);
    GetAsyncOutput message = builder.build();
    GetAsyncReplyMessageFactory serializer = new GetAsyncReplyMessageFactory();
    SerializerRegistry registry = new SerializerRegistryImpl();
    registry.init();
    ByteBuf serializedBuffer = UnpooledByteBufAllocator.DEFAULT.buffer();
    serializer.serialize(message, serializedBuffer);
    BufferHelper.checkHeaderV13(serializedBuffer, MESSAGE_TYPE, 8);
    Assert.assertTrue("Unexpected data", serializedBuffer.readableBytes() == 0);
}
Also used : SerializerRegistry(org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry) GetAsyncOutputBuilder(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutputBuilder) SerializerRegistryImpl(org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl) GetAsyncOutput(org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput) ByteBuf(io.netty.buffer.ByteBuf) Test(org.junit.Test)

Example 25 with SerializerRegistry

use of org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry in project openflowplugin by opendaylight.

the class RoleReplyMessageFactoryTest method startUp.

@Before
public void startUp() {
    SerializerRegistry registry = new SerializerRegistryImpl();
    registry.init();
    factory = registry.getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, RoleRequestOutput.class));
}
Also used : SerializerRegistry(org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry) SerializerRegistryImpl(org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl) MessageTypeKey(org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey) Before(org.junit.Before)

Aggregations

SerializerRegistry (org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry)25 SerializerRegistryImpl (org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl)23 Before (org.junit.Before)21 MessageTypeKey (org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey)21 ByteBuf (io.netty.buffer.ByteBuf)3 Test (org.junit.Test)3 HelloInputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.HelloInputBuilder)2 SerializerRegistryInjector (org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistryInjector)1 GetAsyncOutput (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutput)1 GetAsyncOutputBuilder (org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.protocol.rev130731.GetAsyncOutputBuilder)1