# $Id$ # # Copyright (c) 2001-2011 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary SystemNode ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::SystemNode =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP SystemNode. A related class is L, which represents access to an ONTAP SystemNode. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the SystemNode element are the attributes of the SystemNode ComponentState. =over =item C<< "model" >> =item C<< "assettag" >> =item C<< "uuid" >> =item C<< "node" >> =item C<< "product_version" >> =item C<< "env_failed_power_supply_message" >> =item C<< "eligibility" >> =item C<< "env_failed_fan_count" >> =item C<< "message_list" >> (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $message_list = $obj->message_list(); # $message_list contains a reference to the array of values my @message_list = $obj->message_list(); # @message_list contains the array of values =item C<< "uptime" >> =item C<< "cpu_up_time" >> =item C<< "env_over_temperature" >> =item C<< "systemid" >> =item C<< "owner" >> =item C<< "nvram_battery_status" >> =item C<< "nvramid" >> =item C<< "location" >> =item C<< "env_failed_fan_message" >> =item C<< "env_failed_power_supply_count" >> =item C<< "cpu_busy_time" >> =item C<< "health" >> =item C<< "epsilon" >> =item C<< "serialnumber" >> =item C<< "cpu_fw_rel" >> =item C<< "vendor" >> =item C<< "uuid_str" >> =item C<< max_aggr_size >> Filled in for CMode CLI. =item C<< max_vol_size >> Filled in for CMode CLI. =item C<< max_node_vvols >> Filled in for CMode CLI. =item C<< env_over_temp_snmp >> Filled in for CMode CLI. =item C<< vmhost_uuid >> UUID of the hypervisor Filled in for CMode CLI. =item C<< vmhost_hypervisor >> Hypervisor Version Filled in for CMode CLI. =item C<< vm_coredisk_file_name >> Hypervisor file name of virtual machine coredump disk Filled in for CMode CLI. =item C<< vmhost_cpu_core_count >> Number of CPU cores of the hypervisor machine Filled in for CMode CLI. =item C<< vm_coredisk_area_name >> Hypervisor storage area of virtual machine coredump disk Filled in for CMode CLI. =item C<< vm_logdisk_file_name >> Hypervisor file name of virtual machine nvram disk Filled in for CMode CLI. =item C<< vmhost_bios_version >> BIOS version of the hypervisor machine Filled in for CMode CLI. =item C<< vmhost_bios_release_date >> BIOS release date of the hypervisor machine Filled in for CMode CLI. =item C<< vm_bootdisk_area_name >> Hypervisor storage area of virtual machine boot disk Filled in for CMode CLI. =item C<< vmhost_cpu_thread_count >> Number of CPU threads of the hypervisor machine Filled in for CMode CLI. =item C<< vmhost_memory >> Physical memory (in GiB) in physical host Filled in for CMode CLI. =item C<< vm_bootdisk_file_name >> Hypervisor file name of virtual machine boot disk Filled in for CMode CLI. =item C<< vmhost_cpu_clock_rate >> CPU speed of the hypervisor machine (in mHz) Filled in for CMode CLI. =item C<< vmhost_cpu_socket_count >> Number of CPU sockets of the hypervisor machine Filled in for CMode CLI. =item C<< vmhost_name >> Hostname of the hypervisor Filled in for CMode CLI. =item C<< vm_logdisk_area_name >> Hypervisor storage area of virtual machine nvram disk Filled in for CMode CLI. =item C<< vmhost_model >> Hardware model Filled in for CMode CLI. =item C<< vmhost_hardware_vendor >> Hardware vendor Filled in for CMode CLI. =back =cut package NACL::CS::SystemNode; use strict; use warnings; use Params::Validate qw(validate); use NACL::ComponentUtils qw(_dump_one); use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use NACL::Exceptions::NoElementsFound qw(:try); use base 'NACL::CS::ComponentState::ONTAP'; use Class::MethodMaker [ scalar => 'model', scalar => 'assettag', scalar => 'uuid', scalar => 'node', scalar => 'product_version', scalar => 'env_failed_power_supply_message', scalar => 'eligibility', scalar => 'env_failed_fan_count', array => 'message_list', scalar => 'uptime', scalar => 'cpu_up_time', scalar => 'env_over_temperature', scalar => 'systemid', scalar => 'owner', scalar => 'nvram_battery_status', scalar => 'nvramid', scalar => 'location', scalar => 'env_failed_fan_message', scalar => 'env_failed_power_supply_count', scalar => 'cpu_busy_time', scalar => 'health', scalar => 'epsilon', scalar => 'serialnumber', scalar => 'cpu_fw_rel', scalar => 'vendor', scalar => 'uuid_str', scalar => 'max_aggr_size', scalar => 'max_vol_size', scalar => 'max_node_vvols', scalar => 'env_over_temp_snmp', scalar => 'vmhost_uuid', scalar => 'vmhost_hypervisor', scalar => 'vm_coredisk_file_name', scalar => 'vmhost_cpu_core_count', scalar => 'vm_coredisk_area_name', scalar => 'vm_logdisk_file_name', scalar => 'vmhost_bios_version', scalar => 'vmhost_bios_release_date', scalar => 'vm_bootdisk_area_name', scalar => 'vmhost_cpu_thread_count', scalar => 'vmhost_memory', scalar => 'vm_bootdisk_file_name', scalar => 'vmhost_cpu_clock_rate', scalar => 'vmhost_cpu_socket_count', scalar => 'vmhost_name', scalar => 'vm_logdisk_area_name', scalar => 'vmhost_model', scalar => 'vmhost_hardware_vendor', scalar => 'is_all_flash_optimized', ]; sub isa { $Log->enter() if $may_enter; my ($pkg_or_obj, $kind) = @_; my $isa = $pkg_or_obj->_build_isa( kind => $kind, alias => 'NACL::CS::Node' ); $Log->exit() if $may_exit; return $isa; } =head1 METHODS =head2 fetch my $SystemNode_state = NACL::CS::SystemNode->fetch(command_interface => $ci, ...); my @SystemNode_states = NACL::CS::SystemNode->fetch(command_interface => $ci, ...); (Class method) Discovers which elements are present and returns their state in ComponentState objects. Called in scalar context it returns only one state object, in list context it returns all state objects. See L for a more detailed description along with a complete explanation of the options it accepts. =over =item Exceptions =over =item C When there are no elements matching the query specified or elements of that type doesn't exist, then this exception will be thrown. =back =back =cut sub fetch { $Log->enter() if $may_enter; my $pkg = shift; my @state_objs = $pkg->SUPER::fetch( @_, choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode', }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode', }, ], exception_text => 'No matching system node(s) found', show_cmd => 'system node show', ); $Log->exit() if $may_exit; return wantarray ? @state_objs : $state_objs[0]; } ## end sub fetch sub _fetch_cmode_cli { $Log->enter() if $may_enter; my ($pkg, %opts) = @_; my @state_objs; try { @state_objs = $pkg->SUPER::_fetch_cmode_cli(%opts, api => 'system_node_show', ); } catch NACL::APISet::Exceptions::InvalidParamValueException with { my $exception = shift; $Log->debug("InvalidParamValueException caught. Error:\n" . $exception->text()); }; $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_cli sub _fetch_cmode_zapi { my $pkg = shift; my @states = $pkg->SUPER::_fetch_cmode_zapi( @_, api => "system_node_get_iter", copy => [ qw(node env-failed-power-supply-count env-failed-fan-count env-failed-power-supply-message env-failed-fan-message env-over-temperature nvram-battery-status product-version is-all-flash-optimized) ], map => { "assettag" => ['node-asset-tag'], "model" => ['node-model'], "nvramid" => ['node-nvram-id'], "uptime" => ['node-uptime'], "vendor" => ['node-vendor'], "owner" => ['node-owner'], "location" => ['node-location'], "serialnumber" => ['node-serial-number'], "systemid" => ['node-system-id'], "uuid" => ['node-uuid'], "cpu_busy_time" => ['cpu-busytime'], "cpu_fw_rel" => ['cpu-firmware-release'], "epsilon" => ['is-epsilon-node'], "health" => ['is-node-healthy'], "max_aggr_size" => ['maximum-aggregate-size'], "max_node_vvols" => ['maximum-number-of-volumes'], "max_vol_size" => ['maximum-volume-size'], "eligibility" => ['is-node-cluster-eligible'], }, ); foreach my $state (@states) { foreach my $key (%$state) { if (ref($state->{$key}) eq "HASH" && keys(%{$state->{$key}}) == 0) { $state->{$key} = '""'; } } ## end foreach my $key (%$state) } ## end foreach my $state (@states) return @states; } ## end sub _fetch_cmode_zapi 1;