Passed
Push — master ( b50e97...feedcb )
by Humberto
01:28 queued 14s
created

TestGroupStats.setUpClass()   A

Complexity

Conditions 1

Size

Total Lines 10
Code Lines 9

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 9
dl 0
loc 10
rs 9.95
c 0
b 0
f 0
cc 1
nop 1
1
"""Group stats message."""
2
from pyof.v0x04.common.action import ActionOutput, ListOfActions
3
from pyof.v0x04.common.flow_instructions import (
4
    InstructionApplyAction, ListOfInstruction)
5
from pyof.v0x04.common.flow_match import (
6
    Match, MatchType, OxmClass, OxmOfbMatchField, OxmTLV)
7
from pyof.v0x04.common.port import PortNo
8
from pyof.v0x04.controller2switch.common import (
9
    BucketCounter, ListOfBucketCounter, MultipartType)
10
from pyof.v0x04.controller2switch.multipart_reply import (
11
    GroupStats, MultipartReply)
12
from tests.unit.test_struct import TestStruct
13
14
15
class TestGroupStats(TestStruct):
16
    """Group stats message."""
17
18
    @classmethod
19
    def setUpClass(cls):
20
        """Configure raw file and its object in parent class (TestDump)."""
21
        super().setUpClass()
22
        super().set_raw_dump_file('v0x04', 'ofpt_group_stats')
23
        super().set_raw_dump_object(MultipartReply, xid=1,
24
                                    multipart_type=MultipartType.OFPMP_GROUP,
25
                                    flags=0,
26
                                    body=_get_body())
27
        super().set_minimum_size(16)
28
29
30
def _get_body():
31
    """Return the body used by MultipartReply message."""
32
    bs = ListOfBucketCounter([BucketCounter(packet_count=0, byte_count=0),
33
                              BucketCounter(packet_count=0, byte_count=0)])
34
    return GroupStats(length=72, group_id=1, ref_count=0,
35
                      packet_count=0, byte_count=0, duration_sec=14,
36
                      duration_nsec=837000000, bucket_stats=bs)
37