Thanks Iwase. Can you help me how to solve this use-case?

A packet which matches a source IP address 1.1.1.1 needs to have a VLAN
stripped if it is present in the packet and forwarded to port "s1-eth1".
This would mean that I need to have two rules with OF1.5:
1. ip,nw_src=1.1.1.1 actions=outport:"s1-eth1"
2. vlan_tci=0x1000/0x1000,ip,nw_src-1.1.1.1
actions=pop_vlan,output:"s1-eth1"

I will be using two rules to solve the use-case.

With OF 1.0 I could have achieved above with 1 rule.

I assume you might have gone through similar conundrum, I am wondering how
this problem could have been solved.

Thanks
-Vasu


*Vasu Dasari*

On Thu, Jan 11, 2018 at 7:36 PM, Iwase Yusuke <iwase.yusu...@gmail.com>
wrote:

> Hi Vasu,
>
> > 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):
>
> The following messages shows that the match is inconsistent with the given
> actions and the FlowMod could not be accepted.
>
> The OpenFlow Spec 1.3.5 says on "6.4 Flow Table Modification Messages"
> section;
> ====
> If an action in a flow mod message performs an operation which is
> inconsistent with the match and prior
> actions of the flow entry, for example, a pop VLAN action with a match
> specifying no VLAN, or a set
> TTL action with a match wildcarding the Ethertype, the switch may
> optionally reject the flow mod and
> immediately return an ofp_error_msg with OFPET_BAD_ACTION type and
> OFPBAC_MATCH_INCONSISTENT
> code.
> ===
>
> So you need to add the "vlan_vid" match field, for example;
>   vlan_vid=(ofproto_v1_3.OFPVID_PRESENT, ofproto_v1_3.OFPVID_PRESENT)
> in the arguments for OFPMatch().
> For the combination of the value/mask for the "vlan_vid" match field,
> please
> refer to the "NOTE" section at the following.
> http://ryu.readthedocs.io/en/latest/ofproto_v1_3_ref.html#fl
> ow-match-structure
>
> FYI, if you specify "--verbose" option for "ryu-manager" the warning
> messages
> , which is similar to that of "ovs-ofctl snoop", should be displayed.
>
> Thanks,
> Iwase
>
>
>
> On 2018年01月12日 01:25, Vasu Dasari wrote:
>
>> 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:0x8
>> 100,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
>>
>>
------------------------------------------------------------------------------
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