#!/usr/bin/perl -I/opt/SUNWstade/lib
#
# install and turn-on rasagent
#
use System;
use TO;

System->set_home("/opt/SUNWstade");

my $HOME = "/opt/SUNWstade";

system("$HOME/bin/ras_install -m -S N -c");

my($renv, $devs, $hosts,$notifs) = PDM::ConfigFile->read();

$renv->{customer} = $renv->{site_name}    = $renv->{site_city}  = "NETCONNECT";
$renv->{site_zip} = $renv->{site_contact} = $renv->{site_email} = "NETCONNECT";
$renv->{site_country}             = "NETCONNECT";

$renv->{frequency}                = 60;
$renv->{'pro.netconnect.active'}  = 'Y';
$renv->{'pro.netconnect.maxsize'} = 2000;
$renv->{'auto_discover'}          = "auto";

#$renv->{categories} = "a5k|6120|t3|host|3310|3510|switch2|switch|";

PDM::ConfigFile->write($renv, $devs, $hosts, $notifs);

system("$HOME/bin/ras_admin discover_a5k -h local");

system("$HOME/bin/ras_admin discover_3510 -h local");

# discover devices from /etc/deviceIP.conf

system("$HOME/bin/ras_admin discover_deviceIP -h local");

my $hostname = System->hostname();
TO->clearTopo($hostname);
my $to = TO->readTopo($hostname,1);
TO->copyTopo($hostname,"MERGE-MASTER");


system("$HOME/bin/ras_admin agent -s");


