####################
# set initial conditions
+# actual persons_per_slice is min(number_persons,number_persons_per_slice)
# actual nodes_per_slice is min(number_nodes,number_nodes_per_slice)
# this is to prevent quadractic test times on big tests
-def define_test (keys,sites,persons,nodes,slices,nodes_per_slice,fast_mode=None):
+def define_test (keys,sites,persons,nodes,slices,
+ nodes_per_slice,persons_per_slice,fast_mode=None):
global number_keys, number_sites, number_persons, number_nodes, number_slices
- global number_nodes_per_slice, fast_flag
+ global number_nodes_per_slice, number_persons_per_slice, fast_flag
number_keys=keys
number_sites = sites
number_persons=persons
number_nodes=nodes
number_slices=slices
number_nodes_per_slice=nodes_per_slice
+ number_persons_per_slice=persons_per_slice
if fast_mode is not None:
fast_flag=fast_mode
print 'Running locally on index %d'%local_index
def mini():
- define_test(1,1,1,1,1,1,True)
+ define_test(1,1,1,1,1,1,1,True)
def normal():
- define_test (keys=2,sites=4,persons=4,nodes=5,slices=4,nodes_per_slice=5,fast_mode=False)
+ define_test (keys=2,sites=4,persons=4,nodes=5,slices=4,nodes_per_slice=5,persons_per_slice=8,fast_mode=False)
# use only 1 key in this case
big_factor=4
except:
login_base=site_login_base(i,map_on_site(nn))
n=s[i].AddNode(a[i],login_base,{'hostname': nodename})
- print '%02d:== Added node %d %s'%(i,n,node_name(i,i))
+ print '%02d:== Added node %d %s'%(i,n,node_name(i,nn))
def test02_delnode (args=[1,2]):
for nn in myrange(number_nodes):
'instanciation':'plc-instantiated',
})
print '%02d:== created slice %d - max nodes=%d'%(i,slice_id,max_nodes)
- for np in myrange(number_persons):
+ actual_persons_per_slice = min (number_persons,number_persons_per_slice)
+ for np in myrange(actual_persons_per_slice):
email = person_name (i,np)
retcod = s[i].AddPersonToSlice (a[i], email, slicename)
print '%02d:== Attached person %s to slice %s'%(i,email,slicename)
message("END")
### ad hoc test sequences
+# we just create objects here so we can dump the DB
def populate ():
timer_start()
test_all_init()
timer_show()
test05_sa([1])
timer_show()
-# test00_refresh ("populate: refreshing peer 1",[1])
-# timer_show()
-# test04_slice_add_fnode([1])
-# timer_show()
-# test00_refresh("populate: refresh all")
+
+def populate_end():
+ test00_init()
+ test00_refresh ("populate: refreshing peer 1",[1])
+ timer_show()
+ test04_slice_add_fnode([1])
+ timer_show()
+ test00_refresh("populate: refresh all")
dump()
timer_show()
+ message("END")
# temporary - scratch as needed
def test_now ():
print "Usage: %s [-n] [-f]"%sys.argv[0]
print " -n runs test_now instead of test_all"
print " -p runs populate instead of test_all"
+ print " -e runs populate_end of test_all"
print " -m run in mini mode (1 instance of each class)"
print " -b performs big run (%d times as large as normal)"%big_factor
print " -H performs huge run (%d times as large as normal)"%huge_factor
def main ():
try:
- (o,a) = getopt.getopt(sys.argv[1:], "mnpbHl:")
+ (o,a) = getopt.getopt(sys.argv[1:], "emnpbHl:")
except:
usage()
func = test_all
elif opt=='-p':
print 'Running populate'
func = populate
+ elif opt=='-e':
+ print 'Running populate_end'
+ func = populate_end
elif opt=='-m':
mini()
elif opt=='-b':