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 jam...@nau.edu¹Þ´Â»ç¶÷ : Min-Hyup KANG kang-min-h...@hanmail.netÂüÁ¶ : "NOX-dev" nox-dev@noxrepo.org³¯Â¥: 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 fileinclude/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_castconst Port_stats_in_event(e);  vectorPort_stats::const_iterator i = psie.ports.begin();  while (i != psie.ports.end())  {   std::cout"rx_packets= "i-rx_packetsstd::endl;   std::cout"rx_bytes= "i-rx_bytesstd::endl;   std::cout"tx_bytes= "i-tx_bytesstd::endl;00488|openflow-event|DBG:received stats reply from 00232033dbcerx_packets= 612rx_bytes= 44878tx_bytes= 34546rx_packets= 866- ¿øº» ¸ÞÀÏ -º¸³½»ç¶÷: Murphy McCauley jam...@nau.edu¹Þ´Â»ç¶÷: "Min-Hyup KANG" kang-min-h...@hanmail.netÂüÁ¶: "NOX-dev" nox-dev@noxrepo.org³¯Â¥: 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 ofsend_stat_req()? If so, it's not going to work. The request is sent bysend_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 thehandle_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)));  /

Re: [nox-dev] send_stat_req

2011-07-10 Thread Murphy McCauley
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.

-- Murphy

On 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_castconst 
 Port_stats_in_event(e);
 
 vectorPort_stats::const_iterator i = psie.ports.begin();
 
 while (i != psie.ports.end())
 {
 
   std::coutrx_packets= i-rx_packetsstd::endl;
   std::coutrx_bytes= i-rx_bytesstd::endl;
   std::couttx_bytes= i-tx_bytesstd::endl;
 
 
 00488|openflow-event|DBG:received stats reply from 00232033dbce
 rx_packets= 612
 rx_bytes= 44878
 tx_bytes= 34546
 rx_packets= 866
 
 
 
 
 - 원본 메일 -
 보낸사람: Murphy McCauley jam...@nau.edu
 받는사람 : Min-Hyup KANG kang-min-h...@hanmail.net
 참조 : NOX-dev nox-dev@noxrepo.org
 날짜: 2011년 7월 08일 금요일, 18시 59분 59초 +0900
 제목: Re: [nox-dev] send_stat_req
 So 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.
 
 -- Murphy
 
 On 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_port_stats psrep;
 
 std::coutRX_packets = psrep.rx_packetsstd::endl;
 std::coutRX_bytes = psrep.rx_bytesstd::endl;
 std::coutTX_bytes = psrep.tx_bytesstd::endl;
 
 ./nox_core -i ptcp:6633 -v simplerouting linkload=interval=10
 
 
 00096|linkload|DBG:Send probe to 123456abcdef
 RX_packets = 0
 RX_bytes = 0
 TX_bytes = 0
 
 
 
 
 
 Best Regards, 
 Min-Hyup KANG 
 
   ___
 nox-dev mailing list
 nox-dev@noxrepo.org
 http://noxrepo.org/mailman/listinfo/nox-dev
 
 
 
 
 
 
 
 Best Regards, 
 Min-Hyup KANG 
 
  

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