Exemplo n.º 1
0
Arquivo: app.py Projeto: aemaet/arccn
from cmd import Cmd, App, Task, Instruction
import random

a = App()
perf = Cmd()
f = open('mydump','rb')
tmp = f.read()
f.close()
i = Instruction(['sudo python3 net_manager.py -stat mydump'],{'mydump':tmp},r'/home/aemaet/pr/arccn/netbuilder/NetworkStand')
perf.add_state('A',i,{})
perf.add_state('END',Instruction(),{},True)
perf.set_start('A')
a.run([Task({'ip': '', 'port':8888},5,perf)])


Exemplo n.º 2
0
Arquivo: app.py Projeto: aemaet/arccn
from cmd import Cmd, App, Task
import random

a = App()
c = Cmd()
c.add_state('A','',{'a': 'B','b': 'C'})
c.add_state('B','',{'a': 'B','b': 'C'})
c.add_state('C','',{'a': 'A','b': 'D'})
c.add_state('D','',{},True)
c.set_start('A')
clients, servers = [], []
for i in range(100):
	client = Cmd()
	server = Cmd()
	client.add_state('A','iperf -c 192.168.122.243 -p {0} -t 120'.format(5001 + i),{},True)
	server.add_state('A','iperf -s -p {0}'.format(5001 + i),{},True)
	client.set_start('A')
	server.set_start('A')
	clients.append(client)
	servers.append(server)
time_client = range(6,106)
time_server = range(5,105)
clients = zip(clients,time_client)
servers = zip(servers,time_server) 
perf = Cmd()
perf.add_state('A','iperf -c localhost',{'[ ID] Interval       Transfer     Bandwidth\n':'END'})
perf.add_state('END','',{},True)
perf.set_start('A')
#for i in range(99):
#	time += [(i+2)*5]*random.randint(3,10)
tasks = [Task({'ip': '192.168.122.243', 'port': 8888},d[1],d[0]) for d in servers] + [Task({'ip': '192.168.122.181', 'port': 8888},d[1],d[0]) for d in clients]