diff --git a/build.xml b/build.xml index 58f4b71df0c067390cb53bc34c346cc70b3e432a..c94be94c1475fafe689bd3811b2e9fbfade75047 100644 --- a/build.xml +++ b/build.xml @@ -111,7 +111,7 @@ debug="true" srcdir="${source}:${packetstreamer-gen}" destdir="${build}"> - </javac> + </javac> </target> <target name="compile-tests" depends="compile-test"/> diff --git a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java index ed47ecb665f8398581dea41dea6f4de0f9e64917..a5b8352aabbdd612fa62e29f756ebd77480f9c0f 100755 --- a/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java +++ b/src/main/java/net/floodlightcontroller/devicemanager/internal/DeviceManagerImpl.java @@ -621,6 +621,7 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe protected boolean inSamePortChannel(SwitchPortTuple swPort1, SwitchPortTuple swPort2) { IOFSwitch sw = swPort1.getSw(); + if (sw == null) return false; String portName = sw.getPort(swPort1.getPort()).getName(); String key = sw.getStringId() + portName; String portChannel1 = portChannelMap.get(key); @@ -628,6 +629,7 @@ public class DeviceManagerImpl implements IDeviceManagerService, IOFMessageListe return false; sw = swPort2.getSw(); + if (sw == null) return false; portName = sw.getPort(swPort2.getPort()).getName(); key = sw.getStringId() + portName; String portChannel2 = portChannelMap.get(key); diff --git a/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java b/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java index a2fc7dfeae65495efbdcb0ed91c7bd230dff2740..07f4926880ea1dc76a90c1991b4b64e3f680b200 100644 --- a/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java +++ b/src/main/java/net/floodlightcontroller/topology/NodePortTuple.java @@ -1,15 +1,41 @@ package net.floodlightcontroller.topology; +import net.floodlightcontroller.linkdiscovery.SwitchPortTuple; + import org.openflow.util.HexString; +/** + * A NodePortTuple is similar to a SwitchPortTuple + * but it only stores IDs instead of references + * to the actual objects. + * @author srini + */ public class NodePortTuple { - protected long nodeId; - protected short portId; + protected long nodeId; // switch DPID + protected short portId; // switch port id + /** + * Creates a NodePortTuple + * @param nodeId The DPID of the switch + * @param portId The port of the switch + */ public NodePortTuple(long nodeId, short portId) { this.nodeId = nodeId; this.portId = portId; } + + /** + * Creates a NodePortTuple from the same information + * in a SwitchPortTuple + * @param swt + */ + public NodePortTuple(SwitchPortTuple swt) { + if (swt.getSw() != null) + this.nodeId = swt.getSw().getId(); + else + this.nodeId = 0; + this.portId = swt.getPort(); + } public long getNodeId() { return nodeId;