Total Complexity | 2 |
Total Lines | 31 |
Duplicated Lines | 0 % |
Changes | 0 |
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 |