[ovs-discuss] [ovs-dev] Delete Flows matching specific cookie - OpenFlow 1.3.5 Spec support by OpenVSwitch

Darrell Ball dball at vmware.com
Tue Apr 24 03:15:18 UTC 2018



On 4/23/18, 6:53 PM, "Carlos Ferreira" <carlosmf.pt at gmail.com> wrote:

    @IWAMOTO
    
    Hello IWAMOTO,
    No, I do not get any kind of error from Ryu. I have also verified the
    structure of the Openflow messages sent to the switch using Wireshark
    and no anomalies were found. The packet was well structured.
    
    @Darrell,
    
    Darrel, thank you for the info. I tried to use the del-flows using the
    "ovs-ofctl del-flows" command with the specific cookie and in fact, it
    did work. I'm lost here, because it does not seems to work if the
    communication is done via OpenFlow with a remote controller.

Maybe you want to check what Ryu is sending the switch

http://www.openvswitch.org//support/dist-docs/ovs-ofctl.8.pdf

“
OpenFlow Switch Monitoring Commands

monitor switch [miss-len] [invalid_ttl] [watch:[spec...]]
Connects to switch and prints to the console all OpenFlow messages received. Usually, switch
should specify the name of a bridge in the ovs−vswitchd database.
“

eg) ovs-ofctl monitor br0 65534 invalid_ttl --detach --no-chdir --pidfile 2> ofctl_monitor.log

    
    
    
    On 24 April 2018 at 02:42, Darrell Ball <dball at vmware.com> wrote:
    > //You can verify that OVS supports deletion by cookie specification by checking these tests:
    >
    >  932: ofproto.at:1746    ofproto - del flows based on cookie
    >  933: ofproto.at:1767    ofproto - del flows based on cookie mask
    >
    > // Run the tests using “make check” like this:
    > sudo make check TESTSUITEFLAGS='932-933' -C _gcc
    >
    > //Look at what is being tested here:
    > tests/ofproto.at
    >
    > Thanks Darrell
    >
    >
    > On 4/23/18, 4:17 PM, "ovs-dev-bounces at openvswitch.org on behalf of Carlos Ferreira" <ovs-dev-bounces at openvswitch.org on behalf of carlosmf.pt at gmail.com> wrote:
    >
    >     Hello to all
    >
    >     According to the OpenFlow 1.3.5 spec, page 44 specifies the following:
    >
    >
    >     "Modify and delete commands can also be filtered by cookie value, if
    >     the cookie_mask field contains
    >     a value other than 0. This constraint is that the bits specified by
    >     the cookie_mask in both
    >     the cookie field of the flow mod and a flow entry’s cookie value must
    >     be equal. In other words,
    >     (flow entry.cookie&flow mod.cookie mask) == (flow mod.cookie&flow
    >     mod.cookie mask)."
    >
    >
    >     Now, using the Ryu python-based controller, I tried to delete a flow
    >     by specifying the flow's cookie value, but the procedure was not
    >     successful.
    >
    >     The following code is a test-example which I used.
    >
    >         from ryu.base.app_manager import RyuApp
    >         from ryu.controller.dpset import EventDP
    >         from ryu.controller.handler import MAIN_DISPATCHER
    >         from ryu.controller.handler import set_ev_cls
    >         from ryu.ofproto import ofproto_v1_3
    >         from ryu.ofproto import ether, inet
    >
    >         class MPLS_Testing(RyuApp):
    >           OFP_VERSIONS = [ofproto_v1_3.OFP_VERSION]
    >
    >           @set_ev_cls(EventDP, MAIN_DISPATCHER)
    >           def switch_connect_event(self, ev):
    >             ofp_parser = ev.dp.ofproto_parser
    >             ofp = ev.dp.ofproto
    >             datapath_obj = ev.dp
    >             if ev.enter:
    >               datapath_obj.send_msg(  # Removes all flows registered in this switch.
    >                 ofp_parser.OFPFlowMod(
    >                   datapath=datapath_obj,
    >                   table_id=ofp.OFPTT_ALL,
    >                   command=ofp.OFPFC_DELETE,
    >                   out_port=ofp.OFPP_ANY,
    >                   out_group=ofp.OFPG_ANY,
    >                 )
    >               )
    >               add_label_flow = ofp_parser.OFPFlowMod(
    >                 datapath=datapath_obj,
    >                 cookie=1,
    >                 table_id=0,
    >                 command=ofp.OFPFC_ADD,
    >                 match=ofp_parser.OFPMatch(
    >                   in_port=1
    >                 ),
    >                 instructions=[
    >                   ofp_parser.OFPInstructionActions(
    >                     ofp.OFPIT_APPLY_ACTIONS,
    >                     [
    >                       ofp_parser.OFPActionPushMpls(),
    >                       ofp_parser.OFPActionSetField(mpls_label=16),
    >                     ]
    >                   ),
    >                   ofp_parser.OFPInstructionGotoTable(table_id=1),
    >                 ]
    >               )
    >               datapath_obj.send_msg(add_label_flow)
    >
    >               add_label_flow2 = ofp_parser.OFPFlowMod(
    >                 datapath=datapath_obj,
    >                 cookie=2,
    >                 table_id=1,
    >                 command=ofp.OFPFC_ADD,
    >                 match=ofp_parser.OFPMatch(
    >                   in_port=1
    >                 ),
    >                 instructions=[
    >                   ofp_parser.OFPInstructionActions(
    >                     ofp.OFPIT_APPLY_ACTIONS,
    >                     [
    >                       ofp_parser.OFPActionPushMpls(),
    >                       ofp_parser.OFPActionSetField(mpls_label=12),
    >                     ]
    >                   ),
    >                   ofp_parser.OFPInstructionGotoTable(table_id=2),
    >                 ]
    >               )
    >               datapath_obj.send_msg(add_label_flow2)
    >
    >               # Deletes flow with cookie equal to 2.
    >               datapath_obj.send_msg(
    >                 ofp_parser.OFPFlowMod(
    >                   cookie=2,
    >                   cookie_mask=0xFFFFFFFFFFFFFFFF,
    >                   datapath=datapath_obj,
    >                   command=ofp.OFPFC_DELETE,
    >                   out_port=ofp.OFPP_ANY,
    >                   out_group=ofp.OFPG_ANY,
    >                 )
    >               )
    >
    >     Can anyone tell me if OpenVSwitch 2.9 supports cookie match when
    >     deleting a flow from the tables? OpenFlow 1.3.5 spec clearly states
    >     that a Delete command could also filter flows using the cookie value,
    >     when the cookie_mask is different than zero. Currently, I'm kinda lost
    >     here.
    >
    >     Thank you!
    >
    >     --
    >
    >     Carlos Miguel Ferreira
    >     Researcher at Telecommunications Institute
    >     Aveiro - Portugal
    >     Work E-mail - cmf at av.it.pt
    >     Skype & GTalk -> carlosmf.pt at gmail.com
    >     LinkedIn -> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.linkedin.com_in_carlosmferreira&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=ND4lqlTir-Ukyp2WkESK_WJ7j0b1dAUdptpdObaFU7Y&s=saz4uZw1U4C3pxnJSK9cRxTNXucuBUokJFvgmL3P3Wg&e=
    >     _______________________________________________
    >     dev mailing list
    >     dev at openvswitch.org
    >     https://urldefense.proofpoint.com/v2/url?u=https-3A__mail.openvswitch.org_mailman_listinfo_ovs-2Ddev&d=DwIGaQ&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=ND4lqlTir-Ukyp2WkESK_WJ7j0b1dAUdptpdObaFU7Y&s=A8DVOVYZJhWrS-4plyLgmB6DmiB0nWaYxbqdlekjUOU&e=
    >
    >
    
    
    
    -- 
    
    Carlos Miguel Ferreira
    Researcher at Telecommunications Institute
    Aveiro - Portugal
    Work E-mail - cmf at av.it.pt
    Skype & GTalk -> carlosmf.pt at gmail.com
    LinkedIn -> https://urldefense.proofpoint.com/v2/url?u=http-3A__www.linkedin.com_in_carlosmferreira&d=DwIFaQ&c=uilaK90D4TOVoH58JNXRgQ&r=BVhFA09CGX7JQ5Ih-uZnsw&m=j9V3B7ygf4O--CxRpwz12p2tUPPwIjBqmilIY5vrfIM&s=NdRdr5TN0ZvE3gY7DHkfHb1q2amlsHU5WU_Ho-04KNE&e=
    



More information about the discuss mailing list