I should have mentioned that the OpenFlow pack library in NOX does this for you, with the correct byte order. For details, check out:
http://noxrepo.org/~yapkke/doc/classvigil_1_1openflow__pack.html http://noxrepo.org/~yapkke/doc/openflow-pack-raw_8hh.html Regards KK On 21 March 2011 13:11, Ricardo Bennesby <ricardo.benne...@gmail.com> wrote: > Hi Paulo and kk! > > You are right! > Problem solved. > Thank you very much for your help. > > Best Regards. > > 2011/3/21 Paulo César <pcd...@gmail.com> >> >> Hi, Ricardo. >> I solved this problem. >> Try to use ntohll() to uint64 and ntohs() to uint32. >> Best regards. >> 2011/3/21 Paulo César <pcd...@gmail.com> >>> >>> Hi, >>> I am having the same problem. >>> Any help? >>> Best regards. >>> >>> >>> 2011/3/20 Ricardo Bennesby <ricardo.benne...@gmail.com> >>>> >>>> Sorry, forgot to paste that... >>>> fsie is from Flow_stats_in event, declared in a >>>> handle_flow_stats_in method (a handler): >>>> >>>> Disposition newcomp::handle_flow_stats_in(const Event& e){ >>>> const Flow_stats_in_event& fsie >>>> = assert_cast<const Flow_stats_in_event&>(e); >>>> >>>> So, fsie.flows has that informations about the flows, that can be used >>>> to collect statistcs. >>>> >>>> Thanks for help. >>>> Regards. >>>> >>>> 2011/3/20 kk yap <yap...@stanford.edu> >>>>> >>>>> Ricardo, >>>>> >>>>> Can you explain which component is fsie as with >>>>> * fsie.flows.at(i) >>>>> >>>>> Regards >>>>> KK >>>>> >>>>> On 20 March 2011 13:11, Ricardo Bennesby <ricardo.benne...@gmail.com> >>>>> wrote: >>>>> > Thanks kk. >>>>> > >>>>> > I think I did what you suggested: >>>>> > >>>>> > uint32_t ds; //duration_sec >>>>> > uint64_t pc; //packet_count >>>>> > uint16_t pri; //priority >>>>> > uint64_t bc; //byte_count >>>>> > uint16_t len; //legth >>>>> > uint8_t tid; //table_id >>>>> > >>>>> > for(int i=0;i<fsie.flows.size();i++){ >>>>> > lg.dbg("i value: %d",i); >>>>> > ds = ntohl(fsie.flows.at(i).duration_sec); >>>>> > pc = ntohl(fsie.flows.at(i).packet_count); >>>>> > pri = ntohl(fsie.flows.at(i).priority); >>>>> > bc = ntohl(fsie.flows.at(i).byte_count); >>>>> > len = ntohl(fsie.flows.at(i).length); >>>>> > tid = ntohl(fsie.flows.at(i).table_id); >>>>> > lg.dbg("duration_sec: %"PRIu32,ds); >>>>> > lg.dbg("packet_count: %"PRIu64,pc); >>>>> > lg.dbg("priority: %"PRIu16,pri); >>>>> > lg.dbg("byte_count: %"PRIu64,bc); >>>>> > lg.dbg("length: %"PRIu16,len); >>>>> > lg.dbg("table_id: %"PRIu8,tid); >>>>> > } >>>>> > >>>>> > But now only number of flows and duration in seconds are non-zero: >>>>> > >>>>> > 00238|newcomp|DBG:Size of flows: 2 >>>>> > 00239|newcomp|DBG:i value: 0 >>>>> > 00240|newcomp|DBG:duration_sec: 8 >>>>> > 00241|newcomp|DBG:packet_count: 0 >>>>> > 00242|newcomp|DBG:priority: 0 >>>>> > 00243|newcomp|DBG:byte_count: 0 >>>>> > 00244|newcomp|DBG:length: 0 >>>>> > 00245|newcomp|DBG:table_id: 0 >>>>> > 00246|newcomp|DBG:i value: 1 >>>>> > 00247|newcomp|DBG:duration_sec: 7 >>>>> > 00248|newcomp|DBG:packet_count: 0 >>>>> > 00249|newcomp|DBG:priority: 0 >>>>> > 00250|newcomp|DBG:byte_count: 0 >>>>> > 00251|newcomp|DBG:length: 0 >>>>> > 00252|newcomp|DBG:table_id: 0 >>>>> > >>>>> > What am I missing? >>>>> > >>>>> > Sorry to bother. >>>>> > >>>>> > Regards. >>>>> > >>>>> > >>>>> > 2011/3/20 kk yap <yap...@stanford.edu> >>>>> >> >>>>> >> Hi Ricardo, >>>>> >> >>>>> >> I mean the result. Did you run ntoh<x> on them. >>>>> >> >>>>> >> Regards >>>>> >> KK >>>>> >> >>>>> >> On 20 March 2011 10:50, Ricardo Bennesby >>>>> >> <ricardo.benne...@gmail.com> >>>>> >> wrote: >>>>> >> > Hi kk, thanks for quick reply. >>>>> >> > >>>>> >> > I changed request.match.wildcards = htonl(0xffffffff) to: >>>>> >> > >>>>> >> > request.match.wildcards = htons(0xffffffff); -> but it didn't >>>>> >> > work. >>>>> >> > Nothing >>>>> >> > was printed about the packets >>>>> >> > >>>>> >> > request.match.wildcards = ntohs(0xffffffff); -> the same that >>>>> >> > happened >>>>> >> > with >>>>> >> > htons >>>>> >> > >>>>> >> > request.match.wildcards = ntohl(0xffffffff); -> the same result of >>>>> >> > use >>>>> >> > htonl >>>>> >> > >>>>> >> > Sorry kk, but still I missing something? >>>>> >> > >>>>> >> > 2011/3/20 kk yap <yap...@stanford.edu> >>>>> >> >> >>>>> >> >> Hi Ricardo, >>>>> >> >> >>>>> >> >> Did you consider network/host byte order? >>>>> >> >> >>>>> >> >> Regards >>>>> >> >> KK >>>>> >> >> >>>>> >> >> On 20 March 2011 10:01, Ricardo Bennesby >>>>> >> >> <ricardo.benne...@gmail.com> >>>>> >> >> wrote: >>>>> >> >> > Hi. >>>>> >> >> > >>>>> >> >> > I am running a C++ component that prints statistics of flows >>>>> >> >> > collected >>>>> >> >> > in >>>>> >> >> > switches with the flow_stats_in_event. >>>>> >> >> > I am also running the dpctl dump-flows command in mininet to >>>>> >> >> > compare >>>>> >> >> > the >>>>> >> >> > values and they are very different. >>>>> >> >> > >>>>> >> >> > The request is as follows: >>>>> >> >> > request.table_id = 0xff; >>>>> >> >> > request.out_port = OFPP_NONE; >>>>> >> >> > request.match.wildcards = htonl(0xffffffff); >>>>> >> >> > >>>>> >> >> > Some values printed with dpctl dump-flows are: >>>>> >> >> > cookie=0, duration_sec=6s, table_id=1, priority=32768, >>>>> >> >> > n_packets=9, >>>>> >> >> > n_bytes=882 >>>>> >> >> > And it seems correct. >>>>> >> >> > >>>>> >> >> > In Flow_stats_in_event handler I wrote: >>>>> >> >> > if(fsie.flows.size()>0){ >>>>> >> >> > lg.dbg("duration_sec: >>>>> >> >> > %"PRIu32,fsie.flows.at(0).duration_sec); >>>>> >> >> > lg.dbg("packet_count: >>>>> >> >> > %"PRIu64,fsie.flows.at(0).packet_count); >>>>> >> >> > lg.dbg("priority: >>>>> >> >> > %"PRIu16,fsie.flows.at(0).priority); >>>>> >> >> > lg.dbg("byte_count: >>>>> >> >> > %"PRIu64,fsie.flows.at(0).byte_count); >>>>> >> >> > lg.dbg("length: %d",fsie.flows.at(0).length); >>>>> >> >> > lg.dbg("table_id: >>>>> >> >> > %d",fsie.flows.at(0).table_id); >>>>> >> >> > } >>>>> >> >> > >>>>> >> >> > But the values printed are: >>>>> >> >> > 00533|openflow-event|DBG:received stats reply from 000000000001 >>>>> >> >> > 00534|newcomp|DBG:Size of flows: 2 >>>>> >> >> > 00535|newcomp|DBG:duration_sec: 922746880 >>>>> >> >> > 00536|newcomp|DBG:packet_count: 7710162562058289152 >>>>> >> >> > 00537|newcomp|DBG:priority: 128 >>>>> >> >> > 00538|newcomp|DBG:byte_count: 17737427132398698496 >>>>> >> >> > 00539|newcomp|DBG:length: 24576 >>>>> >> >> > 00540|newcomp|DBG:table_id: 1 >>>>> >> >> > >>>>> >> >> > What am I missing? >>>>> >> >> > If I wasn't detailed enough please let me know. >>>>> >> >> > >>>>> >> >> > Best Regards. >>>>> >> >> > >>>>> >> >> > -- >>>>> >> >> > Ricardo Bennesby da Silva >>>>> >> >> > Ciência da Computação - UFAM >>>>> >> >> > LabCIA - Laboratório de Computação Inteligente e Autonômica >>>>> >> >> > >>>>> >> >> > >>>>> >> >> > _______________________________________________ >>>>> >> >> > nox-dev mailing list >>>>> >> >> > nox-dev@noxrepo.org >>>>> >> >> > http://noxrepo.org/mailman/listinfo/nox-dev >>>>> >> >> > >>>>> >> >> > >>>>> >> > >>>>> >> > >>>>> >> > >>>>> >> > -- >>>>> >> > Ricardo Bennesby da Silva >>>>> >> > Ciência da Computação - UFAM >>>>> >> > LabCIA - Laboratório de Computação Inteligente e Autonômica >>>>> >> > >>>>> >> > >>>>> > >>>>> > >>>>> > >>>>> > -- >>>>> > Ricardo Bennesby da Silva >>>>> > Ciência da Computação - UFAM >>>>> > LabCIA - Laboratório de Computação Inteligente e Autonômica >>>>> > >>>>> > >>>> >>>> >>>> >>>> -- >>>> Ricardo Bennesby da Silva >>>> Ciência da Computação - UFAM >>>> LabCIA - Laboratório de Computação Inteligente e Autonômica >>>> >>>> >>>> _______________________________________________ >>>> nox-dev mailing list >>>> nox-dev@noxrepo.org >>>> http://noxrepo.org/mailman/listinfo/nox-dev >>>> >>> >>> >>> >>> -- >>> "Life is not fair; get used to it." >>> Bill Gates >>> >> >> >> >> -- >> "Life is not fair; get used to it." >> Bill Gates >> > > > > -- > Ricardo Bennesby da Silva > Ciência da Computação - UFAM > LabCIA - Laboratório de Computação Inteligente e Autonômica > > _______________________________________________ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev