Removed the old openflowj protocol library

Change-Id: I4fcd0399c6eb0d9089116e365b55505042ded1fc
diff --git a/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java b/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
index 276215b..b312ca0 100644
--- a/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/AllSwitchStatisticsResource.java
@@ -17,21 +17,6 @@
 
 package net.floodlightcontroller.core.web;
 
-import java.lang.Thread.State;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.floodlightcontroller.core.IFloodlightProviderService;
-
-import org.openflow.protocol.OFFeaturesReply;
-import org.openflow.protocol.statistics.OFStatistics;
-import org.openflow.protocol.statistics.OFStatisticsType;
-import org.openflow.util.HexString;
-import org.restlet.resource.Get;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Return switch statistics information for all switches
@@ -39,7 +24,7 @@
  * @author readams
  */
 public class AllSwitchStatisticsResource extends SwitchResourceBase {
-    protected final static Logger log =
+    /*protected final static Logger log =
             LoggerFactory.getLogger(AllSwitchStatisticsResource.class);
 
     @Get("json")
@@ -93,7 +78,7 @@
 
         // Join all the threads after the timeout. Set a hard timeout
         // of 12 seconds for the threads to finish. If the thread has not
-        // finished the switch has not replied yet and therefore we won't 
+        // finished the switch has not replied yet and therefore we won't
         // add the switch's stats to the reply.
         for (int iSleepCycles = 0; iSleepCycles < 12; iSleepCycles++) {
             for (GetConcurrentStatsThread curThread : activeThreads) {
@@ -164,5 +149,5 @@
                 featuresReply = getSwitchFeaturesReply(switchId);
             }
         }
-    }
+    }*/
 }
diff --git a/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java b/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java
index 223da56..1e115ac 100644
--- a/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/ControllerSwitchesResource.java
@@ -24,7 +24,7 @@
 import net.floodlightcontroller.core.IOFSwitch;
 import net.floodlightcontroller.util.FilterIterator;
 
-import org.openflow.util.HexString;
+import org.projectfloodlight.openflow.util.HexString;
 import org.restlet.data.Form;
 import org.restlet.data.Status;
 import org.restlet.resource.Get;
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java b/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
index d5b534d..176e357 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchResourceBase.java
@@ -17,30 +17,7 @@
 
 package net.floodlightcontroller.core.web;
 
-import java.util.Collections;
-import java.util.List;
-import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
-
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.IOFSwitch;
-import net.floodlightcontroller.core.annotations.LogMessageDoc;
-
-import org.openflow.protocol.OFFeaturesReply;
-import org.openflow.protocol.OFMatch;
-import org.openflow.protocol.OFPort;
-import org.openflow.protocol.OFStatisticsRequest;
-import org.openflow.protocol.statistics.OFAggregateStatisticsRequest;
-import org.openflow.protocol.statistics.OFFlowStatisticsRequest;
-import org.openflow.protocol.statistics.OFPortStatisticsRequest;
-import org.openflow.protocol.statistics.OFQueueStatisticsRequest;
-import org.openflow.protocol.statistics.OFStatistics;
-import org.openflow.protocol.statistics.OFStatisticsType;
-import org.openflow.util.HexString;
-import org.restlet.resource.ResourceException;
 import org.restlet.resource.ServerResource;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Base class for server resources related to switches
@@ -49,7 +26,7 @@
  */
 
 public class SwitchResourceBase extends ServerResource {
-    protected final static Logger log = LoggerFactory.getLogger(SwitchResourceBase.class);
+    /*protected final static Logger log = LoggerFactory.getLogger(SwitchResourceBase.class);
 
     public enum REQUESTTYPE {
         OFSTATS,
@@ -118,12 +95,12 @@
             }
             req.setLengthU(requestLength);
             // XXX S fix when we fix stats
-            /*try {
+            try {
                 future = sw.getStatistics(req);
                 values = future.get(10, TimeUnit.SECONDS);
             } catch (Exception e) {
                 log.error("Failure retrieving statistics from switch " + sw, e);
-            }*/
+            }
         }
         return values;
     }
