Skip to content
Snippets Groups Projects
Commit 007335e4 authored by Shudong Zhou's avatar Shudong Zhou
Browse files

Remove IOFSwitchFeatures, can now be done by overriding switch driver

parent aa8a4915
No related branches found
No related tags found
No related merge requests found
......@@ -55,6 +55,32 @@ public interface IOFSwitch {
public static final String PROP_SUPPORTS_OFPP_FLOOD = "supportsOfppFlood";
public static final String PROP_SUPPORTS_NETMASK_TBL = "supportsNetmaskTbl";
public enum OFPortType {
NORMAL("normal"), // normal port (default)
TUNNEL("tunnel"), // tunnel port
UPLINK("uplink"), // uplink port (on a virtual switch)
MANAGEMENT("management"); // for in-band management
private String value;
OFPortType(String v) {
value = v;
}
@Override
public String toString() {
return value;
}
public static OFPortType fromString(String str) {
for (OFPortType m : OFPortType.values()) {
if (m.value.equals(str)) {
return m;
}
}
return OFPortType.NORMAL;
}
}
/**
* Set IFloodlightProviderService for this switch instance
* Called immediately after instantiation
......@@ -124,12 +150,6 @@ public interface IOFSwitch {
*/
public void setFeaturesReply(OFFeaturesReply featuresReply);
/**
* Set the SwitchProperties based on it's description
* @param description
*/
public void setSwitchProperties(OFDescriptionStatistics description);
/**
* Get list of all enabled ports. This will typically be different from
* the list of ports in the OFFeaturesReply, since that one is a static
......@@ -427,4 +447,36 @@ public interface IOFSwitch {
public SocketAddress getInetAddress();
/***********************************************
* The following method can be overridden by
* specific types of switches
***********************************************
*/
/**
* Set the SwitchProperties based on it's description
* @param description
*/
public void setSwitchProperties(OFDescriptionStatistics description);
/**
* Return the type of OFPort
* @param port_num
* @return
*/
public OFPortType getPortType(short port_num);
/**
* Can the port be turned on without forming a new loop?
* @param port_num
* @return
*/
public boolean isFastPort(short port_num);
/**
* Retun a list of uplink port (for virtual switches only)
* @return
*/
public List<Short> getUplinkPorts();
}
......@@ -40,7 +40,6 @@ import net.floodlightcontroller.core.IFloodlightProviderService.Role;
import net.floodlightcontroller.core.IOFSwitch;
import net.floodlightcontroller.core.annotations.LogMessageDoc;
import net.floodlightcontroller.core.internal.Controller;
import net.floodlightcontroller.core.internal.IOFSwitchFeatures;
import net.floodlightcontroller.core.internal.OFFeaturesReplyFuture;
import net.floodlightcontroller.core.internal.OFStatisticsFuture;
import net.floodlightcontroller.core.web.serializers.DPIDSerializer;
......@@ -114,7 +113,6 @@ public abstract class OFSwitchBase implements IOFSwitch {
private ConcurrentMap<Short, Long> portBroadcastCacheHitMap;
public static IOFSwitchFeatures switchFeatures;
protected static final ThreadLocal<Map<IOFSwitch,List<OFMessage>>> local_msg_buffer =
new ThreadLocal<Map<IOFSwitch,List<OFMessage>>>() {
@Override
......
package net.floodlightcontroller.core.internal;
import org.openflow.protocol.statistics.OFDescriptionStatistics;
import net.floodlightcontroller.core.IOFSwitch;
public interface IOFSwitchFeatures {
public void setFromDescription(IOFSwitch sw, OFDescriptionStatistics description);
}
......@@ -17,6 +17,8 @@
package net.floodlightcontroller.core.internal;
import java.util.List;
import org.codehaus.jackson.annotate.JsonIgnore;
import org.openflow.protocol.statistics.OFDescriptionStatistics;
......@@ -30,9 +32,23 @@ public class OFSwitchImpl extends OFSwitchBase {
@Override
@JsonIgnore
public void setSwitchProperties(OFDescriptionStatistics description) {
if (switchFeatures != null) {
switchFeatures.setFromDescription(this, description);
}
// Nothing to do at the moment
}
@Override
public OFPortType getPortType(short port_num) {
return OFPortType.NORMAL;
}
@Override
@JsonIgnore
public boolean isFastPort(short port_num) {
return false;
}
@Override
public List<Short> getUplinkPorts() {
return null;
}
......
......@@ -380,4 +380,22 @@ public class OFMessageDamperMockSwitch implements IOFSwitch {
return null;
}
@Override
public OFPortType getPortType(short port_num) {
// TODO Auto-generated method stub
return null;
}
@Override
public boolean isFastPort(short port_num) {
// TODO Auto-generated method stub
return false;
}
@Override
public List<Short> getUplinkPorts() {
// TODO Auto-generated method stub
return null;
}
}
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment