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

Add IOFSwitch.getInetAddress and comments to other interfaces

parent 778df0eb
No related branches found
No related tags found
No related merge requests found
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
package net.floodlightcontroller.core; package net.floodlightcontroller.core;
import java.io.IOException; import java.io.IOException;
import java.net.SocketAddress;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
...@@ -53,7 +54,31 @@ public interface IOFSwitch { ...@@ -53,7 +54,31 @@ public interface IOFSwitch {
public static final String PROP_SUPPORTS_OFPP_TABLE = "supportsOfppTable"; public static final String PROP_SUPPORTS_OFPP_TABLE = "supportsOfppTable";
public static final String PROP_SUPPORTS_OFPP_FLOOD = "supportsOfppFlood"; public static final String PROP_SUPPORTS_OFPP_FLOOD = "supportsOfppFlood";
public static final String PROP_SUPPORTS_NETMASK_TBL = "supportsNetmaskTbl"; public static final String PROP_SUPPORTS_NETMASK_TBL = "supportsNetmaskTbl";
/**
* Set IFloodlightProviderService for this switch instance
* Called immediately after instantiation
*
* @param controller
*/
public void setFloodlightProvider(Controller controller);
/**
* Set IThreadPoolService for this switch instance
* Called immediately after instantiation
*
* @param threadPool
*/
public void setThreadPoolService(IThreadPoolService threadPool);
/**
* Set the netty Channel this switch instance is associated with
* Called immediately after instantiation
*
* @param channel
*/
public void setChannel(Channel channel);
/** /**
* Writes to the OFMessage to the output stream. * Writes to the OFMessage to the output stream.
* The message will be handed to the floodlightProvider for possible filtering * The message will be handed to the floodlightProvider for possible filtering
...@@ -403,14 +428,28 @@ public interface IOFSwitch { ...@@ -403,14 +428,28 @@ public interface IOFSwitch {
*/ */
public void setHARole(Role role, boolean haRoleReplyReceived); public void setHARole(Role role, boolean haRoleReplyReceived);
public void setChannel(Channel channel); /**
* Return a read lock that must be held while calling the listeners for
public void setFloodlightProvider(Controller controller); * messages from the switch. Holding the read lock prevents the active
* switch list from being modified out from under the listeners.
public void setThreadPoolService(IThreadPoolService threadPool); * @return
*/
public Lock getListenerReadLock(); public Lock getListenerReadLock();
/**
* Return a write lock that must be held when the controllers modifies the
* list of active switches. This is to ensure that the active switch list
* doesn't change out from under the listeners as they are handling a
* message from the switch.
* @return
*/
public Lock getListenerWriteLock(); public Lock getListenerWriteLock();
/**
* Get the IP Address for the switch
* @return the inet address
*/
public SocketAddress getInetAddress();
} }
...@@ -633,6 +633,8 @@ public class OFSwitchImpl implements IOFSwitch { ...@@ -633,6 +633,8 @@ public class OFSwitchImpl implements IOFSwitch {
return xid; return xid;
} }
@JsonIgnore
@Override
public void setHARole(Role role, boolean replyReceived) { public void setHARole(Role role, boolean replyReceived) {
/* null role implies disconnect the switch */ /* null role implies disconnect the switch */
if (role == null) { if (role == null) {
......
...@@ -2,6 +2,7 @@ package net.floodlightcontroller.util; ...@@ -2,6 +2,7 @@ package net.floodlightcontroller.util;
import static org.junit.Assert.*; import static org.junit.Assert.*;
import java.io.IOException; import java.io.IOException;
import java.net.SocketAddress;
import java.util.Collection; import java.util.Collection;
import java.util.Date; import java.util.Date;
...@@ -391,4 +392,10 @@ public class OFMessageDamperMockSwitch implements IOFSwitch { ...@@ -391,4 +392,10 @@ public class OFMessageDamperMockSwitch implements IOFSwitch {
} }
@Override
public SocketAddress getInetAddress() {
// 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