Added support for matching TCP ports and fixed flow stat IP address matching
Showing
2 changed files
with
19 additions
and
6 deletions
... | @@ -223,7 +223,7 @@ public class FlowEntryBuilder { | ... | @@ -223,7 +223,7 @@ public class FlowEntryBuilder { |
223 | if (di.isCidrMask()) { | 223 | if (di.isCidrMask()) { |
224 | dip = IpPrefix.valueOf(di.getInt(), di.asCidrMaskLength()); | 224 | dip = IpPrefix.valueOf(di.getInt(), di.asCidrMaskLength()); |
225 | } else { | 225 | } else { |
226 | - dip = IpPrefix.valueOf(di.getInt()); | 226 | + dip = IpPrefix.valueOf(di.getInt(), IpPrefix.MAX_INET_MASK); |
227 | } | 227 | } |
228 | builder.matchIPDst(dip); | 228 | builder.matchIPDst(dip); |
229 | break; | 229 | break; |
... | @@ -233,7 +233,7 @@ public class FlowEntryBuilder { | ... | @@ -233,7 +233,7 @@ public class FlowEntryBuilder { |
233 | if (si.isCidrMask()) { | 233 | if (si.isCidrMask()) { |
234 | sip = IpPrefix.valueOf(si.getInt(), si.asCidrMaskLength()); | 234 | sip = IpPrefix.valueOf(si.getInt(), si.asCidrMaskLength()); |
235 | } else { | 235 | } else { |
236 | - sip = IpPrefix.valueOf(si.getInt()); | 236 | + sip = IpPrefix.valueOf(si.getInt(), IpPrefix.MAX_INET_MASK); |
237 | } | 237 | } |
238 | builder.matchIPSrc(sip); | 238 | builder.matchIPSrc(sip); |
239 | break; | 239 | break; |
... | @@ -249,6 +249,12 @@ public class FlowEntryBuilder { | ... | @@ -249,6 +249,12 @@ public class FlowEntryBuilder { |
249 | VlanId vlanId = VlanId.vlanId(match.get(MatchField.VLAN_VID).getVlan()); | 249 | VlanId vlanId = VlanId.vlanId(match.get(MatchField.VLAN_VID).getVlan()); |
250 | builder.matchVlanId(vlanId); | 250 | builder.matchVlanId(vlanId); |
251 | break; | 251 | break; |
252 | + case TCP_DST: | ||
253 | + builder.matchTcpDst((short) match.get(MatchField.TCP_DST).getPort()); | ||
254 | + break; | ||
255 | + case TCP_SRC: | ||
256 | + builder.matchTcpSrc((short) match.get(MatchField.TCP_SRC).getPort()); | ||
257 | + break; | ||
252 | case ARP_OP: | 258 | case ARP_OP: |
253 | case ARP_SHA: | 259 | case ARP_SHA: |
254 | case ARP_SPA: | 260 | case ARP_SPA: |
... | @@ -272,8 +278,6 @@ public class FlowEntryBuilder { | ... | @@ -272,8 +278,6 @@ public class FlowEntryBuilder { |
272 | case MPLS_TC: | 278 | case MPLS_TC: |
273 | case SCTP_DST: | 279 | case SCTP_DST: |
274 | case SCTP_SRC: | 280 | case SCTP_SRC: |
275 | - case TCP_DST: | ||
276 | - case TCP_SRC: | ||
277 | case TUNNEL_ID: | 281 | case TUNNEL_ID: |
278 | case UDP_DST: | 282 | case UDP_DST: |
279 | case UDP_SRC: | 283 | case UDP_SRC: | ... | ... |
... | @@ -15,6 +15,7 @@ import org.onlab.onos.net.flow.criteria.Criteria.EthTypeCriterion; | ... | @@ -15,6 +15,7 @@ import org.onlab.onos.net.flow.criteria.Criteria.EthTypeCriterion; |
15 | import org.onlab.onos.net.flow.criteria.Criteria.IPCriterion; | 15 | import org.onlab.onos.net.flow.criteria.Criteria.IPCriterion; |
16 | import org.onlab.onos.net.flow.criteria.Criteria.IPProtocolCriterion; | 16 | import org.onlab.onos.net.flow.criteria.Criteria.IPProtocolCriterion; |
17 | import org.onlab.onos.net.flow.criteria.Criteria.PortCriterion; | 17 | import org.onlab.onos.net.flow.criteria.Criteria.PortCriterion; |
18 | +import org.onlab.onos.net.flow.criteria.Criteria.TcpPortCriterion; | ||
18 | import org.onlab.onos.net.flow.criteria.Criteria.VlanIdCriterion; | 19 | import org.onlab.onos.net.flow.criteria.Criteria.VlanIdCriterion; |
19 | import org.onlab.onos.net.flow.criteria.Criteria.VlanPcpCriterion; | 20 | import org.onlab.onos.net.flow.criteria.Criteria.VlanPcpCriterion; |
20 | import org.onlab.onos.net.flow.criteria.Criterion; | 21 | import org.onlab.onos.net.flow.criteria.Criterion; |
... | @@ -42,6 +43,7 @@ import org.projectfloodlight.openflow.types.Masked; | ... | @@ -42,6 +43,7 @@ import org.projectfloodlight.openflow.types.Masked; |
42 | import org.projectfloodlight.openflow.types.OFBufferId; | 43 | import org.projectfloodlight.openflow.types.OFBufferId; |
43 | import org.projectfloodlight.openflow.types.OFPort; | 44 | import org.projectfloodlight.openflow.types.OFPort; |
44 | import org.projectfloodlight.openflow.types.OFVlanVidMatch; | 45 | import org.projectfloodlight.openflow.types.OFVlanVidMatch; |
46 | +import org.projectfloodlight.openflow.types.TransportPort; | ||
45 | import org.projectfloodlight.openflow.types.U64; | 47 | import org.projectfloodlight.openflow.types.U64; |
46 | import org.projectfloodlight.openflow.types.VlanPcp; | 48 | import org.projectfloodlight.openflow.types.VlanPcp; |
47 | import org.projectfloodlight.openflow.types.VlanVid; | 49 | import org.projectfloodlight.openflow.types.VlanVid; |
... | @@ -199,6 +201,7 @@ public class FlowModBuilder { | ... | @@ -199,6 +201,7 @@ public class FlowModBuilder { |
199 | Match.Builder mBuilder = factory.buildMatch(); | 201 | Match.Builder mBuilder = factory.buildMatch(); |
200 | EthCriterion eth; | 202 | EthCriterion eth; |
201 | IPCriterion ip; | 203 | IPCriterion ip; |
204 | + TcpPortCriterion tp; | ||
202 | for (Criterion c : selector.criteria()) { | 205 | for (Criterion c : selector.criteria()) { |
203 | switch (c.type()) { | 206 | switch (c.type()) { |
204 | case IN_PORT: | 207 | case IN_PORT: |
... | @@ -250,6 +253,14 @@ public class FlowModBuilder { | ... | @@ -250,6 +253,14 @@ public class FlowModBuilder { |
250 | mBuilder.setExact(MatchField.VLAN_VID, | 253 | mBuilder.setExact(MatchField.VLAN_VID, |
251 | OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vid.vlanId().toShort()))); | 254 | OFVlanVidMatch.ofVlanVid(VlanVid.ofVlan(vid.vlanId().toShort()))); |
252 | break; | 255 | break; |
256 | + case TCP_DST: | ||
257 | + tp = (TcpPortCriterion) c; | ||
258 | + mBuilder.setExact(MatchField.TCP_DST, TransportPort.of(tp.tcpPort())); | ||
259 | + break; | ||
260 | + case TCP_SRC: | ||
261 | + tp = (TcpPortCriterion) c; | ||
262 | + mBuilder.setExact(MatchField.TCP_SRC, TransportPort.of(tp.tcpPort())); | ||
263 | + break; | ||
253 | case ARP_OP: | 264 | case ARP_OP: |
254 | case ARP_SHA: | 265 | case ARP_SHA: |
255 | case ARP_SPA: | 266 | case ARP_SPA: |
... | @@ -276,8 +287,6 @@ public class FlowModBuilder { | ... | @@ -276,8 +287,6 @@ public class FlowModBuilder { |
276 | case PBB_ISID: | 287 | case PBB_ISID: |
277 | case SCTP_DST: | 288 | case SCTP_DST: |
278 | case SCTP_SRC: | 289 | case SCTP_SRC: |
279 | - case TCP_DST: | ||
280 | - case TCP_SRC: | ||
281 | case TUNNEL_ID: | 290 | case TUNNEL_ID: |
282 | case UDP_DST: | 291 | case UDP_DST: |
283 | case UDP_SRC: | 292 | case UDP_SRC: | ... | ... |
-
Please register or login to post a comment