Package onep :: Package discovery :: Module DiscoveryListener :: Class DiscoveryListener
[frames] | no frames]

Class DiscoveryListener



DiscoveryListener provides an interface to the application to define the 
action that has to be taken when ONEP Service sets are enabled or 
disabled. If the application wants to be notified of ONEP service set 
state changes in the network element, it invokes the add_discovery_listener
L{NetworkElement<onep.element.NetworkElement>} API to receive notification.

See L{DiscoveryEvent<onep.discovery.DiscoveryEvent>}
See L{DiscoveryFilter<onep.discovery.DiscoveryFilter>}

The following code shows how to define and add service set discovery listener 
to the network element.

1. Implement the DiscoveryListener interface:

class MyDiscoveryListener(DiscoveryListener):
    def handle_event(e, clientData):
    print "Following service sets changed" +
    e.description + "change in state" + 
    str(e.state)
    
2. Add MyDiscoveryListener instance to NetworkElement:

myDiscoveryListener = MyDiscoveryListener()
filter = DiscoveryFilter()
networkelement.add_discovery_listener(myDiscoveryListener, filter, clientData)

Warning: This Sample Code Has Not Been Verified

Instance Methods
 
handle_event(self, event, clientData)
Invoked when an event is received from the network element.

Inherited from object: __delattr__, __format__, __getattribute__, __hash__, __init__, __new__, __reduce__, __reduce_ex__, __repr__, __setattr__, __sizeof__, __str__, __subclasshook__

Properties

Inherited from object: __class__

Method Details

handle_event(self, event, clientData)

 

Invoked when an event is received from the network element.

Parameters:
  • event (DiscoveryEvent) - An event object that indicates that an event occurred in a network element.
  • clientData (void) - The clientData is an object that was passed in when the application called an API to add/register the event listener. The application is responsible for casting the input clientData to the appropriate class before using it.
Decorators:
  • @abstractmethod