# Copyright (c) 2013 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # # ## @summary Lsdev ComponentState Module ## @author Vishwanath.Rawat@netapp.com, dl-nacl-dev@netapp.com ## @status shared ## @pod here ################################################################################ =head1 NAME NACL::CS::Client::Lsdev =head1 DESCRIPTION C is a derived class of L. It represents the state of Lsdev element. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the Lsdev element are the individual attributes of the Lsdev ComponentState =over =item C<< "location" >> Filled in for AIX CLI. Maps to: AIX CLI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object. =item C<< "status" >> Filled in for AIX CLI. Maps to: AIX CLI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object. =item C<< "name" >> AIX CLI: Maps to: AIX and Solaris CLI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object. =item C<< "description" >> Filled in for AIX CLI. Maps to: AIX CLI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object. =item C<< "type" >> Filled in for AIX CLI. Maps to: AIX CLI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object. =item C<< "subclass" >> AIX CLI: Maps to: AIX and Solaris CLI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object. =item C<< "class" >> Filled in for AIX CLI. Maps to: AIX CLI: For 'filter': Applicable, Filtering will be done by Components. For 'requested_fields', Not applicable, but the field will be populated in the CS object. =back =cut ################### # Package package NACL::CS::Client::Lsdev; ################### # Everytime use strict; use warnings; ################### # Module includes use Params::Validate qw (validate SCALAR); use NACL::ComponentUtils qw (_optional_scalars); use NATE::Log qw(log_global); my $Log = log_global(); my $may_enter = $Log->may_enter(); my $may_exit = $Log->may_exit(); use base 'NACL::CS::ComponentState::Client'; use NACL::Exceptions::NoElementsFound qw(:try); use NACL::APISet::Exceptions::CommandFailedException; use Class::MethodMaker [ # AIX components scalar => "location", scalar => "status", scalar => "name", scalar => "description", scalar => "class", scalar => "subclass", scalar => "type", ]; =head1 METHODS =head2 fetch my $iscsi_state = NACL::CS::Client::Lsdev->fetch(command_interface=>$ci); see L Supports AIX CLI. Invokes "lscfg" command for AIX CLI. =back =cut sub fetch { $Log->enter(); my ($pkg, @opts) = @_; my @state_objs = $pkg->SUPER::fetch( @opts, choices => [ { method => "_fetch_aix_cli", interface => "CLI", set => 'AIX', }, ], exception_text => 'No requested modules found', ); $Log->exit(); return wantarray ? @state_objs : $state_objs[0]; } sub _fetch_aix_cli { $Log->enter(); my ($pkg, @opts) = @_; my %opts = validate @opts, $pkg->_fetch_backend_validate_spec(); my $apiset = delete $opts{apiset}; my $command_interface = delete $opts{command_interface}; my %copy_filter = %{ $opts{filter} }; my @copy_requested_fields = @{ $opts{requested_fields} }; my $deleted_filter = $pkg->_remove_relational_regex_filters( filter => \%copy_filter, requested_fields => \@copy_requested_fields ); my ( @state_objs, $resp ); my $parsed_output = []; if (exists $opts{filter}->{parent}) { $resp = $apiset->lsdev(parent => $opts{filter}->{parent}); } else { $resp = $apiset->lsdev(); } $parsed_output = $resp->get_parsed_output(); foreach my $row (@$parsed_output) { my $obj = $pkg->new( command_interface => $command_interface ); $obj->_set_fields( row => $row ); push @state_objs, $obj; } $Log->exit(); return @state_objs; } sub _extra_filter_fields { $Log->enter(); $Log->exit(); return [qw(parent)]; } 1;