BitOhenry
Committed by Gerrit Code Review

[ONOS-3485] Create arp_op selector and add operation to provifer of

openflow to onos

Change-Id: I4dd0a9d7eb66092d7633e288a1fc94ad66eb4810
......@@ -374,6 +374,11 @@ public final class DefaultTrafficSelector implements TrafficSelector {
}
@Override
public Builder matchArpOp(int arpOp) {
return add(Criteria.matchArpOp(arpOp));
}
@Override
public TrafficSelector build() {
return new DefaultTrafficSelector(ImmutableSet.copyOf(selector.values()));
}
......
......@@ -419,6 +419,14 @@ public interface TrafficSelector {
Builder matchArpSha(MacAddress addr);
/**
* Matches a arp operation type.
*
* @param arpOp a arp operation type
* @return a selection builder
*/
Builder matchArpOp(int arpOp);
/**
* Builds an immutable traffic selector.
*
* @return traffic selector
......
......@@ -708,6 +708,10 @@ public class FlowEntryBuilder {
long tunnelId = match.get(MatchField.TUNNEL_ID).getValue();
builder.matchTunnelId(tunnelId);
break;
case ARP_OP:
int arpOp = match.get(MatchField.ARP_OP).getOpcode();
builder.matchArpOp(arpOp);
break;
case ARP_SHA:
mac = MacAddress.valueOf(match.get(MatchField.ARP_SHA).getLong());
builder.matchArpSha(mac);
......@@ -724,7 +728,6 @@ public class FlowEntryBuilder {
ip = Ip4Address.valueOf(match.get(MatchField.ARP_TPA).getInt());
builder.matchArpTpa(ip);
break;
case ARP_OP:
case MPLS_TC:
default:
log.warn("Match type {} not yet implemented.", field.id);
......
......@@ -25,6 +25,7 @@ import org.onosproject.net.driver.DriverService;
import org.onosproject.net.flow.FlowRule;
import org.onosproject.net.flow.TrafficSelector;
import org.onosproject.net.flow.criteria.ArpHaCriterion;
import org.onosproject.net.flow.criteria.ArpOpCriterion;
import org.onosproject.net.flow.criteria.ArpPaCriterion;
import org.onosproject.net.flow.criteria.Criterion;
import org.onosproject.net.flow.criteria.EthCriterion;
......@@ -59,6 +60,7 @@ import org.projectfloodlight.openflow.protocol.OFFlowDelete;
import org.projectfloodlight.openflow.protocol.OFFlowMod;
import org.projectfloodlight.openflow.protocol.match.Match;
import org.projectfloodlight.openflow.protocol.match.MatchField;
import org.projectfloodlight.openflow.types.ArpOpcode;
import org.projectfloodlight.openflow.types.CircuitSignalID;
import org.projectfloodlight.openflow.types.EthType;
import org.projectfloodlight.openflow.types.ICMPv4Code;
......@@ -419,6 +421,11 @@ public abstract class FlowModBuilder {
mplsBos.mplsBos() ? OFBooleanValue.TRUE
: OFBooleanValue.FALSE);
break;
case ARP_OP:
ArpOpCriterion arpOp = (ArpOpCriterion) c;
mBuilder.setExact(MatchField.ARP_OP,
ArpOpcode.of(arpOp.arpOp()));
break;
case ARP_SHA:
arpHaCriterion = (ArpHaCriterion) c;
mBuilder.setExact(MatchField.ARP_SHA,
......@@ -439,7 +446,6 @@ public abstract class FlowModBuilder {
mBuilder.setExact(MatchField.ARP_TPA,
IPv4Address.of(arpPaCriterion.ip().toInt()));
break;
case ARP_OP:
case MPLS_TC:
case PBB_ISID:
default:
......