Merge branch 'master' of https://github.com/OPENNETWORKINGLAB/ONOS
diff --git a/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java b/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java
index 2ca8483..c158fdd 100644
--- a/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java
+++ b/src/main/java/net/floodlightcontroller/restserver/RestApiServer.java
@@ -6,12 +6,18 @@
import java.util.List;
import java.util.Map;
+import net.floodlightcontroller.core.module.FloodlightModuleContext;
+import net.floodlightcontroller.core.module.FloodlightModuleException;
+import net.floodlightcontroller.core.module.IFloodlightModule;
+import net.floodlightcontroller.core.module.IFloodlightService;
+
import org.restlet.Application;
import org.restlet.Component;
import org.restlet.Context;
import org.restlet.Request;
import org.restlet.Response;
import org.restlet.Restlet;
+import org.restlet.Server;
import org.restlet.data.Protocol;
import org.restlet.data.Reference;
import org.restlet.data.Status;
@@ -24,17 +30,13 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import net.floodlightcontroller.core.module.FloodlightModuleContext;
-import net.floodlightcontroller.core.module.FloodlightModuleException;
-import net.floodlightcontroller.core.module.IFloodlightModule;
-import net.floodlightcontroller.core.module.IFloodlightService;
-
public class RestApiServer
implements IFloodlightModule, IRestApiService {
protected static Logger logger = LoggerFactory.getLogger(RestApiServer.class);
protected List<RestletRoutable> restlets;
protected FloodlightModuleContext fmlContext;
protected int restPort = 8080;
+ protected String numThreads = null;
// ***********
// Application
@@ -98,7 +100,11 @@
// Start listening for REST requests
try {
final Component component = new Component();
- component.getServers().add(Protocol.HTTP, restPort);
+ Server server = component.getServers().add(Protocol.HTTP, restPort);
+ if (numThreads != null){
+ logger.debug("Setting number of REST API threads to {}", numThreads);
+ server.getContext().getParameters().add("defaultThreads", numThreads);
+ }
component.getClients().add(Protocol.CLAP);
component.getDefaultHost().attach(this);
component.start();
@@ -179,6 +185,11 @@
restPort = Integer.parseInt(port);
}
logger.debug("REST port set to {}", restPort);
+
+ String numThreads = configOptions.get("dispatcherthreads");
+ if (numThreads != null) {
+ this.numThreads = numThreads;
+ }
}
@Override
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
index 570b847..2034118 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/BgpRoute.java
@@ -6,12 +6,10 @@
import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
-import java.util.Comparator;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
-import java.util.concurrent.ConcurrentSkipListSet;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
@@ -54,6 +52,7 @@
import org.openflow.protocol.OFMatch;
import org.openflow.protocol.OFMessage;
import org.openflow.protocol.OFPacketOut;
+import org.openflow.protocol.OFPort;
import org.openflow.protocol.OFType;
import org.openflow.protocol.action.OFAction;
import org.openflow.protocol.action.OFActionDataLayerDestination;
@@ -62,8 +61,6 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
-import com.google.common.net.InetAddresses;
-
public class BgpRoute implements IFloodlightModule, IBgpRouteService,
ITopologyListener, IOFSwitchListener {
@@ -80,7 +77,7 @@
protected static Ptree ptree;
protected String bgpdRestIp;
protected String routerId;
- protected String gatewaysFilename = "config.json";
+ protected String configFilename = "config.json";
//We need to identify our flows somehow. But like it says in LearningSwitch.java,
//the controller/OS should hand out cookie IDs to prevent conflicts.
@@ -100,10 +97,9 @@
protected final int TOPO_DETECTION_WAIT = 2; //seconds
//Configuration stuff
- protected Map<String, GatewayRouter> gatewayRouters;
protected List<String> switches;
protected Map<String, Interface> interfaces;
- protected List<BgpPeer> bgpPeers;
+ protected Map<InetAddress, BgpPeer> bgpPeers;
protected SwitchPort bgpdAttachmentPoint;
//True when all switches have connected
@@ -111,18 +107,15 @@
//True when we have a full mesh of shortest paths between gateways
protected volatile boolean topologyReady = false;
- //protected ConcurrentSkipListSet<LDUpdate> linkUpdates;
protected ArrayList<LDUpdate> linkUpdates;
protected SingletonTask topologyChangeDetectorTask;
- //protected ILinkStorage linkStorage;//XXX
-
protected class TopologyChangeDetector implements Runnable {
@Override
public void run() {
log.debug("Running topology change detection task");
synchronized (linkUpdates) {
- //This is the model the REST API uses to retrive network graph info
+ //This is the model the REST API uses to retrieve network graph info
ITopoLinkService topoLinkService = new TopoLinkServiceImpl();
List<Link> activeLinks = topoLinkService.getActiveLinks();
@@ -164,16 +157,19 @@
try {
Configuration config = mapper.readValue(gatewaysFile, Configuration.class);
- gatewayRouters = config.getGateways();
switches = config.getSwitches();
- interfaces = config.getInterfaces();
- bgpPeers = config.getPeers();
+ interfaces = new HashMap<String, Interface>();
+ for (Interface intf : config.getInterfaces()){
+ interfaces.put(intf.getName(), intf);
+ }
+ bgpPeers = new HashMap<InetAddress, BgpPeer>();
+ for (BgpPeer peer : config.getPeers()){
+ bgpPeers.put(peer.getIpAddress(), peer);
+ }
bgpdAttachmentPoint = new SwitchPort(
new Dpid(config.getBgpdAttachmentDpid()),
new Port(config.getBgpdAttachmentPort()));
- //bgpdAttachmentDpid = config.getBgpdAttachmentDpid();
- //bgpdAttachmentPort = config.getBgpdAttachmentPort();
} catch (JsonParseException e) {
log.error("Error in JSON file", e);
@@ -219,9 +215,7 @@
throws FloodlightModuleException {
ptree = new Ptree(32);
-
- //routerIpAddresses = new HashSet<InetAddress>();
-
+
// Register floodlight provider and REST handler.
floodlightProvider = context.getServiceImpl(IFloodlightProviderService.class);
topology = context.getServiceImpl(ITopologyService.class);
@@ -232,24 +226,6 @@
//part of the controller core
proxyArp = new ProxyArpManager(floodlightProvider, topology);
- /*
- linkStorage = new LinkStorageImpl();
- //XXX Hack to pull out the database location from NetworkGraphPublisher's config
- String databaseConfig = null;
- for (IFloodlightModule fm : context.getAllModules()){
- if (fm instanceof NetworkGraphPublisher){
- Map<String, String> configMap = context.getConfigParams(fm);
- databaseConfig = configMap.get("dbconf");
- break;
- }
- }
- if (databaseConfig == null){
- log.error("Couldn't find database config string \"dbconf\"");
- System.exit(1);
- }
- linkStorage.init(databaseConfig);
- */
- //linkUpdates = new ConcurrentSkipListSet<ILinkDiscovery.LDUpdate>();
linkUpdates = new ArrayList<LDUpdate>();
ScheduledExecutorService executor = Executors.newScheduledThreadPool(1);
topologyChangeDetectorTask = new SingletonTask(executor, new TopologyChangeDetector());
@@ -275,7 +251,13 @@
log.info("RouterId set to {}", routerId);
}
- readGatewaysConfiguration(gatewaysFilename);
+ String configFilenameParameter = context.getConfigParams(this).get("configfile");
+ if (configFilenameParameter != null){
+ configFilename = configFilenameParameter;
+ }
+ log.debug("Config file set to {}", configFilename);
+
+ readGatewaysConfiguration(configFilename);
// Test.
//test();
}
@@ -448,34 +430,45 @@
String prefix = getPrefixFromPtree(node);
- log.debug("New prefix {} added, next hop {}",
- prefix, node.rib.nextHop.toString());
+ log.debug("New prefix {} added, next hop {}, routerId {}",
+ new Object[] {prefix, node.rib.nextHop.toString(),
+ node.rib.routerId.getHostAddress()});
- //Add a flow to rewrite mac for this prefix to all border switches
- GatewayRouter thisRouter = gatewayRouters
- .get(InetAddresses.toAddrString(node.rib.nextHop));
+ //TODO this is wrong, we shouldn't be dealing with BGP peers here.
+ //We need to figure out where the device is attached and what it's
+ //mac address is by learning.
+ //The next hop is not necessarily the peer, and the peer's attachment
+ //point is not necessarily the next hop's attachment point.
+ BgpPeer peer = bgpPeers.get(node.rib.nextHop);
- if (thisRouter == null){
- //TODO local router isn't in gateway list so this will get thrown
+ if (peer == null){
+ //TODO local router isn't in peers list so this will get thrown
//Need to work out what to do about local prefixes with next hop 0.0.0.0.
+
+ //The other scenario is this is a route server route. In that
+ //case the next hop is not in our configuration
log.error("Couldn't find next hop router in router {} in config"
, node.rib.nextHop.toString());
return; //just quit out here? This is probably a configuration error
}
+
+ Interface peerInterface = interfaces.get(peer.getInterfaceName());
- for (GatewayRouter ingressRouter : gatewayRouters.values()){
- if (ingressRouter == thisRouter) {
+ //Add a flow to rewrite mac for this prefix to all border switches
+ for (Interface srcInterface : interfaces.values()) {
+ if (srcInterface == peerInterface) {
+ //Don't push a flow for the switch where this peer is attached
continue;
}
-
+
DataPath shortestPath = topoRouteService.getShortestPath(
- ingressRouter.getAttachmentPoint(),
- thisRouter.getAttachmentPoint());
+ srcInterface.getSwitchPort(),
+ peerInterface.getSwitchPort());
if (shortestPath == null){
log.debug("Shortest path between {} and {} not found",
- ingressRouter.getAttachmentPoint(),
- thisRouter.getAttachmentPoint());
+ srcInterface.getSwitchPort(),
+ peerInterface.getSwitchPort());
return; // just quit here?
}
@@ -492,8 +485,6 @@
.setBufferId(OFPacketOut.BUFFER_ID_NONE)
.setCookie(MAC_RW_COOKIE)
.setCommand(OFFlowMod.OFPFC_ADD)
- //.setMatch(match)
- //.setActions(actions)
.setPriority(SDNIP_PRIORITY)
.setLengthU(OFFlowMod.MINIMUM_LENGTH
+ OFActionDataLayerDestination.MINIMUM_LENGTH
@@ -503,8 +494,9 @@
match.setDataLayerType(Ethernet.TYPE_IPv4);
match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_TYPE);
- match.setDataLayerSource(ingressRouter.getRouterMac().toBytes());
- match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_SRC);
+ //match.setDataLayerSource(ingressRouter.getRouterMac().toBytes());
+ //match.setDataLayerSource(peer.getMacAddress().toBytes());
+ //match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_SRC);
InetAddress address = null;
try {
@@ -520,7 +512,9 @@
//Set up MAC rewrite action
OFActionDataLayerDestination macRewriteAction = new OFActionDataLayerDestination();
- macRewriteAction.setDataLayerAddress(thisRouter.getRouterMac().toBytes());
+ //TODO use ARP module rather than configured mac addresses
+ //TODO the peer's mac address is not necessarily the next hop's...
+ macRewriteAction.setDataLayerAddress(peer.getMacAddress().toBytes());
//Set up output action
OFActionOutput outputAction = new OFActionOutput();
@@ -536,7 +530,7 @@
//Write to switch
IOFSwitch sw = floodlightProvider.getSwitches()
- .get(ingressRouter.getAttachmentPoint().dpid().value());
+ .get(srcInterface.getDpid());
if (sw == null){
log.warn("Switch not found when pushing flow mod");
@@ -554,6 +548,7 @@
}
}
+ //TODO this is largely untested
public void prefixDeleted(PtreeNode node) {
if (!topologyReady) {
return;
@@ -565,11 +560,16 @@
prefix, node.rib.nextHop.toString());
//Remove MAC rewriting flows from other border switches
- GatewayRouter thisRouter = gatewayRouters
- .get(InetAddresses.toAddrString(node.rib.nextHop));
+ BgpPeer peer = bgpPeers.get(node.rib.nextHop);
+ if (peer == null){
+ //either a router server route or local route. Can't handle right now
+ return;
+ }
- for (GatewayRouter ingressRouter : gatewayRouters.values()){
- if (ingressRouter == thisRouter) {
+ Interface peerInterface = interfaces.get(peer.getInterfaceName());
+
+ for (Interface srcInterface : interfaces.values()) {
+ if (srcInterface == peerInterface) {
continue;
}
@@ -583,8 +583,7 @@
.setBufferId(OFPacketOut.BUFFER_ID_NONE)
.setCookie(MAC_RW_COOKIE)
.setCommand(OFFlowMod.OFPFC_DELETE)
- //.setMatch(match)
- //.setActions(actions)
+ .setOutPort(OFPort.OFPP_NONE)
.setPriority(SDNIP_PRIORITY)
.setLengthU(OFFlowMod.MINIMUM_LENGTH);
//+ OFActionDataLayerDestination.MINIMUM_LENGTH
@@ -594,8 +593,9 @@
match.setDataLayerType(Ethernet.TYPE_IPv4);
match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_TYPE);
- match.setDataLayerSource(ingressRouter.getRouterMac().toBytes());
- match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_SRC);
+ //match.setDataLayerSource(ingressRouter.getRouterMac().toBytes());
+ //match.setDataLayerSource(peer.getMacAddress().toBytes());
+ //match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_SRC);
InetAddress address = null;
try {
@@ -611,7 +611,7 @@
//Write to switch
IOFSwitch sw = floodlightProvider.getSwitches()
- .get(ingressRouter.getAttachmentPoint().dpid().value());
+ .get(srcInterface.getDpid());
if (sw == null){
log.warn("Switch not found when pushing flow mod");
@@ -634,60 +634,38 @@
* switches
*/
private void setupFullMesh(){
- Map<IOFSwitch, SwitchPort> gatewaySwitches = new HashMap<IOFSwitch, SwitchPort>();
-
- //have to account for switches not being there, paths not being found.
-
- for (GatewayRouter router : gatewayRouters.values()){
- SwitchPort switchPort = router.getAttachmentPoint();
-
- IOFSwitch sw = floodlightProvider.getSwitches().get(switchPort.dpid().value());
-
- if (sw == null){
- log.debug("Gateway switch {} not here yet", switchPort.dpid().value());
- return; // just quit here?
- }
-
- //Only need to know 1 external-facing port from each gateway switch
- //which we can feed into shortest path calculation
- if (!gatewaySwitches.containsKey(sw)){
- gatewaySwitches.put(sw, switchPort);
- }
-
- }
-
//For each border router, calculate and install a path from every other
//border switch to said border router. However, don't install the entry
//in to the first hop switch, as we need to install an entry to rewrite
//for each prefix received. This will be done later when prefixes have
//actually been received.
- for (GatewayRouter dstRouter : gatewayRouters.values()){
- SwitchPort routerAttachmentPoint = dstRouter.getAttachmentPoint();
- for (Map.Entry<IOFSwitch, SwitchPort> src : gatewaySwitches.entrySet()) {
-
- if (routerAttachmentPoint.dpid().value() ==
- src.getKey().getId()){
+ for (BgpPeer peer : bgpPeers.values()) {
+ Interface peerInterface = interfaces.get(peer.getInterfaceName());
+ //for (Map.Entry<String, Interface> intfEntry : interfaces.entrySet()) {
+ for (Interface srcInterface : interfaces.values()) {
+ //Interface srcInterface = intfEntry.getValue();
+ //if (peer.getInterfaceName().equals(intfEntry.getKey())){
+ if (peer.getInterfaceName().equals(srcInterface.getName())){
continue;
}
DataPath shortestPath = topoRouteService.getShortestPath(
- src.getValue(), routerAttachmentPoint);
+ srcInterface.getSwitchPort(), peerInterface.getSwitchPort());
if (shortestPath == null){
log.debug("Shortest path between {} and {} not found",
- src.getValue(), routerAttachmentPoint);
+ srcInterface.getSwitchPort(), peerInterface.getSwitchPort());
return; // just quit here?
}
//install flows
- installPath(shortestPath.flowEntries(), dstRouter);
+ installPath(shortestPath.flowEntries(), peer);
}
}
}
- private void installPath(List<FlowEntry> flowEntries, GatewayRouter router){
-
+ private void installPath(List<FlowEntry> flowEntries, BgpPeer peer){
//Set up the flow mod
OFFlowMod fm =
(OFFlowMod) floodlightProvider.getOFMessageFactory()
@@ -703,7 +681,6 @@
.setBufferId(OFPacketOut.BUFFER_ID_NONE)
.setCookie(L2_FWD_COOKIE)
.setCommand(OFFlowMod.OFPFC_ADD)
- //.setMatch(match)
.setActions(actions)
.setLengthU(OFFlowMod.MINIMUM_LENGTH+OFActionOutput.MINIMUM_LENGTH);
@@ -713,7 +690,8 @@
FlowEntry flowEntry = flowEntries.get(i);
OFMatch match = new OFMatch();
- match.setDataLayerDestination(router.getRouterMac().toBytes());
+ //TODO Again using MAC address from configuration
+ match.setDataLayerDestination(peer.getMacAddress().toBytes());
match.setWildcards(match.getWildcards() & ~OFMatch.OFPFW_DL_DST);
((OFActionOutput) fm.getActions().get(0)).setPort(flowEntry.outPort().value());
@@ -744,7 +722,7 @@
}
private void setupBgpPaths(){
- for (BgpPeer bgpPeer : bgpPeers){
+ for (BgpPeer bgpPeer : bgpPeers.values()){
Interface peerInterface = interfaces.get(bgpPeer.getInterfaceName());
DataPath path = topoRouteService.getShortestPath(
@@ -892,23 +870,21 @@
switchesConnected = true;
}
+ //Actually we only need to go half way round to verify full mesh connectivity
+ //(n^2)/2
private void checkTopologyReady(){
- for (GatewayRouter dstRouter : gatewayRouters.values()){
- SwitchPort dstAttachmentPoint = dstRouter.getAttachmentPoint();
- for (GatewayRouter srcRouter : gatewayRouters.values()) {
-
- if (dstRouter == srcRouter){
+ for (Interface dstInterface : interfaces.values()) {
+ for (Interface srcInterface : interfaces.values()) {
+ if (dstInterface == srcInterface) {
continue;
}
- SwitchPort srcAttachmentPoint = srcRouter.getAttachmentPoint();
-
DataPath shortestPath = topoRouteService.getShortestPath(
- srcAttachmentPoint, dstAttachmentPoint);
+ srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
if (shortestPath == null){
log.debug("Shortest path between {} and {} not found",
- srcAttachmentPoint, dstAttachmentPoint);
+ srcInterface.getSwitchPort(), dstInterface.getSwitchPort());
return;
}
}
@@ -957,23 +933,7 @@
}
log.debug("Topo change {}", ldu.getOperation());
- /*
- if (ldu.getOperation().equals(ILinkDiscovery.UpdateOperation.LINK_ADDED)){
- log.debug("Link Added: src={} outPort={} dst={} inPort={}",
- new Object[] {
- HexString.toHexString(ldu.getSrc()), ldu.getSrcPort(),
- HexString.toHexString(ldu.getDst()), ldu.getDstPort()});
- TopoLinkServiceImpl impl = new TopoLinkServiceImpl();
-
- List<Link> retval = impl.getActiveLinks();
-
- log.debug("retval size {}", retval.size());
-
- for (Link l : retval){
- log.debug("link {}", l);
- }
- }
- */
+
if (ldu.getOperation().equals(ILinkDiscovery.UpdateOperation.LINK_ADDED)){
synchronized (linkUpdates) {
linkUpdates.add(ldu);
@@ -983,13 +943,6 @@
if (refreshNeeded){
topologyChangeDetectorTask.reschedule(TOPO_DETECTION_WAIT, TimeUnit.SECONDS);
- /*if (topologyReady){
- setupFullMesh();
- }
- else{
- checkStatus();
- }*/
-
}
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/Configuration.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Configuration.java
index 65617c8..c3c8cbb 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/Configuration.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Configuration.java
@@ -1,7 +1,6 @@
package net.onrc.onos.ofcontroller.bgproute;
import java.util.List;
-import java.util.Map;
import org.codehaus.jackson.annotate.JsonProperty;
import org.openflow.util.HexString;
@@ -10,9 +9,9 @@
private long bgpdAttachmentDpid;
private short bgpdAttachmentPort;
private List<String> switches;
- private Map<String, Interface> interfaces;
+ private List<Interface> interfaces;
private List<BgpPeer> peers;
- private Map<String, GatewayRouter> gateways;
+ //private Map<String, GatewayRouter> gateways;
public Configuration() {
// TODO Auto-generated constructor stub
@@ -45,12 +44,12 @@
this.switches = switches;
}
- public Map<String, Interface> getInterfaces() {
+ public List<Interface> getInterfaces() {
return interfaces;
}
@JsonProperty("interfaces")
- public void setInterfaces(Map<String, Interface> interfaces) {
+ public void setInterfaces(List<Interface> interfaces) {
this.interfaces = interfaces;
}
@@ -63,6 +62,7 @@
this.peers = peers;
}
+ /*
public Map<String, GatewayRouter> getGateways() {
return gateways;
}
@@ -70,6 +70,6 @@
@JsonProperty("gateways")
public void setGateways(Map<String, GatewayRouter> gateways) {
this.gateways = gateways;
- }
+ }*/
}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/bgproute/Interface.java b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Interface.java
index 15b2125..088c18e 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/bgproute/Interface.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/bgproute/Interface.java
@@ -12,12 +12,22 @@
import com.google.common.net.InetAddresses;
public class Interface {
+ private String name;
private SwitchPort switchPort = null;
private long dpid;
private short port;
private InetAddress ipAddress;
private int prefixLength;
+ public String getName() {
+ return name;
+ }
+
+ @JsonProperty("name")
+ public void setName(String name) {
+ this.name = name;
+ }
+
public synchronized SwitchPort getSwitchPort() {
if (switchPort == null){
switchPort = new SwitchPort(new Dpid(dpid), new Port(port));
diff --git a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
index b7fc896..a5246c0 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/proxyarp/ProxyArpManager.java
@@ -39,7 +39,6 @@
protected IFloodlightProviderService floodlightProvider;
protected ITopologyService topology;
-
protected Map<InetAddress, ArpTableEntry> arpTable;
public ProxyArpManager(IFloodlightProviderService floodlightProvider,
@@ -57,13 +56,11 @@
@Override
public boolean isCallbackOrderingPrereq(OFType type, String name) {
- // TODO Auto-generated method stub
return false;
}
@Override
public boolean isCallbackOrderingPostreq(OFType type, String name) {
- // TODO Auto-generated method stub
return false;
}
@@ -115,7 +112,6 @@
}
}
-
return Command.CONTINUE;
}
@@ -180,14 +176,11 @@
OFPacketOut po = new OFPacketOut();
po.setInPort(OFPort.OFPP_NONE)
.setBufferId(-1)
- //.setLengthU(OFActionOutput.MINIMUM_LENGTH);
.setPacketData(pi.getPacketData());
List<OFAction> actions = new ArrayList<OFAction>();
for (short portNum : enabledPorts){
- //log.debug("linkPorts {}", linkPorts);
- //log.debug("portNum {}", portNum);
if (linkPorts.contains(portNum) ||
(sw.getId() == inSwitch && portNum == inPort)){
//If this port isn't an edge port or is the ingress port
@@ -258,14 +251,15 @@
log.warn("Failure writing packet out to switch", e);
}
}
-
+
+ //TODO this should be put somewhere more central. I use it in BgpRoute as well.
+ //We need a HexString.toHexString() equivalent.
private String bytesToStringAddr(byte[] bytes){
InetAddress addr;
try {
addr = InetAddress.getByAddress(bytes);
} catch (UnknownHostException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
+ log.warn(" ", e);
return "";
}
if (addr == null) return "";