Code

244686b6055f6e39244d8b11164c2af5e0c5bd40
[gosa.git] / gosa-si / tests / client.php
1 #!/usr/bin/php5 -q
2 <?php
4 require_once("../../gosa-core/include/class_socketClient.inc");
5 error_reporting(E_ALL);
7 $zahl= 1;
9 for($count = 1; $count <= $zahl; $count++)
10 {
12 $sock = new Socket_Client("127.0.0.1","20081",TRUE,1);
13 $sock->setEncryptionKey("secret-gosa-password");
15 if($sock->connected()){
16         /* Prepare a hunge bunch of data to be send */
18 # jobdb add
19 #$data = "<xml> <header>gosa_network_completition</header> <source>GOSA</source><target>GOSA</target><hostname>ws-muc-2</hostname></xml>";
20 #$data = "<xml> <header>job_sayHello</header> <source>10.89.1.155:20083</source><mac>00:1B:77:04:8A:6C</mac> <timestamp>20130102133900</timestamp> </xml>";
21 #$data = "<xml> <header>job_ping</header> <source>10.89.1.155:20083</source> <target>10.89.1.155:20081</target><macaddress>00:01:6c:9d:b9:fa</macaddress> <timestamp>20130102133900</timestamp> </xml>";
23 # jobdb delete
24 #$data = "<xml> <header>gosa_delete_jobdb_entry</header><where><clause><phrase><id>3</id></phrase></clause></where></xml>";
26 # smbhash
27 #$data = "<xml> <header>gosa_gen_smb_hash</header> <source>GOSA</source><target>GOSA</target><password>tester</password></xml>";
29 # Reload ldap config
30 #$data = "<xml> <header>gosa_trigger_reload_ldap_config</header> <source>GOSA</source><target>00:01:6c:9d:b9:fa</target></xml>";
32 # jobdb update  
33 #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <macaddress>00:01:6c:9d:b9:fa</macaddress></phrase></clause> </where> <update><timestamp>23450101000000</timestamp><result>XXXXXXXXXXXXXXx</result></update></xml>";
34 #$data = "<xml> <header>gosa_update_status_jobdb_entry</header> <source>GOSA</source><target>GOSA</target><where><clause><phrase> <status>waiting</status></phrase></clause> </where> <update><status>processing</status> <result>update</result></update></xml>";
36 # jobdb query
37 #$data = "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target>".
38 #    "<where><clause><connector>and</connector><phrase><operator>gt</operator><ROWID>0</ROWID></phrase><phrase><operator>le</operator><ROWID>5</ROWID></phrase></clause></where></xml>";
39 #$data= "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target>".
40 #    "<where><clause><phrase><headertag>ping</headertag></phrase></clause></where><limit><from>0</from><to>3</to></limit></xml>";
41 #$data= "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target>".
42 #    "<where><clause><phrase><HEADERTAG>trigger_action_reinstall</HEADERTAG></phrase></clause></where>".
43 #    "<limit><from>0</from><to>25</to></limit><orderby>timestamp DESC</orderby></xml>";
44 #$data= "<xml><header>gosa_query_jobdb</header><source>GOSA</source> <target>GOSA</target></xml>";
46 # jobdb count
47 #$data = "<xml> <header>gosa_count_packages_list</header><source>GOSA</source> <target>GOSA</target></xml>";
49 # jobdb clear
50 #$data = "<xml> <header>gosa_clear_jobdb</header> </xml>";
52 # set gosa-si-client to 'activated'
53 #$data = "<xml> <header>gosa_set_activated_for_installation</header> <target>10.89.1.31:20083</target> <source>127.0.0.1:20081</source> </xml>";
56 # trigger jobs at client
57 #$data = "<xml> <header>gosa_detect_hardware</header> <target>10.89.1.31:20083</target> <source>10.89.1.31:20081</source> </xml>";
58 #$data = "<xml> <header>gosa_new_key_for_client</header> <target>00:01:6c:9d:b9:fa</target> <source>10.89.1.31:20081</source> </xml>";
59 #$data = "<xml> <header>gosa_trigger_action_wake</header> <target>00:01:6c:9d:b9:fa</target> <source>10.89.1.31:20081</source> </xml>";
60 #$data = "<xml> <header>gosa_trigger_action_faireboot</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
61 #$data = "<xml> <header>job_trigger_action_reinstall</header> <source>GOSA</source> <target>00:01:6c:9d:b9:fa</target> ".
62 #    "<macaddress>00:01:6c:9d:b9:fa</macaddress> <timestamp>20130101000000</timestamp> </xml>";
63 $data = "<xml> <header>gosa_ping</header> <target>00:01:6c:9d:b9:fa</target> <source>GOSA</source> </xml>";
66 # to test
67 #    "trigger_reload_ldap_config",
68 #    "network_completition",
69 #    "trigger_action_localboot",
70 #    "trigger_action_faireboot",
71 #    "trigger_action_reboot",
72 #    "trigger_action_halt",
73 #    "trigger_action_update", 
74 #    "trigger_action_reinstall",
75 #    "trigger_action_memcheck", 
76 #    "trigger_action_sysinfo",
77 #    "trigger_action_instant_update",
78 #    "trigger_action_rescan",
79 #    "trigger_action_wake",
81 # get_login_usr_for_client
82 #$data = "<xml> <header>gosa_get_login_usr_for_client</header> <target>GOSA</target> <source>GOSA</source> <client>00:01:6c:9d:b9:fa</client></xml>";
84 # get_client_for_login_usr
85 #$data = "<xml> <header>gosa_get_client_for_login_usr</header> <target>GOSA</target> <source>GOSA</source> <usr>harald</usr></xml>";
87 # recreate_fai_server_db
88 #$data = "<xml> <header>gosa_recreate_fai_server_db</header> <target>GOSA</target> <source>GOSA</source></xml>"; 
90     $sock->write($data);
91     $answer = "nothing";
92         $answer = $sock->read();
93     
94     echo "$count: $answer\n";
95         $sock->close(); 
96 }else{
97         echo "... FAILED!\n";
98 }
99 }
100 ?>