Skip to content

Commit 0538526

Browse files
committed
code cleanup
1 parent 9f380aa commit 0538526

File tree

3 files changed

+65
-9
lines changed

3 files changed

+65
-9
lines changed

net_proto/tests/unit/protocols/ethernet_802_3/test__ethernet_802_3__assembler__operation.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@
6969
"payload=RawAssembler(raw__payload=b'0123456789ABCDEF'))"
7070
),
7171
"__bytes__": (
72+
# Ethernet 802.3
73+
# Destination MAC : 11:22:33:44:55:66
74+
# Source MAC : 77:88:99:aa:bb:cc
75+
# Length : 0x0010 (16 bytes)
76+
#
77+
# Summary : Unicast 802.3 frame with 16-byte LLC payload.
7278
b"\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\x00\x10"
7379
b"\x30\x31\x32\x33\x34\x35\x36\x37\x38\x39\x41\x42\x43\x44"
7480
b"\x45\x46"
@@ -106,6 +112,12 @@
106112
f"payload=RawAssembler(raw__payload=b'{"X" * ETHERNET_802_3__PAYLOAD__MAX_LEN}'))"
107113
),
108114
"__bytes__": (
115+
# Ethernet 802.3
116+
# Destination MAC : a1:b2:c3:d4:e5:f6
117+
# Source MAC : 11:12:13:14:15:16
118+
# Length : 0x05dc (1500 bytes)
119+
#
120+
# Summary : Unicast 802.3 frame at maximum payload size.
109121
b"\xa1\xb2\xc3\xd4\xe5\xf6\x11\x12\x13\x14\x15\x16\x05\xdc"
110122
+ b"X" * ETHERNET_802_3__PAYLOAD__MAX_LEN
111123
),

net_proto/tests/unit/protocols/ethernet_802_3/test__ethernet_802_3__parser__integrity_checks.py

Lines changed: 33 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,16 @@
5454
"The frame length is less than the value of the 'ETHERNET_802_3__HEADER__LEN' " "constant."
5555
),
5656
"_args": [
57-
b"\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\x00",
57+
(
58+
# Ethernet 802.3
59+
# Destination MAC : 11:22:33:44:55:66
60+
# Source MAC : 77:88:99:aa:bb:cc
61+
# Length : 0x0000 (truncated header)
62+
# Frame length : 13 bytes (< 14-byte header minimum)
63+
#
64+
# Summary : Header cut short by one byte.
65+
b"\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\x00"
66+
),
5867
],
5968
"_kwargs": {},
6069
"_results": {
@@ -65,10 +74,19 @@
6574
},
6675
},
6776
{
68-
"_description": ("The 'dlen' field value is different than the actual payload length."),
77+
"_description": "The 'dlen' field value is different than the actual payload length.",
6978
"_args": [
70-
b"\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\x00\x10\x30\x31"
71-
b"\x32\x33\x34\x35\x36\x37\x38\x39\x41\x42\x43\x44\x45\x46\x47",
79+
(
80+
# Ethernet 802.3
81+
# Destination MAC : 11:22:33:44:55:66
82+
# Source MAC : 77:88:99:aa:bb:cc
83+
# Length : 0x0010 (16 bytes)
84+
# Payload bytes : 17
85+
#
86+
# Summary : Declared length 16 bytes but frame carries 17-byte payload.
87+
b"\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\x00\x10\x30\x31"
88+
b"\x32\x33\x34\x35\x36\x37\x38\x39\x41\x42\x43\x44\x45\x46\x47"
89+
),
7290
],
7391
"_kwargs": {},
7492
"_results": {
@@ -81,8 +99,17 @@
8199
{
82100
"_description": "Ethernet 802.3 packet (III).",
83101
"_args": [
84-
b"\xa1\xb2\xc3\xd4\xe5\xf6\x11\x12\x13\x14\x15\x16\x05\xdd"
85-
+ b"X" * (ETHERNET_802_3__PAYLOAD__MAX_LEN + 1),
102+
(
103+
# Ethernet 802.3
104+
# Destination MAC : a1:b2:c3:d4:e5:f6
105+
# Source MAC : 11:12:13:14:15:16
106+
# Length : 0x05dd (1501 bytes)
107+
# Payload bytes : 1501 (> 1500 maximum)
108+
#
109+
# Summary : Frame exceeds Ethernet 802.3 maximum payload size.
110+
b"\xa1\xb2\xc3\xd4\xe5\xf6\x11\x12\x13\x14\x15\x16\x05\xdd"
111+
+ b"X" * (ETHERNET_802_3__PAYLOAD__MAX_LEN + 1)
112+
),
86113
],
87114
"_kwargs": {},
88115
"_results": {

net_proto/tests/unit/protocols/ethernet_802_3/test__ethernet_802_3__parser__operation.py

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,16 @@
5252
{
5353
"_description": "Ethernet 802.3 packet (I).",
5454
"_args": [
55-
b"\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\x00\x10\x30\x31"
56-
b"\x32\x33\x34\x35\x36\x37\x38\x39\x41\x42\x43\x44\x45\x46",
55+
(
56+
# Ethernet 802.3
57+
# Destination MAC : 11:22:33:44:55:66
58+
# Source MAC : 77:88:99:aa:bb:cc
59+
# Length : 0x0010 (16 bytes)
60+
#
61+
# Summary : Unicast 802.3 frame with 16-byte LLC payload.
62+
b"\x11\x22\x33\x44\x55\x66\x77\x88\x99\xaa\xbb\xcc\x00\x10\x30\x31"
63+
b"\x32\x33\x34\x35\x36\x37\x38\x39\x41\x42\x43\x44\x45\x46"
64+
),
5765
],
5866
"_kwargs": {},
5967
"_results": {
@@ -68,7 +76,16 @@
6876
{
6977
"_description": "Ethernet 802.3 packet (II).",
7078
"_args": [
71-
b"\xa1\xb2\xc3\xd4\xe5\xf6\x11\x12\x13\x14\x15\x16\x05\xdc" + b"X" * ETHERNET_802_3__PAYLOAD__MAX_LEN,
79+
(
80+
# Ethernet 802.3
81+
# Destination MAC : a1:b2:c3:d4:e5:f6
82+
# Source MAC : 11:12:13:14:15:16
83+
# Length : 0x05dc (1500 bytes)
84+
#
85+
# Summary : Unicast 802.3 frame at maximum payload size.
86+
b"\xa1\xb2\xc3\xd4\xe5\xf6\x11\x12\x13\x14\x15\x16\x05\xdc"
87+
+ b"X" * ETHERNET_802_3__PAYLOAD__MAX_LEN
88+
),
7289
],
7390
"_kwargs": {},
7491
"_results": {

0 commit comments

Comments
 (0)