* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
* terms of the Eclipse Public License v1.0 which accompanies this distribution,
* and is available at http://www.eclipse.org/legal/epl-v10.html
*/
package org.opendaylight.openflowplugin.impl.protocol.serialization.messages;
import static org.junit.Assert.assertEquals;
package org.opendaylight.openflowplugin.impl.protocol.serialization.messages;
import static org.junit.Assert.assertEquals;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.openflowplugin.impl.protocol.serialization.AbstractSerializerTest;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.util.ByteBufUtils;
import org.opendaylight.openflowplugin.impl.protocol.serialization.AbstractSerializerTest;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev130715.MacAddress;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortConfig;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortFeatures;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumberValues;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.port.rev130925.PortNumberUni;
import org.opendaylight.yang.gen.v1.urn.opendaylight.flow.types.rev131026.OutputPortValues;
import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.PortNumberValues;
private static final byte PADDING_IN_PORT_MOD_MESSAGE_02 = 2;
private static final byte PADDING_IN_PORT_MOD_MESSAGE_03 = 4;
private static final short LENGTH = 40;
private static final byte PADDING_IN_PORT_MOD_MESSAGE_02 = 2;
private static final byte PADDING_IN_PORT_MOD_MESSAGE_03 = 4;
private static final short LENGTH = 40;
- private static final Long XID = 42L;
- private static final short VERSION = EncodeConstants.OF13_VERSION_ID;
+ private static final Uint32 XID = Uint32.valueOf(42);
+ private static final Uint8 VERSION = EncodeConstants.OF_VERSION_1_3;
private static final String PORT_NUMBER = OutputPortValues.ALL.toString();
private static final Long PORT_NUMBER_VAL = BinContent.intToUnsignedLong(PortNumberValues.ALL.getIntValue());
private static final String PORT_NUMBER = OutputPortValues.ALL.toString();
private static final Long PORT_NUMBER_VAL = BinContent.intToUnsignedLong(PortNumberValues.ALL.getIntValue());
.setVersion(VERSION)
.setPortNumber(new PortNumberUni(PORT_NUMBER))
.setConfiguration(new PortConfig(IS_NOFWD, IS_NOPACKETIN, IS_NORECV, IS_PORTDOWN))
.setVersion(VERSION)
.setPortNumber(new PortNumberUni(PORT_NUMBER))
.setConfiguration(new PortConfig(IS_NOFWD, IS_NOPACKETIN, IS_NORECV, IS_PORTDOWN))
- serializer = getRegistry().getSerializer(new MessageTypeKey<>(EncodeConstants.OF13_VERSION_ID, PortMessage.class));
+ serializer = getRegistry()
+ .getSerializer(new MessageTypeKey<>(EncodeConstants.OF_VERSION_1_3, PortMessage.class));
final ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(MESSAGE, out);
// Header
final ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(MESSAGE, out);
// Header
assertEquals(out.readByte(), serializer.getMessageType());
assertEquals(out.readShort(), LENGTH);
assertEquals(out.readInt(), XID.intValue());
assertEquals(out.readByte(), serializer.getMessageType());
assertEquals(out.readShort(), LENGTH);
assertEquals(out.readInt(), XID.intValue());