| 1 | package Net::ILO; | ||||||||||||||||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||||||||||||||||
| 3 | 7 | ▶ | use strict; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 4 | 7 | ▶ | use warnings; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 5 | |||||||||||||||||||||||||||||||||||||||||||
| 6 | 7 | ▶ | use Carp; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 7 | 7 | ▶ | use Data::Dumper; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 8 | 7 | ▶ | use English qw(-no_match_vars); | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 9 | 7 | ▶ | use IO::Socket::SSL; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 10 | 7 | ▶ | use XML::Simple; | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||||||||||||||||
| 11 | |||||||||||||||||||||||||||||||||||||||||||
| 12 | 7 | our $VERSION = '0.54'; | |||||||||||||||||||||||||||||||||||||||||
| 13 | |||||||||||||||||||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||||||||||||||||
| 15 | 7 | my $METHOD_UNSUPPORTED = 'Method not supported by this iLO version'; | |||||||||||||||||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||||||||||||||||
| 18 | 11 | ▶ | sub address { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
address: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||||||||||||||||
| 20 | 11 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 21 | |||||||||||||||||||||||||||||||||||||||||||
| 22 | 11 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 23 | 7 | $self->{address} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 24 | } | ||||||||||||||||||||||||||||||||||||||||||
| 25 | |||||||||||||||||||||||||||||||||||||||||||
| 26 | 11 | return $self->{address}; | |||||||||||||||||||||||||||||||||||||||||
| 27 | |||||||||||||||||||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||||||||||||||||
| 31 | 0 | ▶ | sub add_user { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
add_user: not called CC=16 SCAR=56.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 32 | |||||||||||||||||||||||||||||||||||||||||||
| 33 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 34 | |||||||||||||||||||||||||||||||||||||||||||
| 35 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||||||||||||||||
| 37 | 0 | my $arg_ref = shift; | |||||||||||||||||||||||||||||||||||||||||
| 38 | |||||||||||||||||||||||||||||||||||||||||||
| 39 | 0 | ▶ | my $user_name = $arg_ref->{name} or croak 'name required'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 40 | 0 | ▶ | my $user_login = $arg_ref->{username} or croak 'username required'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 41 | 0 | ▶ | my $user_password = $arg_ref->{password} or croak 'password required'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 42 | |||||||||||||||||||||||||||||||||||||||||||
| 43 | 0 | ▶ | my $user_admin = $arg_ref->{admin} || 'No'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'admin'} || 'No'
MC/DC0%0/1
$arg_ref->{'admin'} || 'No'
$arg_ref->{'admin'}
Truth table0%0/2
A
A= $arg_ref->{'admin'}
| |||||||||||||||||||||||||||||||||||||||||||
| 44 | 0 | ▶ | my $user_can_remote = $arg_ref->{remote_console_privilege} || 'No'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'remote_console_privilege'} || 'No'
MC/DC0%0/1
$arg_ref->{'remote_console_privilege'} || 'No'
$arg_ref->{'remote_console_privilege'}
Truth table0%0/2
A
A= $arg_ref->{'remote_console_privilege'}
| |||||||||||||||||||||||||||||||||||||||||||
| 45 | 0 | ▶ | my $user_can_reset = $arg_ref->{reset_privilege} || 'No'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'reset_privilege'} || 'No'
MC/DC0%0/1
$arg_ref->{'reset_privilege'} || 'No'
$arg_ref->{'reset_privilege'}
Truth table0%0/2
A
A= $arg_ref->{'reset_privilege'}
| |||||||||||||||||||||||||||||||||||||||||||
| 46 | 0 | ▶ | my $user_can_virtual = $arg_ref->{virtual_media_privilege} || 'No'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'virtual_media_privilege'} || 'No'
MC/DC0%0/1
$arg_ref->{'virtual_media_privilege'} || 'No'
$arg_ref->{'virtual_media_privilege'}
Truth table0%0/2
A
A= $arg_ref->{'virtual_media_privilege'}
| |||||||||||||||||||||||||||||||||||||||||||
| 47 | 0 | ▶ | my $user_can_config = $arg_ref->{config_ilo_privilege} || 'No'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'config_ilo_privilege'} || 'No'
MC/DC0%0/1
$arg_ref->{'config_ilo_privilege'} || 'No'
$arg_ref->{'config_ilo_privilege'}
Truth table0%0/2
A
A= $arg_ref->{'config_ilo_privilege'}
| |||||||||||||||||||||||||||||||||||||||||||
| 48 | 0 | ▶ | my $user_can_view_logs = $arg_ref->{view_logs_privilege} || 'No'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'view_logs_privilege'} || 'No'
MC/DC0%0/1
$arg_ref->{'view_logs_privilege'} || 'No'
$arg_ref->{'view_logs_privilege'}
Truth table0%0/2
A
A= $arg_ref->{'view_logs_privilege'}
| |||||||||||||||||||||||||||||||||||||||||||
| 49 | 0 | ▶ | my $user_can_clear_logs = $arg_ref->{clear_logs_privilege} || 'No'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'clear_logs_privilege'} || 'No'
MC/DC0%0/1
$arg_ref->{'clear_logs_privilege'} || 'No'
$arg_ref->{'clear_logs_privilege'}
Truth table0%0/2
A
A= $arg_ref->{'clear_logs_privilege'}
| |||||||||||||||||||||||||||||||||||||||||||
| 50 | 0 | ▶ | my $user_can_update = $arg_ref->{update_ilo_privilege} || 'No'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$arg_ref->{'update_ilo_privilege'} || 'No'
MC/DC0%0/1
$arg_ref->{'update_ilo_privilege'} || 'No'
$arg_ref->{'update_ilo_privilege'}
Truth table0%0/2
A
A= $arg_ref->{'update_ilo_privilege'}
| |||||||||||||||||||||||||||||||||||||||||||
| 51 | |||||||||||||||||||||||||||||||||||||||||||
| 52 | 0 | my $ilo_command = qq| | |||||||||||||||||||||||||||||||||||||||||
| 53 | <USER_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 54 | <ADD_USER USER_NAME="$user_name" USER_LOGIN="$user_login" PASSWORD="$user_password"> | ||||||||||||||||||||||||||||||||||||||||||
| 55 | <ADMIN_PRIV value="$user_admin"/> | ||||||||||||||||||||||||||||||||||||||||||
| 56 | <REMOTE_CONS_PRIV value="$user_can_remote"/> | ||||||||||||||||||||||||||||||||||||||||||
| 57 | <RESET_SERVER_PRIV value="$user_can_reset"/> | ||||||||||||||||||||||||||||||||||||||||||
| 58 | <VIRTUAL_MEDIA_PRIV value="$user_can_virtual"/> | ||||||||||||||||||||||||||||||||||||||||||
| 59 | <CONFIG_ILO_PRIV value="$user_can_config"/> | ||||||||||||||||||||||||||||||||||||||||||
| 60 | <VIEW_LOGS_PRIV value="$user_can_view_logs"/> | ||||||||||||||||||||||||||||||||||||||||||
| 61 | <CLEAR_LOGS_PRIV value="$user_can_clear_logs"/> | ||||||||||||||||||||||||||||||||||||||||||
| 62 | <UPDATE_ILO_PRIV value="$user_can_update"/> | ||||||||||||||||||||||||||||||||||||||||||
| 63 | </ADD_USER> | ||||||||||||||||||||||||||||||||||||||||||
| 64 | </USER_INFO> | ||||||||||||||||||||||||||||||||||||||||||
| 65 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 66 | |||||||||||||||||||||||||||||||||||||||||||
| 67 | 0 | $ilo_command = $self->_wrap($ilo_command); | |||||||||||||||||||||||||||||||||||||||||
| 68 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 69 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 70 | |||||||||||||||||||||||||||||||||||||||||||
| 71 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 72 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 73 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 74 | } | ||||||||||||||||||||||||||||||||||||||||||
| 75 | |||||||||||||||||||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||||||||||||||||
| 77 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||||||||||||||||
| 79 | 0 | croak 'add_user() requires parameters'; | |||||||||||||||||||||||||||||||||||||||||
| 80 | |||||||||||||||||||||||||||||||||||||||||||
| 81 | } | ||||||||||||||||||||||||||||||||||||||||||
| 82 | |||||||||||||||||||||||||||||||||||||||||||
| 83 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 84 | |||||||||||||||||||||||||||||||||||||||||||
| 85 | } | ||||||||||||||||||||||||||||||||||||||||||
| 86 | |||||||||||||||||||||||||||||||||||||||||||
| 87 | |||||||||||||||||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub biosdate { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
biosdate: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||||||||||||||||
| 90 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||||||||||||||||
| 92 | 0 | ▶ | if (!$self->{biosdate}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 93 | 0 | ▶ | $self->_populate_host_data or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 94 | } | ||||||||||||||||||||||||||||||||||||||||||
| 95 | |||||||||||||||||||||||||||||||||||||||||||
| 96 | 0 | return $self->{biosdate}; | |||||||||||||||||||||||||||||||||||||||||
| 97 | |||||||||||||||||||||||||||||||||||||||||||
| 98 | } | ||||||||||||||||||||||||||||||||||||||||||
| 99 | |||||||||||||||||||||||||||||||||||||||||||
| 100 | |||||||||||||||||||||||||||||||||||||||||||
| 101 | 0 | ▶ | sub cpus { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
cpus: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 102 | |||||||||||||||||||||||||||||||||||||||||||
| 103 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 104 | |||||||||||||||||||||||||||||||||||||||||||
| 105 | 0 | ▶ | if (!$self->{cpus}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 106 | 0 | ▶ | $self->_populate_host_data or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 107 | } | ||||||||||||||||||||||||||||||||||||||||||
| 108 | |||||||||||||||||||||||||||||||||||||||||||
| 109 | 0 | return $self->{cpus}; | |||||||||||||||||||||||||||||||||||||||||
| 110 | |||||||||||||||||||||||||||||||||||||||||||
| 111 | } | ||||||||||||||||||||||||||||||||||||||||||
| 112 | |||||||||||||||||||||||||||||||||||||||||||
| 113 | |||||||||||||||||||||||||||||||||||||||||||
| 114 | 0 | ▶ | sub del_user { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
del_user: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 115 | |||||||||||||||||||||||||||||||||||||||||||
| 116 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 117 | |||||||||||||||||||||||||||||||||||||||||||
| 118 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 119 | |||||||||||||||||||||||||||||||||||||||||||
| 120 | 0 | my $user_login = shift; | |||||||||||||||||||||||||||||||||||||||||
| 121 | |||||||||||||||||||||||||||||||||||||||||||
| 122 | 0 | my $ilo_command = qq| | |||||||||||||||||||||||||||||||||||||||||
| 123 | <USER_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 124 | <DELETE_USER USER_LOGIN="$user_login"/> | ||||||||||||||||||||||||||||||||||||||||||
| 125 | </USER_INFO> | ||||||||||||||||||||||||||||||||||||||||||
| 126 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 127 | |||||||||||||||||||||||||||||||||||||||||||
| 128 | 0 | $ilo_command = $self->_wrap($ilo_command); | |||||||||||||||||||||||||||||||||||||||||
| 129 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 130 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 131 | |||||||||||||||||||||||||||||||||||||||||||
| 132 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 133 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 134 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 135 | } | ||||||||||||||||||||||||||||||||||||||||||
| 136 | |||||||||||||||||||||||||||||||||||||||||||
| 137 | } | ||||||||||||||||||||||||||||||||||||||||||
| 138 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 139 | |||||||||||||||||||||||||||||||||||||||||||
| 140 | 0 | croak 'del_user() requires the username to delete'; | |||||||||||||||||||||||||||||||||||||||||
| 141 | |||||||||||||||||||||||||||||||||||||||||||
| 142 | } | ||||||||||||||||||||||||||||||||||||||||||
| 143 | |||||||||||||||||||||||||||||||||||||||||||
| 144 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 145 | |||||||||||||||||||||||||||||||||||||||||||
| 146 | } | ||||||||||||||||||||||||||||||||||||||||||
| 147 | |||||||||||||||||||||||||||||||||||||||||||
| 148 | |||||||||||||||||||||||||||||||||||||||||||
| 149 | 0 | ▶ | sub dhcp_enabled { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
dhcp_enabled: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 150 | |||||||||||||||||||||||||||||||||||||||||||
| 151 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 152 | |||||||||||||||||||||||||||||||||||||||||||
| 153 | 0 | ▶ | if (!$self->{dhcp_enable}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 154 | 0 | ▶ | $self->_populate_network_settings or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 155 | } | ||||||||||||||||||||||||||||||||||||||||||
| 156 | |||||||||||||||||||||||||||||||||||||||||||
| 157 | 0 | return $self->{dhcp_enable}; | |||||||||||||||||||||||||||||||||||||||||
| 158 | |||||||||||||||||||||||||||||||||||||||||||
| 159 | } | ||||||||||||||||||||||||||||||||||||||||||
| 160 | |||||||||||||||||||||||||||||||||||||||||||
| 161 | |||||||||||||||||||||||||||||||||||||||||||
| 162 | 0 | ▶ | sub domain_name { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
domain_name: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 163 | |||||||||||||||||||||||||||||||||||||||||||
| 164 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 165 | |||||||||||||||||||||||||||||||||||||||||||
| 166 | 0 | ▶ | if (!$self->{domain_name}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 167 | 0 | ▶ | $self->_populate_network_settings or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 168 | } | ||||||||||||||||||||||||||||||||||||||||||
| 169 | |||||||||||||||||||||||||||||||||||||||||||
| 170 | 0 | return $self->{domain_name}; | |||||||||||||||||||||||||||||||||||||||||
| 171 | |||||||||||||||||||||||||||||||||||||||||||
| 172 | } | ||||||||||||||||||||||||||||||||||||||||||
| 173 | |||||||||||||||||||||||||||||||||||||||||||
| 174 | |||||||||||||||||||||||||||||||||||||||||||
| 175 | 4 | ▶ | sub error { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
error: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 176 | |||||||||||||||||||||||||||||||||||||||||||
| 177 | 4 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 178 | |||||||||||||||||||||||||||||||||||||||||||
| 179 | 4 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 180 | 2 | $self->{error} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 181 | } | ||||||||||||||||||||||||||||||||||||||||||
| 182 | |||||||||||||||||||||||||||||||||||||||||||
| 183 | 4 | return $self->{error}; | |||||||||||||||||||||||||||||||||||||||||
| 184 | |||||||||||||||||||||||||||||||||||||||||||
| 185 | } | ||||||||||||||||||||||||||||||||||||||||||
| 186 | |||||||||||||||||||||||||||||||||||||||||||
| 187 | |||||||||||||||||||||||||||||||||||||||||||
| 188 | 0 | ▶ | sub fans { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fans: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 189 | |||||||||||||||||||||||||||||||||||||||||||
| 190 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 191 | |||||||||||||||||||||||||||||||||||||||||||
| 192 | 0 | ▶ | if (!$self->{fans}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 193 | 0 | ▶ | $self->_populate_embedded_health or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 194 | } | ||||||||||||||||||||||||||||||||||||||||||
| 195 | |||||||||||||||||||||||||||||||||||||||||||
| 196 | 0 | return $self->{fans}; | |||||||||||||||||||||||||||||||||||||||||
| 197 | |||||||||||||||||||||||||||||||||||||||||||
| 198 | } | ||||||||||||||||||||||||||||||||||||||||||
| 199 | |||||||||||||||||||||||||||||||||||||||||||
| 200 | |||||||||||||||||||||||||||||||||||||||||||
| 201 | 0 | ▶ | sub fw_date { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fw_date: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 202 | |||||||||||||||||||||||||||||||||||||||||||
| 203 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 204 | |||||||||||||||||||||||||||||||||||||||||||
| 205 | 0 | ▶ | if (!$self->{fw_date}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 206 | 0 | ▶ | $self->_populate_fw_version or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 208 | |||||||||||||||||||||||||||||||||||||||||||
| 209 | 0 | return $self->{fw_date}; | |||||||||||||||||||||||||||||||||||||||||
| 210 | |||||||||||||||||||||||||||||||||||||||||||
| 211 | } | ||||||||||||||||||||||||||||||||||||||||||
| 212 | |||||||||||||||||||||||||||||||||||||||||||
| 213 | |||||||||||||||||||||||||||||||||||||||||||
| 214 | 0 | ▶ | sub fw_type { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fw_type: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 215 | |||||||||||||||||||||||||||||||||||||||||||
| 216 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 217 | |||||||||||||||||||||||||||||||||||||||||||
| 218 | 0 | ▶ | if (!$self->{fw_type}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 219 | 0 | ▶ | $self->_populate_fw_version or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 220 | } | ||||||||||||||||||||||||||||||||||||||||||
| 221 | |||||||||||||||||||||||||||||||||||||||||||
| 222 | 0 | return $self->{fw_type}; | |||||||||||||||||||||||||||||||||||||||||
| 223 | |||||||||||||||||||||||||||||||||||||||||||
| 224 | } | ||||||||||||||||||||||||||||||||||||||||||
| 225 | |||||||||||||||||||||||||||||||||||||||||||
| 226 | |||||||||||||||||||||||||||||||||||||||||||
| 227 | 0 | ▶ | sub fw_version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
fw_version: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 228 | |||||||||||||||||||||||||||||||||||||||||||
| 229 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 230 | |||||||||||||||||||||||||||||||||||||||||||
| 231 | 0 | ▶ | if (!$self->{fw_version}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 232 | 0 | ▶ | $self->_populate_fw_version or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 233 | } | ||||||||||||||||||||||||||||||||||||||||||
| 234 | |||||||||||||||||||||||||||||||||||||||||||
| 235 | 0 | return $self->{fw_version}; | |||||||||||||||||||||||||||||||||||||||||
| 236 | |||||||||||||||||||||||||||||||||||||||||||
| 237 | } | ||||||||||||||||||||||||||||||||||||||||||
| 238 | |||||||||||||||||||||||||||||||||||||||||||
| 239 | |||||||||||||||||||||||||||||||||||||||||||
| 240 | 0 | ▶ | sub gateway { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
gateway: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 241 | |||||||||||||||||||||||||||||||||||||||||||
| 242 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 243 | |||||||||||||||||||||||||||||||||||||||||||
| 244 | 0 | ▶ | if (!$self->{gateway_ip_address}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 245 | 0 | ▶ | $self->_populate_network_settings or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 247 | |||||||||||||||||||||||||||||||||||||||||||
| 248 | 0 | return $self->{gateway_ip_address}; | |||||||||||||||||||||||||||||||||||||||||
| 249 | |||||||||||||||||||||||||||||||||||||||||||
| 250 | } | ||||||||||||||||||||||||||||||||||||||||||
| 251 | |||||||||||||||||||||||||||||||||||||||||||
| 252 | |||||||||||||||||||||||||||||||||||||||||||
| 253 | 0 | ▶ | sub hostname { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
hostname: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 254 | |||||||||||||||||||||||||||||||||||||||||||
| 255 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 256 | |||||||||||||||||||||||||||||||||||||||||||
| 257 | 0 | ▶ | if (!$self->{dns_name}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 258 | 0 | ▶ | $self->_populate_network_settings or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 259 | } | ||||||||||||||||||||||||||||||||||||||||||
| 260 | |||||||||||||||||||||||||||||||||||||||||||
| 261 | 0 | return $self->{dns_name}; | |||||||||||||||||||||||||||||||||||||||||
| 262 | |||||||||||||||||||||||||||||||||||||||||||
| 263 | } | ||||||||||||||||||||||||||||||||||||||||||
| 264 | |||||||||||||||||||||||||||||||||||||||||||
| 265 | |||||||||||||||||||||||||||||||||||||||||||
| 266 | 0 | ▶ | sub http_port { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
http_port: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 267 | |||||||||||||||||||||||||||||||||||||||||||
| 268 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 269 | |||||||||||||||||||||||||||||||||||||||||||
| 270 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 271 | |||||||||||||||||||||||||||||||||||||||||||
| 272 | 0 | my $http_port = shift; | |||||||||||||||||||||||||||||||||||||||||
| 273 | |||||||||||||||||||||||||||||||||||||||||||
| 274 | 0 | ▶ | _port_is_valid($http_port) or croak "HTTP port must be an integer between 0 and 65535"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 275 | |||||||||||||||||||||||||||||||||||||||||||
| 276 | 0 | my $ilo_command = qq| | |||||||||||||||||||||||||||||||||||||||||
| 277 | <RIB_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 278 | <MOD_GLOBAL_SETTINGS> | ||||||||||||||||||||||||||||||||||||||||||
| 279 | <HTTP_PORT value="$http_port"/> | ||||||||||||||||||||||||||||||||||||||||||
| 280 | </MOD_GLOBAL_SETTINGS> | ||||||||||||||||||||||||||||||||||||||||||
| 281 | </RIB_INFO> | ||||||||||||||||||||||||||||||||||||||||||
| 282 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 283 | |||||||||||||||||||||||||||||||||||||||||||
| 284 | 0 | $ilo_command = $self->_wrap($ilo_command); | |||||||||||||||||||||||||||||||||||||||||
| 285 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 286 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 287 | |||||||||||||||||||||||||||||||||||||||||||
| 288 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 289 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 290 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 291 | } | ||||||||||||||||||||||||||||||||||||||||||
| 292 | |||||||||||||||||||||||||||||||||||||||||||
| 293 | 0 | $self->{http_port} = $http_port; | |||||||||||||||||||||||||||||||||||||||||
| 294 | |||||||||||||||||||||||||||||||||||||||||||
| 295 | } | ||||||||||||||||||||||||||||||||||||||||||
| 296 | |||||||||||||||||||||||||||||||||||||||||||
| 297 | 0 | ▶ | if (!$self->{http_port}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 298 | 0 | ▶ | $self->_populate_global_settings or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 299 | } | ||||||||||||||||||||||||||||||||||||||||||
| 300 | |||||||||||||||||||||||||||||||||||||||||||
| 301 | 0 | return $self->{http_port}; | |||||||||||||||||||||||||||||||||||||||||
| 302 | |||||||||||||||||||||||||||||||||||||||||||
| 303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 304 | |||||||||||||||||||||||||||||||||||||||||||
| 305 | |||||||||||||||||||||||||||||||||||||||||||
| 306 | 0 | ▶ | sub https_port { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
https_port: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 307 | |||||||||||||||||||||||||||||||||||||||||||
| 308 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 309 | |||||||||||||||||||||||||||||||||||||||||||
| 310 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 311 | |||||||||||||||||||||||||||||||||||||||||||
| 312 | 0 | my $https_port = shift; | |||||||||||||||||||||||||||||||||||||||||
| 313 | |||||||||||||||||||||||||||||||||||||||||||
| 314 | 0 | ▶ | _port_is_valid($https_port) or croak "HTTPS port must be an integer between 0 and 65535"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 315 | |||||||||||||||||||||||||||||||||||||||||||
| 316 | 0 | my $ilo_command = qq| | |||||||||||||||||||||||||||||||||||||||||
| 317 | <RIB_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 318 | <MOD_GLOBAL_SETTINGS> | ||||||||||||||||||||||||||||||||||||||||||
| 319 | <HTTPS_PORT value="$https_port"/> | ||||||||||||||||||||||||||||||||||||||||||
| 320 | </MOD_GLOBAL_SETTINGS> | ||||||||||||||||||||||||||||||||||||||||||
| 321 | </RIB_INFO> | ||||||||||||||||||||||||||||||||||||||||||
| 322 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 323 | |||||||||||||||||||||||||||||||||||||||||||
| 324 | 0 | $ilo_command = $self->_wrap($ilo_command); | |||||||||||||||||||||||||||||||||||||||||
| 325 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 326 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 327 | |||||||||||||||||||||||||||||||||||||||||||
| 328 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 329 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 330 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 331 | } | ||||||||||||||||||||||||||||||||||||||||||
| 332 | |||||||||||||||||||||||||||||||||||||||||||
| 333 | 0 | $self->{https_port} = $https_port; | |||||||||||||||||||||||||||||||||||||||||
| 334 | |||||||||||||||||||||||||||||||||||||||||||
| 335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 336 | |||||||||||||||||||||||||||||||||||||||||||
| 337 | 0 | ▶ | if (!$self->{https_port}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 338 | 0 | ▶ | $self->_populate_global_settings or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 340 | |||||||||||||||||||||||||||||||||||||||||||
| 341 | 0 | return $self->{https_port}; | |||||||||||||||||||||||||||||||||||||||||
| 342 | |||||||||||||||||||||||||||||||||||||||||||
| 343 | } | ||||||||||||||||||||||||||||||||||||||||||
| 344 | |||||||||||||||||||||||||||||||||||||||||||
| 345 | |||||||||||||||||||||||||||||||||||||||||||
| 346 | 0 | ▶ | sub ip_address { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ip_address: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 347 | |||||||||||||||||||||||||||||||||||||||||||
| 348 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 349 | |||||||||||||||||||||||||||||||||||||||||||
| 350 | 0 | ▶ | if (!$self->{ip_address}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 351 | 0 | ▶ | $self->_populate_network_settings or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 352 | } | ||||||||||||||||||||||||||||||||||||||||||
| 353 | |||||||||||||||||||||||||||||||||||||||||||
| 354 | 0 | return $self->{ip_address}; | |||||||||||||||||||||||||||||||||||||||||
| 355 | |||||||||||||||||||||||||||||||||||||||||||
| 356 | } | ||||||||||||||||||||||||||||||||||||||||||
| 357 | |||||||||||||||||||||||||||||||||||||||||||
| 358 | |||||||||||||||||||||||||||||||||||||||||||
| 359 | 0 | ▶ | sub license { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
license: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 360 | |||||||||||||||||||||||||||||||||||||||||||
| 361 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 362 | |||||||||||||||||||||||||||||||||||||||||||
| 363 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 364 | |||||||||||||||||||||||||||||||||||||||||||
| 365 | 0 | my $license_key = shift; | |||||||||||||||||||||||||||||||||||||||||
| 366 | |||||||||||||||||||||||||||||||||||||||||||
| 367 | 0 | my $ilo_command = qq| | |||||||||||||||||||||||||||||||||||||||||
| 368 | <RIB_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 369 | <LICENSE> | ||||||||||||||||||||||||||||||||||||||||||
| 370 | <ACTIVATE KEY="$license_key"/> | ||||||||||||||||||||||||||||||||||||||||||
| 371 | </LICENSE> | ||||||||||||||||||||||||||||||||||||||||||
| 372 | </RIB_INFO> | ||||||||||||||||||||||||||||||||||||||||||
| 373 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 374 | |||||||||||||||||||||||||||||||||||||||||||
| 375 | 0 | $ilo_command = $self->_wrap($ilo_command); | |||||||||||||||||||||||||||||||||||||||||
| 376 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 377 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 378 | |||||||||||||||||||||||||||||||||||||||||||
| 379 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 380 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 381 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 382 | } | ||||||||||||||||||||||||||||||||||||||||||
| 383 | |||||||||||||||||||||||||||||||||||||||||||
| 384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 385 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 386 | |||||||||||||||||||||||||||||||||||||||||||
| 387 | 0 | croak 'license() requires the license key as a paramater'; | |||||||||||||||||||||||||||||||||||||||||
| 388 | |||||||||||||||||||||||||||||||||||||||||||
| 389 | } | ||||||||||||||||||||||||||||||||||||||||||
| 390 | |||||||||||||||||||||||||||||||||||||||||||
| 391 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 392 | |||||||||||||||||||||||||||||||||||||||||||
| 393 | } | ||||||||||||||||||||||||||||||||||||||||||
| 394 | |||||||||||||||||||||||||||||||||||||||||||
| 395 | |||||||||||||||||||||||||||||||||||||||||||
| 396 | 0 | ▶ | sub mac01 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mac01: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 397 | |||||||||||||||||||||||||||||||||||||||||||
| 398 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 399 | |||||||||||||||||||||||||||||||||||||||||||
| 400 | 0 | ▶ | if (!$self->{mac01}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 401 | 0 | ▶ | $self->_populate_host_data or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 402 | } | ||||||||||||||||||||||||||||||||||||||||||
| 403 | |||||||||||||||||||||||||||||||||||||||||||
| 404 | 0 | ▶ | if ($self->{mac01}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 405 | 0 | return $self->{mac01}; | |||||||||||||||||||||||||||||||||||||||||
| 406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 407 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 408 | 0 | $self->error($METHOD_UNSUPPORTED); | |||||||||||||||||||||||||||||||||||||||||
| 409 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 410 | } | ||||||||||||||||||||||||||||||||||||||||||
| 411 | |||||||||||||||||||||||||||||||||||||||||||
| 412 | } | ||||||||||||||||||||||||||||||||||||||||||
| 413 | |||||||||||||||||||||||||||||||||||||||||||
| 414 | |||||||||||||||||||||||||||||||||||||||||||
| 415 | 0 | ▶ | sub mac02 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mac02: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 416 | |||||||||||||||||||||||||||||||||||||||||||
| 417 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 418 | |||||||||||||||||||||||||||||||||||||||||||
| 419 | 0 | ▶ | if (!$self->{mac02}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 420 | 0 | ▶ | $self->_populate_host_data or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 421 | } | ||||||||||||||||||||||||||||||||||||||||||
| 422 | |||||||||||||||||||||||||||||||||||||||||||
| 423 | 0 | ▶ | if ($self->{mac02}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 424 | 0 | return $self->{mac02}; | |||||||||||||||||||||||||||||||||||||||||
| 425 | } | ||||||||||||||||||||||||||||||||||||||||||
| 426 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 427 | 0 | $self->error($METHOD_UNSUPPORTED); | |||||||||||||||||||||||||||||||||||||||||
| 428 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 429 | } | ||||||||||||||||||||||||||||||||||||||||||
| 430 | |||||||||||||||||||||||||||||||||||||||||||
| 431 | } | ||||||||||||||||||||||||||||||||||||||||||
| 432 | |||||||||||||||||||||||||||||||||||||||||||
| 433 | |||||||||||||||||||||||||||||||||||||||||||
| 434 | 0 | ▶ | sub mac03 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mac03: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 435 | |||||||||||||||||||||||||||||||||||||||||||
| 436 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 437 | |||||||||||||||||||||||||||||||||||||||||||
| 438 | # if mac01 is defined but mac03 isn't we aren't going to get it | ||||||||||||||||||||||||||||||||||||||||||
| 439 | # this time around either | ||||||||||||||||||||||||||||||||||||||||||
| 440 | |||||||||||||||||||||||||||||||||||||||||||
| 441 | 0 | ▶ | if (!$self->{mac03} && !$self->{mac01}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"mac03"} or $self->{"mac01"}
MC/DC0%0/2
$self->{"mac03"} or $self->{"mac01"}
$self->{"mac03"}
$self->{"mac01"}
Truth table0%0/3
A or B
A= $self->{"mac03"}B= $self->{"mac01"}
| |||||||||||||||||||||||||||||||||||||||||||
| 442 | 0 | ▶ | $self->_populate_host_data or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 443 | } | ||||||||||||||||||||||||||||||||||||||||||
| 444 | |||||||||||||||||||||||||||||||||||||||||||
| 445 | 0 | ▶ | if ($self->{mac03}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 446 | 0 | return $self->{mac03}; | |||||||||||||||||||||||||||||||||||||||||
| 447 | } | ||||||||||||||||||||||||||||||||||||||||||
| 448 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 449 | 0 | $self->error($METHOD_UNSUPPORTED); | |||||||||||||||||||||||||||||||||||||||||
| 450 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 451 | } | ||||||||||||||||||||||||||||||||||||||||||
| 452 | |||||||||||||||||||||||||||||||||||||||||||
| 453 | } | ||||||||||||||||||||||||||||||||||||||||||
| 454 | |||||||||||||||||||||||||||||||||||||||||||
| 455 | |||||||||||||||||||||||||||||||||||||||||||
| 456 | 0 | ▶ | sub mac04 { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mac04: not called CC=5 SCAR=34.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 457 | |||||||||||||||||||||||||||||||||||||||||||
| 458 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 459 | |||||||||||||||||||||||||||||||||||||||||||
| 460 | # see above | ||||||||||||||||||||||||||||||||||||||||||
| 461 | |||||||||||||||||||||||||||||||||||||||||||
| 462 | 0 | ▶ | if (!$self->{mac04} && !$self->{mac01}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$self->{"mac04"} or $self->{"mac01"}
MC/DC0%0/2
$self->{"mac04"} or $self->{"mac01"}
$self->{"mac04"}
$self->{"mac01"}
Truth table0%0/3
A or B
A= $self->{"mac04"}B= $self->{"mac01"}
| |||||||||||||||||||||||||||||||||||||||||||
| 463 | 0 | ▶ | $self->_populate_host_data or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 464 | } | ||||||||||||||||||||||||||||||||||||||||||
| 465 | |||||||||||||||||||||||||||||||||||||||||||
| 466 | 0 | ▶ | if ($self->{mac04}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 467 | 0 | return $self->{mac04}; | |||||||||||||||||||||||||||||||||||||||||
| 468 | } | ||||||||||||||||||||||||||||||||||||||||||
| 469 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 470 | 0 | $self->error($METHOD_UNSUPPORTED); | |||||||||||||||||||||||||||||||||||||||||
| 471 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 472 | } | ||||||||||||||||||||||||||||||||||||||||||
| 473 | |||||||||||||||||||||||||||||||||||||||||||
| 474 | } | ||||||||||||||||||||||||||||||||||||||||||
| 475 | |||||||||||||||||||||||||||||||||||||||||||
| 476 | |||||||||||||||||||||||||||||||||||||||||||
| 477 | 0 | ▶ | sub macilo { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
macilo: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 478 | |||||||||||||||||||||||||||||||||||||||||||
| 479 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 480 | |||||||||||||||||||||||||||||||||||||||||||
| 481 | 0 | ▶ | if (!$self->{macilo}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 482 | 0 | ▶ | $self->_populate_host_data or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 483 | } | ||||||||||||||||||||||||||||||||||||||||||
| 484 | |||||||||||||||||||||||||||||||||||||||||||
| 485 | 0 | ▶ | if ($self->{macilo}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 486 | 0 | return $self->{macilo}; | |||||||||||||||||||||||||||||||||||||||||
| 487 | } | ||||||||||||||||||||||||||||||||||||||||||
| 488 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 489 | 0 | $self->error($METHOD_UNSUPPORTED); | |||||||||||||||||||||||||||||||||||||||||
| 490 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 491 | } | ||||||||||||||||||||||||||||||||||||||||||
| 492 | |||||||||||||||||||||||||||||||||||||||||||
| 493 | } | ||||||||||||||||||||||||||||||||||||||||||
| 494 | |||||||||||||||||||||||||||||||||||||||||||
| 495 | |||||||||||||||||||||||||||||||||||||||||||
| 496 | 0 | ▶ | sub model { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
model: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 497 | |||||||||||||||||||||||||||||||||||||||||||
| 498 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 499 | |||||||||||||||||||||||||||||||||||||||||||
| 500 | 0 | ▶ | if (!$self->{model}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 501 | 0 | ▶ | $self->_populate_host_data or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 502 | } | ||||||||||||||||||||||||||||||||||||||||||
| 503 | |||||||||||||||||||||||||||||||||||||||||||
| 504 | 0 | return $self->{model}; | |||||||||||||||||||||||||||||||||||||||||
| 505 | |||||||||||||||||||||||||||||||||||||||||||
| 506 | } | ||||||||||||||||||||||||||||||||||||||||||
| 507 | |||||||||||||||||||||||||||||||||||||||||||
| 508 | |||||||||||||||||||||||||||||||||||||||||||
| 509 | 0 | ▶ | sub mod_user { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
mod_user: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 510 | |||||||||||||||||||||||||||||||||||||||||||
| 511 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 512 | |||||||||||||||||||||||||||||||||||||||||||
| 513 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 514 | |||||||||||||||||||||||||||||||||||||||||||
| 515 | 0 | my $arg_ref = shift; | |||||||||||||||||||||||||||||||||||||||||
| 516 | |||||||||||||||||||||||||||||||||||||||||||
| 517 | 0 | ▶ | my $mod_username = $arg_ref->{username} || $self->username; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$arg_ref->{'username'} || $self->username
MC/DC0%0/2
$arg_ref->{'username'} || $self->username
$arg_ref->{'username'}
$self->username
Truth table0%0/3
A || B
A= $arg_ref->{'username'}B= $self->username
| |||||||||||||||||||||||||||||||||||||||||||
| 518 | 0 | ▶ | my $mod_password = $arg_ref->{password} || $self->password; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/3
$arg_ref->{'password'} || $self->password
MC/DC0%0/2
$arg_ref->{'password'} || $self->password
$arg_ref->{'password'}
$self->password
Truth table0%0/3
A || B
A= $arg_ref->{'password'}B= $self->password
| |||||||||||||||||||||||||||||||||||||||||||
| 519 | |||||||||||||||||||||||||||||||||||||||||||
| 520 | 0 | ▶ | if (!$mod_username && !$mod_password) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$mod_username or $mod_password
MC/DC0%0/2
$mod_username or $mod_password
$mod_username
$mod_password
Truth table0%0/3
A or B
A= $mod_usernameB= $mod_password
| |||||||||||||||||||||||||||||||||||||||||||
| 521 | |||||||||||||||||||||||||||||||||||||||||||
| 522 | 0 | croak "mod_user requires username to modify and new password"; | |||||||||||||||||||||||||||||||||||||||||
| 523 | |||||||||||||||||||||||||||||||||||||||||||
| 524 | } | ||||||||||||||||||||||||||||||||||||||||||
| 525 | |||||||||||||||||||||||||||||||||||||||||||
| 526 | 0 | my $ilo_command = qq| | |||||||||||||||||||||||||||||||||||||||||
| 527 | <USER_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 528 | <MOD_USER USER_LOGIN="$mod_username"> | ||||||||||||||||||||||||||||||||||||||||||
| 529 | <PASSWORD value="$mod_password"/> | ||||||||||||||||||||||||||||||||||||||||||
| 530 | </MOD_USER> | ||||||||||||||||||||||||||||||||||||||||||
| 531 | </USER_INFO> | ||||||||||||||||||||||||||||||||||||||||||
| 532 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 533 | |||||||||||||||||||||||||||||||||||||||||||
| 534 | 0 | $ilo_command = $self->_wrap($ilo_command); | |||||||||||||||||||||||||||||||||||||||||
| 535 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 536 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 537 | |||||||||||||||||||||||||||||||||||||||||||
| 538 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 539 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 540 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 541 | } | ||||||||||||||||||||||||||||||||||||||||||
| 542 | |||||||||||||||||||||||||||||||||||||||||||
| 543 | 0 | ▶ | if ($self->username eq $mod_username) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 544 | |||||||||||||||||||||||||||||||||||||||||||
| 545 | 0 | $self->password($mod_password); | |||||||||||||||||||||||||||||||||||||||||
| 546 | |||||||||||||||||||||||||||||||||||||||||||
| 547 | } | ||||||||||||||||||||||||||||||||||||||||||
| 548 | |||||||||||||||||||||||||||||||||||||||||||
| 549 | } | ||||||||||||||||||||||||||||||||||||||||||
| 550 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 551 | |||||||||||||||||||||||||||||||||||||||||||
| 552 | 0 | croak "mod_user() requires parameters"; | |||||||||||||||||||||||||||||||||||||||||
| 553 | |||||||||||||||||||||||||||||||||||||||||||
| 554 | } | ||||||||||||||||||||||||||||||||||||||||||
| 555 | |||||||||||||||||||||||||||||||||||||||||||
| 556 | |||||||||||||||||||||||||||||||||||||||||||
| 557 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 558 | |||||||||||||||||||||||||||||||||||||||||||
| 559 | } | ||||||||||||||||||||||||||||||||||||||||||
| 560 | |||||||||||||||||||||||||||||||||||||||||||
| 561 | |||||||||||||||||||||||||||||||||||||||||||
| 562 | 0 | ▶ | sub network { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
network: not called CC=18 SCAR=58.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 563 | |||||||||||||||||||||||||||||||||||||||||||
| 564 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 565 | |||||||||||||||||||||||||||||||||||||||||||
| 566 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 567 | |||||||||||||||||||||||||||||||||||||||||||
| 568 | 0 | my $arg_ref = shift; | |||||||||||||||||||||||||||||||||||||||||
| 569 | |||||||||||||||||||||||||||||||||||||||||||
| 570 | 0 | ▶ | my $domain_name = $arg_ref->{domain_name} || $self->domain_name or croak "domain_name not set"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$arg_ref->{'domain_name'} || $self->domain_name
MC/DC0%0/2
$arg_ref->{'domain_name'} || $self->domain_name
$arg_ref->{'domain_name'}
$self->domain_name
Truth table0%0/3
A || B
A= $arg_ref->{'domain_name'}B= $self->domain_name
| |||||||||||||||||||||||||||||||||||||||||||
| 571 | 0 | ▶ | my $dns_name = $arg_ref->{hostname} || $self->hostname or croak "name not set"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$arg_ref->{'hostname'} || $self->hostname
MC/DC0%0/2
$arg_ref->{'hostname'} || $self->hostname
$arg_ref->{'hostname'}
$self->hostname
Truth table0%0/3
A || B
A= $arg_ref->{'hostname'}B= $self->hostname
| |||||||||||||||||||||||||||||||||||||||||||
| 572 | 0 | ▶ | my $dhcp_enable = $arg_ref->{dhcp_enabled} || $self->dhcp_enabled or croak "dhcp_enabled not set"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$arg_ref->{'dhcp_enabled'} || $self->dhcp_enabled
MC/DC0%0/2
$arg_ref->{'dhcp_enabled'} || $self->dhcp_enabled
$arg_ref->{'dhcp_enabled'}
$self->dhcp_enabled
Truth table0%0/3
A || B
A= $arg_ref->{'dhcp_enabled'}B= $self->dhcp_enabled
| |||||||||||||||||||||||||||||||||||||||||||
| 573 | 0 | ▶ | my $ip_address = $arg_ref->{ip_address} || $self->ip_address or croak "ip_address not set"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$arg_ref->{'ip_address'} || $self->ip_address
MC/DC0%0/2
$arg_ref->{'ip_address'} || $self->ip_address
$arg_ref->{'ip_address'}
$self->ip_address
Truth table0%0/3
A || B
A= $arg_ref->{'ip_address'}B= $self->ip_address
| |||||||||||||||||||||||||||||||||||||||||||
| 574 | 0 | ▶ | my $subnet_mask = $arg_ref->{subnet_mask} || $self->subnet_mask or croak "subnet_mask not set"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$arg_ref->{'subnet_mask'} || $self->subnet_mask
MC/DC0%0/2
$arg_ref->{'subnet_mask'} || $self->subnet_mask
$arg_ref->{'subnet_mask'}
$self->subnet_mask
Truth table0%0/3
A || B
A= $arg_ref->{'subnet_mask'}B= $self->subnet_mask
| |||||||||||||||||||||||||||||||||||||||||||
| 575 | 0 | ▶ | my $gateway = $arg_ref->{gateway} || $self->gateway or croak "gateway not set"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$arg_ref->{'gateway'} || $self->gateway
MC/DC0%0/2
$arg_ref->{'gateway'} || $self->gateway
$arg_ref->{'gateway'}
$self->gateway
Truth table0%0/3
A || B
A= $arg_ref->{'gateway'}B= $self->gateway
| |||||||||||||||||||||||||||||||||||||||||||
| 576 | |||||||||||||||||||||||||||||||||||||||||||
| 577 | 0 | my $ilo_command = qq| | |||||||||||||||||||||||||||||||||||||||||
| 578 | <RIB_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 579 | <MOD_NETWORK_SETTINGS> | ||||||||||||||||||||||||||||||||||||||||||
| 580 | <DHCP_ENABLE value="$dhcp_enable"/> | ||||||||||||||||||||||||||||||||||||||||||
| 581 | <IP_ADDRESS value="$ip_address"/> | ||||||||||||||||||||||||||||||||||||||||||
| 582 | <SUBNET_MASK value="$subnet_mask"/> | ||||||||||||||||||||||||||||||||||||||||||
| 583 | <GATEWAY_IP_ADDRESS value="$gateway"/> | ||||||||||||||||||||||||||||||||||||||||||
| 584 | <DNS_NAME value="$dns_name"/> | ||||||||||||||||||||||||||||||||||||||||||
| 585 | <DOMAIN_NAME value="$domain_name"/> | ||||||||||||||||||||||||||||||||||||||||||
| 586 | </MOD_NETWORK_SETTINGS> | ||||||||||||||||||||||||||||||||||||||||||
| 587 | </RIB_INFO> | ||||||||||||||||||||||||||||||||||||||||||
| 588 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 589 | |||||||||||||||||||||||||||||||||||||||||||
| 590 | 0 | $ilo_command = $self->_wrap($ilo_command); | |||||||||||||||||||||||||||||||||||||||||
| 591 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 592 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 593 | |||||||||||||||||||||||||||||||||||||||||||
| 594 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 595 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 596 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 597 | } | ||||||||||||||||||||||||||||||||||||||||||
| 598 | |||||||||||||||||||||||||||||||||||||||||||
| 599 | # force module to refresh new settings from the remote server | ||||||||||||||||||||||||||||||||||||||||||
| 600 | 0 | foreach my $option_changed (keys %$arg_ref) { | |||||||||||||||||||||||||||||||||||||||||
| 601 | |||||||||||||||||||||||||||||||||||||||||||
| 602 | 0 | delete $self->{$option_changed}; | |||||||||||||||||||||||||||||||||||||||||
| 603 | |||||||||||||||||||||||||||||||||||||||||||
| 604 | } | ||||||||||||||||||||||||||||||||||||||||||
| 605 | |||||||||||||||||||||||||||||||||||||||||||
| 606 | # if IP was changed it should be updated, if not this won't hurt | ||||||||||||||||||||||||||||||||||||||||||
| 607 | 0 | $self->address($ip_address); | |||||||||||||||||||||||||||||||||||||||||
| 608 | |||||||||||||||||||||||||||||||||||||||||||
| 609 | } | ||||||||||||||||||||||||||||||||||||||||||
| 610 | |||||||||||||||||||||||||||||||||||||||||||
| 611 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 612 | |||||||||||||||||||||||||||||||||||||||||||
| 613 | } | ||||||||||||||||||||||||||||||||||||||||||
| 614 | |||||||||||||||||||||||||||||||||||||||||||
| 615 | |||||||||||||||||||||||||||||||||||||||||||
| 616 | 7 | ▶ | sub new { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
new: called CC=5 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 617 | |||||||||||||||||||||||||||||||||||||||||||
| 618 | 7 | my ($class) = shift; | |||||||||||||||||||||||||||||||||||||||||
| 619 | |||||||||||||||||||||||||||||||||||||||||||
| 620 | # RT #65352: allow hash or hashref constructor args | ||||||||||||||||||||||||||||||||||||||||||
| 621 | 7 | ▶ | my %options = ref $_[0] ? %{$_[0]} : @_; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 622 | |||||||||||||||||||||||||||||||||||||||||||
| 623 | 7 | my $self = {}; | |||||||||||||||||||||||||||||||||||||||||
| 624 | |||||||||||||||||||||||||||||||||||||||||||
| 625 | 7 | bless($self, $class); | |||||||||||||||||||||||||||||||||||||||||
| 626 | |||||||||||||||||||||||||||||||||||||||||||
| 627 | 7 | $self->address( $options{address} ); | |||||||||||||||||||||||||||||||||||||||||
| 628 | 7 | $self->username( $options{username} ); | |||||||||||||||||||||||||||||||||||||||||
| 629 | 7 | $self->password( $options{password} ); | |||||||||||||||||||||||||||||||||||||||||
| 630 | |||||||||||||||||||||||||||||||||||||||||||
| 631 | 7 | ▶ | if ($options{port}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 632 | 3 | $self->port($options{port}); | |||||||||||||||||||||||||||||||||||||||||
| 633 | } | ||||||||||||||||||||||||||||||||||||||||||
| 634 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 635 | 4 | $self->port(443); | |||||||||||||||||||||||||||||||||||||||||
| 636 | } | ||||||||||||||||||||||||||||||||||||||||||
| 637 | |||||||||||||||||||||||||||||||||||||||||||
| 638 | # iLO version will be autodetected later if not specified | ||||||||||||||||||||||||||||||||||||||||||
| 639 | 6 | ▶ | $self->{_version} = $options{version} || undef; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$options{'version'} || undef
MC/DC100%1/1
$options{'version'} || undef
$options{'version'}
Truth table100%2/2
A
A= $options{'version'}
| |||||||||||||||||||||||||||||||||||||||||||
| 640 | 6 | ▶ | $self->{_debug} = $options{debug} || '0'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition100%2/2
$options{'debug'} || '0'
MC/DC100%1/1
$options{'debug'} || '0'
$options{'debug'}
Truth table100%2/2
A
A= $options{'debug'}
| |||||||||||||||||||||||||||||||||||||||||||
| 641 | |||||||||||||||||||||||||||||||||||||||||||
| 642 | 6 | return $self; | |||||||||||||||||||||||||||||||||||||||||
| 643 | |||||||||||||||||||||||||||||||||||||||||||
| 644 | } | ||||||||||||||||||||||||||||||||||||||||||
| 645 | |||||||||||||||||||||||||||||||||||||||||||
| 646 | |||||||||||||||||||||||||||||||||||||||||||
| 647 | 22 | ▶ | sub password { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
password: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 648 | |||||||||||||||||||||||||||||||||||||||||||
| 649 | 22 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 650 | |||||||||||||||||||||||||||||||||||||||||||
| 651 | 22 | ▶ | if ( @_ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 652 | 7 | $self->{password} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 653 | } | ||||||||||||||||||||||||||||||||||||||||||
| 654 | |||||||||||||||||||||||||||||||||||||||||||
| 655 | 22 | return $self->{password}; | |||||||||||||||||||||||||||||||||||||||||
| 656 | |||||||||||||||||||||||||||||||||||||||||||
| 657 | } | ||||||||||||||||||||||||||||||||||||||||||
| 658 | |||||||||||||||||||||||||||||||||||||||||||
| 659 | |||||||||||||||||||||||||||||||||||||||||||
| 660 | 10 | ▶ | sub port { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
port: called CC=3 SCAR=11.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 661 | |||||||||||||||||||||||||||||||||||||||||||
| 662 | 10 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 663 | |||||||||||||||||||||||||||||||||||||||||||
| 664 | 10 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 665 | 7 | my $port = shift; | |||||||||||||||||||||||||||||||||||||||||
| 666 | |||||||||||||||||||||||||||||||||||||||||||
| 667 | 7 | ▶ | _port_is_valid($port) or croak "Port must be an integer between 0 and 65535"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 668 | |||||||||||||||||||||||||||||||||||||||||||
| 669 | 6 | $self->{port} = $port; | |||||||||||||||||||||||||||||||||||||||||
| 670 | } | ||||||||||||||||||||||||||||||||||||||||||
| 671 | |||||||||||||||||||||||||||||||||||||||||||
| 672 | 9 | return $self->{port}; | |||||||||||||||||||||||||||||||||||||||||
| 673 | |||||||||||||||||||||||||||||||||||||||||||
| 674 | } | ||||||||||||||||||||||||||||||||||||||||||
| 675 | |||||||||||||||||||||||||||||||||||||||||||
| 676 | |||||||||||||||||||||||||||||||||||||||||||
| 677 | 0 | ▶ | sub power { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
power: not called CC=12 SCAR=50.5
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 678 | |||||||||||||||||||||||||||||||||||||||||||
| 679 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 680 | |||||||||||||||||||||||||||||||||||||||||||
| 681 | 0 | ▶ | if ( @_ ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 682 | |||||||||||||||||||||||||||||||||||||||||||
| 683 | 0 | my $state_requested = shift; | |||||||||||||||||||||||||||||||||||||||||
| 684 | |||||||||||||||||||||||||||||||||||||||||||
| 685 | 0 | my $ilo_command; | |||||||||||||||||||||||||||||||||||||||||
| 686 | |||||||||||||||||||||||||||||||||||||||||||
| 687 | 0 | ▶ | if (lc($state_requested) eq 'on') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 688 | |||||||||||||||||||||||||||||||||||||||||||
| 689 | 0 | $ilo_command = $self->_generate_cmd('power_on'); | |||||||||||||||||||||||||||||||||||||||||
| 690 | |||||||||||||||||||||||||||||||||||||||||||
| 691 | } | ||||||||||||||||||||||||||||||||||||||||||
| 692 | elsif (lc($state_requested) eq 'off') { | ||||||||||||||||||||||||||||||||||||||||||
| 693 | |||||||||||||||||||||||||||||||||||||||||||
| 694 | 0 | $ilo_command = $self->_generate_cmd('power_off'); | |||||||||||||||||||||||||||||||||||||||||
| 695 | |||||||||||||||||||||||||||||||||||||||||||
| 696 | } | ||||||||||||||||||||||||||||||||||||||||||
| 697 | elsif (lc($state_requested) eq 'reset') { | ||||||||||||||||||||||||||||||||||||||||||
| 698 | |||||||||||||||||||||||||||||||||||||||||||
| 699 | 0 | $ilo_command = $self->_generate_cmd('power_reset'); | |||||||||||||||||||||||||||||||||||||||||
| 700 | |||||||||||||||||||||||||||||||||||||||||||
| 701 | } | ||||||||||||||||||||||||||||||||||||||||||
| 702 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 703 | |||||||||||||||||||||||||||||||||||||||||||
| 704 | 0 | croak "State '$state_requested' is not valid"; | |||||||||||||||||||||||||||||||||||||||||
| 705 | |||||||||||||||||||||||||||||||||||||||||||
| 706 | } | ||||||||||||||||||||||||||||||||||||||||||
| 707 | |||||||||||||||||||||||||||||||||||||||||||
| 708 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 709 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 710 | |||||||||||||||||||||||||||||||||||||||||||
| 711 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 712 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 713 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 714 | } | ||||||||||||||||||||||||||||||||||||||||||
| 715 | |||||||||||||||||||||||||||||||||||||||||||
| 716 | 0 | return $state_requested; | |||||||||||||||||||||||||||||||||||||||||
| 717 | |||||||||||||||||||||||||||||||||||||||||||
| 718 | } | ||||||||||||||||||||||||||||||||||||||||||
| 719 | |||||||||||||||||||||||||||||||||||||||||||
| 720 | 0 | my $ilo_command = $self->_generate_cmd('power_status'); | |||||||||||||||||||||||||||||||||||||||||
| 721 | |||||||||||||||||||||||||||||||||||||||||||
| 722 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 723 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 724 | |||||||||||||||||||||||||||||||||||||||||||
| 725 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 726 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 727 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 728 | } | ||||||||||||||||||||||||||||||||||||||||||
| 729 | |||||||||||||||||||||||||||||||||||||||||||
| 730 | 0 | my $state = $xml->{GET_HOST_POWER}->{HOST_POWER}; | |||||||||||||||||||||||||||||||||||||||||
| 731 | |||||||||||||||||||||||||||||||||||||||||||
| 732 | 0 | ▶ | if (!$state) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 733 | 0 | $self->error('Invalid response from remote ilo'); | |||||||||||||||||||||||||||||||||||||||||
| 734 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 735 | } | ||||||||||||||||||||||||||||||||||||||||||
| 736 | |||||||||||||||||||||||||||||||||||||||||||
| 737 | 0 | return lc($state); | |||||||||||||||||||||||||||||||||||||||||
| 738 | |||||||||||||||||||||||||||||||||||||||||||
| 739 | } | ||||||||||||||||||||||||||||||||||||||||||
| 740 | |||||||||||||||||||||||||||||||||||||||||||
| 741 | |||||||||||||||||||||||||||||||||||||||||||
| 742 | 0 | ▶ | sub power_consumption { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
power_consumption: not called CC=6 SCAR=37.4
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 743 | |||||||||||||||||||||||||||||||||||||||||||
| 744 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 745 | |||||||||||||||||||||||||||||||||||||||||||
| 746 | 0 | my $ilo_command = $self->_generate_cmd('power_consumption'); | |||||||||||||||||||||||||||||||||||||||||
| 747 | |||||||||||||||||||||||||||||||||||||||||||
| 748 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 749 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 750 | |||||||||||||||||||||||||||||||||||||||||||
| 751 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 752 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 753 | 0 | ▶ | return unless $errmsg =~ /^Syntax error/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 754 | } | ||||||||||||||||||||||||||||||||||||||||||
| 755 | |||||||||||||||||||||||||||||||||||||||||||
| 756 | 0 | ▶ | if ($self->{power_consumption} = $xml->{GET_POWER_READINGS}->{PRESENT_POWER_READING}->{VALUE}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 757 | |||||||||||||||||||||||||||||||||||||||||||
| 758 | 0 | return $self->{power_consumption}; | |||||||||||||||||||||||||||||||||||||||||
| 759 | |||||||||||||||||||||||||||||||||||||||||||
| 760 | } | ||||||||||||||||||||||||||||||||||||||||||
| 761 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 762 | |||||||||||||||||||||||||||||||||||||||||||
| 763 | 0 | $self->error($METHOD_UNSUPPORTED); | |||||||||||||||||||||||||||||||||||||||||
| 764 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 765 | |||||||||||||||||||||||||||||||||||||||||||
| 766 | } | ||||||||||||||||||||||||||||||||||||||||||
| 767 | |||||||||||||||||||||||||||||||||||||||||||
| 768 | } | ||||||||||||||||||||||||||||||||||||||||||
| 769 | |||||||||||||||||||||||||||||||||||||||||||
| 770 | |||||||||||||||||||||||||||||||||||||||||||
| 771 | 0 | ▶ | sub power_supplies { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
power_supplies: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 772 | |||||||||||||||||||||||||||||||||||||||||||
| 773 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 774 | |||||||||||||||||||||||||||||||||||||||||||
| 775 | 0 | ▶ | if (!$self->{power_supplies}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 776 | 0 | ▶ | $self->_populate_embedded_health or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 777 | } | ||||||||||||||||||||||||||||||||||||||||||
| 778 | |||||||||||||||||||||||||||||||||||||||||||
| 779 | 0 | return $self->{power_supplies}; | |||||||||||||||||||||||||||||||||||||||||
| 780 | |||||||||||||||||||||||||||||||||||||||||||
| 781 | } | ||||||||||||||||||||||||||||||||||||||||||
| 782 | |||||||||||||||||||||||||||||||||||||||||||
| 783 | |||||||||||||||||||||||||||||||||||||||||||
| 784 | 0 | ▶ | sub ramslots { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ramslots: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 785 | |||||||||||||||||||||||||||||||||||||||||||
| 786 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 787 | |||||||||||||||||||||||||||||||||||||||||||
| 788 | 0 | ▶ | if (!$self->{ramslots}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 789 | 0 | ▶ | $self->_populate_host_data or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 790 | } | ||||||||||||||||||||||||||||||||||||||||||
| 791 | |||||||||||||||||||||||||||||||||||||||||||
| 792 | 0 | return $self->{ramslots}; | |||||||||||||||||||||||||||||||||||||||||
| 793 | |||||||||||||||||||||||||||||||||||||||||||
| 794 | } | ||||||||||||||||||||||||||||||||||||||||||
| 795 | |||||||||||||||||||||||||||||||||||||||||||
| 796 | |||||||||||||||||||||||||||||||||||||||||||
| 797 | 0 | ▶ | sub reset { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
reset: not called CC=4 SCAR=30.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 798 | |||||||||||||||||||||||||||||||||||||||||||
| 799 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 800 | |||||||||||||||||||||||||||||||||||||||||||
| 801 | 0 | my $ilo_command = $self->_generate_cmd('reset'); | |||||||||||||||||||||||||||||||||||||||||
| 802 | |||||||||||||||||||||||||||||||||||||||||||
| 803 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 804 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 805 | |||||||||||||||||||||||||||||||||||||||||||
| 806 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 807 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 808 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 809 | } | ||||||||||||||||||||||||||||||||||||||||||
| 810 | |||||||||||||||||||||||||||||||||||||||||||
| 811 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 812 | |||||||||||||||||||||||||||||||||||||||||||
| 813 | } | ||||||||||||||||||||||||||||||||||||||||||
| 814 | |||||||||||||||||||||||||||||||||||||||||||
| 815 | |||||||||||||||||||||||||||||||||||||||||||
| 816 | 0 | ▶ | sub serialID { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
serialID: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 817 | |||||||||||||||||||||||||||||||||||||||||||
| 818 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 819 | |||||||||||||||||||||||||||||||||||||||||||
| 820 | 0 | ▶ | if (!$self->{serialID}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 821 | 0 | ▶ | $self->_populate_host_data or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 822 | } | ||||||||||||||||||||||||||||||||||||||||||
| 823 | |||||||||||||||||||||||||||||||||||||||||||
| 824 | 0 | return $self->{serialID}; | |||||||||||||||||||||||||||||||||||||||||
| 825 | |||||||||||||||||||||||||||||||||||||||||||
| 826 | } | ||||||||||||||||||||||||||||||||||||||||||
| 827 | |||||||||||||||||||||||||||||||||||||||||||
| 828 | |||||||||||||||||||||||||||||||||||||||||||
| 829 | 0 | ▶ | sub session_timeout { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
session_timeout: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 830 | |||||||||||||||||||||||||||||||||||||||||||
| 831 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 832 | |||||||||||||||||||||||||||||||||||||||||||
| 833 | 0 | ▶ | if (!$self->{session_timeout}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 834 | 0 | ▶ | $self->_populate_global_settings or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 835 | } | ||||||||||||||||||||||||||||||||||||||||||
| 836 | |||||||||||||||||||||||||||||||||||||||||||
| 837 | 0 | return $self->{session_timeout}; | |||||||||||||||||||||||||||||||||||||||||
| 838 | |||||||||||||||||||||||||||||||||||||||||||
| 839 | } | ||||||||||||||||||||||||||||||||||||||||||
| 840 | |||||||||||||||||||||||||||||||||||||||||||
| 841 | |||||||||||||||||||||||||||||||||||||||||||
| 842 | 0 | ▶ | sub ssh_port { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ssh_port: not called CC=8 SCAR=42.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 843 | |||||||||||||||||||||||||||||||||||||||||||
| 844 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 845 | |||||||||||||||||||||||||||||||||||||||||||
| 846 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 847 | |||||||||||||||||||||||||||||||||||||||||||
| 848 | 0 | my $ssh_port = shift; | |||||||||||||||||||||||||||||||||||||||||
| 849 | |||||||||||||||||||||||||||||||||||||||||||
| 850 | 0 | ▶ | _port_is_valid($ssh_port) or croak "ssh_port must be an integer between 0 and 65535"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 851 | |||||||||||||||||||||||||||||||||||||||||||
| 852 | 0 | my $ilo_command = qq| | |||||||||||||||||||||||||||||||||||||||||
| 853 | <RIB_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 854 | <MOD_GLOBAL_SETTINGS> | ||||||||||||||||||||||||||||||||||||||||||
| 855 | <SSH_PORT value="$ssh_port"/> | ||||||||||||||||||||||||||||||||||||||||||
| 856 | </MOD_GLOBAL_SETTINGS> | ||||||||||||||||||||||||||||||||||||||||||
| 857 | </RIB_INFO> | ||||||||||||||||||||||||||||||||||||||||||
| 858 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 859 | |||||||||||||||||||||||||||||||||||||||||||
| 860 | 0 | $ilo_command = $self->_wrap($ilo_command); | |||||||||||||||||||||||||||||||||||||||||
| 861 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 862 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 863 | |||||||||||||||||||||||||||||||||||||||||||
| 864 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 865 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 866 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 867 | } | ||||||||||||||||||||||||||||||||||||||||||
| 868 | |||||||||||||||||||||||||||||||||||||||||||
| 869 | 0 | $self->{ssh_port} = $ssh_port; | |||||||||||||||||||||||||||||||||||||||||
| 870 | |||||||||||||||||||||||||||||||||||||||||||
| 871 | } | ||||||||||||||||||||||||||||||||||||||||||
| 872 | |||||||||||||||||||||||||||||||||||||||||||
| 873 | 0 | ▶ | if (!$self->{ssh_port}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 874 | 0 | ▶ | $self->_populate_global_settings or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 875 | } | ||||||||||||||||||||||||||||||||||||||||||
| 876 | |||||||||||||||||||||||||||||||||||||||||||
| 877 | 0 | return $self->{ssh_port}; | |||||||||||||||||||||||||||||||||||||||||
| 878 | |||||||||||||||||||||||||||||||||||||||||||
| 879 | } | ||||||||||||||||||||||||||||||||||||||||||
| 880 | |||||||||||||||||||||||||||||||||||||||||||
| 881 | |||||||||||||||||||||||||||||||||||||||||||
| 882 | 0 | ▶ | sub ssh_status { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
ssh_status: not called CC=7 SCAR=40.3
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 883 | |||||||||||||||||||||||||||||||||||||||||||
| 884 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 885 | |||||||||||||||||||||||||||||||||||||||||||
| 886 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 887 | |||||||||||||||||||||||||||||||||||||||||||
| 888 | 0 | my $ssh_status = shift; | |||||||||||||||||||||||||||||||||||||||||
| 889 | |||||||||||||||||||||||||||||||||||||||||||
| 890 | 0 | my $ilo_command = qq| | |||||||||||||||||||||||||||||||||||||||||
| 891 | <RIB_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 892 | <MOD_GLOBAL_SETTINGS> | ||||||||||||||||||||||||||||||||||||||||||
| 893 | <SSH_STATUS value="$ssh_status"/> | ||||||||||||||||||||||||||||||||||||||||||
| 894 | </MOD_GLOBAL_SETTINGS> | ||||||||||||||||||||||||||||||||||||||||||
| 895 | </RIB_INFO> | ||||||||||||||||||||||||||||||||||||||||||
| 896 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 897 | |||||||||||||||||||||||||||||||||||||||||||
| 898 | 0 | $ilo_command = $self->_wrap($ilo_command); | |||||||||||||||||||||||||||||||||||||||||
| 899 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 900 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 901 | |||||||||||||||||||||||||||||||||||||||||||
| 902 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 903 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 904 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 905 | } | ||||||||||||||||||||||||||||||||||||||||||
| 906 | |||||||||||||||||||||||||||||||||||||||||||
| 907 | 0 | $self->{ssh_status} = $ssh_status; | |||||||||||||||||||||||||||||||||||||||||
| 908 | |||||||||||||||||||||||||||||||||||||||||||
| 909 | } | ||||||||||||||||||||||||||||||||||||||||||
| 910 | |||||||||||||||||||||||||||||||||||||||||||
| 911 | 0 | ▶ | if (!$self->{ssh_status}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 912 | 0 | ▶ | $self->_populate_global_settings or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 913 | } | ||||||||||||||||||||||||||||||||||||||||||
| 914 | |||||||||||||||||||||||||||||||||||||||||||
| 915 | 0 | return $self->{ssh_status}; | |||||||||||||||||||||||||||||||||||||||||
| 916 | |||||||||||||||||||||||||||||||||||||||||||
| 917 | } | ||||||||||||||||||||||||||||||||||||||||||
| 918 | |||||||||||||||||||||||||||||||||||||||||||
| 919 | |||||||||||||||||||||||||||||||||||||||||||
| 920 | 0 | ▶ | sub subnet_mask { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
subnet_mask: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 921 | |||||||||||||||||||||||||||||||||||||||||||
| 922 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 923 | |||||||||||||||||||||||||||||||||||||||||||
| 924 | 0 | ▶ | if (!$self->{subnet_mask}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 925 | 0 | ▶ | $self->_populate_network_settings or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 926 | } | ||||||||||||||||||||||||||||||||||||||||||
| 927 | |||||||||||||||||||||||||||||||||||||||||||
| 928 | 0 | return $self->{subnet_mask}; | |||||||||||||||||||||||||||||||||||||||||
| 929 | |||||||||||||||||||||||||||||||||||||||||||
| 930 | } | ||||||||||||||||||||||||||||||||||||||||||
| 931 | |||||||||||||||||||||||||||||||||||||||||||
| 932 | |||||||||||||||||||||||||||||||||||||||||||
| 933 | 0 | ▶ | sub temperatures { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
temperatures: not called CC=3 SCAR=24.8
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 934 | |||||||||||||||||||||||||||||||||||||||||||
| 935 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 936 | |||||||||||||||||||||||||||||||||||||||||||
| 937 | 0 | ▶ | if (!$self->{temperatures}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 938 | 0 | ▶ | $self->_populate_embedded_health or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 939 | } | ||||||||||||||||||||||||||||||||||||||||||
| 940 | |||||||||||||||||||||||||||||||||||||||||||
| 941 | 0 | return $self->{temperatures}; | |||||||||||||||||||||||||||||||||||||||||
| 942 | |||||||||||||||||||||||||||||||||||||||||||
| 943 | } | ||||||||||||||||||||||||||||||||||||||||||
| 944 | |||||||||||||||||||||||||||||||||||||||||||
| 945 | |||||||||||||||||||||||||||||||||||||||||||
| 946 | 0 | ▶ | sub uid { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
uid: not called CC=10 SCAR=47.0
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 947 | |||||||||||||||||||||||||||||||||||||||||||
| 948 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 949 | |||||||||||||||||||||||||||||||||||||||||||
| 950 | 0 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 951 | |||||||||||||||||||||||||||||||||||||||||||
| 952 | 0 | my $state_requested = shift; | |||||||||||||||||||||||||||||||||||||||||
| 953 | |||||||||||||||||||||||||||||||||||||||||||
| 954 | 0 | my $ilo_command; | |||||||||||||||||||||||||||||||||||||||||
| 955 | |||||||||||||||||||||||||||||||||||||||||||
| 956 | 0 | ▶ | if ($state_requested eq 'on') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 2 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 957 | |||||||||||||||||||||||||||||||||||||||||||
| 958 | 0 | $ilo_command = $self->_generate_cmd('uid_on'); | |||||||||||||||||||||||||||||||||||||||||
| 959 | |||||||||||||||||||||||||||||||||||||||||||
| 960 | } | ||||||||||||||||||||||||||||||||||||||||||
| 961 | elsif ($state_requested eq 'off') { | ||||||||||||||||||||||||||||||||||||||||||
| 962 | |||||||||||||||||||||||||||||||||||||||||||
| 963 | 0 | $ilo_command = $self->_generate_cmd('uid_off'); | |||||||||||||||||||||||||||||||||||||||||
| 964 | |||||||||||||||||||||||||||||||||||||||||||
| 965 | } | ||||||||||||||||||||||||||||||||||||||||||
| 966 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 967 | |||||||||||||||||||||||||||||||||||||||||||
| 968 | 0 | $self->error("State '$state_requested' is not valid"); | |||||||||||||||||||||||||||||||||||||||||
| 969 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 970 | |||||||||||||||||||||||||||||||||||||||||||
| 971 | } | ||||||||||||||||||||||||||||||||||||||||||
| 972 | |||||||||||||||||||||||||||||||||||||||||||
| 973 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 974 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 975 | |||||||||||||||||||||||||||||||||||||||||||
| 976 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 977 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 978 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 979 | } | ||||||||||||||||||||||||||||||||||||||||||
| 980 | |||||||||||||||||||||||||||||||||||||||||||
| 981 | 0 | return $state_requested; | |||||||||||||||||||||||||||||||||||||||||
| 982 | |||||||||||||||||||||||||||||||||||||||||||
| 983 | } | ||||||||||||||||||||||||||||||||||||||||||
| 984 | |||||||||||||||||||||||||||||||||||||||||||
| 985 | 0 | my $ilo_command = $self->_generate_cmd('uid_status'); | |||||||||||||||||||||||||||||||||||||||||
| 986 | |||||||||||||||||||||||||||||||||||||||||||
| 987 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 988 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 989 | |||||||||||||||||||||||||||||||||||||||||||
| 990 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 991 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 992 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 993 | } | ||||||||||||||||||||||||||||||||||||||||||
| 994 | |||||||||||||||||||||||||||||||||||||||||||
| 995 | 0 | my $uid_status = $xml->{GET_UID_STATUS}->{UID}; | |||||||||||||||||||||||||||||||||||||||||
| 996 | |||||||||||||||||||||||||||||||||||||||||||
| 997 | 0 | return lc($uid_status); | |||||||||||||||||||||||||||||||||||||||||
| 998 | |||||||||||||||||||||||||||||||||||||||||||
| 999 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1000 | |||||||||||||||||||||||||||||||||||||||||||
| 1001 | |||||||||||||||||||||||||||||||||||||||||||
| 1002 | 22 | ▶ | sub username { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
username: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||||||||||||||||
| 1003 | |||||||||||||||||||||||||||||||||||||||||||
| 1004 | 22 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1005 | |||||||||||||||||||||||||||||||||||||||||||
| 1006 | 22 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1007 | 7 | $self->{username} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1008 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1009 | |||||||||||||||||||||||||||||||||||||||||||
| 1010 | 22 | return $self->{username}; | |||||||||||||||||||||||||||||||||||||||||
| 1011 | |||||||||||||||||||||||||||||||||||||||||||
| 1012 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1013 | |||||||||||||||||||||||||||||||||||||||||||
| 1014 | |||||||||||||||||||||||||||||||||||||||||||
| 1015 | 3 | ▶ | sub _check_errors { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_check_errors: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1016 | |||||||||||||||||||||||||||||||||||||||||||
| 1017 | 3 | my $xml = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1018 | |||||||||||||||||||||||||||||||||||||||||||
| 1019 | 3 | my $errcode = $xml->{RESPONSE}->{STATUS}; | |||||||||||||||||||||||||||||||||||||||||
| 1020 | 3 | my $errmsg = $xml->{RESPONSE}->{MESSAGE}; | |||||||||||||||||||||||||||||||||||||||||
| 1021 | |||||||||||||||||||||||||||||||||||||||||||
| 1022 | 3 | ▶ | if ($errcode ne '0x0000') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1023 | 2 | return $errmsg; | |||||||||||||||||||||||||||||||||||||||||
| 1024 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1025 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1026 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1027 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1028 | |||||||||||||||||||||||||||||||||||||||||||
| 1029 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1030 | |||||||||||||||||||||||||||||||||||||||||||
| 1031 | |||||||||||||||||||||||||||||||||||||||||||
| 1032 | 2 | ▶ | sub _connect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_connect: called CC=5 SCAR=23.7
| |||||||||||||||||||||||||||||||||||||||||||
| 1033 | |||||||||||||||||||||||||||||||||||||||||||
| 1034 | 2 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1035 | |||||||||||||||||||||||||||||||||||||||||||
| 1036 | 2 | ▶ | if ($self->{_client}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1037 | 1 | return $self->{_client}; | |||||||||||||||||||||||||||||||||||||||||
| 1038 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1039 | |||||||||||||||||||||||||||||||||||||||||||
| 1040 | 1 | ▶ | my $address = $self->address or croak "Can't connect: address not set"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1041 | 0 | ▶ | my $port = $self->port or croak "Can't connect: port not set"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1042 | |||||||||||||||||||||||||||||||||||||||||||
| 1043 | 0 | $self->{_client} = IO::Socket::SSL->new( | |||||||||||||||||||||||||||||||||||||||||
| 1044 | PeerAddr => "$address:$port", | ||||||||||||||||||||||||||||||||||||||||||
| 1045 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1046 | |||||||||||||||||||||||||||||||||||||||||||
| 1047 | 0 | ▶ | if (!$self->{_client}) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1048 | 0 | $self->error( "Unable to establish SSL connection with $address:$port [" . IO::Socket::SSL::errstr() . "]" ); | |||||||||||||||||||||||||||||||||||||||||
| 1049 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1050 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1051 | |||||||||||||||||||||||||||||||||||||||||||
| 1052 | 0 | return $self->{_client}; | |||||||||||||||||||||||||||||||||||||||||
| 1053 | |||||||||||||||||||||||||||||||||||||||||||
| 1054 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1055 | |||||||||||||||||||||||||||||||||||||||||||
| 1056 | |||||||||||||||||||||||||||||||||||||||||||
| 1057 | 30 | ▶ | sub _debug { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_debug: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||
| 1058 | |||||||||||||||||||||||||||||||||||||||||||
| 1059 | 30 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1060 | |||||||||||||||||||||||||||||||||||||||||||
| 1061 | 30 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1062 | 0 | $self->{_debug} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1063 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1064 | |||||||||||||||||||||||||||||||||||||||||||
| 1065 | 30 | return $self->{_debug}; | |||||||||||||||||||||||||||||||||||||||||
| 1066 | |||||||||||||||||||||||||||||||||||||||||||
| 1067 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1068 | |||||||||||||||||||||||||||||||||||||||||||
| 1069 | |||||||||||||||||||||||||||||||||||||||||||
| 1070 | 0 | ▶ | sub _detect_version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_detect_version: not called CC=3 SCAR=24.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1071 | |||||||||||||||||||||||||||||||||||||||||||
| 1072 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1073 | |||||||||||||||||||||||||||||||||||||||||||
| 1074 | # iLO 3 has a slightly different interface; it requires that | ||||||||||||||||||||||||||||||||||||||||||
| 1075 | # you preface commands with an HTTP header | ||||||||||||||||||||||||||||||||||||||||||
| 1076 | |||||||||||||||||||||||||||||||||||||||||||
| 1077 | 0 | my $ilo_command = qq( | |||||||||||||||||||||||||||||||||||||||||
| 1078 | POST /ribcl HTTP/1.1 | ||||||||||||||||||||||||||||||||||||||||||
| 1079 | HOST: localhost | ||||||||||||||||||||||||||||||||||||||||||
| 1080 | Content-length: 30 | ||||||||||||||||||||||||||||||||||||||||||
| 1081 | Connection: Close | ||||||||||||||||||||||||||||||||||||||||||
| 1082 | |||||||||||||||||||||||||||||||||||||||||||
| 1083 | <RIBCL VERSION="2.0"></RIBCL> | ||||||||||||||||||||||||||||||||||||||||||
| 1084 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1085 | |||||||||||||||||||||||||||||||||||||||||||
| 1086 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1087 | |||||||||||||||||||||||||||||||||||||||||||
| 1088 | 0 | ▶ | if ($response =~ /^HTTP\/1.1 200 OK/) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1089 | 0 | return 3; | |||||||||||||||||||||||||||||||||||||||||
| 1090 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1091 | else { | ||||||||||||||||||||||||||||||||||||||||||
| 1092 | 0 | return 2; | |||||||||||||||||||||||||||||||||||||||||
| 1093 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1094 | |||||||||||||||||||||||||||||||||||||||||||
| 1095 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1096 | |||||||||||||||||||||||||||||||||||||||||||
| 1097 | |||||||||||||||||||||||||||||||||||||||||||
| 1098 | 0 | ▶ | sub _disconnect { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_disconnect: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1099 | |||||||||||||||||||||||||||||||||||||||||||
| 1100 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1101 | |||||||||||||||||||||||||||||||||||||||||||
| 1102 | 0 | ▶ | my $client = $self->{_client} or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1103 | |||||||||||||||||||||||||||||||||||||||||||
| 1104 | 0 | $client->close; | |||||||||||||||||||||||||||||||||||||||||
| 1105 | |||||||||||||||||||||||||||||||||||||||||||
| 1106 | 0 | delete $self->{_client}; | |||||||||||||||||||||||||||||||||||||||||
| 1107 | |||||||||||||||||||||||||||||||||||||||||||
| 1108 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1109 | |||||||||||||||||||||||||||||||||||||||||||
| 1110 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1111 | |||||||||||||||||||||||||||||||||||||||||||
| 1112 | |||||||||||||||||||||||||||||||||||||||||||
| 1113 | 13 | ▶ | sub _generate_cmd { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_generate_cmd: called CC=2 SCAR=6.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1114 | |||||||||||||||||||||||||||||||||||||||||||
| 1115 | 13 | my ($self, $command) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1116 | |||||||||||||||||||||||||||||||||||||||||||
| 1117 | 13 | my %commands = ( | |||||||||||||||||||||||||||||||||||||||||
| 1118 | |||||||||||||||||||||||||||||||||||||||||||
| 1119 | 'get_embedded_health' => qq( <SERVER_INFO MODE="read"> | ||||||||||||||||||||||||||||||||||||||||||
| 1120 | <GET_EMBEDDED_HEALTH/> | ||||||||||||||||||||||||||||||||||||||||||
| 1121 | </SERVER_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1122 | |||||||||||||||||||||||||||||||||||||||||||
| 1123 | 'get_fw_version' => qq( <RIB_INFO MODE="read"> | ||||||||||||||||||||||||||||||||||||||||||
| 1124 | <GET_FW_VERSION/> | ||||||||||||||||||||||||||||||||||||||||||
| 1125 | </RIB_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1126 | |||||||||||||||||||||||||||||||||||||||||||
| 1127 | 'get_global_settings' => qq( <RIB_INFO MODE="read"> | ||||||||||||||||||||||||||||||||||||||||||
| 1128 | <GET_GLOBAL_SETTINGS/> | ||||||||||||||||||||||||||||||||||||||||||
| 1129 | </RIB_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1130 | |||||||||||||||||||||||||||||||||||||||||||
| 1131 | 'get_host_data' => qq( <SERVER_INFO MODE="read"> | ||||||||||||||||||||||||||||||||||||||||||
| 1132 | <GET_HOST_DATA/> | ||||||||||||||||||||||||||||||||||||||||||
| 1133 | </SERVER_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1134 | |||||||||||||||||||||||||||||||||||||||||||
| 1135 | 'get_network_settings' => qq( <RIB_INFO MODE="read"> | ||||||||||||||||||||||||||||||||||||||||||
| 1136 | <GET_NETWORK_SETTINGS/> | ||||||||||||||||||||||||||||||||||||||||||
| 1137 | </RIB_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1138 | |||||||||||||||||||||||||||||||||||||||||||
| 1139 | 'power_consumption' => qq( <SERVER_INFO MODE="read"> | ||||||||||||||||||||||||||||||||||||||||||
| 1140 | <GET_POWER_READINGS/> | ||||||||||||||||||||||||||||||||||||||||||
| 1141 | </SERVER_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1142 | |||||||||||||||||||||||||||||||||||||||||||
| 1143 | 'power_off' => qq( <SERVER_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 1144 | <SET_HOST_POWER HOST_POWER="No"/> | ||||||||||||||||||||||||||||||||||||||||||
| 1145 | </SERVER_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1146 | |||||||||||||||||||||||||||||||||||||||||||
| 1147 | 'power_on' => qq( <SERVER_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 1148 | <SET_HOST_POWER HOST_POWER="Yes"/> | ||||||||||||||||||||||||||||||||||||||||||
| 1149 | </SERVER_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1150 | |||||||||||||||||||||||||||||||||||||||||||
| 1151 | 'power_reset' => qq( <SERVER_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 1152 | <RESET_SERVER/> | ||||||||||||||||||||||||||||||||||||||||||
| 1153 | </SERVER_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1154 | |||||||||||||||||||||||||||||||||||||||||||
| 1155 | 'power_status' => qq( <SERVER_INFO MODE="read"> | ||||||||||||||||||||||||||||||||||||||||||
| 1156 | <GET_HOST_POWER_STATUS/> | ||||||||||||||||||||||||||||||||||||||||||
| 1157 | </SERVER_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1158 | |||||||||||||||||||||||||||||||||||||||||||
| 1159 | 'reset' => qq( <RIB_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 1160 | <RESET_RIB/> | ||||||||||||||||||||||||||||||||||||||||||
| 1161 | </RIB_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1162 | |||||||||||||||||||||||||||||||||||||||||||
| 1163 | 'uid_off' => qq( <SERVER_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 1164 | <UID_CONTROL UID="No"/> | ||||||||||||||||||||||||||||||||||||||||||
| 1165 | </SERVER_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1166 | |||||||||||||||||||||||||||||||||||||||||||
| 1167 | 'uid_on' => qq( <SERVER_INFO MODE="write"> | ||||||||||||||||||||||||||||||||||||||||||
| 1168 | <UID_CONTROL UID="Yes"/> | ||||||||||||||||||||||||||||||||||||||||||
| 1169 | </SERVER_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1170 | |||||||||||||||||||||||||||||||||||||||||||
| 1171 | 'uid_status' => qq( <SERVER_INFO MODE="read"> | ||||||||||||||||||||||||||||||||||||||||||
| 1172 | <GET_UID_STATUS/> | ||||||||||||||||||||||||||||||||||||||||||
| 1173 | </SERVER_INFO> ), | ||||||||||||||||||||||||||||||||||||||||||
| 1174 | |||||||||||||||||||||||||||||||||||||||||||
| 1175 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1176 | |||||||||||||||||||||||||||||||||||||||||||
| 1177 | 13 | ▶ | my $ilo_command = $commands{$command} or die "Internal error: command '$command' doesn't exist"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1178 | |||||||||||||||||||||||||||||||||||||||||||
| 1179 | 12 | $ilo_command = $self->_wrap($ilo_command); | |||||||||||||||||||||||||||||||||||||||||
| 1180 | |||||||||||||||||||||||||||||||||||||||||||
| 1181 | 12 | return $ilo_command; | |||||||||||||||||||||||||||||||||||||||||
| 1182 | |||||||||||||||||||||||||||||||||||||||||||
| 1183 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1184 | |||||||||||||||||||||||||||||||||||||||||||
| 1185 | |||||||||||||||||||||||||||||||||||||||||||
| 1186 | 0 | ▶ | sub _length { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_length: not called CC=2 SCAR=17.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1187 | |||||||||||||||||||||||||||||||||||||||||||
| 1188 | # for iLO 3 we need to know the length of the XML for the | ||||||||||||||||||||||||||||||||||||||||||
| 1189 | # Content-length field in the http header | ||||||||||||||||||||||||||||||||||||||||||
| 1190 | |||||||||||||||||||||||||||||||||||||||||||
| 1191 | 0 | my ($self, $ilo_command) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1192 | |||||||||||||||||||||||||||||||||||||||||||
| 1193 | 0 | my $length = 0; | |||||||||||||||||||||||||||||||||||||||||
| 1194 | |||||||||||||||||||||||||||||||||||||||||||
| 1195 | 0 | foreach my $line (split(/\n/, $ilo_command)) { | |||||||||||||||||||||||||||||||||||||||||
| 1196 | |||||||||||||||||||||||||||||||||||||||||||
| 1197 | 0 | $line =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||
| 1198 | 0 | $line =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||
| 1199 | |||||||||||||||||||||||||||||||||||||||||||
| 1200 | # each line has \r\n appended when sending, so + 2 | ||||||||||||||||||||||||||||||||||||||||||
| 1201 | 0 | $length += length($line) + 2; | |||||||||||||||||||||||||||||||||||||||||
| 1202 | |||||||||||||||||||||||||||||||||||||||||||
| 1203 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1204 | |||||||||||||||||||||||||||||||||||||||||||
| 1205 | 0 | return $length; | |||||||||||||||||||||||||||||||||||||||||
| 1206 | |||||||||||||||||||||||||||||||||||||||||||
| 1207 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1208 | |||||||||||||||||||||||||||||||||||||||||||
| 1209 | |||||||||||||||||||||||||||||||||||||||||||
| 1210 | 0 | ▶ | sub _populate_embedded_health { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_populate_embedded_health: not called CC=12 SCAR=50.5
| |||||||||||||||||||||||||||||||||||||||||||
| 1211 | |||||||||||||||||||||||||||||||||||||||||||
| 1212 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1213 | |||||||||||||||||||||||||||||||||||||||||||
| 1214 | 0 | my $ilo_command = $self->_generate_cmd('get_embedded_health'); | |||||||||||||||||||||||||||||||||||||||||
| 1215 | |||||||||||||||||||||||||||||||||||||||||||
| 1216 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1217 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1218 | |||||||||||||||||||||||||||||||||||||||||||
| 1219 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1220 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 1221 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1222 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1223 | |||||||||||||||||||||||||||||||||||||||||||
| 1224 | 0 | my $fans = $xml->{GET_EMBEDDED_HEALTH_DATA}->{FANS}->{FAN}; | |||||||||||||||||||||||||||||||||||||||||
| 1225 | 0 | my $power_supplies = $xml->{GET_EMBEDDED_HEALTH_DATA}->{POWER_SUPPLIES}->{SUPPLY}; | |||||||||||||||||||||||||||||||||||||||||
| 1226 | 0 | my $temperatures = $xml->{GET_EMBEDDED_HEALTH_DATA}->{TEMPERATURE}->{TEMP}; | |||||||||||||||||||||||||||||||||||||||||
| 1227 | |||||||||||||||||||||||||||||||||||||||||||
| 1228 | 0 | foreach my $fan (@$fans) { | |||||||||||||||||||||||||||||||||||||||||
| 1229 | |||||||||||||||||||||||||||||||||||||||||||
| 1230 | 0 | my $location = $fan->{ZONE}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1231 | 0 | my $name = $fan->{LABEL}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1232 | 0 | my $speed = $fan->{SPEED}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1233 | 0 | my $status = $fan->{STATUS}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1234 | 0 | my $unit = $fan->{SPEED}->{UNIT}; | |||||||||||||||||||||||||||||||||||||||||
| 1235 | |||||||||||||||||||||||||||||||||||||||||||
| 1236 | 0 | ▶ | next unless $speed && $speed =~ /^\d+$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$speed and $speed =~ /^\d+$/
MC/DC0%0/2
$speed and $speed =~ /^\d+$/
$speed
$speed =~ /^\d+$/
Truth table0%0/3
A and B
A= $speedB= $speed =~ /^\d+$/
| |||||||||||||||||||||||||||||||||||||||||||
| 1237 | |||||||||||||||||||||||||||||||||||||||||||
| 1238 | 0 | push( @{$self->{fans}}, { | |||||||||||||||||||||||||||||||||||||||||
| 1239 | 'location' => $location, | ||||||||||||||||||||||||||||||||||||||||||
| 1240 | 'name' => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 1241 | 'speed' => $speed, | ||||||||||||||||||||||||||||||||||||||||||
| 1242 | 'status' => $status, | ||||||||||||||||||||||||||||||||||||||||||
| 1243 | 'unit' => $unit, | ||||||||||||||||||||||||||||||||||||||||||
| 1244 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 1245 | |||||||||||||||||||||||||||||||||||||||||||
| 1246 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1247 | |||||||||||||||||||||||||||||||||||||||||||
| 1248 | 0 | foreach my $power_supply (@$power_supplies) { | |||||||||||||||||||||||||||||||||||||||||
| 1249 | |||||||||||||||||||||||||||||||||||||||||||
| 1250 | 0 | my $name = $power_supply->{LABEL}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1251 | 0 | my $status = $power_supply->{STATUS}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1252 | |||||||||||||||||||||||||||||||||||||||||||
| 1253 | 0 | ▶ | next if $status eq 'Not Installed'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1254 | |||||||||||||||||||||||||||||||||||||||||||
| 1255 | 0 | push( @{$self->{power_supplies}}, { | |||||||||||||||||||||||||||||||||||||||||
| 1256 | 'name' => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 1257 | 'status' => $status, | ||||||||||||||||||||||||||||||||||||||||||
| 1258 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 1259 | |||||||||||||||||||||||||||||||||||||||||||
| 1260 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1261 | |||||||||||||||||||||||||||||||||||||||||||
| 1262 | 0 | foreach my $temperature (@$temperatures) { | |||||||||||||||||||||||||||||||||||||||||
| 1263 | |||||||||||||||||||||||||||||||||||||||||||
| 1264 | 0 | my $name = $temperature->{LABEL}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1265 | 0 | my $location = $temperature->{LOCATION}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1266 | 0 | my $value = $temperature->{CURRENTREADING}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1267 | 0 | my $unit = $temperature->{CURRENTREADING}->{UNIT}; | |||||||||||||||||||||||||||||||||||||||||
| 1268 | 0 | my $caution = $temperature->{CAUTION}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1269 | 0 | my $critical = $temperature->{CRITICAL}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1270 | 0 | my $status = $temperature->{STATUS}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1271 | |||||||||||||||||||||||||||||||||||||||||||
| 1272 | 0 | ▶ | next unless $value && $value =~ /^\d+$/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$value and $value =~ /^\d+$/
MC/DC0%0/2
$value and $value =~ /^\d+$/
$value
$value =~ /^\d+$/
Truth table0%0/3
A and B
A= $valueB= $value =~ /^\d+$/
| |||||||||||||||||||||||||||||||||||||||||||
| 1273 | |||||||||||||||||||||||||||||||||||||||||||
| 1274 | 0 | push( @{$self->{temperatures}}, { | |||||||||||||||||||||||||||||||||||||||||
| 1275 | 'name' => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 1276 | 'location' => $location, | ||||||||||||||||||||||||||||||||||||||||||
| 1277 | 'value' => $value, | ||||||||||||||||||||||||||||||||||||||||||
| 1278 | 'unit' => $unit, | ||||||||||||||||||||||||||||||||||||||||||
| 1279 | 'caution' => $caution, | ||||||||||||||||||||||||||||||||||||||||||
| 1280 | 'critical' => $critical, | ||||||||||||||||||||||||||||||||||||||||||
| 1281 | 'status' => $status, | ||||||||||||||||||||||||||||||||||||||||||
| 1282 | }); | ||||||||||||||||||||||||||||||||||||||||||
| 1283 | |||||||||||||||||||||||||||||||||||||||||||
| 1284 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1285 | |||||||||||||||||||||||||||||||||||||||||||
| 1286 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1287 | |||||||||||||||||||||||||||||||||||||||||||
| 1288 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1289 | |||||||||||||||||||||||||||||||||||||||||||
| 1290 | |||||||||||||||||||||||||||||||||||||||||||
| 1291 | 0 | ▶ | sub _populate_fw_version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_populate_fw_version: not called CC=4 SCAR=30.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1292 | |||||||||||||||||||||||||||||||||||||||||||
| 1293 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1294 | |||||||||||||||||||||||||||||||||||||||||||
| 1295 | 0 | my $ilo_command = $self->_generate_cmd('get_fw_version'); | |||||||||||||||||||||||||||||||||||||||||
| 1296 | |||||||||||||||||||||||||||||||||||||||||||
| 1297 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1298 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1299 | |||||||||||||||||||||||||||||||||||||||||||
| 1300 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1301 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 1302 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1303 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1304 | |||||||||||||||||||||||||||||||||||||||||||
| 1305 | 0 | $self->{fw_type} = $xml->{GET_FW_VERSION}->{MANAGEMENT_PROCESSOR}; | |||||||||||||||||||||||||||||||||||||||||
| 1306 | 0 | $self->{fw_date} = $xml->{GET_FW_VERSION}->{FIRMWARE_DATE}; | |||||||||||||||||||||||||||||||||||||||||
| 1307 | 0 | $self->{fw_version} = $xml->{GET_FW_VERSION}->{FIRMWARE_VERSION}; | |||||||||||||||||||||||||||||||||||||||||
| 1308 | |||||||||||||||||||||||||||||||||||||||||||
| 1309 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1310 | |||||||||||||||||||||||||||||||||||||||||||
| 1311 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1312 | |||||||||||||||||||||||||||||||||||||||||||
| 1313 | |||||||||||||||||||||||||||||||||||||||||||
| 1314 | 0 | ▶ | sub _populate_global_settings { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_populate_global_settings: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1315 | |||||||||||||||||||||||||||||||||||||||||||
| 1316 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1317 | |||||||||||||||||||||||||||||||||||||||||||
| 1318 | 0 | my $ilo_command = $self->_generate_cmd('get_global_settings'); | |||||||||||||||||||||||||||||||||||||||||
| 1319 | |||||||||||||||||||||||||||||||||||||||||||
| 1320 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1321 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1322 | |||||||||||||||||||||||||||||||||||||||||||
| 1323 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1324 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 1325 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1326 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1327 | |||||||||||||||||||||||||||||||||||||||||||
| 1328 | 0 | my @fields = qw( session_timeout https_port http_port | |||||||||||||||||||||||||||||||||||||||||
| 1329 | ssh_port ssh_status ); | ||||||||||||||||||||||||||||||||||||||||||
| 1330 | |||||||||||||||||||||||||||||||||||||||||||
| 1331 | 0 | foreach my $field (@fields) { | |||||||||||||||||||||||||||||||||||||||||
| 1332 | |||||||||||||||||||||||||||||||||||||||||||
| 1333 | 0 | $self->{$field} = $xml->{GET_GLOBAL_SETTINGS}->{uc($field)}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1334 | |||||||||||||||||||||||||||||||||||||||||||
| 1335 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1336 | |||||||||||||||||||||||||||||||||||||||||||
| 1337 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1338 | |||||||||||||||||||||||||||||||||||||||||||
| 1339 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1340 | |||||||||||||||||||||||||||||||||||||||||||
| 1341 | |||||||||||||||||||||||||||||||||||||||||||
| 1342 | 0 | ▶ | sub _populate_host_data { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_populate_host_data: not called CC=45 SCAR=76.4
| |||||||||||||||||||||||||||||||||||||||||||
| 1343 | |||||||||||||||||||||||||||||||||||||||||||
| 1344 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1345 | |||||||||||||||||||||||||||||||||||||||||||
| 1346 | 0 | my $ilo_command = $self->_generate_cmd('get_host_data'); | |||||||||||||||||||||||||||||||||||||||||
| 1347 | |||||||||||||||||||||||||||||||||||||||||||
| 1348 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1349 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1350 | |||||||||||||||||||||||||||||||||||||||||||
| 1351 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1352 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 1353 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1354 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1355 | |||||||||||||||||||||||||||||||||||||||||||
| 1356 | # SMBIOS data is stored in a big fat array | ||||||||||||||||||||||||||||||||||||||||||
| 1357 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1358 | # data is not guaranteed to be in any particular index, so we have to | ||||||||||||||||||||||||||||||||||||||||||
| 1359 | # iterate through all the data looking for certain fields. | ||||||||||||||||||||||||||||||||||||||||||
| 1360 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1361 | # thankfully, SMBIOS *types* are standard (eg. CPU data is type 4) | ||||||||||||||||||||||||||||||||||||||||||
| 1362 | # so we have a starting point | ||||||||||||||||||||||||||||||||||||||||||
| 1363 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1364 | # this really sucks but I don't know of a better way | ||||||||||||||||||||||||||||||||||||||||||
| 1365 | |||||||||||||||||||||||||||||||||||||||||||
| 1366 | 0 | for my $fieldnum (0 .. scalar @{$xml->{GET_HOST_DATA}->{SMBIOS_RECORD}}) { | |||||||||||||||||||||||||||||||||||||||||
| 1367 | |||||||||||||||||||||||||||||||||||||||||||
| 1368 | 0 | my $smbios_data = $xml->{GET_HOST_DATA}->{SMBIOS_RECORD}[$fieldnum]->{FIELD}; | |||||||||||||||||||||||||||||||||||||||||
| 1369 | 0 | my $smbios_type = $xml->{GET_HOST_DATA}->{SMBIOS_RECORD}[$fieldnum]->{TYPE}; | |||||||||||||||||||||||||||||||||||||||||
| 1370 | |||||||||||||||||||||||||||||||||||||||||||
| 1371 | 0 | ▶ | next unless defined $smbios_type; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1372 | |||||||||||||||||||||||||||||||||||||||||||
| 1373 | 0 | ▶ | if ($smbios_type == 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1374 | |||||||||||||||||||||||||||||||||||||||||||
| 1375 | 0 | for my $entry (0 .. scalar @$smbios_data) { | |||||||||||||||||||||||||||||||||||||||||
| 1376 | |||||||||||||||||||||||||||||||||||||||||||
| 1377 | 0 | my $field_name = $smbios_data->[$entry]->{NAME}; | |||||||||||||||||||||||||||||||||||||||||
| 1378 | 0 | my $field_value = $smbios_data->[$entry]->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1379 | |||||||||||||||||||||||||||||||||||||||||||
| 1380 | 0 | ▶ | next unless $field_name && $field_value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$field_name and $field_value
MC/DC0%0/2
$field_name and $field_value
$field_name
$field_value
Truth table0%0/3
A and B
A= $field_nameB= $field_value
| |||||||||||||||||||||||||||||||||||||||||||
| 1381 | |||||||||||||||||||||||||||||||||||||||||||
| 1382 | 0 | ▶ | if ($field_name eq 'Date') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1383 | 0 | $self->{biosdate} = $field_value; | |||||||||||||||||||||||||||||||||||||||||
| 1384 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1385 | |||||||||||||||||||||||||||||||||||||||||||
| 1386 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1387 | |||||||||||||||||||||||||||||||||||||||||||
| 1388 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1389 | elsif ($smbios_type == 1) { | ||||||||||||||||||||||||||||||||||||||||||
| 1390 | |||||||||||||||||||||||||||||||||||||||||||
| 1391 | 0 | for my $entry (0 .. scalar @$smbios_data) { | |||||||||||||||||||||||||||||||||||||||||
| 1392 | |||||||||||||||||||||||||||||||||||||||||||
| 1393 | 0 | my $field_name = $smbios_data->[$entry]->{NAME}; | |||||||||||||||||||||||||||||||||||||||||
| 1394 | 0 | my $field_value = $smbios_data->[$entry]->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1395 | |||||||||||||||||||||||||||||||||||||||||||
| 1396 | 0 | ▶ | next unless $field_name && $field_value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$field_name and $field_value
MC/DC0%0/2
$field_name and $field_value
$field_name
$field_value
Truth table0%0/3
A and B
A= $field_nameB= $field_value
| |||||||||||||||||||||||||||||||||||||||||||
| 1397 | |||||||||||||||||||||||||||||||||||||||||||
| 1398 | 0 | ▶ | if ($field_name eq 'Product Name') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1399 | 0 | $self->{model} = $field_value; | |||||||||||||||||||||||||||||||||||||||||
| 1400 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1401 | elsif ($field_name eq 'Serial Number') { | ||||||||||||||||||||||||||||||||||||||||||
| 1402 | 0 | $self->{serialID} = $field_value; | |||||||||||||||||||||||||||||||||||||||||
| 1403 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1404 | elsif ($field_name eq 'UUID') { | ||||||||||||||||||||||||||||||||||||||||||
| 1405 | 0 | $self->{UUID} = $field_value; | |||||||||||||||||||||||||||||||||||||||||
| 1406 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1407 | |||||||||||||||||||||||||||||||||||||||||||
| 1408 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1409 | |||||||||||||||||||||||||||||||||||||||||||
| 1410 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1411 | elsif ($smbios_type == 4) { | ||||||||||||||||||||||||||||||||||||||||||
| 1412 | |||||||||||||||||||||||||||||||||||||||||||
| 1413 | 0 | my ($name, $speed, $cores); | |||||||||||||||||||||||||||||||||||||||||
| 1414 | |||||||||||||||||||||||||||||||||||||||||||
| 1415 | 0 | for my $entry (0 .. scalar @$smbios_data) { | |||||||||||||||||||||||||||||||||||||||||
| 1416 | |||||||||||||||||||||||||||||||||||||||||||
| 1417 | 0 | my $field_name = $smbios_data->[$entry]->{NAME}; | |||||||||||||||||||||||||||||||||||||||||
| 1418 | 0 | my $field_value = $smbios_data->[$entry]->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1419 | |||||||||||||||||||||||||||||||||||||||||||
| 1420 | 0 | ▶ | next unless $field_name && $field_value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$field_name and $field_value
MC/DC0%0/2
$field_name and $field_value
$field_name
$field_value
Truth table0%0/3
A and B
A= $field_nameB= $field_value
| |||||||||||||||||||||||||||||||||||||||||||
| 1421 | |||||||||||||||||||||||||||||||||||||||||||
| 1422 | 0 | ▶ | if ($field_name eq 'Label') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1423 | 0 | $name = $field_value; | |||||||||||||||||||||||||||||||||||||||||
| 1424 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1425 | elsif ($field_name eq 'Speed') { | ||||||||||||||||||||||||||||||||||||||||||
| 1426 | 0 | $speed = $field_value; | |||||||||||||||||||||||||||||||||||||||||
| 1427 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1428 | elsif ($field_name eq 'Execution Technology') { | ||||||||||||||||||||||||||||||||||||||||||
| 1429 | 0 | ▶ | $cores = $field_value || 'single core'; | ||||||||||||||||||||||||||||||||||||||||
|
Condition0%0/2
$field_value || 'single core'
MC/DC0%0/1
$field_value || 'single core'
$field_value
Truth table0%0/2
A
A= $field_value
| |||||||||||||||||||||||||||||||||||||||||||
| 1430 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1431 | |||||||||||||||||||||||||||||||||||||||||||
| 1432 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1433 | |||||||||||||||||||||||||||||||||||||||||||
| 1434 | # otherwise slot is empty | ||||||||||||||||||||||||||||||||||||||||||
| 1435 | 0 | ▶ | next unless $speed && $speed =~ /^[1-9]/; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$speed and $speed =~ /^[1-9]/
MC/DC0%0/2
$speed and $speed =~ /^[1-9]/
$speed
$speed =~ /^[1-9]/
Truth table0%0/3
A and B
A= $speedB= $speed =~ /^[1-9]/
| |||||||||||||||||||||||||||||||||||||||||||
| 1436 | |||||||||||||||||||||||||||||||||||||||||||
| 1437 | 0 | push( @{$self->{cpus}}, { | |||||||||||||||||||||||||||||||||||||||||
| 1438 | 'name' => $name, | ||||||||||||||||||||||||||||||||||||||||||
| 1439 | 'speed' => $speed, | ||||||||||||||||||||||||||||||||||||||||||
| 1440 | 'cores' => $cores } | ||||||||||||||||||||||||||||||||||||||||||
| 1441 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1442 | |||||||||||||||||||||||||||||||||||||||||||
| 1443 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1444 | elsif ($smbios_type == 17) { | ||||||||||||||||||||||||||||||||||||||||||
| 1445 | |||||||||||||||||||||||||||||||||||||||||||
| 1446 | 0 | my ($location, $size, $speed); | |||||||||||||||||||||||||||||||||||||||||
| 1447 | |||||||||||||||||||||||||||||||||||||||||||
| 1448 | 0 | for my $entry (0 .. scalar @$smbios_data) { | |||||||||||||||||||||||||||||||||||||||||
| 1449 | |||||||||||||||||||||||||||||||||||||||||||
| 1450 | 0 | my $field_name = $smbios_data->[$entry]->{NAME}; | |||||||||||||||||||||||||||||||||||||||||
| 1451 | 0 | my $field_value = $smbios_data->[$entry]->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1452 | |||||||||||||||||||||||||||||||||||||||||||
| 1453 | 0 | ▶ | next unless $field_name && $field_value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$field_name and $field_value
MC/DC0%0/2
$field_name and $field_value
$field_name
$field_value
Truth table0%0/3
A and B
A= $field_nameB= $field_value
| |||||||||||||||||||||||||||||||||||||||||||
| 1454 | |||||||||||||||||||||||||||||||||||||||||||
| 1455 | 0 | ▶ | if ($field_name eq 'Label') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 3 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1456 | 0 | $location = $field_value; | |||||||||||||||||||||||||||||||||||||||||
| 1457 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1458 | elsif ($field_name eq 'Size') { | ||||||||||||||||||||||||||||||||||||||||||
| 1459 | 0 | $size = $field_value; | |||||||||||||||||||||||||||||||||||||||||
| 1460 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1461 | elsif ($field_name eq 'Speed') { | ||||||||||||||||||||||||||||||||||||||||||
| 1462 | 0 | $speed = $field_value; | |||||||||||||||||||||||||||||||||||||||||
| 1463 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1464 | |||||||||||||||||||||||||||||||||||||||||||
| 1465 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1466 | |||||||||||||||||||||||||||||||||||||||||||
| 1467 | 0 | push( @{$self->{ramslots}}, { | |||||||||||||||||||||||||||||||||||||||||
| 1468 | 'location' => $location, | ||||||||||||||||||||||||||||||||||||||||||
| 1469 | 'size' => $size, | ||||||||||||||||||||||||||||||||||||||||||
| 1470 | 'speed' => $speed } | ||||||||||||||||||||||||||||||||||||||||||
| 1471 | ); | ||||||||||||||||||||||||||||||||||||||||||
| 1472 | |||||||||||||||||||||||||||||||||||||||||||
| 1473 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1474 | elsif ($smbios_type == 209) { | ||||||||||||||||||||||||||||||||||||||||||
| 1475 | |||||||||||||||||||||||||||||||||||||||||||
| 1476 | 0 | for my $entry (0 .. scalar @$smbios_data) { | |||||||||||||||||||||||||||||||||||||||||
| 1477 | |||||||||||||||||||||||||||||||||||||||||||
| 1478 | 0 | my $field_name = $smbios_data->[$entry]->{NAME}; | |||||||||||||||||||||||||||||||||||||||||
| 1479 | 0 | my $field_value = $smbios_data->[$entry]->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1480 | |||||||||||||||||||||||||||||||||||||||||||
| 1481 | 0 | ▶ | next unless $field_name && $field_value; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition0%0/3
$field_name and $field_value
MC/DC0%0/2
$field_name and $field_value
$field_name
$field_value
Truth table0%0/3
A and B
A= $field_nameB= $field_value
| |||||||||||||||||||||||||||||||||||||||||||
| 1482 | 0 | ▶ | next unless $field_name eq 'Port'; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1483 | |||||||||||||||||||||||||||||||||||||||||||
| 1484 | # MAC address is offset by one from port label | ||||||||||||||||||||||||||||||||||||||||||
| 1485 | |||||||||||||||||||||||||||||||||||||||||||
| 1486 | 0 | my $current_mac = $smbios_data->[$entry + 1]->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1487 | |||||||||||||||||||||||||||||||||||||||||||
| 1488 | 0 | ▶ | if ($field_value eq '1') { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 5 branches
| |||||||||||||||||||||||||||||||||||||||||||
| 1489 | 0 | $self->{mac01} = $current_mac; | |||||||||||||||||||||||||||||||||||||||||
| 1490 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1491 | elsif ($field_value eq '2') { | ||||||||||||||||||||||||||||||||||||||||||
| 1492 | 0 | $self->{mac02} = $current_mac; | |||||||||||||||||||||||||||||||||||||||||
| 1493 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1494 | elsif ($field_value eq '3') { | ||||||||||||||||||||||||||||||||||||||||||
| 1495 | 0 | $self->{mac03} = $current_mac; | |||||||||||||||||||||||||||||||||||||||||
| 1496 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1497 | elsif ($field_value eq '4') { | ||||||||||||||||||||||||||||||||||||||||||
| 1498 | 0 | $self->{mac04} = $current_mac; | |||||||||||||||||||||||||||||||||||||||||
| 1499 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1500 | elsif ($field_value eq 'iLO') { | ||||||||||||||||||||||||||||||||||||||||||
| 1501 | 0 | $self->{macilo} = $current_mac; | |||||||||||||||||||||||||||||||||||||||||
| 1502 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1503 | |||||||||||||||||||||||||||||||||||||||||||
| 1504 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1505 | |||||||||||||||||||||||||||||||||||||||||||
| 1506 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1507 | |||||||||||||||||||||||||||||||||||||||||||
| 1508 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1509 | |||||||||||||||||||||||||||||||||||||||||||
| 1510 | 0 | ($self->{mac01} = lc($self->{mac01})) =~ tr/-/:/; | |||||||||||||||||||||||||||||||||||||||||
| 1511 | 0 | ($self->{mac02} = lc($self->{mac02})) =~ tr/-/:/; | |||||||||||||||||||||||||||||||||||||||||
| 1512 | 0 | ($self->{mac03} = lc($self->{mac03})) =~ tr/-/:/; | |||||||||||||||||||||||||||||||||||||||||
| 1513 | 0 | ($self->{mac04} = lc($self->{mac04})) =~ tr/-/:/; | |||||||||||||||||||||||||||||||||||||||||
| 1514 | 0 | ($self->{macilo} = lc($self->{macilo})) =~ tr/-/:/; | |||||||||||||||||||||||||||||||||||||||||
| 1515 | |||||||||||||||||||||||||||||||||||||||||||
| 1516 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1517 | |||||||||||||||||||||||||||||||||||||||||||
| 1518 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1519 | |||||||||||||||||||||||||||||||||||||||||||
| 1520 | |||||||||||||||||||||||||||||||||||||||||||
| 1521 | 0 | ▶ | sub _populate_network_settings { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_populate_network_settings: not called CC=5 SCAR=34.0
| |||||||||||||||||||||||||||||||||||||||||||
| 1522 | |||||||||||||||||||||||||||||||||||||||||||
| 1523 | 0 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1524 | |||||||||||||||||||||||||||||||||||||||||||
| 1525 | 0 | my $ilo_command = $self->_generate_cmd('get_network_settings'); | |||||||||||||||||||||||||||||||||||||||||
| 1526 | |||||||||||||||||||||||||||||||||||||||||||
| 1527 | 0 | ▶ | my $response = $self->_send($ilo_command) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1528 | 0 | ▶ | my $xml = $self->_serialize($response) or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1529 | |||||||||||||||||||||||||||||||||||||||||||
| 1530 | 0 | ▶ | if ( my $errmsg = _check_errors($xml) ) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1531 | 0 | $self->error($errmsg); | |||||||||||||||||||||||||||||||||||||||||
| 1532 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1533 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1534 | |||||||||||||||||||||||||||||||||||||||||||
| 1535 | 0 | my @fields = qw( dhcp_dns_server dhcp_gateway dns_name | |||||||||||||||||||||||||||||||||||||||||
| 1536 | dhcp_domain_name ip_address domain_name | ||||||||||||||||||||||||||||||||||||||||||
| 1537 | dhcp_enable subnet_mask gateway_ip_address ); | ||||||||||||||||||||||||||||||||||||||||||
| 1538 | |||||||||||||||||||||||||||||||||||||||||||
| 1539 | 0 | foreach my $field (@fields) { | |||||||||||||||||||||||||||||||||||||||||
| 1540 | |||||||||||||||||||||||||||||||||||||||||||
| 1541 | 0 | $self->{$field} = $xml->{GET_NETWORK_SETTINGS}->{uc($field)}->{VALUE}; | |||||||||||||||||||||||||||||||||||||||||
| 1542 | |||||||||||||||||||||||||||||||||||||||||||
| 1543 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1544 | |||||||||||||||||||||||||||||||||||||||||||
| 1545 | 0 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1546 | |||||||||||||||||||||||||||||||||||||||||||
| 1547 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1548 | |||||||||||||||||||||||||||||||||||||||||||
| 1549 | |||||||||||||||||||||||||||||||||||||||||||
| 1550 | 0 | ▶ | sub _send { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_send: not called CC=8 SCAR=42.8
| |||||||||||||||||||||||||||||||||||||||||||
| 1551 | |||||||||||||||||||||||||||||||||||||||||||
| 1552 | 0 | my ($self, $ilo_command) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1553 | |||||||||||||||||||||||||||||||||||||||||||
| 1554 | 0 | ▶ | my $client = $self->_connect or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1555 | |||||||||||||||||||||||||||||||||||||||||||
| 1556 | 0 | foreach my $line ( split(/\n/, $ilo_command) ) { | |||||||||||||||||||||||||||||||||||||||||
| 1557 | |||||||||||||||||||||||||||||||||||||||||||
| 1558 | 0 | $line =~ s/^\s+//; | |||||||||||||||||||||||||||||||||||||||||
| 1559 | 0 | $line =~ s/\s+$//; | |||||||||||||||||||||||||||||||||||||||||
| 1560 | |||||||||||||||||||||||||||||||||||||||||||
| 1561 | 0 | ▶ | if ($self->_debug > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1562 | 0 | print "'$line'\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1563 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1564 | |||||||||||||||||||||||||||||||||||||||||||
| 1565 | 0 | my $ok = print {$client} $line . "\r\n"; | |||||||||||||||||||||||||||||||||||||||||
| 1566 | |||||||||||||||||||||||||||||||||||||||||||
| 1567 | 0 | ▶ | if (!$ok) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1568 | 0 | $self->error("Error transmitting command to server"); | |||||||||||||||||||||||||||||||||||||||||
| 1569 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1570 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1571 | |||||||||||||||||||||||||||||||||||||||||||
| 1572 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1573 | |||||||||||||||||||||||||||||||||||||||||||
| 1574 | 0 | chomp( my $response = join('', <$client>) ); | |||||||||||||||||||||||||||||||||||||||||
| 1575 | |||||||||||||||||||||||||||||||||||||||||||
| 1576 | # iLO 3 returns a chunked http response | ||||||||||||||||||||||||||||||||||||||||||
| 1577 | # rather than parse it, just filter out the chunking data | ||||||||||||||||||||||||||||||||||||||||||
| 1578 | # janky, but a lightweight solution which works for all iLO versions | ||||||||||||||||||||||||||||||||||||||||||
| 1579 | |||||||||||||||||||||||||||||||||||||||||||
| 1580 | 0 | $response =~ s/[\r\n]+[0-9a-f]{3}[\r\n]+//gs; | |||||||||||||||||||||||||||||||||||||||||
| 1581 | |||||||||||||||||||||||||||||||||||||||||||
| 1582 | 0 | ▶ | $self->_disconnect or die "Internal error: disconnect failed, wtf!"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1583 | |||||||||||||||||||||||||||||||||||||||||||
| 1584 | 0 | ▶ | if (!$response) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1585 | 0 | $self->error("No response received from remote machine"); | |||||||||||||||||||||||||||||||||||||||||
| 1586 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1587 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1588 | |||||||||||||||||||||||||||||||||||||||||||
| 1589 | 0 | ▶ | if ($self->_debug > 0) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1590 | 0 | print Dumper $response; | |||||||||||||||||||||||||||||||||||||||||
| 1591 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1592 | |||||||||||||||||||||||||||||||||||||||||||
| 1593 | 0 | return $response; | |||||||||||||||||||||||||||||||||||||||||
| 1594 | |||||||||||||||||||||||||||||||||||||||||||
| 1595 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1596 | |||||||||||||||||||||||||||||||||||||||||||
| 1597 | |||||||||||||||||||||||||||||||||||||||||||
| 1598 | 15 | ▶ | sub _serialize { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_serialize: called CC=5 SCAR=16.3
| |||||||||||||||||||||||||||||||||||||||||||
| 1599 | |||||||||||||||||||||||||||||||||||||||||||
| 1600 | 15 | my ($self, $data) = @_; | |||||||||||||||||||||||||||||||||||||||||
| 1601 | |||||||||||||||||||||||||||||||||||||||||||
| 1602 | 15 | ▶ | if (!$data) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1603 | 1 | $self->error('Error parsing response: no data received'); | |||||||||||||||||||||||||||||||||||||||||
| 1604 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1605 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1606 | |||||||||||||||||||||||||||||||||||||||||||
| 1607 | # iLO returns multiple XML stanzas, all starting with a standard header. | ||||||||||||||||||||||||||||||||||||||||||
| 1608 | # We first need to break this glob of data into individual XML components, | ||||||||||||||||||||||||||||||||||||||||||
| 1609 | # while ignoring the HTTP header returned by iLO 3. | ||||||||||||||||||||||||||||||||||||||||||
| 1610 | |||||||||||||||||||||||||||||||||||||||||||
| 1611 | 14 | chomp( my @stanzas = grep { !/HTTP\/1.1/ } split(/<\?xml.*?\?>/, $data) ); | |||||||||||||||||||||||||||||||||||||||||
| 1612 | |||||||||||||||||||||||||||||||||||||||||||
| 1613 | # @stanzas now contains a number of valid XML sequences. | ||||||||||||||||||||||||||||||||||||||||||
| 1614 | # All but one is unnecessary; they contain short status messages and | ||||||||||||||||||||||||||||||||||||||||||
| 1615 | # nothing else. So, we want to parse only the longest message. | ||||||||||||||||||||||||||||||||||||||||||
| 1616 | # | ||||||||||||||||||||||||||||||||||||||||||
| 1617 | # NB: The same status codes are also included in the longest stanza. | ||||||||||||||||||||||||||||||||||||||||||
| 1618 | |||||||||||||||||||||||||||||||||||||||||||
| 1619 | 14 | my $longest = ( sort {length($b) <=> length($a)} @stanzas )[0]; | |||||||||||||||||||||||||||||||||||||||||
| 1620 | |||||||||||||||||||||||||||||||||||||||||||
| 1621 | 14 | ▶ | if ($self->_debug > 3) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1622 | 0 | print Dumper $longest; | |||||||||||||||||||||||||||||||||||||||||
| 1623 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1624 | |||||||||||||||||||||||||||||||||||||||||||
| 1625 | # XML::Simple croaks if it can't parse the data properly. | ||||||||||||||||||||||||||||||||||||||||||
| 1626 | # We want to capture any errors and propagate them on our own terms. | ||||||||||||||||||||||||||||||||||||||||||
| 1627 | |||||||||||||||||||||||||||||||||||||||||||
| 1628 | 14 | my $xml; | |||||||||||||||||||||||||||||||||||||||||
| 1629 | |||||||||||||||||||||||||||||||||||||||||||
| 1630 | 14 | eval { $xml = XMLin( $longest, NormaliseSpace => 2 ) }; | |||||||||||||||||||||||||||||||||||||||||
| 1631 | |||||||||||||||||||||||||||||||||||||||||||
| 1632 | 14 | ▶ | if ($EVAL_ERROR) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1633 | 1 | $self->error("Error parsing response: $EVAL_ERROR"); | |||||||||||||||||||||||||||||||||||||||||
| 1634 | 1 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1635 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1636 | |||||||||||||||||||||||||||||||||||||||||||
| 1637 | 13 | ▶ | if ($self->_debug >= 2) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1638 | 0 | print Dumper $xml; | |||||||||||||||||||||||||||||||||||||||||
| 1639 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1640 | |||||||||||||||||||||||||||||||||||||||||||
| 1641 | 13 | return $xml; | |||||||||||||||||||||||||||||||||||||||||
| 1642 | |||||||||||||||||||||||||||||||||||||||||||
| 1643 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1644 | |||||||||||||||||||||||||||||||||||||||||||
| 1645 | |||||||||||||||||||||||||||||||||||||||||||
| 1646 | 12 | ▶ | sub _port_is_valid { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_port_is_valid: called CC=4 SCAR=13.9
| |||||||||||||||||||||||||||||||||||||||||||
| 1647 | |||||||||||||||||||||||||||||||||||||||||||
| 1648 | 12 | my $port = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1649 | |||||||||||||||||||||||||||||||||||||||||||
| 1650 | 12 | ▶ | return unless defined $port && $port =~ /^\d{1,5}$/ && $port <= 65535; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
Condition83%5/6
defined $port and $port =~ /^\d{1,5}$/ and $port <= 65535
defined $port and $port =~ /^\d{1,5}$/
MC/DC66%2/3
defined $port and $port =~ /^\d{1,5}$/ and $port <= 65535
defined $port
$port =~ /^\d{1,5}$/
$port <= 65535
Truth table75%3/4
A and B and C
A= defined $portB= $port =~ /^\d{1,5}$/C= $port <= 65535
| |||||||||||||||||||||||||||||||||||||||||||
| 1651 | |||||||||||||||||||||||||||||||||||||||||||
| 1652 | 8 | return 1; | |||||||||||||||||||||||||||||||||||||||||
| 1653 | |||||||||||||||||||||||||||||||||||||||||||
| 1654 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1655 | |||||||||||||||||||||||||||||||||||||||||||
| 1656 | |||||||||||||||||||||||||||||||||||||||||||
| 1657 | 24 | ▶ | sub _version { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_version: called CC=2 SCAR=7.6
| |||||||||||||||||||||||||||||||||||||||||||
| 1658 | |||||||||||||||||||||||||||||||||||||||||||
| 1659 | 24 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1660 | |||||||||||||||||||||||||||||||||||||||||||
| 1661 | 24 | ▶ | if (@_) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1662 | 0 | $self->{_version} = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1663 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1664 | |||||||||||||||||||||||||||||||||||||||||||
| 1665 | 24 | return $self->{_version}; | |||||||||||||||||||||||||||||||||||||||||
| 1666 | |||||||||||||||||||||||||||||||||||||||||||
| 1667 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1668 | |||||||||||||||||||||||||||||||||||||||||||
| 1669 | |||||||||||||||||||||||||||||||||||||||||||
| 1670 | 12 | ▶ | sub _wrap { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
_wrap: called CC=8 SCAR=27.7
| |||||||||||||||||||||||||||||||||||||||||||
| 1671 | |||||||||||||||||||||||||||||||||||||||||||
| 1672 | 12 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1673 | |||||||||||||||||||||||||||||||||||||||||||
| 1674 | 12 | ▶ | my $body = shift or die "Internal error: no data passed to _wrap()"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1675 | |||||||||||||||||||||||||||||||||||||||||||
| 1676 | 12 | ▶ | my $username = $self->username or croak "Username not set"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1677 | 12 | ▶ | my $password = $self->password or croak "Password not set"; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1678 | |||||||||||||||||||||||||||||||||||||||||||
| 1679 | 12 | ▶ | if (!$self->_version) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1680 | |||||||||||||||||||||||||||||||||||||||||||
| 1681 | 0 | ▶ | my $ilo_version = $self->_detect_version or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1682 | |||||||||||||||||||||||||||||||||||||||||||
| 1683 | 0 | ▶ | print "Detected iLO version $ilo_version\n" if $self->_debug > 2; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1684 | |||||||||||||||||||||||||||||||||||||||||||
| 1685 | 0 | $self->_version($ilo_version); | |||||||||||||||||||||||||||||||||||||||||
| 1686 | |||||||||||||||||||||||||||||||||||||||||||
| 1687 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1688 | |||||||||||||||||||||||||||||||||||||||||||
| 1689 | 12 | my $header = qq| | |||||||||||||||||||||||||||||||||||||||||
| 1690 | <?xml version="1.0"?> | ||||||||||||||||||||||||||||||||||||||||||
| 1691 | <LOCFG version="2.21"> | ||||||||||||||||||||||||||||||||||||||||||
| 1692 | <RIBCL VERSION="2.0"> | ||||||||||||||||||||||||||||||||||||||||||
| 1693 | <LOGIN USER_LOGIN="$username" PASSWORD="$password"> | ||||||||||||||||||||||||||||||||||||||||||
| 1694 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 1695 | |||||||||||||||||||||||||||||||||||||||||||
| 1696 | 12 | my $footer = qq| | |||||||||||||||||||||||||||||||||||||||||
| 1697 | </LOGIN> | ||||||||||||||||||||||||||||||||||||||||||
| 1698 | </RIBCL> | ||||||||||||||||||||||||||||||||||||||||||
| 1699 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 1700 | |||||||||||||||||||||||||||||||||||||||||||
| 1701 | 12 | my $ilo_command = $header . $body . $footer; | |||||||||||||||||||||||||||||||||||||||||
| 1702 | |||||||||||||||||||||||||||||||||||||||||||
| 1703 | 12 | ▶ | if ($self->_version == 3) { | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1704 | |||||||||||||||||||||||||||||||||||||||||||
| 1705 | 0 | my $command_length = $self->_length($ilo_command); | |||||||||||||||||||||||||||||||||||||||||
| 1706 | |||||||||||||||||||||||||||||||||||||||||||
| 1707 | 0 | my $http_header = qq| | |||||||||||||||||||||||||||||||||||||||||
| 1708 | POST /ribcl HTTP/1.1 | ||||||||||||||||||||||||||||||||||||||||||
| 1709 | HOST: localhost | ||||||||||||||||||||||||||||||||||||||||||
| 1710 | Content-length: $command_length | ||||||||||||||||||||||||||||||||||||||||||
| 1711 | Connection: Close | ||||||||||||||||||||||||||||||||||||||||||
| 1712 | |||||||||||||||||||||||||||||||||||||||||||
| 1713 | |; | ||||||||||||||||||||||||||||||||||||||||||
| 1714 | |||||||||||||||||||||||||||||||||||||||||||
| 1715 | 0 | $ilo_command = $http_header . $ilo_command; | |||||||||||||||||||||||||||||||||||||||||
| 1716 | |||||||||||||||||||||||||||||||||||||||||||
| 1717 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1718 | |||||||||||||||||||||||||||||||||||||||||||
| 1719 | 12 | return $ilo_command; | |||||||||||||||||||||||||||||||||||||||||
| 1720 | |||||||||||||||||||||||||||||||||||||||||||
| 1721 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1722 | |||||||||||||||||||||||||||||||||||||||||||
| 1723 | |||||||||||||||||||||||||||||||||||||||||||
| 1724 | 7 | ▶ | sub DESTROY { | ||||||||||||||||||||||||||||||||||||||||
|
Subroutine
DESTROY: called CC=2 SCAR=9.2
| |||||||||||||||||||||||||||||||||||||||||||
| 1725 | |||||||||||||||||||||||||||||||||||||||||||
| 1726 | 7 | my $self = shift; | |||||||||||||||||||||||||||||||||||||||||
| 1727 | |||||||||||||||||||||||||||||||||||||||||||
| 1728 | 7 | ▶ | my $client = $self->{_client} or return; | ||||||||||||||||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||||||||||||||||
| 1729 | 0 | $client->close; | |||||||||||||||||||||||||||||||||||||||||
| 1730 | |||||||||||||||||||||||||||||||||||||||||||
| 1731 | 0 | return; | |||||||||||||||||||||||||||||||||||||||||
| 1732 | } | ||||||||||||||||||||||||||||||||||||||||||
| 1733 | |||||||||||||||||||||||||||||||||||||||||||
| 1734 | 7 | 1; | |||||||||||||||||||||||||||||||||||||||||
| 1735 | __END__ | ||||||||||||||||||||||||||||||||||||||||||