Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 24 additions & 25 deletions modcheck.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
#!/usr/bin/python
import os,sys
#!/usr/bin/env python
import sys
import subprocess


print "Scroll down for summary"
print ""
print ""
print("Scroll down for summary")
print("")
print("")

f = open('MODTREE')
mods = {}
Expand All @@ -23,7 +22,7 @@ def get_deps(mod):
return retlist


while(True):
while True:
r = f.readline()
if r == '':
break
Expand All @@ -33,7 +32,7 @@ def get_deps(mod):
deps = strings[1].rstrip('\n')
mods[mod] = deps.strip(' ')

for k,v in mods.iteritems():
for k,v in mods.items():
command = 'make dummy '
deps = get_deps(k)
for i in mods.keys():
Expand All @@ -47,7 +46,7 @@ def get_deps(mod):
failed = 0

for i in commands:
print 'Checking config:\n\t%s' % i
print('Checking config:\n\t%s' % i)

subprocess.call(['make','clean'])
sys.stdout.flush()
Expand All @@ -61,30 +60,30 @@ def get_deps(mod):
sys.stderr.flush()

if ret == 0:
print "**********************************************************"
print "******************* CONFIG PASSED! *******************"
print("**********************************************************")
print("******************* CONFIG PASSED! *******************")
endResult.append({"test": i, "result": "PASS"})
else:
failed += 1
print "**********************************************************"
print "******************* CONFIG FAILED! *******************"
print("**********************************************************")
print("******************* CONFIG FAILED! *******************")
endResult.append({"test": i, "result": "FAIL"})
print "**********************************************************"
print("**********************************************************")

print ""
print "***************************************************************************"
print " Executive Summary"
print "***************************************************************************"
print ""
print("")
print("***************************************************************************")
print(" Executive Summary")
print("***************************************************************************")
print("")

for r in endResult:
print "Test:", r["test"]
print "Status:", r["result"]
print ""
print("Test:", r["test"])
print("Status:", r["result"])
print("")

print "***********************"
print "%d out of %d Failed" % (failed, len(endResult))
print "***********************"
print("***********************")
print("%d out of %d Failed" % (failed, len(endResult)))
print("***********************")

if failed:
sys.exit(1)
Expand Down
4 changes: 2 additions & 2 deletions test/python/dhcp.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# dhcp.py
# Butterfly-like topology test for dhcp
# One DHCP server, serving on two interface
Expand Down Expand Up @@ -28,7 +28,7 @@
r3 = Host(T, net2, args="dhcpclient:eth1")
r4 = Host(T, net2, args="dhcpclient:eth1")

raw_input("Press enter to continue ...")
input("Press enter to continue ...")
start(T)

wait(server)
Expand Down
2 changes: 1 addition & 1 deletion test/python/fairness.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# fairness.py
# A complex test for butterfly-like topology,
# using 3 TCP connections and 3 ping flows.
Expand Down
2 changes: 1 addition & 1 deletion test/python/fairness_bottleneck.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# fairness.py
# A complex test for butterfly-like topology,
# using 3 TCP connections and 3 ping flows.
Expand Down
2 changes: 1 addition & 1 deletion test/python/fairness_bottleneck_linux.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# fairness.py
# A complex test for butterfly-like topology,
# using 3 TCP connections and 3 ping flows.
Expand Down
30 changes: 15 additions & 15 deletions test/python/fragmentation.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
#
# fragmentation.py
#
Expand All @@ -13,7 +13,7 @@
#

from topology import *
import socket, random, string
import socket

SRC_ADDR = ''
DST_ADDR = '172.16.1.1'
Expand All @@ -25,36 +25,36 @@
SUBLOOPS = 1
UDPCLIENT = "udpclient:" + str(DST_ADDR) + ":" + str(SENDTO_PORT) + ":" + str(LISTEN_PORT) + ":" + str(DATASIZE) + ":" + str(LOOPS) + ":" + str(SUBLOOPS)

print UDPCLIENT
print(UDPCLIENT)

T = Topology()
net1 = Network(T, "pyt0")
h1 = Host(T, net1, args=UDPCLIENT)

s_udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s_udp.bind((SRC_ADDR, SRC_PORT))
s_udp.settimeout(5);
s_udp.settimeout(5)

raw_input("Press enter to continue ...")
input("Press enter to continue ...")
start(T)

while True:
data, addr = s_udp.recvfrom(DATASIZE)
#print data
if len(data) == DATASIZE:
print '\n\n'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '+++++ fragmentation test IS successful +++++'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '\n\n'
print('\n\n')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('+++++ fragmentation test IS successful +++++')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('\n\n')
cleanup()
exit(0)

print '\n\n'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '+++++ fragmentation test NOT successful ++++'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '\n\n'
print('\n\n')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('+++++ fragmentation test NOT successful ++++')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('\n\n')
cleanup()
exit(1)