@@ -141,13 +118,13 @@
         Future<OFFeaturesReply> future;
         OFFeaturesReply featuresReply = null;
         if (sw != null) {
-		// XXX S fix when we fix stats
-            /*try {
+        	// XXX S fix when we fix stats
+            try {
                 future = sw.getFeaturesReplyFromSwitch();
                 featuresReply = future.get(10, TimeUnit.SECONDS);
             } catch (Exception e) {
                 log.error("Failure getting features reply from switch" + sw, e);
-            }*/
+            }
         }
 
         return featuresReply;
@@ -155,6 +132,6 @@
 
     protected OFFeaturesReply getSwitchFeaturesReply(String switchId) {
         return getSwitchFeaturesReply(HexString.toLong(switchId));
-    }
+    }*/
 
 }
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java b/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
index d598005..f85b75e 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchRoleResource.java
@@ -5,7 +5,7 @@
 import net.floodlightcontroller.core.IFloodlightProviderService;
 import net.floodlightcontroller.core.IOFSwitch;
 
-import org.openflow.util.HexString;
+import org.projectfloodlight.openflow.util.HexString;
 import org.restlet.resource.Get;
 import org.restlet.resource.ServerResource;
 import org.slf4j.Logger;
diff --git a/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java b/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
index 468a50e..cb8860e 100644
--- a/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
+++ b/src/main/java/net/floodlightcontroller/core/web/SwitchStatisticsResource.java
@@ -17,13 +17,6 @@
 
 package net.floodlightcontroller.core.web;
 
-import java.util.HashMap;
-import java.util.Map;
-
-import org.openflow.protocol.statistics.OFStatisticsType;
-import org.restlet.resource.Get;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
 
 /**
  * Return switch statistics information for specific switches
@@ -31,7 +24,7 @@
  * @author readams
  */
 public class SwitchStatisticsResource extends SwitchResourceBase {
-    protected final static Logger log =
+    /*protected final static Logger log =
             LoggerFactory.getLogger(SwitchStatisticsResource.class);
 
     @Get("json")
@@ -60,5 +53,5 @@
 
         result.put(switchId, values);
         return result;
-    }
+    }*/
 }
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java
index 35f810b..674e1e0 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/ByteArrayMACSerializer.java
@@ -23,7 +23,7 @@
 import org.codehaus.jackson.JsonProcessingException;
 import org.codehaus.jackson.map.JsonSerializer;
 import org.codehaus.jackson.map.SerializerProvider;
