I'm not sure I understand the question or confusion.  I think you're saying 
that you believe these connections are not event sources and so make no sense 
to listen to events from.  Maybe you're under the impression they are strings 
and therefore couldn't be?

They're not strings.  event.connection in the first example and the connection 
argument in the second example are openflow.of_01.Connection objects.  If you 
look them up, you'll see that they do, indeed, raise events.  If they didn't, 
you'd get a warning message.

-- Murphy

On Jun 3, 2013, at 6:07 AM, Yanan wrote:

> I have a question about listenTo in l2_multi.
> 
> sometimes  I can follow the command line, such as "listenTo(core)" or 
> "listenTo(core.openflow)". 
> 
> but in the forwarding.l2_multi , in the class "l2_multi":
> 
>   def _handle_ConnectionUp (self, event):
>     sw = switches.get(event.dpid)
>     if sw is None:
>       # New switch
>       sw = Switch()
>       switches[event.dpid] = sw
>       sw.connect(event.connection)
>     else:
>       sw.connect(event.connection)
> 
> and then I find the "connect" in the "Switch" class :
> 
>   def connect (self, connection):
>     if self.dpid is None:
>       self.dpid = connection.dpid
>     assert self.dpid == connection.dpid
>     if self.ports is None:
>       self.ports = connection.features.ports
>     self.disconnect()
>     log.debug("Connect %s" % (connection,))
>     self.connection = connection
>     self._listeners = self.listenTo(connection)
>     self._connected_at = time.time()
> 
> the debug is "DEBUG:forwarding.l2_multi:Connect [90-e2-ba-28-29-f6 1]".
> 
> It seems that the conneciton is not  a "source".
> 
> I am confused about the listenTo in forwarding.l2_multi.  
> 
> Please help me to understand this.
> 
> Best Regards,
> Yanan
> 
> 

Reply via email to