Passed
Push — master ( b50e97...feedcb )
by Humberto
01:28 queued 14s
created

TestFlowRemoved.setUpClass()   A

Complexity

Conditions 1

Size

Total Lines 19
Code Lines 17

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 17
dl 0
loc 19
rs 9.55
c 0
b 0
f 0
cc 1
nop 1
1
"""Testing FlowRemoved message."""
2
from pyof.foundation.basic_types import HWAddress, IPAddress
3
from pyof.v0x01.asynchronous.flow_removed import FlowRemoved, FlowRemovedReason
4
from pyof.v0x01.common.flow_match import Match
5
from tests.unit.test_struct import TestStruct
6
7
8
class TestFlowRemoved(TestStruct):
9
    """Test the FlowRemoved message."""
10
11
    @classmethod
12
    def setUpClass(cls):
13
        """Setup TestStruct."""
14
        reason = FlowRemovedReason.OFPRR_IDLE_TIMEOUT
15
        match = Match(in_port=80, dl_vlan=1, dl_vlan_pcp=1, dl_type=1,
16
                      nw_tos=1, nw_proto=1, tp_src=80, tp_dst=80,
17
                      dl_src=HWAddress('00:00:00:00:00:00'),
18
                      dl_dst=HWAddress('00:00:00:00:00:00'),
19
                      nw_src=IPAddress('192.168.0.1'),
20
                      nw_dst=IPAddress('192.168.0.2'))
21
22
        super().setUpClass()
23
        super().set_raw_dump_file('v0x01', 'ofpt_flow_removed')
24
        super().set_raw_dump_object(FlowRemoved, xid=12,
25
                                    match=match, cookie=0, priority=1,
26
                                    reason=reason, duration_sec=4,
27
                                    duration_nsec=23, idle_timeout=9,
28
                                    packet_count=10, byte_count=4)
29
        super().set_minimum_size(88)
30