tests.unit.v0x01.test_controller2switch.test_table_stats   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 28
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 20
dl 0
loc 28
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A _get_table_stats() 0 5 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestTableStats.setUpClass() 0 9 1
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