import org.junit.Test;
import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
import org.opendaylight.openflowjava.protocol.api.util.OxmMatchConstants;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntry;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.augments.rev131002.Icmpv6CodeMatchEntryBuilder;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.Icmpv6Code;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.OpenflowBasicClass;
-import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev130731.oxm.fields.grouping.MatchEntriesBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.Icmpv6Code;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.OpenflowBasicClass;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entries.grouping.MatchEntryBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.Icmpv6CodeCaseBuilder;
+import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.oxm.rev150225.match.entry.value.grouping.match.entry.value.icmpv6.code._case.Icmpv6CodeBuilder;
/**
* @author michal.polkorab
*/
@Test
public void testSerialize() {
- MatchEntriesBuilder builder = prepareIcmpv6CodeMatchEntry((short) 101);
-
+ MatchEntryBuilder builder = prepareIcmpv6CodeMatchEntry((short) 101);
+
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
serializer.serialize(builder.build(), buffer);
*/
@Test
public void testSerializeHeader() {
- MatchEntriesBuilder builder = prepareIcmpv6CodeHeader(false);
-
+ MatchEntryBuilder builder = prepareIcmpv6CodeHeader(false);
+
ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
serializer.serializeHeader(builder.build(), buffer);
assertEquals("Wrong value length", EncodeConstants.SIZE_OF_BYTE_IN_BYTES, serializer.getValueLength());
}
- private static MatchEntriesBuilder prepareIcmpv6CodeMatchEntry(short value) {
- MatchEntriesBuilder builder = prepareIcmpv6CodeHeader(false);
- Icmpv6CodeMatchEntryBuilder icmpv6Builder = new Icmpv6CodeMatchEntryBuilder();
- icmpv6Builder.setIcmpv6Code(value);
- builder.addAugmentation(Icmpv6CodeMatchEntry.class, icmpv6Builder.build());
+ private static MatchEntryBuilder prepareIcmpv6CodeMatchEntry(short value) {
+ MatchEntryBuilder builder = prepareIcmpv6CodeHeader(false);
+ Icmpv6CodeCaseBuilder casebuilder = new Icmpv6CodeCaseBuilder();
+ Icmpv6CodeBuilder valueBuilder = new Icmpv6CodeBuilder();
+ valueBuilder.setIcmpv6Code(value);
+ casebuilder.setIcmpv6Code(valueBuilder.build());
+ builder.setMatchEntryValue(casebuilder.build());
return builder;
}
- private static MatchEntriesBuilder prepareIcmpv6CodeHeader(boolean hasMask) {
- MatchEntriesBuilder builder = new MatchEntriesBuilder();
+ private static MatchEntryBuilder prepareIcmpv6CodeHeader(boolean hasMask) {
+ MatchEntryBuilder builder = new MatchEntryBuilder();
builder.setOxmClass(OpenflowBasicClass.class);
builder.setOxmMatchField(Icmpv6Code.class);
builder.setHasMask(hasMask);