mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 12:33:02 +02:00
test: revert back to tcpdump output format when reading pcap
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
committed by
Tobias Waldekranz
parent
dee36ce801
commit
db628ee3f3
@@ -187,7 +187,7 @@ with infamy.Test() as test:
|
||||
snif = infamy.Sniffer(ns0, "ip proto 89")
|
||||
with snif:
|
||||
time.sleep(15) # default hello time 10s
|
||||
assert(snif.output().stdout == "")
|
||||
assert(snif.packets() == "")
|
||||
|
||||
with test.step("Test connectivity"):
|
||||
_, hport0 = env.ltop.xlate("host", "data1")
|
||||
|
||||
@@ -98,16 +98,16 @@ with infamy.Test() as test:
|
||||
time.sleep(5)
|
||||
with snif_nojoin:
|
||||
time.sleep(5)
|
||||
assert(snif_receiver.output().stdout != "")
|
||||
assert(snif_nojoin.output().stdout != "")
|
||||
assert(snif_receiver.packets() != "")
|
||||
assert(snif_nojoin.packets() != "")
|
||||
print("As expected, unregistered multicast is received on both ports")
|
||||
|
||||
with receiver:
|
||||
with snif_receiver,snif_nojoin:
|
||||
time.sleep(5)
|
||||
assert(snif_nojoin.output().stdout == "")
|
||||
assert(snif_nojoin.packets() == "")
|
||||
print("As expected, registered multicast is NOT forwarded to non-member port")
|
||||
assert(snif_receiver.output().stdout != "")
|
||||
assert(snif_receiver.packets() != "")
|
||||
print("As expected, registered multicast is forwarded to the member port")
|
||||
|
||||
test.succeed()
|
||||
|
||||
@@ -282,13 +282,13 @@ with infamy.Test() as test:
|
||||
# TODO: Here should we check for 224.1.1.1 in mdb, also
|
||||
# verify that 224.2.2.2 does not exist in mdb
|
||||
|
||||
assert(snif_vlan77_sender_incorrect.output().stdout == "")
|
||||
assert(snif_vlan77_receiver_incorrect.output().stdout == "")
|
||||
assert(snif_vlan55_receiver_incorrect.output().stdout == "")
|
||||
assert(snif_vlan55_sender_incorrect.output().stdout == "")
|
||||
assert(snif_vlan77_sender_incorrect.packets() == "")
|
||||
assert(snif_vlan77_receiver_incorrect.packets() == "")
|
||||
assert(snif_vlan55_receiver_incorrect.packets() == "")
|
||||
assert(snif_vlan55_sender_incorrect.packets() == "")
|
||||
print("Multicast does not exist on ports/VLANs where they should not be")
|
||||
assert(snif_vlan55_receiver_correct.output().stdout != "")
|
||||
assert(snif_vlan77_receiver_correct.output().stdout != "")
|
||||
assert(snif_vlan55_receiver_correct.packets() != "")
|
||||
assert(snif_vlan77_receiver_correct.packets() != "")
|
||||
print("Multicast received on correct port and VLAN")
|
||||
|
||||
test.succeed()
|
||||
|
||||
@@ -125,8 +125,8 @@ with infamy.Test() as test:
|
||||
time.sleep(5)
|
||||
with snif_nojoin:
|
||||
time.sleep(5)
|
||||
assert(snif_receiver.output().stdout != "")
|
||||
assert(snif_nojoin.output().stdout != "")
|
||||
assert(snif_receiver.packets() != "")
|
||||
assert(snif_nojoin.packets() != "")
|
||||
print("As expected, unregistered multicast is received on both ports")
|
||||
|
||||
set_static_multicast_filter(target, "224.1.1.1")
|
||||
@@ -134,9 +134,9 @@ with infamy.Test() as test:
|
||||
with snif_receiver,snif_nojoin:
|
||||
time.sleep(5)
|
||||
|
||||
assert(snif_nojoin.output().stdout == "")
|
||||
assert(snif_nojoin.packets() == "")
|
||||
print("As expected, registered multicast is NOT forwarded to non-member port")
|
||||
assert(snif_receiver.output().stdout != "")
|
||||
assert(snif_receiver.packets() != "")
|
||||
print("As expected, registered multicast is forwarded to the member port")
|
||||
|
||||
test.succeed()
|
||||
|
||||
@@ -37,4 +37,9 @@ class Sniffer:
|
||||
|
||||
def output(self):
|
||||
"""Return PCAP output"""
|
||||
return self.netns.runsh(f"tshark -n -r {self.pcap.name}")
|
||||
return self.netns.runsh(f"tcpdump -n -r {self.pcap.name}")
|
||||
|
||||
def packets(self):
|
||||
"""Filtered text output, skipping tcpdump "reading from file" initial line"""
|
||||
lines = self.output().stdout.split('\n')
|
||||
return '\n'.join(lines[1:])
|
||||
|
||||
Reference in New Issue
Block a user