| Total Complexity | 2 |
| Total Lines | 28 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 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 |