Hi Chitra,

this is what I understand
(this code snippet is from the unmodified hub.cc file)

       ofp_flow_mod* ofm;
size_t size = sizeof *ofm + *sizeof(ofp_action_output); *//* #1:* make this <N> * sizeof(ofp_action_output)
       boost::shared_array<char> raw_of(new char[size]);
       ofm = (ofp_flow_mod*) raw_of.get();

       ofm->header.version = OFP_VERSION;
       ofm->header.type = OFPT_FLOW_MOD;
       ofm->header.length = htons(size);
       ofm->match.wildcards = htonl(0);
       ofm->match.in_port = htons(flow.in_port);
       ofm->match.dl_vlan = flow.dl_vlan;
memcpy(ofm->match.dl_src, flow.dl_src.octet, sizeof ofm->match.dl_src); memcpy(ofm->match.dl_dst, flow.dl_dst.octet, sizeof ofm->match.dl_dst);
       ofm->match.dl_type = flow.dl_type;
       ofm->match.nw_src = flow.nw_src;
       ofm->match.nw_dst = flow.nw_dst;
       ofm->match.nw_proto = flow.nw_proto;
       ofm->match.tp_src = flow.tp_src;
       ofm->match.tp_dst = flow.tp_dst;
       ofm->command = htons(OFPFC_ADD);
       ofm->buffer_id = htonl(buffer_id);
       ofm->idle_timeout = htons(5);
       ofm->hard_timeout = htons(5);
       ofm->priority = htons(OFP_DEFAULT_PRIORITY);
       ofm->reserved = htons(0);
       *ofp_action_output& action = *((ofp_action_output*)ofm->actions);
       /* change the above line to the one below..
* the idea is, pointers are arrays.. so now you can refer to each of
        * your action as action[0] ... action[N-1]
        * once you make the change
        */ // change #2**
*        *ofp_action_output* action = ((ofp_action_output*)ofm->actions);*
memset(&action, 0, *<N> * *sizeof(ofp_action_output)); *// change #3* action.type = htons(OFPAT_OUTPUT); *// action[i].type change #4*
       action.len = htons(sizeof(ofp_action_output));    *// action[i].len*
action.port = htons(OFPP_FLOOD); *// action[i].port* action.max_len = htons(0); *// action[i].max_len*
       send_openflow_command(pi.datapath_id, &ofm->header, true);

HTH
/varghese

Chitra Muthukrishnan wrote:
Hi,
In most of the examples that I see, the controller sends an ofp_flow_mod instructing the switch to take 1 action for a rule. I am wondering how to specify 2 actions for a rule. Do we just send two messages- 1 for each action?
Or is there some other message format to specify 2 actions for a match?

-Chitra


On Thu, Oct 29, 2009 at 10:46 AM, kk yap <[email protected] <mailto:[email protected]>> wrote:

    Hi Chitra,

    You have to construct a ofp_flow_mod message (specified in openflow.h)
    and send it to the switch.  In NOX, I typically use a boost shared
    array to hold the message, then it is just a send_openflow_command.  I
    cannot find a very clean segment of code, but you can look at
    routing.cc for try to follow through it.

    Regards
    KK

    2009/10/29 Chitra Muthukrishnan <[email protected]
    <mailto:[email protected]>>:
    > I believe the controller can specify many actions to be taken
    for a matching
    > packet.
    > I need a switch to send some packets to the controller and
    forward it to an
    > output port.
    > Can someone tell me how we can construct such rules with nox?
    >
    > -Chitra
    >
    > _______________________________________________
    > nox-dev mailing list
    > [email protected] <mailto:[email protected]>
    > http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
    >
    >


------------------------------------------------------------------------

_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org
_______________________________________________
nox-dev mailing list
[email protected]
http://noxrepo.org/mailman/listinfo/nox-dev_noxrepo.org

Reply via email to