4 changes: 2 additions & 2 deletions test/python/howto.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
########################################################################
#== Create a test scenario ==#
########################################################################
# Every script file will start with: "#!/usr/bin/python" in the first
# Every script file will start with: "#!/usr/bin/env python" in the first
# line, and will have execution permissions. This script is an exception
# because it is not intended to be run, as it is in fact a walkthrough to
# all the functionalities.
Expand Down Expand Up @@ -115,7 +115,7 @@
#== Start the test ==#
########################################################################
# All the host will be connected and activated when you call:
start()
start(T)

# At this point you may want to define your exit strategy. Valid commands
# are:
Expand Down
2 changes: 1 addition & 1 deletion test/python/http_server_linux.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
from topology import *

T = Topology()
Expand Down
34 changes: 17 additions & 17 deletions test/python/multicast_recv.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
# multicast_recv.py
#
# Multicast test with PicoTCP receiving and Linux sending
Expand All @@ -8,7 +8,7 @@
# mcast to 224.7.7.7
#
from topology import *
import socket, random, string
import socket

IF_ADDR = '172.16.1.1'
LINK_ADDR = '172.16.1.2'
Expand All @@ -18,7 +18,7 @@
SENDTO_PORT = 6667
MCASTRECV = "mcastreceive:" + str(LINK_ADDR) + ":" + str(MCAST_ADDR) + ":" + str(LISTEN_PORT) + ":" + str(SENDTO_PORT)

print MCASTRECV
print(MCASTRECV)

T = Topology()
net1 = Network(T, "pyt0")
Expand All @@ -35,30 +35,30 @@
s_udp_recv = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s_udp_recv.bind((IF_ADDR, LISTEN_PORT))
s_udp_recv.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s_udp_recv.settimeout(5);
s_udp_recv.settimeout(5)

raw_input("Press enter to continue ...")
input("Press enter to continue ...")
start(T)
sleep(1)

while True:
s_udp.sendto("multicast test succeeded", (str(MCAST_ADDR), LISTEN_PORT))
s_udp.sendto("multicast test succeeded".encode('utf-8'), (str(MCAST_ADDR), LISTEN_PORT))
data = s_udp_recv.recv(4096)
#print data
if 'succeeded' in data:
print '\n\n'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '+++++ multicast_recv test IS successful +++++'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '\n\n'
if 'succeeded' in data.decode('utf-8'):
print('\n\n')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('+++++ multicast_recv test IS successful +++++')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('\n\n')
cleanup()
exit(0)

print '\n\n'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '+++++ multicast_recv test NOT successful ++++'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '\n\n'
print('\n\n')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('+++++ multicast_recv test NOT successful ++++')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('\n\n')
cleanup()
exit(1)

32 changes: 16 additions & 16 deletions test/python/multicast_send.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
#
# multicast_send.py
#
Expand All @@ -10,7 +10,7 @@
#

from topology import *
import socket, random, string, struct
import socket, struct

IF_ADDR = '172.16.1.1'
LINK_ADDR = '172.16.1.2'
Expand All @@ -19,7 +19,7 @@
SENDTO_PORT = 6667
MCASTSEND = "mcastsend:" + str(LINK_ADDR) + ":" + str(MCAST_ADDR) + ":" + str(SENDTO_PORT) + ":" + str(LISTEN_PORT)

print MCASTSEND
print(MCASTSEND)

T = Topology()
net1 = Network(T, "pyt0")
Expand All @@ -28,31 +28,31 @@
s_udp = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
s_udp.bind((MCAST_ADDR, LISTEN_PORT))
s_udp.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
s_udp.settimeout(5);
s_udp.settimeout(5)

mreq = struct.pack("=4s4s", socket.inet_aton(str(MCAST_ADDR)), socket.inet_aton(str(IF_ADDR)))
s_udp.setsockopt(socket.IPPROTO_IP, socket.IP_ADD_MEMBERSHIP, mreq)

raw_input("Press enter to continue ...")
input("Press enter to continue ...")
start(T)
sleep(1)

while True:
data = s_udp.recv(4096)
#print data
if 'end' in data:
print '\n\n'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '+++++ multicast_send test IS successful +++++'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '\n\n'
if 'end' in data.decode('utf-8'):
print('\n\n')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('+++++ multicast_send test IS successful +++++')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('\n\n')
cleanup()
exit(0)

print '\n\n'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '+++++ multicast_send test NOT successful ++++'
print '+++++++++++++++++++++++++++++++++++++++++++++'
print '\n\n'
print('\n\n')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('+++++ multicast_send test NOT successful ++++')
print('+++++++++++++++++++++++++++++++++++++++++++++')
print('\n\n')
cleanup()
exit(1)
2 changes: 1 addition & 1 deletion test/python/noop.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
from topology import *

T = Topology()
Expand Down
2 changes: 1 addition & 1 deletion test/python/ping.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
from topology import *

T = Topology()
Expand Down
2 changes: 1 addition & 1 deletion test/python/ping_delay.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
from topology import *

T = Topology()
Expand Down
2 changes: 1 addition & 1 deletion test/python/ping_linux.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
from topology import *

T = Topology()
Expand Down
2 changes: 1 addition & 1 deletion test/python/ping_nat.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/python
#!/usr/bin/env python
from topology import *

T = Topology()
Expand Down
Loading
Loading