Re: [nox-dev] how to use discovery component?
Hi there, in order use Link_events in your python component you need to: 1) make your component aware of the Link_event object by importing it 2) register a handler for the event in your component's configure() (to make your component respond to such events) 3) write a handler (to tell your component how it should respond to such events) so, in practice: # 1 from nox.netapps.discovery.pylinkevent import Link_event ... # 2 def install(self): ... self.register_handler(Link_event.static_get_name(), self.handle_link_event) # 3 def handle_link_event(self, e): print "Received link event:", e.__dict__# this will show you the contents of the event (for example: 'dport': 2, 'dpsrc': 1L, 'dpdst': 2L, 'sport': 2, 'action': 'add') # do something about the event here On Tue, Oct 11, 2011 at 3:17 AM, hzy wrote: > Hi murphy: > > yes, the results are the same. > the NOX I am using is download from > http://www.openflow.org/wk/index.php/OpenFlow_Tutorial. > Never mind, the thing I concern is that how can i deal with the link_event > in my component. > I think I should look some codes, like core.py or something else, I just > don't know how to start. > Can you give me some advice? > best regards > > hzy > > > 2011/10/11 Murphy McCauley > >> I don't know anything about pytutorial (it's not one of the mainlin NOX >> components), so I don't really know what to make of that. >> >> You tried implementing getInterface() like below on your my_router class? >> def getInterface (self): >> return str(my_router) >> >> And the results were the same? >> >> This is unrelated, but you also seem to be using a version of NOX that's >> over a year old. The destiny branch in particular has many bug fixes. >> >> -- Murphy >> >> On Oct 10, 2011, at 7:40 PM, hzy wrote: >> >> Hi murphy: >> >> Thank you for your reply, but I have added these codes in my component. >> This time I tried to invoke component pytutorial, so that you can get more >> information in your computer. >> >> So I add following codes in discovery component. >> self._pytutorial = >> self.resolve("nox.coreapps.tutorial.pytutorial.pyturorial") >> print self._pytutorial.mac_to_port >> >> 00478|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 166, in >> discovery.lldp_input_handler(self,dp,inport,reason,len,bid,packet), >> File "./nox/netapps/discovery/discovery.py", line 316, in >> lldp_input_handler >> print self._pytutorial.mac_to_port >> AttributeError: 'NoneType' object has no attribute 'mac_to_port' >> >> I was confused. >> >> In other hand, I accept your advise to handle discovery's Link_even. Since >> I am a newbie, can you give me some advice how to deal with Link_event in my >> component? >> >> Best regards. >> >> hzy >> >> 2011/10/10 Murphy McCauley >> >>> Whoops. I meant: >>> >>> def getInterface (self): >>> return str(my_router) >>> >>> Sorry about that! >>> >>> -- Murphy >>> >>> >>> On Oct 10, 2011, at 7:51 AM, Murphy McCauley wrote: >>> >>> So first off, maybe you have a reason, but in general, the hope is that >>> you should have no reason to modify discovery.py. Rather than modify >>> discovery.py to explicitly call your component, hopefully you should be able >>> to simply handle discovery's Link_event. >>> >>> If you really do need to modify discovery.py to call your component >>> explicitly, then as for why your code doesn't work, I don't think I have >>> enough information to say. Assuming that your paths are right (you have a >>> directory/package called my_experiment) and that in my_router.py you have a >>> class/component called my_router... my best guess is that you didn't >>> implement getInterface() in my_router in the expected way. Try adding the >>> following to your my_router class: >>> >>> def getInterface (self): >>> return my_router >>> >>> Hope that helps. >>> >>> -- Murphy >>> >>> On Oct 10, 2011, at 6:45 AM, hzy wrote: >>> >>> 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 >>> discovery.lldp_input_handler(self,dp,inport,
Re: [nox-dev] how to use discovery component?
Hi murphy: yes, the results are the same. the NOX I am using is download from http://www.openflow.org/wk/index.php/OpenFlow_Tutorial. Never mind, the thing I concern is that how can i deal with the link_event in my component. I think I should look some codes, like core.py or something else, I just don't know how to start. Can you give me some advice? best regards hzy 2011/10/11 Murphy McCauley > I don't know anything about pytutorial (it's not one of the mainlin NOX > components), so I don't really know what to make of that. > > You tried implementing getInterface() like below on your my_router class? > def getInterface (self): > return str(my_router) > > And the results were the same? > > This is unrelated, but you also seem to be using a version of NOX that's > over a year old. The destiny branch in particular has many bug fixes. > > -- Murphy > > On Oct 10, 2011, at 7:40 PM, hzy wrote: > > Hi murphy: > > Thank you for your reply, but I have added these codes in my component. > This time I tried to invoke component pytutorial, so that you can get more > information in your computer. > > So I add following codes in discovery component. > self._pytutorial = > self.resolve("nox.coreapps.tutorial.pytutorial.pyturorial") > print self._pytutorial.mac_to_port > > 00478|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 166, in > discovery.lldp_input_handler(self,dp,inport,reason,len,bid,packet), > File "./nox/netapps/discovery/discovery.py", line 316, in > lldp_input_handler > print self._pytutorial.mac_to_port > AttributeError: 'NoneType' object has no attribute 'mac_to_port' > > I was confused. > > In other hand, I accept your advise to handle discovery's Link_even. Since > I am a newbie, can you give me some advice how to deal with Link_event in my > component? > > Best regards. > > hzy > > 2011/10/10 Murphy McCauley > >> Whoops. I meant: >> >> def getInterface (self): >> return str(my_router) >> >> Sorry about that! >> >> -- Murphy >> >> >> On Oct 10, 2011, at 7:51 AM, Murphy McCauley wrote: >> >> So first off, maybe you have a reason, but in general, the hope is that >> you should have no reason to modify discovery.py. Rather than modify >> discovery.py to explicitly call your component, hopefully you should be able >> to simply handle discovery's Link_event. >> >> If you really do need to modify discovery.py to call your component >> explicitly, then as for why your code doesn't work, I don't think I have >> enough information to say. Assuming that your paths are right (you have a >> directory/package called my_experiment) and that in my_router.py you have a >> class/component called my_router... my best guess is that you didn't >> implement getInterface() in my_router in the expected way. Try adding the >> following to your my_router class: >> >> def getInterface (self): >> return my_router >> >> Hope that helps. >> >> -- Murphy >> >> On Oct 10, 2011, at 6:45 AM, hzy wrote: >> >> 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 >> 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 >> >>> 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 m
Re: [nox-dev] how to use discovery component?
I don't know anything about pytutorial (it's not one of the mainlin NOX components), so I don't really know what to make of that. You tried implementing getInterface() like below on your my_router class? def getInterface (self): return str(my_router) And the results were the same? This is unrelated, but you also seem to be using a version of NOX that's over a year old. The destiny branch in particular has many bug fixes. -- Murphy On Oct 10, 2011, at 7:40 PM, hzy wrote: > Hi murphy: > > Thank you for your reply, but I have added these codes in my component. > This time I tried to invoke component pytutorial, so that you can get more > information in your computer. > > So I add following codes in discovery component. > self._pytutorial = self.resolve("nox.coreapps.tutorial.pytutorial.pyturorial") > print self._pytutorial.mac_to_port > > 00478|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 166, in > discovery.lldp_input_handler(self,dp,inport,reason,len,bid,packet), > File "./nox/netapps/discovery/discovery.py", line 316, in lldp_input_handler > print self._pytutorial.mac_to_port > AttributeError: 'NoneType' object has no attribute 'mac_to_port' > > I was confused. > > In other hand, I accept your advise to handle discovery's Link_even. Since I > am a newbie, can you give me some advice how to deal with Link_event in my > component? > > Best regards. > > hzy > > 2011/10/10 Murphy McCauley > Whoops. I meant: > > def getInterface (self): > return str(my_router) > > Sorry about that! > > -- Murphy > > > On Oct 10, 2011, at 7:51 AM, Murphy McCauley wrote: > >> So first off, maybe you have a reason, but in general, the hope is that you >> should have no reason to modify discovery.py. Rather than modify >> discovery.py to explicitly call your component, hopefully you should be able >> to simply handle discovery's Link_event. >> >> If you really do need to modify discovery.py to call your component >> explicitly, then as for why your code doesn't work, I don't think I have >> enough information to say. Assuming that your paths are right (you have a >> directory/package called my_experiment) and that in my_router.py you have a >> class/component called my_router... my best guess is that you didn't >> implement getInterface() in my_router in the expected way. Try adding the >> following to your my_router class: >> >> def getInterface (self): >> return my_router >> >> Hope that helps. >> >> -- Murphy >> >> On Oct 10, 2011, at 6:45 AM, hzy wrote: >> >>> 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 >>> 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 >>> 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 >>>
Re: [nox-dev] how to use discovery component?
Hi murphy: Thank you for your reply, but I have added these codes in my component. This time I tried to invoke component pytutorial, so that you can get more information in your computer. So I add following codes in discovery component. self._pytutorial = self.resolve("nox.coreapps.tutorial.pytutorial.pyturorial") print self._pytutorial.mac_to_port 00478|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 166, in discovery.lldp_input_handler(self,dp,inport,reason,len,bid,packet), File "./nox/netapps/discovery/discovery.py", line 316, in lldp_input_handler print self._pytutorial.mac_to_port AttributeError: 'NoneType' object has no attribute 'mac_to_port' I was confused. In other hand, I accept your advise to handle discovery's Link_even. Since I am a newbie, can you give me some advice how to deal with Link_event in my component? Best regards. hzy 2011/10/10 Murphy McCauley > Whoops. I meant: > > def getInterface (self): > return str(my_router) > > Sorry about that! > > -- Murphy > > > On Oct 10, 2011, at 7:51 AM, Murphy McCauley wrote: > > So first off, maybe you have a reason, but in general, the hope is that you > should have no reason to modify discovery.py. Rather than modify > discovery.py to explicitly call your component, hopefully you should be able > to simply handle discovery's Link_event. > > If you really do need to modify discovery.py to call your component > explicitly, then as for why your code doesn't work, I don't think I have > enough information to say. Assuming that your paths are right (you have a > directory/package called my_experiment) and that in my_router.py you have a > class/component called my_router... my best guess is that you didn't > implement getInterface() in my_router in the expected way. Try adding the > following to your my_router class: > > def getInterface (self): > return my_router > > Hope that helps. > > -- Murphy > > On Oct 10, 2011, at 6:45 AM, hzy wrote: > > 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 > 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 > >> 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
Re: [nox-dev] how to use discovery component?
Whoops. I meant: def getInterface (self): return str(my_router) Sorry about that! -- Murphy On Oct 10, 2011, at 7:51 AM, Murphy McCauley wrote: > So first off, maybe you have a reason, but in general, the hope is that you > should have no reason to modify discovery.py. Rather than modify > discovery.py to explicitly call your component, hopefully you should be able > to simply handle discovery's Link_event. > > If you really do need to modify discovery.py to call your component > explicitly, then as for why your code doesn't work, I don't think I have > enough information to say. Assuming that your paths are right (you have a > directory/package called my_experiment) and that in my_router.py you have a > class/component called my_router... my best guess is that you didn't > implement getInterface() in my_router in the expected way. Try adding the > following to your my_router class: > > def getInterface (self): > return my_router > > Hope that helps. > > -- Murphy > > On Oct 10, 2011, at 6:45 AM, hzy wrote: > >> 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 >> 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 >> 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
Re: [nox-dev] how to use discovery component?
So first off, maybe you have a reason, but in general, the hope is that you should have no reason to modify discovery.py. Rather than modify discovery.py to explicitly call your component, hopefully you should be able to simply handle discovery's Link_event. If you really do need to modify discovery.py to call your component explicitly, then as for why your code doesn't work, I don't think I have enough information to say. Assuming that your paths are right (you have a directory/package called my_experiment) and that in my_router.py you have a class/component called my_router... my best guess is that you didn't implement getInterface() in my_router in the expected way. Try adding the following to your my_router class: def getInterface (self): return my_router Hope that helps. -- Murphy On Oct 10, 2011, at 6:45 AM, hzy wrote: > 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 > 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 > 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
Re: [nox-dev] how to use discovery component?
addition imformation: meta.xml http://www.noxrepo.org/components.xsd";> my_router python discovery nox.coreapps.my_experiment.my_router 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 > 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 > 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 > >> 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
Re: [nox-dev] how to use discovery component?
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 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 > 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