updates port-down logic

This commit is contained in:
Jed Reynolds
2018-09-26 14:48:41 -07:00
parent 0cc5c9065a
commit abf3d941c1

View File

@@ -229,12 +229,15 @@ sleep 1;
# wait on ports up # wait on ports up
my $ports_still_down = 1; my $ports_still_down = 1;
while ($ports_still_down > 0) { while ($ports_still_down > 0) {
$rh = json_request("/port/1/3/list?fields=_links,port,device,down"); # this logic has to see if port is phantom and if port is over-subscribed
$rh = json_request("/port/1/3/list?fields=_links,port,device,down,phantom,channel");
flatten_list($rh, 'interfaces'); flatten_list($rh, 'interfaces');
$ports_still_down=0; $ports_still_down=0;
for my $rh_p (values %{$rh->{'flat_list'}}) { for my $rh_p (values %{$rh->{'flat_list'}}) {
next unless $rh_p->{'device'} =~ /^sta/; next unless $rh_p->{'device'} =~ /^sta/;
#print "$rh_p->{'device'} is $rh_p->{'down'} "; print "$rh_p->{'device'} Down: $rh_p->{'down'} Ph $rh_p->{'phantom'} Channel: $rh_p->{'channel'}";
next if ($rh_p->{'phantom'}); # does not count as down
next if (!$rh_p->{'channel'}); # probably oversubscribed or misconfigured
$ports_still_down++ $ports_still_down++
if ($rh_p->{'down'}); if ($rh_p->{'down'});
} }
@@ -299,4 +302,4 @@ for my $port_uri (@links2) {
} }
logg(" updating "); logg(" updating ");
$rh_response = json_post("/cli-json/nc_show_ports", $rh_update); $rh_response = json_post("/cli-json/nc_show_ports", $rh_update);
# #