Hi mehran, What do you exactly mean "specify the switch"? What you want to do is to get all dpid connecting to the controller, and to install a flow into the specified switch, right?
Ryu provides APIs to get all Datapath instance connecting to Ryu. How about using this APIs? (http://ryu.readthedocs.org/en/latest/api_ref.html#ryu.controller.dpset.DPSet) Thanks, Iwase On 2015年04月11日 03:58, mehran shetabi wrote: > Hi Iwase, > Thanks for reply. In POX, there is a way to specify the switch, like this > code: > > def _handle_ConnectionUp (event): > global s0_dpid, s1_dpid, s2_dpid, s3_dpid > print "ConnectionUp: ", dpidToStr(event.connection.dpid) > #remember the connection dpid for switch > for m in event.connection.features.ports: > if m.name == "s0-eth1": > s0_dpid = event.connection.dpid > print "s0_dpid=", s0_dpid > elif m.name == "s1-eth1": > s1_dpid = event.connection.dpid > print "s1_dpid=", s1_dpid > elif m.name == "s2-eth1": > s2_dpid = event.connection.dpid > print "s2_dpid=", s2_dpid > > In Ryu, what is the code to specify a switch? > would you please write this code for me? > > Best Regards, > ................................................... > mehran shetabi > PhD student > Computer Engineering Department > IUST > > -----Original Message----- > From: Yusuke Iwase <[email protected]> > To: [email protected], [email protected] > Date: Fri, 10 Apr 2015 10:36:48 +0900 > Subject: Re: [Ryu-devel] Add flow entry to specific switch > > Hi mehran, > > Ryu provides you many way to do it. > > One is "Writing Your Ryu Application" while referring to the > Ryu-Documentation. > (http://ryu.readthedocs.org/en/latest/developing.html) > > Another easy one is to use ryu/app/ofctl_rest.py as follows. > > # Run ofctl_rest.py > $ sudo ryu-manager ryu.app.ofctl_rest > > # e.g.) Add a flow entry > $ curl -X POST -d '{ > "dpid": 1, > "cookie": 1, > "cookie_mask": 1, > "table_id": 0, > "idle_timeout": 30, > "hard_timeout": 30, > "priority": 11111, > "flags": 1, > "match":{ > "in_port":1 > }, > "actions":[ > { > "type":"OUTPUT", > "port": 2 > } > ] > }' http://localhost:8080/stats/flowentry/add > > For more information of ofctl_rest.py, Please refer to the following page. > (http://ryu.readthedocs.org/en/latest/app/ofctl_rest.html ) > > > Thanks, > Iwase > > On 2015年04月10日 02:33, mehran shetabi wrote: > > Hi, > > I want to add flow entry to specific switch in my network topology that > implemented with Mininet. Would you please tell me that how can I specify the > exact switch in Ryu controller? > > Best regards > > > > ................................................... > > mehran shetabi > > PhD student > > Computer Engineering Department > > IUST > > > > > > > ------------------------------------------------------------------------------ > > BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT > > Develop your own process in accordance with the BPMN 2 standard > > Learn Process modeling best practices with Bonita BPM through live > exercises > > http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- > event?utm_ > > source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF > > > > > > > > _______________________________________________ > > Ryu-devel mailing list > > [email protected] > > https://lists.sourceforge.net/lists/listinfo/ryu-devel > > > > > > > ------------------------------------------------------------------------------ > BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT > Develop your own process in accordance with the BPMN 2 standard > Learn Process modeling best practices with Bonita BPM through live exercises > http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ > source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF > > > > _______________________________________________ > Ryu-devel mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/ryu-devel > ------------------------------------------------------------------------------ BPM Camp - Free Virtual Workshop May 6th at 10am PDT/1PM EDT Develop your own process in accordance with the BPMN 2 standard Learn Process modeling best practices with Bonita BPM through live exercises http://www.bonitasoft.com/be-part-of-it/events/bpm-camp-virtual- event?utm_ source=Sourceforge_BPM_Camp_5_6_15&utm_medium=email&utm_campaign=VA_SF _______________________________________________ Ryu-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/ryu-devel
