Removed the old openflowj protocol library
Change-Id: I4fcd0399c6eb0d9089116e365b55505042ded1fc
diff --git a/src/main/java/net/onrc/onos/apps/sdnip/Configuration.java b/src/main/java/net/onrc/onos/apps/sdnip/Configuration.java
index 28f195c..b834603 100644
--- a/src/main/java/net/onrc/onos/apps/sdnip/Configuration.java
+++ b/src/main/java/net/onrc/onos/apps/sdnip/Configuration.java
@@ -6,7 +6,7 @@
import net.floodlightcontroller.util.MACAddress;
import org.codehaus.jackson.annotate.JsonProperty;
-import org.openflow.util.HexString;
+import org.projectfloodlight.openflow.util.HexString;
/**
* Contains the configuration data for SDN-IP that has been read from a
diff --git a/src/main/java/net/onrc/onos/apps/sdnip/FlowCache.java b/src/main/java/net/onrc/onos/apps/sdnip/FlowCache.java
deleted file mode 100644
index dc9182c..0000000
--- a/src/main/java/net/onrc/onos/apps/sdnip/FlowCache.java
+++ /dev/null
@@ -1,166 +0,0 @@
-package net.onrc.onos.apps.sdnip;
-
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.Comparator;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-import net.floodlightcontroller.core.IFloodlightProviderService;
-import net.floodlightcontroller.core.IOFSwitch;
-
-import org.openflow.protocol.OFFlowMod;
-import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFPort;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class FlowCache {
- private static final Logger log = LoggerFactory.getLogger(FlowCache.class);
-
- private final IFloodlightProviderService floodlightProvider;
-
- private final Map<Long, List<OFFlowMod>> flowCacheMap;
-
- private final Comparator<OFFlowMod> cookieComparator =
- new Comparator<OFFlowMod>() {
- @Override
- public int compare(OFFlowMod fm1, OFFlowMod fm2) {
- long difference = fm2.getCookie() - fm1.getCookie();
-
- if (difference > 0) {
- return 1;
- } else if (difference < 0) {
- return -1;
- } else {
- return 0;
- }
- }
- };
-
- public FlowCache(IFloodlightProviderService floodlightProvider) {
- this.floodlightProvider = floodlightProvider;
-
- flowCacheMap = new HashMap<Long, List<OFFlowMod>>();
- }
-
- public void write(long dpid, OFFlowMod flowMod) {
- synchronized (this) {
- List<OFFlowMod> flowModList = new ArrayList<OFFlowMod>(1);
- flowModList.add(flowMod);
- write(dpid, flowModList);
- }
- }
-
- public void write(long dpid, List<OFFlowMod> flowMods) {
- synchronized (this) {
- ensureCacheForSwitch(dpid);
-
- List<OFFlowMod> clones = new ArrayList<OFFlowMod>(flowMods.size());
-
- // Somehow the OFFlowMods we get passed in will change later on.
- // No idea how this happens, but we can just clone to prevent problems
- try {
- for (OFFlowMod fm : flowMods) {
- clones.add(fm.clone());
- }
- } catch (CloneNotSupportedException e) {
- log.debug("Clone exception", e);
- }
-
- flowCacheMap.get(dpid).addAll(clones);
-
- IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
-
- if (sw == null) {
- log.debug("Switch not found when writing flow mods");
- return;
- }
-
- List<OFMessage> msgList = new ArrayList<OFMessage>(clones.size());
- msgList.addAll(clones);
-
- // XXX S commenting out the old message writes
- /*try {
- sw.write(msgList, null);
- } catch (IOException e) {
- log.error("Error writing to switch", e);
- }*/
- }
- }
-
- public void delete(long dpid, OFFlowMod flowMod) {
- synchronized (this) {
- List<OFFlowMod> flowModList = new ArrayList<OFFlowMod>(1);
- flowModList.add(flowMod);
- delete(dpid, flowModList);
- }
- }
-
- public void delete(long dpid, List<OFFlowMod> flowMods) {
- synchronized (this) {
- ensureCacheForSwitch(dpid);
-
- // Remove the flow mods from the cache first before we alter them
- flowCacheMap.get(dpid).removeAll(flowMods);
-
- // Alter the original flow mods to make them delete flow mods
- for (OFFlowMod fm : flowMods) {
- fm.setCommand(OFFlowMod.OFPFC_DELETE_STRICT)
- .setOutPort(OFPort.OFPP_NONE)
- .setLengthU(OFFlowMod.MINIMUM_LENGTH);
-
- fm.getActions().clear();
- }
-
- IOFSwitch sw = floodlightProvider.getSwitches().get(dpid);
- if (sw == null) {
- log.debug("Switch not found when writing flow mods");
- return;
- }
-
- List<OFMessage> msgList = new ArrayList<OFMessage>(flowMods.size());
- msgList.addAll(flowMods);
-
- // XXX S commenting out old message writes
- /*try {
- sw.write(msgList, null);
- } catch (IOException e) {
- log.error("Error writing to switch", e);
- }*/
- }
- }
-
- public void switchConnected(IOFSwitch sw) {
- synchronized (this) {
- log.debug("Switch connected: {}", sw);
-
- ensureCacheForSwitch(sw.getId());
-
- List<OFFlowMod> flowMods = flowCacheMap.get(sw.getId());
-
- Collections.sort(flowMods, cookieComparator);
-
- sw.clearAllFlowMods();
-
- List<OFMessage> messages = new ArrayList<OFMessage>(flowMods.size());
- messages.addAll(flowMods);
-
- // XXX S commenting out old message writes
- /* try {
- sw.write(messages, null);
- } catch (IOException e) {
- log.error("Failure writing flow mods to switch {}",
- HexString.toHexString(sw.getId()));
- }
- */
- }
- }
-
- private void ensureCacheForSwitch(long dpid) {
- if (!flowCacheMap.containsKey(dpid)) {
- flowCacheMap.put(dpid, new ArrayList<OFFlowMod>());
- }
- }
-}
diff --git a/src/main/java/net/onrc/onos/apps/sdnip/Interface.java b/src/main/java/net/onrc/onos/apps/sdnip/Interface.java
index de3b48c..463cac8 100644
--- a/src/main/java/net/onrc/onos/apps/sdnip/Interface.java
+++ b/src/main/java/net/onrc/onos/apps/sdnip/Interface.java
@@ -8,7 +8,7 @@
import org.codehaus.jackson.annotate.JsonCreator;
import org.codehaus.jackson.annotate.JsonProperty;
-import org.openflow.util.HexString;
+import org.projectfloodlight.openflow.util.HexString;
import com.google.common.net.InetAddresses;
diff --git a/src/main/java/net/onrc/onos/apps/sdnip/Path.java b/src/main/java/net/onrc/onos/apps/sdnip/Path.java
index 28b632b..7a6dd27 100644
--- a/src/main/java/net/onrc/onos/apps/sdnip/Path.java
+++ b/src/main/java/net/onrc/onos/apps/sdnip/Path.java
@@ -1,8 +1,6 @@
package net.onrc.onos.apps.sdnip;
import java.net.InetAddress;
-import java.util.Collections;
-import java.util.List;
/**
* A {@link Path} represents paths within a network that forward traffic from
@@ -35,7 +33,8 @@
private final InetAddress dstIpAddress;
private int numUsers; // initialized to 0
- private List<PushedFlowMod> flowMods; // initialized to null
+ // XXX PushedFlowMod has been removed
+ //private List<PushedFlowMod> flowMods; // initialized to null
private boolean permanent; // initialized to false
/**
@@ -97,9 +96,10 @@
*
* @return the list of {@link PushedFlowMod}s
*/
- public List<PushedFlowMod> getFlowMods() {
+ // XXX PushedFlowMod has been removed
+ /*public List<PushedFlowMod> getFlowMods() {
return Collections.unmodifiableList(flowMods);
- }
+ }*/
/**
* Sets the list of flow mods that were installed to realize this path in
@@ -107,9 +107,10 @@
*
* @param flowMods the list of {@link PushedFlowMod}s
*/
- public void setFlowMods(List<PushedFlowMod> flowMods) {
+ // XXX PushedFlowMod has been removed
+ /*public void setFlowMods(List<PushedFlowMod> flowMods) {
this.flowMods = flowMods;
- }
+ }*/
/**
* Signifies whether the path is permanent and shouldn't be deleted when
diff --git a/src/main/java/net/onrc/onos/apps/sdnip/PushedFlowMod.java b/src/main/java/net/onrc/onos/apps/sdnip/PushedFlowMod.java
deleted file mode 100644
index 38ac37f..0000000
--- a/src/main/java/net/onrc/onos/apps/sdnip/PushedFlowMod.java
+++ /dev/null
@@ -1,46 +0,0 @@
-package net.onrc.onos.apps.sdnip;
-
-import org.openflow.protocol.OFFlowMod;
-
-// TODO This functionality should be handled by ONOS's flow layer in future.
-/**
- * Collects together the DPID and OFFlowMod of a pushed flow mod. This
- * information is used if the flow mod has to be deleted in the future.
- */
-public class PushedFlowMod {
- private final long dpid;
- private OFFlowMod flowMod;
-
- /**
- * Class constructor, taking a DPID and a flow mod.
- *
- * @param dpid the DPID of the switch the flow mod was pushed to
- * @param flowMod the OFFlowMod that was pushed to the switch
- */
- public PushedFlowMod(long dpid, OFFlowMod flowMod) {
- this.dpid = dpid;
- try {
- this.flowMod = flowMod.clone();
- } catch (CloneNotSupportedException e) {
- this.flowMod = flowMod;
- }
- }
-
- /**
- * Gets the DPID of the switch the flow mod was pushed to.
- *
- * @return the DPID of the switch
- */
- public long getDpid() {
- return dpid;
- }
-
- /**
- * Gets the OFFlowMod that was pushed to the switch.
- *
- * @return the OFFlowMod object
- */
- public OFFlowMod getFlowMod() {
- return flowMod;
- }
-}
diff --git a/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java b/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java
index 135d0a7..49128ea 100644
--- a/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java
+++ b/src/main/java/net/onrc/onos/apps/sdnip/SdnIp.java
@@ -62,13 +62,6 @@
import org.codehaus.jackson.JsonParseException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
-import org.openflow.protocol.OFFlowMod;
-import org.openflow.protocol.OFMatch;
-import org.openflow.protocol.OFPacketOut;
-import org.openflow.protocol.OFPort;
-import org.openflow.protocol.action.OFAction;
-import org.openflow.protocol.action.OFActionOutput;
-import org.openflow.util.HexString;
import org.projectfloodlight.openflow.protocol.OFPortDesc;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -160,7 +153,8 @@
// private Multimap<Prefix, PushedFlowMod> pushedFlows;
private Multimap<Prefix, FlowId> pushedFlowIds;
- private FlowCache flowCache;
+ // XXX FlowCache has been removed
+ //private FlowCache flowCache;
// TODO: Fix for the new Topology Network Graph
// private volatile Topology topology = null;
@@ -305,7 +299,7 @@
// pushedFlows = HashMultimap.<Prefix, PushedFlowMod>create();
pushedFlowIds = HashMultimap.create();
- flowCache = new FlowCache(floodlightProvider);
+ //flowCache = new FlowCache(floodlightProvider);
bgpUpdatesExecutor = Executors.newSingleThreadExecutor(
new ThreadFactoryBuilder().setNameFormat("bgp-updates-%d").build());
@@ -1162,8 +1156,8 @@
}
}
- // TODO wait the priority module of the flow Manager
- private void setupArpFlows() {
+ // XXX OpenFlow message classes have been removed
+ /*private void setupArpFlows() {
OFMatch match = new OFMatch();
match.setDataLayerType(Ethernet.TYPE_ARP);
match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_TYPE);
@@ -1191,7 +1185,6 @@
}
}
- // TODO need update, waiting for the priority feature from flow Manager
private void setupDefaultDropFlows() {
OFFlowMod fm = new OFFlowMod();
fm.setMatch(new OFMatch());
@@ -1247,7 +1240,7 @@
for (String strdpid : switches) {
flowCache.write(HexString.toLong(strdpid), flowModList);
}
- }
+ }*/
private void beginRouting() {
log.debug("Topology is now ready, beginning routing function");
@@ -1469,7 +1462,7 @@
sw.clearAllFlowMods();
}
- flowCache.switchConnected(sw);
+ //flowCache.switchConnected(sw);
}
@Override