# Prompt => '/[^\s\(]+(\([^\(]\)){0,1}[#>]/');
if (!defined($ios)) {
print "Could not connect to $dip";
- return;
+ return 0;
}
$ios->login($nms::config::ios_user, $nms::config::ios_pass);
$ios->enable;
if (ios_getroute($ios, "192.168.1.0") == 1) {
print "Already routed up 192.168.1.0/24\n" ;
- return;
+ return 0;
}
my $zyxeloldip = "192.168.1.1";
print "Waiting for zyxel on $dip:$vlan timed out, wanted to set ip: $newip\n";
print LOG "Could not connect to $switchname\n";
stop_vlan($ios, $vlan);
- return;
+ return 0;
}
last if $p->ping($zyxeloldip);
print "pinging...\n";
$ios->close();
+ return 1;
}
## Collect switch ips
while (<PATCHLIST>) {
print "Verify run....\n";
my ($switch, $distro, $port) = split;
+
+ if ($switch eq "e71-6") {
+ print "There is no e71-6\n";
+ next;
+ }
my ($row, $place, $ipnet, $vlan, $ip, $dip) = switch_info($switch, $distro, $port);
print "Switch: $switch, Distro: $distro, vlan: $vlan\n";
while (1) {
if ($counter > 4) {
print "No answer from $dip:$vlan $ip, trying to route it up\n";
- do_distro($dip, $ip, $vlan, $switch);
+ my $ret = do_distro($dip, $ip, $vlan, $switch);
+ if ($ret == 0) {
+ # No answer from zyxel
+ last;
+ }
my $pid = fork();
if ($pid == 0) {
sleep 100;