Re: [pox-dev] Where is the corresponding source code for the following Object.

2014-04-16 Thread Murphy McCauley
On Apr 16, 2014, at 3:27 AM, Shiyao Ma i...@introo.me wrote:

 Hi.
 
 I am following 
 https://github.com/noxrepo/pox/blob/carp/pox/forwarding/l2_learning.py#L121
 I wonder where is the corresponding source for that event obj (The relevant 
 class definition), so I can know what the event.attr stands for and how many 
 attrs the event has.

This is a PacketIn event handler, so the event object is a PacketIn.  You can 
either grep the codebase for class PacketIn, or you can look up the PacketIn 
event in the POX manual.  It's in a subsection called PacketIn under 
OpenFlow Events: Responding to Switches.

 Also, I'd like to know the relevant class for the connection object. 
 https://github.com/noxrepo/pox/blob/carp/pox/forwarding/l2_learning.py#L86

The connection object is from a class called Connection.  You can search the 
codebase for class Connection, or you can look it up in the manual.  It's in 
a subsection called Connection Objects.


For either or both of these, you could also use Python to find the answers for 
you.  For example, to find the class of the connection, object, insert the 
following near line 86 of l2_learning:
import inspect
print inspect.getsourcefile(type(connection)), 
inspect.getsourcelines(type(connection))[1]

Et voila, it'll print out the file and line number of the class.  Or simply 
insert help(connection) to get the whole pydoc for it.  Or save it to a 
global variable, run the POX py module, and then do help(global variable 
name) from the commandline.


Hope that helps.

-- Murphy

 Thanks and regards.
 -- 
 
 吾輩は猫である。ホームーページはhttp://introo.me。



Re: [pox-dev] Where is the corresponding source code for the following Object.

2014-04-16 Thread Shiyao Ma
Thanks and especially for the three methods.


Regards.


2014-04-17 4:50 GMT+08:00 Murphy McCauley murphy.mccau...@gmail.com:

 On Apr 16, 2014, at 3:27 AM, Shiyao Ma i...@introo.me wrote:

 Hi.

 I am following
 https://github.com/noxrepo/pox/blob/carp/pox/forwarding/l2_learning.py#L121
 I wonder where is the corresponding source for that event obj (The
 relevant class definition), so I can know what the event.attr stands for
 and how many attrs the event has.


 This is a PacketIn event handler, so the event object is a PacketIn.  You
 can either grep the codebase for class PacketIn, or you can look up the
 PacketIn event in the POX manual.  It's in a subsection called PacketIn
 under OpenFlow Events: Responding to Switches.

 Also, I'd like to know the relevant class for the connection object.
 https://github.com/noxrepo/pox/blob/carp/pox/forwarding/l2_learning.py#L86


 The connection object is from a class called Connection.  You can search
 the codebase for class Connection, or you can look it up in the manual.
  It's in a subsection called Connection Objects.


 For either or both of these, you could also use Python to find the answers
 for you.  For example, to find the class of the connection, object, insert
 the following near line 86 of l2_learning:
 import inspect
 print inspect.getsourcefile(type(connection)),
 inspect.getsourcelines(type(connection))[1]

 Et voila, it'll print out the file and line number of the class.  Or
 simply insert help(connection) to get the whole pydoc for it.  Or save it
 to a global variable, run the POX py module, and then do help(global
 variable name) from the commandline.


 Hope that helps.

 -- Murphy

 Thanks and regards.
 --

 吾輩は猫である。ホームーページはhttp://introo.me。





-- 

吾輩は猫である。ホームーページはhttp://introo.me。