コード例 #1
0
ファイル: queue-create.py プロジェクト: CodEnFisH/pane
#!/usr/bin/python
import PaneTest
from time import sleep

topo = PaneTest.TreeTopo(depth=1,fanout=2)
test = PaneTest.Test(topo)
h1 = test.net.hosts[0]
h2 = test.net.hosts[-1]
PaneTest.check(test.ping(h1, h2, 0.5, 2),
    0,
    "initial packets lost")
PaneTest.check(test.client.request("NewShare net0 for (*) [reserve <= 200] on \
    rootShare."),
    True,
    "should be able to create a new share")
PaneTest.check(test.client.request("deny (srcHost=%s,dstHost=%s) on \
    rootShare." % (h1.IP(), h2.IP())),
    True,
    "deny should succeed")
sleep(1)
PaneTest.check(test.ping(h1, h2, 0.5, 2),
    100,
    "packets should be lost")

PaneTest.check(test.client.request("reserve (srcHost=%s,dstHost=%s) = 20 on \
    net0." % (h1.IP(), h2.IP())),
    True,
    "reservation should succeed")
sleep(1)
print "Pinging ..."
PaneTest.check(test.ping(h1, h2, 0.5, 2), 
コード例 #2
0
ファイル: deny-timer.py プロジェクト: brownsys/pane
#!/usr/bin/python
import PaneTest
from time import gmtime, strftime, sleep

topo = PaneTest.LinearTopo(k=2)
test = PaneTest.Test(topo)
h1 = test.net.hosts[0]
h2 = test.net.hosts[-1]
PaneTest.check(test.ping(h1, h2, 0.5, 5), 0, "initial packets lost")
PaneTest.check(
    test.client.request(
        "deny(srcHost=%s,dstHost=%s) on rootShare \
    from now to +5."
        % (h1.IP(), h2.IP())
    ),
    True,
    "deny failed",
)
sleep(1)
PaneTest.check(test.ping(h1, h2, 0.5, 5), 100, "packets should be dropped")
print "Packets successfully dropped. Sleeping until deny expires ..."
sleep(2)
PaneTest.check(test.ping(h1, h2, 0.5, 5), 0, "deny not uninstalled")
print "Test successful."
コード例 #3
0
ファイル: tree-ping.py プロジェクト: brownsys/pane
#!/usr/bin/python
import PaneTest

topo = PaneTest.TreeTopo(depth=2, fanout=2)
test = PaneTest.Test(topo)
for src in test.net.hosts:
    for dst in test.net.hosts:
        if src == dst:
            continue
        PaneTest.check(test.ping(src, dst, 1, 3), 0, "packets lost")