File: Test.pm

package info (click to toggle)
libnetapp-perl 1.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 384 kB
  • ctags: 226
  • sloc: perl: 4,539; makefile: 15
file content (67 lines) | stat: -rw-r--r-- 1,820 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#
# $Id: $
#

package NetApp::Test;

use strict;
use warnings;
use English;

select(STDERR); $| = 1;
select(STDOUT); $| = 1;

# The author has to set these ssh options to workaround the lack of a
# centrally managed known_hosts file:
#
# export NETAPP_SSH_COMMAND = \
#	ssh -o StrictHostKeyChecking=no -o LogLevel=ERROR
#
# If your ssh environment required additional default options, specify
# them here.  Do NOT specify the identify file in these arguments.
my $ssh_command = [ split( /\s+/, $ENV{NETAPP_SSH_COMMAND} || 'ssh' ) ];

# This variable specifies the default ssh identify file to use
my $ssh_identity = $ENV{NETAPP_SSH_IDENTITY};

our @filer_args	= ();

# Specify a list of NAS filers to use for the test suite. This
# variable should a whitespace-separated list of colon-separated
# entries.  Each entry should be of the form:
#
#	$hostname:$protocol:$extra
#
# where $hostname is the hostname of the filer, $protocol is either
# 'ssh' or 'telnet', and $extra is either the ssh identity file
# (optional) or the telnet password.  If the ssh_identity file is NOT
# specified in these entries, then a default must have been specified
# above.  If the protocol is not given, then it defaults to 'ssh'.

if ( $ENV{NETAPP_TEST_FILERS} ) {

    foreach my $entry ( split /\s+/, $ENV{NETAPP_TEST_FILERS} ) {

        my ($hostname,$protocol,$extra) = split /:/, $entry, 3;

        $protocol		||= 'ssh';

        my $filer_arg	= {
            hostname	=> $hostname,
            protocol	=> $protocol,
        };

        if ( $protocol eq 'ssh' ) {
            $filer_arg->{ssh_command} = $ssh_command;
            $filer_arg->{ssh_identity} = $extra || $ssh_identity;
        } elsif ( $extra ) {
            $filer_arg->{telnet_password} = $extra;
        }

        push @filer_args, $filer_arg;

    }

}

1;