X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=clients%2Fzyxelng.pl;h=3d029967e80903ec2b6d41c73e1bb019c356eb24;hb=7c8aa8e94cc75dd4952b969c79cb45ddf3dd7985;hp=e46f0fb66993ca9b810175227439b6b5037f0937;hpb=31834d967b81557a519d32c881d0fc42fe11dfee;p=nms diff --git a/clients/zyxelng.pl b/clients/zyxelng.pl index e46f0fb..3d02996 100644 --- a/clients/zyxelng.pl +++ b/clients/zyxelng.pl @@ -5,13 +5,89 @@ use strict; use lib '../include'; -use nms; -use ios; +use Data::Dumper; +use nms qw(switch_connect switch_exec); +#use ios; -my $t = nms::ios_connect('62.148.36.12', 'c', 'c', 'c'); +#my $t = nms::ios_connect('62.148.36.12', 'c', 'c', 'c'); -print STDERR "No such network 192.168.1.0\n" if nms::ios_getroute($t, "192.168.1.0") == 0; +#print STDERR "No such network 192.168.1.0\n" if nms::ios_getroute($t, "192.168.1.0") == 0; -nms::ios_close($t); +#nms::ios_close($t); + +if ($#ARGV < 1) { + die "Not enough arguments to zyxelng.pl $#ARGV"; +} + +my $oldip = $ARGV[0]; +my $newip = $ARGV[1]; +#$switchname = $ARGV[2]; + +my $one = 0; + +my $switchip; +#$switchip = "87.76.250.226" if $one; +#$switchip = "192.168.2.150" if $one; +#$switchip = "192.168.1.1" unless $one; +$switchip = $oldip; +my $switch = switch_connect($switchip) + or die "Could not connect to $switchip"; + +my $cmds1 = <close(); + +#print "Reconnecting... "; +##$switchip = "192.168.1.1" if $one; +##$switchip = "192.168.2.150" unless $one; +#$switchip = $newip; +#autoflush STDOUT 1; +#print "Connecting to: $switchip...\n"; +#my $i = 1; +#while(1) { +# $switch = switch_connect($switchip); +# +# #print (defined($switch)? $switch : "foo") ." <---- switch\n"; +# if (defined($switch) || $switch) { +# last; +# } +# printf("Waited $i seconds...\r"); +# $i++; +# sleep 1; +#} +#print "\n"; + +#print $switch."\n"; +#$cmd = "sys sw vlan1q svlan cpu 248"; +#print "Sending '$cmd'\n"; +#print "XXX: No we did not..."; +#print Dumper($switch->cmd("ip ifconfig")); +#print Dumper($switch->cmd("ip route status")); +#switch_exec($cmd, $switch, 1);