Active DeletePort
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index 0cbcfcb..6e816c7 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -107,6 +107,7 @@
import org.openflow.protocol.OFPacketIn;
import org.openflow.protocol.OFPhysicalPort;
import org.openflow.protocol.OFPortStatus;
+import org.openflow.protocol.OFPhysicalPort.OFPortConfig;
import org.openflow.protocol.OFPhysicalPort.OFPortState;
import org.openflow.protocol.OFPortStatus.OFPortReason;
import org.openflow.protocol.OFSetConfig;
@@ -1145,12 +1146,10 @@
short portNumber = m.getDesc().getPortNumber();
OFPhysicalPort port = m.getDesc();
if (m.getReason() == (byte)OFPortReason.OFPPR_MODIFY.ordinal()) {
- int srcPortState = port.getState();
- boolean portUp = ((srcPortState &
- OFPortState.OFPPS_STP_MASK.getValue()) !=
- OFPortState.OFPPS_STP_BLOCK.getValue());
+ boolean portDown = ((OFPortConfig.OFPPC_PORT_DOWN.getValue() & port.getConfig()) > 0) ||
+ ((OFPortState.OFPPS_LINK_DOWN.getValue() & port.getState()) > 0);
sw.setPort(port);
- if (portUp) {
+ if (!portDown) {
swStore.addPort(sw.getStringId(), port);
} else {
swStore.deletePort(sw.getStringId(), port.getPortNumber());
diff --git a/src/main/java/net/floodlightcontroller/core/internal/SwitchStorageImpl.java b/src/main/java/net/floodlightcontroller/core/internal/SwitchStorageImpl.java
index 0636400..27d2a9f 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/SwitchStorageImpl.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/SwitchStorageImpl.java
@@ -8,6 +8,8 @@
import org.slf4j.LoggerFactory;
import org.openflow.protocol.OFPhysicalPort;
+import org.openflow.protocol.OFPhysicalPort.OFPortConfig;
+import org.openflow.protocol.OFPhysicalPort.OFPortState;
import com.thinkaurelius.titan.core.TitanException;
import com.thinkaurelius.titan.core.TitanFactory;
@@ -63,6 +65,13 @@
public void addPort(String dpid, OFPhysicalPort port) {
// TODO Auto-generated method stub
Vertex sw;
+
+ boolean portDown = ((OFPortConfig.OFPPC_PORT_DOWN.getValue() & port.getConfig()) > 0) ||
+ ((OFPortState.OFPPS_LINK_DOWN.getValue() & port.getState()) > 0);
+ if (portDown) {
+ deletePort(dpid, port.getPortNumber());
+ return;
+ }
try {
if ((sw = graph.getVertices("dpid",dpid).iterator().next()) != null) {
log.info("SwitchStorage:addPort dpid:{} port:{}", dpid, port.getPortNumber());