# # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary SystemNodeServiceProcessor ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::SystemNodeServiceProcessor =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP SystemNodeServiceProcessor. A related class is L, which represents access to an ONTAP SystemNodeServiceProcessor. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the SystemNodeServiceProcessor element are the attributes of the SystemNodeServiceProcessor ComponentState. Additionally, the command_interface used to obtain the ComponentState object is also an attribute of the object. This makes it easier to obtain the component object corresponding to the CS object, using L. =over =item command_interface The command_interface with which the CS object was obtained. (Available in all CS objects regardless of requested_fields and the mode/interface) =item C<< autosupport_enabled >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: $auto_support_enabled =item C<< gateway >> Filled in for CMode CLI. =item C<< status >> Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $status 7M CLI : status =item C<< node >> Filled in for CMode CLI/ZAPI,7Mode CLI. For CMode ZAPI , If node name is not specified, then it will be picked up from the hostname attribute of hostrec object present in the command_interface passed Maps to: CM ZAPI: $node 7M CLI : -node (Programmatic name: 'nodename') =item C<< autosupport_smtp >> Filled in for CMode CLI. =item C<< uptime >> Filled in for CMode CLI. =item C<< address >> Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI:
@address
7M CLI : address =item C<< netmask >> Filled in for CMode CLI. =item C<< autosupport_from >> Filled in for CMode CLI. =item C<< mac >> Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $mac 7M CLI : mac =item C<< mtu >> Filled in for CMode CLI. =item C<< link >> Filled in for CMode CLI. =item C<< fw_version >> Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $version 7M CLI : fw-version =item C<< name >> Filled in for CMode CLI. =item C<< auto_negotiation >> Filled in for CMode CLI. =item C<< duplex >> Filled in for CMode CLI. =item C<< autosupport_to >> Filled in for CMode CLI. =item C<< arp_interval >> Filled in for CMode CLI. =item C<< dhcp >> Filled in for CMode CLI. =item C<< new_fw_available >> Is New SP Firmware Available, possible value(s) are true,false Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $autoupdate_enabled 7M CLI : new-fw-available =item C<< serial_num >> Serial Number Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $serial_num 7M CLI : serial-num =item C<< autoupdate_enabled >> Is SP Firmware Autoupdate Enabled, possible value(s) are true,false Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $autoupdate_enabled 7M CLI : autoupdate-enabled =item C<< device_id >> Device ID Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $device_id 7M CLI : device-id =item C<< new_fw_version >> New Firmware Version Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $fw_version 7M CLI : new-fw-version =item C<< is_configured >> Is the Service Processor Configured, possible value(s) are true,false Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $is_configured 7M CLI : is_configured =item C<< part_num >> Part Number Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $part_num 7M CLI : part-num =item C<< ipmi_ver >> IPMI Version Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $ipmi_ver 7M CLI : ipmi-ver =item C<< revision >> Revision Filled in for CMode CLI/ZAPI, 7Mode CLI. Maps to: CM ZAPI: $revision 7M CLI : revision =item C<< type >> Type of the Service Processor, possible value(s) are BMC,RLM,SP Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $type =item C<< product_id >> Product ID Filled in for CMode CLI/ZAPI,7Mode CLi. Maps to: CM ZAPI: $product_id 7M CLI : product-id =item C<< man_id >> Manufacturer ID Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $man_id 7M CLI : man-id =item C<< dev_rev >> Device Revision Filled in for CMode CLI/ZAPI,7Mode CLI. Maps to: CM ZAPI: $dev_rev 7M CLI : dev-rev =item C<< ip_configured >> Is SP Network Configured, possible value(s) are true,false Filled in for CMode CLI/ZAPI. =back =cut package NACL::CS::SystemNodeServiceProcessor; use strict; use warnings; use Params::Validate qw(validate); 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 NACL::CS::_Mixins::SystemNodeServiceProcessor qw(:all); use base 'NACL::CS::ComponentState::ONTAP'; use NACL::CS::ComponentState::ZapiSkip qw(make_zapi_skip); use NACL::CS::ComponentState::ZapiArray qw(make_zapi_array); use Class::MethodMaker [ scalar => 'autosupport_enabled', scalar => 'gateway', scalar => 'status', scalar => 'node', scalar => 'autosupport_smtp', scalar => 'uptime', array => 'address', scalar => 'netmask', scalar => 'autosupport_from', scalar => 'mac', scalar => 'mtu', scalar => 'link', scalar => 'fw_version', scalar => 'name', scalar => 'auto_negotiation', scalar => 'duplex', scalar => 'autosupport_to', scalar => 'arp_interval', scalar => 'dhcp', scalar => 'new_fw_available', scalar => 'serial_num', scalar => 'autoupdate_enabled', scalar => 'device_id', scalar => 'new_fw_version', scalar => 'is_configured', scalar => 'part_num', scalar => 'ipmi_ver', scalar => 'revision', scalar => 'type', scalar => 'product_id', scalar => 'man_id', scalar => 'dev_rev', scalar => 'ip_configured', ]; =head1 METHODS =head2 fetch my $SystemNodeServiceProcessor_state = NACL::CS::SystemNodeServiceProcessor->fetch(command_interface => $ci, ...); my @SystemNodeServiceProcessor_states = NACL::CS::SystemNodeServiceProcessor->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. Uses a CMode CLI/ZAPI,7Mode CLI APISet. Invokes "system node service-processor show" command for 7Mode CLI. Invokes "service-processor-config-get" api for CMode ZAPI. =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. =item C When apiset_must choice for interface is provided as 'ZAPI' and if the method is invoked without specifying 'node' in the 'filter' or if the method is invoked with special query characters in the filter, 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_7mode_cli', interface => 'CLI', set => '7Mode' }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode', check => '_fetch_zapi_check', } ], exception_text => 'No matching system node service-processor(s) found' ); $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 = shift; my @state_objs = $pkg->SUPER::_fetch_cmode_cli(@_, api => 'system_node_service_processor_show',); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_cli sub _fetch_cmode_zapi { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my @state_objs = $pkg->SUPER::_fetch_cmode_zapi_non_iter( @args, copy => [ qw(status serial-num node type part-num ) ], map => { 'ip-configured' => 'is-ip-configured', 'fw-version' => 'firmware-version', 'autoupdate-enabled' => 'is-autoupdate-enabled', 'address' => [ make_zapi_array('ip-address'), make_zapi_skip('ip-address'), ], 'mac' => 'mac-address', 'dev-rev' => 'device-revision', }, api => "service-processor-get", primary_keys => [qw( node )], ); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_zapi sub _fetch_7mode_cli { $Log->enter() if $may_enter; my ($pkg, @args) = @_; my %opts = validate @args, $pkg->_fetch_backend_validate_spec(); my $command_interface = delete $opts{command_interface}; my $apiset = delete $opts{apiset}; my %copy_filter = %{$opts{filter}}; my @copy_requested_fields = @{$opts{requested_fields}}; $pkg->_remove_relational_regex_filters( filter => \%copy_filter, requested_fields => \@copy_requested_fields ); my %apiset_opts = (); if (scalar(keys %copy_filter)) { %apiset_opts = %copy_filter; } if (scalar(@copy_requested_fields)) { $apiset_opts{fields} = join(',', @copy_requested_fields); } if (exists $apiset_opts{'node'}) { $apiset_opts{'nodename'} = delete $apiset_opts{'node'}; } my @state_objs; my $response = $apiset->system_node_service_processor_show(%apiset_opts); my $list_output = $response->get_parsed_output(); foreach my $output (@{$list_output}) { my $target = $pkg->_hash_copy( source => $output, copy => [ qw(node type status is_configured address mac fw_version part_num serial_num device_id product_id man_id ipmi_ver dev_rev autoupdate_enabled new_fw_available new_fw_version revision) ], map => { 'serial_number' => 'serial_num', 'type_of_the_service_processor' => 'type', 'type_of_device' => 'type', 'device_revision' => 'dev_rev', 'new_firmware_version' => 'new_fw_version', 'is_sp_firmware_autoupdate_enabled' => 'autoupdate_enabled', 'is_firmware_autoupdate_enabled' => 'autoupdate_enabled', 'ipmi_version' => 'ipmi_ver', 'mac_address' => 'mac', 'manufacturer_id' => 'man_id', 'is_new_sp_firmware_available' => 'new_fw_available', 'firmware_version' => 'fw_version', 'is_the_service_processor_configured' => 'is_configured', 'is_network_configured' => 'is_configured', 'part_number' => 'part_num' }, ); my $obj = $pkg->new(command_interface => $command_interface,); $obj->_set_fields(row => $target); push @state_objs, $obj; } ## end foreach my $output (@$list_output) $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_7mode_cli 1;