Renaming a couple of match-action matches
Adding an interface for OF13 switches
Change-Id: Id3cff30fb61bc453fbf4bf50de8f561444f28a8a
diff --git a/src/main/java/net/floodlightcontroller/core/IOF13Switch.java b/src/main/java/net/floodlightcontroller/core/IOF13Switch.java
new file mode 100644
index 0000000..425c6a9
--- /dev/null
+++ b/src/main/java/net/floodlightcontroller/core/IOF13Switch.java
@@ -0,0 +1,101 @@
+package net.floodlightcontroller.core;
+
+import java.util.Collection;
+import java.util.HashSet;
+import java.util.Set;
+
+import net.onrc.onos.core.matchaction.MatchActionOperationEntry;
+import net.onrc.onos.core.util.Dpid;
+
+import com.google.common.primitives.Longs;
+
+
+public interface IOF13Switch extends IOFSwitch {
+
+ // **************************
+ // Flow related
+ // **************************
+
+ /**
+ * Pushes a single flow to the switch as described by the match-action
+ * operation and match-action definition, and subject to the TTP supported
+ * by a switch implementing this interface. It is up to the implementation
+ * to translate the 'matchActionOp' into a match-instruction with actions,
+ * as expected by OF 1.3 switches.
+ *
+ * @param matchActionOp
+ */
+ public void pushFlow(MatchActionOperationEntry matchActionOp);
+
+ /**
+ * Pushes a collection of flows to the switch.
+ *
+ * @param matchActionOps
+ */
+ public void pushFlows(Collection<MatchActionOperationEntry> matchActionOps);
+
+ // ****************************
+ // Group related
+ // ****************************
+
+ /**
+ * Representation of a set of neighbor switch dpids. Meant to be used as a
+ * lookup-key in a hash-map to retrieve an ECMP-group that hashes packets to
+ * a set of ports connecting to the neighbors in this set.
+ */
+ public class NeighborSet {
+ Set<Dpid> dpids;
+
+ /**
+ * Constructor
+ *
+ * @param dpids A variable number of Dpids represention neighbor
+ * switches
+ */
+ public NeighborSet(Dpid... dpids) {
+ this.dpids = new HashSet<Dpid>();
+ for (Dpid d : dpids) {
+ this.dpids.add(d);
+ }
+ }
+
+ public void addDpid(Dpid d) {
+ dpids.add(d);
+ }
+
+ @Override
+ public boolean equals(Object o) {
+ if (!(o instanceof NeighborSet)) {
+ return false;
+ }
+ NeighborSet that = (NeighborSet) o;
+ return this.dpids.equals(that.dpids);
+ }
+
+ @Override
+ public int hashCode() {
+ int result = 17;
+ for (Dpid d : dpids) {
+ result = 31 * result + Longs.hashCode(d.value());
+ }
+ return result;
+ }
+
+ @Override
+ public String toString() {
+ return " Sw: {} Neighbors: " + dpids;
+ }
+ }
+
+ /**
+ * Get the ECMP group-id for the ECMP group in this switch that includes
+ * ports that connect to the neighbor-switches included in the NeighborSet
+ * 'ns'
+ *
+ * @param ns the set of Neighbor Dpids
+ * @return the ecmp group id, or -1 if no such group exists
+ */
+ public int getEcmpGroupId(NeighborSet ns);
+
+
+}