Updated experimenter model
[openflowjava.git] / openflow-protocol-impl / src / main / java / org / opendaylight / openflowjava / protocol / impl / util / OF10MatchDeserializer.java
index cd06f2ddbec5cc4ae825b6a66cce23564683c109..93ff402db21a0dd99967892b75a90c1700e8a918 100644 (file)
@@ -10,10 +10,9 @@ package org.opendaylight.openflowjava.protocol.impl.util;
 
 import io.netty.buffer.ByteBuf;
 
-import java.util.ArrayList;
-import java.util.List;
-
 import org.opendaylight.openflowjava.protocol.api.extensibility.OFDeserializer;
+import org.opendaylight.openflowjava.protocol.api.util.EncodeConstants;
+import org.opendaylight.openflowjava.util.ByteBufUtils;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.inet.types.rev100924.Ipv4Address;
 import org.opendaylight.yang.gen.v1.urn.ietf.params.xml.ns.yang.ietf.yang.types.rev100924.MacAddress;
 import org.opendaylight.yang.gen.v1.urn.opendaylight.openflow.common.types.rev130731.FlowWildcardsV10;
@@ -57,16 +56,8 @@ public class OF10MatchDeserializer implements OFDeserializer<MatchV10> {
         builder.setNwTos(input.readUnsignedByte());
         builder.setNwProto(input.readUnsignedByte());
         input.skipBytes(PADDING_IN_MATCH_2);
-        List<String> srcGroups = new ArrayList<>();
-        for (int i = 0; i < EncodeConstants.GROUPS_IN_IPV4_ADDRESS; i++) {
-            srcGroups.add(Short.toString(input.readUnsignedByte()));
-        }
-        builder.setNwSrc(new Ipv4Address(ByteBufUtils.DOT_JOINER.join(srcGroups)));
-        List<String> dstGroups = new ArrayList<>();
-        for (int i = 0; i < EncodeConstants.GROUPS_IN_IPV4_ADDRESS; i++) {
-            dstGroups.add(Short.toString(input.readUnsignedByte()));
-        }
-        builder.setNwDst(new Ipv4Address(ByteBufUtils.DOT_JOINER.join(dstGroups)));
+        builder.setNwSrc(new Ipv4Address(ByteBufUtils.readIpv4Address(input)));
+        builder.setNwDst(new Ipv4Address(ByteBufUtils.readIpv4Address(input)));
         builder.setTpSrc(input.readUnsignedShort());
         builder.setTpDst(input.readUnsignedShort());
         return builder.build();