86890704fd
todo: add documentation & wireshark dissector
48 lines
1.6 KiB
Text
Executable file
48 lines
1.6 KiB
Text
Executable file
% LACP unit tests
|
|
#
|
|
# Type the following command to launch start the tests:
|
|
# $ test/run_tests -P "load_contrib('lacp')" -t scapy/contrib/lacp.uts
|
|
|
|
+ LACP
|
|
|
|
= Build & dissect LACP
|
|
|
|
# 1 0.000000 CiscoInc_12:0f:0d Slow-Protocols LACP 124 Link Aggregation Control ProtocolVersion 1. Actor Port = 22 Partner Port = 25
|
|
params = dict(
|
|
actor_system_priority=32768,
|
|
actor_system='00:13:c4:12:0f:00',
|
|
actor_key=13,
|
|
actor_port_priority=32768,
|
|
actor_port_numer=22,
|
|
actor_state=0x85,
|
|
partner_system_priority=32768,
|
|
partner_system='00:0e:83:16:f5:00',
|
|
partner_key=13,
|
|
partner_port_priority=32768,
|
|
partner_port_numer=25,
|
|
partner_state=0x36,
|
|
collector_max_delay=32768,
|
|
)
|
|
pkt = Ether(src="00:13:c4:12:0f:0d") / SlowProtocol() / LACP(**params)
|
|
s = raw(pkt)
|
|
raw_pkt = b'\x01\x80\xc2\x00\x00\x02\x00\x13\xc4\x12\x0f\x0d\x88\x09\x01\x01\x01\x14\x80' \
|
|
b'\x00\x00\x13\xc4\x12\x0f\x00\x00\x0d\x80\x00\x00\x16\x85\x00\x00\x00\x02\x14' \
|
|
b'\x80\x00\x00\x0e\x83\x16\xf5\x00\x00\x0d\x80\x00\x00\x19\x36\x00\x00\x00\x03' \
|
|
b'\x10\x80\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' \
|
|
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' \
|
|
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00' \
|
|
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
|
|
assert(s == raw_pkt)
|
|
|
|
p = Ether(s)
|
|
assert(SlowProtocol in p and LACP in p)
|
|
assert(raw(p) == raw_pkt)
|
|
|
|
= Marker sanity
|
|
|
|
pkt = Ether(src="00:13:c4:12:0f:0d") / SlowProtocol() / MarkerProtocol()
|
|
pkt.show()
|
|
s = raw(pkt)
|
|
p = Ether(s)
|
|
assert(SlowProtocol in p and MarkerProtocol in p)
|
|
assert(raw(p) == s)
|