Hi,
Thanks for the report.
On 2015年05月15日 05:57, Liu, Weijie wrote:
> I suggest that we add the field "wildcards" in the function "match_to_str" of
> "ryu/ryu/lib/ofctl_v1_0.py". That is,
>
> -----
> in ryu/ryu/lib/ofctl_v1_0.py:
> def match_to_str(m):
> return {
> 'wildcards': m.wildcards, # add it for showing wildcards
> 'dl_dst': haddr_to_str(m.dl_dst),
> ...
> ...
> ...
> 'tp_dst': m.tp_dst}
>
> Then we can use the binary form of 'wildcards' to decide which fields are
> wildcarded or exactly matched.
>
I think good.
On the other hand, to make it easier to understand the results, I've created a
patch for omitting the wild card.
What do you think of the follwoing?
def match_to_str(m):
- return {'dl_dst': haddr_to_str(m.dl_dst),
- 'dl_src': haddr_to_str(m.dl_src),
- 'dl_type': m.dl_type,
- 'dl_vlan': m.dl_vlan,
- 'dl_vlan_pcp': m.dl_vlan_pcp,
- 'in_port': m.in_port,
- 'nw_dst': nw_dst_to_str(m.wildcards, m.nw_dst),
- 'nw_proto': m.nw_proto,
- 'nw_tos': m.nw_tos,
- 'nw_src': nw_src_to_str(m.wildcards, m.nw_src),
- 'tp_src': m.tp_src,
- 'tp_dst': m.tp_dst}
+
+ match = {}
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_IN_PORT:
+ match['in_port'] = m.in_port
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_DL_VLAN:
+ match['dl_vlan'] = m.dl_vlan
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_DL_SRC:
+ match['dl_src'] = haddr_to_str(m.dl_src)
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_DL_DST:
+ match['dl_dst'] = haddr_to_str(m.dl_dst)
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_DL_TYPE:
+ match['dl_type'] = m.dl_type
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_NW_PROTO:
+ match['nw_proto'] = m.nw_proto
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_TP_SRC:
+ match['tp_src'] = m.tp_src
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_TP_DST:
+ match['tp_dst'] = m.tp_dst
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_NW_SRC_ALL:
+ match['nw_src'] = m.nw_src_to_str(m.wildcards, m.nw_src)
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_NW_DST_ALL:
+ match['nw_dst'] = nw_dst_to_str(m.wildcards, m.nw_dst)
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_DL_VLAN_PCP:
+ match['dl_vlan_pcp'] = m.dl_vlan_pcp
+
+ if ~m.wildcards & ofproto_v1_0.OFPFW_NW_TOS:
+ match['nw_tos'] = m.nw_tos
+
+ return match
before applying this patch:
$curl http://127.0.0.1:8080/stats/flow/1
{
"1": [
{
"actions": [
"OUTPUT:1"
],
"byte_count": 238,
"cookie": 0,
"duration_nsec": 585000000,
"duration_sec": 154,
"hard_timeout": 0,
"idle_timeout": 0,
"match": {
"dl_dst": "00:00:00:00:00:01",
"dl_src": "00:00:00:00:00:00",
"dl_type": 0,
"dl_vlan": 0,
"dl_vlan_pcp": 0,
"in_port": 2,
"nw_dst": "0.0.0.0",
"nw_proto": 0,
"nw_src": "0.0.0.0",
"nw_tos": 0,
"tp_dst": 0,
"tp_src": 0
},
"packet_count": 3,
"priority": 32768,
"table_id": 0
},
{
"actions": [
"OUTPUT:2"
],
"byte_count": 140,
"cookie": 0,
"duration_nsec": 583000000,
"duration_sec": 154,
"hard_timeout": 0,
"idle_timeout": 0,
"match": {
"dl_dst": "00:00:00:00:00:02",
"dl_src": "00:00:00:00:00:00",
"dl_type": 0,
"dl_vlan": 0,
"dl_vlan_pcp": 0,
"in_port": 1,
"nw_dst": "0.0.0.0",
"nw_proto": 0,
"nw_src": "0.0.0.0",
"nw_tos": 0,
"tp_dst": 0,
"tp_src": 0
},
"packet_count": 2,
"priority": 32768,
"table_id": 0
}
]
}
after applying this patch:
$curl http://127.0.0.1:8080/stats/flow/1
{
"1": [
{
"actions": [
"OUTPUT:1"
],
"byte_count": 238,
"cookie": 0,
"duration_nsec": 593000000,
"duration_sec": 12,
"hard_timeout": 0,
"idle_timeout": 0,
"match": {
"dl_dst": "00:00:00:00:00:01",
"in_port": 2
},
"packet_count": 3,
"priority": 32768,
"table_id": 0
},
{
"actions": [
"OUTPUT:2"
],
"byte_count": 140,
"cookie": 0,
"duration_nsec": 591000000,
"duration_sec": 12,
"hard_timeout": 0,
"idle_timeout": 0,
"match": {
"dl_dst": "00:00:00:00:00:02",
"in_port": 1
},
"packet_count": 2,
"priority": 32768,
"table_id": 0
}
]
}
thanks
>
>
> ________________________________________
> From: Liu, Weijie
> Sent: Wednesday, May 13, 2015 23:31
> To: [email protected]
> Subject: RE: [Ryu-devel] [Ryu] Output from ryu.app.ofctl_rest
>
> Because from what I saw, the outputs of "exactly matching dl_vlan as value
> zero" and "dl_vlan wildcard matching" are the same! :(
>
> how can I tell the correct meaning from the output of ryu.app.ofctl_rest with
> OpenFlow 1.0?
>
> ________________________________________
> From: Liu, Weijie
> Sent: Wednesday, May 13, 2015 23:30
> To: Minoru TAKAHASHI
> Subject: RE: [Ryu-devel] [Ryu] Output from ryu.app.ofctl_rest
>
> Thanks.
>
> Now comes the question: how can I tell the correct meaning from the output of
> ryu.app.ofctl_rest with OpenFlow 1.0?
>
>
>
> ________________________________________
> From: Minoru TAKAHASHI [[email protected]]
> Sent: Wednesday, May 13, 2015 23:25
> To: Liu, Weijie
> Subject: Re: [Ryu-devel] [Ryu] Output from ryu.app.ofctl_rest
>
> Hi,
>
> On 2015年05月14日 12:54, Liu, Weijie wrote:
>> Hi, Minoru,
>>
>> (1) Are you sure about that? I disagree with your answer of "exactly
>> matching dl_vlan as value zero is correct".
>>
>> Because this flow rule is from simple_switch.py; there is no dl_vlan
>> matching here. Therefore, I think "It should be considered as a wildcard
>> matching".
>
> Oh, Sorry!
> I was talking about OpenFlow1.2 and later.
> "It should be considered as a wildcard matching" is correct.
>
> thanks,
>
>>
>> (2) Actually, I am using Openflow 1.0. I am not sure whether you are saying
>> about other version of Openflow.
>>
>>
>> Thanks a lot.
>> Weijie
>>
>>
>> ________________________________________
>> From: Minoru TAKAHASHI [[email protected]]
>> Sent: Wednesday, May 13, 2015 20:19
>> To: Liu, Weijie; [email protected]
>> Subject: Re: [Ryu-devel] [Ryu] Output from ryu.app.ofctl_rest
>>
>> Hi,
>>
>> On 2015年05月14日 01:44, Liu, Weijie wrote:
>>> Hi,
>>>
>>> I have a question when I read the output of 'GET /stats/flow/1' of
>>> ryu.app.ofctl_rest. You know, I want to use this command to see the flow
>>> rules in a switch's flow table.
>>>
>>> My question: In "match", there is a field like "dl_vlan: 0". It can be
>>> considered as a wildcard matching; but it can also be considered as exactly
>>> matching dl_vlan as value zero.
>>>
>>> How can I tell which of the two is correct?
>>
>> "exactly matching dl_vlan as value zero" is correct.
>>
>> Just for your infomation, how to read of "dl_vlan" field is as follows.
>>
>> "match": {"dl_vlan": "0-4095"}
>> -> Only packets with VLAN tag and VID equal
>>
>> "match": {"dl_vlan": "0x0000"}
>> -> Only packets without a VLAN tag
>>
>> "match": {"dl_vlan": "0x1000/0x1000"}
>> -> Only packets with a VLAN tag regardless of its value
>>
>> thanks,
>>
>>>
>>> Thanks.
>>> --
>>> Weijie Liu
>>> Department of Computer Science
>>> University of Illinois at Urbana-Champaign
>>> (217)819-6113
>>>
>>>
>>> ------------------------------------------------------------------------------
>>> One dashboard for servers and applications across Physical-Virtual-Cloud
>>> Widest out-of-the-box monitoring support with 50+ applications
>>> Performance metrics, stats and reports that give you Actionable Insights
>>> Deep dive visibility with transaction tracing using APM Insight.
>>> http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
>>>
>>>
>>>
>>> _______________________________________________
>>> Ryu-devel mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/ryu-devel
>>>
------------------------------------------------------------------------------
One dashboard for servers and applications across Physical-Virtual-Cloud
Widest out-of-the-box monitoring support with 50+ applications
Performance metrics, stats and reports that give you Actionable Insights
Deep dive visibility with transaction tracing using APM Insight.
http://ad.doubleclick.net/ddm/clk/290420510;117567292;y
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel