File: test_desc_stats.py

package info (click to toggle)
python-openflow 2021.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,224 kB
  • sloc: python: 6,906; sh: 4; makefile: 4
file content (27 lines) | stat: -rw-r--r-- 1,045 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
"""Test DescStats message."""
from pyof.foundation.constants import DESC_STR_LEN
from pyof.v0x01.controller2switch.common import DescStats, StatsType
from pyof.v0x01.controller2switch.stats_reply import StatsReply
from tests.unit.test_struct import TestStruct


class TestDescStats(TestStruct):
    """Test class for TestDescStats."""

    @classmethod
    def setUpClass(cls):
        """[Controller2Switch/DescStats] - size 1056."""
        super().setUpClass()
        super().set_raw_dump_file('v0x01', 'ofpt_desc_stats_reply')
        super().set_raw_dump_object(StatsReply, xid=14,
                                    body_type=StatsType.OFPST_DESC,
                                    flags=0, body=_get_desc_stats())
        super().set_minimum_size(12)


def _get_desc_stats():
    """Function used to return desc_stat used by StatsReply instance."""
    content = 'A' * DESC_STR_LEN
    return DescStats(mfr_desc=content, hw_desc=content,
                     sw_desc=content, serial_num=content,
                     dp_desc=content)