[ONOS-3374] Create arp_sha selector to onos
Change-Id: I82f29e24c5fe57d3e23e4e41a6e86c165456e901
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 fcaa5c0..8c51110 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
@@ -358,6 +358,11 @@
}
@Override
+ public Builder matchArpSha(MacAddress addr) {
+ return add(Criteria.matchArpSha(addr));
+ }
+
+ @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 8d2288c..a0b3416 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
@@ -394,6 +394,14 @@
Builder matchArpTha(MacAddress addr);
/**
+ * Matches a arp_eth_src address.
+ *
+ * @param addr a arp_eth_src address
+ * @return a selection builder
+ */
+ Builder matchArpSha(MacAddress addr);
+
+ /**
* Builds an immutable traffic selector.
*
* @return traffic selector
diff --git a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
index bc1a094..c45f160 100644
--- a/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
+++ b/core/api/src/main/java/org/onosproject/net/flow/criteria/Criteria.java
@@ -510,9 +510,9 @@
}
/**
- * Creates a match on IPv4 source field using the specified value.
+ * Creates a match on IPv4 destination field using the specified value.
*
- * @param ip ipv4 source value
+ * @param ip ipv4 destination value
* @return match criterion
*/
public static Criterion matchArpTpa(Ip4Address ip) {
@@ -520,13 +520,23 @@
}
/**
+ * Creates a match on MAC destination field using the specified value.
+ *
+ * @param mac MAC destination value
+ * @return match criterion
+ */
+ public static Criterion matchArpTha(MacAddress mac) {
+ return new ArpHaCriterion(mac, Type.ARP_THA);
+ }
+
+ /**
* Creates a match on MAC source field using the specified value.
*
* @param mac MAC source value
* @return match criterion
*/
- public static Criterion matchArpTha(MacAddress mac) {
- return new ArpHaCriterion(mac, Type.ARP_THA);
+ public static Criterion matchArpSha(MacAddress mac) {
+ return new ArpHaCriterion(mac, Type.ARP_SHA);
}
public static Criterion dummy() {