2b3f0418bc367fc4f9c6bc79a0d29655017a154c
[certmaster.git] / certmaster / overlord / test_func.py
1 #!/usr/bin/python
2
3
4 # FIXME: should import the client lib, not XMLRPC lib, when we are done
5
6 import xmlrpclib
7 import sys
8
9 TEST_GETATTR = True
10 TEST_PROCESS = False
11 TEST_VIRT = False
12 TEST_SERVICES = False
13 TEST_HARDWARE = False
14 TEST_SMART = True
15
16 if TEST_GETATTR:
17 import func.overlord.client as func_client
18 print func_client.Client("*").hardware.pci_info()
19 #print func_client.Client("*").test.add(1,2)
20 #print func_client.Client("*").hardware.info()
21 #print func_client.Client("*").run("hardware","info",[])
22 #print func_client.Client(socket.gethostname(),noglobs=True).test.add("1","2")
23 sys.exit(1)
24
25 # get a connecton (to be replaced by client lib logic)
26 s = xmlrpclib.ServerProxy("http://127.0.0.1:51234")
27
28 # here's the basic test...
29 print s.test.add(1, 2)
30
31 if TEST_SMART:
32 print s.smart.info()
33
34 if TEST_PROCESS:
35 print s.process.info()
36 # print s.process.pkill("thunderbird")
37
38 # here's the service module testing
39 if TEST_SERVICES:
40 print s.service.restart("httpd")
41
42 if TEST_HARDWARE:
43 print s.hardware.info()
44
45 # this is so I can remember how the virt module works
46 if TEST_VIRT:
47
48 # example of using koan to install a virtual machine
49 #s.virt_install("mdehaan.rdu.redhat.com","profileX")
50
51 # wait ...
52 vms = s.virt.list_vms()
53 # example of stopping all stopped virtual machines
54 print "list of virtual instances = %s" % vms
55 for vm in vms:
56 status = s.virt.status(vm)
57 print status
58 if status == "shutdown":
59 s.virt.start(vm)
60
61 # add more tests here