<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On May 8, 2015, at 9:49 PM, 博威张 <<a href="mailto:zbw921124@gmail.com">zbw921124@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr">Hi,<div><br></div><div>I have following confusions about the class of <i>Switch (EventMixin) </i>in<i> l2_multi </i>:</div><div>1.No instance of the class of <i>Switch (EventMixin)</i> has been found in<i> component of l2_multi, so how does it work</i>? </div></div></blockquote><div><br></div><div>Sure there are instances of it.  The l2_multi class creates instances in response to ConnectionUp events.</div><br><blockquote type="cite"><div dir="ltr"><div>2. It doesn't listen to any components(including the <i>core.openflow</i>) , so how will the function of <i>_handle_PacketIn work?</i></div></div></blockquote><div><br></div><div>It listens to Connection objects.  Switch.connect() does this by a call to self.listenTo().  As with the creation of Switch instances, the call to Switch.connect() is made from l2_multi's ConnectionUp handler.</div><br><blockquote type="cite"><div dir="ltr"><div><i>3. </i>It doesn't raise any events and even doesn't have the<i> _eventMixin_events set, </i>why does it inherit from<i> revent.EventMixin? </i></div></div></blockquote><div><br></div><div>It inherits from it so that it can do self.listenTo() (which comes from EventMixin).  This was briefly "the normal way" to bind events, but has been sort of deprecated for a long while.  I guess it has never been replaced here, though.  The more common/modern equivalent is calling source.addListeners(sink) rather than sink.listenTo(source).</div><br><blockquote type="cite"><div dir="ltr"><div>Thank you!</div><div>Bowei</div><div><i><br></i></div></div>
</blockquote></div><br></body></html>