Hi,

Ok.

Yes I could also use the pcp bits that's true. But 12 bits should be
enough for what I wanna do right now.

But I really need a way only to touch some bits of the vlan tag. Maybe
I could copy them to the metatag field and them change some bits there
and then copy it back to vlan tag field. Since it looks like it's the
only field a mask can can be used in the set field instruction...

Best,
Clément

On 30 January 2015 at 15:39, Wei-li Tang <[email protected]> wrote:
> Hello,
>
> 2015-01-30 22:32 GMT+08:00 Clément Rault <[email protected]>:
>>
>> I realized that that my example isn't very clear.
>>
>> If I understood well the vlan tag is 16 bits long, the first bit is
>> used to represent if a tag a present, the three next ones are for the
>> pcp and 12 last ones are for the tag itself, right?
>>
>> My point is that I wanna touch 2 bits only, let's say the 2 first of
>> the 12 bits.
>>
>> For ex if I wanna check that those 2 bits are set at 0 I could use
>>
>>  "match":{
>>          "dl_vlan": "0x1000/0x1C00"
>>      },
>>
>> right?
>
>
> Yes.
>
>>
>>
>> But you say that it's not possible to do the same with the set field
>> instruction, right? It's too bad because I really need to be able to
>> only touch a part of the bits in my scenario. And for example to check
>> if the two first bits are at 00 then put them to 01. I need to figure
>> out a way to do it...
>
>
> Yes, you must rewrite all bits of vlan_vid at once. You can just set unused
> bits to zero but of course it alters the value.
>
> If you really need few bits from vlan tag to do something, how about
> utilizing 3-bit vlan_pcp if you were not running 802.1p QoS in your network?
>
>
>> Best,
>> Clément
>>
>> On 30 January 2015 at 12:03, Clément Rault <[email protected]>
>> wrote:
>> > Hi,
>> >
>> > Thanks for your answer.
>> >
>> > So you're saying that it's possible to match on a part of the bits of
>> > the VLAN tag (with dl_vlan = 0xC00 | 0x1000 = 0x1C00 for example,
>> > right?) but it's not possible to set only some bits of the VLAN tag?
>> >
>> > Because I wanna use the VLAN tag to store some information but I only
>> > wanna use a part of the bits for each switch.
>> >
>> > How would you write a set field instruction that only touch a part of
>> > the VLAN tag (let's say the two first bits for ex)?
>> >
>> > Best,
>> > Clément
>> >
>> > On 30 January 2015 at 03:38, Wei-Li Tang <[email protected]> wrote:
>> >> Hello,
>> >>
>> >> 2015-01-30 1:49 GMT+08:00 Clément Rault <[email protected]>:
>> >>>
>> >>> Hi,
>> >>>
>> >>> On 29 January 2015 at 03:51, Yusuke Iwase <[email protected]>
>> >>> wrote:
>> >>> > Hi Clément,
>> >>> >
>> >>> > In ofctl_rest.py, fields vlan_vid and dl_vlan are the same.
>> >>> >
>> >>> > Match field for VLAN ID is described as "dl_vlan" in OpenFlow Spec
>> >>> > 1.0.
>> >>> > On the other hand, In Spec 1.2+, this field is described as
>> >>> > "vlan_vid".
>> >>> > ofctl_rest.py supports both name of this field.
>> >>> >
>> >>> >
>> >>> > I think you can use the following match field to check VLAN tag are
>> >>> > present or not.
>> >>> >
>> >>> >
>> >>> >
>> >>> > (http://ryu.readthedocs.org/en/latest/app/ofctl_rest.html#example-of-vlan-id-match-field)
>> >>> > - To match only packets with a VLAN tag regardless of its value:
>> >>> >     ...
>> >>> >     "match":{
>> >>> >         "dl_vlan": "0x1000/0x1000"   # Describe
>> >>> > OFPVID_PRESENT(0x1000/0x1000)
>> >>> >     },
>> >>> >     ...
>> >>> >
>> >>> >
>> >>> >
>> >>> > The same.
>> >>> > There is no difference between 0x03 and 0x3 in this command.
>> >>> >
>> >>> >
>> >>> > Yes, you can use "metadata": "0x1/0x1".
>> >>> >
>> >>> >
>> >>> > 0x1000 is OFPVID_PRESENT bit.
>> >>> > Please refer to the table "Match combinations for VLAN tags." in
>> >>> > OpenFlow Spec 1.3
>> >>>
>> >>> I did it. And in the document I found " The VLAN id is 12-bits, so we
>> >>> can use the entire 16 bits to indicate special conditions." So I can
>> >>> "only" use 12 bits to store the vlan id I guess.
>> >>>
>> >>> >
>> >>> >
>> >>> > First, you want to match VLAN-ID = 0b110000000000 = 0xC00, right?
>> >>>
>> >>> I meant 0xC00 and not 0xB00 yes sorry.
>> >>>
>> >>> >
>> >>> >
>> >>> >
>> >>> > (http://ryu.readthedocs.org/en/latest/app/ofctl_rest.html#example-of-vlan-id-match-field)
>> >>> > - To match only packets with VLAN tag and VLAN ID equal value 5:
>> >>> >     ...
>> >>> >     "match":{
>> >>> >         "dl_vlan": "0x1005"   # Describe sum of VLAN-ID(e.g. 5) |
>> >>> > OFPVID_PRESENT(0x1000)
>> >>> >     },
>> >>> >     ...
>> >>> >
>> >>> > Then, I think you should specify dl_vlan = 0xC00 | 0x1000 = 0x1C00
>> >>>
>> >>> I'm not sure to understand why I need the " | 0x1000".
>> >>
>> >>
>> >> OFPVID_PRESENT(0x1000) means you are going to match a packet which is
>> >> VLAN-tagged.
>> >>
>> >>>
>> >>>
>> >>> >
>> >>> >
>> >>> > Please refer to the following page.
>> >>> >
>> >>> >
>> >>> > http://ryu.readthedocs.org/en/latest/app/ofctl_rest.html#example-of-set-field-action
>> >>> >
>> >>> >
>> >>> > Thanks
>> >>>
>> >>> I checked this page but I didn't find an example with a way to only
>> >>> change some bits using the mask.
>> >>>
>> >>> My point is that I only wanna set the two first bits of the VLAN tag
>> >>> to 0 and I was wondering if it's possible with this action:
>> >>>
>> >>> actions":{
>> >>>         "type": "SET_FIELD",
>> >>>          "field": "dl_vlan",
>> >>>         "value": "0x00/0xC0"
>> >>>       }
>> >>
>> >>
>> >> Although the Set Field action reuses the OXM TLV structure, you can't
>> >> specify any mask here.
>> >>
>> >> Refer to the description of Set Field structure in page 70, Openflow
>> >> Switch
>> >> Specification 1.3.4:
>> >>
>> >> The field contains a header field described using a single OXM TLV
>> >> structure
>> >> (see 7.2.3). Set-Field
>> >> actions are defined by oxm_type, the type of the OXM TLV, and modify
>> >> the
>> >> corresponding header field
>> >> in the packet with the value of oxm_value, the payload of the OXM TLV.
>> >> The
>> >> value of oxm_hasmask
>> >> must be zero and no oxm_mask is included.
>> >>
>> >>
>> >>>
>> >>>
>> >>> Thanks,
>> >>> Clément
>> >>>
>> >>> >> On 11 December 2014 at 02:39, Yusuke Iwase
>> >>> >> <[email protected]>
>> >>> >> wrote:
>> >>> >>> Hi Clément,
>> >>> >>>
>> >>> >>> On 2014年12月10日 22:30, Clément Rault wrote:
>> >>> >>>> Hi,
>> >>> >>>>
>> >>> >>>> It there a way to force the actions present in the actions set to
>> >>> >>>> be
>> >>> >>>> immediately applied?
>> >>> >>>
>> >>> >>> If you use Apply-Actions instruction, please describe the "action"
>> >>> >>> directly
>> >>> >>> in actions array.
>> >>> >>>
>> >>> >>> e.g.)
>> >>> >>>
>> >>> >>>   curl -X POST -d '{
>> >>> >>>       "dpid": 1,
>> >>> >>>       "match":{
>> >>> >>>           "dl_vlan": 5
>> >>> >>>       },
>> >>> >>>       "actions":[
>> >>> >>>           {
>> >>> >>>               "type": "PUSH_VLAN",     # Push a new VLAN tag if a
>> >>> >>> input frame is non-VLAN-tagged
>> >>> >>>               "ethertype": 33024       # Ethertype 0x8100(=33024):
>> >>> >>> IEEE 802.1Q VLAN-tagged frame
>> >>> >>>           },
>> >>> >>>           {
>> >>> >>>               "type": "SET_FIELD",
>> >>> >>>               "field": "vlan_vid",     # Set VLAN ID
>> >>> >>>               "value": 4102            # Describe sum of
>> >>> >>> vlan_id(e.g.
>> >>> >>> 6) | OFPVID_PRESENT(0x1000=4096)
>> >>> >>>           },
>> >>> >>>           {
>> >>> >>>               "type": "OUTPUT",
>> >>> >>>               "port": 2
>> >>> >>>           }
>> >>> >>>       ]
>> >>> >>>    }' http://localhost:8080/stats/flowentry/add
>> >>> >>>
>> >>> >>>
>> >>> >>> For more details, please refer to "Description of Actions on
>> >>> >>> request
>> >>> >>> messages"
>> >>> >>>
>> >>> >>>
>> >>> >>> (http://ryu.readthedocs.org/en/latest/app/ofctl_rest.html#description-of-actions-on-request-messages)
>> >>> >>>
>> >>> >>>
>> >>> >>>>
>> >>> >>>> It's quite important for me to be able to do that so that I can
>> >>> >>>> use
>> >>> >>>> the metadata to communicate between tables but I couldn't find it
>> >>> >>>> in
>> >>> >>>> the documentation
>> >>> >>>> (http://ryu.readthedocs.org/en/latest/app/ofctl_rest.html).
>> >>> >>>
>> >>> >>> How about this scinario?
>> >>> >>> I hope it is helpful for you.
>> >>> >>>
>> >>> >>>
>> >>> >>> 1.Build topology
>> >>> >>> $ sudo mn --topo single,2 --mac --switch ovsk --controller remote
>> >>> >>>
>> >>> >>>
>> >>> >>> 2.Run ofctl_rest
>> >>> >>> $ sudo ryu-manager ryu.app.ofctl_rest
>> >>> >>>
>> >>> >>>
>> >>> >>> 3.Install Flow entries
>> >>> >>> # Install the Flow entries to communicate between table 0 and
>> >>> >>> table 1.
>> >>> >>> $ curl -X POST -d '{
>> >>> >>>     "dpid": "1",
>> >>> >>>     "table_id": 0,   # The 1st table
>> >>> >>>     "match":{
>> >>> >>>         "in_port":1  # From Host 1
>> >>> >>>     },
>> >>> >>>     "actions":[
>> >>> >>>         {
>> >>> >>>             "type": "WRITE_METADATA",   # Write metadata.
>> >>> >>>             "metadata": 0x1,            #  e.g.) "0x1" which shows
>> >>> >>> in_port value
>> >>> >>>             "metadata_mask": 0x3
>> >>> >>>         },
>> >>> >>>         {
>> >>> >>>             "type": "GOTO_TABLE",       # Describe next table
>> >>> >>>             "table_id": 1
>> >>> >>>         }
>> >>> >>>     ]
>> >>> >>>  }' http://localhost:8080/stats/flowentry/add
>> >>> >>>
>> >>> >>> $ curl -X POST -d '{
>> >>> >>>     "dpid": "1",
>> >>> >>>     "table_id": 0,   # The 1st table
>> >>> >>>     "match":{
>> >>> >>>         "in_port":2  # From Host 2
>> >>> >>>     },
>> >>> >>>     "actions":[
>> >>> >>>         {
>> >>> >>>             "type": "WRITE_METADATA",   # Write metadata.
>> >>> >>>             "metadata": 0x2,            #  e.g.) "0x2" which shows
>> >>> >>> in_port value
>> >>> >>>             "metadata_mask": 0x3
>> >>> >>>         },
>> >>> >>>         {
>> >>> >>>             "type": "GOTO_TABLE",       # Describe next table
>> >>> >>>             "table_id": 1
>> >>> >>>         }
>> >>> >>>     ]
>> >>> >>>  }' http://localhost:8080/stats/flowentry/add
>> >>> >>>
>> >>> >>>
>> >>> >>> # Install the Flow entries which use metadata to detect in_port.
>> >>> >>> $ curl -X POST -d '{
>> >>> >>>     "dpid": "1",
>> >>> >>>     "table_id": 1,              # The 2nd table
>> >>> >>>     "match":{
>> >>> >>>         "metadata": "0x1/0x03"  # "0x1/0x03" means in_port value
>> >>> >>> is
>> >>> >>> "1"
>> >>> >>>     },
>> >>> >>>     "actions":[
>> >>> >>>         {
>> >>> >>>             "type": "OUTPUT",   # Output to Host 2
>> >>> >>>             "port": 2
>> >>> >>>         }
>> >>> >>>     ]
>> >>> >>>  }' http://localhost:8080/stats/flowentry/add
>> >>> >>>
>> >>> >>> $ curl -X POST -d '{
>> >>> >>>     "dpid": "1",
>> >>> >>>     "table_id": 1,              # The 2nd table
>> >>> >>>     "match":{
>> >>> >>>         "metadata": "0x2/0x03"  # "0x2/0x03" means in_port value
>> >>> >>> is
>> >>> >>> "2"
>> >>> >>>     },
>> >>> >>>     "actions":[
>> >>> >>>         {
>> >>> >>>             "type": "OUTPUT",   # Output to Host 1
>> >>> >>>             "port": 1
>> >>> >>>         }
>> >>> >>>     ]
>> >>> >>>  }' http://localhost:8080/stats/flowentry/add
>> >>> >>>
>> >>> >>>
>> >>> >>> 3.Confirm Flow entries
>> >>> >>> $ curl -X GET http://localhost:8080/stats/flow/1 | jq .
>> >>> >>>
>> >>> >>>
>> >>> >>> 4.Ping test
>> >>> >>> mininet> h1 ping h2
>> >>> >>> PING 10.0.0.2 (10.0.0.2) 56(84) bytes of data.
>> >>> >>> 64 bytes from 10.0.0.2: icmp_seq=1 ttl=64 time=0.915 ms
>> >>> >>> 64 bytes from 10.0.0.2: icmp_seq=2 ttl=64 time=0.043 ms
>> >>> >>> 64 bytes from 10.0.0.2: icmp_seq=3 ttl=64 time=0.049 ms
>> >>> >>> ...
>> >>> >>>
>> >>> >>>
>> >>> >>> Tips for the above commands is described in the documentation.
>> >>> >>> (http://ryu.readthedocs.org/en/latest/app/ofctl_rest.html)
>> >>> >>>
>> >>> >>> Thanks
>> >>> >>>
>> >>> >>>>
>> >>> >>>> Thanks in advance.
>> >>> >>>> Best,
>> >>> >>>> Clément
>> >>> >>>>
>> >>> >>>>
>> >>> >>>>
>> >>> >>>> ------------------------------------------------------------------------------
>> >>> >>>> Download BIRT iHub F-Type - The Free Enterprise-Grade BIRT Server
>> >>> >>>> from Actuate! Instantly Supercharge Your Business Reports and
>> >>> >>>> Dashboards
>> >>> >>>> with Interactivity, Sharing, Native Excel Exports, App
>> >>> >>>> Integration &
>> >>> >>>> more
>> >>> >>>> Get technology previously reserved for billion-dollar
>> >>> >>>> corporations,
>> >>> >>>> FREE
>> >>> >>>>
>> >>> >>>>
>> >>> >>>> http://pubads.g.doubleclick.net/gampad/clk?id=164703151&iu=/4140/ostg.clktrk
>> >>> >>>> _______________________________________________
>> >>> >>>> Ryu-devel mailing list
>> >>> >>>> [email protected]
>> >>> >>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>> >>> >>>>
>> >>>
>> >>>
>> >>>
>> >>> ------------------------------------------------------------------------------
>> >>> Dive into the World of Parallel Programming. The Go Parallel Website,
>> >>> sponsored by Intel and developed in partnership with Slashdot Media,
>> >>> is
>> >>> your
>> >>> hub for all things parallel software development, from weekly thought
>> >>> leadership blogs to news, videos, case studies, tutorials and more.
>> >>> Take a
>> >>> look and join the conversation now. http://goparallel.sourceforge.net/
>> >>> _______________________________________________
>> >>> Ryu-devel mailing list
>> >>> [email protected]
>> >>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>> >>
>> >>
>> >>
>> >>
>> >> --
>> >> Sincerely,
>> >>
>> >> Wei-Li Tang
>> >> RD Engineer, Xinguard Inc.
>
>
>
>
> --
> Sincerely,
>
> Alex Tang

------------------------------------------------------------------------------
Dive into the World of Parallel Programming. The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net/
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel

Reply via email to