[ONOS-3485] Create arp_op selector and add operation to provifer of
openflow to onos
Change-Id: I4dd0a9d7eb66092d7633e288a1fc94ad66eb4810
diff --git a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
index a842d60..8b2916a 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/DefaultTrafficSelector.java
@@ -374,6 +374,11 @@
}
@Override
+ public Builder matchArpOp(int arpOp) {
+ return add(Criteria.matchArpOp(arpOp));
+ }
+
+ @Override
public TrafficSelector build() {
return new DefaultTrafficSelector(ImmutableSet.copyOf(selector.values()));
}
diff --git a/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java b/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
index 9fe88d5..b92281f 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/TrafficSelector.java
@@ -419,6 +419,14 @@
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
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
index 7982e39..d4494f1 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowEntryBuilder.java
@@ -708,6 +708,10 @@
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 @@
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);
diff --git a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
index 0dd6b89..2a8d201 100644
--- a/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
+++ b/providers/openflow/flow/src/main/java/org/onosproject/provider/of/flow/impl/FlowModBuilder.java
@@ -25,6 +25,7 @@
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.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 @@
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 @@
mBuilder.setExact(MatchField.ARP_TPA,
IPv4Address.of(arpPaCriterion.ip().toInt()));
break;
- case ARP_OP:
case MPLS_TC:
case PBB_ISID:
default: