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

tests.unit.v0x01.test_asynchronous.test_port_status   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 31
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
wmc 2
eloc 22
dl 0
loc 31
rs 10
c 0
b 0
f 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A _new_portstatus() 0 11 1

1 Method

Rating   Name   Duplication   Size   Complexity  
A TestPortStatus.setUpClass() 0 7 1
1
"""Port Status message tests."""
2
from pyof.foundation.basic_types import HWAddress
3
from pyof.v0x01.asynchronous.port_status import PortReason, PortStatus
4
from pyof.v0x01.common.phy_port import PhyPort, PortFeatures, PortState
5
from tests.unit.test_struct import TestStruct
6
7
8
class TestPortStatus(TestStruct):
9
    """Test the Port Status message."""
10
11
    @classmethod
12
    def setUpClass(cls):
13
        """Configure raw file and its object in parent class (TestDump)."""
14
        super().setUpClass()
15
        super().set_raw_dump_file('v0x01', 'ofpt_port_status')
16
        super().set_raw_dump_object(_new_portstatus)
17
        super().set_minimum_size(64)
18
19
20
def _new_portstatus():
21
    """Crate new PortStatus and PhyPort instances."""
22
    desc_name = 's1-eth1'
23
    desc = PhyPort(port_no=1,
24
                   hw_addr=HWAddress('9a:da:11:8a:f4:0c'),
25
                   name=desc_name,
26
                   state=PortState.OFPPS_STP_LISTEN,
27
                   curr=PortFeatures.OFPPF_10GB_FD | PortFeatures.OFPPF_COPPER)
28
    return PortStatus(xid=0,
29
                      reason=PortReason.OFPPR_MODIFY,
30
                      desc=desc)
31