Separate Port Added/Removed Event added by ONOS from IOFSwitchListener to IOFSwitchPortListener
diff --git a/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java b/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java
index f8dd52c..1bc258b 100644
--- a/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java
+++ b/src/main/java/net/floodlightcontroller/core/IOFSwitchListener.java
@@ -17,8 +17,6 @@
 
 package net.floodlightcontroller.core;
 
-import org.openflow.protocol.OFPhysicalPort;
-
 /**
  *
  *
@@ -46,16 +44,6 @@
     public void switchPortChanged(Long switchId);
     
     /**
-     * Fired when ports on a switch area added
-     */
-    public void switchPortAdded(Long switchId, OFPhysicalPort port);
-    
-    /**
-     * Fired when ports on a switch area removed
-     */
-    public void switchPortRemoved(Long switchId, OFPhysicalPort port);
-    
-    /**
      * The name assigned to this listener
      * @return
      */
diff --git a/src/main/java/net/floodlightcontroller/core/internal/Controller.java b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
index d9fa666..e8c575a 100644
--- a/src/main/java/net/floodlightcontroller/core/internal/Controller.java
+++ b/src/main/java/net/floodlightcontroller/core/internal/Controller.java
@@ -73,6 +73,7 @@
 import net.floodlightcontroller.storage.OperatorPredicate;
 import net.floodlightcontroller.storage.StorageException;
 import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyService.ITopoRouteService;
 import net.onrc.onos.ofcontroller.flowcache.IFlowService;
 import net.onrc.onos.registry.controller.IControllerRegistryService;
@@ -298,10 +299,14 @@
                             listener.switchPortChanged(sw.getId());
                             break;
                         case PORTADDED:
-                        	listener.switchPortAdded(sw.getId(), port);
+                        	if (listener instanceof IOFSwitchPortListener) {
+                        		((IOFSwitchPortListener) listener).switchPortAdded(sw.getId(), port);
+                        	}
                         	break;
                         case PORTREMOVED:
-                        	listener.switchPortRemoved(sw.getId(), port);
+                        	if (listener instanceof IOFSwitchPortListener) {
+                        		((IOFSwitchPortListener) listener).switchPortRemoved(sw.getId(), port);
+                        	}
                         	break;
                         default:
                         	break;
diff --git a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
index afa1dbf..c126a26 100644
--- a/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
+++ b/src/main/java/net/floodlightcontroller/linkdiscovery/internal/LinkDiscoveryManager.java
@@ -2134,15 +2134,4 @@
         this.autoPortFastFeature = autoPortFastFeature;
     }
 
-	@Override
-	public void switchPortAdded(Long switchId, OFPhysicalPort port) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	@Override
-	public void switchPortRemoved(Long switchId, OFPhysicalPort port) {
-		// TODO Auto-generated method stub
-		
-	}
 }
diff --git a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java
index 371a479..4ed59d7 100644
--- a/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java
+++ b/src/main/java/net/floodlightcontroller/staticflowentry/StaticFlowEntryPusher.java
@@ -39,7 +39,6 @@
 import org.openflow.protocol.OFFlowRemoved;
 import org.openflow.protocol.OFMatch;
 import org.openflow.protocol.OFMessage;
-import org.openflow.protocol.OFPhysicalPort;
 import org.openflow.protocol.OFType;
 import org.openflow.protocol.factory.BasicFactory;
 import org.openflow.util.HexString;
@@ -676,17 +675,5 @@
             Map<String, String> removedControllerNodeIPs) {
         // ignore
     }
-
-	@Override
-	public void switchPortAdded(Long switchId, OFPhysicalPort port) {
-		// TODO Auto-generated method stub
-		
-	}
-
-	@Override
-	public void switchPortRemoved(Long switchId, OFPhysicalPort port) {
-		// TODO Auto-generated method stub
-		
-	}
      
 }
diff --git a/src/main/java/net/onrc/onos/ofcontroller/core/IOFSwitchPortListener.java b/src/main/java/net/onrc/onos/ofcontroller/core/IOFSwitchPortListener.java
new file mode 100644
index 0000000..5deae69
--- /dev/null
+++ b/src/main/java/net/onrc/onos/ofcontroller/core/IOFSwitchPortListener.java
@@ -0,0 +1,26 @@
+/**
+ * 
+ */
+package net.onrc.onos.ofcontroller.core;
+
+import org.openflow.protocol.OFPhysicalPort;
+
+import net.floodlightcontroller.core.IOFSwitchListener;
+
+/**
+ * @author y-higuchi
+ *
+ */
+public interface IOFSwitchPortListener extends IOFSwitchListener {
+
+	/**
+	 * Fired when ports on a switch area added
+	 */
+	public void switchPortAdded(Long switchId, OFPhysicalPort port);
+
+	/**
+	 * Fired when ports on a switch area removed
+	 */
+	public void switchPortRemoved(Long switchId, OFPhysicalPort port);
+
+}
diff --git a/src/main/java/net/onrc/onos/ofcontroller/onoslistener/OnosPublisher.java b/src/main/java/net/onrc/onos/ofcontroller/onoslistener/OnosPublisher.java
index 01ca69b..db18296 100644
--- a/src/main/java/net/onrc/onos/ofcontroller/onoslistener/OnosPublisher.java
+++ b/src/main/java/net/onrc/onos/ofcontroller/onoslistener/OnosPublisher.java
@@ -27,6 +27,7 @@
 import net.floodlightcontroller.linkdiscovery.internal.LinkStorageImpl;
 import net.floodlightcontroller.routing.Link;
 import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
 import net.onrc.onos.ofcontroller.core.ISwitchStorage;
 import net.onrc.onos.ofcontroller.core.INetMapStorage.DM_OPERATION;
 import net.onrc.onos.ofcontroller.core.INetMapTopologyObjects.ISwitchObject;
@@ -43,7 +44,7 @@
 import net.onrc.onos.util.IDBConnection;
 import net.onrc.onos.util.LocalTopologyEventListener;
 
-public class OnosPublisher implements IDeviceListener, IOFSwitchListener,
+public class OnosPublisher implements IDeviceListener, IOFSwitchListener, IOFSwitchPortListener,
 		ILinkDiscoveryListener, IFloodlightModule {
 	
 	protected IDeviceStorage devStore;
diff --git a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
index 05e01a3..4ae4309 100644
--- a/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
+++ b/src/test/java/net/floodlightcontroller/core/internal/ControllerTest.java
@@ -69,6 +69,7 @@
 import net.floodlightcontroller.storage.memory.MemoryStorageSource;
 import net.floodlightcontroller.test.FloodlightTestCase;
 import net.floodlightcontroller.threadpool.IThreadPoolService;
+import net.onrc.onos.ofcontroller.core.IOFSwitchPortListener;
 
 import org.easymock.Capture;
 import org.easymock.EasyMock;
@@ -404,7 +405,7 @@
     
     @Test
     public void testUpdateQueue() throws Exception {
-        class DummySwitchListener implements IOFSwitchListener {
+        class DummySwitchListener implements IOFSwitchListener, IOFSwitchPortListener {
             public int nAdded;
             public int nRemoved;
             public int nPortChanged;