Пример #1
0
#!/usr/bin/env python

from deter import topdl

subs = [ ]
elems = [ ]
intf = [ ]
clients = [ ]
number_of_clients = 2
for i in range(0,number_of_clients):
	subs.append(topdl.Substrate('link'+str(i),topdl.Capacity(100000.0, 'avg')))

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)%10) == 0:
		container_num = container_num+1
servers = ('server')

Пример #2
0
#!/usr/bin/env python

from deter import topdl

subs = []
elems = []
intf = []
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')
Пример #3
0
#!/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()