Giant patch of changes to support OpenFlow 1.3
The following people have contributed to this patch:
- Ali Al-Shabibi <alshabibi.ali@gmail.com>
- Ayaka Koshibe <ayaka@onlab.us>
- Brian O'Connor <bocon@onlab.us>
- Jonathan Hart <jono@onlab.us>
- Matteo Gerola <mgerola@create-net.org>
- Michele Santuari <michele.santuari@create-net.org>
- Pavlin Radoslavov <pavlin@onlab.us>
- Saurav Das <sauravdas@alumni.stanford.edu>
- Toshio Koide <t-koide@onlab.us>
- Yuta HIGUCHI <y-higuchi@onlab.us>
The patch includes the following changes:
- New Floodlight I/O loop / state machine
- New switch/port handling
- New role management (incl. Role.EQUAL)
- Added Floodlight debug framework
- Updates to Controller.java
- Move to Loxigen's OpenflowJ library
- Added OF1.3 support
- Added support for different switches (via DriverManager)
- Updated ONOS modules to use new APIs
- Added and updated unit tests
Change-Id: Ic70a8d50f7136946193d2ba2e4dc0b4bfac5f599
diff --git a/src/main/java/net/onrc/onos/core/drivermanager/DriverManager.java b/src/main/java/net/onrc/onos/core/drivermanager/DriverManager.java
new file mode 100644
index 0000000..fe86077
--- /dev/null
+++ b/src/main/java/net/onrc/onos/core/drivermanager/DriverManager.java
@@ -0,0 +1,58 @@
+package net.onrc.onos.core.drivermanager;
+
+import net.floodlightcontroller.core.IOFSwitch;
+import net.floodlightcontroller.core.internal.OFSwitchImplBase;
+
+import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * A simple implementation of a driver manager that differentiates between
+ * connected switches using the OF Description Statistics Reply message.
+ */
+public final class DriverManager {
+
+ private static final Logger log = LoggerFactory.getLogger(DriverManager.class);
+
+ /**
+ * Return an IOFSwitch object based on switch's manufacturer description
+ * from OFDescStatsReply.
+ *
+ * @param desc DescriptionStatistics reply from the switch
+ * @return A IOFSwitch instance if the driver found an implementation for
+ * the given description. Otherwise it returns OFSwitchImplBase
+ */
+ public static IOFSwitch getOFSwitchImpl(OFDescStatsReply desc, OFVersion ofv) {
+ String vendor = desc.getMfrDesc();
+ String hw = desc.getHwDesc();
+ if (vendor.startsWith("Stanford University, Ericsson Research and CPqD Research")
+ &&
+ hw.startsWith("OpenFlow 1.3 Reference Userspace Switch")) {
+ return new OFSwitchImplCPqD13(desc);
+ }
+
+ if (vendor.startsWith("Nicira") &&
+ hw.startsWith("Open vSwitch")) {
+ if (ofv == OFVersion.OF_10) {
+ return new OFSwitchImplOVS10(desc);
+ } else if (ofv == OFVersion.OF_13) {
+ return new OFSwitchImplOVS13(desc);
+ }
+ }
+
+ log.warn("DriverManager could not identify switch desc: {}. "
+ + "Assigning OFSwitchImplBase", desc);
+ OFSwitchImplBase base = new OFSwitchImplBase();
+ base.setSwitchDescription(desc);
+ // XXX S must set counter here - unidentified switch
+ return base;
+ }
+
+ /**
+ * Private constructor to avoid instantiation.
+ */
+ private DriverManager() {
+ }
+}