Ascend Archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: (ASCEND) Remote Update over SNMP



-----BEGIN PGP SIGNED MESSAGE-----

On Sat, 13 Jun 1998, Stephane Lux wrote:

> Date: Sat, 13 Jun 1998 19:06:37 +0200
> From: Stephane Lux <chipie@pironet.de>
> To: Ascend-Users Mailinglist <ascend-users@bungi.com>
> Subject: (ASCEND) Remote Update over SNMP
> 
> Hello again,
> 
> is it possible, to upload a config or even a software release to a
> ascend pipeline with snmp? If yes, how can I do that and which
> softwareversion (5.x, 6.x) do I need?
> 
	Below I'm includin a lil perl script interface I wrote for
restoring max configs and could be adapted to to code as well... Just
change the sysConfigTftpCmd value in load() to 6 to do tloadcode rather
than 2 to do a trestore...
	Sincerely,
	Jeremy T. Bouse
	System Administrator

<<<< Begin maxrest script
#!/usr/bin/perl

my $DEBUG = 0;
my %CMDS = ( "save(1)", 1, "restore(2)", 2, "loadcode(6)", 6 );
my %STATUS = ( "ok(1)", 1, "access(3)", 3 );
my $enterprise = ".iso.org.dod.internet.private.enterprises";
$enterprise .= ".ascend.systemStatusGroup.sysConfigTftp";
my $TftpHost = "<TFTP host IP>";
my $TftpPort = 69;
my $SNMPget = "/usr/bin/snmpget";
my $SNMPset = "/usr/bin/snmpset";
my $command = ""; my $trash;

my ($host, $comm, $file) = @ARGV;

&usage unless defined($host);
&usage unless defined($comm);
&usage unless defined($file);

print "Checking SNMP values\n";
&check;
print "Loading file\n";
&load;
exit 1;

##################################################################
sub load {
  $command = "$enterprise";
  $command .= ".sysConfigTftpPort.0 i $TftpPort ";
  $command .= "$enterprise";
  $command .= ".sysConfigTftpHostAddr.0 a $TftpHost ";
  $command .= "$enterprise";
  $command .= ".sysConfigTftpFilename.0 s $file ";
  $command .= "$enterprise";
  $command .= ".sysConfigTftpCmd.0 i 2";
  @result = `$SNMPset $host $comm $command`;
  if ($DEBUG) {
    print "@result\n";
  }
 
  sleep (50);
  $command = "$enterprise";
  $command .= ".sysConfigTftpStatus.0";
  $status = `$SNMPget $host $comm $command`;
  chop ($status);
  ($trash, $status) = split (/ = /, $status);
  # .sysConfigTftpStatus.0 = ok(1)

  if ($STATUS{$status} eq 1) {
    print "Config file restored Successful...\n";
  } else {
    print "Error on restore: $status\n";
    exit 0;
  }
}

##################################################################
sub check {
  $command = "$enterprise";
  $command .= ".sysConfigTftpCmd.0 ";
  $command .= "$enterprise";
  $command .= ".sysConfigTftpHostAddr.0 ";
  $command .= "$enterprise";
  $command .= ".sysConfigTftpFilename.0 ";
  $command .= "$enterprise";
  $command .= ".sysConfigTftpPort.0 ";
  $command .= "$enterprise";
  $command .= ".sysConfigTftpStatus.0 ";
  @result = `$SNMPget $host $comm $command`;
  if ($DEBUG) {
    print "@result";
  }
}

##################################################################
sub usage {
  print <<EOF;
Usage: maxrest <hostname> <community> <filename>
   ex: maxrest localhost public test.cfg

EOF
  exit 0;
} 
>>>>> End script

    Jeremy T. Bouse - SouthNet TeleComm Services, Inc - www.STSI.net
  PGP ID/Fingerprint: 1024/E83D9AE5/4ACC03F098D78198  19D0593E50E597E9
 Public PGP key available by sending email with 'send pgpkey' in subject
     undrgrid@UnderGrid.net - NIC Whois: JB5713 - undrgrid@STSI.net
          /earth is 98% full ... please delete anyone you can.


-----BEGIN PGP SIGNATURE-----
Version: 2.6.3a
Charset: noconv

iQCVAwUBNYM7mOak13roPZrlAQGY0wP/aPoVnp+6TRyejOqntW7C059rKZoDoloz
JELVefs5b4hk037rOK4+NcFYmF1AXSCPcgjt5LZb96a6lrS3IRtrid+urpy0VdHQ
QA4y3Dj9Ctb7rrzfnRcuGVJDljMGtjg1rBnUGy4FOh2LkNcyLIkh0ZBpmReQIlVZ
xvNtngp1E3Q=
=m1X0
-----END PGP SIGNATURE-----

++ Ascend Users Mailing List ++
To unsubscribe:	send unsubscribe to ascend-users-request@bungi.com
To get FAQ'd:	<http://www.nealis.net/ascend/faq>


References: