max
max

Reputation: 686

POX component listen to events

I want to discover the topology of a network emulated by mininet using POX components. I figured out that I need to write my own component, which is listening to LinkEvents. Something like:

someObject.addListenerByName("LinkEvent", someFunction)

But I don't actually know on what kind of an object i should execute this.

If I execute it as

core.openflow_discovery.addListenerByName("LinkEvent", someFunction)

as stated in the openflow.discovery module, it throws the following error:

AttributeError: 'openflow_discovery' not registered

Upvotes: 3

Views: 1193

Answers (2)

max
max

Reputation: 686

Fixed it by calling addListenerByName from within launch().

Upvotes: 1

matrix
matrix

Reputation: 33

It is easier to use pox modules named "gephi" to do this, it should be under misc directory, just add this method to the "gephi_topo.py" in "class GephiTopo":

 def get_gephi_topology (self):
    switchesAndLinksAndHosts=[self.switches,self.links, self.hosts]
    return switchesAndLinksAndHosts

and then use it anywhere in your pox controller like:

topo=gephi_topo.GephiTopo.get_gephi_topology(core.GephiTopo)
switches= topo[0]
links=topo[1]
hosts=topo[2]

Upvotes: 2

Related Questions