Waqas, You need to return CONTINUE at your handlers. This will allow the packet_in events to go throughout different modules within nox. Again, spacing doesn't look good, but it might be copy-paste that causes this. Maybe going through the nox-manual will be helpful. It's a bit out-of-date but will give you a good idea about how nox events and modules work...
http://noxrepo.org/manual/index.html Thanks, Yianis On Fri, Jul 30, 2010 at 10:07 AM, Waqas Daar <waqasd...@gmail.com> wrote: > Sorry it was mistype Now I am attaching the nox output when my component is > loaded. > > See below > > # ./nox_core -i ptcp:7788 -v pyrouting pywaqas > 00001|nox|INFO:Starting nox_core (/home/nox/src/.libs/lt-nox_core) > 00002|pyrt|DBG:Loading a component description file > 'nox/coreapps/simple_c_py_app/meta.xml'. > 00003|pyrt|DBG:Loading a component description file > 'nox/coreapps/switch/meta.xml'. > 00004|pyrt|DBG:Loading a component description file > 'nox/coreapps/testharness/meta.xml'. > 00005|pyrt|DBG:Loading a component description file > 'nox/coreapps/simple_c_app/meta.xml'. > 00006|pyrt|DBG:Loading a component description file > 'nox/coreapps/pyrt/meta.xml'. > 00007|pyrt|DBG:Loading a component description file > 'nox/coreapps/hub/meta.xml'. > 00008|pyrt|DBG:Loading a component description file > 'nox/coreapps/coretests/meta.xml'. > 00009|pyrt|DBG:Loading a component description file > 'nox/coreapps/examples/meta.xml'. > 00010|pyrt|DBG:Loading a component description file > 'nox/coreapps/examples/t/meta.xml'. > 00011|pyrt|DBG:Loading a component description file > 'nox/netapps/discovery/meta.xml'. > 00012|pyrt|DBG:Loading a component description file > 'nox/netapps/switchstats/meta.xml'. > 00013|pyrt|DBG:Loading a component description file > 'nox/netapps/topology/meta.xml'. > 00014|pyrt|DBG:Loading a component description file > 'nox/netapps/tests/meta.xml'. > 00015|pyrt|DBG:Loading a component description file > 'nox/netapps/data/meta.xml'. > 00016|pyrt|DBG:Loading a component description file > 'nox/netapps/storage/meta.xml'. > 00017|pyrt|DBG:Loading a component description file > 'nox/netapps/storage/t/meta.xml'. > 00018|pyrt|DBG:Loading a component description file > 'nox/netapps/switch_management/meta.xml'. > 00019|pyrt|DBG:Loading a component description file > 'nox/netapps/flow_fetcher/meta.xml'. > 00020|pyrt|DBG:Loading a component description file > 'nox/netapps/routing/meta.xml'. > 00021|pyrt|DBG:Loading a component description file > 'nox/netapps/bindings_storage/meta.xml'. > 00022|pyrt|DBG:Loading a component description file > 'nox/netapps/bindings_storage/t/meta.xml'. > 00023|pyrt|DBG:Loading a component description file > 'nox/netapps/authenticator/meta.xml'. > 00024|pyrt|DBG:Loading a component description file > 'nox/netapps/user_event_log/meta.xml'. > 00025|pyrt|DBG:Loading a component description file > 'nox/webapps/webserver/meta.xml'. > 00026|pyrt|DBG:Loading a component description file > 'nox/webapps/webservice/meta.xml'. > 00027|pyrt|DBG:Loading a component description file > 'nox/webapps/miscws/meta.xml'. > 00028|dht-storage|DBG:Creating a table: bindings_host > 00029|dht-storage|DBG:Creating a table: bindings_user > 00030|dht-storage|DBG:Creating a table: bindings_dladdr > 00031|dht-storage|DBG:Creating a table: bindings_link > 00032|dht-storage|DBG:Creating a table: bindings_location > 00033|pycomponent|DBG:Importing Python module > nox.netapps.bindings_storage.pybindings_storage > 00034|dht-storage|DBG:Creating a table: user_event_log > 00035|dht-storage|DBG:Creating a table: user_event_log_names > 00036|pycomponent|DBG:Importing Python module > nox.netapps.data.datatypes_impl > 00037|pycomponent|DBG:Importing Python module > nox.netapps.data.datacache_impl > 00038|pycomponent|DBG:Importing Python module > nox.netapps.user_event_log.pyuser_event_log > 00039|pycomponent|DBG:Importing Python module > nox.netapps.discovery.discovery > 00040|pycomponent|DBG:Importing Python module nox.netapps.routing.pyrouting > 00041|pycomponent|DBG:Importing Python module nox.coreapps.examples.pywaqas > 2010-07-30 16:58:07+0000 [-] Log opened. > 00042|nox|DBG:Application installation report: > 00043|nox|DBG:storage-common: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: > > 00044|nox|DBG:link event: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: > > 00045|nox|DBG:data_cache: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'datatypes' OK > > 00046|nox|DBG:python: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: > > 00047|nox|DBG:pydatatypes: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'datatypes' OK, 'python' OK > > 00048|nox|DBG:pyrouting: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'routing_module' OK, 'python' OK > > 00049|nox|DBG:discovery: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'link event' OK, 'pybindings_storage' OK, > 'pyuser_event_log' OK, 'python' OK > > 00050|nox|DBG:bindings_storage: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'storage-backend' OK, 'datatypes' OK, 'data_cache' OK > > 00051|nox|DBG:topology: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'discovery' OK > > 00052|nox|DBG:storage-backend: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'storage-common' OK > > 00053|nox|DBG:pyuser_event_log: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'user_event_log' OK, 'pydatatypes' OK, 'pydatacache' > OK, 'python' OK > > 00054|nox|DBG:pywaqas: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'python' OK, 'python' OK > > 00055|nox|DBG:built-in DSO deployer: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: > > 00056|nox|DBG:nat_enforcer: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'flow_util' OK > > 00057|nox|DBG:pydatacache: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'data_cache' OK, 'python' OK > > 00058|nox|DBG:datatypes: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: > > 00059|nox|DBG:built-in event dispatcher: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: > > 00060|nox|DBG:flow_util: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'datatypes' OK > > 00061|nox|DBG:routing_module: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'topology' OK, 'nat_enforcer' OK > > 00062|nox|DBG:pybindings_storage: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'bindings_storage' OK, 'python' OK > > 00063|nox|DBG:user_event_log: > Current state: INSTALLED > Required state: INSTALLED > Dependencies: 'storage-backend' OK, 'bindings_storage' OK, > 'datatypes' OK > > 00064|openflow|DBG:Passive tcp interface bound to port 7788 > 00094|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00095|discovery|WARN:new link detected (00:00:00:23:20:f1:7c:e9 p:0 -> > 00:00:00:55:46:88:43:04 p:0) > 00096|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00097|discovery|WARN:new link detected (00:00:00:55:46:88:43:04 p:0 -> > 00:00:00:23:20:f1:7c:e9 p:0) > 00098|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00099|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00100|openflow-event|DBG:received packet-in event from 005546884304 > (len:90) > 00101|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:90) > 00102|openflow-event|DBG:received packet-in event from 005546884304 > (len:52) > 00103|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:52) > 00104|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00105|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:90) > 00106|openflow-event|DBG:received packet-in event from 005546884304 > (len:90) > 00107|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00108|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00109|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00110|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00111|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00112|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00113|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00114|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00115|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00116|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00117|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00118|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00119|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:52) > 00120|openflow-event|DBG:received packet-in event from 005546884304 > (len:52) > 00121|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00122|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00123|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00124|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00125|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00126|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00127|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00128|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00129|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00130|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00131|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00132|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00133|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > 00134|openflow-event|DBG:received packet-in event from 005546884304 > (len:52) > 00135|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:52) > 00136|openflow-event|DBG:received packet-in event from 002320f17ce9 > (len:34) > 00137|openflow-event|DBG:received packet-in event from 005546884304 > (len:34) > > > And the code of my component is as follows > > from nox.lib import core > from nox.lib.core import * > from nox.lib.core import Component > from nox.netapps.authenticator.pyflowutil import Flow_in_event > > from nox.netapps.routing import pyrouting > > from twisted.python import log > > import sys > import code > > class Pywaqas(Component): > > def __init__(self, ctxt): > Component.__init__(self, ctxt) > self.routing = None > log.startLogging(sys.stdout) > > def install(self): > > self.routing = self.resolve(pyrouting.PyRouting) > > match_src = { core.DL_TYPE: ethernet.ethernet.IP_TYPE, > core.NW_PROTO : ipv4.ipv4.TCP_PROTOCOL, core.TP_DST : 22 } > > self.register_for_packet_match(self.handle_tcppacket, > 0xffff, match_src) > self.register_for_datapath_join ( lambda dp,stats : > Pywaqas.dp_join(self, dp, stats) ) > self.register_for_datapath_leave( lambda dp : > Pywaqas.dp_leave(self, dp) ) > self.register_for_port_status( lambda dp, reason, port : > Pywaqas.port_status_change(self, dp, reason, port) ) > > self.register_handler(Flow_in_event.static_get_name(), > self.handle_flow_in) > > def handle_tcppacket(self, dpid, inport, ofp_reason, > total_frame_len, buffer_id, packet): > log.msg(str((dpid, inport, ofp_reason, total_frame_len, > buffer_id, packet))) > > def handle_flow_in ( self, event): > log.msg("Flow_in recieved\n") > route = pyrouting.Route() > if self.routing.get_route(route): > checked=True > * log.msg("Getting Routes %s" % str(route))* > else: > log.err("No Route between %s and %s." % > (hex(route.id.src.as_host()),hex(route.id.dst.as_host()))) > > def dp_join(self, dp, stats): > for k,v in stats.items(): > if k== "ports": continue > log.msg("dp '%s' join: %s = %s > "%(str(dp),str(k),str(v))) > if stats.has_key("ports"): > ports = stats["ports"] > for port_data in ports: > hw_addr = port_data["hw_addr"] > name = port_data["name"] > port_id = "%s %s"%(name,str([hw_addr])) > for kk,vv in port_data.items(): > if kk in ("hw_addr","name") > :continue > log.msg("port %s: %s = > %s"%(port_id,str(kk),str(vv))) > > def dp_leave(self, up): > log.msg(str( up)) > def port_status_change(self, dp, reason, port): > log.msg("dp %s => The status of the port '%s' changed: > reason=%s"%(str(dp),str(port),str(reason))) > > def getInterface(self): > return str(Pywaqas) > > > def getFactory(): > class Factory: > def instance(self, ctxt): > return Pywaqas(ctxt) > > return Factory() > > I am just trying to do simple thing just want to print the routes. Hope > this will help you to understand my problem? > > > Best Regards, > > Waqas Daar > > > > On Fri, Jul 30, 2010 at 6:53 PM, Yiannis Yiakoumis > <gyiakou...@gmail.com>wrote: > >> Waqas, >> >> If spacing is correct in what you pasted, handle_flow_in belongs to >> another component named Pywaqas. But the routing that you install belongs >> to the pyflushroutes. >> Can you try making the handle_flow_in a pyflushroute function and then >> register it similarly to samplerouting? >> >> Thanks, >> Yiannis >> >> On Fri, Jul 30, 2010 at 9:28 AM, Waqas Daar <waqasd...@gmail.com> wrote: >> >>> Dear KK, >>> >>> Thanks for your prompt reply. But I did not get it what you are trying to >>> say :S. where I am doing wrong ? >>> >>> Yes, In future I will not do cross posts. >>> Thanks in Advanced. >>> >>> Best Regards, >>> >>> Waqas Daar >>> >>> >>> >>> On Fri, Jul 30, 2010 at 6:22 PM, kk yap <yap...@stanford.edu> wrote: >>> >>>> Looking at samplerouting.py as example, >>>> >>>> def install(self): >>>> self.routing = self.resolve(pyrouting.PyRouting) >>>> self.register_handler(Flow_in_event.static_get_name(), >>>> self.handle_flow_in) >>>> >>>> which make this looks peculiar. >>>> >>>> def install(self): >>>> >>>> self.routing = self.resolve(pyrouting.PyRouting) >>>> self.register_handler(Flow_in_event.static_get_name(), >>>> Pywaqas.handle_flow_in) >>>> >>>> Regards >>>> KK >>>> >>>> PS>> Please don't cross post within an hour of non-response. Many >>>> people are subscribed to both lists. >>>> On 30 July 2010 09:07, Waqas Daar <waqasd...@gmail.com> wrote: >>>> > Hello all, >>>> > I am trying to create a NOX component called 'pyflushroutes.py' in >>>> python, >>>> > which get the routes from the openflow switche on the network and >>>> flush it >>>> > to all the openflow switches in the network. The first thing I am >>>> trying to >>>> > do is to just use the function 'get_routes()' and print that routes in >>>> the >>>> > handler function flow_in. According to that routing module listens for >>>> > flow_in_events and perform the routing. I have registered the function >>>> > Flow_in_event and write a simpel handler function for that event, >>>> > Below is the excerpts of the component. >>>> > class pyflushroutes(Component): >>>> > def __init__(self, ctxt): >>>> > Component.__init__(self, ctxt) >>>> > self.routing = None >>>> > log.startLogging(sys.stdout) >>>> > def install(self): >>>> > self.routing = self.resolve(pyrouting.PyRouting) >>>> > self.register_handler(Flow_in_event.static_get_name(), >>>> > Pywaqas.handle_flow_in) >>>> > def handle_flow_in ( self, event): >>>> > log.msg("Flow_in recieved\n") >>>> > route = pyrouting.Route() >>>> > if self.routing.get_route(route): >>>> > checked=True >>>> > log.msg(str(route)) >>>> > else: >>>> > log.err("No Route between %s and %s." % >>>> > (hex(route.id.src.as_host()),hex(route.id.dst.as_host()))) >>>> > >>>> > But it did not print any thing even the Flow in recieved message. :( >>>> > Any idea where I am doing wrong ? >>>> > >>>> > >>>> > Best Regards, >>>> > >>>> > Waqas Daar >>>> > >>>> > _______________________________________________ >>>> > openflow-discuss mailing list >>>> > openflow-disc...@lists.stanford.edu >>>> > https://mailman.stanford.edu/mailman/listinfo/openflow-discuss >>>> > >>>> > >>>> >>> >>> >>> _______________________________________________ >>> nox-dev mailing list >>> nox-dev@noxrepo.org >>> http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org >>> >>> >> >> >> -- >> Yiannis . >> > > -- Yiannis .
_______________________________________________ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org