File: test_aggregate_stats.py

package info (click to toggle)
python-openflow 2021.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,224 kB
  • sloc: python: 6,906; sh: 4; makefile: 4
file content (26 lines) | stat: -rw-r--r-- 994 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
"""Aggregate stats request message."""
from pyof.v0x04.controller2switch.common import MultipartType
from pyof.v0x04.controller2switch.multipart_reply import (
    AggregateStatsReply, MultipartReply)
from tests.unit.test_struct import TestStruct


class TestAggregateStats(TestStruct):
    """Aggregate stats message."""

    @classmethod
    def setUpClass(cls):
        """Configure raw file and its object in parent class (TestDump)."""
        mp_type = MultipartType.OFPMP_AGGREGATE
        super().setUpClass()
        super().set_raw_dump_file('v0x04', 'ofpt_aggregate_stats')
        super().set_raw_dump_object(MultipartReply, xid=1,
                                    multipart_type=mp_type,
                                    flags=0,
                                    body=_get_body())
        super().set_minimum_size(16)


def _get_body():
    """Return the body used by MultipartReply message."""
    return AggregateStatsReply(packet_count=2, byte_count=220, flow_count=2)