On Mar 29, 2013, at 11:40 PM, chenli wrote: > 1. The meaning for registering > Is core.registerNew(Mycomponent) the function to register to core object, and > we can use the methods in core which defined in /pox/pox/core.py ? > > If I register the Mycomponent to core, the other components can communicate > with Mycomponent by core object?
I think the answer here is yes. One of the purposes of the core object is to provide a rendezvous point for component instances. This allows a number of things, not all of which are really used extensively at this point: 1) It means you often just need to import core instead of a whole bunch of modules. 2) Multiple components that all implement the same interface can register under the same name and other components can find the active one. 3) It's not always clear where long-lived objects should be. One option is as a global variable of some module. core is a (possibly) more structured alternative which (among other things) hopefully encourages components to be capable of being instantiated more than once. (In practice, this is rarely true so far.) > 2. The code section for raising ConnectionUp event > And the second problem , I want to know where is the raiseEvent which raise > ConnectionUp event happened. In other words, maybe it looks like > core.openflow.raiseEvent(ConnectionUp). I'm not sure why it's helpful to know exactly where this event is raised, but it's in openflow.of_01 along with the rest of the stuff specific to communicating with OpenFlow 1.0 switches (not counting the stuff related to the OpenFlow protocol itself which is in libopenflow_01). It's slightly more complicated than just raising it on core.openflow. Connection objects are "owned" by an OpenFlowNexus. core.openflow is the default nexus, but there can be others. So the actual ConnectionUp event is raised on whichever nexus the Connection belongs to. -- Murphy