diff --git a/Netdisco/Changes b/Netdisco/Changes index c4b7b99c..0ca0418b 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -34,6 +34,7 @@ * [#58] Search by VLAN name now works (R. Kerr) * Make "Not" option work for vlan number search in Device Ports * [#48] Fix for netmap links when domain_suffix is set (R. Kerr) + * [#57] Port sort order for Extreme switches "1:10" format 2.020002 - 2013-12-11 diff --git a/Netdisco/lib/App/Netdisco/Util/Web.pm b/Netdisco/lib/App/Netdisco/Util/Web.pm index 11f88cf0..32638100 100644 --- a/Netdisco/lib/App/Netdisco/Util/Web.pm +++ b/Netdisco/lib/App/Netdisco/Util/Web.pm @@ -36,7 +36,7 @@ sub sort_port { my $numbers = qr{^(\d+)$}; my $numeric = qr{^([\d\.]+)$}; - my $dotted_numeric = qr{^(\d+)\.(\d+)$}; + my $dotted_numeric = qr{^(\d+)[:.](\d+)$}; my $letter_number = qr{^([a-zA-Z]+)(\d+)$}; my $wordcharword = qr{^([^:\/.]+)[-\ :\/\.]+([^:\/.0-9]+)(\d+)?$}; #port-channel45 my $netgear = qr{^Slot: (\d+) Port: (\d+) }; # "Slot: 0 Port: 15 Gigabit - Level" diff --git a/Netdisco/t/10-sort_port.t b/Netdisco/t/10-sort_port.t new file mode 100644 index 00000000..59f3aebf --- /dev/null +++ b/Netdisco/t/10-sort_port.t @@ -0,0 +1,17 @@ +#!/usr/bin/perl + +use strict; use warnings FATAL => 'all'; +use Test::More 0.88; + +BEGIN { + use_ok( 'App::Netdisco::Util::Web', 'sort_port' ); +} + +# 1 = first is greater +# 0 = same +# -1 = first is lesser + +is(sort_port(1,1), 0, 'number - same values'); +is(sort_port('1:2','1:10'), -1, 'colon number (Extreme) - first lesser'); + +done_testing;