summaryrefslogtreecommitdiffstats
path: root/INF.pm
blob: 20b41b8f07371f00add2653bca4a1ae870f259c4 (plain)
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
package INF;
use INF::APC;
use INF::DSRx020;
use INF::ILO;
use INF::ILO2;
use INF::SuperMicro;
use INF::Cyclades;


#$infs = [
#    {
#        host      => 'ms2.foo.com',
#	 nice_name => 'ms2',
#        community => 'write_cty_name',
#        inf_type  => 'apc'
#    },
#    {
#        host      => 'kvm2.foo.com',
#	 nice_name => 'kvm2',
#        user      => 'Admin',
#        password  => 'password',
#        inf_type  => 'dsr'
#    },
#];

require 'INF/INF.pm';

sub new ($;$) {
    my ( $class, $inf ) = @_;

    if ( $inf->{inf_type} eq 'dsr' ) {
        return INF::DSRx020->new($inf);
    }
    elsif ( $inf->{inf_type} eq 'apc' ) {
        return INF::APC->new($inf);
    } elsif ( $inf->{inf_type} eq 'supermicro' ) {
        return INF::SuperMicro->new($inf);
    } elsif ( $inf->{inf_type} eq 'ilo' ) {
        return INF::ILO->new($inf);
    } elsif ( $inf->{inf_type} eq 'ilo2' ) {
        return INF::ILO2->new($inf);
    } elsif ( $inf->{inf_type} eq 'cyclades' ) {
        return INF::Cyclades->new($inf);
    }
    else {
        return undef;
    }
}

1;