import org.junit.Assert;
import org.junit.Before;
import org.junit.Test;
-import org.opendaylight.openflowjava.protocol.api.extensibility.MessageTypeKey;
import org.opendaylight.openflowjava.protocol.api.extensibility.OFSerializer;
import org.opendaylight.openflowjava.protocol.api.extensibility.SerializerRegistry;
+import org.opendaylight.openflowjava.protocol.api.keys.MessageTypeKey;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.impl.serialization.SerializerRegistryImpl;
import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Dscp;
MatchBuilder builder = new MatchBuilder();
builder.setType(OxmMatchType.class);
Match match = builder.build();
-
+
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
matchSerializer.serialize(match, out);
-
+
Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());
Assert.assertEquals("Wrong match length", 4, out.readUnsignedShort());
Assert.assertTrue("Wrong padding", out.readableBytes() == 4);
}
-
+
/**
* Testing serialization of match
*/
bosBuilder.setBos(true);
entryBuilder.addAugmentation(BosMatchEntry.class, bosBuilder.build());
entries.add(entryBuilder.build());
-
+
entryBuilder = new MatchEntriesBuilder();
entryBuilder.setOxmClass(OpenflowBasicClass.class);
entryBuilder.setOxmMatchField(PbbIsid.class);
maskBuilder.setMask(new byte[]{0,1,2});
entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
entries.add(entryBuilder.build());
-
+
entryBuilder = new MatchEntriesBuilder();
entryBuilder.setOxmClass(OpenflowBasicClass.class);
entryBuilder.setOxmMatchField(TunnelId.class);
maskBuilder.setMask(new byte[]{0,0,0,0,0,0,0,2});
entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
entries.add(entryBuilder.build());
-
+
entryBuilder = new MatchEntriesBuilder();
entryBuilder.setOxmClass(OpenflowBasicClass.class);
entryBuilder.setOxmMatchField(Ipv6Exthdr.class);
maskBuilder.setMask(new byte[]{0,2});
entryBuilder.addAugmentation(MaskMatchEntry.class, maskBuilder.build());
entries.add(entryBuilder.build());
-
-
-
+
+
+
builder.setMatchEntries(entries);
Match match = builder.build();
-
+
ByteBuf out = UnpooledByteBufAllocator.DEFAULT.buffer();
matchSerializer.serialize(match, out);
-
+
Assert.assertEquals("Wrong match type", 1, out.readUnsignedShort());
Assert.assertEquals("Wrong match length", 428, out.readUnsignedShort());
Assert.assertEquals("Wrong match entry class", 0x8000, out.readUnsignedShort());