Committed by
Gerrit Code Review
[ONOS-3485] Create arp_op selector and add operation to provifer of
openflow to onos Change-Id: I4dd0a9d7eb66092d7633e288a1fc94ad66eb4810
Showing
4 changed files
with
24 additions
and
2 deletions
... | @@ -374,6 +374,11 @@ public final class DefaultTrafficSelector implements TrafficSelector { | ... | @@ -374,6 +374,11 @@ public final class DefaultTrafficSelector implements TrafficSelector { |
374 | } | 374 | } |
375 | 375 | ||
376 | @Override | 376 | @Override |
377 | + public Builder matchArpOp(int arpOp) { | ||
378 | + return add(Criteria.matchArpOp(arpOp)); | ||
379 | + } | ||
380 | + | ||
381 | + @Override | ||
377 | public TrafficSelector build() { | 382 | public TrafficSelector build() { |
378 | return new DefaultTrafficSelector(ImmutableSet.copyOf(selector.values())); | 383 | return new DefaultTrafficSelector(ImmutableSet.copyOf(selector.values())); |
379 | } | 384 | } | ... | ... |
... | @@ -419,6 +419,14 @@ public interface TrafficSelector { | ... | @@ -419,6 +419,14 @@ public interface TrafficSelector { |
419 | Builder matchArpSha(MacAddress addr); | 419 | Builder matchArpSha(MacAddress addr); |
420 | 420 | ||
421 | /** | 421 | /** |
422 | + * Matches a arp operation type. | ||
423 | + * | ||
424 | + * @param arpOp a arp operation type | ||
425 | + * @return a selection builder | ||
426 | + */ | ||
427 | + Builder matchArpOp(int arpOp); | ||
428 | + | ||
429 | + /** | ||
422 | * Builds an immutable traffic selector. | 430 | * Builds an immutable traffic selector. |
423 | * | 431 | * |
424 | * @return traffic selector | 432 | * @return traffic selector | ... | ... |
... | @@ -708,6 +708,10 @@ public class FlowEntryBuilder { | ... | @@ -708,6 +708,10 @@ public class FlowEntryBuilder { |
708 | long tunnelId = match.get(MatchField.TUNNEL_ID).getValue(); | 708 | long tunnelId = match.get(MatchField.TUNNEL_ID).getValue(); |
709 | builder.matchTunnelId(tunnelId); | 709 | builder.matchTunnelId(tunnelId); |
710 | break; | 710 | break; |
711 | + case ARP_OP: | ||
712 | + int arpOp = match.get(MatchField.ARP_OP).getOpcode(); | ||
713 | + builder.matchArpOp(arpOp); | ||
714 | + break; | ||
711 | case ARP_SHA: | 715 | case ARP_SHA: |
712 | mac = MacAddress.valueOf(match.get(MatchField.ARP_SHA).getLong()); | 716 | mac = MacAddress.valueOf(match.get(MatchField.ARP_SHA).getLong()); |
713 | builder.matchArpSha(mac); | 717 | builder.matchArpSha(mac); |
... | @@ -724,7 +728,6 @@ public class FlowEntryBuilder { | ... | @@ -724,7 +728,6 @@ public class FlowEntryBuilder { |
724 | ip = Ip4Address.valueOf(match.get(MatchField.ARP_TPA).getInt()); | 728 | ip = Ip4Address.valueOf(match.get(MatchField.ARP_TPA).getInt()); |
725 | builder.matchArpTpa(ip); | 729 | builder.matchArpTpa(ip); |
726 | break; | 730 | break; |
727 | - case ARP_OP: | ||
728 | case MPLS_TC: | 731 | case MPLS_TC: |
729 | default: | 732 | default: |
730 | log.warn("Match type {} not yet implemented.", field.id); | 733 | log.warn("Match type {} not yet implemented.", field.id); | ... | ... |
... | @@ -25,6 +25,7 @@ import org.onosproject.net.driver.DriverService; | ... | @@ -25,6 +25,7 @@ import org.onosproject.net.driver.DriverService; |
25 | import org.onosproject.net.flow.FlowRule; | 25 | import org.onosproject.net.flow.FlowRule; |
26 | import org.onosproject.net.flow.TrafficSelector; | 26 | import org.onosproject.net.flow.TrafficSelector; |
27 | import org.onosproject.net.flow.criteria.ArpHaCriterion; | 27 | import org.onosproject.net.flow.criteria.ArpHaCriterion; |
28 | +import org.onosproject.net.flow.criteria.ArpOpCriterion; | ||
28 | import org.onosproject.net.flow.criteria.ArpPaCriterion; | 29 | import org.onosproject.net.flow.criteria.ArpPaCriterion; |
29 | import org.onosproject.net.flow.criteria.Criterion; | 30 | import org.onosproject.net.flow.criteria.Criterion; |
30 | import org.onosproject.net.flow.criteria.EthCriterion; | 31 | import org.onosproject.net.flow.criteria.EthCriterion; |
... | @@ -59,6 +60,7 @@ import org.projectfloodlight.openflow.protocol.OFFlowDelete; | ... | @@ -59,6 +60,7 @@ import org.projectfloodlight.openflow.protocol.OFFlowDelete; |
59 | import org.projectfloodlight.openflow.protocol.OFFlowMod; | 60 | import org.projectfloodlight.openflow.protocol.OFFlowMod; |
60 | import org.projectfloodlight.openflow.protocol.match.Match; | 61 | import org.projectfloodlight.openflow.protocol.match.Match; |
61 | import org.projectfloodlight.openflow.protocol.match.MatchField; | 62 | import org.projectfloodlight.openflow.protocol.match.MatchField; |
63 | +import org.projectfloodlight.openflow.types.ArpOpcode; | ||
62 | import org.projectfloodlight.openflow.types.CircuitSignalID; | 64 | import org.projectfloodlight.openflow.types.CircuitSignalID; |
63 | import org.projectfloodlight.openflow.types.EthType; | 65 | import org.projectfloodlight.openflow.types.EthType; |
64 | import org.projectfloodlight.openflow.types.ICMPv4Code; | 66 | import org.projectfloodlight.openflow.types.ICMPv4Code; |
... | @@ -419,6 +421,11 @@ public abstract class FlowModBuilder { | ... | @@ -419,6 +421,11 @@ public abstract class FlowModBuilder { |
419 | mplsBos.mplsBos() ? OFBooleanValue.TRUE | 421 | mplsBos.mplsBos() ? OFBooleanValue.TRUE |
420 | : OFBooleanValue.FALSE); | 422 | : OFBooleanValue.FALSE); |
421 | break; | 423 | break; |
424 | + case ARP_OP: | ||
425 | + ArpOpCriterion arpOp = (ArpOpCriterion) c; | ||
426 | + mBuilder.setExact(MatchField.ARP_OP, | ||
427 | + ArpOpcode.of(arpOp.arpOp())); | ||
428 | + break; | ||
422 | case ARP_SHA: | 429 | case ARP_SHA: |
423 | arpHaCriterion = (ArpHaCriterion) c; | 430 | arpHaCriterion = (ArpHaCriterion) c; |
424 | mBuilder.setExact(MatchField.ARP_SHA, | 431 | mBuilder.setExact(MatchField.ARP_SHA, |
... | @@ -439,7 +446,6 @@ public abstract class FlowModBuilder { | ... | @@ -439,7 +446,6 @@ public abstract class FlowModBuilder { |
439 | mBuilder.setExact(MatchField.ARP_TPA, | 446 | mBuilder.setExact(MatchField.ARP_TPA, |
440 | IPv4Address.of(arpPaCriterion.ip().toInt())); | 447 | IPv4Address.of(arpPaCriterion.ip().toInt())); |
441 | break; | 448 | break; |
442 | - case ARP_OP: | ||
443 | case MPLS_TC: | 449 | case MPLS_TC: |
444 | case PBB_ISID: | 450 | case PBB_ISID: |
445 | default: | 451 | default: | ... | ... |
-
Please register or login to post a comment