1
# test script to evaluate Cobbler API performance
3
# Michael DeHaan <mdehaan@redhat.com>
6
import cobbler.api as capi
12
print "sample size is %s" % N
16
# part one ... create our test systems for benchmarking purposes if
17
# they do not seem to exist.
19
#if not api.find_profile("foo"):
20
# print "CREATE A PROFILE NAMED 'foo' to be able to run this test"
24
mac = [ 0x00, 0x16, 0x3e,
25
random.randint(0x00, 0x7f),
26
random.randint(0x00, 0xff),
27
random.randint(0x00, 0xff) ]
28
return ':'.join(map(lambda x: "%02x" % x, mac))
30
print "Deleting autotest entries from a previous run"
34
sys = api.remove_system("autotest-%s" % x,with_delete=True)
38
print "ELAPSED: %s seconds" % (time2 - time1)
40
print "Creating test systems from scratch"
43
sys = api.new_system()
44
sys.set_name("autotest-%s" % x)
45
sys.set_mac_address(random_mac(), "eth0")
46
sys.set_profile("foo") # assumes there is already a foo
47
# print "... adding: %s" % sys.name
50
print "ELAPSED %s seconds" % (time2 - time1)
52
#for mode2 in [ "fast", "normal", "full" ]:
53
for mode in [ "on", "off" ]:
55
print "Running netboot edit benchmarks (turn %s)" % (mode)
58
sys = api.systems().find("autotest-%s" % x)
60
sys.set_netboot_enabled(0)
62
sys.set_netboot_enabled(1)
63
# print "... editing: %s" % sys.name
67
print "ELAPSED: %s seconds" % (time2 - time1)