mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-30 20:43:02 +02:00
test: igmp_basic: Speed up test and some renaming
Rename to more distinct names for netns and hostports
This commit is contained in:
@@ -76,42 +76,38 @@ with infamy.Test() as test:
|
||||
}
|
||||
})
|
||||
with test.step("Check multicast receieved on correct port"):
|
||||
_, hport0 = env.ltop.xlate("host", "data0")
|
||||
_, hport1 = env.ltop.xlate("host", "data1")
|
||||
_, hport2 = env.ltop.xlate("host", "data2")
|
||||
with infamy.IsolatedMacVlan(hport0) as ns0, \
|
||||
infamy.IsolatedMacVlan(hport1) as ns1, \
|
||||
infamy.IsolatedMacVlan(hport2) as ns2:
|
||||
ns0.addip("10.0.0.2")
|
||||
ns1.addip("10.0.0.3")
|
||||
ns2.addip("10.0.0.4")
|
||||
ns0.must_reach("10.0.0.1")
|
||||
ns1.must_reach("10.0.0.1")
|
||||
ns2.must_reach("10.0.0.1")
|
||||
_, hsend = env.ltop.xlate("host", "data0")
|
||||
_, hreceive = env.ltop.xlate("host", "data1")
|
||||
_, hnojoin = env.ltop.xlate("host", "data2")
|
||||
with infamy.IsolatedMacVlan(hsend) as send_ns, \
|
||||
infamy.IsolatedMacVlan(hreceive) as receive_ns, \
|
||||
infamy.IsolatedMacVlan(hnojoin) as nojoin_ns:
|
||||
send_ns.addip("10.0.0.2")
|
||||
receive_ns.addip("10.0.0.3")
|
||||
nojoin_ns.addip("10.0.0.4")
|
||||
send_ns.must_reach("10.0.0.1")
|
||||
receive_ns.must_reach("10.0.0.1")
|
||||
nojoin_ns.must_reach("10.0.0.1")
|
||||
|
||||
sender = mcast.MCastSender(ns0, "224.1.1.1")
|
||||
receiver = mcast.MCastReceiver(ns1, "224.1.1.1")
|
||||
snif_nojoin = infamy.Sniffer(ns2, "host 224.1.1.1")
|
||||
snif_receiver = infamy.Sniffer(ns1, "host 224.1.1.1")
|
||||
sender = mcast.MCastSender(send_ns, "224.1.1.1")
|
||||
receiver = mcast.MCastReceiver(receive_ns, "224.1.1.1")
|
||||
snif_nojoin = infamy.Sniffer(nojoin_ns, "host 224.1.1.1")
|
||||
snif_receiver = infamy.Sniffer(receive_ns, "host 224.1.1.1")
|
||||
with sender:
|
||||
time.sleep(5)
|
||||
with snif_nojoin:
|
||||
time.sleep(5)
|
||||
assert(snif_nojoin.output().stdout != "")
|
||||
|
||||
with snif_receiver:
|
||||
time.sleep(5)
|
||||
with snif_nojoin:
|
||||
time.sleep(5)
|
||||
assert(snif_receiver.output().stdout != "")
|
||||
print("Multicast is received on ports without join")
|
||||
assert(snif_nojoin.output().stdout != "")
|
||||
print("As expected, unregistered multicast is received on both ports")
|
||||
|
||||
with receiver:
|
||||
with snif_receiver:
|
||||
time.sleep(5)
|
||||
with snif_nojoin:
|
||||
with snif_receiver,snif_nojoin:
|
||||
time.sleep(5)
|
||||
assert(snif_nojoin.output().stdout == "")
|
||||
print("Multicast is NOT received on port when join exist")
|
||||
assert(snif_nojoin.output().stdout == "")
|
||||
print("As expected, registered multicast is NOT forwarded to non-member port")
|
||||
assert(snif_receiver.output().stdout != "")
|
||||
print("Multicast is received after join")
|
||||
print("As expected, registered multicast is forwarded to the member port")
|
||||
|
||||
test.succeed()
|
||||
|
||||
Reference in New Issue
Block a user