Bug 2756 - Match model update
[openflowjava.git] / openflow-protocol-impl / src / test / java / org / opendaylight / openflowjava / protocol / impl / serialization / match / OxmIcmpv6CodeSerializerTest.java
index f45254417333a6eaf7bf969e0b036586518aaaf5..6706a9d2a6888ca497a7a3eba438bd061a52fdc9 100644 (file)
@@ -16,11 +16,11 @@ import io.netty.buffer.PooledByteBufAllocator;
 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
@@ -35,8 +35,8 @@ public class OxmIcmpv6CodeSerializerTest {
      */
     @Test
     public void testSerialize() {
-        MatchEntriesBuilder builder = prepareIcmpv6CodeMatchEntry((short) 101);
-        
+        MatchEntryBuilder builder = prepareIcmpv6CodeMatchEntry((short) 101);
+
         ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
         serializer.serialize(builder.build(), buffer);
 
@@ -50,8 +50,8 @@ public class OxmIcmpv6CodeSerializerTest {
      */
     @Test
     public void testSerializeHeader() {
-        MatchEntriesBuilder builder = prepareIcmpv6CodeHeader(false);
-        
+        MatchEntryBuilder builder = prepareIcmpv6CodeHeader(false);
+
         ByteBuf buffer = PooledByteBufAllocator.DEFAULT.buffer();
         serializer.serializeHeader(builder.build(), buffer);
 
@@ -83,16 +83,18 @@ public class OxmIcmpv6CodeSerializerTest {
         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);