net.floodlightcontroller.devicemanager
Interface IDeviceService

All Superinterfaces:
IFloodlightService
All Known Implementing Classes:
DeviceManagerImpl

public interface IDeviceService
extends IFloodlightService

Device manager allows interacting with devices on the network. Note that under normal circumstances, Device objects should be retrieved from the FloodlightContext rather than from IDeviceManager.


Nested Class Summary
static class IDeviceService.DeviceField
          Fields used in devices for indexes and querying
 
Field Summary
static java.lang.String CONTEXT_DST_DEVICE
          The destination device for the current packet-in, if applicable.
static java.lang.String CONTEXT_ORIG_DST_DEVICE
          The original destination device for the current packet-in
static java.lang.String CONTEXT_SRC_DEVICE
          The source device for the current packet-in, if applicable.
static FloodlightContextStore<IDevice> fcStore
          A FloodlightContextStore object that can be used to interact with the FloodlightContext information created by BVS manager.
 
Method Summary
 void addIndex(boolean perClass, java.util.EnumSet<IDeviceService.DeviceField> keyFields)
          Create an index over a set of fields.
 void addListener(IDeviceListener listener)
          Adds a listener to listen for IDeviceManagerServices notifications
 void addSuppressAPs(long swId, int port)
          Specify points in the network where attachment points are not to be learned.
 IDevice findClassDevice(IEntityClass entityClass, long macAddress, java.lang.Short vlan, java.lang.Integer ipv4Address)
          Get a destination device using entity fields that corresponds with the given source device.
 IDevice findDevice(long macAddress, java.lang.Short vlan, java.lang.Integer ipv4Address, java.lang.Long switchDPID, java.lang.Integer switchPort)
          Search for a device exactly matching the provided device fields.
 java.util.Collection<? extends IDevice> getAllDevices()
          Get an unmodifiable collection view over all devices currently known.
 IDevice getDevice(java.lang.Long deviceKey)
          Get the device with the given device key.
 java.util.Set<SwitchPort> getSuppressAPs()
           
 java.util.Iterator<? extends IDevice> queryClassDevices(IEntityClass entityClass, java.lang.Long macAddress, java.lang.Short vlan, java.lang.Integer ipv4Address, java.lang.Long switchDPID, java.lang.Integer switchPort)
          Find devices that match the provided query.
 java.util.Iterator<? extends IDevice> queryDevices(java.lang.Long macAddress, java.lang.Short vlan, java.lang.Integer ipv4Address, java.lang.Long switchDPID, java.lang.Integer switchPort)
          Find devices that match the provided query.
 void removeSuppressAPs(long swId, int port)
           
 

Field Detail

CONTEXT_SRC_DEVICE

static final java.lang.String CONTEXT_SRC_DEVICE
The source device for the current packet-in, if applicable.

See Also:
Constant Field Values

CONTEXT_DST_DEVICE

static final java.lang.String CONTEXT_DST_DEVICE
The destination device for the current packet-in, if applicable.

See Also:
Constant Field Values

CONTEXT_ORIG_DST_DEVICE

static final java.lang.String CONTEXT_ORIG_DST_DEVICE
The original destination device for the current packet-in

See Also:
Constant Field Values

fcStore

static final FloodlightContextStore<IDevice> fcStore
A FloodlightContextStore object that can be used to interact with the FloodlightContext information created by BVS manager.

Method Detail

getDevice

IDevice getDevice(java.lang.Long deviceKey)
Get the device with the given device key.

Parameters:
deviceKey - the key to search for
Returns:
the device associated with the key, or null if no such device
See Also:
IDevice.getDeviceKey()

findDevice

IDevice findDevice(long macAddress,
                   java.lang.Short vlan,
                   java.lang.Integer ipv4Address,
                   java.lang.Long switchDPID,
                   java.lang.Integer switchPort)
                   throws java.lang.IllegalArgumentException
Search for a device exactly matching the provided device fields. This is the same lookup process that is used for packet_in processing and device learning. Thus, findDevice() can be used to match flow entries from switches to devices. Only the key fields as defined by the IEntityClassifierService will be important in this search. All key fields MUST be supplied. queryDevices() might be more appropriate!

Parameters:
macAddress - The MAC address
vlan - the VLAN. Null means no VLAN and is valid even if VLAN is a key field.
ipv4Address - the ipv4 address
switchDPID - the switch DPID
switchPort - the switch port
Returns:
an IDevice or null if no device is found.
Throws:
java.lang.IllegalArgumentException - if not all key fields of the current IEntityClassifierService are specified.
See Also:
IDeviceManager#setEntityClassifier(IEntityClassifierService)

findClassDevice

IDevice findClassDevice(IEntityClass entityClass,
                        long macAddress,
                        java.lang.Short vlan,
                        java.lang.Integer ipv4Address)
                        throws java.lang.IllegalArgumentException
Get a destination device using entity fields that corresponds with the given source device. The source device is important since there could be ambiguity in the destination device without the attachment point information. Search for a device in a given entity class. This is the same as the lookup process for destination devices. Only the key fields as defined by the reference entity class will be important in this search. All key fields MUST be supplied.

Parameters:
entityClass - The entity class in which to perform the lookup.
macAddress - The MAC address for the destination
vlan - the VLAN if available
ipv4Address - The IP address if available.
Returns:
an IDevice or null if no device is found.
Throws:
java.lang.IllegalArgumentException - if not all key fields of the source's IEntityClass are specified.
See Also:
findDevice(long, Short, Integer, Long, Integer)

getAllDevices

java.util.Collection<? extends IDevice> getAllDevices()
Get an unmodifiable collection view over all devices currently known.

Returns:
the collection of all devices

addIndex

void addIndex(boolean perClass,
              java.util.EnumSet<IDeviceService.DeviceField> keyFields)
Create an index over a set of fields. This allows efficient lookup of devices when querying using the indexed set of specified fields. The index must be registered before any device learning takes place, or it may be incomplete. It's OK if this is called multiple times with the same fields; only one index will be created for each unique set of fields.

Parameters:
perClass - set to true if the index should be maintained for each entity class separately.
keyFields - the set of fields on which to index

queryDevices

java.util.Iterator<? extends IDevice> queryDevices(java.lang.Long macAddress,
                                                   java.lang.Short vlan,
                                                   java.lang.Integer ipv4Address,
                                                   java.lang.Long switchDPID,
                                                   java.lang.Integer switchPort)
Find devices that match the provided query. Any fields that are null will not be included in the query. If there is an index for the query, then it will be performed efficiently using the index. Otherwise, there will be a full scan of the device list.

Parameters:
macAddress - The MAC address
vlan - the VLAN
ipv4Address - the ipv4 address
switchDPID - the switch DPID
switchPort - the switch port
Returns:
an iterator over a set of devices matching the query
See Also:
queryClassDevices(IEntityClass, Long, Short, Integer, Long, Integer)

queryClassDevices

java.util.Iterator<? extends IDevice> queryClassDevices(IEntityClass entityClass,
                                                        java.lang.Long macAddress,
                                                        java.lang.Short vlan,
                                                        java.lang.Integer ipv4Address,
                                                        java.lang.Long switchDPID,
                                                        java.lang.Integer switchPort)
Find devices that match the provided query. Only the index for the specified class will be searched. Any fields that are null will not be included in the query. If there is an index for the query, then it will be performed efficiently using the index. Otherwise, there will be a full scan of the device list.

Parameters:
entityClass - The entity class in which to perform the query
macAddress - The MAC address
vlan - the VLAN
ipv4Address - the ipv4 address
switchDPID - the switch DPID
switchPort - the switch port
Returns:
an iterator over a set of devices matching the query
See Also:
IDeviceService#queryClassDevices(Long, Short, Integer, Long, Integer)

addListener

void addListener(IDeviceListener listener)
Adds a listener to listen for IDeviceManagerServices notifications

Parameters:
listener - The listener that wants the notifications
type - The type of the listener

addSuppressAPs

void addSuppressAPs(long swId,
                    int port)
Specify points in the network where attachment points are not to be learned.

Parameters:
sw -
port -

removeSuppressAPs

void removeSuppressAPs(long swId,
                       int port)

getSuppressAPs

java.util.Set<SwitchPort> getSuppressAPs()