10 use nms qw(switch_connect switch_exec);
13 #my $t = nms::ios_connect('62.148.36.12', 'c', 'c', 'c');
15 #print STDERR "No such network 192.168.1.0\n" if nms::ios_getroute($t, "192.168.1.0") == 0;
20 die "Not enough arguments to zyxelng.pl $#ARGV";
25 #$switchname = $ARGV[2];
30 #$switchip = "87.76.250.226" if $one;
31 #$switchip = "192.168.2.150" if $one;
32 #$switchip = "192.168.1.1" unless $one;
34 my $switch = switch_connect($switchip)
35 or die "Could not connect to $switchip";
43 foreach (split(/\n+/, $cmds1)) {
44 print "Sending: '$_'\n";
45 switch_exec($_, $switch);
49 #$cmd = "ip ifconfig swif0 192.168.1.1/24" if $one;
50 #$cmd = "ip ifconfig swif0 192.168.2.150/24" unless $one;
51 $cmd = "ip ifconfig swif0 $newip/30";
53 print "Sending '$cmd'\n";
56 print "Sending ifconfig.. $cmd\n";
57 switch_exec($cmd, $switch);
60 #switch_exec($cmd, $switch, 1);
61 print "Sleeping...\n";
66 #print "Reconnecting... ";
67 ##$switchip = "192.168.1.1" if $one;
68 ##$switchip = "192.168.2.150" unless $one;
71 #print "Connecting to: $switchip...\n";
74 # $switch = switch_connect($switchip);
76 # #print (defined($switch)? $switch : "foo") ." <---- switch\n";
77 # if (defined($switch) || $switch) {
80 # printf("Waited $i seconds...\r");
87 #$cmd = "sys sw vlan1q svlan cpu 248";
88 #print "Sending '$cmd'\n";
89 #print "XXX: No we did not...";
90 #print Dumper($switch->cmd("ip ifconfig"));
91 #print Dumper($switch->cmd("ip route status"));
92 #switch_exec($cmd, $switch, 1);