Thank you very much. I solved this problem by your way. But I have another question. I have written nox module which used as a router. And I want to create a queue for each port and monitor it. When the length of the queue is more than a certain limit, the router will change another way to forward the packet. So I must let NOX know the status of queue in each port. I ask ovs dev this question and they said OVS doesn't provide a way to monitor the length of a queue. Do you have any good idea to do this?
Thanks again. -- Zhigang Chen ________________________________ 发件人: Murphy McCauley <[email protected]> 收件人: 星言 墨虚 <[email protected]> 抄送: "[email protected]" <[email protected]> 发送日期: 2012年3月28日, 星期三, 上午 10:51 主题: Re: [nox-dev] Some problems about add flow entry to flow table in openvswitch Looking at the wireshark trace, it looks as if the in_port on the match is getting byte reversed. This is quite possibly a bug in the packing library; byte ordering in NOX Classic is problematic. Try flipping it: ofm.match = flow.get_exact_match(); ofm.match.in_port = htons(ofm.match.in_port); // Swap bytes You might also try turning up the verbosity for Open vSwitch and looking for messages from it. I won't swear to it, but I'd think there's a decent chance it would log something if it got a command with an invalid port number. -- Murphy On Mar 26, 2012, at 11:12 PM, 星言 墨虚 wrote: Dear all, > > >Sorry to bother you. > > >I am writing a NOX module whose name is router. It can be use as a router. But >there are some questions that NOX cannot add flow entry to flow table in >openvswitch through send_openflow_command. > > >This is part of my code. > // set up a new flow >ofp_action_list act_list; >ofp_action *act; > > >act = new ofp_action(); >act->set_action_dl_addr( OFPAT_SET_DL_DST, ARPTable[RouteEntry. NextIPAddr]); >act_list.action_list.push_ back(*act); >act = new ofp_action(); >act->set_action_output( RouteEntry.outPort, 0); >act_list.action_list.push_ back(*act); > > >// set up new flow >boost::shared_array<uint8_t> of_raw; >size_t size = sizeof(ofp_flow_mod)+act_list. mem_size(); >of_raw.reset(new uint8_t[size]); > > >of_flow_mod ofm; >ofm.header = openflow_pack::header(OFPT_ FLOW_MOD, size); >ofm.match = flow.get_exact_match(); > > >ofm.cookie = htonl(0); >ofm.command = htons(OFPFC_ADD); >ofm.flags = htons(0); >ofm.priority = htons(OFP_DEFAULT_PRIORITY); >ofm.idle_timeout = htons(120); >ofm.hard_timeout = htons(0); >ofm.buffer_id = buffer_id; > > >ofm.pack((ofp_flow_mod*) openflow_pack::get_pointer(of_ raw)); >act_list.pack(openflow_pack:: get_pointer(of_raw,sizeof(ofp_ flow_mod))); > > >lg.dbg("Install flow entry %s with %zu actions", > flow.to_string().c_str(), act_list.action_list.size()); > > >send_openflow_command( datapath_id, of_raw, false); > > > Irun this code in nox(ip: 192.168.0.1) and send packet from host(ip: >192.168.57.1) to terminal(ip: 10.0.0.1), then nox show that flow has been >installed successfully, packet has also been sent to terminal successfully and >wiresharek can capture the OFP packet too, but openvswitch cannot add this >flow to flow table. > > > >The attachment is capture file from wireshark. > > >Thanks! > > > ><packet>
