# MCnetn.ctl:215: Collects Network Device Driver Information # $Id: MCnetn.ctl,v 1.4 2013/10/30 07:18:25 RDA Exp $ # ARCS: $Header: /home/cvs/cvs/RDA_8/src/scripting/lib/collect/EXPLORER/MCnetn.ctl,v 1.4 2013/10/30 07:18:25 RDA Exp $ # # Change History # 20130610 MSC Improve validation. =head1 NAME EXPLORER:MCnetn - Collects Network Device Driver Information =head1 DESCRIPTION This module collects information about the network device drivers. =cut use Mrc use Buffer # Initialization var $VALIDATE = true keep $VALIDATE section begin var $ERR = '---## Associated Errors' var $TOC = '%TOC%' var $TOP = '[[#Top][Back to top]]' run EXPLORER:XPLRlib('ndd') #------------------------------------------------------------------------------ # XPLR_ndd section #------------------------------------------------------------------------------ section XPLR_ndd # Validate the execution context if !${B_GLOBAL:true} return call log_run('Processing NETN sections ...') # Define the capture macro macro capture_results {var ($rpt,$wrk) = @arg import @out while ?$wrk->get_line() {var $lin = chomp(last) write {$rpt} $lin call push(@out,$lin) } } =head2 netn_svc - Network Service Configuration Gathers network service configuration using the following commands: =over 2 =item o C =item o C =back =cut debug ' Inside NETN collection, gathering network services information' report netn_svc title '---+!! Network Services' title $TOC var $flg = expr('>=',get_osv(),10) loop $svc ('ip','tcp','udp','icmp','arp',cond($flg,'sctp',list())) {var $rpt = concat('netinfo/ndd/',$svc,'.out') # Collect and capture the parameter list var @out = () call collectCommand({nam=>concat('netinfo/ndd/',$svc,'.list'),\ out=>{blk=>true,flt=>true,idx=>true,fct=>'capture_results'},\ err=>{blk=>true,flt=>true,hdr=>$ERR,rpt=>${CUR.O_REPORT}}\ },concat('/usr/sbin/ndd /dev/',$svc,' \?')) # Treat all parameters prefix write '---+ ',uc($svc),' Service Settings' call addBlock('E','T',$rpt) call writeComment('Configuration service: ',$svc,\ "\012-------------------------") loop $lin (@out) {var ($par,$mod) = split('\s*\(',$lin,2) next compare('eq',$par,'?') call addBlock('E','T',$rpt) call writeComment($lin) if or(not(match($mod,'read')),\ match($mod,'^no'),\ and($flg,match($par,':ip.*_forwarding'))) {call addBlock('E','T',$rpt) call writeComment('') } else {# Collect the parameter on its respective file and write it to report prefix write '---++!! ',$lin call collectCommand({nam=>concat('netinfo/ndd/',$svc,'/',$par),\ out=>{blk=>true,flt=>true,idx=>true,dup=>['T',$rpt],rpt=>${CUR.O_REPORT}},\ err=>{blk=>true,flt=>true,hdr=>$ERR,rpt=>${CUR.O_REPORT}}\ },concat('/usr/sbin/ndd /dev/',$svc,' ',quote($par))) } } if hasOutput(true) write $TOP # Collect SCTP debug information if compare('eq',$svc,'sctp') {prefix {write '---+ SCTP Debug' write '---## Using: ',\ encode('echo "::walk sctps |::sctp -a" | /usr/bin/mdb -k') } call collectCommand({nam=>'netinfo/echo_walk_sctps_sctp-a_mdb-k',\ inp=>"::walk sctps |::sctp -a\012",\ out=>{blk=>true,flt=>true,idx=>true,rpt=>${CUR.O_REPORT}},\ err=>{blk=>true,flt=>true,hdr=>$ERR,rpt=>${CUR.O_REPORT}}\ },'/usr/bin/mdb -k') if hasOutput(true) write $TOP } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Network Services]]' =head2 netn_crd - Network Device Drivers Gathers network device driver information using the following commands: =over 2 =item o C =item o C =back =cut debug ' Inside NETN collection, gathering network device driver information' report netn_crd title '---+!! Network Device Drivers' title $TOC # Get unique cards by inspecting interface results var %crd = () loop $ifc (grepCommand('/usr/sbin/ifconfig -au','^([^:]+):.*flags=','1')) {var ($crd,$ins) = match($ifc,'^(.*\D)(\d+)?$') if ?$ins var $crd{$crd,$ins} = 1 } # Collect the information from each network card loop $crd (keys(%crd)) {next !?testFile('c',$drv = concat('/dev/',$crd)) next grepCommand(concat('/usr/sbin/ndd -set ',$drv,' instance 0 2>&1'),\ 'couldn\047t push') loop $ins (keys($crd{$crd},'IA')) {# Determine the corresponding device var $dev = $drv if grepCommand(concat('/usr/sbin/ndd -set ',$dev,' instance ',$ins,' 2>&1'),\ 'operation failed') {var $dev = concat($dev,$ins) next grepCommand(concat('/usr/sbin/ndd -get ',$dev,' \? 2>&1'),\ 'couldn\047t push') } # Collect and capture the parameter list var @out = () call collectCommand({nam=>concat('netinfo/ndd/',$crd,'.',$ins,'/list'),\ out=>{blk=>true,flt=>true,idx=>true,fct=>'capture_results'},\ err=>{blk=>true,flt=>true,hdr=>$ERR,rpt=>${CUR.O_REPORT}}\ },concat('/usr/sbin/ndd ',$dev,' \?')) # Treat all parameters var $rpt = concat('netinfo/ndd/',$crd,'.out') prefix write '---+ ',$dev,' Card Settings' call addBlock('E','T',$rpt) call writeComment('Card Configuration: ',$crd,' instance: ',$ins,\ "\012-----------------------------------------") loop $lin (@out) {var ($par,$mod) = split('\s*\(',trim($lin),2) next compare('eq',$par,'?') call addBlock('E','T',$rpt) call writeComment($lin) if or(not(match($mod,'read')),match($mod,'^no')) {call addBlock('E','T',$rpt) call writeComment('') } else {# Collect the parameter on its respective file and in the report prefix write '---++!! ',$lin call collectCommand({nam=>concat('netinfo/ndd/',$crd,'.',$ins,'/',$par),\ out=>{blk=>true,flt=>true,idx=>true,dup=>['T',$rpt],rpt=>${CUR.O_REPORT}},\ err=>{blk=>true,flt=>true,hdr=>$ERR,rpt=>${CUR.O_REPORT}}\ },concat('/usr/sbin/ndd ',$dev,' ',quote($par))) } } if hasOutput(true) write $TOP } } if isCreated(true) toc '2:[[',getFile(),'][rda_report][Network Device Drivers]]' =head1 SEE ALSO L, L =head1 COPYRIGHT NOTICE Copyright (c) 2002, 2016, Oracle and/or its affiliates. All rights reserved. =head1 TRADEMARK NOTICE Oracle and Java are registered trademarks of Oracle and/or its affiliates. Other names may be trademarks of their respective owners. =cut