Dear all:
Sorry to bother you.
I am writing a Nox module that adds flow into the openflow switch. I have
the module working correctly. And NOX also has sent Flow Mod Message to 
OpenvSwitch, but I cannot find any flow entry in flow table of OpenvSwitch 
which means NOX didn't add flow into the openvswitch. So when a new packet 
arrived, NOX must install a new flow although this flow has been sent to 
openvswitch just before.
This is my code.

// set action for 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 a 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 = 0;    
ofm.command = OFPFC_ADD;
ofm.idle_timeout = 120;
ofm.hard_timeout = 0;
ofm.buffer_id = buffer_id;
ofm.out_port = OFPP_NONE;
ofm.flags = ofd_flow_mod_flags();

// set action to flow
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);

Thanks
Tony

Reply via email to