_get_table_stats()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 5
dl 0
loc 5
rs 10
c 0
b 0
f 0
cc 1
nop 0
1
"""Test TableStats message."""
2
from pyof.foundation.constants import OFP_MAX_TABLE_NAME_LEN
3
from pyof.v0x01.common.flow_match import FlowWildCards
4
from pyof.v0x01.controller2switch.common import StatsType, TableStats
5
from pyof.v0x01.controller2switch.stats_reply import StatsReply
6
from tests.unit.test_struct import TestStruct
7
8
9
class TestTableStats(TestStruct):
10
    """Test class for TableStats."""
11
12
    @classmethod
13
    def setUpClass(cls):
14
        """[Controller2Switch/TableStats] - size 64."""
15
        super().setUpClass()
16
        super().set_raw_dump_file('v0x01', 'ofpt_table_stats')
17
        super().set_raw_dump_object(StatsReply, xid=14,
18
                                    body_type=StatsType.OFPST_TABLE,
19
                                    flags=0, body=_get_table_stats())
20
        super().set_minimum_size(12)
21
22
23
def _get_table_stats():
24
    return TableStats(table_id=1,
25
                      name='X' * OFP_MAX_TABLE_NAME_LEN,
26
                      wildcards=FlowWildCards.OFPFW_TP_DST, max_entries=1,
27
                      active_count=10, count_lookup=10, count_matched=0)
28