Pavlin Radoslavov

Use Ip4Address and Ip4Prefix inside FlowEntryBuilder when dealing

with IPv4 source or destination.

Change-Id: Ia9084c2361b296d8636052e859c2a2d1516a4a11
...@@ -31,8 +31,8 @@ import org.onlab.onos.net.flow.FlowRule; ...@@ -31,8 +31,8 @@ import org.onlab.onos.net.flow.FlowRule;
31 import org.onlab.onos.net.flow.TrafficSelector; 31 import org.onlab.onos.net.flow.TrafficSelector;
32 import org.onlab.onos.net.flow.TrafficTreatment; 32 import org.onlab.onos.net.flow.TrafficTreatment;
33 import org.onlab.onos.openflow.controller.Dpid; 33 import org.onlab.onos.openflow.controller.Dpid;
34 -import org.onlab.packet.IpAddress; 34 +import org.onlab.packet.Ip4Address;
35 -import org.onlab.packet.IpPrefix; 35 +import org.onlab.packet.Ip4Prefix;
36 import org.onlab.packet.MacAddress; 36 import org.onlab.packet.MacAddress;
37 import org.onlab.packet.VlanId; 37 import org.onlab.packet.VlanId;
38 import org.projectfloodlight.openflow.protocol.OFFlowRemoved; 38 import org.projectfloodlight.openflow.protocol.OFFlowRemoved;
...@@ -168,12 +168,12 @@ public class FlowEntryBuilder { ...@@ -168,12 +168,12 @@ public class FlowEntryBuilder {
168 case SET_NW_DST: 168 case SET_NW_DST:
169 OFActionSetNwDst nwdst = (OFActionSetNwDst) act; 169 OFActionSetNwDst nwdst = (OFActionSetNwDst) act;
170 IPv4Address di = nwdst.getNwAddr(); 170 IPv4Address di = nwdst.getNwAddr();
171 - builder.setIpDst(IpAddress.valueOf(di.getInt())); 171 + builder.setIpDst(Ip4Address.valueOf(di.getInt()));
172 break; 172 break;
173 case SET_NW_SRC: 173 case SET_NW_SRC:
174 OFActionSetNwSrc nwsrc = (OFActionSetNwSrc) act; 174 OFActionSetNwSrc nwsrc = (OFActionSetNwSrc) act;
175 IPv4Address si = nwsrc.getNwAddr(); 175 IPv4Address si = nwsrc.getNwAddr();
176 - builder.setIpSrc(IpAddress.valueOf(si.getInt())); 176 + builder.setIpSrc(Ip4Address.valueOf(si.getInt()));
177 break; 177 break;
178 case EXPERIMENTER: 178 case EXPERIMENTER:
179 OFActionExperimenter exp = (OFActionExperimenter) act; 179 OFActionExperimenter exp = (OFActionExperimenter) act;
...@@ -237,33 +237,33 @@ public class FlowEntryBuilder { ...@@ -237,33 +237,33 @@ public class FlowEntryBuilder {
237 builder.matchEthType((short) ethType); 237 builder.matchEthType((short) ethType);
238 break; 238 break;
239 case IPV4_DST: 239 case IPV4_DST:
240 - IpPrefix dip; 240 + Ip4Prefix dip;
241 if (match.isPartiallyMasked(MatchField.IPV4_DST)) { 241 if (match.isPartiallyMasked(MatchField.IPV4_DST)) {
242 Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_DST); 242 Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_DST);
243 243
244 - dip = IpPrefix.valueOf( 244 + dip = Ip4Prefix.valueOf(
245 maskedIp.getValue().getInt(), 245 maskedIp.getValue().getInt(),
246 maskedIp.getMask().asCidrMaskLength()); 246 maskedIp.getMask().asCidrMaskLength());
247 } else { 247 } else {
248 - dip = IpPrefix.valueOf( 248 + dip = Ip4Prefix.valueOf(
249 match.get(MatchField.IPV4_DST).getInt(), 249 match.get(MatchField.IPV4_DST).getInt(),
250 - IpPrefix.MAX_INET_MASK_LENGTH); 250 + Ip4Prefix.MAX_MASK_LENGTH);
251 } 251 }
252 252
253 builder.matchIPDst(dip); 253 builder.matchIPDst(dip);
254 break; 254 break;
255 case IPV4_SRC: 255 case IPV4_SRC:
256 - IpPrefix sip; 256 + Ip4Prefix sip;
257 if (match.isPartiallyMasked(MatchField.IPV4_SRC)) { 257 if (match.isPartiallyMasked(MatchField.IPV4_SRC)) {
258 Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_SRC); 258 Masked<IPv4Address> maskedIp = match.getMasked(MatchField.IPV4_SRC);
259 259
260 - sip = IpPrefix.valueOf( 260 + sip = Ip4Prefix.valueOf(
261 maskedIp.getValue().getInt(), 261 maskedIp.getValue().getInt(),
262 maskedIp.getMask().asCidrMaskLength()); 262 maskedIp.getMask().asCidrMaskLength());
263 } else { 263 } else {
264 - sip = IpPrefix.valueOf( 264 + sip = Ip4Prefix.valueOf(
265 match.get(MatchField.IPV4_SRC).getInt(), 265 match.get(MatchField.IPV4_SRC).getInt(),
266 - IpPrefix.MAX_INET_MASK_LENGTH); 266 + Ip4Prefix.MAX_MASK_LENGTH);
267 } 267 }
268 268
269 builder.matchIPSrc(sip); 269 builder.matchIPSrc(sip);
......