| Total Complexity | 2 |
| Total Lines | 37 |
| Duplicated Lines | 0 % |
| Changes | 0 | ||
| 1 | """Port Status message tests.""" |
||
| 2 | from pyof.foundation.basic_types import HWAddress |
||
| 3 | from pyof.v0x04.asynchronous.port_status import PortReason, PortStatus |
||
| 4 | from pyof.v0x04.common.port import Port, 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('v0x04', 'ofpt_port_status') |
||
| 16 | super().set_raw_dump_object(_new_portstatus) |
||
| 17 | super().set_minimum_size(80) |
||
| 18 | |||
| 19 | |||
| 20 | def _new_portstatus(): |
||
| 21 | """Crate new PortStatus and Port instances.""" |
||
| 22 | desc_name = 's1-eth1' |
||
| 23 | desc = Port(port_no=1, |
||
| 24 | hw_addr=HWAddress('62:43:e5:db:35:0a'), |
||
| 25 | name=desc_name, |
||
| 26 | config=0, |
||
| 27 | state=PortState.OFPPS_LIVE, |
||
| 28 | curr=PortFeatures.OFPPF_10GB_FD | PortFeatures.OFPPF_COPPER, |
||
| 29 | advertised=0, |
||
| 30 | supported=0, |
||
| 31 | peer=0, |
||
| 32 | curr_speed=10000000, |
||
| 33 | max_speed=0) |
||
| 34 | return PortStatus(xid=0, |
||
| 35 | reason=PortReason.OFPPR_MODIFY, |
||
| 36 | desc=desc) |
||
| 37 |