-import org.openflow.util.HexString;
+import org.projectfloodlight.openflow.util.HexString;
 
 /**
  * Serialize a MAC as colon-separated hexadecimal
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java
index 304e835..a85a10d 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/DPIDSerializer.java
@@ -23,7 +23,7 @@
 import org.codehaus.jackson.JsonProcessingException;
 import org.codehaus.jackson.map.JsonSerializer;
 import org.codehaus.jackson.map.SerializerProvider;
-import org.openflow.util.HexString;
+import org.projectfloodlight.openflow.util.HexString;
 
 /**
  * Serialize a DPID as colon-separated hexadecimal
diff --git a/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java b/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java
index eacf515..8f86a4b 100644
--- a/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java
+++ b/src/main/java/net/floodlightcontroller/core/web/serializers/MACSerializer.java
@@ -23,7 +23,7 @@
 import org.codehaus.jackson.JsonProcessingException;
 import org.codehaus.jackson.map.JsonSerializer;
 import org.codehaus.jackson.map.SerializerProvider;
-import org.openflow.util.HexString;
+import org.projectfloodlight.openflow.util.HexString;
 
 /**
  * Serialize a MAC as colon-separated hexadecimal
diff --git a/src/main/java/net/floodlightcontroller/debugevent/Event.java b/src/main/java/net/floodlightcontroller/debugevent/Event.java
index b3e284e..229902f 100644
--- a/src/main/java/net/floodlightcontroller/debugevent/Event.java
+++ b/src/main/java/net/floodlightcontroller/debugevent/Event.java
@@ -6,13 +6,14 @@
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
+import java.util.Set;
 
 import net.floodlightcontroller.debugevent.IDebugEventService.EventColumn;
 import net.onrc.onos.core.packet.IPv4;
 import net.onrc.onos.core.util.SwitchPort;
 
-import org.openflow.protocol.OFFlowMod;
-import org.openflow.util.HexString;
+import org.projectfloodlight.openflow.protocol.OFFlowModFlags;
+import org.projectfloodlight.openflow.util.HexString;
 
 public class Event {
     long timestamp;
@@ -117,19 +118,20 @@
                         retMap.put(ec.name(), net.onrc.onos.core.packet.IPv4.fromIPv4Address((Integer) obj));
                         break;
                     case FLOW_MOD_FLAGS:
-                        int flags = (Integer)obj;
+                        @SuppressWarnings("unchecked")
+                        Set<OFFlowModFlags> flags = (Set<OFFlowModFlags>) obj;
                         StringBuilder builder = new StringBuilder();
-                        if (flags == 0) {
+                        if (flags.isEmpty()) {
                             builder.append("None");
                         }
                         else {
-                            if ((flags & OFFlowMod.OFPFF_SEND_FLOW_REM) != 0) {
+                            if (flags.contains(OFFlowModFlags.SEND_FLOW_REM)) {
                                 builder.append("SEND_FLOW_REM ");
                             }
-                            if ((flags & OFFlowMod.OFPFF_CHECK_OVERLAP) != 0) {
+                            if (flags.contains(OFFlowModFlags.CHECK_OVERLAP)) {
                                 builder.append("CHECK_OVERLAP ");
                             }
-                            if ((flags & OFFlowMod.OFPFF_EMERG) != 0) {
+                            if (flags.contains(OFFlowModFlags.EMERG)) {
                                 builder.append("EMERG ");
                             }
                         }
diff --git a/src/main/java/net/floodlightcontroller/util/MACAddress.java b/src/main/java/net/floodlightcontroller/util/MACAddress.java
index f3ac52b..7f0e9f5 100644
--- a/src/main/java/net/floodlightcontroller/util/MACAddress.java
+++ b/src/main/java/net/floodlightcontroller/util/MACAddress.java
@@ -8,7 +8,7 @@
 
 import org.codehaus.jackson.map.annotate.JsonDeserialize;
 import org.codehaus.jackson.map.annotate.JsonSerialize;
-import org.openflow.util.HexString;
+import org.projectfloodlight.openflow.util.HexString;
 
 /**
  * The class representing MAC address.
diff --git a/src/main/java/net/floodlightcontroller/util/OFMessageDamper.java b/src/main/java/net/floodlightcontroller/util/OFMessageDamper.java
deleted file mode 100644
index 90bee76..0000000
--- a/src/main/java/net/floodlightcontroller/util/OFMessageDamper.java
+++ /dev/null
@@ -1,177 +0,0 @@
-/*
- * Copyright Big Switch Networks 2012
- */
-
-package net.floodlightcontroller.util;
-
-import java.io.IOException;
-import java.util.EnumSet;
-import java.util.Iterator;
-import java.util.Set;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-import net.floodlightcontroller.core.FloodlightContext;
-import net.floodlightcontroller.core.IOFSwitch;
-
-import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFType;
-
-/**
- * Dampens OFMessages sent to an OF switch. A message is only written to
- * a switch if the same message (as defined by .equals()) has not been written
- * in the last n milliseconds. Timer granularity is based on TimedCache
- *
- * @author gregor
- */
-public class OFMessageDamper {
-    /**
-     * An entry in the TimedCache. A cache entry consists of the sent message
-     * as well as the switch to which the message was sent.
-     * <p/>
-     * NOTE: We currently use the full OFMessage object. To save space, we
-     * could use a cryptographic hash (e.g., SHA-1). However, this would
-     * obviously be more time-consuming....
-     * <p/>
-     * We also store a reference to the actual IOFSwitch object and /not/
-     * the switch DPID. This way we are guarnteed to not dampen messages if
-     * a switch disconnects and then reconnects.
-     *
-     * @author gregor
-     */
-    protected static class DamperEntry {
-        OFMessage msg;
-        IOFSwitch sw;
-
-        public DamperEntry(OFMessage msg, IOFSwitch sw) {
-            super();
-            this.msg = msg;
-            this.sw = sw;
-        }
-
-        /* (non-Javadoc)
-         * @see java.lang.Object#hashCode()
-         */
-        @Override
-        public int hashCode() {
-            final int prime = 31;
-            int result = 1;
-            result = prime * result + ((msg == null) ? 0 : msg.hashCode());
-            result = prime * result + ((sw == null) ? 0 : sw.hashCode());
-            return result;
-        }
-
-        /* (non-Javadoc)
-         * @see java.lang.Object#equals(java.lang.Object)
-         */
-        @Override
-        public boolean equals(Object obj) {
-            if (this == obj) return true;
-            if (obj == null) return false;
-            if (getClass() != obj.getClass()) return false;
-            DamperEntry other = (DamperEntry) obj;
-            if (msg == null) {
-                if (other.msg != null) return false;
-            } else if (!msg.equals(other.msg)) return false;
-            if (sw == null) {
-                if (other.sw != null) return false;
-            } else if (!sw.equals(other.sw)) return false;
-            return true;
-        }
-
-
-    }
-
-    TimedCache<DamperEntry> cache;
-    EnumSet<OFType> msgTypesToCache;
-    // executor for invalidate task
-    private static ExecutorService executor = Executors.newFixedThreadPool(1);
-
-    /**
-     * @param capacity      the maximum number of messages that should be
-     *                      kept
-     * @param typesToDampen The set of OFMessageTypes that should be
-     *                      dampened by this instance. Other types will be passed through
-     * @param timeout       The dampening timeout. A message will only be
-     *                      written if the last write for the an equal message more than
-     *                      timeout ms ago.
-     */
-    public OFMessageDamper(int capacity,
-                           Set<OFType> typesToDampen,
-                           int timeout) {
-        cache = new TimedCache<DamperEntry>(capacity, timeout);
-        msgTypesToCache = EnumSet.copyOf(typesToDampen);
-    }
-
-    /**
-     * write the messag to the switch according to our dampening settings
-     *
-     * @param sw
-     * @param msg
-     * @param cntx
-     * @return true if the message was written to the switch, false if
-     * the message was dampened.
-     * @throws IOException
-     */
-    public boolean write(IOFSwitch sw, OFMessage msg, FloodlightContext cntx)
-            throws IOException {
-        return write(sw, msg, cntx, false);
-    }
-
-    /**
-     * write the messag to the switch according to our dampening settings
-     *
-     * @param sw
-     * @param msg
-     * @param cntx
-     * @param flush true to flush the packet immidiately
-     * @return true if the message was written to the switch, false if
-     * the message was dampened.
-     * @throws IOException
-     */
-    public boolean write(IOFSwitch sw, OFMessage msg,
-                         FloodlightContext cntx, boolean flush)
-            throws IOException {
-        if (!msgTypesToCache.contains(msg.getType())) {
-            // XXX S commenting out old message writes
-		//sw.write(msg, cntx);
-            if (flush) {
-                sw.flush();
-            }
-            return true;
-        }
-
-        DamperEntry entry = new DamperEntry(msg, sw);
-        if (cache.update(entry)) {
-            // entry exists in cache. Dampening.
-            return false;
-        } else {
-            // XXX S commenting out old message writes
-		// sw.write(msg, cntx);
-            if (flush) {
-                sw.flush();
-            }
-            return true;
-        }
-    }
-
-    /**
-     * Invalidates all the damper cache entries for the specified switch.
-     *
-     * @param sw switch connection to invalidate
-     */
-    public void invalidate(final IOFSwitch sw) {
-        executor.submit(new Runnable() {
-            @Override
-            public void run() {
-                Iterator<DamperEntry> it = cache.getCachedEntries().iterator();
-                while (it.hasNext()) {
-                    DamperEntry entry = it.next();
-                    if (entry.sw == sw) {
-                        it.remove();
-                    }
-                }
-            }
-        });
-   }
-}