Can someone please help with a recipe on how to delete a VLAN tag if it
exists in the packet? I want to do this OpenFlow version >1.3? Note that I
could achieve with OF 1.0 and Ryu as highlighted below.

I tried the following code:

    ofp_parser = ofproto_v1_3_parser
    actions = [
        ofp_parser.OFPActionPopVlan(),
        ofp_parser.OFPActionSetField(vlan_vid=ofproto_v1_3.OFPVID_PRESENT |
100),
        ofp_parser.OFPActionOutput(3, 0)
    ]
    match = ofp_parser.OFPMatch(in_port=1)

    inst = [
        ofp_parser.OFPInstructionActions(ofp.OFPIT_APPLY_ACTIONS, actions)
    ]
    m = ofp_parser.OFPFlowMod(self.dp, 0x1234, 0, 0, ofp.OFPFC_ADD, 0,
                              0, 100, UINT32_MAX, ofp.OFPP_ANY,
                              ofp.OFPG_ANY, 0, match, inst)

This results in following error in OVS (got this from using "ovs-ofctl
snoop s1 --detach"):

OFPT_FLOW_MOD (OF1.3) (xid=0x6accfc95): ***decode error:
OFPBAC_MATCH_INCONSISTENT***
OFPT_ERROR (OF1.3) (xid=0x6accfc95): OFPBAC_MATCH_INCONSISTENT
OFPT_FLOW_MOD (OF1.3) (xid=0x6accfc95):
(***truncated to 64 bytes from 112***)
00000000  04 0e 00 70 6a cc fc 95-00 00 00 00 00 00 12 34 |...pj..........4|
00000010  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 64 |...............d|
00000020  ff ff ff ff ff ff ff ff-ff ff ff ff 00 00 00 00 |................|
00000030  00 01 00 0c 80 00 00 04-00 00 00 01 00 00 00 00 |................|

If I use ofproto_v1_1_parser, I could create the flow

    actions = [
        ofp_parser.OFPActionStripVlan(),
        ofp_parser.OFPActionVlanVid(100),
        ofp_parser.OFPActionOutput(3, 0)
    ]
    match = ofp_parser.OFPMatch(in_port=1)
    m = ofp_parser.OFPFlowMod(self.dp, match, 0x1234, ofp.OFPFC_ADD,
                              priority=100, actions=actions)

>From ovs-ofctl dump-flows:

 cookie=0x1234, duration=849.909s, table=0, n_packets=14, n_bytes=1008,
reset_counts priority=100,in_port="s1-eth1"
actions=pop_vlan,push_vlan:0x8100,set_field:4196->vlan_vid,output:"s1-eth3"

Thanks,
-Vasu

*Vasu Dasari*
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Ryu-devel mailing list
Ryu-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to