Hi Hardeep, Here is how I add multiple actions. FYI... the complete c++ file is attached. check the handle_ofentry_install() for the example Hope it works for you!
here is the partial code ----------------------------------------------- ofp_action_list actlist; ofp_action *act = new ofp_action(); act->set_action_dl_addr(OFPAT_SET_DL_SRC,srcmac ); actlist.action_list.push_back(*act); ofp_action *act = new ofp_action(); act->set_action_nw_addr(OFPAT_SET_NW_SRC, ntohl(bom->nw_src)); actlist.action_list.push_back(*act); ofp_action *act = new ofp_action(); act->set_action_output(output_port, 0); actlist.action_list.push_back(*act); ofp->init_flow_mod(of_raw, actlist); ofp->set_flow_mod_actions(of_raw, actlist); ofp->send_command(of_raw,dpid, false ); ----------------------------------------------- BTW, the sequence of actions does matter. Regards, MinChi From: nox-dev-boun...@noxrepo.org [mailto:nox-dev-boun...@noxrepo.org] On Behalf Of Hardeep Uppal Sent: Tuesday, May 25, 2010 3:14 PM To: kk yap Cc: nox-dev@noxrepo.org Subject: Re: [nox-dev] Nox: Adding multiple action to a flow using c++ Has anyone tried adding multiple actions to a flow? If you have, can you post an example in c++ showing how its down. My method make the openflow switch throw errors about the packet it receives from Nox. Thanks Hardeep On Sun, May 23, 2010 at 9:14 PM, kk yap <yap...@stanford.edu<mailto:yap...@stanford.edu>> wrote: Hi Hardeep, this looks correct. Have you looked at the packet sent using wireshark? I would recommend that. Regards KK On 23 May 2010 20:51, Hardeep Uppal <hardeep...@gmail.com<mailto:hardeep...@gmail.com>> wrote: > Hi, > I am writing a Nox module that adds flow into the openflow switch. I have > the module working correctly which adds one action ofp_action_output with > the flow. > I am not sure how to add multiple flows. I want to add the action > ofp_action_tp_port defined in openflow.h. The struct for ofp_flow_mod has > the array struct ofp_action_header actions[0]. I am not sure what the > correct pointer arithmetic is to add the length of ofp_action_nw_addr and > ofp_action_output. This is what I have > ofp_action_nw_addr& action1 = *((ofp_action_nw_addr*)ofm->actions); > memset(&action1, 0, sizeof(ofp_action_nw_addr)); > action1.type = htons(OFPAT_SET_NW_DST); > action1.len = htons(sizeof(ofp_action_nw_addr)); > action1.nw_addr = l3_[2].addr; > ofp_action_output& action2 = *((ofp_action_output*)(((char*)ofm->actions) + > sizeof(ofp_action_nw_addr))); > memset(&action2, 0, sizeof(ofp_action_output)); > action2.type = htons(OFPAT_OUTPUT); > action2.len = htons(sizeof(ofp_action_output)); > action2.max_len = htons(0); > action2.port = htons(out_port); > Can someone tell me what am I doing wrong? > Thanks, > Hardeep > > _______________________________________________ > nox-dev mailing list > nox-dev@noxrepo.org<mailto:nox-dev@noxrepo.org> > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org > >
timcanpy.cc
Description: timcanpy.cc
_______________________________________________ nox-dev mailing list nox-dev@noxrepo.org http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org