8 my $poll_frequency = 60;
10 # Send a command to switch and return the data recvied from the switch
12 my ($cmd, $conn) = @_;
14 # Send the command and get data from switch
15 my @data = $conn->cmd($cmd);
17 foreach my $line (@data) {
18 # Remove escape-7 sequence
19 $line =~ s/\x1b\x37//g;
28 my $time = POSIX::ctime(time);
30 printf STDERR "[%s] %s\n", $time, $msg;
34 die("Error in arguments passed\n".
35 "./ssendfile.pl addr configfile\n");
38 my $conn = nms::switch_connect($ARGV[0]);
39 if (!defined($conn)) {
40 die("Could not connect to switch.\n");
43 open(CONFIG, $ARGV[1]);
47 print "Executing: `$cmd`\n";
48 # if ($cmd =~ /ip ifconfig swif0 (\d{1-3}\.\d{1-3}\.\d{1-3}\.\d{1-3})/) {
49 # print "New ip: $1\n";
50 # $conn->cmd( String => $cmd,
52 # $conn = nms::switch_connect($1);
53 # if (!defined($conn)) {
54 # die "Could not connect to new ip: $1\n";
58 my @data = switch_exec($cmd, $conn);
59 foreach my $line (@data) {
60 $line =~ s/[\r\n]+//g;