# $Id$ # # Copyright (c) 2001-2014 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary SystemServiceProcessor Component Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com ## @status shared ## @pod here =head1 NAME NACL::C::SystemServiceProcessor =head1 DESCRIPTION C is a derived class of L. It represents access to an ONTAP SystemServiceProcessor. A related class is L, which represents the past state of an ONTAP SystemServiceProcessor. =head1 ATTRIBUTES =head2 command_interface See L =head2 node =cut package NACL::C::SystemServiceProcessor; use strict; use warnings; use NACL::CS::SystemServiceProcessor; use NACL::ComponentUtils qw (_optional_scalars Dumper); use base 'NACL::C::Component::ONTAP'; use Params::Validate qw(validate_with SCALAR ARRAYREF SCALARREF); use NATE::Log qw(log_global); use NACL::CS::ComponentState::ZapiSkip qw(make_zapi_skip); use NACL::CS::ComponentState::ZapiArray qw(make_zapi_array); =head1 METHODS =head2 new my $SystemServiceProcessor = NACL::C::SystemServiceProcessor->new( command_interface => $ci, 'node' => $node, ); Return a new SystemServiceProcessor component object with the given attributes. =cut use Class::MethodMaker [scalar => 'node',]; my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); =head2 find my $SystemServiceProcessor_obj = NACL::C::SystemServiceProcessor->find(command_interface => $ci, ...); my @SystemServiceProcessor_objs = NACL::C::SystemServiceProcessor->find(command_interface => $ci, ...); (Class method) A constructor of sorts, which discovers which elements are present (by interacting with the given command interface). In an array context it creates a component object for each present element and returns them. In a scalar context it creates a component object for just one element. This method is generally not implemented in individual components. The base class (L provides an implementation. See for a more detailed description along with explanation of all the options accepted. Uses a CMode CLI/ZAPI APISet. =head2 state my SystemServiceProcessor_state = $SystemServiceProcessor_obj->state(); (Instance method) Fetch the current state of the element associated with this component, and return a Component State object corresponding to this component (calling this on NACL::C::SystemServiceProcessor would return a NACL::CS::SystemServiceProcessor object) This method is generally not implemented in individual components. The base class (L provides an implementation. See for a more detailed description along with explanation of all the options accepted. Uses a CMode CLI/ZAPI APISet. =cut =head2 reboot_sp NACL::C::SystemServiceProcessor->reboot_sp( command_interface => $ci, 'node' => $node, ...); or $SystemServiceProcessor_obj->reboot_sp(...); (Class or instance method) This method is used to reboot the Service Processor on a node. Uses CMode CLI/ZAPI . Invokes service-processor-reboot for CMode Zapi non-iter =over =item Options =over =item C<< command_interface => $command_interface >> (Required for class method, Not Applicable for instance method) See L =item C<< apiset_must => $ruleset >> (Optional) See L =item C<< apiset_should => $ruleset >> (Optional) See L =item C<< 'node' => $node >> (Required for class method, Not Applicable for instance method) Node possible value(s) are, ,local Applicable for CMode CLI/ZAPI, non-iter. =item C<< 'image' => $string >> Image to Boot with After Reboot possible value(s) are, primary,backup Applicable for CMode CLI/ZAPI, non-iter. Mapping for non-iter: firmware-image =item C<< '*' >> This method takes all other options supported by "system service processor reboot sp" command in ONTAP =item C<< other_options >> This method takes other common options described in L =back =back =over =item Exceptions =over =item C In general, Component methods propagate the exceptions thrown from underlying API layer and the details of those exceptions are described in the L of user guide. =back =back =cut sub reboot_sp { $Log->enter() if $may_enter; my ($pkg_or_obj, @args) = @_; $pkg_or_obj->_frontend_log_debug_opts(@args); my %opts = $pkg_or_obj->_common_validate_with( params => \@args, additional_spec => { _optional_scalars( qw( image ) ), }, api => 'system_service_processor_reboot_sp', ); $pkg_or_obj->call_on_apiset( %opts, choices => [ { method => '_reboot_sp_cmode_cli', interface => 'CLI', set => 'CMode', zapi_type => 'none', }, { method => '_reboot_sp_cmode_zapi_non_iter', interface => 'ZAPI', set => 'CMode', zapi_type => 'non-iter', }, ], frontend => 'NACL::C::SystemServiceProcessor::reboot_sp', ); $Log->exit() if $may_exit; } sub _reboot_sp_cmode_cli { $Log->enter() if $may_enter; my ($pkg_or_obj, @opts) = @_; $pkg_or_obj->_base_backend_cmode_cli(@opts, api => 'system_service_processor_reboot_sp',); $Log->exit() if $may_exit; } sub _reboot_sp_cmode_zapi_non_iter { $Log->enter() if $may_enter; my ($pkg_or_obj, @opts) = @_; my $copy = [qw(node)]; my $map = {'image' => 'firmware-image',}; $pkg_or_obj->_base_backend_cmode_zapi( @opts, api => 'service-processor-reboot', copy => $copy, map => $map, ); $Log->exit() if $may_exit; } =head2 sp_shell NACL::C::SystemServiceProcessor->sp_shell( command_interface => $ci, 'node' => $node, ...); or $SystemServiceProcessor_obj->sp_shell(...); (Class or instance method) This method is used to switch to command shell of the SP of given node. Uses CMode CLI/ZAPI . Invokes service-processor-sp-shell for CMode Zapi non-iter =over =item Options =over =item C<< command_interface => $command_interface >> (Required for class method, Not Applicable for instance method) See L =item C<< apiset_must => $ruleset >> (Optional) See L =item C<< apiset_should => $ruleset >> (Optional) See L =item C<< 'node' => $node >> (Required for class method, Not Applicable for instance method) Node possible value(s) are, ,local Applicable for CMode CLI/ZAPI, non-iter. =item C<< '*' >> This method takes all other options supported by "system service processor sp shell" command in ONTAP =item C<< other_options >> This method takes other common options described in L =back =back =over =item Exceptions =over =item C In general, Component methods propagate the exceptions thrown from underlying API layer and the details of those exceptions are described in the L of user guide. =back =back =cut sub sp_shell { $Log->enter() if $may_enter; my ($pkg_or_obj, @args) = @_; $pkg_or_obj->_frontend_log_debug_opts(@args); my %opts = $pkg_or_obj->_common_validate_with( params => \@args, api => 'system_service_processor_sp_shell', ); $pkg_or_obj->call_on_apiset( %opts, choices => [ { method => '_sp_shell_cmode_cli', interface => 'CLI', set => 'CMode', zapi_type => 'none', }, { method => '_sp_shell_cmode_zapi_non_iter', interface => 'ZAPI', set => 'CMode', zapi_type => 'non-iter', }, ], frontend => 'NACL::C::SystemServiceProcessor::sp_shell', ); $Log->exit() if $may_exit; } sub _sp_shell_cmode_cli { $Log->enter() if $may_enter; my ($pkg_or_obj, %opts) = @_; my $password = $opts{command_interface}->hostrec()->default_password() || 'netapp1!'; my $prompts_answers = ['Are you sure you want to continue connecting.*' => 'yes', '.*password:' => $password,]; $pkg_or_obj->_base_backend_cmode_cli(%opts, api => 'system_service_processor_sp_shell', additional_args => {'connectrec-match_table' => $prompts_answers} ); $Log->exit() if $may_exit; } sub _sp_shell_cmode_zapi_non_iter { $Log->enter() if $may_enter; my ($pkg_or_obj, @opts) = @_; my $copy = [qw(node)]; $pkg_or_obj->_base_backend_cmode_zapi( @opts, api => 'service-processor-sp-shell', copy => $copy, ); $Log->exit() if $may_exit; } __PACKAGE__->_load_event_class(); sub _primary_keys_validate_spec { return ('node' => {type => SCALAR},); } 1;