Passed
Push — master ( 945c40...91495d )
by Beraldo
02:05
created

_get_vendor_stats()   A

Complexity

Conditions 1

Size

Total Lines 4

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 4
rs 10
cc 1
1
"""Test VendorStats message."""
2
from pyof.v0x01.controller2switch.common import StatsTypes, VendorStats
3
from pyof.v0x01.controller2switch.stats_request import StatsRequest
4
from tests.test_struct import TestStruct
5
6
7
class TestVendorStats(TestStruct):
8
    """Test class for TestVendorStats.
9
10
    The dump and unpacked data were provided by user bug report.
11
    """
12
13
    @classmethod
14
    def setUpClass(cls):
15
        """[Controller2Switch/VendorStats] - size 1056."""
16
        super().setUpClass()
17
        super().set_raw_dump_file('v0x01', 'ofpt_vendor_stats_reply')
18
        super().set_raw_dump_object(StatsRequest, xid=4,
19
                                    body_type=StatsTypes.OFPST_VENDOR,
20
                                    flags=0, body=_get_vendor_stats())
21
        super().set_minimum_size(12)
22
23
24
def _get_vendor_stats():
25
    """Return vendor stats found in StatsReply.body."""
26
    body = b'\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff\x00\x00\xff\x00\x00\x00'
27
    return VendorStats(vendor=0x2320, body=body)
28