Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Designing and Developing Scalable IP Networks.pdf
Скачиваний:
36
Добавлен:
15.03.2015
Размер:
2.95 Mб
Скачать

3.8 TO UPGRADE OR NOT TO UPGRADE

31

Table 3.2 (continued)

Perl script

#

# user is the user id for an account with an SSH public key installed on all devices

$user = guyd

#rprompt is the regular prompt of Juniper routers $rprompt = ">";

#cprompt is the configuration mode prompt of Juniper routers $cprompt = "#";

#HOME is the base directory for this script

$HOME = "/home/guyd/script";

open (HOSTS, "<$HOME/listhosts.txt"); $RDSSH = gensym();

$WRSSH = gensym(); HOST:

while ($hostname = <HOSTS>) {

$pid = open2 ($RDSSH, $WRSSH, "ssh -l $user $hostname"); SSHLINE:

while ($line = <STDOUT>) {

if ($line = /$rprompt/) { print "configure\n" $_;

print "delete protocols mpls traffic-engineering\n" $_; print "commit-and-quit\n" $_;

print "exit\n" $_; last;

} else {

next SSHLINE;

}

}

close ($RDSSH); close ($WRSSH);

print "configured $hostname\n"; next HOST;

}

print "\n\nFinished configuring hosts.\n\n"; close (HOSTS);

3.7.2.3 JUNOScript

JUNOScript is a Juniper Networks proprietary, XML-based configuration and device management API. It can be ‘driven’ using Perl scripts or C compiled programs to create, send, receive and analyse the XML formatted text returned by the router. JUNOScript can use SSH, telnet, or SSL to connect to the routing device and exchange information.

3.8TO UPGRADE OR NOT TO UPGRADE

This decision to upgrade or not is an important one. Upgrading software always brings with it the risk of a new and unforeseen failure mode. However, it is often the only way