net.floodlightcontroller.devicemanager
Interface IEntityClassifierService

All Superinterfaces:
IFloodlightService
All Known Implementing Classes:
DefaultEntityClassifier

public interface IEntityClassifierService
extends IFloodlightService

A component that wishes to participate in entity classification needs to implement the IEntityClassifier interface, and register with the Device Manager as an entity classifier. An entity is classified by the classifier into an IEntityClass

Author:
readams

Method Summary
 void addListener(IEntityClassListener listener)
          Adds a listener to listen for IEntityClassifierServices notifications
 IEntityClass classifyEntity(Entity entity)
          Classify the given entity into an IEntityClass.
 void deviceUpdate(IDevice oldDevice, java.util.Collection<? extends IDevice> newDevices)
          Once reclassification is complete for a device, this method will be called.
 java.util.EnumSet<IDeviceService.DeviceField> getKeyFields()
          Return the most general list of fields that should be used as key fields.
 IEntityClass reclassifyEntity(IDevice curDevice, Entity entity)
          Reclassify the given entity into a class.
 

Method Detail

classifyEntity

IEntityClass classifyEntity(Entity entity)
Classify the given entity into an IEntityClass. It is important that the key fields returned by getKeyFields() be sufficient for classifying entities. That is, if two entities are identical except for a field that is not a key field, they must be assigned the same class. Furthermore, entity classification must be transitive: For all entities x, y, z, if x and y belong to a class c, and y and z belong class c, then x and z must belong to class c.

Parameters:
entity - the entity to classify
Returns:
the IEntityClass resulting from the classification.
See Also:
getKeyFields()

getKeyFields

java.util.EnumSet<IDeviceService.DeviceField> getKeyFields()
Return the most general list of fields that should be used as key fields. If devices differ in any fields not listed here, they can never be considered a different device by any IEntityClass returned by classifyEntity(net.floodlightcontroller.devicemanager.internal.Entity). The key fields for an entity classifier must not change unless associated with a flush of all entity state. The list of key fields must be the union of all key fields that could be returned by IEntityClass.getKeyFields().

Returns:
a set containing the fields that should not be wildcarded. May be null to indicate that all fields are key fields.
See Also:
IEntityClass#getKeyFields()}, IEntityClassifierService#classifyEntity}

reclassifyEntity

IEntityClass reclassifyEntity(IDevice curDevice,
                              Entity entity)
Reclassify the given entity into a class. When reclassifying entities, it can be helpful to take into account the current classification either as an optimization or to allow flushing any cached state tied to the key for that device. The entity will be assigned to a new device with a new object if the entity class returned is different from the entity class for curDevice.

Note that you must take steps to ensure you always return classes in some consistent ordering.

Parameters:
curDevice - the device currently associated with the entity
entity - the entity to reclassify
Returns:
the IEntityClass resulting from the classification

deviceUpdate

void deviceUpdate(IDevice oldDevice,
                  java.util.Collection<? extends IDevice> newDevices)
Once reclassification is complete for a device, this method will be called. If any entities within the device changed their classification, it will split into one or more new devices for each of the entities. If two devices are merged because of a reclassification, then this will be called on each of the devices, with the same device in the newDevices collection.

Parameters:
oldDevice - the original device object
newDevices - all the new devices derived from the entities of the old device. If null, the old device was unchanged.

addListener

void addListener(IEntityClassListener listener)
Adds a listener to listen for IEntityClassifierServices notifications

Parameters:
listener - The listener that wants the notifications