Skip to content

Commit abac9fa

Browse files
committed
code cleanup
1 parent 74003e3 commit abac9fa

File tree

1 file changed

+191
-2
lines changed

1 file changed

+191
-2
lines changed

pytcp/tests/integration/test__packet_handler__icmp6__tx.py

Lines changed: 191 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 ICMPv6 TX operations.
32+
This module contains integration tests for the Packet Handler ICMPv6 TX operations.
3333
34-
pytcp/tests/unit/test__packet_handler__icmp6__tx.py
34+
pytcp/tests/integration/test__packet_handler__icmp6__tx.py
3535
3636
ver 3.0.4
3737
"""
@@ -111,6 +111,28 @@
111111
),
112112
},
113113
"_expected__frames_tx": [
114+
# Ethernet II
115+
# Destination MAC : 02:00:00:00:00:91
116+
# Source MAC : 02:00:00:00:00:07
117+
# Ethertype : 0x86DD (IPv6)
118+
# Frame length : 344 bytes
119+
#
120+
# IPv6
121+
# Version / Traffic Class / Flow Label : 0x60000000
122+
# Payload Length : 0x0148 (328 bytes)
123+
# Next Header : 58 (ICMPv6)
124+
# Hop Limit : 64
125+
# Source IP : 2001:db8:0:1::7
126+
# Destination IP : 2001:db8:0:1::91
127+
#
128+
# ICMPv6
129+
# Type/Code : 128 / 0 (Echo Request)
130+
# Checksum : 0xf53e
131+
# Identifier : 12345
132+
# Sequence : 54320
133+
# Payload : 320 bytes ("0123456789ABCDEF" * 20)
134+
#
135+
# Summary: ICMPv6 echo request with large payload headed to host A.
114136
b"\x02\x00\x00\x00\x00\x91\x02\x00\x00\x00\x00\x07\x86\xdd\x60\x00"
115137
b"\x00\x00\x01\x48\x3a\x40\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
116138
b"\x00\x00\x00\x00\x00\x07\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
@@ -161,6 +183,28 @@
161183
),
162184
},
163185
"_expected__frames_tx": [
186+
# Ethernet II
187+
# Destination MAC : 02:00:00:00:00:91
188+
# Source MAC : 02:00:00:00:00:07
189+
# Ethertype : 0x86DD (IPv6)
190+
# Frame length : 344 bytes
191+
#
192+
# IPv6
193+
# Version / Traffic Class / Flow Label : 0x60000000
194+
# Payload Length : 0x0148 (328 bytes)
195+
# Next Header : 58 (ICMPv6)
196+
# Hop Limit : 64
197+
# Source IP : 2001:db8:0:1::7
198+
# Destination IP : 2001:db8:0:1::91
199+
#
200+
# ICMPv6
201+
# Type/Code : 129 / 0 (Echo Reply)
202+
# Checksum : 0xf43e
203+
# Identifier : 12345
204+
# Sequence : 54320
205+
# Payload : 320 bytes mirrored from the request
206+
#
207+
# Summary: ICMPv6 echo reply returning the same payload to host A.
164208
b"\x02\x00\x00\x00\x00\x91\x02\x00\x00\x00\x00\x07\x86\xdd\x60\x00"
165209
b"\x00\x00\x01\x48\x3a\x40\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
166210
b"\x00\x00\x00\x00\x00\x07\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
@@ -210,6 +254,26 @@
210254
),
211255
},
212256
"_expected__frames_tx": [
257+
# Ethernet II
258+
# Destination MAC : 02:00:00:00:00:91
259+
# Source MAC : 02:00:00:00:00:07
260+
# Ethertype : 0x86DD (IPv6)
261+
# Frame length : 1266 bytes
262+
#
263+
# IPv6
264+
# Version / Traffic Class / Flow Label : 0x60000000
265+
# Payload Length : 0x04d8 (1240 bytes)
266+
# Next Header : 58 (ICMPv6)
267+
# Hop Limit : 64
268+
# Source IP : 2001:db8:0:1::7
269+
# Destination IP : 2001:db8:0:1::91
270+
#
271+
# ICMPv6
272+
# Type/Code : 1 / 4 (Destination Unreachable - Port)
273+
# Checksum : 0x6741
274+
# Payload : 1232 bytes (original datagram excerpt)
275+
#
276+
# Summary: ICMPv6 destination unreachable (port) with a large quoted packet body.
213277
b"\x02\x00\x00\x00\x00\x91\x02\x00\x00\x00\x00\x07\x86\xdd\x60\x00"
214278
b"\x00\x00\x04\xd8\x3a\x40\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
215279
b"\x00\x00\x00\x00\x00\x07\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
@@ -318,6 +382,25 @@
318382
),
319383
},
320384
"_expected__frames_tx": [
385+
# Ethernet II
386+
# Destination MAC : 33:33:00:00:00:02 (all-routers multicast)
387+
# Source MAC : 02:00:00:00:00:07
388+
# Ethertype : 0x86DD (IPv6)
389+
# Frame length : 118 bytes
390+
#
391+
# IPv6
392+
# Version / Traffic Class / Flow Label : 0x60000000
393+
# Payload Length : 0x0010 (16 bytes)
394+
# Next Header : 58 (ICMPv6)
395+
# Hop Limit : 255
396+
# Source IP : 2001:db8:0:1::7
397+
# Destination IP : ff02::2 (all routers)
398+
#
399+
# ICMPv6 Router Solicitation
400+
# Options : Source Link-Layer (02:00:00:00:00:07)
401+
# Checksum : 0x4ae7
402+
#
403+
# Summary: Router solicitation advertising our MAC to local routers.
321404
b"\x33\x33\x00\x00\x00\x02\x02\x00\x00\x00\x00\x07\x86\xdd\x60\x00"
322405
b"\x00\x00\x00\x10\x3a\xff\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
323406
b"\x00\x00\x00\x00\x00\x07\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -364,6 +447,30 @@
364447
),
365448
},
366449
"_expected__frames_tx": [
450+
# Ethernet II
451+
# Destination MAC : 33:33:00:00:00:01 (all-nodes multicast)
452+
# Source MAC : 02:00:00:00:00:07
453+
# Ethertype : 0x86DD (IPv6)
454+
# Frame length : 170 bytes
455+
#
456+
# IPv6
457+
# Version / Traffic Class / Flow Label : 0x60000000
458+
# Payload Length : 0x0038 (56 bytes)
459+
# Next Header : 58 (ICMPv6)
460+
# Hop Limit : 255
461+
# Source IP : 2001:db8:0:1::7
462+
# Destination IP : ff02::1 (all nodes)
463+
#
464+
# ICMPv6 Router Advertisement
465+
# Checksum : 0x61b9
466+
# Hop Limit : 64
467+
# Flags : M=1, O=1
468+
# Router Lifetime : 1800 s
469+
# Reachable Time : 900 ms
470+
# Retrans Timer : 300 ms
471+
# Options : SLLA + Prefix Information (2001:db8:0:1::/64)
472+
#
473+
# Summary: Router advertisement broadcasting stack parameters to local hosts.
367474
b"\x33\x33\x00\x00\x00\x01\x02\x00\x00\x00\x00\x07\x86\xdd\x60\x00"
368475
b"\x00\x00\x00\x38\x3a\xff\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
369476
b"\x00\x00\x00\x00\x00\x07\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -402,6 +509,26 @@
402509
),
403510
},
404511
"_expected__frames_tx": [
512+
# Ethernet II
513+
# Destination MAC : 02:00:00:00:00:91
514+
# Source MAC : 02:00:00:00:00:07
515+
# Ethertype : 0x86DD (IPv6)
516+
# Frame length : 118 bytes
517+
#
518+
# IPv6
519+
# Version / Traffic Class / Flow Label : 0x60000000
520+
# Payload Length : 0x0020 (32 bytes)
521+
# Next Header : 58 (ICMPv6)
522+
# Hop Limit : 255
523+
# Source IP : 2001:db8:0:1::7
524+
# Destination IP : 2001:db8:0:1::91
525+
#
526+
# ICMPv6 Neighbor Advertisement
527+
# Flags : 0x60000000 (Solicited + Override)
528+
# Target : 2001:db8:0:1::7
529+
# Options : TLLA (02:00:00:00:00:07)
530+
#
531+
# Summary: Neighbor advertisement conveying our MAC and target address to host A.
405532
b"\x02\x00\x00\x00\x00\x91\x02\x00\x00\x00\x00\x07\x86\xdd\x60\x00"
406533
b"\x00\x00\x00\x20\x3a\xff\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
407534
b"\x00\x00\x00\x00\x00\x07\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
@@ -436,6 +563,26 @@
436563
),
437564
},
438565
"_expected__frames_tx": [
566+
# Ethernet II
567+
# Destination MAC : 33:33:00:00:00:91 (solicited-node multicast for host A)
568+
# Source MAC : 02:00:00:00:00:07
569+
# Ethertype : 0x86DD (IPv6)
570+
# Frame length : 118 bytes
571+
#
572+
# IPv6
573+
# Version / Traffic Class / Flow Label : 0x60000000
574+
# Payload Length : 0x0020 (32 bytes)
575+
# Next Header : 58 (ICMPv6)
576+
# Hop Limit : 255
577+
# Source IP : 2001:db8:0:1::7
578+
# Destination IP : ff02::1:ff00:91
579+
#
580+
# ICMPv6 Neighbor Solicitation
581+
# Flags : 0x00000000
582+
# Target : 2001:db8:0:1::91
583+
# Options : SLLA (02:00:00:00:00:07)
584+
#
585+
# Summary: Neighbor solicitation probing host A for its MAC address.
439586
b"\x33\x33\xff\x00\x00\x91\x02\x00\x00\x00\x00\x07\x86\xdd\x60\x00"
440587
b"\x00\x00\x00\x20\x3a\xff\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
441588
b"\x00\x00\x00\x00\x00\x07\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -468,6 +615,26 @@
468615
),
469616
},
470617
"_expected__frames_tx": [
618+
# Ethernet II
619+
# Destination MAC : 33:33:ff:00:00:07 (solicited-node multicast)
620+
# Source MAC : 02:00:00:00:00:07
621+
# Ethertype : 0x86DD (IPv6)
622+
# Frame length : 94 bytes
623+
#
624+
# IPv6
625+
# Version / Traffic Class / Flow Label : 0x60000000
626+
# Payload Length : 0x0018 (24 bytes)
627+
# Next Header : 58 (ICMPv6)
628+
# Hop Limit : 255
629+
# Source IP : ::
630+
# Destination IP : ff02::1:ff00:7
631+
#
632+
# ICMPv6 Neighbor Solicitation (DAD)
633+
# Flags : 0x00000000
634+
# Target : 2001:db8:0:1::7
635+
# Options : none
636+
#
637+
# Summary: DAD neighbor solicitation emitted with unspecified source.
471638
b"\x33\x33\xff\x00\x00\x07\x02\x00\x00\x00\x00\x07\x86\xdd\x60\x00"
472639
b"\x00\x00\x00\x18\x3a\xff\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00"
473640
b"\x00\x00\x00\x00\x00\x00\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00"
@@ -524,6 +691,28 @@
524691
),
525692
},
526693
"_expected__frames_tx": [
694+
# Ethernet II
695+
# Destination MAC : 33:33:00:00:00:16 (MLDv2 routers multicast)
696+
# Source MAC : 02:00:00:00:00:07
697+
# Ethertype : 0x86DD (IPv6)
698+
# Frame length : 150 bytes
699+
#
700+
# IPv6
701+
# Version / Traffic Class / Flow Label : 0x60000000
702+
# Payload Length : 0x0080 (128 bytes)
703+
# Next Header : 58 (ICMPv6)
704+
# Hop Limit : 1
705+
# Source IP : 2001:db8:0:1::7
706+
# Destination IP : ff02::16 (MLDv2 routers)
707+
#
708+
# ICMPv6 MLDv2 Report
709+
# Record Count : 6
710+
# Records : {CHANGE_TO_EXCLUDE ff02::a, CHANGE_TO_INCLUDE ff02::b,
711+
# MODE_IS_EXCLUDE ff02::c, MODE_IS_INCLUDE ff02::d,
712+
# ALLOW_NEW_SOURCES ff02::e, ALLOW_NEW_SOURCES ff02::f}
713+
# Checksum : 0x3508
714+
#
715+
# Summary: MLDv2 report advertising multicast memberships to routers.
527716
b"\x33\x33\x00\x00\x00\x16\x02\x00\x00\x00\x00\x07\x86\xdd\x60\x00"
528717
b"\x00\x00\x00\x80\x3a\x01\x20\x01\x0d\xb8\x00\x00\x00\x01\x00\x00"
529718
b"\x00\x00\x00\x00\x00\x07\xff\x02\x00\x00\x00\x00\x00\x00\x00\x00"

0 commit comments

Comments
 (0)