From 9c3e6908f9e663b48368e011a78804dda9b0c425 Mon Sep 17 00:00:00 2001 From: Owen DeLong Date: Mon, 3 Feb 2025 14:48:44 -0800 Subject: [PATCH] Instrumented Loader.pm use of Ping and Interfaces calls --- switch-configuration/config/scripts/Loader.pm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/switch-configuration/config/scripts/Loader.pm b/switch-configuration/config/scripts/Loader.pm index 27a519e5..cad32c7b 100755 --- a/switch-configuration/config/scripts/Loader.pm +++ b/switch-configuration/config/scripts/Loader.pm @@ -166,15 +166,19 @@ sub new STDERR->autoflush(1); # Turn on autoflush for STDERR get_switchtype("anonymous"); - + + my $ping = Net::Ping->new("icmp"), + print STDERR "Ping OK\n"; + my $interfaces = [ Net::Interface->interfaces() ], # List of interfaces + print STDERR "Interfaces OK\n"; my $self = { - ping => Net::Ping->new("icmp"), + ping => $ping, DefaultIP => "192.168.255.76", # Switch target management IP line_delay => 100 * 1000, # Delay 100 milliseconds between lines sent to /dev (presumably serial line) - Interfaces => [ Net::Interface->interfaces() ], # List of interfaces - DefaultUser => $user, - asroot => 0, - power_off => 0, # Power off the switch at end of override_switch (default=no) + Interfaces => $interfaces, + DefaultUser => $user, + asroot => 0, + power_off => 0, # Power off the switch at end of override_switch (default=no) }; foreach my $if (@{$self->{"Interfaces"}})