#!/usr/local/bin/python from deter import topdl top = topdl.Topology(substrates=[ topdl.Substrate("link0", topdl.Capacity(100000.0, 'max'))], elements=[ topdl.Computer('e1', interface=[topdl.Interface('link0')]), topdl.Computer('e2', interface=[topdl.Interface('link0')])]) f = open ('huhtest.xml','w+') f.write( topdl.topology_to_xml(top, top ='experiment')) f.close()
clients = [] number_of_clients = 45 for i in range(0, number_of_clients): subs.append( topdl.Substrate('link' + str(i), topdl.Capacity(100000.0, 'max'))) container_num = 0 for i in range(number_of_clients): client = 'client' + str(i) clients.append(client) #clients = ('client1','client2') for index, elem_name in enumerate(clients): inf = topdl.Interface(name='inf000', substrate=['link' + str(index)]) elem = topdl.Computer(name=elem_name, interface=[inf]) elem.set_attribute('containers:node_type', 'openvz') elem.set_attribute('containers:partition', container_num) elem.set_attribute('startup', 'sudo python /share/magi/current/magi_bootstrap.py') elems.append(elem) if ((index + 1) % 9) == 0: container_num = container_num + 1 servers = ('server') for index in range(len(clients)): inf = topdl.Interface(name='inf' + str(format(index, '03d')), substrate=['link' + str(index)]) intf.append(inf) elem = topdl.Computer(name='server', interface=intf)
#clients = ('client1','client2') for index, elem_name in enumerate(clients): if index < 24: inf_list = [] inf = topdl.Interface(name='inf000', substrate=['link' + str(index)]) inf_list.append(inf) inf = topdl.Interface(name='inf001', substrate=['link' + str(index + 24)]) inf_list.append(inf) else: inf_list = [] inf = topdl.Interface(name='inf000', substrate=['link' + str(index)]) inf_list.append(inf) elem = topdl.Computer(name=elem_name, interface=inf_list) elem.set_attribute('containers:node_type', 'openvz') elem.set_attribute('containers:partition', container_num) elem.set_attribute( 'startup', 'sudo python /share/magi/dev/magi_bootstrap.py -p /share/magi/dev/') elems.append(elem) if ((index + 1) % 8) == 0: container_num = container_num + 1 servers = ('server1') for index in range(24): inf = topdl.Interface(name='inf' + str(format(index, '03d')), substrate=['link' + str(index)]) intf.append(inf)