# $Id$ # # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary VserverIscsiSession ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com, pkj@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::VserverIscsiSession =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP VserverIscsiSession. A related class is L, which represents access to an ONTAP VserverIscsiSession. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the VserverIscsiSession element are the attributes of the VserverIscsiSession ComponentState. =over =item C<< "interfaceNames" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "cmdWindowSize" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "immDataEnabled" >> Filled in for CMode CLI. =item C<< "initAlias" >> Filled in for 7Mode CLI. Maps to: 7Mode 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<< "isid" >> Filled in for CMode CLI/ZAPI, 7Mode CLI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode 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<< "maxBurstLen" >> Filled in for CMode CLI. =item C<< "remoteIps" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "remoteIpPorts" >> Filled in for CMode CLI. =item C<< "dataDigestEnableds" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "commandTypes" >> Filled in for CMode CLI. =item C<< "dataPduInOrder" >> Filled in for CMode CLI. =item C<< "hdrDigestEnableds" >> Filled in for CMode CLI. =item C<< "initiatorMrdsl" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "commandStates" >> Filled in for CMode CLI. =item C<< "firstBurstLen" >> Filled in for CMode CLI. =item C<< "recvWindowSizes" >> Filled in for CMode CLI. =item C<< "localIpPorts" >> Filled in for CMode CLI. =item C<< "commandZapiStates" >> Filled in for CMode CLI. =item C<< "maxConnections" >> Filled in for CMode CLI. =item C<< "node" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "errRecoveryLevel" >> Filled in for CMode CLI. =item C<< "targetMrdsl" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "commandSubIds" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "maxOutstandingR2t" >> Filled in for CMode CLI. =item C<< "connectionIds" >> Filled in for CMode CLI. =item C<< "tpgTag" >> Filled in for CMode CLI. =item C<< "commandIds" >> Filled in for CMode CLI. =item C<< "sessionType" >> Filled in for CMode CLI. =item C<< "defTime2Wait" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "initNodename" >> Filled in for CMode CLI/ZAPI, 7Mode CLI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode 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<< "vserver" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "defTime2Retain" >> Filled in for CMode CLI. =item C<< "authMethods" >> Filled in for CMode CLI. =item C<< "tsih" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value 7Mode 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<< "commandZapiTypes" >> Filled in for CMode CLI. =item C<< "localIps" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "dataSeqInOrder" >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< "initialR2tEnabled" >> =item C<< "initiator_information" >> Filled in for 7Mode CLI. Maps to: 7Mode 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<< command_zapi_types >> Filled in for CMode CLI. =item C<< target_mrdsl >> Filled in for CMode CLI. =item C<< default_time_to_wait >> Filled in for CMode CLI. =item C<< header_digest_enableds >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< max_connections >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< tpgroup >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< authentication_methods >> (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $authentication_methods = $obj->authentication_methods(); # $authentication_methods contains a reference to the array of values my @authentication_methods = $obj->authentication_methods(); # @authentication_methods contains the array of values Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< command_zapi_states >> Filled in for CMode CLI. =item C<< initiator_name >> Filled in for CMode CLI. =item C<< local_addresses >> (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $local_addresses = $obj->local_addresses(); # $local_addresses contains a reference to the array of values my @local_addresses = $obj->local_addresses(); # @local_addresses contains the array of values Filled in for CMode CLI. =item C<< first_burst_length >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< lif >> Filled in for CMode CLI. =item C<< remote_ip_ports >> (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $remote_ip_ports = $obj->remote_ip_ports(); # $remote_ip_ports contains a reference to the array of values my @remote_ip_ports = $obj->remote_ip_ports(); # @remote_ip_ports contains the array of values Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< command_ids >> Filled in for CMode CLI. =item C<< command_states >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< max_burst_length >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< command_types >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< initiator_alias >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< immediate_data_enabled >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< tpgroup_tag >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< local_ip_ports >> (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $local_ip_ports = $obj->local_ip_ports(); # $local_ip_ports contains a reference to the array of values my @local_ip_ports = $obj->local_ip_ports(); # @local_ip_ports contains the array of values Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< error_recovery_level >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< connection_ids >> (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $connection_ids = $obj->connection_ids(); # $connection_ids contains a reference to the array of values my @connection_ids = $obj->connection_ids(); # @connection_ids contains the array of values Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< remote_addresses >> (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $remote_addresses = $obj->remote_addresses(); # $remote_addresses contains a reference to the array of values my @remote_addresses = $obj->remote_addresses(); # @remote_addresses contains the array of values Filled in for CMode CLI. =item C<< initial_r2t_enabled >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< session_type >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< data_pdu_in_order >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< initiator_mrdsl >> Filled in for CMode CLI =item C<< rcv_window_sizes >> (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $rcv_window_sizes = $obj->rcv_window_sizes(); # $rcv_window_sizes contains a reference to the array of values my @rcv_window_sizes = $obj->rcv_window_sizes(); # @rcv_window_sizes contains the array of values Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< data_sequence_in_order >> Filled in for CMode CLI. =item C<< default_time_to_retain >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< command_sub_ids >> (Array) Note that for array fields, the accessor method can be invoked in either scalar or list context. my $command_sub_ids = $obj->command_sub_ids(); # $command_sub_ids contains a reference to the array of values my @command_sub_ids = $obj->command_sub_ids(); # @command_sub_ids contains the array of values Filled in for CMode CLI. =item C<< max_outstanding_r2t >> Filled in for CMode CLI/ZAPI. Maps to: CMode ZAPI: For "requested_fields", "filter" and Output mapping: $value =item C<< cmd_window_size >> Filled in for CMode CLI. =item C<< max_ios_per_session >> Filled in for CMode CLI. =item C<< target_name >> *Target Name Filled in for CMode CLI. =item C<< target_alias >> *Target Alias Filled in for CMode CLI. =item C<< vserver_uuid >> Vserver UUID Filled in for CMode CLI. =back =cut package NACL::CS::VserverIscsiSession; 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 Data::Dumper; use NACL::Exceptions::NoElementsFound qw(:try); use base 'NACL::CS::ComponentState::ONTAP'; use Class::MethodMaker [ scalar => 'interfaceNames', scalar => 'cmdWindowSize', scalar => 'immDataEnabled', scalar => 'initAlias', scalar => 'isid', scalar => 'maxBurstLen', scalar => 'remoteIps', scalar => 'remoteIpPorts', scalar => 'dataDigestEnableds', scalar => 'commandTypes', scalar => 'dataPduInOrder', scalar => 'hdrDigestEnableds', scalar => 'initiatorMrdsl', scalar => 'commandStates', scalar => 'firstBurstLen', scalar => 'recvWindowSizes', scalar => 'localIpPorts', scalar => 'commandZapiStates', scalar => 'maxConnections', scalar => 'node', scalar => 'errRecoveryLevel', scalar => 'targetMrdsl', scalar => 'commandSubIds', scalar => 'maxOutstandingR2t', scalar => 'connectionIds', scalar => 'tpgTag', scalar => 'commandIds', scalar => 'sessionType', scalar => 'defTime2Wait', scalar => 'initNodename', scalar => 'vserver', scalar => 'defTime2Retain', scalar => 'authMethods', scalar => 'tsih', scalar => 'commandZapiTypes', scalar => 'localIps', scalar => 'dataSeqInOrder', scalar => 'initialR2tEnabled', array => 'initiator_information', scalar => 'command_zapi_types', scalar => 'target_mrdsl', scalar => 'default_time_to_wait', scalar => 'header_digest_enableds', scalar => 'max_connections', scalar => 'tpgroup', array => 'authentication_methods', scalar => 'command_zapi_states', scalar => 'initiator_name', array => 'local_addresses', scalar => 'first_burst_length', scalar => 'lif', array => 'remote_ip_ports', scalar => 'command_ids', scalar => 'command_states', scalar => 'data_digest_enableds', scalar => 'max_burst_length', scalar => 'command_types', scalar => 'initiator_alias', scalar => 'immediate_data_enabled', scalar => 'tpgroup_tag', array => 'local_ip_ports', scalar => 'error_recovery_level', array => 'connection_ids', array => 'remote_addresses', scalar => 'initial_r2t_enabled', scalar => 'session_type', scalar => 'data_pdu_in_order', scalar => 'initiator_mrdsl', array => 'rcv_window_sizes', scalar => 'data_sequence_in_order', scalar => 'default_time_to_retain', array => 'command_sub_ids', scalar => 'max_outstanding_r2t', scalar => 'cmd_window_size', scalar => 'max_ios_per_session', scalar => 'target_name', scalar => 'target_alias', scalar => 'vserver_uuid', ]; =head1 METHODS =head2 fetch my $VserverIscsiSession_state = NACL::CS::VserverIscsiSession->fetch(command_interface => $ci, ...); my @VserverIscsiSession_states = NACL::CS::VserverIscsiSession->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. Supports CMode CLI/ZAPI, 7Mode CLI. Invokes "iscsi-session-get-iter" API for CMode ZAPI. Invokes "iscsi session show" command for 7Mode CLI. =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( @_, show_cmd => 'vserver iscsi session show', choices => [ { method => '_fetch_cmode_cli', interface => 'CLI', set => 'CMode', }, { method => '_fetch_cmode_zapi', interface => 'ZAPI', set => 'CMode', }, { method => '_fetch_7mode_cli', interface => 'CLI', set => '7Mode', }, ], exception_text => 'No matching vserver iscsi session(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 => 'vserver_iscsi_session_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 = shift; my @state_objs = $pkg->SUPER::_fetch_cmode_zapi( @_, copy => [ qw ( first_burst_length initial_r2t_enabled data_pdu_in_order default_time_to_retain error_recovery_level immediate_data_enabled isid max_connections max_outstanding_r2t node session_type tpgroup_tag max_burst_length vserver) ], map => { 'cmdWindowSize' => 'cmd-window-size', 'dataSeqInOrder' => 'data-sequence-in-order', 'initiator_alias' => 'initiator-aliasname', 'defTime2Wait' => 'default-time-to-wait', 'initNodename' => 'initiator-nodename', 'tpgroup' => 'tpgroup-name', 'tsih' => 'target-session-id', 'connection_ids' => ['iscsi-session-connection-list-entries', 'connection-id'], 'header_digest_enableds' => [ 'iscsi-session-connection-list-entries', 'header-digest-enabled' ], 'data_digest_enableds' => [ 'iscsi-session-connection-list-entries', 'header-digest-enabled' ], 'interfaceNames' => ['iscsi-session-connection-list-entries', 'interface-name'], 'initiatorMrdsl' => [ 'iscsi-session-connection-list-entries', 'initiator-max-rcv-data-segment-length' ], 'local_ip_ports' => ['iscsi-session-connection-list-entries', 'local-ip-port'], 'localIps' => ['iscsi-session-connection-list-entries', 'local-ip-address'], 'rcv_window_sizes' => ['iscsi-session-connection-list-entries', 'rcv-window-size'], 'authentication_methods' => [ 'iscsi-session-connection-list-entries', 'authentication-method' ], 'remoteIps' => [ 'iscsi-session-connection-list-entries', 'remote-ip-address' ], 'remote_ip_ports' => ['iscsi-session-connection-list-entries', 'remote-ip-port'], 'targetMrdsl' => [ 'iscsi-session-connection-list-entries', 'target-max-rcv-data-segment-length' ], 'command_states' => ['iscsi-sesssion-cmd-list-entries', 'cmd-state'], 'commandSubIds' => ['iscsi-sesssion-cmd-list-entries', 'cmd-sub-id'], 'command_types' => ['iscsi-sesssion-cmd-list-entries', 'cmd-type'], }, api => 'iscsi_session_get_iter' ); $Log->exit() if $may_exit; return @state_objs; } ## end sub _fetch_cmode_zapi sub _fetch_7mode_cli { my $pkg = shift; my %opts = validate @_, $pkg->_fetch_backend_validate_spec(); my %api_opts; my @state_objs; my %cmd_opts; 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 $filter = \%copy_filter; my $requested_fields = \@copy_requested_fields; my $apiset = delete $opts{apiset}; my $command_interface = delete $opts{command_interface}; my $response = $apiset->iscsi_session_show(%cmd_opts); my $output = $response->get_parsed_output(); my $i = 0; foreach my $list_output (@$output) { for ($i = 0; $i < @$output; $i++) { if ($output->[$i]->{'status'} eq "offlined_by_user/system") { $output->[$i]->{'status'} = "down"; } else { $output->[$i]->{'status'} = "up"; } } ## end for ( $i = 0; $i < @$output... my $target = $pkg->_hash_copy( source => $list_output, copy => [qw(initiator_information)], map => {'session' => 'tsih',}, ); my $state_info = $target->{'initiator_information'}->[0]; my $state_settings = $pkg->_hash_copy( source => $state_info, copy => [qw(isid)], map => { 'initiator_name' => 'initNodename', 'initiator_alias' => 'initAlias', }, ); my %final_attributes = (%$target, %$state_settings); my $obj = $pkg->new(command_interface => $command_interface); $obj->_set_fields(row => \%final_attributes); push @state_objs, $obj; } ## end foreach my $list_output (@$output) return @state_objs; } ## end sub _fetch_7mode_cli 1;