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

Complexity

Total Complexity 3

Size/Duplication

Total Lines 37
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 3
eloc 25
dl 0
loc 37
rs 10
c 0
b 0
f 0

2 Functions

Rating   Name   Duplication   Size   Complexity  
A _get_packet_queue() 0 6 1
A _get_queue_properties() 0 6 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestQueueGetConfigReply.setUpClass() 0 9 1
1
"""Test for QueueGetConfigReply message."""
2
from pyof.v0x01.common.phy_port import Port
3
from pyof.v0x01.common.queue import (
4
    PacketQueue, QueueProperties, QueuePropHeader)
5
from pyof.v0x01.controller2switch import queue_get_config_reply
6
from tests.unit.test_struct import TestStruct
7
8
9
class TestQueueGetConfigReply(TestStruct):
10
    """Test for QueueGetConfigReply message."""
11
12
    @classmethod
13
    def setUpClass(cls):
14
        """[Controller2Switch/QueueGetConfigReply] - size 16."""
15
        super().setUpClass()
16
        super().set_raw_dump_file('v0x01', 'ofpt_queue_get_config_reply')
17
        super().set_raw_dump_object(queue_get_config_reply.QueueGetConfigReply,
18
                                    xid=1, port=Port.OFPP_ALL,
19
                                    queues=_get_packet_queue())
20
        super().set_minimum_size(16)
21
22
23
def _get_packet_queue():
24
    """Function used to return a PacketQueue instance."""
25
    packets = []
26
    packets.append(PacketQueue(queue_id=1, length=8,
27
                               properties=_get_queue_properties()))
28
    return packets
29
30
31
def _get_queue_properties():
32
    """Function used to return a list of queue properties."""
33
    properties = []
34
    properties.append(QueuePropHeader(
35
        queue_property=QueueProperties.OFPQT_MIN_RATE, length=12))
36
    return properties
37