# TSTcell.def: Tests Connection to Exadata Cells # $Id: TSTcell.def,v 1.4 2009/05/19 14:52:57 mschenke Exp $ # ARCS: $Header: /u02/webapps/workbench/cvs/RDA_4/src/scripting/lib/modules/TSTcell.def,v 1.4 2009/05/19 14:52:57 mschenke Exp $ # # Change History # 20090119 MSC Extend the tests. =head1 NAME TSTcell - Tests Connection to Exadata Cells =head1 DESCRIPTION This test module tests the connection to Exadata cells and can be used in two ways: =over 3 =item a) Runs interactively. It requests the user to input the user for connecting to the remote cells. -vT cell =item b) Runs from the command line. You can also specifiy the user for connecting to the remote cells, using the following syntax: -vT cell:userid =back It extracts the cell access information from file F. The collection of cell information requires that a F authentication agent is configured. Otherwise F will require the passord for every connection. This test module executes following tests: =cut echo tput('bold'),'Processing Exadata Cell tool ...',tput('off') if getSetting('TST_ARGS') var $USERID = last else {call requestSetting('TSTcell') var $USERID = getSetting('CELL_USERID') } =pod - Tests which commands are available from the PATH. =cut echo "\012Command Availability:" loop $cmd ('rcp','remsh','rsh','scp','ssh','ssh-add','ssh-agent') echo sprintf(' %-12s %s',$cmd,nvl(findCommand($cmd),'(Not found)')) =pod - Checks the existence and the permissions of F<.ssh> directory. - Checks the existence and the permissions of a DSA or RSA key file. =cut if isUnix() {var $dir = catDir(getEnv('HOME'),'.ssh') echo "\012.ssh Directory:" if testDir('e',$dir) {var @sta = getStat($dir) echo ' File permissions of .ssh directory are: ',\ sprintf('%03o',expr('&',$sta[2],511)) if expr('&',$sta[2],63) echo ' Other users than the owner have permissions on it' var $flg = true if testFile('f',catFile($dir,'id_dsa')) {var @sta = getStat(lastFile()) if expr('&',$sta[2],7) echo ' DSA key file is ignored due to invalid permissions: ',\ sprintf('%03o',expr('&',$sta[2],511)) else var $flg= false } if testFile('s',catFile($dir,'id_rsa')) {var @sta = getStat(lastFile()) if expr('&',$sta[2],7) echo ' RSA key file is ignored due to invalid permissions: ',\ sprintf('%03o',expr('&',$sta[2],511)) else var $flg= false } if $flg echo ' No DSA or RSA key file found' } else echo ' ',$dir,' directory does not exist' } =pod - Checks the access to F. =cut if !loadFile('/etc/oracle/cell/network-config/cellip.ora') {echo "\012Unable to get the cell information from file \ /etc/oracle/cell/network-config/cellip.ora" return } =pod - Tests if an authentication agent is configured. When possible, it checks if identities have been added. =cut macro chk_env {var ($key,$flg) = @arg if getEnv($key,$flg) {import $TTL echo $TTL,' ',$key,'=',last var $TTL = undef } } macro chk_ident {echo "\012Agent identities:" loop $lin (command('ssh-add -l')) echo $lin } var $TTL = "\012Check if an authentication agent is running\012" call chk_env('SSH_AGENT_PID') call chk_env('SSH_AUTH_SOCK') var $agt = $TTL if !$agt call chk_ident() echo "\012The cell information collection requires that a ssh authentication \ agent is set up. Otherwise every ssh connection will ask for the \ password.\012" =pod - Checks the connectivity. =cut call setTempSetting('REMOTE_CELL_USER',$USERID) call setTempSetting('REMOTE_CELL_SSH_COMMAND','ssh') call setTempSetting('REMOTE_CELL_SSH_OPTIONS','-Cnq -o ConnectTimeout=30') loop $lin (grepLastFile('^cell=\".*?\"')) {if match($lin,'^cell=\"(.*?)\"') {var ($cel) = last call setTempSetting('REMOTE_CELL_HOSTNAME',$cel) if rexec('CELL','env',true) echo 'Connection error connecting to cell ',$cel else echo 'Successful connection to cell ',$cel } } =begin credits =over 10 =item RDA 4.16: Jean-Marc Gaudron. =back =end credits =head1 COPYRIGHT NOTICE Copyright (c) 2002-2009, Oracle. All rights reserved. =head1 TRADEMARK NOTICE Oracle, JD Edwards, PeopleSoft, and Siebel are registered trademarks of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. =cut