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

TestDescStats.setUpClass()   A

Complexity

Conditions 1

Size

Total Lines 9
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 8
dl 0
loc 9
rs 10
c 0
b 0
f 0
cc 1
nop 1
1
"""Test DescStats message."""
2
from pyof.foundation.constants import DESC_STR_LEN
3
from pyof.v0x01.controller2switch.common import DescStats, StatsType
4
from pyof.v0x01.controller2switch.stats_reply import StatsReply
5
from tests.unit.test_struct import TestStruct
6
7
8
class TestDescStats(TestStruct):
9
    """Test class for TestDescStats."""
10
11
    @classmethod
12
    def setUpClass(cls):
13
        """[Controller2Switch/DescStats] - size 1056."""
14
        super().setUpClass()
15
        super().set_raw_dump_file('v0x01', 'ofpt_desc_stats_reply')
16
        super().set_raw_dump_object(StatsReply, xid=14,
17
                                    body_type=StatsType.OFPST_DESC,
18
                                    flags=0, body=_get_desc_stats())
19
        super().set_minimum_size(12)
20
21
22
def _get_desc_stats():
23
    """Function used to return desc_stat used by StatsReply instance."""
24
    content = 'A' * DESC_STR_LEN
25
    return DescStats(mfr_desc=content, hw_desc=content,
26
                     sw_desc=content, serial_num=content,
27
                     dp_desc=content)
28