# # Copyright (c) 2001-2012 NetApp, Inc., All Rights Reserved # Any use, modification, or distribution is prohibited # without prior written consent from NetApp, Inc. # ## @summary SystemNodeServiceProcessorNetwork ComponentState Module (auto-generated by CGT) ## @author dl-nacl-dev@netapp.com,skotagir@netapp.com ## @status shared ## @pod here =head1 NAME NACL::CS::SystemNodeServiceProcessorNetwork =head1 DESCRIPTION C is a derived class of L. It represents the state of an ONTAP SystemNodeServiceProcessorNetwork. A related class is L, which represents access to an ONTAP SystemNodeServiceProcessorNetwork. =head1 ATTRIBUTES The individual pieces of data that are part of the state of the SystemNodeServiceProcessorNetwork element are the attributes of the SystemNodeServiceProcessorNetwork 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<< address_type >> Address Type Filled in for CMode CLI/ZAPI,7Mode CLI (Required for Cmode ZAPI) Maps to: 7M CLI : address_type CM ZAPI: $address_type =item C<< link_status >> Link Status, possible value(s) are up,down,admin-down Filled in for CMode CLI/ZAPI, 7Mode CLI Maps to: 7M CLI : link_status CM ZAPI: $link_status =item C<< router_ip >> Router assigned IP Address Filled in for CMode CLI,7Mode CLI Maps to: 7M CLI : router_ip =item C<< gateway >> Gateway IP Address Filled in for CMode CLI/ZAPI,7Mode CLI Maps to: 7M CLI : gateway CM ZAPI: $gateway =item C<< status >> Status, possible value(s) are online,offline,sp_daemon_offline,node_offline,degraded,rebooting Filled in for CMode CLI/ZAPI,7Mode CLI Maps to: 7M CLI : status CM ZAPI: $status =item C<< prefix_length >> Prefix Length Filled in for CMode CLI,7Mode CLI Maps to: 7M CLI : prefix-length =item C<< node >> Node Filled in for CMode CLI/ZAPI,7Mode CLI (Required for CMode ZAPI) For CMode ZAPI , If node name is not specified, then it will be picked up from AA the hostname attribute of hostrec object present in the command_interface passed. Maps to: 7M CLI : -node (Programmatic name: 'nodename') CM ZAPI: $node =item C<< link_local_ip >> Link local IP Address Filled in for CMode CLI,7Mode CLI Maps to: 7M CLI : link_local_ip =item C<< ip_address >> IP Address Filled in for CMode CLI/ZAPI,7Mode CLI Maps to: 7M CLI : ip_address CM ZAPI: $address =item C<< netmask >> Netmask Filled in for CMode CLI/ZAPI,7Mode CLI Maps to: 7M CLI : netmask CM ZAPI: $netmask =item C<< mac >> MAC Address Filled in for CMode CLI/ZAPI,7Mode CLI Maps to: 7M CLI : mac CM ZAPI: $mac_address =item C<< enable >> Interface Enabled, possible value(s) are true,false Filled in for CMode CLI/ZAPI,7Mode CLI Maps to: CM ZAPI: $enable =item C<< gateway_mac >> Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: $gateway_address =item C<< arp_interval >> Filled in for CMode CLI/ZAPI. Maps to: CM ZAPI: $interval =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: 7M CLI : type CM ZAPI: $type =item C<< dhcp >> DHCP Status, possible value(s) are v4,none Filled in for CMode CLI/ZAPI,7Mode CLI Maps to: 7M CLI : dhcp CM ZAPI: $dhcp_status =item C<< role >> Filled in for CMode CLI/ZAPI Maps to: CM ZAPI: $role =item C<< time_last_updated >> Time Last Updated Filled in for CMode CLI. =back =cut package NACL::CS::SystemNodeServiceProcessorNetwork; 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::CS::_Mixins::SystemNodeServiceProcessor qw(:all); use base 'NACL::CS::ComponentState::ONTAP'; use Class::MethodMaker [ scalar => 'address_type', scalar => 'link_status', scalar => 'router_ip', scalar => 'gateway', scalar => 'status', scalar => 'prefix_length', scalar => 'node', scalar => 'link_local_ip', scalar => 'ip_address', scalar => 'netmask', scalar => 'mac', scalar => 'enable', scalar => 'gateway_mac', scalar => 'arp_interval', scalar => 'type', scalar => 'dhcp', scalar => 'role', scalar => 'time_last_updated', ]; =head1 METHODS =head2 fetch my $SystemNodeServiceProcessorNetwork_state = NACL::CS::SystemNodeServiceProcessorNetwork->fetch(command_interface => $ci, ...); my @SystemNodeServiceProcessorNetwork_states = NACL::CS::SystemNodeServiceProcessorNetwork->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 or 7Mode CLI APISet. Invokes "system node service-processor network show" command for 7Mode CLI. Invokes "service-processor-network-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, @args) = @_; my @state_objs = $pkg->SUPER::fetch( @args, 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 network(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_network_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 %opts = validate @args, $pkg->_fetch_backend_validate_spec(); my $apiset = $opts{apiset}; my @state_objs; my @requested_fields = @{$opts{requested_fields}}; my (%desired_attributes_hash, %sp_options); foreach (@requested_fields) { $desired_attributes_hash{$_} = 1; } if (keys %desired_attributes_hash) { $sp_options{'desired-attributes'} = {%desired_attributes_hash}; } my $args = $pkg->_hash_copy( source => $opts{filter}, copy => [qw(node address-type)], ); my $network_response = $apiset->service_processor_network_get(%$args, %sp_options); my $network_output = $network_response->get_parsed_output(); my $network_output_info = defined($network_output->[0]{'attributes'}[0] {'service-processor-network-info'}) ? $network_output->[0]{'attributes'}[0] {'service-processor-network-info'} : $network_output->[0]{'attributes'}[0]{'service-processor-network'}; foreach my $row (@$network_output_info) { my $obj = $pkg->new(command_interface => $opts{command_interface}); $obj->_set_fields(row => $row); push @state_objs, $obj; } ## end foreach my $row ( @{ $network_output... $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_network_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 status ip_address dhcp address_type enable type link_status mac netmask prefix_length router_ip link_local_ip gateway) ], map => { 'network_mask_ipv4_only' => 'netmask', 'prefix_lengthipv6_only' => 'prefix_length', 'mac_address' => 'mac', 'network_gateway' => 'gateway', 'link_state' => 'link_status', }, ); 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;