Skip to content

Commit f2d9cbc

Browse files
committed
code cleanup
1 parent 3790ed2 commit f2d9cbc

File tree

2 files changed

+40
-5
lines changed

2 files changed

+40
-5
lines changed

pytcp/tests/integration/test__packet_handler__ethernet_802_3__rx.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929

3030

3131
"""
32-
This module contains unit tests for the Packet Handler Ethernet 802.3 RX operations.
32+
This module contains integration tests for the Packet Handler Ethernet 802.3 RX operations.
3333
34-
pytcp/tests/unit/test__packet_handler__ethernet_802_3__rx.py
34+
pytcp/tests/integration/test__packet_handler__ethernet_802_3__rx.py
3535
3636
ver 3.0.4
3737
"""
@@ -49,6 +49,12 @@
4949
{
5050
"_description": "Ethernet 802.3 - dst unknown",
5151
"_frames_rx": [
52+
# Ethernet 802.3
53+
# Destination MAC : 02:00:00:99:99:99 (foreign)
54+
# Source MAC : 52:54:00:df:85:37
55+
# Length : 0x0000 (invalid/treated as LLC length)
56+
#
57+
# Summary: Frame addressed to an unknown MAC; stack drops before further processing.
5258
b"\x02\x00\x00\x99\x99\x99\x52\x54\x00\xdf\x85\x37\x00\x00",
5359
],
5460
"_expected__frames_tx": [],
@@ -61,6 +67,12 @@
6167
{
6268
"_description": "Ethernet 802.3 - malformed header",
6369
"_frames_rx": [
70+
# Ethernet 802.3
71+
# Destination MAC : 02:00:00:77:77:77 (foreign)
72+
# Source MAC : 52:54:00:df:85:37
73+
# Length : <missing byte> (frame too short)
74+
#
75+
# Summary: Malformed Ethernet 802.3 header (length field truncated) triggers parse drop.
6476
b"\x02\x00\x00\x77\x77\x77\x52\x54\x00\xdf\x85\x37\x00",
6577
],
6678
"_expected__frames_tx": [],

pytcp/tests/integration/test__packet_handler__ethernet_802_3__tx.py

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@
2929

3030

3131
"""
32-
This module contains unit tests for the Packet Handler Ethernet 802.3 TX operations.
32+
This module contains integration tests for the Packet Handler Ethernet 802.3 TX operations.
3333
34-
pytcp/tests/unit/test__packet_handler__ethernet_802_3__tx.py
34+
pytcp/tests/integration/test__packet_handler__ethernet_802_3__tx.py
3535
3636
ver 3.0.4
3737
"""
@@ -61,6 +61,12 @@
6161
"ethernet_802_3__dst": HOST_A__MAC_ADDRESS,
6262
},
6363
"_expected__frames_tx": [
64+
# Ethernet 802.3
65+
# Destination MAC : 02:00:00:00:00:91
66+
# Source MAC : 02:00:00:00:00:07
67+
# Length : 0x0000 (header-only frame)
68+
#
69+
# Summary: Raw 802.3 frame transmitted with caller-specified MAC addresses.
6470
b"\x02\x00\x00\x00\x00\x91\x02\x00\x00\x00\x00\x07\x00\x00",
6571
],
6672
"_expected__tx_status": TxStatus.PASSED__ETHERNET_802_3__TO_TX_RING,
@@ -77,7 +83,15 @@
7783
"ethernet_802_3__src": MAC__UNSPECIFIED,
7884
"ethernet_802_3__dst": HOST_A__MAC_ADDRESS,
7985
},
80-
"_expected__frames_tx": [b"\x02\x00\x00\x00\x00\x91\x02\x00\x00\x00\x00\x07\x00\x00"],
86+
"_expected__frames_tx": [
87+
# Ethernet 802.3
88+
# Destination MAC : 02:00:00:00:00:91
89+
# Source MAC : 02:00:00:00:00:07 (filled by stack)
90+
# Length : 0x0000 (header-only frame)
91+
#
92+
# Summary: Source MAC unspecified; stack fills in before transmitting the 802.3 header.
93+
b"\x02\x00\x00\x00\x00\x91\x02\x00\x00\x00\x00\x07\x00\x00",
94+
],
8195
"_expected__tx_status": TxStatus.PASSED__ETHERNET_802_3__TO_TX_RING,
8296
"_expected__packet_stats_tx": PacketStatsTx(
8397
ethernet_802_3__pre_assemble=1,
@@ -109,6 +123,15 @@
109123
"ethernet_802_3__payload": RawAssembler(raw__payload=bytes(range(16))),
110124
},
111125
"_expected__frames_tx": [
126+
# Ethernet 802.3
127+
# Destination MAC : 02:00:00:00:00:91
128+
# Source MAC : 02:00:00:00:00:07
129+
# Length : 0x0010 (16 bytes of payload)
130+
#
131+
# Payload
132+
# Bytes : 00..0f (RawAssembler content)
133+
#
134+
# Summary: 802.3 frame with a 16-byte LLC payload assembled by RawAssembler.
112135
b"\x02\x00\x00\x00\x00\x91\x02\x00\x00\x00\x00\x07\x00\x10\x00\x01"
113136
b"\x02\x03\x04\x05\x06\x07\x08\x09\x0a\x0b\x0c\x0d\x0e\x0f",
114137
],

0 commit comments

Comments
 (0)