Hi, On 2015年06月24日 04:46, Juan Pedro Muñoz Gea wrote: > Hi all, > > I have tried to get the datapath object from the dpid (integer) using > the following code: > > import ryu.app.ofctl.api as api > datapath = api.get_datapath(self, dpid) > > However, the following error appears: > AttributeError: 'Monitoring' object has no attribute 'name' > > How can I fix this point?
On my environment, api.get_datapath() works fine. Please see the following snippet. $ git diff diff --git a/ryu/app/simple_switch_13.py b/ryu/app/simple_switch_13.py index b9cbad0..2480dc3 100644 --- a/ryu/app/simple_switch_13.py +++ b/ryu/app/simple_switch_13.py @@ -21,6 +21,8 @@ from ryu.ofproto import ofproto_v1_3 from ryu.lib.packet import packet from ryu.lib.packet import ethernet +from ryu.app.ofctl import api + class SimpleSwitch13(app_manager.RyuApp): OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION] @@ -62,6 +64,10 @@ class SimpleSwitch13(app_manager.RyuApp): match=match, instructions=inst) datapath.send_msg(mod) + # Send event to get datapath + dp = api.get_datapath(self, datapath.id) + self.logger.info('datapath=%s', dp) + @set_ev_cls(ofp_event.EventOFPPacketIn, MAIN_DISPATCHER) def _packet_in_handler(self, ev): # If you hit this you might want to increase Thanks, Iwase > > Thanks, > - Juan Pedro > > ------------------------------------------------------------------------------ > Monitor 25 network devices or servers for free with OpManager! > OpManager is web-based network management software that monitors > network devices and physical & virtual servers, alerts via email & sms > for fault. Monitor 25 devices for free with no restriction. Download now > http://ad.doubleclick.net/ddm/clk/292181274;119417398;o > _______________________________________________ > Ryu-devel mailing list > Ryu-devel@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/ryu-devel > ------------------------------------------------------------------------------ Monitor 25 network devices or servers for free with OpManager! OpManager is web-based network management software that monitors network devices and physical & virtual servers, alerts via email & sms for fault. Monitor 25 devices for free with no restriction. Download now http://ad.doubleclick.net/ddm/clk/292181274;119417398;o _______________________________________________ Ryu-devel mailing list Ryu-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/ryu-devel