Hi All,

I am not able to delete a flow entry. Following is my code snippet, I have
added to the "switch" module in NOX.

Basically, I store the flows that I want to delete.

The delete is sending flow_mod to switch. But, I am not receiving Flow
Removed or a New Packet In for the deleted flows. Dpctl dump flows also
still shows the flow. Which means it is not deleted.

Is this a bug with userspace openflow switch (ofprotocol/ofdatapath) or I am
doing something wrong.

Thanks a lot,
Vishal


Call back function:
delete_rule ( ) {


*/* *
*Retrieving information needed to delete a flow rule.*
*Stored from a previously received Packet IN, rule corresponding to which is
being deleted now.*
*
*
**/*
    Flow flow = (Flow)flow_list[0];
    uint32_t buffer_id = (uint32_t)buffer_id_list[0];
    int out_port = (int) out_port_list[0];
    datapathid datapath_id = (datapathid) datapath_id_list[0];



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

*// Populating OF header*
    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);
    //VLOG_DBG(log, "Input Port %d",(int)flow.in_port);
    //ofm->match.dl_vlan = flow.dl_vlan;
    //ofm->match.dl_vlan_pcp = flow.dl_vlan_pcp;
    //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;
    //VLOG_DBG(log, "Nw Src %d",flow.nw_src);
    //VLOG_DBG(log, "Nw Dst %d",flow.nw_dst);
    //ofm->match.nw_proto = flow.nw_proto;
    //ofm->match.nw_tos = flow.nw_tos;
    ofm->match.tp_src = flow.tp_src;
    ofm->match.tp_dst = flow.tp_dst;
    ofm->cookie = htonl(0);
    //ofm->out_group = htonl(OFPG_ANY); //version 1.1.0
    ofm->out_port = htonl(OFPP_NONE);
    ofm->command = htons(OFPFC_DELETE);
    //ofm->buffer_id = htonl(buffer_id);
    ofm->idle_timeout = htons(5);
    ofm->hard_timeout = htons(OFP_FLOW_PERMANENT);
    ofm->priority = htons(OFP_DEFAULT_PRIORITY);
    ofm->flags = htons(ofd_flow_mod_flags());

  //  ofp_action_output& action = *((ofp_action_output*)ofm->actions);
  //  memset(&action, 0, sizeof(ofp_action_output));
  //  action.type = htons(OFPAT_OUTPUT);
  //  action.len = htons(sizeof(ofp_action_output));
  //  action.max_len = htons(0);
  //  action.port = htons(out_port);
  //  VLOG_DBG(log, "Output Port %d",(int)action.port);*/

    send_openflow_command(datapath_id, &ofm->header, true);

}
_______________________________________________
nox-dev mailing list
nox-dev@noxrepo.org
http://noxrepo.org/mailman/listinfo/nox-dev

Reply via email to