diff --git a/openflow/api/pom.xml b/openflow/api/pom.xml
new file mode 100644
index 0000000000..7a1619e9e4
--- /dev/null
+++ b/openflow/api/pom.xml
@@ -0,0 +1,73 @@
+
+
+ 4.0.0
+
+
+ org.onlab.onos
+ onos-of
+ 1.0.0-SNAPSHOT
+ ../pom.xml
+
+
+ onos-of-api
+ bundle
+
+ ONOS OpenFlow controller subsystem API
+
+
+
+ org.projectfloodlight
+ openflowj
+ 0.3.8-SNAPSHOT
+
+
+ io.netty
+ netty
+ 3.9.0.Final
+
+
+
+
+
+
+ org.apache.maven.plugins
+ maven-shade-plugin
+ 2.3
+
+
+
+ io.netty:netty
+ com.google.guava:guava
+ org.slf4j:slfj-api
+ ch.qos.logback:logback-core
+ ch.qos.logback:logback-classic
+ com.google.code.findbugs:annotations
+
+
+
+
+
+ package
+
+ shade
+
+
+
+
+
+ org.apache.felix
+ maven-bundle-plugin
+
+
+
+ org.onlab.onos.of.*,org.projectfloodlight.openflow.*
+
+
+
+
+
+
+
+
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/DefaultOpenFlowPacketContext.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/DefaultOpenFlowPacketContext.java
new file mode 100644
index 0000000000..45f615a67a
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/DefaultOpenFlowPacketContext.java
@@ -0,0 +1,120 @@
+package org.onlab.onos.of.controller;
+
+import static org.slf4j.LoggerFactory.getLogger;
+
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.onlab.packet.Ethernet;
+import org.projectfloodlight.openflow.protocol.OFPacketIn;
+import org.projectfloodlight.openflow.protocol.OFPacketOut;
+import org.projectfloodlight.openflow.protocol.action.OFAction;
+import org.projectfloodlight.openflow.protocol.action.OFActionOutput;
+import org.projectfloodlight.openflow.protocol.match.MatchField;
+import org.projectfloodlight.openflow.types.OFBufferId;
+import org.projectfloodlight.openflow.types.OFPort;
+import org.slf4j.Logger;
+
+public final class DefaultOpenFlowPacketContext implements OpenFlowPacketContext {
+
+ private final Logger log = getLogger(getClass());
+
+ private final AtomicBoolean free = new AtomicBoolean(true);
+ private final AtomicBoolean isBuilt = new AtomicBoolean(false);
+ private final OpenFlowSwitch sw;
+ private final OFPacketIn pktin;
+ private OFPacketOut pktout = null;
+
+ private DefaultOpenFlowPacketContext(OpenFlowSwitch s, OFPacketIn pkt) {
+ this.sw = s;
+ this.pktin = pkt;
+ }
+
+ @Override
+ public void send() {
+ if (block() && isBuilt.get()) {
+ sw.sendMsg(pktout);
+ }
+ }
+
+ @Override
+ public void build(OFPort outPort) {
+ if (isBuilt.getAndSet(true)) {
+ return;
+ }
+ OFPacketOut.Builder builder = sw.factory().buildPacketOut();
+ OFAction act = buildOutput(outPort.getPortNumber());
+ pktout = builder.setXid(pktin.getXid())
+ .setInPort(pktin.getInPort())
+ .setBufferId(pktin.getBufferId())
+ .setActions(Collections.singletonList(act))
+ .build();
+ }
+
+ @Override
+ public void build(Ethernet ethFrame, OFPort outPort) {
+ if (isBuilt.getAndSet(true)) {
+ return;
+ }
+ OFPacketOut.Builder builder = sw.factory().buildPacketOut();
+ OFAction act = buildOutput(outPort.getPortNumber());
+ pktout = builder.setXid(pktin.getXid())
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setInPort(pktin.getInPort())
+ .setActions(Collections.singletonList(act))
+ .setData(ethFrame.serialize())
+ .build();
+ }
+
+ @Override
+ public Ethernet parsed() {
+ Ethernet eth = new Ethernet();
+ eth.deserialize(pktin.getData(), 0, pktin.getTotalLen());
+ return eth;
+ }
+
+ @Override
+ public Dpid dpid() {
+ return new Dpid(sw.getId());
+ }
+
+ public static OpenFlowPacketContext packetContextFromPacketIn(OpenFlowSwitch s,
+ OFPacketIn pkt) {
+ return new DefaultOpenFlowPacketContext(s, pkt);
+ }
+
+ @Override
+ public Integer inPort() {
+ try {
+ return pktin.getInPort().getPortNumber();
+ } catch (UnsupportedOperationException e) {
+ return pktin.getMatch().get(MatchField.IN_PORT).getPortNumber();
+ }
+ }
+
+ @Override
+ public byte[] unparsed() {
+
+ return pktin.getData().clone();
+
+ }
+
+ private OFActionOutput buildOutput(Integer port) {
+ OFActionOutput act = sw.factory().actions()
+ .buildOutput()
+ .setPort(OFPort.of(port))
+ .build();
+ return act;
+ }
+
+ @Override
+ public boolean block() {
+ return free.getAndSet(false);
+ }
+
+ @Override
+ public boolean isHandled() {
+ return !free.get();
+ }
+
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/Dpid.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/Dpid.java
new file mode 100644
index 0000000000..ca3d8e61e3
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/Dpid.java
@@ -0,0 +1,119 @@
+package org.onlab.onos.of.controller;
+
+import org.projectfloodlight.openflow.util.HexString;
+
+import java.net.URI;
+import java.net.URISyntaxException;
+
+import static com.google.common.base.Preconditions.checkArgument;
+import static org.onlab.util.Tools.fromHex;
+import static org.onlab.util.Tools.toHex;
+
+/**
+ * The class representing a network switch DPID.
+ * This class is immutable.
+ */
+public final class Dpid {
+
+ private static final String SCHEME = "of";
+ private static final long UNKNOWN = 0;
+ private final long value;
+
+ /**
+ * Default constructor.
+ */
+ public Dpid() {
+ this.value = Dpid.UNKNOWN;
+ }
+
+ /**
+ * Constructor from a long value.
+ *
+ * @param value the value to use.
+ */
+ public Dpid(long value) {
+ this.value = value;
+ }
+
+ /**
+ * Constructor from a string.
+ *
+ * @param value the value to use.
+ */
+ public Dpid(String value) {
+ this.value = HexString.toLong(value);
+ }
+
+ /**
+ * Get the value of the DPID.
+ *
+ * @return the value of the DPID.
+ */
+ public long value() {
+ return value;
+ }
+
+ /**
+ * Convert the DPID value to a ':' separated hexadecimal string.
+ *
+ * @return the DPID value as a ':' separated hexadecimal string.
+ */
+ @Override
+ public String toString() {
+ return HexString.toHexString(this.value);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ if (!(other instanceof Dpid)) {
+ return false;
+ }
+
+ Dpid otherDpid = (Dpid) other;
+
+ return value == otherDpid.value;
+ }
+
+ @Override
+ public int hashCode() {
+ int hash = 17;
+ hash += 31 * hash + (int) (value ^ value >>> 32);
+ return hash;
+ }
+
+ /**
+ * Returns DPID created from the given device URI.
+ *
+ * @param uri device URI
+ * @return dpid
+ */
+ public static Dpid dpid(URI uri) {
+ checkArgument(uri.getScheme().equals(SCHEME), "Unsupported URI scheme");
+ return new Dpid(fromHex(uri.getSchemeSpecificPart()));
+ }
+
+ /**
+ * Produces device URI from the given DPID.
+ *
+ * @param dpid device dpid
+ * @return device URI
+ */
+ public static URI uri(Dpid dpid) {
+ return uri(dpid.value);
+ }
+
+ /**
+ * Produces device URI from the given DPID long.
+ *
+ * @param value device dpid as long
+ * @return device URI
+ */
+ public static URI uri(long value) {
+ try {
+ return new URI(SCHEME, toHex(value), null);
+ } catch (URISyntaxException e) {
+ return null;
+ }
+ }
+
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowController.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowController.java
new file mode 100644
index 0000000000..ab80eee789
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowController.java
@@ -0,0 +1,101 @@
+package org.onlab.onos.of.controller;
+
+import org.projectfloodlight.openflow.protocol.OFMessage;
+
+/**
+ * Abstraction of an OpenFlow controller. Serves as a one stop
+ * shop for obtaining OpenFlow devices and (un)register listeners
+ * on OpenFlow events
+ */
+public interface OpenFlowController {
+
+ /**
+ * Returns all switches known to this OF controller.
+ * @return Iterable of dpid elements
+ */
+ public Iterable getSwitches();
+
+ /**
+ * Returns all master switches known to this OF controller.
+ * @return Iterable of dpid elements
+ */
+ public Iterable getMasterSwitches();
+
+ /**
+ * Returns all equal switches known to this OF controller.
+ * @return Iterable of dpid elements
+ */
+ public Iterable getEqualSwitches();
+
+
+ /**
+ * Returns the actual switch for the given Dpid.
+ * @param dpid the switch to fetch
+ * @return the interface to this switch
+ */
+ public OpenFlowSwitch getSwitch(Dpid dpid);
+
+ /**
+ * Returns the actual master switch for the given Dpid, if one exists.
+ * @param dpid the switch to fetch
+ * @return the interface to this switch
+ */
+ public OpenFlowSwitch getMasterSwitch(Dpid dpid);
+
+ /**
+ * Returns the actual equal switch for the given Dpid, if one exists.
+ * @param dpid the switch to fetch
+ * @return the interface to this switch
+ */
+ public OpenFlowSwitch getEqualSwitch(Dpid dpid);
+
+ /**
+ * Register a listener for meta events that occur to OF
+ * devices.
+ * @param listener the listener to notify
+ */
+ public void addListener(OpenFlowSwitchListener listener);
+
+ /**
+ * Unregister a listener.
+ *
+ * @param listener the listener to unregister
+ */
+ public void removeListener(OpenFlowSwitchListener listener);
+
+ /**
+ * Register a listener for packet events.
+ * @param priority the importance of this listener, lower values are more important
+ * @param listener the listener to notify
+ */
+ public void addPacketListener(int priority, PacketListener listener);
+
+ /**
+ * Unregister a listener.
+ *
+ * @param listener the listener to unregister
+ */
+ public void removePacketListener(PacketListener listener);
+
+ /**
+ * Send a message to a particular switch.
+ * @param dpid the switch to send to.
+ * @param msg the message to send
+ */
+ public void write(Dpid dpid, OFMessage msg);
+
+ /**
+ * Process a message and notify the appropriate listeners.
+ *
+ * @param dpid the dpid the message arrived on
+ * @param msg the message to process.
+ */
+ public void processPacket(Dpid dpid, OFMessage msg);
+
+ /**
+ * Sets the role for a given switch.
+ * @param role the desired role
+ * @param dpid the switch to set the role for.
+ */
+ public void setRole(Dpid dpid, RoleState role);
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowPacketContext.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowPacketContext.java
new file mode 100644
index 0000000000..0e90f95938
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowPacketContext.java
@@ -0,0 +1,69 @@
+package org.onlab.onos.of.controller;
+
+import org.onlab.packet.Ethernet;
+import org.projectfloodlight.openflow.types.OFPort;
+
+/**
+ * A representation of a packet context which allows any provider
+ * to view the packet in event but may block the response to the
+ * event if blocked has been called.
+ */
+public interface OpenFlowPacketContext {
+
+ //TODO: may want to support sending packet out other switches than
+ // the one it came in on.
+ /**
+ * Blocks further responses (ie. send() calls) on this
+ * packet in event.
+ */
+ public boolean block();
+
+ /**
+ * Checks whether the packet has been handled.
+ * @return true if handled, false otherwise.
+ */
+ public boolean isHandled();
+
+ /**
+ * Provided build has been called send the packet
+ * out the switch it came in on.
+ */
+ public void send();
+
+ /**
+ * Build the packet out in response to this packet in event.
+ * @param outPort the out port to send to packet out of.
+ */
+ public void build(OFPort outPort);
+
+ /**
+ * Build the packet out in response to this packet in event.
+ * @param ethFrame the actual packet to send out.
+ * @param outPort the out port to send to packet out of.
+ */
+ public void build(Ethernet ethFrame, OFPort outPort);
+
+ /**
+ * Provided a handle onto the parsed payload.
+ * @return the parsed form of the payload.
+ */
+ public Ethernet parsed();
+
+ /**
+ * Provide an unparsed copy of the data.
+ * @return the unparsed form of the payload.
+ */
+ public byte[] unparsed();
+
+ /**
+ * Provide the dpid of the switch where the packet in arrived.
+ * @return the dpid of the switch.
+ */
+ public Dpid dpid();
+
+ /**
+ * Provide the port on which the packet arrived.
+ * @return the port
+ */
+ public Integer inPort();
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowSwitch.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowSwitch.java
new file mode 100644
index 0000000000..f16bb88bf3
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowSwitch.java
@@ -0,0 +1,108 @@
+package org.onlab.onos.of.controller;
+
+import java.util.List;
+
+import org.projectfloodlight.openflow.protocol.OFFactory;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFPortDesc;
+
+/**
+ * Represents to provider facing side of a switch.
+ */
+public interface OpenFlowSwitch {
+
+ /**
+ * Writes the message to the driver.
+ *
+ * @param msg the message to write
+ */
+ public void sendMsg(OFMessage msg);
+
+ /**
+ * Writes to the OFMessage list to the driver.
+ *
+ * @param msgs the messages to be written
+ */
+ public void sendMsg(List msgs);
+
+ /**
+ * Handle a message from the switch.
+ * @param fromSwitch the message to handle
+ */
+ public void handleMessage(OFMessage fromSwitch);
+
+ /**
+ * Sets the role for this switch.
+ * @param role the role to set.
+ */
+ public void setRole(RoleState role);
+
+ /**
+ * Fetch the role for this switch.
+ * @return the role.
+ */
+ public RoleState getRole();
+
+ /**
+ * Fetches the ports of this switch.
+ * @return unmodifiable list of the ports.
+ */
+ public List getPorts();
+
+ /**
+ * Provides the factory for this OF version.
+ * @return OF version specific factory.
+ */
+ public OFFactory factory();
+
+ /**
+ * Gets a string version of the ID for this switch.
+ *
+ * @return string version of the ID
+ */
+ public String getStringId();
+
+ /**
+ * Gets the datapathId of the switch.
+ *
+ * @return the switch dpid in long format
+ */
+ public long getId();
+
+ /**
+ * fetch the manufacturer description.
+ * @return the description
+ */
+ public String manfacturerDescription();
+
+ /**
+ * fetch the datapath description.
+ * @return the description
+ */
+ public String datapathDescription();
+
+ /**
+ * fetch the hardware description.
+ * @return the description
+ */
+ public String hardwareDescription();
+
+ /**
+ * fetch the software description.
+ * @return the description
+ */
+ public String softwareDescription();
+
+ /**
+ * fetch the serial number.
+ * @return the serial
+ */
+ public String serialNumber();
+
+ /**
+ * Disconnects the switch by closing the TCP connection. Results in a call
+ * to the channel handler's channelDisconnected method for cleanup
+ */
+ public void disconnectSwitch();
+
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowSwitchListener.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowSwitchListener.java
new file mode 100644
index 0000000000..ae5e3a8eb7
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/OpenFlowSwitchListener.java
@@ -0,0 +1,28 @@
+package org.onlab.onos.of.controller;
+
+import org.projectfloodlight.openflow.protocol.OFPortStatus;
+
+/**
+ * Allows for providers interested in Switch events to be notified.
+ */
+public interface OpenFlowSwitchListener {
+
+ /**
+ * Notify that the switch was added.
+ * @param dpid the switch where the event occurred
+ */
+ public void switchAdded(Dpid dpid);
+
+ /**
+ * Notify that the switch was removed.
+ * @param dpid the switch where the event occurred.
+ */
+ public void switchRemoved(Dpid dpid);
+
+ /**
+ * Notify that a port has changed.
+ * @param dpid the switch on which the change happened.
+ * @param status the new state of the port.
+ */
+ public void portChanged(Dpid dpid, OFPortStatus status);
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/PacketListener.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/PacketListener.java
new file mode 100644
index 0000000000..6bd39b8ede
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/PacketListener.java
@@ -0,0 +1,14 @@
+package org.onlab.onos.of.controller;
+
+/**
+ * Notifies providers about Packet in events.
+ */
+public interface PacketListener {
+
+ /**
+ * Handles the packet.
+ *
+ * @param pktCtx the packet context
+ */
+ public void handlePacket(OpenFlowPacketContext pktCtx);
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/RoleState.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/RoleState.java
new file mode 100644
index 0000000000..db8efd1064
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/RoleState.java
@@ -0,0 +1,25 @@
+package org.onlab.onos.of.controller;
+
+import org.projectfloodlight.openflow.protocol.OFControllerRole;
+
+/**
+ * The role of the controller as it pertains to a particular switch.
+ * Note that this definition of the role enum is different from the
+ * OF1.3 definition. It is maintained here to be backward compatible to
+ * earlier versions of the controller code. This enum is translated
+ * to the OF1.3 enum, before role messages are sent to the switch.
+ * See sendRoleRequestMessage method in OFSwitchImpl
+ */
+public enum RoleState {
+ EQUAL(OFControllerRole.ROLE_EQUAL),
+ MASTER(OFControllerRole.ROLE_MASTER),
+ SLAVE(OFControllerRole.ROLE_SLAVE);
+
+ private RoleState(OFControllerRole nxRole) {
+ nxRole.ordinal();
+ }
+
+}
+
+
+
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/AbstractOpenFlowSwitch.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/AbstractOpenFlowSwitch.java
new file mode 100644
index 0000000000..d7e0186134
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/AbstractOpenFlowSwitch.java
@@ -0,0 +1,346 @@
+/**
+ * Copyright 2011, Big Switch Networks, Inc.
+ * Originally created by David Erickson, Stanford University
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ **/
+
+package org.onlab.onos.of.controller.driver;
+
+import java.io.IOException;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.jboss.netty.channel.Channel;
+import org.onlab.onos.of.controller.Dpid;
+import org.onlab.onos.of.controller.RoleState;
+import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFErrorMsg;
+import org.projectfloodlight.openflow.protocol.OFExperimenter;
+import org.projectfloodlight.openflow.protocol.OFFactories;
+import org.projectfloodlight.openflow.protocol.OFFactory;
+import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFPortDesc;
+import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFRoleReply;
+import org.projectfloodlight.openflow.protocol.OFVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * An abstract representation of an OpenFlow switch. Can be extended by others
+ * to serve as a base for their vendor specific representation of a switch.
+ */
+public abstract class AbstractOpenFlowSwitch implements OpenFlowSwitchDriver {
+
+ private static Logger log =
+ LoggerFactory.getLogger(AbstractOpenFlowSwitch.class);
+
+ protected Channel channel;
+
+ private boolean connected;
+ protected boolean startDriverHandshakeCalled = false;
+ private final Dpid dpid;
+ private OpenFlowAgent agent;
+ private final AtomicInteger xidCounter = new AtomicInteger(0);
+
+ private OFVersion ofVersion;
+
+ protected OFPortDescStatsReply ports;
+
+ protected boolean tableFull;
+
+ private RoleHandler roleMan;
+
+ protected RoleState role;
+
+ protected OFFeaturesReply features;
+ protected OFDescStatsReply desc;
+
+ /**
+ * Given a dpid build this switch.
+ * @param dp the dpid
+ */
+ protected AbstractOpenFlowSwitch(Dpid dp) {
+ this.dpid = dp;
+ }
+
+ public AbstractOpenFlowSwitch(Dpid dpid, OFDescStatsReply desc) {
+ this.dpid = dpid;
+ this.desc = desc;
+ }
+
+ //************************
+ // Channel related
+ //************************
+
+ @Override
+ public final void disconnectSwitch() {
+ this.channel.close();
+ }
+
+ @Override
+ public final void sendMsg(OFMessage m) {
+ this.write(m);
+ }
+
+ @Override
+ public final void sendMsg(List msgs) {
+ this.write(msgs);
+ }
+
+ @Override
+ public abstract void write(OFMessage msg);
+
+ @Override
+ public abstract void write(List msgs);
+
+ @Override
+ public final boolean isConnected() {
+ return this.connected;
+ }
+
+ @Override
+ public final void setConnected(boolean connected) {
+ this.connected = connected;
+ };
+
+ @Override
+ public final void setChannel(Channel channel) {
+ this.channel = channel;
+ };
+
+ //************************
+ // Switch features related
+ //************************
+
+ @Override
+ public final long getId() {
+ return this.dpid.value();
+ };
+
+ @Override
+ public final String getStringId() {
+ return this.dpid.toString();
+ }
+
+ @Override
+ public final void setOFVersion(OFVersion ofV) {
+ this.ofVersion = ofV;
+ }
+
+ @Override
+ public void setTableFull(boolean full) {
+ this.tableFull = full;
+ }
+
+ @Override
+ public void setFeaturesReply(OFFeaturesReply featuresReply) {
+ this.features = featuresReply;
+ }
+
+ @Override
+ public abstract Boolean supportNxRole();
+
+ //************************
+ // Message handling
+ //************************
+ /**
+ * Handle the message coming from the dataplane.
+ *
+ * @param m the actual message
+ */
+ @Override
+ public final void handleMessage(OFMessage m) {
+ this.agent.processMessage(dpid, m);
+ }
+
+ @Override
+ public RoleState getRole() {
+ return role;
+ };
+
+ @Override
+ public final boolean connectSwitch() {
+ return this.agent.addConnectedSwitch(dpid, this);
+ }
+
+ @Override
+ public final boolean activateMasterSwitch() {
+ return this.agent.addActivatedMasterSwitch(dpid, this);
+ }
+
+ @Override
+ public final boolean activateEqualSwitch() {
+ return this.agent.addActivatedEqualSwitch(dpid, this);
+ }
+
+ @Override
+ public final void transitionToEqualSwitch() {
+ this.agent.transitionToEqualSwitch(dpid);
+ }
+
+ @Override
+ public final void transitionToMasterSwitch() {
+ this.agent.transitionToMasterSwitch(dpid);
+ }
+
+ @Override
+ public final void removeConnectedSwitch() {
+ this.agent.removeConnectedSwitch(dpid);
+ }
+
+ @Override
+ public OFFactory factory() {
+ return OFFactories.getFactory(ofVersion);
+ }
+
+ @Override
+ public void setPortDescReply(OFPortDescStatsReply portDescReply) {
+ this.ports = portDescReply;
+ }
+
+ @Override
+ public abstract void startDriverHandshake();
+
+ @Override
+ public abstract boolean isDriverHandshakeComplete();
+
+ @Override
+ public abstract void processDriverHandshakeMessage(OFMessage m);
+
+ @Override
+ public void setRole(RoleState role) {
+ try {
+ log.info("Sending role {} to switch {}", role, getStringId());
+ if (this.roleMan.sendRoleRequest(role, RoleRecvStatus.MATCHED_SET_ROLE)) {
+ this.role = role;
+ }
+ } catch (IOException e) {
+ log.error("Unable to write to switch {}.", this.dpid);
+ }
+ }
+
+ // Role Handling
+
+ @Override
+ public void handleRole(OFMessage m) throws SwitchStateException {
+ RoleReplyInfo rri = roleMan.extractOFRoleReply((OFRoleReply) m);
+ RoleRecvStatus rrs = roleMan.deliverRoleReply(rri);
+ if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) {
+ if (rri.getRole() == RoleState.MASTER) {
+ this.transitionToMasterSwitch();
+ } else if (rri.getRole() == RoleState.EQUAL ||
+ rri.getRole() == RoleState.MASTER) {
+ this.transitionToEqualSwitch();
+ }
+ }
+ }
+
+ @Override
+ public void handleNiciraRole(OFMessage m) throws SwitchStateException {
+ RoleState r = this.roleMan.extractNiciraRoleReply((OFExperimenter) m);
+ if (r == null) {
+ // The message wasn't really a Nicira role reply. We just
+ // dispatch it to the OFMessage listeners in this case.
+ this.handleMessage(m);
+ }
+
+ RoleRecvStatus rrs = this.roleMan.deliverRoleReply(
+ new RoleReplyInfo(r, null, m.getXid()));
+ if (rrs == RoleRecvStatus.MATCHED_SET_ROLE) {
+ if (r == RoleState.MASTER) {
+ this.transitionToMasterSwitch();
+ } else if (r == RoleState.EQUAL ||
+ r == RoleState.SLAVE) {
+ this.transitionToEqualSwitch();
+ }
+ }
+ }
+
+ @Override
+ public boolean handleRoleError(OFErrorMsg error) {
+ try {
+ return RoleRecvStatus.OTHER_EXPECTATION != this.roleMan.deliverError(error);
+ } catch (SwitchStateException e) {
+ this.disconnectSwitch();
+ }
+ return true;
+ }
+
+ @Override
+ public void reassertRole() {
+ if (this.getRole() == RoleState.MASTER) {
+ this.setRole(RoleState.MASTER);
+ }
+ }
+
+ @Override
+ public final void setAgent(OpenFlowAgent ag) {
+ if (this.agent == null) {
+ this.agent = ag;
+ }
+ }
+
+ @Override
+ public final void setRoleHandler(RoleHandler roleHandler) {
+ if (this.roleMan == null) {
+ this.roleMan = roleHandler;
+ }
+ }
+
+ @Override
+ public void setSwitchDescription(OFDescStatsReply d) {
+ this.desc = d;
+ }
+
+ @Override
+ public int getNextTransactionId() {
+ return this.xidCounter.getAndIncrement();
+ }
+
+ @Override
+ public List getPorts() {
+ return Collections.unmodifiableList(ports.getEntries());
+ }
+
+ @Override
+ public String manfacturerDescription() {
+ return this.desc.getMfrDesc();
+ }
+
+
+ @Override
+ public String datapathDescription() {
+ return this.desc.getDpDesc();
+ }
+
+
+ @Override
+ public String hardwareDescription() {
+ return this.desc.getHwDesc();
+ }
+
+ @Override
+ public String softwareDescription() {
+ return this.desc.getSwDesc();
+ }
+
+ @Override
+ public String serialNumber() {
+ return this.desc.getSerialNum();
+ }
+
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/OpenFlowAgent.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/OpenFlowAgent.java
new file mode 100644
index 0000000000..0d37666b74
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/OpenFlowAgent.java
@@ -0,0 +1,77 @@
+package org.onlab.onos.of.controller.driver;
+
+import org.onlab.onos.of.controller.Dpid;
+import org.onlab.onos.of.controller.OpenFlowSwitch;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+
+/**
+ * Responsible for keeping track of the current set of switches
+ * connected to the system. As well as whether they are in Master
+ * role or not.
+ *
+ */
+public interface OpenFlowAgent {
+
+ /**
+ * Add a switch that has just connected to the system.
+ * @param dpid the dpid to add
+ * @param sw the actual switch object.
+ * @return true if added, false otherwise.
+ */
+ public boolean addConnectedSwitch(Dpid dpid, OpenFlowSwitch sw);
+
+ /**
+ * Checks if the activation for this switch is valid.
+ * @param dpid the dpid to check
+ * @return true if valid, false otherwise
+ */
+ public boolean validActivation(Dpid dpid);
+
+ /**
+ * Called when a switch is activated, with this controller's role as MASTER.
+ * @param dpid the dpid to add.
+ * @param sw the actual switch
+ * @return true if added, false otherwise.
+ */
+ public boolean addActivatedMasterSwitch(Dpid dpid, OpenFlowSwitch sw);
+
+ /**
+ * Called when a switch is activated, with this controller's role as EQUAL.
+ * @param dpid the dpid to add.
+ * @param sw the actual switch
+ * @return true if added, false otherwise.
+ */
+ public boolean addActivatedEqualSwitch(Dpid dpid, OpenFlowSwitch sw);
+
+ /**
+ * Called when this controller's role for a switch transitions from equal
+ * to master. For 1.0 switches, we internally refer to the role 'slave' as
+ * 'equal' - so this transition is equivalent to 'addActivatedMasterSwitch'.
+ * @param dpid the dpid to transistion.
+ */
+ public void transitionToMasterSwitch(Dpid dpid);
+
+ /**
+ * Called when this controller's role for a switch transitions to equal.
+ * For 1.0 switches, we internally refer to the role 'slave' as
+ * 'equal'.
+ * @param dpid the dpid to transistion.
+ */
+ public void transitionToEqualSwitch(Dpid dpid);
+
+ /**
+ * Clear all state in controller switch maps for a switch that has
+ * disconnected from the local controller. Also release control for
+ * that switch from the global repository. Notify switch listeners.
+ * @param dpid the dpid to remove.
+ */
+ public void removeConnectedSwitch(Dpid dpid);
+
+ /**
+ * Process a message coming from a switch.
+ *
+ * @param dpid the dpid the message came on.
+ * @param m the message to process
+ */
+ public void processMessage(Dpid dpid, OFMessage m);
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/OpenFlowSwitchDriver.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/OpenFlowSwitchDriver.java
new file mode 100644
index 0000000000..be999731c7
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/OpenFlowSwitchDriver.java
@@ -0,0 +1,197 @@
+package org.onlab.onos.of.controller.driver;
+
+import java.util.List;
+
+import org.jboss.netty.channel.Channel;
+import org.onlab.onos.of.controller.OpenFlowSwitch;
+import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFErrorMsg;
+import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFVersion;
+
+/**
+ * Represents the driver side of an OpenFlow switch.
+ * This interface should never be exposed to consumers.
+ *
+ */
+public interface OpenFlowSwitchDriver extends OpenFlowSwitch {
+
+ /**
+ * Sets the OpenFlow agent to be used. This method
+ * can only be called once.
+ * @param agent the agent to set.
+ */
+ public void setAgent(OpenFlowAgent agent);
+
+ /**
+ * Sets the Role handler object.
+ * This method can only be called once.
+ * @param roleHandler the roleHandler class
+ */
+ public void setRoleHandler(RoleHandler roleHandler);
+
+ /**
+ * Reasserts this controllers role to the switch.
+ * Useful in cases where the switch no longer agrees
+ * that this controller has the role it claims.
+ */
+ public void reassertRole();
+
+ /**
+ * Handle the situation where the role request triggers an error.
+ * @param error the error to handle.
+ * @return true if handled, false if not.
+ */
+ public boolean handleRoleError(OFErrorMsg error);
+
+ /**
+ * If this driver know of Nicira style role messages, these should
+ * be handled here.
+ * @param m the role message to handle.
+ * @throws SwitchStateException if the message received was
+ * not a nicira role or was malformed.
+ */
+ public void handleNiciraRole(OFMessage m) throws SwitchStateException;
+
+ /**
+ * Handle OF 1.x (where x > 0) role messages.
+ * @param m the role message to handle
+ * @throws SwitchStateException if the message received was
+ * not a nicira role or was malformed.
+ */
+ public void handleRole(OFMessage m) throws SwitchStateException;
+
+ /**
+ * Starts the driver specific handshake process.
+ */
+ public void startDriverHandshake();
+
+ /**
+ * Checks whether the driver specific handshake is complete.
+ * @return true is finished, false if not.
+ */
+ public boolean isDriverHandshakeComplete();
+
+ /**
+ * Process a message during the driver specific handshake.
+ * @param m the message to process.
+ */
+ public void processDriverHandshakeMessage(OFMessage m);
+
+ /**
+ * Announce to the OpenFlow agent that this switch has connected.
+ * @return true if successful, false if duplicate switch.
+ */
+ public boolean connectSwitch();
+
+ /**
+ * Activate this MASTER switch-controller relationship in the OF agent.
+ * @return true is successful, false is switch has not
+ * connected or is unknown to the system.
+ */
+ public boolean activateMasterSwitch();
+
+ /**
+ * Activate this EQUAL switch-controller relationship in the OF agent.
+ * @return true is successful, false is switch has not
+ * connected or is unknown to the system.
+ */
+ public boolean activateEqualSwitch();
+
+ /**
+ * Transition this switch-controller relationship to an EQUAL state.
+ */
+ public void transitionToEqualSwitch();
+
+ /**
+ * Transition this switch-controller relationship to an Master state.
+ */
+ public void transitionToMasterSwitch();
+
+ /**
+ * Remove this switch from the openflow agent.
+ */
+ public void removeConnectedSwitch();
+
+ /**
+ * Sets the ports on this switch.
+ * @param portDescReply the port set and descriptions
+ */
+ public void setPortDescReply(OFPortDescStatsReply portDescReply);
+
+ /**
+ * Sets the features reply for this switch.
+ * @param featuresReply the features to set.
+ */
+ public void setFeaturesReply(OFFeaturesReply featuresReply);
+
+ /**
+ * Sets the switch description.
+ * @param desc the descriptions
+ */
+ public void setSwitchDescription(OFDescStatsReply desc);
+
+ /**
+ * Gets the next transaction id to use.
+ * @return the xid
+ */
+ public int getNextTransactionId();
+
+
+ /**
+ * Does this switch support Nicira Role messages.
+ * @return true if supports, false otherwise.
+ */
+ public Boolean supportNxRole();
+
+ /**
+ * Sets the OF version for this switch.
+ * @param ofV the version to set.
+ */
+ public void setOFVersion(OFVersion ofV);
+
+ /**
+ * Sets this switch has having a full flowtable.
+ * @param full true if full, false otherswise.
+ */
+ public void setTableFull(boolean full);
+
+ /**
+ * Sets the associated Netty channel for this switch.
+ * @param channel the Netty channel
+ */
+ public void setChannel(Channel channel);
+
+ /**
+ * Sets whether the switch is connected.
+ *
+ * @param connected whether the switch is connected
+ */
+ public void setConnected(boolean connected);
+
+ /**
+ * Checks if the switch is still connected.
+ *
+ * @return whether the switch is still connected
+ */
+ public boolean isConnected();
+
+ /**
+ * Writes the message to the output stream
+ * in a driver specific manner.
+ *
+ * @param msg the message to write
+ */
+ public void write(OFMessage msg);
+
+ /**
+ * Writes to the OFMessage list to the output stream
+ * in a driver specific manner.
+ *
+ * @param msgs the messages to be written
+ */
+ public void write(List msgs);
+
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/OpenFlowSwitchDriverFactory.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/OpenFlowSwitchDriverFactory.java
new file mode 100644
index 0000000000..4e84d2878a
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/OpenFlowSwitchDriverFactory.java
@@ -0,0 +1,24 @@
+package org.onlab.onos.of.controller.driver;
+
+import org.onlab.onos.of.controller.Dpid;
+import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFVersion;
+
+/**
+ * Switch factory which returns concrete switch objects for the
+ * physical openflow switch in use.
+ *
+ */
+public interface OpenFlowSwitchDriverFactory {
+
+
+ /**
+ * Constructs the real openflow switch representation.
+ * @param dpid the dpid for this switch.
+ * @param desc its description.
+ * @param ofv the OF version in use
+ * @return the openflow switch representation.
+ */
+ public OpenFlowSwitchDriver getOFSwitchImpl(Dpid dpid,
+ OFDescStatsReply desc, OFVersion ofv);
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/RoleHandler.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/RoleHandler.java
new file mode 100644
index 0000000000..bfded52908
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/RoleHandler.java
@@ -0,0 +1,94 @@
+package org.onlab.onos.of.controller.driver;
+
+import java.io.IOException;
+
+import org.onlab.onos.of.controller.RoleState;
+import org.projectfloodlight.openflow.protocol.OFErrorMsg;
+import org.projectfloodlight.openflow.protocol.OFExperimenter;
+import org.projectfloodlight.openflow.protocol.OFRoleReply;
+
+/**
+ * Role handling.
+ *
+ */
+public interface RoleHandler {
+
+ /**
+ * Extract the role from an OFVendor message.
+ *
+ * Extract the role from an OFVendor message if the message is a
+ * Nicira role reply. Otherwise return null.
+ *
+ * @param experimenterMsg The vendor message to parse.
+ * @return The role in the message if the message is a Nicira role
+ * reply, null otherwise.
+ * @throws SwitchStateException If the message is a Nicira role reply
+ * but the numeric role value is unknown.
+ */
+ public RoleState extractNiciraRoleReply(OFExperimenter experimenterMsg)
+ throws SwitchStateException;
+
+ /**
+ * Send a role request with the given role to the switch and update
+ * the pending request and timestamp.
+ * Sends an OFPT_ROLE_REQUEST to an OF1.3 switch, OR
+ * Sends an NX_ROLE_REQUEST to an OF1.0 switch if configured to support it
+ * in the IOFSwitch driver. If not supported, this method sends nothing
+ * and returns 'false'. The caller should take appropriate action.
+ *
+ * One other optimization we do here is that for OF1.0 switches with
+ * Nicira role message support, we force the Role.EQUAL to become
+ * Role.SLAVE, as there is no defined behavior for the Nicira role OTHER.
+ * We cannot expect it to behave like SLAVE. We don't have this problem with
+ * OF1.3 switches, because Role.EQUAL is well defined and we can simulate
+ * SLAVE behavior by using ASYNC messages.
+ *
+ * @param role
+ * @throws IOException
+ * @return false if and only if the switch does not support role-request
+ * messages, according to the switch driver; true otherwise.
+ */
+ public boolean sendRoleRequest(RoleState role, RoleRecvStatus exp)
+ throws IOException;
+
+ /**
+ * Extract the role information from an OF1.3 Role Reply Message.
+ * @param rrmsg role reply message
+ * @return RoleReplyInfo object
+ * @throws SwitchStateException
+ */
+ public RoleReplyInfo extractOFRoleReply(OFRoleReply rrmsg)
+ throws SwitchStateException;
+
+ /**
+ * Deliver a received role reply.
+ *
+ * Check if a request is pending and if the received reply matches the
+ * the expected pending reply (we check both role and xid) we set
+ * the role for the switch/channel.
+ *
+ * If a request is pending but doesn't match the reply we ignore it, and
+ * return
+ *
+ * If no request is pending we disconnect with a SwitchStateException
+ *
+ * @param rri information about role-reply in format that
+ * controller can understand.
+ * @throws SwitchStateException if no request is pending
+ */
+ public RoleRecvStatus deliverRoleReply(RoleReplyInfo rri)
+ throws SwitchStateException;
+
+
+ /**
+ * Called if we receive an error message. If the xid matches the
+ * pending request we handle it otherwise we ignore it.
+ *
+ * Note: since we only keep the last pending request we might get
+ * error messages for earlier role requests that we won't be able
+ * to handle
+ */
+ public RoleRecvStatus deliverError(OFErrorMsg error)
+ throws SwitchStateException;
+
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/RoleRecvStatus.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/RoleRecvStatus.java
new file mode 100644
index 0000000000..0a109784c8
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/RoleRecvStatus.java
@@ -0,0 +1,37 @@
+package org.onlab.onos.of.controller.driver;
+
+/**
+ * When we remove a pending role request we use this enum to indicate how we
+ * arrived at the decision. When we send a role request to the switch, we
+ * also use this enum to indicate what we expect back from the switch, so the
+ * role changer can match the reply to our expectation.
+ */
+public enum RoleRecvStatus {
+ /** The switch returned an error indicating that roles are not.
+ * supported*/
+ UNSUPPORTED,
+ /** The request timed out. */
+ NO_REPLY,
+ /** The reply was old, there is a newer request pending. */
+ OLD_REPLY,
+ /**
+ * The reply's role matched the role that this controller set in the
+ * request message - invoked either initially at startup or to reassert
+ * current role.
+ */
+ MATCHED_CURRENT_ROLE,
+ /**
+ * The reply's role matched the role that this controller set in the
+ * request message - this is the result of a callback from the
+ * global registry, followed by a role request sent to the switch.
+ */
+ MATCHED_SET_ROLE,
+ /**
+ * The reply's role was a response to the query made by this controller.
+ */
+ REPLY_QUERY,
+ /** We received a role reply message from the switch
+ * but the expectation was unclear, or there was no expectation.
+ */
+ OTHER_EXPECTATION,
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/RoleReplyInfo.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/RoleReplyInfo.java
new file mode 100644
index 0000000000..cc3c483329
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/RoleReplyInfo.java
@@ -0,0 +1,27 @@
+package org.onlab.onos.of.controller.driver;
+
+import org.onlab.onos.of.controller.RoleState;
+import org.projectfloodlight.openflow.types.U64;
+
+/**
+ * Helper class returns role reply information in the format understood
+ * by the controller.
+ */
+public class RoleReplyInfo {
+ private final RoleState role;
+ private final U64 genId;
+ private final long xid;
+
+ public RoleReplyInfo(RoleState role, U64 genId, long xid) {
+ this.role = role;
+ this.genId = genId;
+ this.xid = xid;
+ }
+ public RoleState getRole() { return role; }
+ public U64 getGenId() { return genId; }
+ public long getXid() { return xid; }
+ @Override
+ public String toString() {
+ return "[Role:" + role + " GenId:" + genId + " Xid:" + xid + "]";
+ }
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeAlreadyStarted.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeAlreadyStarted.java
new file mode 100644
index 0000000000..16ed93a177
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeAlreadyStarted.java
@@ -0,0 +1,14 @@
+package org.onlab.onos.of.controller.driver;
+
+/**
+ * Thrown when IOFSwitch.startDriverHandshake() is called more than once.
+ *
+ */
+public class SwitchDriverSubHandshakeAlreadyStarted extends
+ SwitchDriverSubHandshakeException {
+ private static final long serialVersionUID = -5491845708752443501L;
+
+ public SwitchDriverSubHandshakeAlreadyStarted() {
+ super();
+ }
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeCompleted.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeCompleted.java
new file mode 100644
index 0000000000..1c6dac94c2
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeCompleted.java
@@ -0,0 +1,19 @@
+package org.onlab.onos.of.controller.driver;
+
+import org.projectfloodlight.openflow.protocol.OFMessage;
+
+
+/**
+ * Indicates that a message was passed to a switch driver's subhandshake
+ * handling code but the driver has already completed the sub-handshake.
+ *
+ */
+public class SwitchDriverSubHandshakeCompleted
+ extends SwitchDriverSubHandshakeException {
+ private static final long serialVersionUID = -8817822245846375995L;
+
+ public SwitchDriverSubHandshakeCompleted(OFMessage m) {
+ super("Sub-Handshake is already complete but received message "
+ + m.getType());
+ }
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeException.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeException.java
new file mode 100644
index 0000000000..1c9a710c27
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeException.java
@@ -0,0 +1,26 @@
+package org.onlab.onos.of.controller.driver;
+
+/**
+ * Base class for exception thrown by switch driver sub-handshake processing.
+ *
+ */
+public class SwitchDriverSubHandshakeException extends RuntimeException {
+ private static final long serialVersionUID = -6257836781419604438L;
+
+ protected SwitchDriverSubHandshakeException() {
+ super();
+ }
+
+ protected SwitchDriverSubHandshakeException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ protected SwitchDriverSubHandshakeException(String arg0) {
+ super(arg0);
+ }
+
+ protected SwitchDriverSubHandshakeException(Throwable arg0) {
+ super(arg0);
+ }
+
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeNotStarted.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeNotStarted.java
new file mode 100644
index 0000000000..0f34b0ed18
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeNotStarted.java
@@ -0,0 +1,15 @@
+package org.onlab.onos.of.controller.driver;
+
+/**
+ * Thrown when a switch driver's sub-handshake has not been started but an
+ * operation requiring the sub-handshake has been attempted.
+ *
+ */
+public class SwitchDriverSubHandshakeNotStarted extends
+ SwitchDriverSubHandshakeException {
+ private static final long serialVersionUID = -5491845708752443501L;
+
+ public SwitchDriverSubHandshakeNotStarted() {
+ super();
+ }
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeStateException.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeStateException.java
new file mode 100644
index 0000000000..09e737eba7
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchDriverSubHandshakeStateException.java
@@ -0,0 +1,15 @@
+package org.onlab.onos.of.controller.driver;
+
+/**
+ * Thrown when a switch driver's sub-handshake state-machine receives an
+ * unexpected OFMessage and/or is in an invald state.
+ *
+ */
+public class SwitchDriverSubHandshakeStateException extends
+ SwitchDriverSubHandshakeException {
+ private static final long serialVersionUID = -8249926069195147051L;
+
+ public SwitchDriverSubHandshakeStateException(String msg) {
+ super(msg);
+ }
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchStateException.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchStateException.java
new file mode 100644
index 0000000000..55b12de89d
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/SwitchStateException.java
@@ -0,0 +1,50 @@
+/**
+ * Copyright 2011, Big Switch Networks, Inc.
+ * Originally created by David Erickson, Stanford University
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ **/
+
+package org.onlab.onos.of.controller.driver;
+
+/**
+ * This exception indicates an error or unexpected message during
+ * message handling. E.g., if an OFMessage is received that is illegal or
+ * unexpected given the current handshake state.
+ *
+ * We don't allow wrapping other exception in a switch state exception. We
+ * only log the SwitchStateExceptions message so the causing exceptions
+ * stack trace is generally not available.
+ *
+ */
+public class SwitchStateException extends Exception {
+
+ private static final long serialVersionUID = 9153954512470002631L;
+
+ public SwitchStateException() {
+ super();
+ }
+
+ public SwitchStateException(String arg0, Throwable arg1) {
+ super(arg0, arg1);
+ }
+
+ public SwitchStateException(String arg0) {
+ super(arg0);
+ }
+
+ public SwitchStateException(Throwable arg0) {
+ super(arg0);
+ }
+
+}
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/package-info.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/package-info.java
new file mode 100644
index 0000000000..f64ba6c682
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/driver/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * OpenFlow controller switch driver API.
+ */
+package org.onlab.onos.of.controller.driver;
diff --git a/openflow/api/src/main/java/org/onlab/onos/of/controller/package-info.java b/openflow/api/src/main/java/org/onlab/onos/of/controller/package-info.java
new file mode 100644
index 0000000000..888bcce464
--- /dev/null
+++ b/openflow/api/src/main/java/org/onlab/onos/of/controller/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * OpenFlow controller API.
+ */
+package org.onlab.onos.of.controller;
diff --git a/openflow/api/src/test/java/org/onlab/onos/of/controller/OpenflowControllerAdapter.java b/openflow/api/src/test/java/org/onlab/onos/of/controller/OpenflowControllerAdapter.java
new file mode 100644
index 0000000000..09c0fbe448
--- /dev/null
+++ b/openflow/api/src/test/java/org/onlab/onos/of/controller/OpenflowControllerAdapter.java
@@ -0,0 +1,66 @@
+package org.onlab.onos.of.controller;
+
+import org.projectfloodlight.openflow.protocol.OFMessage;
+
+/**
+ * Test adapter for the OpenFlow controller interface.
+ */
+public class OpenflowControllerAdapter implements OpenFlowController {
+ @Override
+ public Iterable getSwitches() {
+ return null;
+ }
+
+ @Override
+ public Iterable getMasterSwitches() {
+ return null;
+ }
+
+ @Override
+ public Iterable getEqualSwitches() {
+ return null;
+ }
+
+ @Override
+ public OpenFlowSwitch getSwitch(Dpid dpid) {
+ return null;
+ }
+
+ @Override
+ public OpenFlowSwitch getMasterSwitch(Dpid dpid) {
+ return null;
+ }
+
+ @Override
+ public OpenFlowSwitch getEqualSwitch(Dpid dpid) {
+ return null;
+ }
+
+ @Override
+ public void addListener(OpenFlowSwitchListener listener) {
+ }
+
+ @Override
+ public void removeListener(OpenFlowSwitchListener listener) {
+ }
+
+ @Override
+ public void addPacketListener(int priority, PacketListener listener) {
+ }
+
+ @Override
+ public void removePacketListener(PacketListener listener) {
+ }
+
+ @Override
+ public void write(Dpid dpid, OFMessage msg) {
+ }
+
+ @Override
+ public void processPacket(Dpid dpid, OFMessage msg) {
+ }
+
+ @Override
+ public void setRole(Dpid dpid, RoleState role) {
+ }
+}
diff --git a/openflow/ctl/pom.xml b/openflow/ctl/pom.xml
new file mode 100644
index 0000000000..88bdcd91fd
--- /dev/null
+++ b/openflow/ctl/pom.xml
@@ -0,0 +1,122 @@
+
+ 4.0.0
+
+
+ org.onlab.onos
+ onos-of
+ 1.0.0-SNAPSHOT
+ ../pom.xml
+
+
+ onos-of-ctl
+ bundle
+
+ ONOS OpenFlow controller subsystem API
+
+
+ UTF-8
+ 1.5.5
+ 2.1.4
+ 2.6
+
+ 3.0.0
+ 3.0.0
+ Max
+ ${project.basedir}/conf/findbugs/exclude.xml
+
+ 2.12
+
+ 3.0.2
+ 2.16
+
+
+
+
+ org.onlab.onos
+ onos-of-api
+
+
+
+ org.apache.felix
+ org.apache.felix.scr.annotations
+ 1.9.6
+
+
+ ch.qos.logback
+ logback-classic
+ 1.1.2
+
+
+ ch.qos.logback
+ logback-core
+ 1.1.2
+
+
+ org.slf4j
+ slf4j-api
+ 1.7.5
+
+
+
+ com.google.code.findbugs
+ annotations
+ ${findbugs.version}
+
+
+ org.projectfloodlight
+ openflowj
+ 0.3.8-SNAPSHOT
+
+
+
+
+ io.netty
+ netty
+ 3.9.2.Final
+
+
+
+ junit
+ junit
+ 4.11
+ test
+
+
+ org.easymock
+ easymock
+ 3.2
+ test
+
+
+ org.powermock
+ powermock-module-junit4
+ ${powermock.version}
+ test
+
+
+ org.powermock
+ powermock-api-easymock
+ ${powermock.version}
+ test
+
+
+
+
+
+
+
+ org.apache.felix
+ maven-scr-plugin
+
+
+
+
+
+
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/Controller.java b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/Controller.java
new file mode 100644
index 0000000000..061f5bf2ef
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/Controller.java
@@ -0,0 +1,227 @@
+/**
+ * Copyright 2011, Big Switch Networks, Inc.
+ * Originally created by David Erickson, Stanford University
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ **/
+
+package org.onlab.onos.of.controller.impl;
+
+import java.lang.management.ManagementFactory;
+import java.lang.management.RuntimeMXBean;
+import java.net.InetSocketAddress;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.concurrent.Executors;
+
+import org.jboss.netty.bootstrap.ServerBootstrap;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.channel.group.ChannelGroup;
+import org.jboss.netty.channel.group.DefaultChannelGroup;
+import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;
+import org.onlab.onos.of.controller.Dpid;
+import org.onlab.onos.of.controller.driver.OpenFlowAgent;
+import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriver;
+import org.onlab.onos.of.drivers.impl.DriverManager;
+import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFFactories;
+import org.projectfloodlight.openflow.protocol.OFFactory;
+import org.projectfloodlight.openflow.protocol.OFVersion;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * The main controller class. Handles all setup and network listeners
+ * - Distributed ownership control of switch through IControllerRegistryService
+ */
+public class Controller {
+
+ protected static final Logger log = LoggerFactory.getLogger(Controller.class);
+ static final String ERROR_DATABASE =
+ "The controller could not communicate with the system database.";
+ protected static final OFFactory FACTORY13 = OFFactories.getFactory(OFVersion.OF_13);
+ protected static final OFFactory FACTORY10 = OFFactories.getFactory(OFVersion.OF_10);
+
+ // The controllerNodeIPsCache maps Controller IDs to their IP address.
+ // It's only used by handleControllerNodeIPsChanged
+ protected HashMap controllerNodeIPsCache;
+
+ private ChannelGroup cg;
+
+ // Configuration options
+ protected int openFlowPort = 6633;
+ protected int workerThreads = 0;
+
+ // Start time of the controller
+ protected long systemStartTime;
+
+ private OpenFlowAgent agent;
+
+ private NioServerSocketChannelFactory execFactory;
+
+ // Perf. related configuration
+ protected static final int SEND_BUFFER_SIZE = 4 * 1024 * 1024;
+
+ // ***************
+ // Getters/Setters
+ // ***************
+
+ public OFFactory getOFMessageFactory10() {
+ return FACTORY10;
+ }
+
+
+ public OFFactory getOFMessageFactory13() {
+ return FACTORY13;
+ }
+
+
+
+ public Map getControllerNodeIPs() {
+ // We return a copy of the mapping so we can guarantee that
+ // the mapping return is the same as one that will be (or was)
+ // dispatched to IHAListeners
+ HashMap retval = new HashMap();
+ synchronized (controllerNodeIPsCache) {
+ retval.putAll(controllerNodeIPsCache);
+ }
+ return retval;
+ }
+
+
+ public long getSystemStartTime() {
+ return (this.systemStartTime);
+ }
+
+ // **************
+ // Initialization
+ // **************
+
+ /**
+ * Tell controller that we're ready to accept switches loop.
+ */
+ public void run() {
+
+ try {
+ final ServerBootstrap bootstrap = createServerBootStrap();
+
+ bootstrap.setOption("reuseAddr", true);
+ bootstrap.setOption("child.keepAlive", true);
+ bootstrap.setOption("child.tcpNoDelay", true);
+ bootstrap.setOption("child.sendBufferSize", Controller.SEND_BUFFER_SIZE);
+
+ ChannelPipelineFactory pfact =
+ new OpenflowPipelineFactory(this, null);
+ bootstrap.setPipelineFactory(pfact);
+ InetSocketAddress sa = new InetSocketAddress(openFlowPort);
+ cg = new DefaultChannelGroup();
+ cg.add(bootstrap.bind(sa));
+
+ log.info("Listening for switch connections on {}", sa);
+ } catch (Exception e) {
+ throw new RuntimeException(e);
+ }
+
+ }
+
+ private ServerBootstrap createServerBootStrap() {
+
+ if (workerThreads == 0) {
+ execFactory = new NioServerSocketChannelFactory(
+ Executors.newCachedThreadPool(),
+ Executors.newCachedThreadPool());
+ return new ServerBootstrap(execFactory);
+ } else {
+ execFactory = new NioServerSocketChannelFactory(
+ Executors.newCachedThreadPool(),
+ Executors.newCachedThreadPool(), workerThreads);
+ return new ServerBootstrap(execFactory);
+ }
+ }
+
+ public void setConfigParams(Map configParams) {
+ String ofPort = configParams.get("openflowport");
+ if (ofPort != null) {
+ this.openFlowPort = Integer.parseInt(ofPort);
+ }
+ log.debug("OpenFlow port set to {}", this.openFlowPort);
+ String threads = configParams.get("workerthreads");
+ if (threads != null) {
+ this.workerThreads = Integer.parseInt(threads);
+ }
+ log.debug("Number of worker threads set to {}", this.workerThreads);
+ }
+
+
+ /**
+ * Initialize internal data structures.
+ */
+ public void init(Map configParams) {
+ // These data structures are initialized here because other
+ // module's startUp() might be called before ours
+ this.controllerNodeIPsCache = new HashMap();
+
+ setConfigParams(configParams);
+ this.systemStartTime = System.currentTimeMillis();
+
+
+ }
+
+ // **************
+ // Utility methods
+ // **************
+
+ public Map getMemory() {
+ Map m = new HashMap();
+ Runtime runtime = Runtime.getRuntime();
+ m.put("total", runtime.totalMemory());
+ m.put("free", runtime.freeMemory());
+ return m;
+ }
+
+
+ public Long getUptime() {
+ RuntimeMXBean rb = ManagementFactory.getRuntimeMXBean();
+ return rb.getUptime();
+ }
+
+ /**
+ * Forward to the driver-manager to get an IOFSwitch instance.
+ * @param desc
+ * @return switch instance
+ */
+ protected OpenFlowSwitchDriver getOFSwitchInstance(long dpid,
+ OFDescStatsReply desc, OFVersion ofv) {
+ OpenFlowSwitchDriver sw = DriverManager.getSwitch(new Dpid(dpid),
+ desc, ofv);
+ sw.setAgent(agent);
+ sw.setRoleHandler(new RoleManager(sw));
+ return sw;
+ }
+
+ public void start(OpenFlowAgent ag) {
+ log.info("Starting OpenFlow IO");
+ this.agent = ag;
+ this.init(new HashMap());
+ this.run();
+ }
+
+
+ public void stop() {
+ log.info("Stopping OpenFlow IO");
+ execFactory.shutdown();
+ cg.close();
+ }
+
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/HandshakeTimeoutException.java b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/HandshakeTimeoutException.java
new file mode 100644
index 0000000000..f3eac5fda5
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/HandshakeTimeoutException.java
@@ -0,0 +1,29 @@
+/**
+ * Copyright 2011, Big Switch Networks, Inc.
+ * Originally created by David Erickson, Stanford University
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ **/
+
+package org.onlab.onos.of.controller.impl;
+
+/**
+ * Exception is thrown when the handshake fails to complete.
+ * before a specified time
+ *
+ */
+public class HandshakeTimeoutException extends Exception {
+
+ private static final long serialVersionUID = 6859880268940337312L;
+
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/HandshakeTimeoutHandler.java b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/HandshakeTimeoutHandler.java
new file mode 100644
index 0000000000..de7853a074
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/HandshakeTimeoutHandler.java
@@ -0,0 +1,94 @@
+/**
+* Copyright 2011, Big Switch Networks, Inc.
+* Originally created by David Erickson, Stanford University
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may
+* not use this file except in compliance with the License. You may obtain
+* a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations
+* under the License.
+**/
+
+package org.onlab.onos.of.controller.impl;
+
+import java.util.concurrent.TimeUnit;
+
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelStateEvent;
+import org.jboss.netty.channel.Channels;
+import org.jboss.netty.channel.SimpleChannelUpstreamHandler;
+import org.jboss.netty.util.Timeout;
+import org.jboss.netty.util.Timer;
+import org.jboss.netty.util.TimerTask;
+
+/**
+ * Trigger a timeout if a switch fails to complete handshake soon enough.
+ */
+public class HandshakeTimeoutHandler
+ extends SimpleChannelUpstreamHandler {
+ static final HandshakeTimeoutException EXCEPTION =
+ new HandshakeTimeoutException();
+
+ final OFChannelHandler channelHandler;
+ final Timer timer;
+ final long timeoutNanos;
+ volatile Timeout timeout;
+
+ public HandshakeTimeoutHandler(OFChannelHandler channelHandler,
+ Timer timer,
+ long timeoutSeconds) {
+ super();
+ this.channelHandler = channelHandler;
+ this.timer = timer;
+ this.timeoutNanos = TimeUnit.SECONDS.toNanos(timeoutSeconds);
+
+ }
+
+ @Override
+ public void channelOpen(ChannelHandlerContext ctx, ChannelStateEvent e)
+ throws Exception {
+ if (timeoutNanos > 0) {
+ timeout = timer.newTimeout(new HandshakeTimeoutTask(ctx),
+ timeoutNanos, TimeUnit.NANOSECONDS);
+ }
+ ctx.sendUpstream(e);
+ }
+
+ @Override
+ public void channelClosed(ChannelHandlerContext ctx, ChannelStateEvent e)
+ throws Exception {
+ if (timeout != null) {
+ timeout.cancel();
+ timeout = null;
+ }
+ }
+
+ private final class HandshakeTimeoutTask implements TimerTask {
+
+ private final ChannelHandlerContext ctx;
+
+ HandshakeTimeoutTask(ChannelHandlerContext ctx) {
+ this.ctx = ctx;
+ }
+
+ @Override
+ public void run(Timeout t) throws Exception {
+ if (t.isCancelled()) {
+ return;
+ }
+
+ if (!ctx.getChannel().isOpen()) {
+ return;
+ }
+ if (!channelHandler.isHandshakeComplete()) {
+ Channels.fireExceptionCaught(ctx, EXCEPTION);
+ }
+ }
+ }
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFChannelHandler.java b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFChannelHandler.java
new file mode 100644
index 0000000000..adcb9904d6
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFChannelHandler.java
@@ -0,0 +1,1225 @@
+//CHECKSTYLE:OFF
+package org.onlab.onos.of.controller.impl;
+
+import java.io.IOException;
+import java.nio.channels.ClosedChannelException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
+import java.util.concurrent.RejectedExecutionException;
+
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.channel.ChannelStateEvent;
+import org.jboss.netty.channel.ExceptionEvent;
+import org.jboss.netty.channel.MessageEvent;
+import org.jboss.netty.handler.timeout.IdleStateAwareChannelHandler;
+import org.jboss.netty.handler.timeout.IdleStateEvent;
+import org.jboss.netty.handler.timeout.ReadTimeoutException;
+import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriver;
+import org.onlab.onos.of.controller.driver.SwitchStateException;
+import org.projectfloodlight.openflow.exceptions.OFParseError;
+import org.projectfloodlight.openflow.protocol.OFAsyncGetReply;
+import org.projectfloodlight.openflow.protocol.OFBadRequestCode;
+import org.projectfloodlight.openflow.protocol.OFBarrierReply;
+import org.projectfloodlight.openflow.protocol.OFBarrierRequest;
+import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFDescStatsRequest;
+import org.projectfloodlight.openflow.protocol.OFEchoReply;
+import org.projectfloodlight.openflow.protocol.OFEchoRequest;
+import org.projectfloodlight.openflow.protocol.OFErrorMsg;
+import org.projectfloodlight.openflow.protocol.OFErrorType;
+import org.projectfloodlight.openflow.protocol.OFExperimenter;
+import org.projectfloodlight.openflow.protocol.OFFactory;
+import org.projectfloodlight.openflow.protocol.OFFeaturesReply;
+import org.projectfloodlight.openflow.protocol.OFFlowModFailedCode;
+import org.projectfloodlight.openflow.protocol.OFFlowRemoved;
+import org.projectfloodlight.openflow.protocol.OFGetConfigReply;
+import org.projectfloodlight.openflow.protocol.OFGetConfigRequest;
+import org.projectfloodlight.openflow.protocol.OFHello;
+import org.projectfloodlight.openflow.protocol.OFHelloElem;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFPacketIn;
+import org.projectfloodlight.openflow.protocol.OFPortDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFPortDescStatsRequest;
+import org.projectfloodlight.openflow.protocol.OFPortStatus;
+import org.projectfloodlight.openflow.protocol.OFQueueGetConfigReply;
+import org.projectfloodlight.openflow.protocol.OFRoleReply;
+import org.projectfloodlight.openflow.protocol.OFSetConfig;
+import org.projectfloodlight.openflow.protocol.OFStatsReply;
+import org.projectfloodlight.openflow.protocol.OFStatsReplyFlags;
+import org.projectfloodlight.openflow.protocol.OFStatsType;
+import org.projectfloodlight.openflow.protocol.OFType;
+import org.projectfloodlight.openflow.protocol.OFVersion;
+import org.projectfloodlight.openflow.protocol.errormsg.OFBadRequestErrorMsg;
+import org.projectfloodlight.openflow.protocol.errormsg.OFFlowModFailedErrorMsg;
+import org.projectfloodlight.openflow.types.U32;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * Channel handler deals with the switch connection and dispatches
+ * switch messages to the appropriate locations.
+ */
+class OFChannelHandler extends IdleStateAwareChannelHandler {
+ private static final Logger log = LoggerFactory.getLogger(OFChannelHandler.class);
+ private final Controller controller;
+ private OpenFlowSwitchDriver sw;
+ private long thisdpid; // channelHandler cached value of connected switch id
+ private Channel channel;
+ // State needs to be volatile because the HandshakeTimeoutHandler
+ // needs to check if the handshake is complete
+ private volatile ChannelState state;
+
+ // When a switch with a duplicate dpid is found (i.e we already have a
+ // connected switch with the same dpid), the new switch is immediately
+ // disconnected. At that point netty callsback channelDisconnected() which
+ // proceeds to cleaup switch state - we need to ensure that it does not cleanup
+ // switch state for the older (still connected) switch
+ private volatile Boolean duplicateDpidFound;
+
+ // Temporary storage for switch-features and port-description
+ private OFFeaturesReply featuresReply;
+ private OFPortDescStatsReply portDescReply;
+ // a concurrent ArrayList to temporarily store port status messages
+ // before we are ready to deal with them
+ private final CopyOnWriteArrayList pendingPortStatusMsg;
+
+ //Indicates the openflow version used by this switch
+ protected OFVersion ofVersion;
+ protected OFFactory factory13;
+ protected OFFactory factory10;
+
+ /** transaction Ids to use during handshake. Since only one thread
+ * calls into an OFChannelHandler instance, we don't need atomic.
+ * We will count down
+ */
+ private int handshakeTransactionIds = -1;
+
+ /**
+ * Create a new unconnected OFChannelHandler.
+ * @param controller
+ */
+ OFChannelHandler(Controller controller) {
+ this.controller = controller;
+ this.state = ChannelState.INIT;
+ this.pendingPortStatusMsg = new CopyOnWriteArrayList();
+ factory13 = controller.getOFMessageFactory13();
+ factory10 = controller.getOFMessageFactory10();
+ duplicateDpidFound = Boolean.FALSE;
+ }
+
+
+
+ // XXX S consider if necessary
+ public void disconnectSwitch() {
+ sw.disconnectSwitch();
+ }
+
+
+
+ //*************************
+ // Channel State Machine
+ //*************************
+
+ /**
+ * The state machine for handling the switch/channel state. All state
+ * transitions should happen from within the state machine (and not from other
+ * parts of the code)
+ */
+ enum ChannelState {
+ /**
+ * Initial state before channel is connected.
+ */
+ INIT(false) {
+ @Override
+ void processOFMessage(OFChannelHandler h, OFMessage m)
+ throws IOException, SwitchStateException {
+ illegalMessageReceived(h, m);
+ }
+
+ @Override
+ void processOFError(OFChannelHandler h, OFErrorMsg m)
+ throws IOException {
+ // need to implement since its abstract but it will never
+ // be called
+ }
+
+ @Override
+ void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
+ throws IOException {
+ unhandledMessageReceived(h, m);
+ }
+ },
+
+ /**
+ * We send a OF 1.3 HELLO to the switch and wait for a Hello from the switch.
+ * Once we receive the reply, we decide on OF 1.3 or 1.0 switch - no other
+ * protocol version is accepted.
+ * We send an OFFeaturesRequest depending on the protocol version selected
+ * Next state is WAIT_FEATURES_REPLY
+ */
+ WAIT_HELLO(false) {
+ @Override
+ void processOFHello(OFChannelHandler h, OFHello m)
+ throws IOException {
+ // TODO We could check for the optional bitmap, but for now
+ // we are just checking the version number.
+ if (m.getVersion() == OFVersion.OF_13) {
+ log.info("Received {} Hello from {}", m.getVersion(),
+ h.channel.getRemoteAddress());
+ h.ofVersion = OFVersion.OF_13;
+ } else if (m.getVersion() == OFVersion.OF_10) {
+ log.info("Received {} Hello from {} - switching to OF "
+ + "version 1.0", m.getVersion(),
+ h.channel.getRemoteAddress());
+ h.ofVersion = OFVersion.OF_10;
+ } else {
+ log.error("Received Hello of version {} from switch at {}. "
+ + "This controller works with OF1.0 and OF1.3 "
+ + "switches. Disconnecting switch ...",
+ m.getVersion(), h.channel.getRemoteAddress());
+ h.channel.disconnect();
+ return;
+ }
+ h.sendHandshakeFeaturesRequestMessage();
+ h.setState(WAIT_FEATURES_REPLY);
+ }
+ @Override
+ void processOFFeaturesReply(OFChannelHandler h, OFFeaturesReply m)
+ throws IOException, SwitchStateException {
+ illegalMessageReceived(h, m);
+ }
+ @Override
+ void processOFStatisticsReply(OFChannelHandler h,
+ OFStatsReply m)
+ throws IOException, SwitchStateException {
+ illegalMessageReceived(h, m);
+ }
+ @Override
+ void processOFError(OFChannelHandler h, OFErrorMsg m) {
+ logErrorDisconnect(h, m);
+ }
+
+ @Override
+ void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
+ throws IOException {
+ unhandledMessageReceived(h, m);
+ }
+ },
+
+
+ /**
+ * We are waiting for a features reply message. Once we receive it, the
+ * behavior depends on whether this is a 1.0 or 1.3 switch. For 1.0,
+ * we send a SetConfig request, barrier, and GetConfig request and the
+ * next state is WAIT_CONFIG_REPLY. For 1.3, we send a Port description
+ * request and the next state is WAIT_PORT_DESC_REPLY.
+ */
+ WAIT_FEATURES_REPLY(false) {
+ @Override
+ void processOFFeaturesReply(OFChannelHandler h, OFFeaturesReply m)
+ throws IOException {
+ h.thisdpid = m.getDatapathId().getLong();
+ log.info("Received features reply for switch at {} with dpid {}",
+ h.getSwitchInfoString(), h.thisdpid);
+
+ h.featuresReply = m; //temp store
+ if (h.ofVersion == OFVersion.OF_10) {
+ h.sendHandshakeSetConfig();
+ h.setState(WAIT_CONFIG_REPLY);
+ } else {
+ //version is 1.3, must get switchport information
+ h.sendHandshakeOFPortDescRequest();
+ h.setState(WAIT_PORT_DESC_REPLY);
+ }
+ }
+ @Override
+ void processOFStatisticsReply(OFChannelHandler h,
+ OFStatsReply m)
+ throws IOException, SwitchStateException {
+ illegalMessageReceived(h, m);
+ }
+ @Override
+ void processOFError(OFChannelHandler h, OFErrorMsg m) {
+ logErrorDisconnect(h, m);
+ }
+
+ @Override
+ void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
+ throws IOException {
+ unhandledMessageReceived(h, m);
+ }
+ },
+
+ /**
+ * We are waiting for a description of the 1.3 switch ports.
+ * Once received, we send a SetConfig request
+ * Next State is WAIT_CONFIG_REPLY
+ */
+ WAIT_PORT_DESC_REPLY(false) {
+
+ @Override
+ void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
+ throws SwitchStateException {
+ // Read port description
+ if (m.getStatsType() != OFStatsType.PORT_DESC) {
+ log.warn("Expecting port description stats but received stats "
+ + "type {} from {}. Ignoring ...", m.getStatsType(),
+ h.channel.getRemoteAddress());
+ return;
+ }
+ if (m.getFlags().contains(OFStatsReplyFlags.REPLY_MORE)) {
+ log.warn("Stats reply indicates more stats from sw {} for "
+ + "port description - not currently handled",
+ h.getSwitchInfoString());
+ }
+ h.portDescReply = (OFPortDescStatsReply) m; // temp store
+ log.info("Received port desc reply for switch at {}",
+ h.getSwitchInfoString());
+ try {
+ h.sendHandshakeSetConfig();
+ } catch (IOException e) {
+ log.error("Unable to send setConfig after PortDescReply. "
+ + "Error: {}", e.getMessage());
+ }
+ h.setState(WAIT_CONFIG_REPLY);
+ }
+
+ @Override
+ void processOFError(OFChannelHandler h, OFErrorMsg m)
+ throws IOException, SwitchStateException {
+ logErrorDisconnect(h, m);
+
+ }
+
+ @Override
+ void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
+ throws IOException, SwitchStateException {
+ unhandledMessageReceived(h, m);
+
+ }
+ },
+
+ /**
+ * We are waiting for a config reply message. Once we receive it
+ * we send a DescriptionStatsRequest to the switch.
+ * Next state: WAIT_DESCRIPTION_STAT_REPLY
+ */
+ WAIT_CONFIG_REPLY(false) {
+ @Override
+ void processOFGetConfigReply(OFChannelHandler h, OFGetConfigReply m)
+ throws IOException {
+ if (m.getMissSendLen() == 0xffff) {
+ log.trace("Config Reply from switch {} confirms "
+ + "miss length set to 0xffff",
+ h.getSwitchInfoString());
+ } else {
+ // FIXME: we can't really deal with switches that don't send
+ // full packets. Shouldn't we drop the connection here?
+ log.warn("Config Reply from switch {} has"
+ + "miss length set to {}",
+ h.getSwitchInfoString(),
+ m.getMissSendLen());
+ }
+ h.sendHandshakeDescriptionStatsRequest();
+ h.setState(WAIT_DESCRIPTION_STAT_REPLY);
+ }
+
+ @Override
+ void processOFBarrierReply(OFChannelHandler h, OFBarrierReply m) {
+ // do nothing;
+ }
+
+ @Override
+ void processOFFeaturesReply(OFChannelHandler h, OFFeaturesReply m)
+ throws IOException, SwitchStateException {
+ illegalMessageReceived(h, m);
+ }
+ @Override
+ void processOFStatisticsReply(OFChannelHandler h,
+ OFStatsReply m)
+ throws IOException, SwitchStateException {
+ log.error("Received multipart(stats) message sub-type {}",
+ m.getStatsType());
+ illegalMessageReceived(h, m);
+ }
+
+ @Override
+ void processOFError(OFChannelHandler h, OFErrorMsg m) {
+ logErrorDisconnect(h, m);
+ }
+
+ @Override
+ void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
+ throws IOException {
+ h.pendingPortStatusMsg.add(m);
+ }
+ },
+
+
+ /**
+ * We are waiting for a OFDescriptionStat message from the switch.
+ * Once we receive any stat message we try to parse it. If it's not
+ * a description stats message we disconnect. If its the expected
+ * description stats message, we:
+ * - use the switch driver to bind the switch and get an IOFSwitch instance
+ * - setup the IOFSwitch instance
+ * - add switch controller and send the initial role
+ * request to the switch.
+ * Next state: WAIT_INITIAL_ROLE
+ * In the typical case, where switches support role request messages
+ * the next state is where we expect the role reply message.
+ * In the special case that where the switch does not support any kind
+ * of role request messages, we don't send a role message, but we do
+ * request mastership from the registry service. This controller
+ * should become master once we hear back from the registry service.
+ * All following states will have a h.sw instance!
+ */
+ WAIT_DESCRIPTION_STAT_REPLY(false) {
+ @Override
+ void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
+ throws SwitchStateException {
+ // Read description, if it has been updated
+ if (m.getStatsType() != OFStatsType.DESC) {
+ log.warn("Expecting Description stats but received stats "
+ + "type {} from {}. Ignoring ...", m.getStatsType(),
+ h.channel.getRemoteAddress());
+ return;
+ }
+ log.info("Received switch description reply from switch at {}",
+ h.channel.getRemoteAddress());
+ OFDescStatsReply drep = (OFDescStatsReply) m;
+ // Here is where we differentiate between different kinds of switches
+ h.sw = h.controller.getOFSwitchInstance(h.thisdpid, drep, h.ofVersion);
+
+ h.sw.setOFVersion(h.ofVersion);
+ h.sw.setFeaturesReply(h.featuresReply);
+ h.sw.setPortDescReply(h.portDescReply);
+ h.sw.setConnected(true);
+ h.sw.setChannel(h.channel);
+ boolean success = h.sw.connectSwitch();
+
+ if (!success) {
+ disconnectDuplicate(h);
+ return;
+ }
+ // set switch information
+
+
+
+ log.info("Switch {} bound to class {}, description {}",
+ new Object[] {h.sw, h.sw.getClass(), drep });
+ //Put switch in EQUAL mode until we hear back from the global registry
+ //log.debug("Setting new switch {} to EQUAL and sending Role request",
+ // h.sw.getStringId());
+ //h.sw.activateEqualSwitch();
+ //h.setSwitchRole(RoleState.EQUAL);
+
+ h.sw.startDriverHandshake();
+ h.setState(WAIT_SWITCH_DRIVER_SUB_HANDSHAKE);
+
+ }
+
+ @Override
+ void processOFError(OFChannelHandler h, OFErrorMsg m) {
+ logErrorDisconnect(h, m);
+ }
+
+ @Override
+ void processOFFeaturesReply(OFChannelHandler h, OFFeaturesReply m)
+ throws IOException, SwitchStateException {
+ illegalMessageReceived(h, m);
+ }
+
+ @Override
+ void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
+ throws IOException {
+ h.pendingPortStatusMsg.add(m);
+ }
+ },
+
+
+ /**
+ * We are waiting for the respective switch driver to complete its
+ * configuration. Notice that we do not consider this to be part of the main
+ * switch-controller handshake. But we do consider it as a step that comes
+ * before we declare the switch as available to the controller.
+ * Next State: depends on the role of this controller for this switch - either
+ * MASTER or EQUAL.
+ */
+ WAIT_SWITCH_DRIVER_SUB_HANDSHAKE(true) {
+
+ @Override
+ void processOFError(OFChannelHandler h, OFErrorMsg m)
+ throws IOException {
+ // will never be called. We override processOFMessage
+ }
+
+ @Override
+ void processOFMessage(OFChannelHandler h, OFMessage m)
+ throws IOException, SwitchStateException {
+ if (m.getType() == OFType.ECHO_REQUEST) {
+ processOFEchoRequest(h, (OFEchoRequest) m);
+ } else if (m.getType() == OFType.ROLE_REPLY) {
+ h.sw.handleRole(m);
+ } else if (m.getType() == OFType.ERROR) {
+ if (!h.sw.handleRoleError((OFErrorMsg)m)) {
+ h.sw.processDriverHandshakeMessage(m);
+ if (h.sw.isDriverHandshakeComplete()) {
+ h.setState(ACTIVE);
+ }
+ }
+ } else {
+ if (m.getType() == OFType.EXPERIMENTER &&
+ ((OFExperimenter) m).getExperimenter() ==
+ RoleManager.NICIRA_EXPERIMENTER) {
+ h.sw.handleNiciraRole(m);
+ } else {
+ h.sw.processDriverHandshakeMessage(m);
+ if (h.sw.isDriverHandshakeComplete()) {
+ h.setState(ACTIVE);
+ }
+ }
+ }
+ }
+
+ @Override
+ void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
+ throws IOException, SwitchStateException {
+ h.pendingPortStatusMsg.add(m);
+ }
+ },
+
+
+ /**
+ * This controller is in MASTER role for this switch. We enter this state
+ * after requesting and winning control from the global registry.
+ * The main handshake as well as the switch-driver sub-handshake
+ * is complete at this point.
+ * // XXX S reconsider below
+ * In the (near) future we may deterministically assign controllers to
+ * switches at startup.
+ * We only leave this state if the switch disconnects or
+ * if we send a role request for SLAVE /and/ receive the role reply for
+ * SLAVE.
+ */
+ ACTIVE(true) {
+ @Override
+ void processOFError(OFChannelHandler h, OFErrorMsg m)
+ throws IOException, SwitchStateException {
+ // if we get here, then the error message is for something else
+ if (m.getErrType() == OFErrorType.BAD_REQUEST &&
+ ((OFBadRequestErrorMsg) m).getCode() ==
+ OFBadRequestCode.EPERM) {
+ // We are the master controller and the switch returned
+ // a permission error. This is a likely indicator that
+ // the switch thinks we are slave. Reassert our
+ // role
+ // FIXME: this could be really bad during role transitions
+ // if two controllers are master (even if its only for
+ // a brief period). We might need to see if these errors
+ // persist before we reassert
+ log.warn("Received permission error from switch {} while" +
+ "being master. Reasserting master role.",
+ h.getSwitchInfoString());
+ h.sw.reassertRole();
+ } else if (m.getErrType() == OFErrorType.FLOW_MOD_FAILED &&
+ ((OFFlowModFailedErrorMsg) m).getCode() ==
+ OFFlowModFailedCode.ALL_TABLES_FULL) {
+ h.sw.setTableFull(true);
+ } else {
+ logError(h, m);
+ }
+ h.dispatchMessage(m);
+ }
+
+ @Override
+ void processOFStatisticsReply(OFChannelHandler h,
+ OFStatsReply m) {
+ h.dispatchMessage(m);
+ }
+
+ @Override
+ void processOFExperimenter(OFChannelHandler h, OFExperimenter m)
+ throws SwitchStateException {
+ h.sw.handleNiciraRole(m);
+ }
+
+ @Override
+ void processOFRoleReply(OFChannelHandler h, OFRoleReply m)
+ throws SwitchStateException {
+ h.sw.handleRole(m);
+ }
+
+ @Override
+ void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
+ throws SwitchStateException {
+ handlePortStatusMessage(h, m, true);
+ h.dispatchMessage(m);
+ }
+
+ @Override
+ void processOFPacketIn(OFChannelHandler h, OFPacketIn m) {
+ h.dispatchMessage(m);
+ }
+
+ @Override
+ void processOFFlowRemoved(OFChannelHandler h,
+ OFFlowRemoved m) {
+ h.dispatchMessage(m);
+ }
+
+ @Override
+ void processOFBarrierReply(OFChannelHandler h, OFBarrierReply m) {
+ h.dispatchMessage(m);
+ }
+
+ };
+
+ private final boolean handshakeComplete;
+ ChannelState(boolean handshakeComplete) {
+ this.handshakeComplete = handshakeComplete;
+ }
+
+ /**
+ * Is this a state in which the handshake has completed?
+ * @return true if the handshake is complete
+ */
+ public boolean isHandshakeComplete() {
+ return handshakeComplete;
+ }
+
+ /**
+ * Get a string specifying the switch connection, state, and
+ * message received. To be used as message for SwitchStateException
+ * or log messages
+ * @param h The channel handler (to get switch information_
+ * @param m The OFMessage that has just been received
+ * @param details A string giving more details about the exact nature
+ * of the problem.
+ * @return display string
+ */
+ // needs to be protected because enum members are actually subclasses
+ protected String getSwitchStateMessage(OFChannelHandler h,
+ OFMessage m,
+ String details) {
+ return String.format("Switch: [%s], State: [%s], received: [%s]"
+ + ", details: %s",
+ h.getSwitchInfoString(),
+ this.toString(),
+ m.getType().toString(),
+ details);
+ }
+
+ /**
+ * We have an OFMessage we didn't expect given the current state and
+ * we want to treat this as an error.
+ * We currently throw an exception that will terminate the connection
+ * However, we could be more forgiving
+ * @param h the channel handler that received the message
+ * @param m the message
+ * @throws SwitchStateException
+ * @throws SwitchStateExeption we always through the execption
+ */
+ // needs to be protected because enum members are acutally subclasses
+ protected void illegalMessageReceived(OFChannelHandler h, OFMessage m)
+ throws SwitchStateException {
+ String msg = getSwitchStateMessage(h, m,
+ "Switch should never send this message in the current state");
+ throw new SwitchStateException(msg);
+
+ }
+
+ /**
+ * We have an OFMessage we didn't expect given the current state and
+ * we want to ignore the message.
+ * @param h the channel handler the received the message
+ * @param m the message
+ */
+ protected void unhandledMessageReceived(OFChannelHandler h,
+ OFMessage m) {
+ if (log.isDebugEnabled()) {
+ String msg = getSwitchStateMessage(h, m,
+ "Ignoring unexpected message");
+ log.debug(msg);
+ }
+ }
+
+ /**
+ * Log an OpenFlow error message from a switch.
+ * @param h The switch that sent the error
+ * @param error The error message
+ */
+ protected void logError(OFChannelHandler h, OFErrorMsg error) {
+ log.error("{} from switch {} in state {}",
+ new Object[] {
+ error,
+ h.getSwitchInfoString(),
+ this.toString()});
+ }
+
+ /**
+ * Log an OpenFlow error message from a switch and disconnect the
+ * channel.
+ *
+ * @param h the IO channel for this switch.
+ * @param error The error message
+ */
+ protected void logErrorDisconnect(OFChannelHandler h, OFErrorMsg error) {
+ logError(h, error);
+ h.channel.disconnect();
+ }
+
+ /**
+ * log an error message for a duplicate dpid and disconnect this channel.
+ * @param h the IO channel for this switch.
+ */
+ protected void disconnectDuplicate(OFChannelHandler h) {
+ log.error("Duplicated dpid or incompleted cleanup - "
+ + "disconnecting channel {}", h.getSwitchInfoString());
+ h.duplicateDpidFound = Boolean.TRUE;
+ h.channel.disconnect();
+ }
+
+
+
+ /**
+ * Handles all pending port status messages before a switch is declared
+ * activated in MASTER or EQUAL role. Note that since this handling
+ * precedes the activation (and therefore notification to IOFSwitchListerners)
+ * the changes to ports will already be visible once the switch is
+ * activated. As a result, no notifications are sent out for these
+ * pending portStatus messages.
+ * @param h
+ * @throws SwitchStateException
+ */
+ protected void handlePendingPortStatusMessages(OFChannelHandler h) {
+ try {
+ handlePendingPortStatusMessages(h, 0);
+ } catch (SwitchStateException e) {
+ log.error(e.getMessage());
+ }
+ }
+
+ private void handlePendingPortStatusMessages(OFChannelHandler h, int index)
+ throws SwitchStateException {
+ if (h.sw == null) {
+ String msg = "State machine error: switch is null. Should never " +
+ "happen";
+ throw new SwitchStateException(msg);
+ }
+ ArrayList temp = new ArrayList();
+ for (OFPortStatus ps: h.pendingPortStatusMsg) {
+ temp.add(ps);
+ handlePortStatusMessage(h, ps, false);
+ }
+ temp.clear();
+ // expensive but ok - we don't expect too many port-status messages
+ // note that we cannot use clear(), because of the reasons below
+ h.pendingPortStatusMsg.removeAll(temp);
+ // the iterator above takes a snapshot of the list - so while we were
+ // dealing with the pending port-status messages, we could have received
+ // newer ones. Handle them recursively, but break the recursion after
+ // five steps to avoid an attack.
+ if (!h.pendingPortStatusMsg.isEmpty() && ++index < 5) {
+ handlePendingPortStatusMessages(h, index);
+ }
+ }
+
+ /**
+ * Handle a port status message.
+ *
+ * Handle a port status message by updating the port maps in the
+ * IOFSwitch instance and notifying Controller about the change so
+ * it can dispatch a switch update.
+ *
+ * @param h The OFChannelHhandler that received the message
+ * @param m The PortStatus message we received
+ * @param doNotify if true switch port changed events will be
+ * dispatched
+ * @throws SwitchStateException
+ *
+ */
+ protected void handlePortStatusMessage(OFChannelHandler h, OFPortStatus m,
+ boolean doNotify) throws SwitchStateException {
+ if (h.sw == null) {
+ String msg = getSwitchStateMessage(h, m,
+ "State machine error: switch is null. Should never " +
+ "happen");
+ throw new SwitchStateException(msg);
+ }
+
+ h.sw.handleMessage(m);
+ }
+
+
+ /**
+ * Process an OF message received on the channel and
+ * update state accordingly.
+ *
+ * The main "event" of the state machine. Process the received message,
+ * send follow up message if required and update state if required.
+ *
+ * Switches on the message type and calls more specific event handlers
+ * for each individual OF message type. If we receive a message that
+ * is supposed to be sent from a controller to a switch we throw
+ * a SwitchStateExeption.
+ *
+ * The more specific handlers can also throw SwitchStateExceptions
+ *
+ * @param h The OFChannelHandler that received the message
+ * @param m The message we received.
+ * @throws SwitchStateException
+ * @throws IOException
+ */
+ void processOFMessage(OFChannelHandler h, OFMessage m)
+ throws IOException, SwitchStateException {
+ switch(m.getType()) {
+ case HELLO:
+ processOFHello(h, (OFHello) m);
+ break;
+ case BARRIER_REPLY:
+ processOFBarrierReply(h, (OFBarrierReply) m);
+ break;
+ case ECHO_REPLY:
+ processOFEchoReply(h, (OFEchoReply) m);
+ break;
+ case ECHO_REQUEST:
+ processOFEchoRequest(h, (OFEchoRequest) m);
+ break;
+ case ERROR:
+ processOFError(h, (OFErrorMsg) m);
+ break;
+ case FEATURES_REPLY:
+ processOFFeaturesReply(h, (OFFeaturesReply) m);
+ break;
+ case FLOW_REMOVED:
+ processOFFlowRemoved(h, (OFFlowRemoved) m);
+ break;
+ case GET_CONFIG_REPLY:
+ processOFGetConfigReply(h, (OFGetConfigReply) m);
+ break;
+ case PACKET_IN:
+ processOFPacketIn(h, (OFPacketIn) m);
+ break;
+ case PORT_STATUS:
+ processOFPortStatus(h, (OFPortStatus) m);
+ break;
+ case QUEUE_GET_CONFIG_REPLY:
+ processOFQueueGetConfigReply(h, (OFQueueGetConfigReply) m);
+ break;
+ case STATS_REPLY: // multipart_reply in 1.3
+ processOFStatisticsReply(h, (OFStatsReply) m);
+ break;
+ case EXPERIMENTER:
+ processOFExperimenter(h, (OFExperimenter) m);
+ break;
+ case ROLE_REPLY:
+ processOFRoleReply(h, (OFRoleReply) m);
+ break;
+ case GET_ASYNC_REPLY:
+ processOFGetAsyncReply(h, (OFAsyncGetReply) m);
+ break;
+
+ // The following messages are sent to switches. The controller
+ // should never receive them
+ case SET_CONFIG:
+ case GET_CONFIG_REQUEST:
+ case PACKET_OUT:
+ case PORT_MOD:
+ case QUEUE_GET_CONFIG_REQUEST:
+ case BARRIER_REQUEST:
+ case STATS_REQUEST: // multipart request in 1.3
+ case FEATURES_REQUEST:
+ case FLOW_MOD:
+ case GROUP_MOD:
+ case TABLE_MOD:
+ case GET_ASYNC_REQUEST:
+ case SET_ASYNC:
+ case METER_MOD:
+ default:
+ illegalMessageReceived(h, m);
+ break;
+ }
+ }
+
+ /*-----------------------------------------------------------------
+ * Default implementation for message handlers in any state.
+ *
+ * Individual states must override these if they want a behavior
+ * that differs from the default.
+ *
+ * In general, these handlers simply ignore the message and do
+ * nothing.
+ *
+ * There are some exceptions though, since some messages really
+ * are handled the same way in every state (e.g., ECHO_REQUST) or
+ * that are only valid in a single state (e.g., HELLO, GET_CONFIG_REPLY
+ -----------------------------------------------------------------*/
+
+ void processOFHello(OFChannelHandler h, OFHello m)
+ throws IOException, SwitchStateException {
+ // we only expect hello in the WAIT_HELLO state
+ illegalMessageReceived(h, m);
+ }
+
+ void processOFBarrierReply(OFChannelHandler h, OFBarrierReply m)
+ throws IOException {
+ // Silently ignore.
+ }
+
+ void processOFEchoRequest(OFChannelHandler h, OFEchoRequest m)
+ throws IOException {
+ if (h.ofVersion == null) {
+ log.error("No OF version set for {}. Not sending Echo REPLY",
+ h.channel.getRemoteAddress());
+ return;
+ }
+ OFFactory factory = (h.ofVersion == OFVersion.OF_13) ?
+ h.controller.getOFMessageFactory13() : h.controller.getOFMessageFactory10();
+ OFEchoReply reply = factory
+ .buildEchoReply()
+ .setXid(m.getXid())
+ .setData(m.getData())
+ .build();
+ h.channel.write(Collections.singletonList(reply));
+ }
+
+ void processOFEchoReply(OFChannelHandler h, OFEchoReply m)
+ throws IOException {
+ // Do nothing with EchoReplies !!
+ }
+
+ // no default implementation for OFError
+ // every state must override it
+ abstract void processOFError(OFChannelHandler h, OFErrorMsg m)
+ throws IOException, SwitchStateException;
+
+
+ void processOFFeaturesReply(OFChannelHandler h, OFFeaturesReply m)
+ throws IOException, SwitchStateException {
+ unhandledMessageReceived(h, m);
+ }
+
+ void processOFFlowRemoved(OFChannelHandler h, OFFlowRemoved m)
+ throws IOException {
+ unhandledMessageReceived(h, m);
+ }
+
+ void processOFGetConfigReply(OFChannelHandler h, OFGetConfigReply m)
+ throws IOException, SwitchStateException {
+ // we only expect config replies in the WAIT_CONFIG_REPLY state
+ illegalMessageReceived(h, m);
+ }
+
+ void processOFPacketIn(OFChannelHandler h, OFPacketIn m)
+ throws IOException {
+ unhandledMessageReceived(h, m);
+ }
+
+ // no default implementation. Every state needs to handle it.
+ abstract void processOFPortStatus(OFChannelHandler h, OFPortStatus m)
+ throws IOException, SwitchStateException;
+
+ void processOFQueueGetConfigReply(OFChannelHandler h,
+ OFQueueGetConfigReply m)
+ throws IOException {
+ unhandledMessageReceived(h, m);
+ }
+
+ void processOFStatisticsReply(OFChannelHandler h, OFStatsReply m)
+ throws IOException, SwitchStateException {
+ unhandledMessageReceived(h, m);
+ }
+
+ void processOFExperimenter(OFChannelHandler h, OFExperimenter m)
+ throws IOException, SwitchStateException {
+ // TODO: it might make sense to parse the vendor message here
+ // into the known vendor messages we support and then call more
+ // specific event handlers
+ unhandledMessageReceived(h, m);
+ }
+
+ void processOFRoleReply(OFChannelHandler h, OFRoleReply m)
+ throws SwitchStateException, IOException {
+ unhandledMessageReceived(h, m);
+ }
+
+ void processOFGetAsyncReply(OFChannelHandler h,
+ OFAsyncGetReply m) {
+ unhandledMessageReceived(h, m);
+ }
+
+ }
+
+
+
+ //*************************
+ // Channel handler methods
+ //*************************
+
+ @Override
+ public void channelConnected(ChannelHandlerContext ctx,
+ ChannelStateEvent e) throws Exception {
+ channel = e.getChannel();
+ log.info("New switch connection from {}",
+ channel.getRemoteAddress());
+ sendHandshakeHelloMessage();
+ setState(ChannelState.WAIT_HELLO);
+ }
+
+ @Override
+ public void channelDisconnected(ChannelHandlerContext ctx,
+ ChannelStateEvent e) throws Exception {
+ log.info("Switch disconnected callback for sw:{}. Cleaning up ...",
+ getSwitchInfoString());
+ if (thisdpid != 0) {
+ if (!duplicateDpidFound) {
+ // if the disconnected switch (on this ChannelHandler)
+ // was not one with a duplicate-dpid, it is safe to remove all
+ // state for it at the controller. Notice that if the disconnected
+ // switch was a duplicate-dpid, calling the method below would clear
+ // all state for the original switch (with the same dpid),
+ // which we obviously don't want.
+ sw.removeConnectedSwitch();
+ } else {
+ // A duplicate was disconnected on this ChannelHandler,
+ // this is the same switch reconnecting, but the original state was
+ // not cleaned up - XXX check liveness of original ChannelHandler
+ duplicateDpidFound = Boolean.FALSE;
+ }
+ } else {
+ log.warn("no dpid in channelHandler registered for "
+ + "disconnected switch {}", getSwitchInfoString());
+ }
+ }
+
+ @Override
+ public void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent e)
+ throws Exception {
+ if (e.getCause() instanceof ReadTimeoutException) {
+ // switch timeout
+ log.error("Disconnecting switch {} due to read timeout",
+ getSwitchInfoString());
+ ctx.getChannel().close();
+ } else if (e.getCause() instanceof HandshakeTimeoutException) {
+ log.error("Disconnecting switch {}: failed to complete handshake",
+ getSwitchInfoString());
+ ctx.getChannel().close();
+ } else if (e.getCause() instanceof ClosedChannelException) {
+ log.debug("Channel for sw {} already closed", getSwitchInfoString());
+ } else if (e.getCause() instanceof IOException) {
+ log.error("Disconnecting switch {} due to IO Error: {}",
+ getSwitchInfoString(), e.getCause().getMessage());
+ if (log.isDebugEnabled()) {
+ // still print stack trace if debug is enabled
+ log.debug("StackTrace for previous Exception: ", e.getCause());
+ }
+ ctx.getChannel().close();
+ } else if (e.getCause() instanceof SwitchStateException) {
+ log.error("Disconnecting switch {} due to switch state error: {}",
+ getSwitchInfoString(), e.getCause().getMessage());
+ if (log.isDebugEnabled()) {
+ // still print stack trace if debug is enabled
+ log.debug("StackTrace for previous Exception: ", e.getCause());
+ }
+ ctx.getChannel().close();
+ } else if (e.getCause() instanceof OFParseError) {
+ log.error("Disconnecting switch "
+ + getSwitchInfoString() +
+ " due to message parse failure",
+ e.getCause());
+ ctx.getChannel().close();
+ } else if (e.getCause() instanceof RejectedExecutionException) {
+ log.warn("Could not process message: queue full");
+ } else {
+ log.error("Error while processing message from switch "
+ + getSwitchInfoString()
+ + "state " + this.state, e.getCause());
+ ctx.getChannel().close();
+ }
+ }
+
+ @Override
+ public String toString() {
+ return getSwitchInfoString();
+ }
+
+ @Override
+ public void channelIdle(ChannelHandlerContext ctx, IdleStateEvent e)
+ throws Exception {
+ OFFactory factory = (ofVersion == OFVersion.OF_13) ? factory13 : factory10;
+ OFMessage m = factory.buildEchoRequest().build();
+ log.info("Sending Echo Request on idle channel: {}",
+ e.getChannel().getPipeline().getLast().toString());
+ e.getChannel().write(Collections.singletonList(m));
+ // XXX S some problems here -- echo request has no transaction id, and
+ // echo reply is not correlated to the echo request.
+ }
+
+ @Override
+ public void messageReceived(ChannelHandlerContext ctx, MessageEvent e)
+ throws Exception {
+ if (e.getMessage() instanceof List) {
+ @SuppressWarnings("unchecked")
+ List msglist = (List) e.getMessage();
+
+
+ for (OFMessage ofm : msglist) {
+ // Do the actual packet processing
+ state.processOFMessage(this, ofm);
+ }
+ } else {
+ state.processOFMessage(this, (OFMessage) e.getMessage());
+ }
+ }
+
+
+
+ //*************************
+ // Channel utility methods
+ //*************************
+
+ /**
+ * Is this a state in which the handshake has completed?
+ * @return true if the handshake is complete
+ */
+ public boolean isHandshakeComplete() {
+ return this.state.isHandshakeComplete();
+ }
+
+ private void dispatchMessage(OFMessage m) {
+ sw.handleMessage(m);
+ }
+
+ /**
+ * Return a string describing this switch based on the already available
+ * information (DPID and/or remote socket).
+ * @return display string
+ */
+ private String getSwitchInfoString() {
+ if (sw != null) {
+ return sw.toString();
+ }
+ String channelString;
+ if (channel == null || channel.getRemoteAddress() == null) {
+ channelString = "?";
+ } else {
+ channelString = channel.getRemoteAddress().toString();
+ }
+ String dpidString;
+ if (featuresReply == null) {
+ dpidString = "?";
+ } else {
+ dpidString = featuresReply.getDatapathId().toString();
+ }
+ return String.format("[%s DPID[%s]]", channelString, dpidString);
+ }
+
+ /**
+ * Update the channels state. Only called from the state machine.
+ * TODO: enforce restricted state transitions
+ * @param state
+ */
+ private void setState(ChannelState state) {
+ this.state = state;
+ }
+
+ /**
+ * Send hello message to the switch using the handshake transactions ids.
+ * @throws IOException
+ */
+ private void sendHandshakeHelloMessage() throws IOException {
+ // The OF protocol requires us to start things off by sending the highest
+ // version of the protocol supported.
+
+ // bitmap represents OF1.0 (ofp_version=0x01) and OF1.3 (ofp_version=0x04)
+ // see Sec. 7.5.1 of the OF1.3.4 spec
+ U32 bitmap = U32.ofRaw(0x00000012);
+ OFHelloElem hem = factory13.buildHelloElemVersionbitmap()
+ .setBitmaps(Collections.singletonList(bitmap))
+ .build();
+ OFMessage.Builder mb = factory13.buildHello()
+ .setXid(this.handshakeTransactionIds--)
+ .setElements(Collections.singletonList(hem));
+ log.info("Sending OF_13 Hello to {}", channel.getRemoteAddress());
+ channel.write(Collections.singletonList(mb.build()));
+ }
+
+ /**
+ * Send featuresRequest msg to the switch using the handshake transactions ids.
+ * @throws IOException
+ */
+ private void sendHandshakeFeaturesRequestMessage() throws IOException {
+ OFFactory factory = (ofVersion == OFVersion.OF_13) ? factory13 : factory10;
+ OFMessage m = factory.buildFeaturesRequest()
+ .setXid(this.handshakeTransactionIds--)
+ .build();
+ channel.write(Collections.singletonList(m));
+ }
+
+ /**
+ * Send the configuration requests to tell the switch we want full
+ * packets.
+ * @throws IOException
+ */
+ private void sendHandshakeSetConfig() throws IOException {
+ OFFactory factory = (ofVersion == OFVersion.OF_13) ? factory13 : factory10;
+ //log.debug("Sending CONFIG_REQUEST to {}", channel.getRemoteAddress());
+ List msglist = new ArrayList(3);
+
+ // Ensure we receive the full packet via PacketIn
+ // FIXME: We don't set the reassembly flags.
+ OFSetConfig sc = factory
+ .buildSetConfig()
+ .setMissSendLen((short) 0xffff)
+ .setXid(this.handshakeTransactionIds--)
+ .build();
+ msglist.add(sc);
+
+ // Barrier
+ OFBarrierRequest br = factory
+ .buildBarrierRequest()
+ .setXid(this.handshakeTransactionIds--)
+ .build();
+ msglist.add(br);
+
+ // Verify (need barrier?)
+ OFGetConfigRequest gcr = factory
+ .buildGetConfigRequest()
+ .setXid(this.handshakeTransactionIds--)
+ .build();
+ msglist.add(gcr);
+ channel.write(msglist);
+ }
+
+ /**
+ * send a description state request.
+ * @throws IOException
+ */
+ private void sendHandshakeDescriptionStatsRequest() throws IOException {
+ // Get Description to set switch-specific flags
+ OFFactory factory = (ofVersion == OFVersion.OF_13) ? factory13 : factory10;
+ OFDescStatsRequest dreq = factory
+ .buildDescStatsRequest()
+ .setXid(handshakeTransactionIds--)
+ .build();
+ channel.write(Collections.singletonList(dreq));
+ }
+
+ private void sendHandshakeOFPortDescRequest() throws IOException {
+ // Get port description for 1.3 switch
+ OFPortDescStatsRequest preq = factory13
+ .buildPortDescStatsRequest()
+ .setXid(handshakeTransactionIds--)
+ .build();
+ channel.write(Collections.singletonList(preq));
+ }
+
+ ChannelState getStateForTesting() {
+ return state;
+ }
+
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFMessageDecoder.java b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFMessageDecoder.java
new file mode 100644
index 0000000000..d3106136bd
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFMessageDecoder.java
@@ -0,0 +1,56 @@
+/**
+ * Copyright 2011, Big Switch Networks, Inc.
+ * Originally created by David Erickson, Stanford University
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ **/
+
+package org.onlab.onos.of.controller.impl;
+
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.handler.codec.frame.FrameDecoder;
+import org.projectfloodlight.openflow.protocol.OFFactories;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFMessageReader;
+
+/**
+ * Decode an openflow message from a Channel, for use in a netty pipeline.
+ */
+public class OFMessageDecoder extends FrameDecoder {
+
+ @Override
+ protected Object decode(ChannelHandlerContext ctx, Channel channel,
+ ChannelBuffer buffer) throws Exception {
+ if (!channel.isConnected()) {
+ // In testing, I see decode being called AFTER decode last.
+ // This check avoids that from reading corrupted frames
+ return null;
+ }
+
+ // Note that a single call to decode results in reading a single
+ // OFMessage from the channel buffer, which is passed on to, and processed
+ // by, the controller (in OFChannelHandler).
+ // This is different from earlier behavior (with the original openflowj),
+ // where we parsed all the messages in the buffer, before passing on
+ // a list of the parsed messages to the controller.
+ // The performance *may or may not* not be as good as before.
+ OFMessageReader reader = OFFactories.getGenericReader();
+ OFMessage message = reader.readFrom(buffer);
+
+ return message;
+ }
+
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFMessageEncoder.java b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFMessageEncoder.java
new file mode 100644
index 0000000000..35d84b4ac3
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OFMessageEncoder.java
@@ -0,0 +1,59 @@
+/**
+ * Copyright 2011, Big Switch Networks, Inc.
+ * Originally created by David Erickson, Stanford University
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License"); you may
+ * not use this file except in compliance with the License. You may obtain
+ * a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+ * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+ * License for the specific language governing permissions and limitations
+ * under the License.
+ **/
+
+package org.onlab.onos.of.controller.impl;
+
+import java.util.List;
+
+import org.jboss.netty.buffer.ChannelBuffer;
+import org.jboss.netty.buffer.ChannelBuffers;
+import org.jboss.netty.channel.Channel;
+import org.jboss.netty.channel.ChannelHandlerContext;
+import org.jboss.netty.handler.codec.oneone.OneToOneEncoder;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+
+
+/**
+ * Encode an openflow message for output into a ChannelBuffer, for use in a
+ * netty pipeline.
+ */
+public class OFMessageEncoder extends OneToOneEncoder {
+
+ @Override
+ protected Object encode(ChannelHandlerContext ctx, Channel channel,
+ Object msg) throws Exception {
+ if (!(msg instanceof List)) {
+ return msg;
+ }
+
+ @SuppressWarnings("unchecked")
+ List msglist = (List) msg;
+ /* XXX S can't get length of OFMessage in loxigen's openflowj??
+ int size = 0;
+ for (OFMessage ofm : msglist) {
+ size += ofm.getLengthU();
+ }*/
+
+ ChannelBuffer buf = ChannelBuffers.dynamicBuffer();
+
+ for (OFMessage ofm : msglist) {
+ ofm.writeTo(buf);
+ }
+ return buf;
+ }
+
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OpenFlowControllerImpl.java b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OpenFlowControllerImpl.java
new file mode 100644
index 0000000000..a8b0673567
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OpenFlowControllerImpl.java
@@ -0,0 +1,292 @@
+package org.onlab.onos.of.controller.impl;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.locks.Lock;
+import java.util.concurrent.locks.ReentrantLock;
+
+import org.apache.felix.scr.annotations.Activate;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Deactivate;
+import org.apache.felix.scr.annotations.Service;
+import org.onlab.onos.of.controller.DefaultOpenFlowPacketContext;
+import org.onlab.onos.of.controller.Dpid;
+import org.onlab.onos.of.controller.OpenFlowController;
+import org.onlab.onos.of.controller.OpenFlowPacketContext;
+import org.onlab.onos.of.controller.OpenFlowSwitch;
+import org.onlab.onos.of.controller.OpenFlowSwitchListener;
+import org.onlab.onos.of.controller.PacketListener;
+import org.onlab.onos.of.controller.RoleState;
+import org.onlab.onos.of.controller.driver.OpenFlowAgent;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFPacketIn;
+import org.projectfloodlight.openflow.protocol.OFPortStatus;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+import com.google.common.collect.ArrayListMultimap;
+import com.google.common.collect.Multimap;
+
+@Component(immediate = true)
+@Service
+public class OpenFlowControllerImpl implements OpenFlowController {
+
+ private static final Logger log =
+ LoggerFactory.getLogger(OpenFlowControllerImpl.class);
+
+ protected ConcurrentHashMap connectedSwitches =
+ new ConcurrentHashMap();
+ protected ConcurrentHashMap activeMasterSwitches =
+ new ConcurrentHashMap();
+ protected ConcurrentHashMap activeEqualSwitches =
+ new ConcurrentHashMap();
+
+ protected OpenFlowSwitchAgent agent = new OpenFlowSwitchAgent();
+ protected Set ofEventListener = new HashSet<>();
+
+ protected Multimap ofPacketListener =
+ ArrayListMultimap.create();
+
+
+ private final Controller ctrl = new Controller();
+
+ @Activate
+ public void activate() {
+ ctrl.start(agent);
+ }
+
+ @Deactivate
+ public void deactivate() {
+ ctrl.stop();
+ }
+
+ @Override
+ public Iterable getSwitches() {
+ return connectedSwitches.values();
+ }
+
+ @Override
+ public Iterable getMasterSwitches() {
+ return activeMasterSwitches.values();
+ }
+
+ @Override
+ public Iterable getEqualSwitches() {
+ return activeEqualSwitches.values();
+ }
+
+ @Override
+ public OpenFlowSwitch getSwitch(Dpid dpid) {
+ return connectedSwitches.get(dpid);
+ }
+
+ @Override
+ public OpenFlowSwitch getMasterSwitch(Dpid dpid) {
+ return activeMasterSwitches.get(dpid);
+ }
+
+ @Override
+ public OpenFlowSwitch getEqualSwitch(Dpid dpid) {
+ return activeEqualSwitches.get(dpid);
+ }
+
+ @Override
+ public void addListener(OpenFlowSwitchListener listener) {
+ if (!ofEventListener.contains(listener)) {
+ this.ofEventListener.add(listener);
+ }
+ }
+
+ @Override
+ public void removeListener(OpenFlowSwitchListener listener) {
+ this.ofEventListener.remove(listener);
+ }
+
+ @Override
+ public void addPacketListener(int priority, PacketListener listener) {
+ ofPacketListener.put(priority, listener);
+ }
+
+ @Override
+ public void removePacketListener(PacketListener listener) {
+ ofPacketListener.values().remove(listener);
+ }
+
+ @Override
+ public void write(Dpid dpid, OFMessage msg) {
+ this.getSwitch(dpid).sendMsg(msg);
+ }
+
+ @Override
+ public void processPacket(Dpid dpid, OFMessage msg) {
+ switch (msg.getType()) {
+ case PORT_STATUS:
+ for (OpenFlowSwitchListener l : ofEventListener) {
+ l.portChanged(dpid, (OFPortStatus) msg);
+ }
+ break;
+ case PACKET_IN:
+ OpenFlowPacketContext pktCtx = DefaultOpenFlowPacketContext
+ .packetContextFromPacketIn(this.getSwitch(dpid),
+ (OFPacketIn) msg);
+ for (PacketListener p : ofPacketListener.values()) {
+ p.handlePacket(pktCtx);
+ }
+ break;
+ default:
+ log.warn("Handling message type {} not yet implemented {}",
+ msg.getType(), msg);
+ }
+ }
+
+ @Override
+ public void setRole(Dpid dpid, RoleState role) {
+ getSwitch(dpid).setRole(role);
+ }
+
+ /**
+ * Implementation of an OpenFlow Agent which is responsible for
+ * keeping track of connected switches and the state in which
+ * they are.
+ */
+ public class OpenFlowSwitchAgent implements OpenFlowAgent {
+
+ private final Logger log = LoggerFactory.getLogger(OpenFlowSwitchAgent.class);
+ private final Lock switchLock = new ReentrantLock();
+
+ @Override
+ public boolean addConnectedSwitch(Dpid dpid, OpenFlowSwitch sw) {
+ if (connectedSwitches.get(dpid) != null) {
+ log.error("Trying to add connectedSwitch but found a previous "
+ + "value for dpid: {}", dpid);
+ return false;
+ } else {
+ log.error("Added switch {}", dpid);
+ connectedSwitches.put(dpid, sw);
+ for (OpenFlowSwitchListener l : ofEventListener) {
+ l.switchAdded(dpid);
+ }
+ return true;
+ }
+ }
+
+ @Override
+ public boolean validActivation(Dpid dpid) {
+ if (connectedSwitches.get(dpid) == null) {
+ log.error("Trying to activate switch but is not in "
+ + "connected switches: dpid {}. Aborting ..",
+ dpid);
+ return false;
+ }
+ if (activeMasterSwitches.get(dpid) != null ||
+ activeEqualSwitches.get(dpid) != null) {
+ log.error("Trying to activate switch but it is already "
+ + "activated: dpid {}. Found in activeMaster: {} "
+ + "Found in activeEqual: {}. Aborting ..", new Object[]{
+ dpid,
+ (activeMasterSwitches.get(dpid) == null) ? 'N' : 'Y',
+ (activeEqualSwitches.get(dpid) == null) ? 'N' : 'Y'});
+ return false;
+ }
+ return true;
+ }
+
+
+ @Override
+ public boolean addActivatedMasterSwitch(Dpid dpid, OpenFlowSwitch sw) {
+ switchLock.lock();
+ try {
+ if (!validActivation(dpid)) {
+ return false;
+ }
+ activeMasterSwitches.put(dpid, sw);
+ return true;
+ } finally {
+ switchLock.unlock();
+ }
+ }
+
+ @Override
+ public boolean addActivatedEqualSwitch(Dpid dpid, OpenFlowSwitch sw) {
+ switchLock.lock();
+ try {
+ if (!validActivation(dpid)) {
+ return false;
+ }
+ activeEqualSwitches.put(dpid, sw);
+ log.info("Added Activated EQUAL Switch {}", dpid);
+ return true;
+ } finally {
+ switchLock.unlock();
+ }
+ }
+
+ @Override
+ public void transitionToMasterSwitch(Dpid dpid) {
+ switchLock.lock();
+ try {
+ if (activeMasterSwitches.containsKey(dpid)) {
+ return;
+ }
+ OpenFlowSwitch sw = activeEqualSwitches.remove(dpid);
+ if (sw == null) {
+ sw = getSwitch(dpid);
+ if (sw == null) {
+ log.error("Transition to master called on sw {}, but switch "
+ + "was not found in controller-cache", dpid);
+ return;
+ }
+ }
+ log.info("Transitioned switch {} to MASTER", dpid);
+ activeMasterSwitches.put(dpid, sw);
+ } finally {
+ switchLock.unlock();
+ }
+ }
+
+
+ @Override
+ public void transitionToEqualSwitch(Dpid dpid) {
+ switchLock.lock();
+ try {
+ if (activeEqualSwitches.containsKey(dpid)) {
+ return;
+ }
+ OpenFlowSwitch sw = activeMasterSwitches.remove(dpid);
+ if (sw == null) {
+ sw = getSwitch(dpid);
+ if (sw == null) {
+ log.error("Transition to equal called on sw {}, but switch "
+ + "was not found in controller-cache", dpid);
+ return;
+ }
+ }
+ log.info("Transitioned switch {} to EQUAL", dpid);
+ activeEqualSwitches.put(dpid, sw);
+ } finally {
+ switchLock.unlock();
+ }
+
+ }
+
+ @Override
+ public void removeConnectedSwitch(Dpid dpid) {
+ connectedSwitches.remove(dpid);
+ OpenFlowSwitch sw = activeMasterSwitches.remove(dpid);
+ if (sw == null) {
+ sw = activeEqualSwitches.remove(dpid);
+ }
+ for (OpenFlowSwitchListener l : ofEventListener) {
+ l.switchRemoved(dpid);
+ }
+ }
+
+ @Override
+ public void processMessage(Dpid dpid, OFMessage m) {
+ processPacket(dpid, m);
+ }
+ }
+
+
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OpenflowPipelineFactory.java b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OpenflowPipelineFactory.java
new file mode 100644
index 0000000000..1e34a3e591
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/OpenflowPipelineFactory.java
@@ -0,0 +1,78 @@
+/**
+* Copyright 2011, Big Switch Networks, Inc.
+* Originally created by David Erickson, Stanford University
+*
+* Licensed under the Apache License, Version 2.0 (the "License"); you may
+* not use this file except in compliance with the License. You may obtain
+* a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+* License for the specific language governing permissions and limitations
+* under the License.
+**/
+
+package org.onlab.onos.of.controller.impl;
+
+import java.util.concurrent.ThreadPoolExecutor;
+
+import org.jboss.netty.channel.ChannelPipeline;
+import org.jboss.netty.channel.ChannelPipelineFactory;
+import org.jboss.netty.channel.Channels;
+import org.jboss.netty.handler.execution.ExecutionHandler;
+import org.jboss.netty.handler.timeout.IdleStateHandler;
+import org.jboss.netty.handler.timeout.ReadTimeoutHandler;
+import org.jboss.netty.util.ExternalResourceReleasable;
+import org.jboss.netty.util.HashedWheelTimer;
+import org.jboss.netty.util.Timer;
+
+/**
+ * Creates a ChannelPipeline for a server-side openflow channel.
+ */
+public class OpenflowPipelineFactory
+ implements ChannelPipelineFactory, ExternalResourceReleasable {
+
+ protected Controller controller;
+ protected ThreadPoolExecutor pipelineExecutor;
+ protected Timer timer;
+ protected IdleStateHandler idleHandler;
+ protected ReadTimeoutHandler readTimeoutHandler;
+
+ public OpenflowPipelineFactory(Controller controller,
+ ThreadPoolExecutor pipelineExecutor) {
+ super();
+ this.controller = controller;
+ this.pipelineExecutor = pipelineExecutor;
+ this.timer = new HashedWheelTimer();
+ this.idleHandler = new IdleStateHandler(timer, 20, 25, 0);
+ this.readTimeoutHandler = new ReadTimeoutHandler(timer, 30);
+ }
+
+ @Override
+ public ChannelPipeline getPipeline() throws Exception {
+ OFChannelHandler handler = new OFChannelHandler(controller);
+
+ ChannelPipeline pipeline = Channels.pipeline();
+ pipeline.addLast("ofmessagedecoder", new OFMessageDecoder());
+ pipeline.addLast("ofmessageencoder", new OFMessageEncoder());
+ pipeline.addLast("idle", idleHandler);
+ pipeline.addLast("timeout", readTimeoutHandler);
+ // XXX S ONOS: was 15 increased it to fix Issue #296
+ pipeline.addLast("handshaketimeout",
+ new HandshakeTimeoutHandler(handler, timer, 60));
+ if (pipelineExecutor != null) {
+ pipeline.addLast("pipelineExecutor",
+ new ExecutionHandler(pipelineExecutor));
+ }
+ pipeline.addLast("handler", handler);
+ return pipeline;
+ }
+
+ @Override
+ public void releaseExternalResources() {
+ timer.stop();
+ }
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/RoleManager.java b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/RoleManager.java
new file mode 100644
index 0000000000..ee3a37fb16
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/RoleManager.java
@@ -0,0 +1,395 @@
+package org.onlab.onos.of.controller.impl;
+
+import java.io.IOException;
+import java.util.Collections;
+
+import org.onlab.onos.of.controller.RoleState;
+import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriver;
+import org.onlab.onos.of.controller.driver.RoleHandler;
+import org.onlab.onos.of.controller.driver.RoleRecvStatus;
+import org.onlab.onos.of.controller.driver.RoleReplyInfo;
+import org.onlab.onos.of.controller.driver.SwitchStateException;
+import org.projectfloodlight.openflow.protocol.OFControllerRole;
+import org.projectfloodlight.openflow.protocol.OFErrorMsg;
+import org.projectfloodlight.openflow.protocol.OFErrorType;
+import org.projectfloodlight.openflow.protocol.OFExperimenter;
+import org.projectfloodlight.openflow.protocol.OFFactories;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFNiciraControllerRole;
+import org.projectfloodlight.openflow.protocol.OFNiciraControllerRoleReply;
+import org.projectfloodlight.openflow.protocol.OFRoleReply;
+import org.projectfloodlight.openflow.protocol.OFRoleRequest;
+import org.projectfloodlight.openflow.protocol.OFVersion;
+import org.projectfloodlight.openflow.protocol.errormsg.OFBadRequestErrorMsg;
+import org.projectfloodlight.openflow.protocol.errormsg.OFRoleRequestFailedErrorMsg;
+import org.projectfloodlight.openflow.types.U64;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+
+/**
+ * A utility class to handle role requests and replies for this channel.
+ * After a role request is submitted the role changer keeps track of the
+ * pending request, collects the reply (if any) and times out the request
+ * if necessary.
+ *
+ * To simplify role handling we only keep track of the /last/ pending
+ * role reply send to the switch. If multiple requests are pending and
+ * we receive replies for earlier requests we ignore them. However, this
+ * way of handling pending requests implies that we could wait forever if
+ * a new request is submitted before the timeout triggers. If necessary
+ * we could work around that though.
+ */
+class RoleManager implements RoleHandler {
+ protected static final long NICIRA_EXPERIMENTER = 0x2320;
+
+ private static Logger log = LoggerFactory.getLogger(RoleManager.class);
+ // indicates that a request is currently pending
+ // needs to be volatile to allow correct double-check idiom
+ private volatile boolean requestPending;
+ // the transaction Id of the pending request
+ private int pendingXid;
+ // the role that's pending
+ private RoleState pendingRole;
+
+ // the expectation set by the caller for the returned role
+ private RoleRecvStatus expectation;
+ private final OpenFlowSwitchDriver sw;
+
+
+ public RoleManager(OpenFlowSwitchDriver sw) {
+ this.requestPending = false;
+ this.pendingXid = -1;
+ this.pendingRole = null;
+ this.expectation = RoleRecvStatus.MATCHED_CURRENT_ROLE;
+ this.sw = sw;
+ }
+
+ /**
+ * Send NX role request message to the switch requesting the specified
+ * role.
+ *
+ * @param role role to request
+ */
+ private int sendNxRoleRequest(RoleState role) throws IOException {
+ // Convert the role enum to the appropriate role to send
+ OFNiciraControllerRole roleToSend = OFNiciraControllerRole.ROLE_OTHER;
+ switch (role) {
+ case MASTER:
+ roleToSend = OFNiciraControllerRole.ROLE_MASTER;
+ break;
+ case SLAVE:
+ case EQUAL:
+ default:
+ // ensuring that the only two roles sent to 1.0 switches with
+ // Nicira role support, are MASTER and SLAVE
+ roleToSend = OFNiciraControllerRole.ROLE_OTHER;
+ log.warn("Sending Nx Role.SLAVE to switch {}.", sw);
+ }
+ int xid = sw.getNextTransactionId();
+ OFExperimenter roleRequest = OFFactories.getFactory(OFVersion.OF_10)
+ .buildNiciraControllerRoleRequest()
+ .setXid(xid)
+ .setRole(roleToSend)
+ .build();
+ sw.write(Collections.singletonList(roleRequest));
+ return xid;
+ }
+
+ private int sendOF13RoleRequest(RoleState role) throws IOException {
+ // Convert the role enum to the appropriate role to send
+ OFControllerRole roleToSend = OFControllerRole.ROLE_NOCHANGE;
+ switch (role) {
+ case EQUAL:
+ roleToSend = OFControllerRole.ROLE_EQUAL;
+ break;
+ case MASTER:
+ roleToSend = OFControllerRole.ROLE_MASTER;
+ break;
+ case SLAVE:
+ roleToSend = OFControllerRole.ROLE_SLAVE;
+ break;
+ default:
+ log.warn("Sending default role.noChange to switch {}."
+ + " Should only be used for queries.", sw);
+ }
+
+ int xid = sw.getNextTransactionId();
+ OFRoleRequest rrm = OFFactories.getFactory(OFVersion.OF_13)
+ .buildRoleRequest()
+ .setRole(roleToSend)
+ .setXid(xid)
+ //FIXME fix below when we actually use generation ids
+ .setGenerationId(U64.ZERO)
+ .build();
+ sw.sendMsg(rrm);
+ return xid;
+ }
+
+ @Override
+ public synchronized boolean sendRoleRequest(RoleState role, RoleRecvStatus exp)
+ throws IOException {
+ this.expectation = exp;
+
+ if (sw.factory().getVersion() == OFVersion.OF_10) {
+ Boolean supportsNxRole = sw.supportNxRole();
+ if (!supportsNxRole) {
+ log.debug("Switch driver indicates no support for Nicira "
+ + "role request messages. Not sending ...");
+ handleUnsentRoleMessage(role,
+ expectation);
+ return false;
+ }
+ // OF1.0 switch with support for NX_ROLE_REQUEST vendor extn.
+ // make Role.EQUAL become Role.SLAVE
+ role = (role == RoleState.EQUAL) ? RoleState.SLAVE : role;
+ pendingXid = sendNxRoleRequest(role);
+ pendingRole = role;
+ requestPending = true;
+ } else {
+ // OF1.3 switch, use OFPT_ROLE_REQUEST message
+ pendingXid = sendOF13RoleRequest(role);
+ pendingRole = role;
+ requestPending = true;
+ }
+ return true;
+ }
+
+ private void handleUnsentRoleMessage(RoleState role,
+ RoleRecvStatus exp) throws IOException {
+ // typically this is triggered for a switch where role messages
+ // are not supported - we confirm that the role being set is
+ // master
+ if (exp != RoleRecvStatus.MATCHED_SET_ROLE) {
+
+ log.error("Expected MASTER role from registry for switch "
+ + "which has no support for role-messages."
+ + "Received {}. It is possible that this switch "
+ + "is connected to other controllers, in which "
+ + "case it should support role messages - not "
+ + "moving forward.", role);
+
+ }
+
+ }
+
+
+ @Override
+ public synchronized RoleRecvStatus deliverRoleReply(RoleReplyInfo rri)
+ throws SwitchStateException {
+ if (!requestPending) {
+ RoleState currentRole = (sw != null) ? sw.getRole() : null;
+ if (currentRole != null) {
+ if (currentRole == rri.getRole()) {
+ // Don't disconnect if the role reply we received is
+ // for the same role we are already in.
+ log.debug("Received unexpected RoleReply from "
+ + "Switch: {}. "
+ + "Role in reply is same as current role of this "
+ + "controller for this sw. Ignoring ...",
+ sw.getStringId());
+ return RoleRecvStatus.OTHER_EXPECTATION;
+ } else {
+ String msg = String.format("Switch: [%s], "
+ + "received unexpected RoleReply[%s]. "
+ + "No roles are pending, and this controller's "
+ + "current role:[%s] does not match reply. "
+ + "Disconnecting switch ... ",
+ sw.getStringId(),
+ rri, currentRole);
+ throw new SwitchStateException(msg);
+ }
+ }
+ log.debug("Received unexpected RoleReply {} from "
+ + "Switch: {}. "
+ + "This controller has no current role for this sw. "
+ + "Ignoring ...", new Object[] {rri,
+ sw.getStringId(), });
+ return RoleRecvStatus.OTHER_EXPECTATION;
+ }
+
+ int xid = (int) rri.getXid();
+ RoleState role = rri.getRole();
+ // XXX S should check generation id meaningfully and other cases of expectations
+
+ if (pendingXid != xid) {
+ log.debug("Received older role reply from " +
+ "switch {} ({}). Ignoring. " +
+ "Waiting for {}, xid={}",
+ new Object[] {sw.getStringId(), rri,
+ pendingRole, pendingXid });
+ return RoleRecvStatus.OLD_REPLY;
+ }
+
+ if (pendingRole == role) {
+ log.debug("Received role reply message from {} that matched "
+ + "expected role-reply {} with expectations {}",
+ new Object[] {sw.getStringId(), role, expectation});
+
+ if (expectation == RoleRecvStatus.MATCHED_CURRENT_ROLE ||
+ expectation == RoleRecvStatus.MATCHED_SET_ROLE) {
+ return expectation;
+ } else {
+ return RoleRecvStatus.OTHER_EXPECTATION;
+ }
+ }
+
+ // if xids match but role's don't, perhaps its a query (OF1.3)
+ if (expectation == RoleRecvStatus.REPLY_QUERY) {
+ return expectation;
+ }
+
+ return RoleRecvStatus.OTHER_EXPECTATION;
+ }
+
+ /**
+ * Called if we receive an error message. If the xid matches the
+ * pending request we handle it otherwise we ignore it.
+ *
+ * Note: since we only keep the last pending request we might get
+ * error messages for earlier role requests that we won't be able
+ * to handle
+ */
+ @Override
+ public synchronized RoleRecvStatus deliverError(OFErrorMsg error)
+ throws SwitchStateException {
+ if (!requestPending) {
+ log.debug("Received an error msg from sw {}, but no pending "
+ + "requests in role-changer; not handling ...",
+ sw.getStringId());
+ return RoleRecvStatus.OTHER_EXPECTATION;
+ }
+ if (pendingXid != error.getXid()) {
+ if (error.getErrType() == OFErrorType.ROLE_REQUEST_FAILED) {
+ log.debug("Received an error msg from sw {} for a role request,"
+ + " but not for pending request in role-changer; "
+ + " ignoring error {} ...",
+ sw.getStringId(), error);
+ }
+ return RoleRecvStatus.OTHER_EXPECTATION;
+ }
+ // it is an error related to a currently pending role request message
+ if (error.getErrType() == OFErrorType.BAD_REQUEST) {
+ log.error("Received a error msg {} from sw {} for "
+ + "pending role request {}. Switch driver indicates "
+ + "role-messaging is supported. Possible issues in "
+ + "switch driver configuration?", new Object[] {
+ ((OFBadRequestErrorMsg) error).toString(),
+ sw.getStringId(), pendingRole
+ });
+ return RoleRecvStatus.UNSUPPORTED;
+ }
+
+ if (error.getErrType() == OFErrorType.ROLE_REQUEST_FAILED) {
+ OFRoleRequestFailedErrorMsg rrerr =
+ (OFRoleRequestFailedErrorMsg) error;
+ switch (rrerr.getCode()) {
+ case BAD_ROLE:
+ // switch says that current-role-req has bad role?
+ // for now we disconnect
+ // fall-thru
+ case STALE:
+ // switch says that current-role-req has stale gen-id?
+ // for now we disconnect
+ // fall-thru
+ case UNSUP:
+ // switch says that current-role-req has role that
+ // cannot be supported? for now we disconnect
+ String msgx = String.format("Switch: [%s], "
+ + "received Error to for pending role request [%s]. "
+ + "Error:[%s]. Disconnecting switch ... ",
+ sw.getStringId(),
+ pendingRole, rrerr);
+ throw new SwitchStateException(msgx);
+ default:
+ break;
+ }
+ }
+
+ // This error message was for a role request message but we dont know
+ // how to handle errors for nicira role request messages
+ return RoleRecvStatus.OTHER_EXPECTATION;
+ }
+
+ /**
+ * Extract the role from an OFVendor message.
+ *
+ * Extract the role from an OFVendor message if the message is a
+ * Nicira role reply. Otherwise return null.
+ *
+ * @param experimenterMsg message
+ * @return The role in the message if the message is a Nicira role
+ * reply, null otherwise.
+ * @throws SwitchStateException If the message is a Nicira role reply
+ * but the numeric role value is unknown.
+ */
+ @Override
+ public RoleState extractNiciraRoleReply(OFExperimenter experimenterMsg)
+ throws SwitchStateException {
+ int vendor = (int) experimenterMsg.getExperimenter();
+ if (vendor != 0x2320) {
+ return null;
+ }
+ OFNiciraControllerRoleReply nrr =
+ (OFNiciraControllerRoleReply) experimenterMsg;
+
+ RoleState role = null;
+ OFNiciraControllerRole ncr = nrr.getRole();
+ switch(ncr) {
+ case ROLE_MASTER:
+ role = RoleState.MASTER;
+ break;
+ case ROLE_OTHER:
+ role = RoleState.EQUAL;
+ break;
+ case ROLE_SLAVE:
+ role = RoleState.SLAVE;
+ break;
+ default: //handled below
+ }
+
+ if (role == null) {
+ String msg = String.format("Switch: [%s], "
+ + "received NX_ROLE_REPLY with invalid role "
+ + "value %s",
+ sw.getStringId(),
+ nrr.getRole());
+ throw new SwitchStateException(msg);
+ }
+ return role;
+ }
+
+ /**
+ * Extract the role information from an OF1.3 Role Reply Message.
+ *
+ * @param rrmsg the role message
+ * @return RoleReplyInfo object
+ * @throws SwitchStateException if the role information could not be extracted.
+ */
+ @Override
+ public RoleReplyInfo extractOFRoleReply(OFRoleReply rrmsg)
+ throws SwitchStateException {
+ OFControllerRole cr = rrmsg.getRole();
+ RoleState role = null;
+ switch(cr) {
+ case ROLE_EQUAL:
+ role = RoleState.EQUAL;
+ break;
+ case ROLE_MASTER:
+ role = RoleState.MASTER;
+ break;
+ case ROLE_SLAVE:
+ role = RoleState.SLAVE;
+ break;
+ case ROLE_NOCHANGE: // switch should send current role
+ default:
+ String msg = String.format("Unknown controller role %s "
+ + "received from switch %s", cr, sw);
+ throw new SwitchStateException(msg);
+ }
+
+ return new RoleReplyInfo(role, rrmsg.getGenerationId(), rrmsg.getXid());
+ }
+
+}
+
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/package-info.java b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/package-info.java
new file mode 100644
index 0000000000..f5b4544f8e
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/controller/impl/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * Implementation of the OpenFlow controller IO subsystem.
+ */
+package org.onlab.onos.of.controller.impl;
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/DriverManager.java b/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/DriverManager.java
new file mode 100644
index 0000000000..0dd897fa79
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/DriverManager.java
@@ -0,0 +1,124 @@
+package org.onlab.onos.of.drivers.impl;
+
+
+
+import java.util.Collections;
+import java.util.List;
+
+import org.onlab.onos.of.controller.Dpid;
+import org.onlab.onos.of.controller.driver.AbstractOpenFlowSwitch;
+import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriver;
+import org.onlab.onos.of.controller.driver.OpenFlowSwitchDriverFactory;
+import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFPortDesc;
+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 implements OpenFlowSwitchDriverFactory {
+
+ private static final Logger log = LoggerFactory.getLogger(DriverManager.class);
+
+ // Whether to use an OF 1.3 configured TTP, or to use an OF 1.0-style
+ // single table with packet-ins.
+ private static boolean cpqdUsePipeline13 = false;
+
+ /**
+ * 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
+ */
+ @Override
+ public OpenFlowSwitchDriver getOFSwitchImpl(Dpid dpid,
+ 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(dpid, desc, cpqdUsePipeline13);
+ }
+
+ if (vendor.startsWith("Nicira") &&
+ hw.startsWith("Open vSwitch")) {
+ if (ofv == OFVersion.OF_10) {
+ return new OFSwitchImplOVS10(dpid, desc);
+ } else if (ofv == OFVersion.OF_13) {
+ return new OFSwitchImplOVS13(dpid, desc);
+ }
+ }
+
+ log.warn("DriverManager could not identify switch desc: {}. "
+ + "Assigning AbstractOpenFlowSwich", desc);
+ return new AbstractOpenFlowSwitch(dpid, desc) {
+
+ @Override
+ public void write(List msgs) {
+ channel.write(msgs);
+ }
+
+ @Override
+ public void write(OFMessage msg) {
+ channel.write(Collections.singletonList(msg));
+
+ }
+
+ @Override
+ public Boolean supportNxRole() {
+ return false;
+ }
+
+ @Override
+ public void startDriverHandshake() {}
+
+ @Override
+ public void processDriverHandshakeMessage(OFMessage m) {}
+
+ @Override
+ public boolean isDriverHandshakeComplete() {
+ return true;
+ }
+
+ @Override
+ public List getPorts() {
+ if (this.factory().getVersion() == OFVersion.OF_10) {
+ return Collections.unmodifiableList(features.getPorts());
+ } else {
+ return Collections.unmodifiableList(ports.getEntries());
+ }
+ }
+ };
+ }
+
+ /**
+ * Private constructor to avoid instantiation.
+ */
+ private DriverManager() {
+ }
+
+ /**
+ * Sets the configuration parameter which determines how the CPqD switch
+ * is set up. If usePipeline13 is true, a 1.3 pipeline will be set up on
+ * the switch. Otherwise, the switch will be set up in a 1.0 style with
+ * a single table where missed packets are sent to the controller.
+ *
+ * @param usePipeline13 whether to use a 1.3 pipeline or not
+ */
+ public static void setConfigForCpqd(boolean usePipeline13) {
+ cpqdUsePipeline13 = usePipeline13;
+ }
+
+ public static OpenFlowSwitchDriver getSwitch(Dpid dpid,
+ OFDescStatsReply desc, OFVersion ofv) {
+ return new DriverManager().getOFSwitchImpl(dpid, desc, ofv);
+ }
+
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/OFSwitchImplCPqD13.java b/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/OFSwitchImplCPqD13.java
new file mode 100644
index 0000000000..e80b7513b4
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/OFSwitchImplCPqD13.java
@@ -0,0 +1,1222 @@
+package org.onlab.onos.of.drivers.impl;
+
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.onlab.onos.of.controller.Dpid;
+import org.onlab.onos.of.controller.RoleState;
+import org.onlab.onos.of.controller.driver.AbstractOpenFlowSwitch;
+import org.onlab.onos.of.controller.driver.SwitchDriverSubHandshakeAlreadyStarted;
+import org.onlab.onos.of.controller.driver.SwitchDriverSubHandshakeCompleted;
+import org.onlab.onos.of.controller.driver.SwitchDriverSubHandshakeNotStarted;
+import org.projectfloodlight.openflow.protocol.OFAsyncGetReply;
+import org.projectfloodlight.openflow.protocol.OFBarrierRequest;
+import org.projectfloodlight.openflow.protocol.OFBucket;
+import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFFactory;
+import org.projectfloodlight.openflow.protocol.OFGroupDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFGroupFeaturesStatsReply;
+import org.projectfloodlight.openflow.protocol.OFGroupType;
+import org.projectfloodlight.openflow.protocol.OFMatchV3;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFOxmList;
+import org.projectfloodlight.openflow.protocol.OFPortDesc;
+import org.projectfloodlight.openflow.protocol.OFStatsReply;
+import org.projectfloodlight.openflow.protocol.action.OFAction;
+import org.projectfloodlight.openflow.protocol.instruction.OFInstruction;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmEthDst;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmEthSrc;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmEthType;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmInPort;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmIpv4DstMasked;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmMetadataMasked;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmMplsLabel;
+import org.projectfloodlight.openflow.protocol.oxm.OFOxmVlanVid;
+import org.projectfloodlight.openflow.types.EthType;
+import org.projectfloodlight.openflow.types.IPv4Address;
+import org.projectfloodlight.openflow.types.MacAddress;
+import org.projectfloodlight.openflow.types.OFBufferId;
+import org.projectfloodlight.openflow.types.OFGroup;
+import org.projectfloodlight.openflow.types.OFMetadata;
+import org.projectfloodlight.openflow.types.OFPort;
+import org.projectfloodlight.openflow.types.OFVlanVidMatch;
+import org.projectfloodlight.openflow.types.TableId;
+import org.projectfloodlight.openflow.types.U32;
+import org.projectfloodlight.openflow.types.U64;
+import org.projectfloodlight.openflow.util.HexString;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * OFDescriptionStatistics Vendor (Manufacturer Desc.): Stanford University,
+ * Ericsson Research and CPqD Research. Make (Hardware Desc.) : OpenFlow 1.3
+ * Reference Userspace Switch Model (Datapath Desc.) : None Software : Serial :
+ * None
+ */
+public class OFSwitchImplCPqD13 extends AbstractOpenFlowSwitch {
+
+ private final Logger log =
+ LoggerFactory.getLogger(OFSwitchImplCPqD13.class);
+
+ private static final int VLAN_ID_OFFSET = 16;
+ private final AtomicBoolean driverHandshakeComplete;
+ private OFFactory factory;
+ private static final int OFPCML_NO_BUFFER = 0xffff;
+ // Configuration of asynch messages to controller. We need different
+ // asynch messages depending on role-equal or role-master.
+ // We don't want to get anything if we are slave.
+ private static final long SET_FLOW_REMOVED_MASK_MASTER = 0xf;
+ private static final long SET_PACKET_IN_MASK_MASTER = 0x7;
+ private static final long SET_PORT_STATUS_MASK_MASTER = 0x7;
+ private static final long SET_FLOW_REMOVED_MASK_EQUAL = 0x0;
+ private static final long SET_PACKET_IN_MASK_EQUAL = 0x0;
+ private static final long SET_PORT_STATUS_MASK_EQUAL = 0x7;
+ private static final long SET_ALL_SLAVE = 0x0;
+
+ private static final long TEST_FLOW_REMOVED_MASK = 0xf;
+ private static final long TEST_PACKET_IN_MASK = 0x7;
+ private static final long TEST_PORT_STATUS_MASK = 0x7;
+ private long barrierXidToWaitFor = -1;
+
+ private static final int TABLE_VLAN = 0;
+ private static final int TABLE_TMAC = 1;
+ private static final int TABLE_IPV4_UNICAST = 2;
+ private static final int TABLE_MPLS = 3;
+ private static final int TABLE_META = 4;
+ private static final int TABLE_ACL = 5;
+
+ private static final short MAX_PRIORITY = (short) 0xffff;
+ private static final short SLASH_24_PRIORITY = (short) 0xfff0;
+ private static final short MIN_PRIORITY = 0x0;
+ private static final U64 METADATA_MASK = U64.of(Long.MAX_VALUE << 1 | 0x1);
+
+ private final Map l2groups;
+
+ private final boolean usePipeline13;
+
+ public OFSwitchImplCPqD13(Dpid dpid, OFDescStatsReply desc, boolean usePipeline13) {
+ super(dpid);
+ driverHandshakeComplete = new AtomicBoolean(false);
+ l2groups = new ConcurrentHashMap();
+ setSwitchDescription(desc);
+
+ this.usePipeline13 = usePipeline13;
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "OFSwitchImplCPqD13 [" + ((channel != null)
+ ? channel.getRemoteAddress() : "?")
+ + " DPID[" + ((this.getStringId() != null) ? this.getStringId() : "?") + "]]";
+ }
+
+ @Override
+ public void startDriverHandshake() {
+ log.debug("Starting driver handshake for sw {}", getStringId());
+ if (startDriverHandshakeCalled) {
+ throw new SwitchDriverSubHandshakeAlreadyStarted();
+ }
+ startDriverHandshakeCalled = true;
+ factory = this.factory();
+ if (!usePipeline13) {
+ // Send packet-in to controller if a packet misses the first table
+ populateTableMissEntry(0, true, false, false, 0);
+ } //else {
+ // configureSwitch();
+ //}
+ sendBarrier(true);
+ }
+
+ @Override
+ public boolean isDriverHandshakeComplete() {
+ if (!startDriverHandshakeCalled) {
+ throw new SwitchDriverSubHandshakeNotStarted();
+ }
+ return driverHandshakeComplete.get();
+ }
+
+ @Override
+ public void processDriverHandshakeMessage(OFMessage m) {
+ if (!startDriverHandshakeCalled || !startDriverHandshakeCalled) {
+ throw new SwitchDriverSubHandshakeNotStarted();
+ }
+ if (driverHandshakeComplete.get()) {
+ throw new SwitchDriverSubHandshakeCompleted(m);
+ }
+
+ switch (m.getType()) {
+ case BARRIER_REPLY:
+ if (m.getXid() == barrierXidToWaitFor) {
+ driverHandshakeComplete.set(true);
+ }
+ break;
+
+ case ERROR:
+ log.error("Switch {} Error {}", getStringId(), m);
+ break;
+
+ case GET_ASYNC_REPLY:
+ OFAsyncGetReply asrep = (OFAsyncGetReply) m;
+ decodeAsyncGetReply(asrep);
+ break;
+ case STATS_REPLY:
+ processStatsReply((OFStatsReply) m);
+ break;
+ case PACKET_IN:
+ case PORT_STATUS:
+ case QUEUE_GET_CONFIG_REPLY:
+ case ROLE_REPLY:
+ case FEATURES_REPLY:
+ case FLOW_REMOVED:
+ break;
+
+ default:
+ log.debug("Received message {} during switch-driver subhandshake "
+ + "from switch {} ... Ignoring message", m, getStringId());
+
+ }
+ }
+
+ private void configureSwitch() throws IOException {
+ // setAsyncConfig();
+ // getTableFeatures();
+ sendGroupFeaturesRequest();
+ setL2Groups();
+ sendBarrier(false);
+ setL3Groups();
+ setL25Groups();
+ sendGroupDescRequest();
+ populateTableVlan();
+ populateTableTMac();
+ populateIpTable();
+ populateMplsTable();
+ populateTableMissEntry(TABLE_ACL, false, false, false, -1);
+ sendBarrier(true);
+ }
+
+ private void setAsyncConfig() throws IOException {
+ List msglist = new ArrayList(3);
+ OFMessage setAC = null;
+
+ if (role == RoleState.MASTER) {
+ setAC = factory.buildAsyncSet()
+ .setFlowRemovedMaskEqualMaster(SET_FLOW_REMOVED_MASK_MASTER)
+ .setPacketInMaskEqualMaster(SET_PACKET_IN_MASK_MASTER)
+ .setPortStatusMaskEqualMaster(SET_PORT_STATUS_MASK_MASTER)
+ .setFlowRemovedMaskSlave(SET_ALL_SLAVE)
+ .setPacketInMaskSlave(SET_ALL_SLAVE)
+ .setPortStatusMaskSlave(SET_ALL_SLAVE)
+ .setXid(getNextTransactionId())
+ .build();
+ } else if (role == RoleState.EQUAL) {
+ setAC = factory.buildAsyncSet()
+ .setFlowRemovedMaskEqualMaster(SET_FLOW_REMOVED_MASK_EQUAL)
+ .setPacketInMaskEqualMaster(SET_PACKET_IN_MASK_EQUAL)
+ .setPortStatusMaskEqualMaster(SET_PORT_STATUS_MASK_EQUAL)
+ .setFlowRemovedMaskSlave(SET_ALL_SLAVE)
+ .setPacketInMaskSlave(SET_ALL_SLAVE)
+ .setPortStatusMaskSlave(SET_ALL_SLAVE)
+ .setXid(getNextTransactionId())
+ .build();
+ }
+ msglist.add(setAC);
+
+ OFMessage br = factory.buildBarrierRequest()
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(br);
+
+ OFMessage getAC = factory.buildAsyncGetRequest()
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(getAC);
+
+ sendMsg(msglist);
+ }
+
+ private void decodeAsyncGetReply(OFAsyncGetReply rep) {
+ long frm = rep.getFlowRemovedMaskEqualMaster();
+ //long frs = rep.getFlowRemovedMaskSlave();
+ long pim = rep.getPacketInMaskEqualMaster();
+ //long pis = rep.getPacketInMaskSlave();
+ long psm = rep.getPortStatusMaskEqualMaster();
+ //long pss = rep.getPortStatusMaskSlave();
+
+ if (role == RoleState.MASTER || role == RoleState.EQUAL) { // should separate
+ log.info("FRM:{}", HexString.toHexString((frm & TEST_FLOW_REMOVED_MASK)));
+ log.info("PIM:{}", HexString.toHexString((pim & TEST_PACKET_IN_MASK)));
+ log.info("PSM:{}", HexString.toHexString((psm & TEST_PORT_STATUS_MASK)));
+ }
+
+ }
+
+ private void getTableFeatures() throws IOException {
+ OFMessage gtf = factory.buildTableFeaturesStatsRequest()
+ .setXid(getNextTransactionId())
+ .build();
+ sendMsg(gtf);
+ }
+
+ private void sendGroupFeaturesRequest() throws IOException {
+ OFMessage gfr = factory.buildGroupFeaturesStatsRequest()
+ .setXid(getNextTransactionId())
+ .build();
+ sendMsg(gfr);
+ }
+
+ private void sendGroupDescRequest() throws IOException {
+ OFMessage gdr = factory.buildGroupDescStatsRequest()
+ .setXid(getNextTransactionId())
+ .build();
+ sendMsg(gdr);
+ }
+
+ /*Create L2 interface groups for all physical ports
+ Naming convention followed is the same as OF-DPA spec
+ eg. port 1 with allowed vlan 10, is enveloped in group with id,
+ 0x0 00a 0001, where the uppermost 4 bits identify an L2 interface,
+ the next 12 bits identify the vlan-id, and the lowermost 16 bits
+ identify the port number.*/
+ private void setL2Groups() throws IOException {
+ List msglist = new ArrayList();
+ for (OFPortDesc p : getPorts()) {
+ int pnum = p.getPortNo().getPortNumber();
+ int portVlan = getVlanConfig(pnum);
+ if (U32.of(pnum).compareTo(U32.of(OFPort.MAX.getPortNumber())) < 1) {
+ OFGroup gl2 = OFGroup.of(pnum | (portVlan << VLAN_ID_OFFSET));
+ OFAction out = factory.actions().buildOutput()
+ .setPort(p.getPortNo()).build();
+ OFAction popVlan = factory.actions().popVlan();
+ List actions = new ArrayList();
+ actions.add(popVlan);
+ actions.add(out);
+ OFBucket bucket = factory.buildBucket()
+ .setActions(actions).build();
+ List buckets = Collections.singletonList(bucket);
+ OFMessage gmAdd = factory.buildGroupAdd()
+ .setGroup(gl2)
+ .setBuckets(buckets)
+ .setGroupType(OFGroupType.INDIRECT)
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(gmAdd);
+ l2groups.put(pnum, gl2);
+ }
+ }
+ log.debug("Creating {} L2 groups in sw {}", msglist.size(), getStringId());
+ sendMsg(msglist);
+ }
+
+ private int getVlanConfig(int portnum) {
+ int portVlan = 10 * portnum;
+ if ((getId() == 0x1 && portnum == 6) ||
+ (getId() == 0x2) ||
+ (getId() == 0x3 && portnum == 2)) {
+ portVlan = 192; // 0xc0
+ }
+ return portVlan;
+ }
+
+ private MacAddress getRouterMacAddr() {
+ if (getId() == 0x3) {
+ return MacAddress.of("00:00:07:07:07:80"); // router mac
+ }
+ if (getId() == 0x1) {
+ return MacAddress.of("00:00:01:01:01:80");
+ }
+ // switch 0x2
+ return MacAddress.of("00:00:02:02:02:80");
+ }
+
+ // only for ports connected to other routers
+ private OFAction getDestAction(int portnum) {
+ OFAction setDA = null;
+ MacAddress dAddr = null;
+ if (getId() == 0x1 && portnum == 6) { // connected to switch 2
+ dAddr = MacAddress.of("00:00:02:02:02:80");
+ }
+ if (getId() == 0x2) {
+ if (portnum == 1) { // connected to sw 1
+ dAddr = MacAddress.of("00:00:01:01:01:80");
+ } else if (portnum == 2) { // connected to sw 3
+ dAddr = MacAddress.of("00:00:07:07:07:80");
+ }
+ }
+ if (getId() == 0x3) {
+ if (portnum == 2) { // connected to switch 2
+ dAddr = MacAddress.of("00:00:02:02:02:80");
+ }
+ }
+
+ if (dAddr != null) {
+ OFOxmEthDst dstAddr = factory.oxms().ethDst(dAddr);
+ setDA = factory.actions().buildSetField()
+ .setField(dstAddr).build();
+ }
+ return setDA;
+ }
+
+ /*
+ * L3 groups are created for all router ports and they all point to corresponding
+ * L2 groups. Only the ports that connect to other routers will have the
+ * DA set.
+ */
+ private void setL3Groups() throws IOException {
+ List msglist = new ArrayList();
+ for (OFGroup gl2 : l2groups.values()) {
+ int gnum = gl2.getGroupNumber();
+ int portnum = gnum & 0x0000ffff;
+ int vlanid = ((gnum & 0x0fff0000) >> VLAN_ID_OFFSET);
+ MacAddress sAddr = getRouterMacAddr();
+
+ OFGroup gl3 = OFGroup.of(0x20000000 | portnum);
+ OFAction group = factory.actions().buildGroup()
+ .setGroup(gl2).build();
+ OFOxmEthSrc srcAddr = factory.oxms().ethSrc(sAddr);
+ OFAction setSA = factory.actions().buildSetField()
+ .setField(srcAddr).build();
+ OFOxmVlanVid vid = factory.oxms().vlanVid(OFVlanVidMatch.ofVlan(vlanid));
+ OFAction setVlan = factory.actions().buildSetField()
+ .setField(vid).build();
+ OFAction decTtl = factory.actions().decNwTtl();
+
+ List actions = new ArrayList();
+ actions.add(decTtl); // decrement the IP TTL/do-checksum/check TTL
+ // and MTU
+ actions.add(setVlan); // set the vlan-id of the exit-port (and
+ // l2group)
+ actions.add(setSA); // set this routers mac address
+ // make L3Unicast group setDA for known (configured) ports
+ // that connect to other routers
+ OFAction setDA = getDestAction(portnum);
+ if (setDA != null) {
+ actions.add(setDA);
+ }
+ actions.add(group);
+
+ OFBucket bucket = factory.buildBucket()
+ .setActions(actions).build();
+ List buckets = Collections.singletonList(bucket);
+ OFMessage gmAdd = factory.buildGroupAdd()
+ .setGroup(gl3)
+ .setBuckets(buckets)
+ .setGroupType(OFGroupType.INDIRECT)
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(gmAdd);
+ }
+ sendMsg(msglist);
+ log.debug("Creating {} L3 groups in sw {}", msglist.size(), getStringId());
+ }
+
+ /*
+ * L2.5 or mpls-unicast groups are only created for those router ports
+ * connected to other router ports. They differ from the corresponding
+ * L3-unicast group only by the fact that they decrement the MPLS TTL
+ * instead of the IP ttl
+ */
+ private void setL25Groups() throws IOException {
+ List msglist = new ArrayList();
+ for (OFGroup gl2 : l2groups.values()) {
+ int gnum = gl2.getGroupNumber();
+ int portnum = gnum & 0x0000ffff;
+ int vlanid = ((gnum & 0x0fff0000) >> VLAN_ID_OFFSET);
+ MacAddress sAddr = getRouterMacAddr();
+ OFAction setDA = getDestAction(portnum);
+ // setDA will only be non-null for ports connected to routers
+ if (setDA != null) {
+ OFGroup gl3 = OFGroup.of(0xa0000000 | portnum); // different id
+ // for mpls
+ // group
+ OFAction group = factory.actions().buildGroup()
+ .setGroup(gl2).build();
+ OFOxmEthSrc srcAddr = factory.oxms().ethSrc(sAddr);
+ OFAction setSA = factory.actions().buildSetField()
+ .setField(srcAddr).build();
+ OFOxmVlanVid vid = factory.oxms().vlanVid(OFVlanVidMatch.ofVlan(vlanid));
+ OFAction setVlan = factory.actions().buildSetField()
+ .setField(vid).build();
+ OFAction decMplsTtl = factory.actions().decMplsTtl();
+ List actions = new ArrayList();
+ actions.add(decMplsTtl); // decrement the MPLS
+ // TTL/do-checksum/check TTL and MTU
+ actions.add(setVlan); // set the vlan-id of the exit-port (and
+ // l2group)
+ actions.add(setSA); // set this routers mac address
+ actions.add(setDA);
+ actions.add(group);
+ OFBucket bucket = factory.buildBucket()
+ .setActions(actions).build();
+ List buckets = Collections.singletonList(bucket);
+ OFMessage gmAdd = factory.buildGroupAdd()
+ .setGroup(gl3)
+ .setBuckets(buckets)
+ .setGroupType(OFGroupType.INDIRECT)
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(gmAdd);
+ }
+ }
+ sendMsg(msglist);
+ log.debug("Creating {} MPLS groups in sw {}", msglist.size(), getStringId());
+ }
+
+ /* Using ECMP groups
+ *
+ * OFGroup group47 = OFGroup.of(47);
+ OFAction outgroup1 = factory.actions()
+ .buildGroup()
+ .setGroup(group61)
+ .build();
+ OFBucket buc47_1 = factory.buildBucket()
+ .setWeight(1)
+ .setActions(Collections.singletonList(outgroup1))
+ .build();
+ OFAction outgroup2 = factory.actions()
+ .buildGroup()
+ .setGroup(group62)
+ .build();
+ OFBucket buc47_2 = factory.buildBucket()
+ .setWeight(1)
+ .setActions(Collections.singletonList(outgroup2))
+ .build();
+ List buckets47 = new ArrayList();
+ buckets47.add(buc47_1);
+ buckets47.add(buc47_2);
+ OFMessage gmS12 = factory.buildGroupAdd()
+ .setGroup(group47)
+ .setBuckets(buckets47)
+ .setGroupType(OFGroupType.SELECT)
+ .setXid(getNextTransactionId())
+ .build();
+ write(gmS12, null); */
+
+ private void processStatsReply(OFStatsReply sr) {
+ switch (sr.getStatsType()) {
+ case AGGREGATE:
+ break;
+ case DESC:
+ break;
+ case EXPERIMENTER:
+ break;
+ case FLOW:
+ break;
+ case GROUP_DESC:
+ processGroupDesc((OFGroupDescStatsReply) sr);
+ break;
+ case GROUP_FEATURES:
+ processGroupFeatures((OFGroupFeaturesStatsReply) sr);
+ break;
+ case METER_CONFIG:
+ break;
+ case METER_FEATURES:
+ break;
+ case PORT_DESC:
+ break;
+ case TABLE_FEATURES:
+ break;
+ default:
+ break;
+
+ }
+ }
+
+ private void processGroupFeatures(OFGroupFeaturesStatsReply gfsr) {
+ log.info("Sw: {} Group Features {}", getStringId(), gfsr);
+ }
+
+ private void processGroupDesc(OFGroupDescStatsReply gdsr) {
+ log.info("Sw: {} Group Desc {}", getStringId(), gdsr);
+ }
+
+ private void populateTableVlan() throws IOException {
+ // for all incoming ports assign configured port-vlans
+ // currently assign portnum*10 -> vlanid to access ports
+ // and vlan 192 to router to router ports
+ List msglist = new ArrayList();
+ for (OFPortDesc p : getPorts()) {
+ int pnum = p.getPortNo().getPortNumber();
+ if (U32.of(pnum).compareTo(U32.of(OFPort.MAX.getPortNumber())) < 1) {
+ int vlanid = getVlanConfig(pnum);
+ OFOxmInPort oxp = factory.oxms().inPort(p.getPortNo());
+ OFOxmVlanVid oxv = factory.oxms()
+ .vlanVid(OFVlanVidMatch.UNTAGGED);
+ OFOxmList oxmList = OFOxmList.of(oxp, oxv);
+ OFMatchV3 match = factory.buildMatchV3()
+ .setOxmList(oxmList).build();
+ OFOxmVlanVid vidToSet = factory.oxms()
+ .vlanVid(OFVlanVidMatch.ofVlan(vlanid));
+ OFAction pushVlan = factory.actions().pushVlan(EthType.VLAN_FRAME);
+ OFAction setVlan = factory.actions().setField(vidToSet);
+ List actionlist = new ArrayList();
+ actionlist.add(pushVlan);
+ actionlist.add(setVlan);
+ OFInstruction appAction = factory.instructions().buildApplyActions()
+ .setActions(actionlist).build();
+ OFInstruction gotoTbl = factory.instructions().buildGotoTable()
+ .setTableId(TableId.of(TABLE_TMAC)).build();
+ List instructions = new ArrayList();
+ instructions.add(appAction);
+ instructions.add(gotoTbl);
+ OFMessage flowEntry = factory.buildFlowAdd()
+ .setTableId(TableId.of(TABLE_VLAN))
+ .setMatch(match)
+ .setInstructions(instructions)
+ .setPriority(1000) // does not matter - all rules
+ // exclusive
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setIdleTimeout(0)
+ .setHardTimeout(0)
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(flowEntry);
+ }
+ }
+ // table-vlan has no table-miss entry, and so packets that miss are
+ // essentially dropped
+ sendMsg(msglist);
+ log.debug("Adding {} vlan-rules in sw {}", msglist.size(), getStringId());
+ }
+
+ private void populateTableTMac() throws IOException {
+ // match for ip packets
+ OFOxmEthType oxe = factory.oxms().ethType(EthType.IPv4);
+ OFOxmList oxmListIp = OFOxmList.of(oxe);
+ OFMatchV3 matchIp = factory.buildMatchV3()
+ .setOxmList(oxmListIp).build();
+ OFInstruction gotoTblIp = factory.instructions().buildGotoTable()
+ .setTableId(TableId.of(TABLE_IPV4_UNICAST)).build();
+ List instructionsIp = Collections.singletonList(gotoTblIp);
+ OFMessage ipEntry = factory.buildFlowAdd()
+ .setTableId(TableId.of(TABLE_TMAC))
+ .setMatch(matchIp)
+ .setInstructions(instructionsIp)
+ .setPriority(1000) // strict priority required lower than
+ // multicastMac
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setIdleTimeout(0)
+ .setHardTimeout(0)
+ .setXid(getNextTransactionId())
+ .build();
+
+ // match for mpls packets
+ OFOxmEthType oxmpls = factory.oxms().ethType(EthType.MPLS_UNICAST);
+ OFOxmList oxmListMpls = OFOxmList.of(oxmpls);
+ OFMatchV3 matchMpls = factory.buildMatchV3()
+ .setOxmList(oxmListMpls).build();
+ OFInstruction gotoTblMpls = factory.instructions().buildGotoTable()
+ .setTableId(TableId.of(TABLE_MPLS)).build();
+ List instructionsMpls = Collections.singletonList(gotoTblMpls);
+ OFMessage mplsEntry = factory.buildFlowAdd()
+ .setTableId(TableId.of(TABLE_TMAC))
+ .setMatch(matchMpls)
+ .setInstructions(instructionsMpls)
+ .setPriority(1001) // strict priority required lower than
+ // multicastMac
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setIdleTimeout(0)
+ .setHardTimeout(0)
+ .setXid(getNextTransactionId())
+ .build();
+
+ // match for everything else to send to controller. Essentially
+ // the table miss flow entry
+ populateTableMissEntry(TABLE_TMAC, true, false, false, -1);
+ log.debug("Adding termination-mac-rules in sw {}", getStringId());
+ List msglist = new ArrayList(2);
+ msglist.add(ipEntry);
+ msglist.add(mplsEntry);
+ sendMsg(msglist);
+ }
+
+ private List getMyIps() { // send to controller
+ List myIps = new ArrayList();
+ if (getId() == 0x1) {
+ myIps.add("10.0.2.128");
+ myIps.add("10.0.3.128");
+ myIps.add("10.0.1.128");
+ myIps.add("192.168.0.1");
+ }
+ if (getId() == 0x2) {
+ myIps.add("192.168.0.2");
+ }
+ if (getId() == 0x3) {
+ myIps.add("192.168.0.3");
+ myIps.add("7.7.7.128");
+ }
+ return myIps;
+ }
+
+ private List getMySubnetIps() { // send to controller
+ List subnetIps = new ArrayList();
+ if (getId() == 0x1) {
+ subnetIps.add("10.0.2.0");
+ subnetIps.add("10.0.3.0");
+ subnetIps.add("10.0.1.0");
+ }
+ // TODO needed?
+ //if (getId() == 0x2) {
+ //}
+ if (getId() == 0x3) {
+ subnetIps.add("7.7.7.0");
+ }
+ return subnetIps;
+ }
+
+ private static class RouteEntry {
+ String prefix;
+ String mask;
+ int nextHopPort;
+ String dstMac;
+ int label;
+
+ public RouteEntry(String prefix, String mask, int nextHopPort, int label) {
+ this.prefix = prefix;
+ this.mask = mask;
+ this.nextHopPort = nextHopPort;
+ this.label = label;
+ }
+
+ public RouteEntry(String prefix, int nextHopPort, String dstMac) {
+ this.prefix = prefix;
+ this.nextHopPort = nextHopPort;
+ this.dstMac = dstMac;
+ }
+ }
+
+ // send out of mpls-group where the next-hop mac-da is already set
+ private List getRouterNextHopIps() {
+ List routerNextHopIps = new ArrayList();
+ if (getId() == 0x1) {
+ routerNextHopIps
+ .add(new RouteEntry("192.168.0.2", "255.255.255.255", 6, 102));
+ routerNextHopIps
+ .add(new RouteEntry("192.168.0.3", "255.255.255.255", 6, 103));
+ routerNextHopIps.add(new RouteEntry("7.7.7.0", "255.255.255.0", 6, 103));
+ }
+ //if (getId() == 0x2) {
+ /* These are required for normal IP routing without labels.
+ routerNextHopIps.add(new RouteEntry("192.168.0.1","255.255.255.255",1));
+ routerNextHopIps.add(new RouteEntry("192.168.0.3","255.255.255.255",2));
+ routerNextHopIps.add(new RouteEntry("10.0.1.0","255.255.255.0",1));
+ routerNextHopIps.add(new RouteEntry("10.0.2.0","255.255.255.0",1));
+ routerNextHopIps.add(new RouteEntry("10.0.3.0","255.255.255.0",1));
+ routerNextHopIps.add(new RouteEntry("7.7.7.0","255.255.255.0",2));*/
+ //}
+ if (getId() == 0x3) {
+ routerNextHopIps
+ .add(new RouteEntry("192.168.0.2", "255.255.255.255", 2, 102));
+ routerNextHopIps
+ .add(new RouteEntry("192.168.0.1", "255.255.255.255", 2, 101));
+ routerNextHopIps.add(new RouteEntry("10.0.1.0", "255.255.255.0", 2, 101));
+ routerNextHopIps.add(new RouteEntry("10.0.2.0", "255.255.255.0", 2, 101));
+ routerNextHopIps.add(new RouteEntry("10.0.3.0", "255.255.255.0", 2, 101));
+ }
+ return routerNextHopIps;
+ }
+
+ // known host mac-addr, setDA/send out of l3group
+ private List getHostNextHopIps() {
+ List hostNextHopIps = new ArrayList();
+ if (getId() == 0x1) {
+ hostNextHopIps.add(new RouteEntry("10.0.2.1", 4, "00:00:00:00:02:01"));
+ hostNextHopIps.add(new RouteEntry("10.0.3.1", 5, "00:00:00:00:03:01"));
+ }
+ // TODO needed?
+ //if (getId() == 0x2) {
+ //}
+ if (getId() == 0x3) {
+ hostNextHopIps.add(new RouteEntry("7.7.7.7", 1, "00:00:07:07:07:07"));
+ }
+ return hostNextHopIps;
+ }
+
+ private void populateIpTable() throws IOException {
+ populateMyIps();
+ populateMySubnets();
+ populateRoutes();
+ populateHostRoutes();
+
+ // match for everything else to send to ACL table. Essentially
+ // the table miss flow entry
+ populateTableMissEntry(TABLE_IPV4_UNICAST, false, true,
+ true, TABLE_ACL);
+ }
+
+ private void populateMyIps() throws IOException {
+ List msglist = new ArrayList();
+ // first all my ip's as exact-matches
+ // write-action instruction to send to controller
+ List myIps = getMyIps();
+ for (int i = 0; i < myIps.size(); i++) {
+ OFOxmEthType ethTypeIp = factory.oxms()
+ .ethType(EthType.IPv4);
+ OFOxmIpv4DstMasked ipPrefix = factory.oxms()
+ .ipv4DstMasked(IPv4Address.of(myIps.get(i)), IPv4Address.NO_MASK);
+ OFOxmList oxmListSlash32 = OFOxmList.of(ethTypeIp, ipPrefix);
+ OFMatchV3 match = factory.buildMatchV3()
+ .setOxmList(oxmListSlash32).build();
+ OFAction outc = factory.actions().buildOutput()
+ .setPort(OFPort.CONTROLLER).setMaxLen(OFPCML_NO_BUFFER)
+ .build();
+ OFInstruction writeInstr = factory.instructions().buildWriteActions()
+ .setActions(Collections.singletonList(outc)).build();
+ OFInstruction gotoInstr = factory.instructions().buildGotoTable()
+ .setTableId(TableId.of(TABLE_ACL)).build();
+ List instructions = new ArrayList();
+ instructions.add(writeInstr);
+ instructions.add(gotoInstr);
+ OFMessage myIpEntry = factory.buildFlowAdd()
+ .setTableId(TableId.of(TABLE_IPV4_UNICAST))
+ .setMatch(match)
+ .setInstructions(instructions)
+ .setPriority(MAX_PRIORITY) // highest priority for exact
+ // match
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setIdleTimeout(0)
+ .setHardTimeout(0)
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(myIpEntry);
+ }
+ sendMsg(msglist);
+ log.debug("Adding {} my-ip-rules in sw {}", msglist.size(), getStringId());
+ }
+
+ private void populateMySubnets() throws IOException {
+ List msglist = new ArrayList();
+ // next prefix-based subnet-IP's configured on my interfaces
+ // need to ARP for exact-IP, so write-action instruction to send to
+ // controller
+ // this has different mask and priority than earlier case
+ List subnetIps = getMySubnetIps();
+ for (int i = 0; i < subnetIps.size(); i++) {
+ OFOxmEthType ethTypeIp = factory.oxms()
+ .ethType(EthType.IPv4);
+ OFOxmIpv4DstMasked ipPrefix = factory.oxms().ipv4DstMasked(
+ IPv4Address.of(subnetIps.get(i)),
+ IPv4Address.of(0xffffff00)); // '/24' mask
+ OFOxmList oxmListSlash24 = OFOxmList.of(ethTypeIp, ipPrefix);
+ OFMatchV3 match = factory.buildMatchV3()
+ .setOxmList(oxmListSlash24).build();
+ OFAction outc = factory.actions().buildOutput()
+ .setPort(OFPort.CONTROLLER).setMaxLen(OFPCML_NO_BUFFER)
+ .build();
+ OFInstruction writeInstr = factory.instructions().buildWriteActions()
+ .setActions(Collections.singletonList(outc)).build();
+ OFInstruction gotoInstr = factory.instructions().buildGotoTable()
+ .setTableId(TableId.of(TABLE_ACL)).build();
+ List instructions = new ArrayList();
+ instructions.add(writeInstr);
+ instructions.add(gotoInstr);
+ OFMessage myIpEntry = factory.buildFlowAdd()
+ .setTableId(TableId.of(TABLE_IPV4_UNICAST))
+ .setMatch(match)
+ .setInstructions(instructions)
+ .setPriority(SLASH_24_PRIORITY)
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setIdleTimeout(0)
+ .setHardTimeout(0)
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(myIpEntry);
+ }
+ sendMsg(msglist);
+ log.debug("Adding {} subnet-ip-rules in sw {}", msglist.size(), getStringId());
+ msglist.clear();
+ }
+
+ private void populateRoutes() throws IOException {
+ List msglist = new ArrayList();
+ // addresses where I know the next-hop's mac-address because it is a
+ // router port - so I have an L3 interface to it (and an MPLS interface)
+ List routerNextHopIps = getRouterNextHopIps();
+ for (int i = 0; i < routerNextHopIps.size(); i++) {
+ OFOxmEthType ethTypeIp = factory.oxms()
+ .ethType(EthType.IPv4);
+ OFOxmIpv4DstMasked ipPrefix = factory.oxms()
+ .ipv4DstMasked(
+ IPv4Address.of(routerNextHopIps.get(i).prefix),
+ IPv4Address.of(routerNextHopIps.get(i).mask)
+ );
+ OFOxmList oxmListSlash32 = OFOxmList.of(ethTypeIp, ipPrefix);
+ OFMatchV3 match = factory.buildMatchV3()
+ .setOxmList(oxmListSlash32).build();
+ OFAction outg = factory.actions().buildGroup()
+ .setGroup(OFGroup.of(0xa0000000 | // mpls group id
+ routerNextHopIps.get(i).nextHopPort))
+ .build();
+ // lots of actions before forwarding to mpls group, and
+ // unfortunately
+ // they need to be apply-actions
+
+ OFAction pushlabel = factory.actions().pushMpls(EthType.MPLS_UNICAST);
+ OFOxmMplsLabel l = factory.oxms()
+ .mplsLabel(U32.of(routerNextHopIps.get(i).label));
+ OFAction setlabelid = factory.actions().buildSetField()
+ .setField(l).build();
+ OFAction copyTtlOut = factory.actions().copyTtlOut();
+ // OFAction setBos =
+ // factory.actions().buildSetField().setField(bos).build();
+
+ /*
+ writeActions.add(pushlabel); // need to be apply actions so can be
+ writeActions.add(copyTtlOut); // matched in pseudo-table
+ //writeActions.add(setlabelid); // bad support in cpqd
+ //writeActions.add(setBos); no support in loxigen
+ */
+
+ List applyActions = new ArrayList();
+ applyActions.add(pushlabel);
+ applyActions.add(copyTtlOut);
+ OFInstruction applyInstr = factory.instructions().buildApplyActions()
+ .setActions(applyActions).build();
+ List writeActions = new ArrayList();
+ writeActions.add(outg); // group will decr mpls-ttl, set mac-sa/da,
+ // vlan
+ OFInstruction writeInstr = factory.instructions().buildWriteActions()
+ .setActions(writeActions).build();
+
+ // necessary to match in pseudo-table to overcome cpqd 1.3 flaw
+ OFInstruction writeMeta = factory.instructions().buildWriteMetadata()
+ .setMetadata(U64.of(routerNextHopIps.get(i).label))
+ .setMetadataMask(METADATA_MASK).build();
+ /*OFInstruction gotoInstr = factory.instructions().buildGotoTable()
+ .setTableId(TableId.of(TABLE_ACL)).build();*/
+ OFInstruction gotoInstr = factory.instructions().buildGotoTable()
+ .setTableId(TableId.of(TABLE_META)).build();
+ List instructions = new ArrayList();
+ instructions.add(applyInstr);
+ // instructions.add(writeInstr);// cannot write here - causes switch
+ // to crash
+ instructions.add(writeMeta);
+ instructions.add(gotoInstr);
+
+ int priority = -1;
+ if (routerNextHopIps.get(i).mask.equals("255.255.255.255")) {
+ priority = MAX_PRIORITY;
+ } else {
+ priority = SLASH_24_PRIORITY;
+ }
+ OFMessage myIpEntry = factory.buildFlowAdd()
+ .setTableId(TableId.of(TABLE_IPV4_UNICAST))
+ .setMatch(match)
+ .setInstructions(instructions)
+ .setPriority(priority)
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setIdleTimeout(0)
+ .setHardTimeout(0)
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(myIpEntry);
+
+ // need to also handle psuedo-table entries to match-metadata and
+ // set mpls
+ // label-id
+ OFOxmEthType ethTypeMpls = factory.oxms()
+ .ethType(EthType.MPLS_UNICAST);
+ OFOxmMetadataMasked meta = factory.oxms()
+ .metadataMasked(
+ OFMetadata.ofRaw(routerNextHopIps.get(i).label),
+ OFMetadata.NO_MASK);
+ OFOxmList oxmListMeta = OFOxmList.of(ethTypeMpls, meta);
+ OFMatchV3 matchMeta = factory.buildMatchV3()
+ .setOxmList(oxmListMeta).build();
+ List writeActions2 = new ArrayList();
+ writeActions2.add(setlabelid);
+ OFAction outg2 = factory.actions().buildGroup()
+ .setGroup(OFGroup.of(routerNextHopIps.get(i).nextHopPort |
+ (192 << VLAN_ID_OFFSET)))
+ .build();
+ writeActions2.add(outg2);
+ OFInstruction writeInstr2 = factory.instructions().buildWriteActions()
+ .setActions(writeActions2).build();
+ OFInstruction gotoInstr2 = factory.instructions().buildGotoTable()
+ .setTableId(TableId.of(TABLE_ACL)).build();
+ List instructions2 = new ArrayList();
+ // unfortunately have to apply this action too
+ OFInstruction applyInstr2 = factory.instructions().buildApplyActions()
+ .setActions(writeActions2).build();
+ instructions2.add(applyInstr2);
+ // instructions2.add(writeInstr2);
+ // instructions2.add(gotoInstr2);
+
+ /*OFMatchV3 match3 = factory.buildMatchV3()
+ .setOxmList(OFOxmList.of(meta)).build();
+ OFInstruction clearInstruction = factory.instructions().clearActions();
+ List instructions3 = new ArrayList();
+ OFAction outc = factory.actions().buildOutput()
+ .setPort(OFPort.CONTROLLER).setMaxLen(OFPCML_NO_BUFFER)
+ .build();
+ OFInstruction writec = factory.instructions()
+ .writeActions(Collections.singletonList(outc));
+ instructions3.add(clearInstruction);
+ instructions3.add(writec);
+ instructions3.add(gotoInstr2); */
+ OFMessage myMetaEntry = factory.buildFlowAdd()
+ .setTableId(TableId.of(TABLE_META))
+ .setMatch(matchMeta)
+ .setInstructions(instructions2)
+ .setPriority(MAX_PRIORITY)
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setIdleTimeout(0)
+ .setHardTimeout(0)
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(myMetaEntry);
+
+ }
+ sendMsg(msglist);
+ log.debug("Adding {} next-hop-router-rules in sw {}", msglist.size(),
+ getStringId());
+
+ // add a table-miss entry to table 4 for debugging - leave it out
+ // unclear packet state - causes switch to crash
+ // populateTableMissEntry(TABLE_META, false, true,
+ // true, TABLE_ACL);
+ }
+
+ private void populateHostRoutes() throws IOException {
+ List msglist = new ArrayList();
+ // addresses where I know the next hop's mac-address and I can set the
+ // destination mac in the match-instruction.write-action
+ // either I sent out arp-request or I got an arp-request from this host
+ List hostNextHopIps = getHostNextHopIps();
+ for (int i = 0; i < hostNextHopIps.size(); i++) {
+ OFOxmEthType ethTypeIp = factory.oxms()
+ .ethType(EthType.IPv4);
+ OFOxmIpv4DstMasked ipPrefix = factory.oxms()
+ .ipv4DstMasked(
+ IPv4Address.of(hostNextHopIps.get(i).prefix),
+ IPv4Address.NO_MASK); // host addr should be /32
+ OFOxmList oxmListSlash32 = OFOxmList.of(ethTypeIp, ipPrefix);
+ OFMatchV3 match = factory.buildMatchV3()
+ .setOxmList(oxmListSlash32).build();
+ OFAction setDmac = null, outg = null;
+ OFOxmEthDst dmac = factory.oxms()
+ .ethDst(MacAddress.of(hostNextHopIps.get(i).dstMac));
+ setDmac = factory.actions().buildSetField()
+ .setField(dmac).build();
+ outg = factory.actions().buildGroup()
+ .setGroup(OFGroup.of(0x20000000 | hostNextHopIps.get(i).nextHopPort)) // l3group
+ // id
+ .build();
+ List writeActions = new ArrayList();
+ writeActions.add(setDmac);
+ writeActions.add(outg);
+ OFInstruction writeInstr = factory.instructions().buildWriteActions()
+ .setActions(writeActions).build();
+ OFInstruction gotoInstr = factory.instructions().buildGotoTable()
+ .setTableId(TableId.of(TABLE_ACL)).build();
+ List instructions = new ArrayList();
+ instructions.add(writeInstr);
+ instructions.add(gotoInstr);
+ OFMessage myIpEntry = factory.buildFlowAdd()
+ .setTableId(TableId.of(TABLE_IPV4_UNICAST))
+ .setMatch(match)
+ .setInstructions(instructions)
+ .setPriority(MAX_PRIORITY) // highest priority for exact
+ // match
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setIdleTimeout(0)
+ .setHardTimeout(0)
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(myIpEntry);
+ }
+ sendMsg(msglist);
+ log.debug("Adding {} next-hop-host-rules in sw {}", msglist.size(), getStringId());
+ }
+
+ private static class MplsEntry {
+ int labelid;
+ int portnum;
+
+ public MplsEntry(int labelid, int portnum) {
+ this.labelid = labelid;
+ this.portnum = portnum;
+ }
+ }
+
+ private List getMplsEntries() {
+ List myLabels = new ArrayList();
+ if (getId() == 0x1) {
+ myLabels.add(new MplsEntry(101, OFPort.CONTROLLER.getPortNumber()));
+ myLabels.add(new MplsEntry(103, 6));
+ }
+ if (getId() == 0x2) {
+ myLabels.add(new MplsEntry(103, 2));
+ myLabels.add(new MplsEntry(102, OFPort.CONTROLLER.getPortNumber()));
+ myLabels.add(new MplsEntry(101, 1));
+ }
+ if (getId() == 0x3) {
+ myLabels.add(new MplsEntry(103, OFPort.CONTROLLER.getPortNumber()));
+ myLabels.add(new MplsEntry(101, 2));
+ }
+ return myLabels;
+ }
+
+ private void populateMplsTable() throws IOException {
+ List msglist = new ArrayList();
+ List lfibEntries = getMplsEntries();
+ for (int i = 0; i < lfibEntries.size(); i++) {
+ OFOxmEthType ethTypeMpls = factory.oxms()
+ .ethType(EthType.MPLS_UNICAST);
+ OFOxmMplsLabel labelid = factory.oxms()
+ .mplsLabel(U32.of(lfibEntries.get(i).labelid));
+ OFOxmList oxmList = OFOxmList.of(ethTypeMpls, labelid);
+ OFMatchV3 matchlabel = factory.buildMatchV3()
+ .setOxmList(oxmList).build();
+ OFAction poplabel = factory.actions().popMpls(EthType.IPv4);
+ OFAction sendTo = null;
+ if (lfibEntries.get(i).portnum == OFPort.CONTROLLER.getPortNumber()) {
+ sendTo = factory.actions().output(OFPort.CONTROLLER,
+ OFPCML_NO_BUFFER);
+ } else {
+ sendTo = factory.actions().group(OFGroup.of(
+ 0xa0000000 | lfibEntries.get(i).portnum));
+ }
+ List writeActions = new ArrayList();
+ writeActions.add(poplabel);
+ writeActions.add(sendTo);
+ OFInstruction writeInstr = factory.instructions().buildWriteActions()
+ .setActions(writeActions).build();
+ OFInstruction gotoInstr = factory.instructions().buildGotoTable()
+ .setTableId(TableId.of(TABLE_ACL)).build();
+ List instructions = new ArrayList();
+ instructions.add(writeInstr);
+ instructions.add(gotoInstr);
+ OFMessage myMplsEntry = factory.buildFlowAdd()
+ .setTableId(TableId.of(TABLE_MPLS))
+ .setMatch(matchlabel)
+ .setInstructions(instructions)
+ .setPriority(MAX_PRIORITY) // exact match and exclusive
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setIdleTimeout(0)
+ .setHardTimeout(0)
+ .setXid(getNextTransactionId())
+ .build();
+ msglist.add(myMplsEntry);
+ }
+ sendMsg(msglist);
+ log.debug("Adding {} mpls-forwarding-rules in sw {}", msglist.size(),
+ getStringId());
+
+ // match for everything else to send to ACL table. Essentially
+ // the table miss flow entry
+ populateTableMissEntry(TABLE_MPLS, false, true,
+ true, TABLE_ACL);
+
+ }
+
+ /**
+ * By default if none of the booleans in the call are set, then the
+ * table-miss entry is added with no instructions, which means that pipeline
+ * execution will stop, and the action set associated with the packet will
+ * be executed.
+ *
+ * @param tableToAdd
+ * @param toControllerNow as an APPLY_ACTION instruction
+ * @param toControllerWrite as a WRITE_ACITION instruction
+ * @param toTable as a GOTO_TABLE instruction
+ * @param tableToSend
+ * @throws IOException
+ */
+ @SuppressWarnings("unchecked")
+ private void populateTableMissEntry(int tableToAdd, boolean toControllerNow,
+ boolean toControllerWrite,
+ boolean toTable, int tableToSend) {
+ OFOxmList oxmList = OFOxmList.EMPTY;
+ OFMatchV3 match = factory.buildMatchV3()
+ .setOxmList(oxmList)
+ .build();
+ OFAction outc = factory.actions()
+ .buildOutput()
+ .setPort(OFPort.CONTROLLER)
+ .setMaxLen(OFPCML_NO_BUFFER)
+ .build();
+ List instructions = new ArrayList();
+ if (toControllerNow) {
+ // table-miss instruction to send to controller immediately
+ OFInstruction instr = factory.instructions()
+ .buildApplyActions()
+ .setActions(Collections.singletonList(outc))
+ .build();
+ instructions.add(instr);
+ }
+
+ if (toControllerWrite) {
+ // table-miss instruction to write-action to send to controller
+ // this will be executed whenever the action-set gets executed
+ OFInstruction instr = factory.instructions()
+ .buildWriteActions()
+ .setActions(Collections.singletonList(outc))
+ .build();
+ instructions.add(instr);
+ }
+
+ if (toTable) {
+ // table-miss instruction to goto-table x
+ OFInstruction instr = factory.instructions()
+ .gotoTable(TableId.of(tableToSend));
+ instructions.add(instr);
+ }
+
+ if (!toControllerNow && !toControllerWrite && !toTable) {
+ // table-miss has no instruction - at which point action-set will be
+ // executed - if there is an action to output/group in the action
+ // set
+ // the packet will be sent there, otherwise it will be dropped.
+ instructions = Collections.EMPTY_LIST;
+ }
+
+ OFMessage tableMissEntry = factory.buildFlowAdd()
+ .setTableId(TableId.of(tableToAdd))
+ .setMatch(match) // match everything
+ .setInstructions(instructions)
+ .setPriority(MIN_PRIORITY)
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setIdleTimeout(0)
+ .setHardTimeout(0)
+ .setXid(getNextTransactionId())
+ .build();
+ sendMsg(tableMissEntry);
+ }
+
+ private void sendBarrier(boolean finalBarrier) {
+ int xid = getNextTransactionId();
+ if (finalBarrier) {
+ barrierXidToWaitFor = xid;
+ }
+ OFBarrierRequest br = factory
+ .buildBarrierRequest()
+ .setXid(xid)
+ .build();
+ sendMsg(br);
+ }
+
+ @Override
+ public Boolean supportNxRole() {
+ return false;
+ }
+
+ @Override
+ public void write(OFMessage msg) {
+ this.channel.write(msg);
+
+ }
+
+ @Override
+ public void write(List msgs) {
+ this.channel.write(msgs);
+ }
+
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/OFSwitchImplOVS10.java b/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/OFSwitchImplOVS10.java
new file mode 100644
index 0000000000..0de661b0c3
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/OFSwitchImplOVS10.java
@@ -0,0 +1,67 @@
+package org.onlab.onos.of.drivers.impl;
+
+import java.util.Collections;
+import java.util.List;
+
+import org.onlab.onos.of.controller.Dpid;
+import org.onlab.onos.of.controller.driver.AbstractOpenFlowSwitch;
+import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFPortDesc;
+
+/**
+ * OFDescriptionStatistics Vendor (Manufacturer Desc.): Nicira, Inc. Make
+ * (Hardware Desc.) : Open vSwitch Model (Datapath Desc.) : None Software :
+ * 1.11.90 (or whatever version + build) Serial : None
+ */
+public class OFSwitchImplOVS10 extends AbstractOpenFlowSwitch {
+
+ public OFSwitchImplOVS10(Dpid dpid, OFDescStatsReply desc) {
+ super(dpid);
+ setSwitchDescription(desc);
+
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#toString()
+ */
+ @Override
+ public String toString() {
+ return "OFSwitchImplOVS10 [" + ((channel != null)
+ ? channel.getRemoteAddress() : "?")
+ + " DPID[" + ((getStringId() != null) ? getStringId() : "?") + "]]";
+ }
+
+ @Override
+ public Boolean supportNxRole() {
+ return true;
+ }
+
+ @Override
+ public void startDriverHandshake() {}
+
+ @Override
+ public boolean isDriverHandshakeComplete() {
+ return true;
+ }
+
+ @Override
+ public void processDriverHandshakeMessage(OFMessage m) {}
+
+ @Override
+ public void write(OFMessage msg) {
+ channel.write(Collections.singletonList(msg));
+ }
+
+ @Override
+ public void write(List msgs) {
+ channel.write(msgs);
+ }
+
+ @Override
+ public List getPorts() {
+ return Collections.unmodifiableList(features.getPorts());
+ }
+
+
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/OFSwitchImplOVS13.java b/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/OFSwitchImplOVS13.java
new file mode 100644
index 0000000000..3e1b713b42
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/OFSwitchImplOVS13.java
@@ -0,0 +1,233 @@
+package org.onlab.onos.of.drivers.impl;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.List;
+import java.util.concurrent.atomic.AtomicBoolean;
+
+import org.onlab.onos.of.controller.Dpid;
+import org.onlab.onos.of.controller.driver.AbstractOpenFlowSwitch;
+import org.onlab.onos.of.controller.driver.SwitchDriverSubHandshakeAlreadyStarted;
+import org.onlab.onos.of.controller.driver.SwitchDriverSubHandshakeCompleted;
+import org.onlab.onos.of.controller.driver.SwitchDriverSubHandshakeNotStarted;
+import org.projectfloodlight.openflow.protocol.OFBarrierRequest;
+import org.projectfloodlight.openflow.protocol.OFDescStatsReply;
+import org.projectfloodlight.openflow.protocol.OFFactory;
+import org.projectfloodlight.openflow.protocol.OFMatchV3;
+import org.projectfloodlight.openflow.protocol.OFMessage;
+import org.projectfloodlight.openflow.protocol.OFOxmList;
+import org.projectfloodlight.openflow.protocol.action.OFAction;
+import org.projectfloodlight.openflow.protocol.instruction.OFInstruction;
+import org.projectfloodlight.openflow.types.OFBufferId;
+import org.projectfloodlight.openflow.types.OFPort;
+import org.projectfloodlight.openflow.types.TableId;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+/**
+ * OFDescriptionStatistics Vendor (Manufacturer Desc.): Nicira, Inc. Make
+ * (Hardware Desc.) : Open vSwitch Model (Datapath Desc.) : None Software :
+ * 2.1.0 (or whatever version + build) Serial : None
+ */
+public class OFSwitchImplOVS13 extends AbstractOpenFlowSwitch {
+
+ private static Logger log =
+ LoggerFactory.getLogger(OFSwitchImplOVS13.class);
+
+ private final AtomicBoolean driverHandshakeComplete;
+ private OFFactory factory;
+ private long barrierXidToWaitFor = -1;
+
+ private static final short MIN_PRIORITY = 0x0;
+ private static final int OFPCML_NO_BUFFER = 0xffff;
+
+ public OFSwitchImplOVS13(Dpid dpid, OFDescStatsReply desc) {
+ super(dpid);
+ driverHandshakeComplete = new AtomicBoolean(false);
+ setSwitchDescription(desc);
+ }
+
+ @Override
+ public String toString() {
+ return "OFSwitchImplOVS13 [" + ((channel != null)
+ ? channel.getRemoteAddress() : "?")
+ + " DPID[" + ((getStringId() != null) ? getStringId() : "?") + "]]";
+ }
+
+ @Override
+ public void startDriverHandshake() {
+ log.debug("Starting driver handshake for sw {}", getStringId());
+ if (startDriverHandshakeCalled) {
+ throw new SwitchDriverSubHandshakeAlreadyStarted();
+ }
+ startDriverHandshakeCalled = true;
+ factory = factory();
+ configureSwitch();
+ }
+
+ @Override
+ public boolean isDriverHandshakeComplete() {
+ if (!startDriverHandshakeCalled) {
+ throw new SwitchDriverSubHandshakeNotStarted();
+ }
+ return driverHandshakeComplete.get();
+ }
+
+ @Override
+ public void processDriverHandshakeMessage(OFMessage m) {
+ if (!startDriverHandshakeCalled) {
+ throw new SwitchDriverSubHandshakeNotStarted();
+ }
+ if (driverHandshakeComplete.get()) {
+ throw new SwitchDriverSubHandshakeCompleted(m);
+ }
+
+ switch (m.getType()) {
+ case BARRIER_REPLY:
+ if (m.getXid() == barrierXidToWaitFor) {
+ driverHandshakeComplete.set(true);
+ }
+ break;
+
+ case ERROR:
+ log.error("Switch {} Error {}", getStringId(), m);
+ break;
+
+ case FEATURES_REPLY:
+ break;
+ case FLOW_REMOVED:
+ break;
+ case GET_ASYNC_REPLY:
+ // OFAsyncGetReply asrep = (OFAsyncGetReply)m;
+ // decodeAsyncGetReply(asrep);
+ break;
+
+ case PACKET_IN:
+ break;
+ case PORT_STATUS:
+ break;
+ case QUEUE_GET_CONFIG_REPLY:
+ break;
+ case ROLE_REPLY:
+ break;
+
+ case STATS_REPLY:
+ // processStatsReply((OFStatsReply) m);
+ break;
+
+ default:
+ log.debug("Received message {} during switch-driver subhandshake "
+ + "from switch {} ... Ignoring message", m, getStringId());
+
+ }
+ }
+
+
+ private void configureSwitch() {
+ populateTableMissEntry(0, true, false, false, 0);
+ sendBarrier(true);
+ }
+
+
+ private void sendBarrier(boolean finalBarrier) {
+ int xid = getNextTransactionId();
+ if (finalBarrier) {
+ barrierXidToWaitFor = xid;
+ }
+ OFBarrierRequest br = factory
+ .buildBarrierRequest()
+ .setXid(xid)
+ .build();
+ sendMsg(br);
+ }
+
+ @Override
+ public Boolean supportNxRole() {
+ return false;
+ }
+
+ @Override
+ public void write(OFMessage msg) {
+ channel.write(Collections.singletonList(msg));
+
+ }
+
+ @Override
+ public void write(List msgs) {
+ channel.write(msgs);
+ }
+
+ /**
+ * By default if none of the booleans in the call are set, then the
+ * table-miss entry is added with no instructions, which means that pipeline
+ * execution will stop, and the action set associated with the packet will
+ * be executed.
+ *
+ * @param tableToAdd
+ * @param toControllerNow as an APPLY_ACTION instruction
+ * @param toControllerWrite as a WRITE_ACITION instruction
+ * @param toTable as a GOTO_TABLE instruction
+ * @param tableToSend
+ */
+ @SuppressWarnings("unchecked")
+ private void populateTableMissEntry(int tableToAdd, boolean toControllerNow,
+ boolean toControllerWrite,
+ boolean toTable, int tableToSend) {
+ OFOxmList oxmList = OFOxmList.EMPTY;
+ OFMatchV3 match = factory.buildMatchV3()
+ .setOxmList(oxmList)
+ .build();
+ OFAction outc = factory.actions()
+ .buildOutput()
+ .setPort(OFPort.CONTROLLER)
+ .setMaxLen(OFPCML_NO_BUFFER)
+ .build();
+ List instructions = new ArrayList();
+ if (toControllerNow) {
+ // table-miss instruction to send to controller immediately
+ OFInstruction instr = factory.instructions()
+ .buildApplyActions()
+ .setActions(Collections.singletonList(outc))
+ .build();
+ instructions.add(instr);
+ }
+
+ if (toControllerWrite) {
+ // table-miss instruction to write-action to send to controller
+ // this will be executed whenever the action-set gets executed
+ OFInstruction instr = factory.instructions()
+ .buildWriteActions()
+ .setActions(Collections.singletonList(outc))
+ .build();
+ instructions.add(instr);
+ }
+
+ if (toTable) {
+ // table-miss instruction to goto-table x
+ OFInstruction instr = factory.instructions()
+ .gotoTable(TableId.of(tableToSend));
+ instructions.add(instr);
+ }
+
+ if (!toControllerNow && !toControllerWrite && !toTable) {
+ // table-miss has no instruction - at which point action-set will be
+ // executed - if there is an action to output/group in the action
+ // set
+ // the packet will be sent there, otherwise it will be dropped.
+ instructions = Collections.EMPTY_LIST;
+ }
+
+ OFMessage tableMissEntry = factory.buildFlowAdd()
+ .setTableId(TableId.of(tableToAdd))
+ .setMatch(match) // match everything
+ .setInstructions(instructions)
+ .setPriority(MIN_PRIORITY)
+ .setBufferId(OFBufferId.NO_BUFFER)
+ .setIdleTimeout(0)
+ .setHardTimeout(0)
+ .setXid(getNextTransactionId())
+ .build();
+ sendMsg(tableMissEntry);
+ }
+
+}
diff --git a/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/package-info.java b/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/package-info.java
new file mode 100644
index 0000000000..ca2535683b
--- /dev/null
+++ b/openflow/ctl/src/main/java/org/onlab/onos/of/drivers/impl/package-info.java
@@ -0,0 +1,4 @@
+/**
+ * OpenFlow base switch drivers implementations.
+ */
+package org.onlab.onos.of.drivers.impl;
diff --git a/openflow/drivers/pom.xml b/openflow/drivers/pom.xml
new file mode 100644
index 0000000000..7538f10679
--- /dev/null
+++ b/openflow/drivers/pom.xml
@@ -0,0 +1,36 @@
+
+ 4.0.0
+
+
+ org.onlab.onos
+ onos-of
+ 1.0.0-SNAPSHOT
+ ../pom.xml
+
+
+ onos-of-drivers
+ bundle
+
+ ONOS OpenFlow switch drivers & factory
+
+
+
+ org.onlab.onos
+ onos-of-api
+
+
+
+
+
+
+
+
diff --git a/openflow/drivers/src/main/java/org/onlab/onos/of/drivers/impl/DeleteMe.java b/openflow/drivers/src/main/java/org/onlab/onos/of/drivers/impl/DeleteMe.java
new file mode 100644
index 0000000000..7d9176c8a9
--- /dev/null
+++ b/openflow/drivers/src/main/java/org/onlab/onos/of/drivers/impl/DeleteMe.java
@@ -0,0 +1,7 @@
+package org.onlab.onos.of.drivers.impl;
+
+/**
+ * Created by tom on 9/2/14.
+ */
+public class DeleteMe {
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFActionType.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFActionType.java
new file mode 100644
index 0000000000..fe5320dec1
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFActionType.java
@@ -0,0 +1,59 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template const.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+
+public enum OFActionType {
+ OUTPUT,
+ SET_VLAN_VID,
+ SET_VLAN_PCP,
+ STRIP_VLAN,
+ SET_DL_SRC,
+ SET_DL_DST,
+ SET_NW_SRC,
+ SET_NW_DST,
+ SET_NW_TOS,
+ SET_TP_SRC,
+ SET_TP_DST,
+ ENQUEUE,
+ EXPERIMENTER,
+ SET_NW_ECN,
+ COPY_TTL_OUT,
+ COPY_TTL_IN,
+ SET_MPLS_LABEL,
+ SET_MPLS_TC,
+ SET_MPLS_TTL,
+ DEC_MPLS_TTL,
+ PUSH_VLAN,
+ POP_VLAN,
+ PUSH_MPLS,
+ POP_MPLS,
+ SET_QUEUE,
+ GROUP,
+ SET_NW_TTL,
+ DEC_NW_TTL,
+ SET_FIELD,
+ PUSH_PBB,
+ POP_PBB;
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAggregateStatsReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAggregateStatsReply.java
new file mode 100644
index 0000000000..ce8478d5ae
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAggregateStatsReply.java
@@ -0,0 +1,58 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFAggregateStatsReply extends OFObject, OFStatsReply {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ U64 getPacketCount();
+ U64 getByteCount();
+ long getFlowCount();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFStatsReply.Builder {
+ OFAggregateStatsReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ U64 getPacketCount();
+ Builder setPacketCount(U64 packetCount);
+ U64 getByteCount();
+ Builder setByteCount(U64 byteCount);
+ long getFlowCount();
+ Builder setFlowCount(long flowCount);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAggregateStatsRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAggregateStatsRequest.java
new file mode 100644
index 0000000000..e2c6cc206b
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAggregateStatsRequest.java
@@ -0,0 +1,67 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFAggregateStatsRequest extends OFObject, OFStatsRequest, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ TableId getTableId();
+ OFPort getOutPort();
+ OFGroup getOutGroup() throws UnsupportedOperationException;
+ U64 getCookie() throws UnsupportedOperationException;
+ U64 getCookieMask() throws UnsupportedOperationException;
+ Match getMatch();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFStatsRequest.Builder {
+ OFAggregateStatsRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ TableId getTableId();
+ Builder setTableId(TableId tableId);
+ OFPort getOutPort();
+ Builder setOutPort(OFPort outPort);
+ OFGroup getOutGroup() throws UnsupportedOperationException;
+ Builder setOutGroup(OFGroup outGroup) throws UnsupportedOperationException;
+ U64 getCookie() throws UnsupportedOperationException;
+ Builder setCookie(U64 cookie) throws UnsupportedOperationException;
+ U64 getCookieMask() throws UnsupportedOperationException;
+ Builder setCookieMask(U64 cookieMask) throws UnsupportedOperationException;
+ Match getMatch();
+ Builder setMatch(Match match);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAsyncGetReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAsyncGetReply.java
new file mode 100644
index 0000000000..d29b921a0d
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAsyncGetReply.java
@@ -0,0 +1,61 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFAsyncGetReply extends OFObject, OFMessage {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getPacketInMaskEqualMaster();
+ long getPacketInMaskSlave();
+ long getPortStatusMaskEqualMaster();
+ long getPortStatusMaskSlave();
+ long getFlowRemovedMaskEqualMaster();
+ long getFlowRemovedMaskSlave();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFMessage.Builder {
+ OFAsyncGetReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getPacketInMaskEqualMaster();
+ Builder setPacketInMaskEqualMaster(long packetInMaskEqualMaster);
+ long getPacketInMaskSlave();
+ Builder setPacketInMaskSlave(long packetInMaskSlave);
+ long getPortStatusMaskEqualMaster();
+ Builder setPortStatusMaskEqualMaster(long portStatusMaskEqualMaster);
+ long getPortStatusMaskSlave();
+ Builder setPortStatusMaskSlave(long portStatusMaskSlave);
+ long getFlowRemovedMaskEqualMaster();
+ Builder setFlowRemovedMaskEqualMaster(long flowRemovedMaskEqualMaster);
+ long getFlowRemovedMaskSlave();
+ Builder setFlowRemovedMaskSlave(long flowRemovedMaskSlave);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAsyncGetRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAsyncGetRequest.java
new file mode 100644
index 0000000000..6f52220652
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAsyncGetRequest.java
@@ -0,0 +1,61 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFAsyncGetRequest extends OFObject, OFMessage, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getPacketInMaskEqualMaster();
+ long getPacketInMaskSlave();
+ long getPortStatusMaskEqualMaster();
+ long getPortStatusMaskSlave();
+ long getFlowRemovedMaskEqualMaster();
+ long getFlowRemovedMaskSlave();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFMessage.Builder {
+ OFAsyncGetRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getPacketInMaskEqualMaster();
+ Builder setPacketInMaskEqualMaster(long packetInMaskEqualMaster);
+ long getPacketInMaskSlave();
+ Builder setPacketInMaskSlave(long packetInMaskSlave);
+ long getPortStatusMaskEqualMaster();
+ Builder setPortStatusMaskEqualMaster(long portStatusMaskEqualMaster);
+ long getPortStatusMaskSlave();
+ Builder setPortStatusMaskSlave(long portStatusMaskSlave);
+ long getFlowRemovedMaskEqualMaster();
+ Builder setFlowRemovedMaskEqualMaster(long flowRemovedMaskEqualMaster);
+ long getFlowRemovedMaskSlave();
+ Builder setFlowRemovedMaskSlave(long flowRemovedMaskSlave);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAsyncSet.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAsyncSet.java
new file mode 100644
index 0000000000..ff3927efab
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFAsyncSet.java
@@ -0,0 +1,62 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFAsyncSet extends OFObject, OFMessage {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getPacketInMaskEqualMaster();
+ long getPacketInMaskSlave();
+ long getPortStatusMaskEqualMaster();
+ long getPortStatusMaskSlave();
+ long getFlowRemovedMaskEqualMaster();
+ long getFlowRemovedMaskSlave();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFMessage.Builder {
+ OFAsyncSet build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getPacketInMaskEqualMaster();
+ Builder setPacketInMaskEqualMaster(long packetInMaskEqualMaster);
+ long getPacketInMaskSlave();
+ Builder setPacketInMaskSlave(long packetInMaskSlave);
+ long getPortStatusMaskEqualMaster();
+ Builder setPortStatusMaskEqualMaster(long portStatusMaskEqualMaster);
+ long getPortStatusMaskSlave();
+ Builder setPortStatusMaskSlave(long portStatusMaskSlave);
+ long getFlowRemovedMaskEqualMaster();
+ Builder setFlowRemovedMaskEqualMaster(long flowRemovedMaskEqualMaster);
+ long getFlowRemovedMaskSlave();
+ Builder setFlowRemovedMaskSlave(long flowRemovedMaskSlave);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadActionCode.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadActionCode.java
new file mode 100644
index 0000000000..13d5543082
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadActionCode.java
@@ -0,0 +1,44 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template const.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+
+public enum OFBadActionCode {
+ BAD_TYPE,
+ BAD_LEN,
+ BAD_EXPERIMENTER,
+ BAD_EXPERIMENTER_TYPE,
+ BAD_OUT_PORT,
+ BAD_ARGUMENT,
+ EPERM,
+ TOO_MANY,
+ BAD_QUEUE,
+ BAD_OUT_GROUP,
+ MATCH_INCONSISTENT,
+ UNSUPPORTED_ORDER,
+ BAD_TAG,
+ BAD_SET_TYPE,
+ BAD_SET_LEN,
+ BAD_SET_ARGUMENT;
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadInstructionCode.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadInstructionCode.java
new file mode 100644
index 0000000000..dfe86d37b7
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadInstructionCode.java
@@ -0,0 +1,38 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template const.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+
+public enum OFBadInstructionCode {
+ UNKNOWN_INST,
+ UNSUP_INST,
+ BAD_TABLE_ID,
+ UNSUP_METADATA,
+ UNSUP_METADATA_MASK,
+ UNSUP_EXP_INST,
+ BAD_EXPERIMENTER,
+ BAD_EXPERIMENTER_TYPE,
+ BAD_LEN,
+ EPERM;
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadMatchCode.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadMatchCode.java
new file mode 100644
index 0000000000..02f689ae5c
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadMatchCode.java
@@ -0,0 +1,40 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template const.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+
+public enum OFBadMatchCode {
+ BAD_TYPE,
+ BAD_LEN,
+ BAD_TAG,
+ BAD_DL_ADDR_MASK,
+ BAD_NW_ADDR_MASK,
+ BAD_WILDCARDS,
+ BAD_FIELD,
+ BAD_VALUE,
+ BAD_MASK,
+ BAD_PREREQ,
+ DUP_FIELD,
+ EPERM;
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadRequestCode.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadRequestCode.java
new file mode 100644
index 0000000000..e254cb2194
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBadRequestCode.java
@@ -0,0 +1,43 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template const.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+
+public enum OFBadRequestCode {
+ BAD_VERSION,
+ BAD_TYPE,
+ BAD_STAT,
+ BAD_EXPERIMENTER,
+ BAD_SUBTYPE,
+ EPERM,
+ BAD_LEN,
+ BUFFER_EMPTY,
+ BUFFER_UNKNOWN,
+ BAD_TABLE_ID,
+ BAD_EXPERIMENTER_TYPE,
+ IS_SLAVE,
+ BAD_PORT,
+ BAD_PACKET,
+ MULTIPART_BUFFER_OVERFLOW;
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBarrierReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBarrierReply.java
new file mode 100644
index 0000000000..f64f16e657
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBarrierReply.java
@@ -0,0 +1,43 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBarrierReply extends OFObject, OFMessage {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFMessage.Builder {
+ OFBarrierReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBarrierRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBarrierRequest.java
new file mode 100644
index 0000000000..b41e104c51
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBarrierRequest.java
@@ -0,0 +1,43 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBarrierRequest extends OFObject, OFMessage, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFMessage.Builder {
+ OFBarrierRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnArpIdle.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnArpIdle.java
new file mode 100644
index 0000000000..3d1893e140
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnArpIdle.java
@@ -0,0 +1,53 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnArpIdle extends OFObject, OFBsnHeader {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ int getVlanVid();
+ IPv4Address getIpv4Addr();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnArpIdle build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ int getVlanVid();
+ Builder setVlanVid(int vlanVid);
+ IPv4Address getIpv4Addr();
+ Builder setIpv4Addr(IPv4Address ipv4Addr);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwClearDataReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwClearDataReply.java
new file mode 100644
index 0000000000..78e74c5945
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwClearDataReply.java
@@ -0,0 +1,50 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnBwClearDataReply extends OFObject, OFBsnHeader {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ long getStatus();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnBwClearDataReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ long getStatus();
+ Builder setStatus(long status);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwClearDataRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwClearDataRequest.java
new file mode 100644
index 0000000000..bb9c2bb6ac
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwClearDataRequest.java
@@ -0,0 +1,47 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnBwClearDataRequest extends OFObject, OFBsnHeader, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnBwClearDataRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableGetReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableGetReply.java
new file mode 100644
index 0000000000..e8ae108e54
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableGetReply.java
@@ -0,0 +1,50 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnBwEnableGetReply extends OFObject, OFBsnHeader {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ long getEnabled();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnBwEnableGetReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ long getEnabled();
+ Builder setEnabled(long enabled);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableGetRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableGetRequest.java
new file mode 100644
index 0000000000..15ccbdceab
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableGetRequest.java
@@ -0,0 +1,47 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnBwEnableGetRequest extends OFObject, OFBsnHeader, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnBwEnableGetRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableSetReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableSetReply.java
new file mode 100644
index 0000000000..6d25d7e4ac
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableSetReply.java
@@ -0,0 +1,54 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnBwEnableSetReply extends OFObject, OFBsnHeader {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ long getEnable();
+ long getStatus();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnBwEnableSetReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ long getEnable();
+ Builder setEnable(long enable);
+ long getStatus();
+ Builder setStatus(long status);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableSetRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableSetRequest.java
new file mode 100644
index 0000000000..2b23800200
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnBwEnableSetRequest.java
@@ -0,0 +1,51 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnBwEnableSetRequest extends OFObject, OFBsnHeader, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ long getEnable();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnBwEnableSetRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ long getEnable();
+ Builder setEnable(long enable);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnection.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnection.java
new file mode 100644
index 0000000000..6d11288a3a
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnection.java
@@ -0,0 +1,50 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnControllerConnection extends OFObject {
+ OFBsnControllerConnectionState getState();
+ OFAuxId getAuxiliaryId();
+ OFControllerRole getRole();
+ String getUri();
+ OFVersion getVersion();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder {
+ OFBsnControllerConnection build();
+ OFBsnControllerConnectionState getState();
+ Builder setState(OFBsnControllerConnectionState state);
+ OFAuxId getAuxiliaryId();
+ Builder setAuxiliaryId(OFAuxId auxiliaryId);
+ OFControllerRole getRole();
+ Builder setRole(OFControllerRole role);
+ String getUri();
+ Builder setUri(String uri);
+ OFVersion getVersion();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnectionState.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnectionState.java
new file mode 100644
index 0000000000..df1312f5a1
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnectionState.java
@@ -0,0 +1,30 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template const.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+
+public enum OFBsnControllerConnectionState {
+ BSN_CONTROLLER_CONNECTION_STATE_DISCONNECTED,
+ BSN_CONTROLLER_CONNECTION_STATE_CONNECTED;
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnectionsReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnectionsReply.java
new file mode 100644
index 0000000000..ffa03c4fc1
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnectionsReply.java
@@ -0,0 +1,51 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnControllerConnectionsReply extends OFObject, OFBsnHeader {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ List getConnections();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnControllerConnectionsReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ List getConnections();
+ Builder setConnections(List connections);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnectionsRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnectionsRequest.java
new file mode 100644
index 0000000000..efee3035e5
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerConnectionsRequest.java
@@ -0,0 +1,47 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnControllerConnectionsRequest extends OFObject, OFBsnHeader, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnControllerConnectionsRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerRoleReason.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerRoleReason.java
new file mode 100644
index 0000000000..a8eb119c45
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnControllerRoleReason.java
@@ -0,0 +1,31 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template const.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+
+public enum OFBsnControllerRoleReason {
+ BSN_CONTROLLER_ROLE_REASON_MASTER_REQUEST,
+ BSN_CONTROLLER_ROLE_REASON_CONFIG,
+ BSN_CONTROLLER_ROLE_REASON_EXPERIMENTER;
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterDescStatsEntry.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterDescStatsEntry.java
new file mode 100644
index 0000000000..0aa440735b
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterDescStatsEntry.java
@@ -0,0 +1,47 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnDebugCounterDescStatsEntry extends OFObject {
+ U64 getCounterId();
+ String getName();
+ String getDescription();
+ OFVersion getVersion();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder {
+ OFBsnDebugCounterDescStatsEntry build();
+ U64 getCounterId();
+ Builder setCounterId(U64 counterId);
+ String getName();
+ Builder setName(String name);
+ String getDescription();
+ Builder setDescription(String description);
+ OFVersion getVersion();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterDescStatsReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterDescStatsReply.java
new file mode 100644
index 0000000000..5f7242663c
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterDescStatsReply.java
@@ -0,0 +1,57 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnDebugCounterDescStatsReply extends OFObject, OFBsnStatsReply {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsReply.Builder {
+ OFBsnDebugCounterDescStatsReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+ Builder setEntries(List entries);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterDescStatsRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterDescStatsRequest.java
new file mode 100644
index 0000000000..ebd3b9b7a7
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterDescStatsRequest.java
@@ -0,0 +1,53 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnDebugCounterDescStatsRequest extends OFObject, OFBsnStatsRequest, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsRequest.Builder {
+ OFBsnDebugCounterDescStatsRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterStatsEntry.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterStatsEntry.java
new file mode 100644
index 0000000000..f3d28d0f8e
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterStatsEntry.java
@@ -0,0 +1,44 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnDebugCounterStatsEntry extends OFObject {
+ U64 getCounterId();
+ U64 getValue();
+ OFVersion getVersion();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder {
+ OFBsnDebugCounterStatsEntry build();
+ U64 getCounterId();
+ Builder setCounterId(U64 counterId);
+ U64 getValue();
+ Builder setValue(U64 value);
+ OFVersion getVersion();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterStatsReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterStatsReply.java
new file mode 100644
index 0000000000..9edf42a0c9
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterStatsReply.java
@@ -0,0 +1,57 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnDebugCounterStatsReply extends OFObject, OFBsnStatsReply {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsReply.Builder {
+ OFBsnDebugCounterStatsReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+ Builder setEntries(List entries);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterStatsRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterStatsRequest.java
new file mode 100644
index 0000000000..cb2d5f908b
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnDebugCounterStatsRequest.java
@@ -0,0 +1,53 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnDebugCounterStatsRequest extends OFObject, OFBsnStatsRequest, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsRequest.Builder {
+ OFBsnDebugCounterStatsRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowChecksumBucketStatsEntry.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowChecksumBucketStatsEntry.java
new file mode 100644
index 0000000000..d709799009
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowChecksumBucketStatsEntry.java
@@ -0,0 +1,41 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnFlowChecksumBucketStatsEntry extends OFObject {
+ U64 getChecksum();
+ OFVersion getVersion();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder {
+ OFBsnFlowChecksumBucketStatsEntry build();
+ U64 getChecksum();
+ Builder setChecksum(U64 checksum);
+ OFVersion getVersion();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowChecksumBucketStatsReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowChecksumBucketStatsReply.java
new file mode 100644
index 0000000000..4759d457bc
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowChecksumBucketStatsReply.java
@@ -0,0 +1,57 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnFlowChecksumBucketStatsReply extends OFObject, OFBsnStatsReply {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsReply.Builder {
+ OFBsnFlowChecksumBucketStatsReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+ Builder setEntries(List entries);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowChecksumBucketStatsRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowChecksumBucketStatsRequest.java
new file mode 100644
index 0000000000..1f4ed0d65b
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowChecksumBucketStatsRequest.java
@@ -0,0 +1,56 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnFlowChecksumBucketStatsRequest extends OFObject, OFBsnStatsRequest, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+ TableId getTableId();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsRequest.Builder {
+ OFBsnFlowChecksumBucketStatsRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ TableId getTableId();
+ Builder setTableId(TableId tableId);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdle.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdle.java
new file mode 100644
index 0000000000..88a2b14392
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdle.java
@@ -0,0 +1,59 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnFlowIdle extends OFObject, OFBsnHeader {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ U64 getCookie();
+ int getPriority();
+ TableId getTableId();
+ Match getMatch();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnFlowIdle build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ U64 getCookie();
+ Builder setCookie(U64 cookie);
+ int getPriority();
+ Builder setPriority(int priority);
+ TableId getTableId();
+ Builder setTableId(TableId tableId);
+ Match getMatch();
+ Builder setMatch(Match match);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableGetReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableGetReply.java
new file mode 100644
index 0000000000..cf3835663b
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableGetReply.java
@@ -0,0 +1,50 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnFlowIdleEnableGetReply extends OFObject, OFBsnHeader {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ long getEnabled();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnFlowIdleEnableGetReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ long getEnabled();
+ Builder setEnabled(long enabled);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableGetRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableGetRequest.java
new file mode 100644
index 0000000000..aacb08c53b
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableGetRequest.java
@@ -0,0 +1,47 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnFlowIdleEnableGetRequest extends OFObject, OFBsnHeader, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnFlowIdleEnableGetRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableSetReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableSetReply.java
new file mode 100644
index 0000000000..6c0b274cb3
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableSetReply.java
@@ -0,0 +1,54 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnFlowIdleEnableSetReply extends OFObject, OFBsnHeader {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ long getEnable();
+ long getStatus();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnFlowIdleEnableSetReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ long getEnable();
+ Builder setEnable(long enable);
+ long getStatus();
+ Builder setStatus(long status);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableSetRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableSetRequest.java
new file mode 100644
index 0000000000..aae991dd72
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnFlowIdleEnableSetRequest.java
@@ -0,0 +1,51 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnFlowIdleEnableSetRequest extends OFObject, OFBsnHeader, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ long getEnable();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnFlowIdleEnableSetRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ long getEnable();
+ Builder setEnable(long enable);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableBucketStatsEntry.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableBucketStatsEntry.java
new file mode 100644
index 0000000000..d69a444d5e
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableBucketStatsEntry.java
@@ -0,0 +1,41 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableBucketStatsEntry extends OFObject {
+ U128 getChecksum();
+ OFVersion getVersion();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder {
+ OFBsnGentableBucketStatsEntry build();
+ U128 getChecksum();
+ Builder setChecksum(U128 checksum);
+ OFVersion getVersion();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableBucketStatsReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableBucketStatsReply.java
new file mode 100644
index 0000000000..0b080786b4
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableBucketStatsReply.java
@@ -0,0 +1,57 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableBucketStatsReply extends OFObject, OFBsnStatsReply {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsReply.Builder {
+ OFBsnGentableBucketStatsReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+ Builder setEntries(List entries);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableBucketStatsRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableBucketStatsRequest.java
new file mode 100644
index 0000000000..72b5983755
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableBucketStatsRequest.java
@@ -0,0 +1,56 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableBucketStatsRequest extends OFObject, OFBsnStatsRequest, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsRequest.Builder {
+ OFBsnGentableBucketStatsRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+ Builder setTableId(GenTableId tableId);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableClearReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableClearReply.java
new file mode 100644
index 0000000000..d0c7015d46
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableClearReply.java
@@ -0,0 +1,56 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableClearReply extends OFObject, OFBsnHeader {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+ long getDeletedCount();
+ long getErrorCount();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnGentableClearReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+ Builder setTableId(GenTableId tableId);
+ long getDeletedCount();
+ Builder setDeletedCount(long deletedCount);
+ long getErrorCount();
+ Builder setErrorCount(long errorCount);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableClearRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableClearRequest.java
new file mode 100644
index 0000000000..e61f3f6688
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableClearRequest.java
@@ -0,0 +1,56 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableClearRequest extends OFObject, OFBsnHeader, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+ U128 getChecksum();
+ U128 getChecksumMask();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnGentableClearRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+ Builder setTableId(GenTableId tableId);
+ U128 getChecksum();
+ Builder setChecksum(U128 checksum);
+ U128 getChecksumMask();
+ Builder setChecksumMask(U128 checksumMask);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableDescStatsEntry.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableDescStatsEntry.java
new file mode 100644
index 0000000000..b39fd101a0
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableDescStatsEntry.java
@@ -0,0 +1,50 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableDescStatsEntry extends OFObject {
+ GenTableId getTableId();
+ String getName();
+ long getBucketsSize();
+ long getMaxEntries();
+ OFVersion getVersion();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder {
+ OFBsnGentableDescStatsEntry build();
+ GenTableId getTableId();
+ Builder setTableId(GenTableId tableId);
+ String getName();
+ Builder setName(String name);
+ long getBucketsSize();
+ Builder setBucketsSize(long bucketsSize);
+ long getMaxEntries();
+ Builder setMaxEntries(long maxEntries);
+ OFVersion getVersion();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableDescStatsReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableDescStatsReply.java
new file mode 100644
index 0000000000..6d2de9d7a5
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableDescStatsReply.java
@@ -0,0 +1,57 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableDescStatsReply extends OFObject, OFBsnStatsReply {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsReply.Builder {
+ OFBsnGentableDescStatsReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+ Builder setEntries(List entries);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableDescStatsRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableDescStatsRequest.java
new file mode 100644
index 0000000000..8fa686de08
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableDescStatsRequest.java
@@ -0,0 +1,53 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableDescStatsRequest extends OFObject, OFBsnStatsRequest, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsRequest.Builder {
+ OFBsnGentableDescStatsRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryAdd.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryAdd.java
new file mode 100644
index 0000000000..ef358fad95
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryAdd.java
@@ -0,0 +1,60 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableEntryAdd extends OFObject, OFBsnHeader {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+ U128 getChecksum();
+ List getKey();
+ List getValue();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnGentableEntryAdd build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+ Builder setTableId(GenTableId tableId);
+ U128 getChecksum();
+ Builder setChecksum(U128 checksum);
+ List getKey();
+ Builder setKey(List key);
+ List getValue();
+ Builder setValue(List value);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDelete.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDelete.java
new file mode 100644
index 0000000000..79093a360d
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDelete.java
@@ -0,0 +1,54 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableEntryDelete extends OFObject, OFBsnHeader {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+ List getKey();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnHeader.Builder {
+ OFBsnGentableEntryDelete build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+ Builder setTableId(GenTableId tableId);
+ List getKey();
+ Builder setKey(List key);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDescStatsEntry.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDescStatsEntry.java
new file mode 100644
index 0000000000..b0783c7111
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDescStatsEntry.java
@@ -0,0 +1,48 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableEntryDescStatsEntry extends OFObject {
+ U128 getChecksum();
+ List getKey();
+ List getValue();
+ OFVersion getVersion();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder {
+ OFBsnGentableEntryDescStatsEntry build();
+ U128 getChecksum();
+ Builder setChecksum(U128 checksum);
+ List getKey();
+ Builder setKey(List key);
+ List getValue();
+ Builder setValue(List value);
+ OFVersion getVersion();
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDescStatsReply.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDescStatsReply.java
new file mode 100644
index 0000000000..c859998964
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDescStatsReply.java
@@ -0,0 +1,57 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableEntryDescStatsReply extends OFObject, OFBsnStatsReply {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsReply.Builder {
+ OFBsnGentableEntryDescStatsReply build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ List getEntries();
+ Builder setEntries(List entries);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDescStatsRequest.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDescStatsRequest.java
new file mode 100644
index 0000000000..ba35738edc
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryDescStatsRequest.java
@@ -0,0 +1,62 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.Set;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableEntryDescStatsRequest extends OFObject, OFBsnStatsRequest, OFRequest {
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ OFStatsType getStatsType();
+ Set getFlags();
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+ U128 getChecksum();
+ U128 getChecksumMask();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder extends OFBsnStatsRequest.Builder {
+ OFBsnGentableEntryDescStatsRequest build();
+ OFVersion getVersion();
+ OFType getType();
+ long getXid();
+ Builder setXid(long xid);
+ OFStatsType getStatsType();
+ Set getFlags();
+ Builder setFlags(Set flags);
+ long getExperimenter();
+ long getSubtype();
+ GenTableId getTableId();
+ Builder setTableId(GenTableId tableId);
+ U128 getChecksum();
+ Builder setChecksum(U128 checksum);
+ U128 getChecksumMask();
+ Builder setChecksumMask(U128 checksumMask);
+ }
+}
diff --git a/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryStatsEntry.java b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryStatsEntry.java
new file mode 100644
index 0000000000..ec0fb5b163
--- /dev/null
+++ b/openflow/openflowj/gen-src/main/java/org/projectfloodlight/openflow/protocol/OFBsnGentableEntryStatsEntry.java
@@ -0,0 +1,45 @@
+// Copyright (c) 2008 The Board of Trustees of The Leland Stanford Junior University
+// Copyright (c) 2011, 2012 Open Networking Foundation
+// Copyright (c) 2012, 2013 Big Switch Networks, Inc.
+// This library was generated by the LoxiGen Compiler.
+// See the file LICENSE.txt which should have been included in the source distribution
+
+// Automatically generated by LOXI from template of_interface.java
+// Do not modify
+
+package org.projectfloodlight.openflow.protocol;
+
+import org.projectfloodlight.openflow.protocol.*;
+import org.projectfloodlight.openflow.protocol.action.*;
+import org.projectfloodlight.openflow.protocol.actionid.*;
+import org.projectfloodlight.openflow.protocol.bsntlv.*;
+import org.projectfloodlight.openflow.protocol.errormsg.*;
+import org.projectfloodlight.openflow.protocol.meterband.*;
+import org.projectfloodlight.openflow.protocol.instruction.*;
+import org.projectfloodlight.openflow.protocol.instructionid.*;
+import org.projectfloodlight.openflow.protocol.match.*;
+import org.projectfloodlight.openflow.protocol.oxm.*;
+import org.projectfloodlight.openflow.protocol.queueprop.*;
+import org.projectfloodlight.openflow.types.*;
+import org.projectfloodlight.openflow.util.*;
+import org.projectfloodlight.openflow.exceptions.*;
+import java.util.List;
+import org.jboss.netty.buffer.ChannelBuffer;
+
+public interface OFBsnGentableEntryStatsEntry extends OFObject {
+ List getKey();
+ List getStats();
+ OFVersion getVersion();
+
+ void writeTo(ChannelBuffer channelBuffer);
+
+ Builder createBuilder();
+ public interface Builder {
+ OFBsnGentableEntryStatsEntry build();
+ List getKey();
+ Builder setKey(List key);
+ List getStats();
+ Builder setStats(List