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) elem.set_attribute('containers:node_type', 'embedded_pnode') elem.set_attribute('containers:partition', container_num + 1) elem.set_attribute('startup', 'sudo python /share/magi/current/magi_bootstrap.py') elems.append(elem) """elem = topdl.Computer(name='control') elem.set_attribute('containers:node_type','embedded_pnode'); elem.set_attribute('containers:partition','1'); elem.set_attribute('startup','sudo python /share/magi/current/magi_bootstrap.py'); elems.append(elem)""" top = topdl.Topology(substrates=subs, elements=elems) f = open('6node45client.xml', 'w+') f.write(topdl.topology_to_xml(top, top='experiment')) f.close() #print topdl.topology_to_xml(top, top='experiment')
#!/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()