[nox-dev] Create Router_ARP dealing problem

2011-07-11 Thread hzy
I am doing excercise “Create Router” on web 
http://www.openflow.org/wk/index.php/OpenFlow_Tutorial#Create_Router
I am running into trouble, when I am dealing with ARP.
When the controller receives a arp request, it first check the arp table to 
get destinate MAC address. If the check is succeed, the controller contructs a 
arp reply back to the host sending the arp request. If not, the  controller 
should flood the arp request.(If this process is not correct, please tell me.)
 
My question is that, when I flood the arp request, I need to change the source 
MAC address to the switch's(the switch receiving the arp request). How can I 
get the MAC address of switch?
(is there a parameter? something like "dpid" mark the switch id.)
 
Thanks
-hzy


___
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev


Re: [nox-dev] send_stat_req

2011-07-11 Thread Min-Hyup KANG



	
	
Thanks for your kindness."You only need to include an item in nox.json if you care about the order in which it is dispatched to components."->  sorry but can you explain more easily ?I am also trying to get aggregate reply. so I re-write networkstate/linkload.cc as belowI know I have to register_event and post event. but I don't know how to use post event exactly.so, please give me some tips ?Thanks,#include " include/aggregate-stats-in.hh".void linkload::configureu(const Configuration* c) {                    ..register_event(Aggregate_stats_in_event::static_get_name());  }..void linkload::send_stat_req(const datapathid& dpid, uint16_t port)  {    size_t size = sizeof(ofp_stats_request)+sizeof(ofp_aggregate_stats_request);    of_raw.reset(new uint8_t[size]);    of_stats_request osr(openflow_pack::header(OFPT_STATS_REQUEST, size),                         OFPST_AGRREGATE, 0);      of_aggregate_stats_request oasr;   oasr.match.wildcards = 0x;   oasr.table_id = 0xff;   oasr.out_port = OFPP_NONE;    osr.pack((ofp_stats_request*) openflow_pack::get_pointer(of_raw));    oasr.pack((ofp_aggregate_stats_request*) openflow_pack::get_pointer(of_raw, sizeof(ofp_stats_request)));    send_openflow_command(dpi->second.datapath_id, of_raw, false);/*post event     I don't know exactly how to use post exactly*/    size_t rsize = sizeof(ofp_stats_reply)+sizeof(ofp_aggregate_stats_reply);    of_raw.reset(new uint8_t[rsize]);    of_stats_reply srep(openflow_pack::header(OFPT_STATS_REPLY, rsize), OFPST_AGGREGATE, 0x0001);    post(new Aggregate_stats_in_event(dpi->second.datapath_id, srep,. ));- ¿øº» ¸ÞÀÏ -º¸³½»ç¶÷: Murphy McCauley ¹Þ´Â»ç¶÷ : Min-Hyup KANG ÂüÁ¶ : "NOX-dev" ³¯Â¥: 2011³â 7¿ù 11ÀÏ ¿ù¿äÀÏ, 11½Ã 04ºÐ 12ÃÊ +0900Á¦¸ñ: Re: [nox-dev] send_stat_req

	Glad to hear you got it working.As for aggregate stats replies, use Aggregate_stats_in_event.  This is in the file include/aggregate-stats-in.hh with the rest of the events.As you notice, it isn't in nox.json, but that is okay.  You only need to include an item in nox.json if you care about the order in which it is dispatched to components.-- MurphyOn Jul 10, 2011, at 6:10 PM, Min-Hyup KANG wrote:Hi,Thank you for your response.yes, What I add the code to the end of send_stats_req() "of_ports psrep"  is to monitor for port status through the reply of switch using C++ without python.so I added some code to monitor as below. It seems to receive reply from switch.and I have a another question. If I send "ofp_aggregate_stats_request", What should I use event ? should I make new event ? I think there isn't aggregate_stats event in src/etc/nox.json. Disposition linkload::handle_port_stats(const Event& e)  {    const Port_stats_in_event& psie = assert_cast(e);    vector::const_iterator i = psie.ports.begin();    while (i != psie.ports.end())    {      std::cout<<"rx_packets= "ÂüÁ¶ : "NOX-dev" ³¯Â¥: 2011³â 7¿ù 08ÀÏ ±Ý¿äÀÏ, 18½Ã 59ºÐ 59ÃÊ +0900Á¦¸ñ: Re: [nox-dev] send_stat_reqSo most of what you posted is just the code from send_stat_req().  At the end, you have some new code starting with "of_port_stats psrep;".  Did you simply add that code to the end of send_stat_req()?  If so, it's not going to work.  The request is sent by send_openflow_command(), but the answer does not come back immediately.  psrep will not be filled in.  Instead, you need to wait for an event to be fired when you receive the response from the switch.  In linkload, this happens in the handle_port_stats() method, which iterates over Port_stats structures (basically the same as ofp_port_stats structures from the packing library).  Your code belongs somewhere in the loop in that function.Hope that helps.-- MurphyOn Jul 7, 2011, at 11:37 PM, Min-Hyup KANG wrote:Hi all,I am currently trying to get any statistics of running switch.and I am re-writing some networkstate/linkload.cc as blow, but I think their value is "0" I need your help and any suggestion would help me.Thanks,void linkload::send_stat_req(const datapathid& dpid, uint16_t port)  {    size_t size = sizeof(ofp_stats_request)+sizeof(ofp_port_stats_request);    of_raw.reset(new uint8_t[size]);    of_stats_request osr(openflow_pack::header(OFPT_STATS_REQUEST, size),                         OFPST_PORT, 0);    of_port_stats_request opsr;    opsr.port_no = OFPP_NONE;    osr.pack((ofp_stats_request*) openflow_pack::get_pointer(of_raw));    opsr.pack((ofp_port_stats_request*) openflow_pack::get_pointer(of_raw, sizeof(ofp_stats_request)));    /*send request message*/    send_openflow_command(dpi->second.datapath_id, of_raw, false);        of_por