#!/usr/bin/perl
# ARG IP


require '/usr/lib/kwartz/control/sharelib.pl';
require 'hostlib.pl';    #load host management library
require 'deploy.pl';

my $IP=shift @ARGV;

sub PulseGetHostMacByIp {
    my $AddrIP=$_[0];
    foreach $host (keys %hostlist) {
        return $hostlist{$host}{'macaddress'} 
            if ($hostlist{$host}{'ipaddress'} eq $AddrIP);
        return $hostlist{$host}{'macaddress2'} 
            if ($hostlist{$host}{'ipaddress2'} eq $AddrIP);
    }
    return undef;
}


my $hostmac=&PulseGetHostMacByIp($IP);
if ( $hostmac ) {
	print "$hostmac";
	exit 0;
} else {
    print "_Undefined_";
}
exit 1;
