> On Tue, 15 Oct 2013 15:42:41 +0900 (JST)
> [email protected] (YAMAMOTO Takashi) wrote:
>
>>> On Tue, 15 Oct 2013 13:58:52 +0900
>>> YAMAMOTO Takashi <[email protected]> wrote:
>>>
>>>> Signed-off-by: YAMAMOTO Takashi <[email protected]>
>>>> ---
>>>> .../of13/4-57-ofp_group_stats_request.packet.json | 7 +++++++
>>>> .../json/of13/4-58-ofp_group_stats_reply.packet.json | 19
>>>> +++++++++++++++++++
>>>> 2 files changed, 26 insertions(+)
>>>> create mode 100644
>>>> ryu/tests/unit/ofproto/json/of13/4-57-ofp_group_stats_request.packet.json
>>>> create mode 100644
>>>> ryu/tests/unit/ofproto/json/of13/4-58-ofp_group_stats_reply.packet.json
>>>>
>>>> diff --git
>>>> a/ryu/tests/unit/ofproto/json/of13/4-57-ofp_group_stats_request.packet.json
>>>>
>>>> b/ryu/tests/unit/ofproto/json/of13/4-57-ofp_group_stats_request.packet.json
>>>> new file mode 100644
>>>> index 0000000..b200a81
>>>> --- /dev/null
>>>> +++
>>>> b/ryu/tests/unit/ofproto/json/of13/4-57-ofp_group_stats_request.packet.json
>>>> @@ -0,0 +1,7 @@
>>>> +{
>>>> + "OFPGroupStatsRequest": {
>>>> + "flags": 0,
>>>> + "group_id": 4294967292,
>>>> + "type": 6
>>>> + }
>>>> +}
>>>> diff --git
>>>> a/ryu/tests/unit/ofproto/json/of13/4-58-ofp_group_stats_reply.packet.json
>>>> b/ryu/tests/unit/ofproto/json/of13/4-58-ofp_group_stats_reply.packet.json
>>>> new file mode 100644
>>>> index 0000000..012f174
>>>> --- /dev/null
>>>> +++
>>>> b/ryu/tests/unit/ofproto/json/of13/4-58-ofp_group_stats_reply.packet.json
>>>> @@ -0,0 +1,19 @@
>>>> +{
>>>> + "OFPGroupStatsReply": {
>>>> + "body": [
>>>> + {
>>>> + "OFPGroupStats": {
>>>> + "byte_count": 12345,
>>>> + "duration_nsec": 609036000,
>>>> + "duration_sec": 9,
>>>> + "group_id": 1,
>>>> + "length": 56,
>>>> + "packet_count": 123,
>>>> + "ref_count": 2
>>>
>>> Can we use a reply packet including buckets?
>>
>> the test packet includes a ofp_bucket_counter.
>> our parser needs to be implemented.
>
> Then let's implement instead of adding incomplete code.
looks good to me. thanks.
YAMAMOTO Takashi
>
> diff --git a/ryu/ofproto/ofproto_v1_3_parser.py
> b/ryu/ofproto/ofproto_v1_3_parser.py
> index b12865e..8d35db2 100644
> --- a/ryu/ofproto/ofproto_v1_3_parser.py
> +++ b/ryu/ofproto/ofproto_v1_3_parser.py
> @@ -3982,16 +3982,48 @@ class OFPQueueStatsReply(OFPMultipartReply):
> super(OFPQueueStatsReply, self).__init__(datapath, **kwargs)
>
>
> -class OFPGroupStats(ofproto_parser.namedtuple('OFPGroupStats', (
> - 'length', 'group_id', 'ref_count', 'packet_count',
> - 'byte_count', 'duration_sec', 'duration_nsec'))):
> +class OFPBucketCounter(StringifyMixin):
> + def __init__(self, packet_count, byte_count):
> + super(OFPBucketCounter, self).__init__()
> + self.packet_count = packet_count
> + self.byte_count = byte_count
> +
> + @classmethod
> + def parser(cls, buf, offset):
> + packet_count, byte_count = struct.unpack_from(
> + ofproto_v1_3.OFP_BUCKET_COUNTER_PACK_STR, buf, offset)
> + return cls(packet_count, byte_count)
> +
> +
> +class OFPGroupStats(StringifyMixin):
> + def __init__(self, length=None, group_id=None, ref_count=None,
> + packet_count=None, byte_count=None, duration_sec=None,
> + duration_nsec=None, bucket_stats=None):
> + super(OFPGroupStats, self).__init__()
> + self.length = length
> + self.group_id = group_id
> + self.ref_count = ref_count
> + self.packet_count = packet_count
> + self.byte_count = byte_count
> + self.duration_sec = duration_sec
> + self.duration_nsec = duration_nsec
> + self.bucket_stats = bucket_stats
> +
> @classmethod
> def parser(cls, buf, offset):
> group = struct.unpack_from(ofproto_v1_3.OFP_GROUP_STATS_PACK_STR,
> buf, offset)
> - stats = cls(*group)
> - stats.length = ofproto_v1_3.OFP_GROUP_STATS_SIZE
> - return stats
> + group_stats = cls(*group)
> +
> + group_stats.bucket_stats = []
> + total_len = group_stats.length + offset
> + offset += ofproto_v1_3.OFP_GROUP_STATS_SIZE
> + while total_len > offset:
> + b = OFPBucketCounter.parser(buf, offset)
> + group_stats.bucket_stats.append(b)
> + offset += ofproto_v1_3.OFP_BUCKET_COUNTER_SIZE
> +
> + return group_stats
>
>
> @_set_stats_type(ofproto_v1_3.OFPMP_GROUP, OFPGroupStats)
> diff --git
> a/ryu/tests/unit/ofproto/json/of13/4-58-ofp_group_stats_reply.packet.json
> b/ryu/tests/unit/ofproto/json/of13/4-58-ofp_group_stats_reply.packet.json
> index 012f174..0caff1c 100644
> --- a/ryu/tests/unit/ofproto/json/of13/4-58-ofp_group_stats_reply.packet.json
> +++ b/ryu/tests/unit/ofproto/json/of13/4-58-ofp_group_stats_reply.packet.json
> @@ -3,6 +3,14 @@
> "body": [
> {
> "OFPGroupStats": {
> + "bucket_stats": [
> + {
> + "OFPBucketCounter": {
> + "byte_count": 2345,
> + "packet_count": 234
> + }
> + }
> + ],
> "byte_count": 12345,
> "duration_nsec": 609036000,
> "duration_sec": 9,
>
> ------------------------------------------------------------------------------
> October Webinars: Code for Performance
> Free Intel webinars can help you accelerate application performance.
> Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
> the latest Intel processors and coprocessors. See abstracts and register >
> http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
> _______________________________________________
> Ryu-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/ryu-devel
------------------------------------------------------------------------------
October Webinars: Code for Performance
Free Intel webinars can help you accelerate application performance.
Explore tips for MPI, OpenMP, advanced profiling, and more. Get the most from
the latest Intel processors and coprocessors. See abstracts and register >
http://pubads.g.doubleclick.net/gampad/clk?id=60135031&iu=/4140/ostg.clktrk
_______________________________________________
Ryu-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ryu-devel