From 6168e18047573025878802a9657e5319ba6301c3 Mon Sep 17 00:00:00 2001 From: Jed Reynolds Date: Tue, 16 Jan 2018 22:59:11 -0800 Subject: [PATCH] ping: WIP collecting port info --- lf_generic_ping.pl | 51 +++++++++++++++++++++++++--------------------- 1 file changed, 28 insertions(+), 23 deletions(-) diff --git a/lf_generic_ping.pl b/lf_generic_ping.pl index 7ad4e353..b35f4ff9 100755 --- a/lf_generic_ping.pl +++ b/lf_generic_ping.pl @@ -26,14 +26,14 @@ use lib '/home/lanforge/scripts'; use List::Util qw(first); use LANforge::Endpoint; use LANforge::Port; -use LANforge::Utils; +use LANforge::Utils qw(fmt_cmd); use Net::Telnet (); our $dest_ip_addr = "0.0.0.0"; our $log_cli = "unset"; # use ENV{'LOG_CLI'} our $usage = qq( Usage: - ./$0 --mgr {host-name | IP} +$0 --mgr {host-name | IP} --mgr_port {ip port} --resource {resource} --dest {destination IP} @@ -86,27 +86,6 @@ GetOptions if ($help) { print($usage) && exit(0); } - -if (defined $::radio && $radio ne "") { - # collect all stations on that radio - # add them to @interfaces -} - -if (defined $::pattern && $pattern ne "") { - # collect all stations on that resource - # add them to @interfaces -} - - -if (@interfaces < 1) { - print STDERR "One or more interfaces required.\n"; - print $usage; - exit(1); -} - -print "Using these interfaces: \n"; -print " ".join(",", @interfaces)."\n"; - if ($::quiet eq "0") { $::quiet = "no"; } @@ -152,4 +131,30 @@ else { $utils->log_cli("# $0 ".`date "+%Y-%m-%d %H:%M:%S"`); +our @port_info = $::utils->doAsyncCmd($utils->fmt_cmd("nc_show_ports", 1, $::resource, "ALL")); + +foreach my $line (@port_info) { + print "$line\n"; +} + +if (defined $::radio && $radio ne "") { + # collect all stations on that radio + # add them to @interfaces +} + +if (defined $::pattern && $pattern ne "") { + # collect all stations on that resource + # add them to @interfaces +} + +if (@interfaces < 1) { + print STDERR "One or more interfaces required.\n"; + print $usage; + exit(1); +} + +print "Using these interfaces: \n"; +print " ".join(",", @interfaces)."\n"; + + #