forked from xapi-project/xen-api
-
Notifications
You must be signed in to change notification settings - Fork 0
/
multipathrt.ml
66 lines (61 loc) · 2.39 KB
/
multipathrt.ml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
(*
* Copyright (C) 2006-2009 Citrix Systems Inc.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as published
* by the Free Software Foundation; version 2.1 only. with the special
* exception on linking described in file LICENSE.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*)
(* Multipath test suite *)
open Client
open Globs
let rpc_of_hostname host xml =
let open Xmlrpc_client in
XML_protocol.rpc ~srcstr:"multipathrt" ~dststr:"xapi" ~transport:(TCP(host, 80)) ~http:(xmlrpc ~version:"1.0" "/") xml
let _ =
Arg.parse [
"-h", Arg.Set_string hostname, "Hostname of the XenServer";
"-u", Arg.Set_string username, "Username";
"-p", Arg.Set_string password, "Password";
"-tc", Arg.Set_int tc, "Test case number"]
(fun _ -> failwith "Invalid argument")
(Printf.sprintf "Usage: %s [-h hostname] [-u username] [-p password] [-tc test case number]" binary_name);
(* Sanity check *)
if !hostname="" then failwith "Need a host name!";
if !username="" then failwith "Need a user name!";
if !password="" then failwith "Need a password!";
if !tc=0 then failwith "Need a test case!";
(* Get a session *)
let rpc = rpc_of_hostname !hostname in
let session = Client.Session.login_with_password ~rpc ~uname:!username ~pwd:!password ~version:"1.4" in
try
begin
match !tc with
(* Device-mapper table integrity tests *)
| 9068 -> Tc_9068.run_iscsi rpc session
| 9069 -> Tc_9069.run_netapp rpc session
| 9078 -> Tc_9078.run_fc rpc session
(* Path fail-over time tests *)
| 9071 -> Tc_9071.run_iscsi rpc session
| 9072 -> Tc_9072.run_netapp rpc session
| 9079 -> Tc_9079.run_fc rpc session
(* Alert tests *)
| 9074 -> Tc_9074.run rpc session
| _ -> failwith "Unknown test case!"
end;
Printf.printf "PASS\n"
with
| Multipathrt_exceptions.Test_error str ->
Printf.printf "Test error: %s\n" str;
Printf.printf "ERROR\n"
| Failure str ->
Printf.printf "Fatal error: %s\n" str;
Printf.printf "FAIL\n"
| e ->
Printf.printf "Unexpected exception: %s\n" (Printexc.to_string e);
Printf.printf "ERROR\n"