Total Complexity | 2 |
Total Lines | 28 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | """Test VendorStats message.""" |
||
2 | from pyof.v0x01.controller2switch.common import StatsType, VendorStats |
||
3 | from pyof.v0x01.controller2switch.stats_request import StatsRequest |
||
4 | from tests.unit.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=StatsType.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 |