Hello Iwase,
Thank you for your answer. I am extremely sorry that I asked you a different 
question from the subject. As my mail bounced from the mailing list two times, 
by mistake I copy pasted different question. My actual question was actually 
about the mechanism ryu used to detect link failure/ add event. I used LinkAdd 
and LinkDelete handler in my application as follows-
@set_ev_cls(EventLinkAdd, MAIN_DISPATCHER)
    def _link_add_handler(self, ev):
@set_ev_cls(EventLinkDelete, MAIN_DISPATCHER)
    def _link_del_handler(self, ev)
Now I want to evaluate the performance of this handlers in different link 
condition(how much time requires to detect the event). Before that I need to 
know actually how this handlers detect this events and how fast the controller 
knows about this events after this events actually happened. 

But unfortunately I was not able to find it. Can you please tell me how this 
event are discovered by the decorator function? 

Thanking youSakib 


     On Tuesday, 26 May 2015, 7:46, Yusuke Iwase <[email protected]> 
wrote:
   
 

 Hi Sakib,

On 2015年05月26日 02:28, MD.Badruzzaman Shakib wrote:
> Hello everyone,
> 
> I want to get the port information from the link_add event. I couldn't find 
> any getter function for port number.
> for the code below-
> 
> @set_ev_cls(EventLinkAdd, MAIN_DISPATCHER)
> def _link_add_handler(self, ev):
>        link = ev.link
>        #print "type of links:", type(link)
>        print link
> 
> it prints-      
> Link: Port<dpid=4, port_no=5, LIVE> to Port<dpid=6, port_no=3, LIVE>
> 
> So now I am getting the source port_no by using
>        src_port = int(str(link)[27:28])

You can get the port number from EventLinkAdd/EventLinkDelete as follow.

    @set_ev_cls(EventLinkAdd, MAIN_DISPATCHER)
    def _link_add_handler(self, ev):
            link = ev.link
            self.logger.info('link.src.port_no = %d', link.src.port_no)
            # e.g.)
            # link.src.port_no = 2

FYI,
'ev.link' is an instance of 'class Link' in ryu/topology/switches.py.
 <https://github.com/osrg/ryu/blob/master/ryu/topology/switches.py#L135>
And 'ev.link.src/dst' is an instance of 'class Port'.
 <https://github.com/osrg/ryu/blob/master/ryu/topology/switches.py#L57>

Thanks,
Iwase

> 
> But I am interested to know is there any standard method to get the port 
> number from the link_add/ link_delete event?
> 
> Thanking you
> Sakib
> 

------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel


 
  
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud 
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to