addition imformation: meta.xml <?xml version="1.0" encoding="UTF-8"?> <components:components xmlns:components=" http://www.noxrepo.org/components.xsd"> <component> <name>my_router</name> <dependency> <name>python</name> </dependency> <dependency> <name>discovery</name> </dependency> <python>nox.coreapps.my_experiment.my_router</python> </component> </components:components>
Makefile.am include ../../../Make.vars EXTRA_DIST =\ meta.xml \ __init__.py \ my_router.py NOX_RUNTIMEFILES = meta.xml \ __init__.py \ my_router.py all-local: nox-all-local clean-local: nox-clean-local install-exec-hook: nox-install-local 2011/10/10 hzy <yyjianx...@gmail.com> > hi murpy: > Thank you for your reply. it works now, but another problem comes up. > This time I want the discovery component invoke the dic_all_path defined in > my modle. > > So I add following codes in discovery component > self._my_router = > self.resolve("nox.coreapps.my_experiment.my_router.my_router") > print self._my_router.dic_all_path > > I also tried these codes > from nox.coreapps.my_experiment import my_router > self._my_router = self.resolve(my_router.my_router > print self._my_router.dic_all_path > > 00206|pyrt|ERR:unable to invoke a Python event handler: > Traceback (most recent call last): > File "./nox/lib/util.py", line 116, in f > event.total_len, buffer_id, packet) > File "./nox/netapps/discovery/discovery.py", line 163, in <lambda> > discovery.lldp_input_handler(self,dp,inport,reason,len,bid,packet), > File "./nox/netapps/discovery/discovery.py", line 312, in > lldp_input_handler > print self._my_router.dic_all_path > AttributeError: 'NoneType' object has no attribute 'dic_all_path' > > any ideas. > best regards. > > hzy > > > > 2011/10/9 Murphy McCauley <jam...@nau.edu> > >> So, the discovery component is a class named "discovery" in a module named >> "discovery" in a package named "discovery". So it's... >> discovery.discovery.discovery. You've only got discovery.discovery. I can >> see how it's a bit confusing. :) >> >> So try the following instead: >> self._discovery = self.resolve(discovery.discovery) >> >> Or alternatively, do: >> self._discovery = >> self.resolve("nox.netapps.discovery.discovery.discovery") >> (In this case, you don't even need the import statement) >> >> -- Murphy >> >> On Oct 9, 2011, at 1:21 AM, hzy wrote: >> >> > hi all: >> > >> > Inorder to find interconnected links in my topology, i would like to use >> discovery.py. >> > In my own component I want to check the adjacency_list which is a public >> attribute in discovery module. >> > How can I use discovery from my component. >> > >> > I add the following codes, but it doesn't work. >> > >> > from nox.netapps.discovery import discovery >> > self._discovery = self.resolve(discovery) >> > print self._discovery.adjacency_list >> > >> > File "./nox/coreapps/my_experiment/my_router.py", line 499, in >> datapath_join_callback >> > print self._discovery.adjacency_list >> > AttributeError: 'NoneType' object has no attribute 'adjacency_list' >> > >> > any ideas? >> > thanks for advance. >> > best regards >> > >> > hzy >> > _______________________________________________ >> > nox-dev mailing list >> > nox-dev@noxrepo.org >> > http://noxrepo.org/mailman/listinfo/nox-dev >> >> >
_______________________________________________ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev