Completed
Pull Request — master (#606)
by Gleyberson
02:26
created

tests.unit.v0x01.test_controller2switch.test_queue_stats   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 16
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A _get_queue_stats() 0 4 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestQueueStats.setUpClass() 0 9 1
1
"""Test for QueueStats."""
2
from pyof.v0x01.controller2switch.common import QueueStats, StatsType
3
from pyof.v0x01.controller2switch.stats_reply import StatsReply
4
from tests.unit.test_struct import TestStruct
5
6
7
class TestQueueStats(TestStruct):
8
    """Test for QueueStats."""
9
10
    @classmethod
11
    def setUpClass(cls):
12
        """[Controller2Switch/QueueStats] - size 32."""
13
        super().setUpClass()
14
        super().set_raw_dump_file('v0x01', 'ofpt_queue_stats')
15
        super().set_raw_dump_object(StatsReply, xid=7,
16
                                    body_type=StatsType.OFPST_QUEUE,
17
                                    flags=0, body=_get_queue_stats())
18
        super().set_minimum_size(12)
19
20
21
def _get_queue_stats():
22
    """Function used to return a QueueStats instance."""
23
    return QueueStats(port_no=80, queue_id=5, tx_bytes=1,
24
                      tx_packets=3, tx_errors=2)
25