File Coverage

blib/lib/IBM/XCLI.pm
Criterion Covered Total %
statement 15 62 24.1
branch 0 20 0.0
condition 0 2 0.0
subroutine 5 9 55.5
pod 1 1 100.0
total 21 94 22.3


line stmt bran cond sub pod time code
1             package IBM::XCLI;
2              
3 1     1   29849 use warnings;
  1         3  
  1         34  
4 1     1   7 use strict;
  1         1  
  1         65  
5              
6 1     1   91 use Carp;
  1         7  
  1         85  
7 1     1   5 use Fcntl;
  1         2  
  1         1043  
8              
9             our $VERSION = '0.51';
10              
11             sub new {
12 0     0 1   my ($class, %args) = @_;
13 0           my $self = (bless {}, $class);
14 0 0         defined $args{ip_address} ? $self->{ip_address} = $args{ip_address} : croak "Constructor failed: ip_address not defined";
15 0 0         defined $args{username} ? $self->{username} = $args{username} : croak "Constructor failed: username not defined";
16 0 0         defined $args{password} ? $self->{password} = $args{password} : croak "Constructor failed: password not defined";
17 0 0         defined $args{xcli} ? $self->{xcli} = $args{xcli} : croak "Constructor failed: xcli not defined";
18 0 0         -x $self->{xcli} or croak "Constructor failed: Unable to execute xcli binary";
19 0 0         open my $dummy_conn, '-|', $self->{xcli}, 'test'
20             or croak "Constructor failed: XCLI dummy connection failed";
21 0           my $output = <$dummy_conn>;
22 0           close $output;
23 0 0         $output eq "Missing user.\n" or croak "Constructor failed: XCLI dummy test failed";
24 0           return $self;
25             }
26              
27             our %M_MAP = (
28             pool_list => { xcli_cmd => 'pool_list', sort_by => 'name' },
29             host_list => { xcli_cmd => 'host_list', sort_by => 'name' },
30             mirror_list => { xcli_cmd => 'mirror_list', sort_by => 'name' },
31             vol_list => { xcli_cmd => 'vol_list', sort_by => 'name' },
32             cluster_list => { xcli_cmd => 'cluster_list', sort_by => 'name' },
33             target_list => { xcli_cmd => 'target_list', sort_by => 'name' },
34             dest_list => { xcli_cmd => 'dest_list', sort_by => 'name' },
35             snap_group_list => { xcli_cmd => 'snap_group_list', sort_by => 'name' },
36             ipinterface_list => { xcli_cmd => 'ipinterface_list', sort_by => 'ipinterface' },
37             target_port_list => { xcli_cmd => 'target_port_list', sort_by => 'iscsi_address' },
38             reservation_key_list => { xcli_cmd => 'reservation_key_list',sort_by => 'initiator_port' },
39             fc_connectivity_list => { xcli_cmd => 'fc_connectivity_list',sort_by => 'wwpn' },
40             host_connectivity_list => { xcli_cmd => 'host_connectivity_list',sort_by => 'host_port' },
41             ups_list => { xcli_cmd => 'ups_list', sort_by => 'component_id' },
42             psu_list => { xcli_cmd => 'psu_list', sort_by => 'component_id' },
43             ats_list => { xcli_cmd => 'ats_list', sort_by => 'component_id' },
44             cf_list => { xcli_cmd => 'cf_list', sort_by => 'component_id' },
45             dimm_list => { xcli_cmd => 'dimm_list', sort_by => 'component_id' },
46             fan_list => { xcli_cmd => 'fan_list', sort_by => 'component_id' },
47             mm_list => { xcli_cmd => 'mm_list', sort_by => 'component_id' },
48             switch_list => { xcli_cmd => 'switch_list', sort_by => 'component_id' },
49             service_list => { xcli_cmd => 'service_list', sort_by => 'component_id' },
50             component_list => { xcli_cmd => 'component_list', sort_by => 'component_id' },
51             fc_port_list => { xcli_cmd => 'fc_port_list', sort_by => 'component_id' },
52             ethernet_cable_list => { xcli_cmd => 'ethernet_cable_list', sort_by => 'component_id' },
53             fs_list => { xcli_cmd => 'fs_list', sort_by => 'module_id' },
54             cg_list => { xcli_cmd => 'cg_list', sort_by => 'name' },
55             rule_list => { xcli_cmd => 'rule_list', sort_by => 'name' },
56             metadata_list => { xcli_cmd => 'metadata_list', sort_by => 'object_type' },
57             reservation_list => { xcli_cmd => 'reservation_list', sort_by => 'volume_name' },
58             event_threshold_list => { xcli_cmd => 'event_threshold_list',sort_by => 'code' },
59             snapshot_list => { xcli_cmd => 'snapshot_list', sort_by => 'name', xcli_args => ['vol'] },
60             mapping_list => { xcli_cmd => 'mapping_list', sort_by => 'volume', xcli_args => ['host'] },
61             );
62              
63             {
64 1     1   8 no strict 'refs';
  1         2  
  1         2465  
65            
66             foreach my $m (keys %M_MAP) {
67             *{ __PACKAGE__ . "::$m" . '_raw' } = sub {
68 0     0     my $self= shift;
69 0           my $args;
70              
71 0           foreach my $arg (@{$M_MAP{$m}{xcli_args}}) {
  0            
72 0 0         @_ ? $args .= "$arg=".(shift).' '
73             : return carp "Missing argument $arg"
74             }
75            
76 0           return $self->_xcli_execute( xcli_cmd => $M_MAP{$m}{xcli_cmd}, xcli_args=> $args );
77             };
78              
79             *{ __PACKAGE__ . "::$m" } = sub {
80 0     0     my $self= shift;
81 0           my $p = $m . '_raw';
82 0           my @data = $self->$p(@_);
83              
84 0           my @headers = map { s/%/percent/g; s/#/no/g; s/ /_/g; s/["\(\)\?]//g; lc $_ } (split /,/, shift @data);
  0            
  0            
  0            
  0            
  0            
85 0           my ($idx) = grep { $headers[$_] eq $M_MAP{$m}{sort_by} } 0..$#headers;
  0            
86 0           my %res;
87              
88 0           foreach (@data) {
89 0           my @d = map { s/"//g; $_ } (split /","/);
  0            
  0            
90 0           my $c = 0;
91              
92 0           foreach (@d) { $res{$d[$idx]}{$headers[$c]} = $_; $c++ }
  0            
  0            
93             }
94              
95 0           return %res
96             }
97             }
98             }
99              
100             sub _xcli_execute {
101 0     0     my ($self,%args)= @_;
102 0   0       $args{xcli_args} ||= '';
103 0           my $xcli_arg = "-s -u $self->{username} -p $self->{password} -m $self->{ip_address} $args{xcli_cmd} $args{xcli_args} -t all";
104 0 0         open my $conn, '-|', $self->{xcli}, $xcli_arg or croak 'Couldn\'t open connection to XCLI';
105 0           my @result = map { chomp ; $_ } <$conn>;
  0            
  0            
106              
107 0 0         return ( $result[0] =~ /^["\w*",?]+/ ? @result : undef )
108             }
109              
110             =head1 NAME
111              
112             IBM::XCLI - A Perl interface to the IBM XIV XCLI
113              
114             =cut
115              
116             =head1 SYNOPSIS
117              
118             use IBM::XCLI;
119            
120             my $xiv = IBM::XCLI->new(
121             ip_address => $ip_address,
122             username => $user
123             password => $password,
124             xcli => $xcli
125             );
126              
127             my @volumes = $xiv->vol_list();
128              
129             foreach (@volumes) {
130             s/^"\|"$//g;
131             my(@volume) = split /","/;
132             print "Volume:\t$volume[0]\tSize:\t$volume[1]\tUsed:\t$volume[6]\n";
133             }
134            
135              
136             =head1 DESCRIPTION
137              
138             This module provides a simple object oriented interface to the IBM XIV XCLI utility.
139              
140             The IBM XIV XCLI is a utility providing a command line interface to an IBM XIV storage array
141             exposing complete management and administrative capabilities of the system.
142              
143             This module provides a simple interface to the IBM XIV XCLI utility by providing convenient
144             wrapper methods for a number of XCLI native method calls. These methods are named for and are
145             analagous to their corresponding XCLI counterparts; for example, a call to the vol_list method
146             exposed by this module returns the same data as would an execution of the native vol_list
147             command would be expected to return.
148              
149             The primary difference between the return value of method calls exposed by this module and
150             the return value of native XCLI calls is that methods in this module using native method names
151             return a nested hash rather than whitespace delimited or comma-separated data.
152              
153             Note that if access to the raw data as returned by the XCLI native method call is required then
154             the B methods can be used to retrieve CSV data as retured directly from the XCLI. See the
155             B section below for further details.
156              
157             The XCLI utility must be installed on the same machine as from which the script is ran.
158              
159             =head1 METHODS
160              
161             =head2 new
162              
163             my $xiv = IBM::XCLI->new(
164             ip_address => $ip_address,
165             username => $user
166             password => $password,
167             xcli => $xcli
168             );
169              
170             Constructor method. Creates a new IBM::XCLI object representing a connection to and an instance
171             of a XCLI connection to the target XIV unit.
172              
173             Required parameters are:
174              
175             =over 3
176              
177             =item ip_address
178              
179             The IP address of a management interface on the target XIV unit.
180              
181             =item username
182              
183             The username with which to connect to the target XIV unit.
184              
185             =item password
186              
187             The password with which to connect to the target XIV unit.
188              
189             =item xcli
190              
191             The path to the XCLI binary. This must be an absolute path to a local file for which the executing
192             user has appropriate privileges.
193              
194             =back
195              
196             =head2 host_list
197              
198             This method is analagous to the native XCLI command 'host_list' and returns a nested hash containing the details
199             of all configured hosts and indexed by host name. The hash has the following structure:
200              
201             host-name-1 => {
202             cluster => string,
203             creator => string,
204             fc_ports => comma-separated list of WWPNs,
205             iscsi_ports => comma-separated list of WWPNs,
206             iscsi_chap_secret => string,
207             iscsi_chap_name => string,
208             name => string,
209             performance_class => string,
210             type => string,
211             user_group => string
212             },
213             ...
214             host-name-n => {
215             ...
216             }
217            
218             =head2 pool_list
219              
220             This method is analagous to the native XCLI command 'pool_list' and returns a nested hash containing the details
221             of all configured pools indexed by pool name. The hash has the following structure:
222              
223             pool-name-1 => {
224             create_last_consistent_snapshot => boolean,
225             creator => string,
226             empty_hard_space_gb => int,
227             empty_hard_space_mib => int,
228             empty_space_gb => int,
229             empty_space_mib => int,
230             hard_size_gb => int,
231             hard_size_mib => int,
232             lock_behavior => string,
233             locked => boolean,
234             name => string,
235             protected_snapshots_priority => int,
236             size_gb => int,
237             size_mib => int,
238             snapshot_size_gb => int,
239             snapshot_size_mib => int,
240             used_by_snapshots_gb => int,
241             used_by_snapshots_mib => int,
242             used_by_volumes_gb => int,
243             used_by_volumes_mib => int
244             },
245             ...
246             pool-name-2 => {
247             ...
248             }
249              
250             =head2 mirror_list
251              
252             This method is analagous to the native XCLI command 'mirror_list' and returns a nested hash containing the details
253             of all configured mirrors index by mirror name. The hash has the following structure:
254              
255             mirror-name-1 => {
256             active => boolean,
257             designation => string,
258             last_replicated => timestamp (YYYY-MM-DD HH:MM:SS),
259             link_up => boolean,
260             mirror_error => string,
261             mirror_object => string,
262             mirror_type => string,
263             name => string-f,
264             operational => boolean,
265             remote_peer => string-f,
266             remote_rpo => time (hh:mm:ss),
267             remote_system => string,
268             role => string,
269             rpo => time (hh:mm:ss),
270             schedule_name => string,
271             size_to_sync_mb => signed int,
272             status => string,
273             sync_progress_percent => percent (range 0-100)
274             },
275             ...
276             mirror-list-n => {
277             ...
278             }
279              
280             =head2 vol_list
281              
282             This method is analagous to the native XCLI command 'vol_list' and returns a nested hash containing the details
283             of all configured volumes indexed by voluem name. The hash has the following structure:
284              
285             vol-list-1 => {
286             capacity_blocks => int,
287             consistency_group => string,
288             creator => vcuser,
289             deletion_priority => int,
290             locked => boolean,
291             locked_by_pool => boolean,
292             master_copy_creation_time => timestamp (YYYY-MM-DD HH:MM:SS),,
293             master_name => int,
294             mirrored => boolean,
295             modified => boolean,
296             name => string,
297             pool => string,
298             serial_number => int,
299             short_live_io => boolean,
300             size_gb => int,
301             size_mib => int,
302             snapshot_creation_time => timestamp (YYYY-MM-DD HH:MM:SS),,
303             snapshot_format => boolean,
304             snapshot_group_name => string,
305             snapshot_of => string,
306             snapshot_of_snap_group => string,
307             used_capacity_gb => int,
308             used_capacity_mib => int,
309             vaai_disabled_by_user => boolean,
310             vaai_enabled => boolean,
311             wwn => WWN
312             },
313             ...
314             vol-list-n => {
315             ...
316             }
317              
318             =head2 cluster_list
319              
320             This method is analagous to the native XCLI command 'cluster_list' and returns a nested hash containing the details
321             of all configured clusters index by cluster name. The hash has the following structure:
322              
323             cluster-1 => {
324             creator => string,
325             hosts => comma-separated list of host names,
326             name => string,
327             type => string,
328             user_group => string
329             },
330             ...
331             cluster-n => {
332             ...
333             }
334              
335             =head2 target_list
336              
337             This method is analagous to the native XCLI command 'target_list' and returns a nested hash containing the details
338             of all configured targets index by target name. The hash has the following structure:
339              
340             target-1 => {
341             connected => boolean,
342             connection_threshold => int,
343             creator => string,
344             iscsi_name => IQN,
345             max_initialization_rate => percentage (range 0-100),
346             max_resync_rate => int,
347             max_syncjob_rate => int,
348             name => string,
349             number_of_ports => int,
350             scsi_type => string,
351             system_id => int,
352             xiv_target => boolean
353             }
354             ...
355             target-n => {
356             ...
357             }
358              
359             =head2 dest_list
360              
361             This method is analagous to the native XCLI command 'dest_list' and returns a nested hash containing the details
362             of all configured destinations indexed by destination name. The hash has the following structure:
363              
364             dest-list-1 => {
365             area_code => int,
366             creator => string,
367             email_address => email address,
368             gateways => string,
369             heartbeat_days => int,
370             heartbeat_time => int,
371             name => string,
372             phone_number => phone number,
373             snmp_manager => string,
374             type => string,
375             user => string
376             },
377             ...
378             dest-list-n => {
379             ...
380             }
381              
382             =head2 snap_group_list
383              
384             This method is analagous to the native XCLI command 'snap_group_list' and returns a nested hash containing the details
385             of all configured snap groups indexed by snap grop name. The hash has the following structure:
386              
387             snap-group-1 => {
388             cg => string,
389             deletion_priority => int,
390             locked => boolean,
391             modified => boolean,
392             name => string,
393             snapshot_group_format => boolean,
394             snapshot_time => timestamp (YYYY-MM-DD HH:MM:SS)
395             },
396             ...
397             snap-group-n => {
398             ...
399             }
400              
401             =head2 ipinterface_list
402              
403             This method is analagous to the native XCLI command 'ipinterface_list' and returns a nested hash containing the details
404             of all configured IP interfaces indexed by IP interface name. The hash has the following structure:
405              
406             ipinterface-1 => {
407             default_gateway => IP address (A.B.C.D),
408             ip_address => IP address (A.B.C.D),
409             module => Module designation (e.g. 1:Module:1),
410             mtu => int,
411             name => string,
412             network_mask => netmask (A.B.C.D),
413             ports => int,
414             type => string
415             },
416             ...
417             ipinterface-n => {
418             ...
419             }
420              
421             =head2 target_port_list
422              
423             This method is analagous to the native XCLI command 'target_port_list' and returns a nested hash containing the details
424             of all configured target ports iSCSI IP address. The hash has the following structure:
425              
426             target-port-1 => {
427             active => boolean,
428             iscsi_address => IP address (A.B.C.D),
429             iscsi_port => int,
430             port_type => string,
431             target_name => string,
432             wwpn => WWPN
433             },
434             ...
435             target-port-n => {
436             ...
437             }
438              
439             =head2 reservation_key_list
440              
441             This method is analagous to the native XCLI command 'reservation_key_list' and returns a nested hash containing the details
442             of all configured reservation keys indexed by reservation key. The hash has the following structure:
443              
444             reservation-key-1 => {
445             initiator_port => WWPN,
446             reservation_key => string,
447             volume_name => string
448             },
449             ...
450             reservation-key-2 => {
451             ...
452             }
453              
454             =head2 fc_port_list
455              
456             This method is analagous to the native XCLI command 'fc_port_list' and returns a nested hash containing the details
457             of configured FC ports in the target unit. Note that FC ports are defined in this context as being FC ports physically belonging
458             to the XIV unit.
459              
460             The hash is indexed by FC port WWPN and has the following structure:
461              
462             wwpn-1 => {
463             active_firmware => string,
464             component_id => component ID (1:FC_Port:1:1),
465             configured_rate_gbaud => string,
466             credit => int,
467             current_rate_gbaud => int,
468             currently_functioning => boolean,
469             enabled => int,
470             error_count => int,
471             hba_vendor => string,
472             link_type => string,
473             maximum_supported_rate_gbaud => string,
474             model => string,
475             module => module ID (e.g. 1:Module:1),
476             original_model => string,
477             original_serial => string,
478             port_id => string,
479             port_number => int,
480             port_state => string,
481             requires_service => string,
482             role => string,
483             serial => string,
484             service_reason => string,
485             status => string,
486             user_enabled => boolean,
487             wwpn => WWPN
488             },
489             ...
490             wwpn-n => {
491             ...
492             }
493              
494             =head2 fc_connectivity_list
495              
496             This method is analagous to the native XCLI command 'fc_connectivity_list' and returns a nested hash containing the details
497             of connected FC ports in the target unit. Note that FC ports are defined in this context as being FC ports physically belonging
498             to the XIV unit.
499              
500             The hash is indexed by FC port WWPN and has the following structure:
501              
502             wwwpn-1 => {
503             component_id => connected component ID (e.g. 1:FC_Port:1:1),
504             port_id => int,
505             role => string,
506             wwpn => WWPN
507             },
508             ...
509             wwwpn-n => {
510             ...
511             }
512              
513             =head2 host_connectivity_list
514              
515             This method is analagous to the native XCLI command 'host_connectivity_list' and returns a nested hash containing all details
516             of configured host ports in the target unit.
517              
518             The hash is indexed by WWPN (the same as the value of 'host_port') and has the following structure:
519              
520             wwpn-1 => {
521             host => string,
522             host_port => WWPN,
523             local_fc_port => connected component ID (e.g. 1:FC_Port:1:1),
524             local_iscsi_port => IQN,
525             module => connected module ID (e.g. 1:Module:5),
526             type => string
527             },
528             ...
529             wwpn-n => {
530             ...
531             }
532              
533             =head2 ups_list
534              
535             This method is analagous to the native XCLI command 'ups_list' and returns a nested hash containing details of all UPSs
536             (Untinterruptible Power Supplys) indexed by the UPS component identifier (the same as the value of component_id).
537             The hash has the following structure:
538              
539             ups-id-1 => {
540             aos_version => string,
541             apparent_load_percent_va => int,
542             battery_charge_level => percentage (range 0-100),
543             battery_week_born => signed int,
544             battery_year_born => signed int,
545             component_id => component ID (i.e. 1:UPS:1),
546             component_test_status => string,
547             currently_functioning => boolean,
548             input_power_on => boolean,
549             last_calibration_date => date (MM/DD/YYYY),
550             last_calibration_result => string,
551             last_self_test_date => date (MM/DD/YYYY),
552             last_self_test_result => string,
553             load_percent_watts => int,
554             monitoring_enabled => boolean,
555             next_self_test => timestamp (YYYY-MM-DD HH:MM:SS),
556             original_serial => string,
557             power_consumption => int,
558             predictive_power_load_percent => int,
559             predictive_remaining_runtime => int,
560             requires_service => string,
561             self-test_status => string,
562             serial => string,
563             service_reason => string,
564             status => string,
565             temperature => int,
566             ups_manufacture_date => date (MM/DD/YYYY),
567             ups_status => string,
568             runtime_remaining => int
569             ` },
570             ...
571             ups-id-n => {
572             ...
573             }
574              
575             =head2 psu_list
576              
577             This method is analagous to the native XCLI command 'psu_list' and returns a nested hash containing details of all PSUs
578             (Power Supply Units) indexed by the PSU component identifier (the same as the value of component_id). The hash has the
579             following structure:
580              
581             psu-id-1 => {
582             component_id => component ID (e.g. 1:PSU:1:1),
583             currently_functioning => boolean,
584             hardware_status => string,
585             requires_service => string,
586             service_reason => string,
587             status => string
588             },
589             ...
590             psu-id-n => {
591             ...
592             }
593              
594             =head2 ats_list
595              
596             This method is analagous to the native XCLI command 'ats_list' and returns a nested hash containing details of all ATSs
597             (Automatic Transfer Switches) indexed by the ATS component identifier (the same as the value of component_id). The hash
598             has the following structure:
599              
600             ats-id-1 => {
601             3-phase => boolean,
602             a_pick-up => boolean,
603             b_pick-up => boolean,
604             c_pick-up => boolean,
605             d_pick-up => boolean,
606             ats_connect_errors => int,
607             ats_reply_errors => int,
608             coil_a_on => boolean,
609             coil_b_on => boolean,
610             coil_c_on => boolean,
611             coil_d_on => boolean,
612             component_id => component ID (e.g. 1:ATS:1),
613             currently_functioning => boolean,
614             default_calibration => boolean,
615             dual_active => boolean,
616             firmware_j1_version => string,
617             firmware_j2_version => string,
618             firmware_version => string,
619             interlock_failed => boolean,
620             j1_source => boolean,
621             j2_source => boolean,
622             l1_input_ok => boolean,
623             l2_input_ok => boolean,
624             logic_power => boolean,
625             no_oc_switching => boolean,
626             outlet_1_state => string,
627             outlet_2_state => string,
628             outlet_3_state => string,
629             output_10a => boolean,
630             output_30a_no1 => boolean,
631             output_30a_no2 => boolean,
632             output_30a_no3 => boolean,
633             over-current_j1_phase_a => boolean,
634             over-current_j1_phase_b => boolean,
635             over-current_j1_phase_c => boolean,
636             over-current_j2_phase_a => boolean,
637             over-current_j2_phase_b => boolean,
638             over-current_j2_phase_c => boolean,
639             p1_current_fault => boolean,
640             p3_current_fault => boolean,
641             p2_current_fault => boolean,
642             requires_service => string,
643             rms_current_outlet_p1 => int,
644             rms_current_outlet_p3 => int,
645             rms_current_outlet_p2 => int,
646             serial_control => boolean,
647             service_reason => string,
648             status => string,
649             us_type => boolean
650             },
651             ...
652             ats-id-n => {
653             ...
654             }
655              
656             =head2 cf_list
657              
658             This method is analagous to the native XCLI command 'cf_list' and returns a nested hash containing details of all CFs
659             (Compact Flash cards) indexed by the CF component identifier (the same as the value of component_id). The hash
660             has the following structure:
661              
662             cf-id-1 => {
663             component_id => component ID (e.g. 1:CF:1:1,
664             currently_functioning => boolean,
665             device_name => string,
666             hardware_status => string,
667             original_part_number => string,
668             original_serial => string,
669             part_no => string,
670             requires_service => string,
671             serial => string,
672             service_reason => string,
673             status => string
674             },
675             ...
676             cf-id-n => {
677             ...
678             }
679              
680             =head2 dimm_list
681              
682             This method is analagous to the native XCLI command 'dimm_list' and returns a nested hash containing details of all DIMMS
683             (Dual Inline Memory Modules) indexed by the DIMM component identifier (the same as the value of component_id).
684             The hash has the following structure:
685              
686             dimm-id-1 => {
687             bank => int,
688             channel => int,
689             component_id => component ID (e.g. 1:DIMM:1:1),
690             currently_functioning => boolean,
691             hardware_status => string,
692             manufacturer => string,
693             original_part_number => string,
694             original_serial => string,
695             part_no => string,
696             requires_service => string,
697             serial => string,
698             sizemb => int,
699             speedmhz => int,
700             status => string
701             },
702             ...
703             dimm-id-1 => {
704             ...
705             }
706              
707             =head2 fan_list
708              
709             This method is analagous to the native XCLI command 'fan_list' and returns a nested hash containing details of all fans
710             indexed by the fan component identifier (the same as the value of component_id). The hash has the following structure:
711              
712             fan-id-1 => {
713             component_id => component ID (e.g. 1:Fan:1:1),
714             currently_functioning => boolean,
715             requires_service => string,
716             service_reason => string,
717             status => string
718             },
719             ...
720             fan-id-n => {
721             ...
722             }
723              
724             =head2 mm_list
725              
726             This method is analagous to the native XCLI command 'mm_list' and returns a nested hash containing details of all maintenance
727             modules indexed by the maintenance module identifier (the same as the value of component_id). The hash has the following structure:
728              
729             mm-id-1 => {
730             component_id => component ID (e.g. 1:MaintenanceModule:1),
731             currently_functioning => boolean,
732             enabled => boolean,
733             free_disk_/ => int,
734             free_disk_/var => int,
735             free_memory => int,
736             linkno1 => boolean,
737             linkno2 => boolean,
738             original_serial => string,
739             original_part_number => string,
740             part_no => string,
741             requires_service => string,
742             service_reason => string,
743             serial => string,
744             status => string,
745             temperature => string,
746             total_memory => int,
747             version => string
748             },
749             ...
750             mm-id-n => {
751             ...
752             }
753              
754             =head2 switch_list
755              
756             This method is analagous to the native XCLI command 'switch_list' and returns a nested hash containing details of all switches
757             indexed by the switch component identifier (the same as the value of component_id). The hash has the following structure:
758              
759             switch-id-1 => {
760             ac_power_state => string,
761             component_id => component ID (e.g. 1:Switch:1),
762             current_active_version => string,
763             currently_functioning => boolean,
764             dc_power_state => string,
765             failed_fans => int,
766             interconnect => string,
767             original_serial => string,
768             next_active_version => string,
769             requires_service => string,
770             serial => string,
771             service_reason => string,
772             status => string,
773             temperature => int,
774             temperature_status => string
775             },
776             ...
777             switch-id-n => {
778             ...
779             }
780              
781             =head2 service_list
782              
783             This method is analagous to the native XCLI command 'service_list' and returns a nested hash containing details of all component
784             generic services indexed by the service component identifier (the same as the value of component_id). The hash has the following
785             structure:
786              
787             server-id-1 => {
788             component_id => service component ID (e.g. 1:Data:1),
789             currently_functioning => boolean,
790             status => string,
791             target_status => string
792             },
793             ...
794             service-id-n => {
795             ...
796             }
797              
798             =head2 component_list
799              
800             This method is analagous to the native XCLI command 'component_list' and returns a nested hash containing details of all system
801             components indexed by the system component identifier (the same as the value of component_id). The hash has the following structure:
802              
803             component-id-1 => {
804             component_id => system component ID (e.g. 1:Data:9),
805             currently_functioning => boolean,
806             requires_service => string,
807             service_reason => string,
808             status => string
809             },
810             ...
811             component-id-n => {
812             ...
813             }
814              
815             =head2 ethernet_cable_list
816              
817             This method is analagous to the native XCLI command 'ethernet_cable_list' and returns a nested hash containing details of all
818             Ethernet cables indexed by the system Ethernet cable identifier (the same as the value of component_id). The hash has the
819             following structure:
820              
821             ethernet-cable-1 => {
822             component_id => Ethernet cable component ID (e.g. 1:Ethernet_Cable:6:8),
823             connected_to => switchport component ID (e.g. 1:Switch:1:1),
824             currently_functioning => boolean,
825             interface_role => string,
826             link_status => string,
827             requires_service => string,
828             service_reason => string,
829             should_be_connected_to => switchport component ID (e.g. 1:Switch:1:1),
830             status => string
831             },
832             ...
833             ethernet-cable-n => {
834             ...
835             }
836              
837             =head2 fs_list
838              
839             This method is analagous to the native XCLI command 'fs_list' and returns a nested hash containing details of all file
840             systems indexed by the file system module identifier (the same as the value of module_id). The hash has the following structure:
841              
842             module-id-1 => {
843             device => string,
844             good => boolean,
845             module_id => module identifier (e.g. 1:Module:1),
846             mount_point => string,
847             total_inodes => int,
848             total_size => int,
849             type => string,
850             used_inodes => int,
851             used_size => int,
852             writable => boolean
853             },
854             ...
855             module-id-n => {
856             ...
857             }
858              
859             =head2 cg_list
860              
861             This method is analagous to the native XCLI command 'cg_list' and returns a nested hash containing details of all consistency
862             groups indexed by the consistency group name. The hash has the following structure:
863              
864             consistency-group-name-1 => {
865             mirrored => boolean,
866             name => string,
867             pool_name => string
868             },
869             ...
870             consistency-group-name-n => {
871             ...
872             }
873              
874             =head2 rule_list
875              
876             This method is analagous to the native XCLI command 'rule_list' and returns a nested hash containing details of all event
877             notification rules and indexed by the rule name. The hash has the following structure:
878              
879             rule-name-1 => {
880             active => boolean,
881             category => string,
882             creator => string,
883             destinations => string (destination name),
884             escalation_only => boolean,
885             escalation_rule => string,
886             escalation_time => int,
887             event_codes => string,
888             except_codes => string,
889             minimum_severity => string,
890             name => string,
891             snooze_time => int
892             },
893             ...
894             rule-name-n => {
895             ...
896             }
897              
898             =head2 metadata_list
899              
900             This method is analagous to the native XCLI command 'metadata_list' and returns a nested hash containing details of all
901             metatdata objects indexed by the object name. The hash has the following structure:
902              
903             metadata-object-name-1 => {
904             key => string,
905             name => string,
906             object_type => string,
907             value => string
908             },
909             ...
910             metadata-object-name-n => {
911             ...
912             }
913              
914             =head2 reservation_list
915              
916             This method is analagous to the native XCLI command 'reservation_list' and returns a nested hash containing details of all
917             volume reservations indexed by volume name. The hash has the following structure:
918              
919             volume-name-1 => {
920             initiator_uid => signed integer,
921             persistent_access_type => string,
922             persistent_reservation_type => string,
923             pr_generation => int,
924             reservation_age => string,
925             reservation_type => string,
926             reserving_port => string,
927             volume_name => string
928             },
929             ...
930             reservation-volume-name-n => {
931             ...
932             }
933            
934              
935             =head2 event_threshold_list
936              
937             This method is analagous to the native XCLI command 'event_threshold_list' and returns a nested hash containing details of
938             all event threshold events for volumes indexed by volume name. The hash has the following structure:
939              
940             volume-name-1 => {
941             code => string,
942             critical => percentage (range 0-100),
943             criticaldef => percentage (range 0-100),
944             has_thresholds => boolean,
945             informational => string,
946             informationaldef => percentage (range 0-100),
947             major => percentage (range 0-100),
948             majordef => percentage (range 0-100),
949             minor => percentage (range 0-100),
950             minordef => percentage (range 0-100),
951             not_in_use => boolean,
952             replaced_by => string,
953             warning => percentage (range 0-100),
954             warningdef => percentage (range 0-100)
955             },
956             ...
957             volume-name-1 => {
958             ...
959             }
960            
961             =head2 snapshot_list ( $volume )
962              
963             This method is analagous to the native XCLI command 'snapshot_list' and returns a nested hash containing details of
964             all snapshots for the specified volume indexed by snapshot name. The hash has the following structure:
965              
966             snapshot-1 => {
967             capacity_blocks => int,
968             consistency_group => string,
969             creator => string,
970             deletion_priority => int,
971             locked => boolean,
972             locked_by_pool => boolean,
973             master_copy_creation_time => string,
974             master_name => string,
975             mirrored => boolean,
976             modified => boolean,
977             name => string,
978             pool => string,
979             serial_number => int,
980             short_live_io => boolean,
981             size_gb => int,
982             size_mib => int,
983             snapshot_creation_time => string,
984             snapshot_format => boolean,
985             snapshot_group_name => string,
986             snapshot_of => string,
987             snapshot_of_snap_group => string,
988             used_capacity_gb => int,
989             used_capacity_mib => int,
990             vaai_disabled_by_user => boolean,
991             vaai_enabled => boolean,
992             wwn => WWN
993             }.
994             ...
995             snapshot-n => {
996             ...
997             }
998              
999             =head2 mapping_list ( $host )
1000              
1001             This method is analagous to the native XCLI command 'mapping_list' and returns a nested hash containing mapping details
1002             of all volumes for the specified host indexed by volume name. The hash has the following structure:
1003              
1004             volume-1 => {
1005             locked => boolean,
1006             lun => int,
1007             master => string,
1008             serial_number => int,
1009             size => int,
1010             volume => string
1011             },
1012             ...
1013             volume-n => {
1014             ...
1015             }
1016              
1017              
1018             =head1 RAW METHODS
1019              
1020             The methods below return data as retrieved directly from a call to the corresponding XCLI method with no
1021             additional data formatting. These methods may be useful if you wish to perform data processing or manipulation
1022             in your own custom methods rather than using the methods above.
1023              
1024             =head2 host_list_raw
1025              
1026             This method is analagous to the native host_list XCLI command, it returns an unformatted response as retrieved
1027             directly from the XCLI invocation.
1028              
1029             =head2 pool_list_raw
1030              
1031             This method is analagous to the native pool_list XCLI command, it returns an unformatted response as retrieved
1032             directly from the XCLI invocation.
1033              
1034             =head2 mirror_list_raw
1035              
1036             This method is analagous to the native mirror_list XCLI command, it returns an unformatted response as retrieved
1037             directly from the XCLI invocation.
1038              
1039             =head2 vol_list_raw
1040              
1041             This method is analagous to the native vol_list XCLI command, it returns an unformatted response as retrieved
1042             directly from the XCLI invocation.
1043              
1044             =head2 cluster_list_raw
1045              
1046             This method is analagous to the native cluster_list XCLI command, it returns an unformatted response as retrieved
1047             directly from the XCLI invocation.
1048              
1049             =head2 target_list_raw
1050              
1051             This method is analagous to the native target_list XCLI command, it returns an unformatted response as retrieved
1052             directly from the XCLI invocation.
1053              
1054             =head2 dest_list_raw
1055              
1056             This method is analagous to the native dest_list XCLI command, it returns an unformatted response as retrieved
1057             directly from the XCLI invocation.
1058              
1059             =head2 snap_group_list_raw
1060              
1061             This method is analagous to the native snap_group_list XCLI command, it returns an unformatted response as retrieved
1062             directly from the XCLI invocation.
1063              
1064             =head2 ipinterface_list_raw
1065              
1066             This method is analagous to the native ipinterface_list XCLI command, it returns an unformatted response as retrieved
1067             directly from the XCLI invocation.
1068              
1069             =head2 target_port_list_raw
1070              
1071             This method is analagous to the native target_port_list XCLI command, it returns an unformatted response as retrieved
1072             directly from the XCLI invocation.
1073              
1074             =head2 reservation_key_list_raw
1075              
1076             This method is analagous to the native reservation_key_list XCLI command, it returns an unformatted response as retrieved
1077             directly from the XCLI invocation.
1078              
1079             =head2 fc_port_list_raw
1080              
1081             This method is analagous to the native fc_port_list XCLI command, it returns an unformatted response as retrieved
1082             directly from the XCLI invocation.
1083              
1084             =head2 fc_connectivity_list_raw
1085              
1086             This method is analagous to the native connectivity_list XCLI command, it returns an unformatted response as retrieved
1087             directly from the XCLI invocation.
1088              
1089             =head2 host_connectivity_list_raw
1090              
1091             This method is analagous to the native host_connectivity_list XCLI command, it returns an unformatted response as retrieved
1092             directly from the XCLI invocation.
1093              
1094             =head2 ups_list_raw
1095              
1096             This method is analagous to the native ups_list XCLI command, it returns an unformatted response as retrieved
1097             directly from the XCLI invocation.
1098              
1099             =head2 psu_list_raw
1100              
1101             This method is analagous to the native psu_list XCLI command, it returns an unformatted response as retrieved
1102             directly from the XCLI invocation.
1103              
1104             =head2 ats_list_raw
1105              
1106             This method is analagous to the native ats_list XCLI command, it returns an unformatted response as retrieved
1107             directly from the XCLI invocation.
1108              
1109             =head2 cf_list_raw
1110              
1111             This method is analagous to the native cf_list XCLI command, it returns an unformatted response as retrieved
1112             directly from the XCLI invocation.
1113              
1114             =head2 dimm_list_raw
1115              
1116             This method is analagous to the native dimm_list XCLI command, it returns an unformatted response as retrieved
1117             directly from the XCLI invocation.
1118              
1119             =head2 fan_list_raw
1120              
1121             This method is analagous to the native fan_list XCLI command, it returns an unformatted response as retrieved
1122             directly from the XCLI invocation.
1123              
1124             =head2 mm_list_raw
1125              
1126             This method is analagous to the native mm_list XCLI command, it returns an unformatted response as retrieved
1127             directly from the XCLI invocation.
1128              
1129             =head2 switch_list_raw
1130              
1131             This method is analagous to the native switch_list XCLI command, it returns an unformatted response as retrieved
1132             directly from the XCLI invocation.
1133              
1134             =head2 service_list_raw
1135              
1136             This method is analagous to the native service_list XCLI command, it returns an unformatted response as retrieved
1137             directly from the XCLI invocation.
1138              
1139             =head2 component_list_raw
1140              
1141             This method is analagous to the native component_list XCLI command, it returns an unformatted response as retrieved
1142             directly from the XCLI invocation.
1143              
1144             =head2 ethernet_cable_list_raw
1145              
1146             This method is analagous to the native ethernet_cable_list XCLI command, it returns an unformatted response as retrieved
1147             directly from the XCLI invocation.
1148              
1149             =head2 fs_list_raw
1150              
1151             This method is analagous to the native fs_list XCLI command, it returns an unformatted response as retrieved
1152             directly from the XCLI invocation.
1153              
1154             =head2 cg_list_raw
1155              
1156             This method is analagous to the native cg_list XCLI command, it returns an unformatted response as retrieved
1157             directly from the XCLI invocation.
1158              
1159             =head2 rule_list_raw
1160              
1161             This method is analagous to the native rule_list XCLI command, it returns an unformatted response as retrieved
1162             directly from the XCLI invocation.
1163              
1164             =head2 metadata_list_raw
1165              
1166             This method is analagous to the native metadata_list XCLI command, it returns an unformatted response as retrieved
1167             directly from the XCLI invocation.
1168              
1169             =head2 reservation_list_raw
1170              
1171             This method is analagous to the native reservation_list XCLI command, it returns an unformatted response as retrieved
1172             directly from the XCLI invocation.
1173              
1174             =head2 event_threshold_list_raw
1175              
1176             This method is analagous to the native event_threshold_list XCLI command, it returns an unformatted response as retrieved
1177             directly from the XCLI invocation.
1178              
1179             =head2 snapshot_list_raw ( $volume )
1180              
1181             This method is analagous to the native snapshot_list XCLI command, it returns an unformatted response as retrieved
1182             directly from the XCLI invocation.
1183              
1184             =head2 mapping_list_raw ( $host )
1185              
1186             This method is analagous to the native mapping_list XCLI command, it returns an unformatted response as retrieved
1187             directly from the XCLI invocation.
1188              
1189             =head1 AUTHOR
1190              
1191             Luke Poskitt, C<< >>
1192              
1193             =head1 BUGS
1194              
1195             Please report any bugs or feature requests to C, or through
1196             the web interface at L. I will be notified, and then you'll
1197             automatically be notified of progress on your bug as I make changes.
1198              
1199              
1200             =head1 SUPPORT
1201              
1202             You can find documentation for this module with the perldoc command.
1203              
1204             perldoc IBM::XCLI
1205              
1206              
1207             You can also look for information at:
1208              
1209             =over 4
1210              
1211             =item * RT: CPAN's request tracker
1212              
1213             L
1214              
1215             =item * AnnoCPAN: Annotated CPAN documentation
1216              
1217             L
1218              
1219             =item * CPAN Ratings
1220              
1221             L
1222              
1223             =item * Search CPAN
1224              
1225             L
1226              
1227             =back
1228              
1229             =head1 LICENSE AND COPYRIGHT
1230              
1231             Copyright 2012 Luke Poskitt.
1232              
1233             This program is free software; you can redistribute it and/or modify it
1234             under the terms of either: the GNU General Public License as published
1235             by the Free Software Foundation; or the Artistic License.
1236              
1237             See http://dev.perl.org/licenses/ for more information.
1238              
1239              
1240             =cut
1241              
1242             1;