Skip to content

Commit

Permalink
enh(aruba-aoscx): add spanning tree (mon+disco) and uptime modes (#5454)
Browse files Browse the repository at this point in the history
Refs: CTOR-1397
  • Loading branch information
omercier authored Mar 6, 2025
2 parents baf7035 + aaf4bb4 commit c254a23
Show file tree
Hide file tree
Showing 9 changed files with 1,091 additions and 9 deletions.
5 changes: 4 additions & 1 deletion packaging/centreon-plugin-Network-Aruba-Aoscx-Snmp/pkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,12 @@
"files": [
"centreon/plugins/script_snmp.pm",
"centreon/plugins/snmp.pm",
"snmp_standard/mode/interfaces.pm",
"snmp_standard/mode/listinterfaces.pm",
"snmp_standard/mode/listspanningtrees.pm",
"snmp_standard/mode/resources/",
"snmp_standard/mode/interfaces.pm",
"snmp_standard/mode/spanningtree.pm",
"snmp_standard/mode/uptime.pm",
"network/aruba/aoscx/snmp/"
]
}
19 changes: 11 additions & 8 deletions src/network/aruba/aoscx/snmp/plugin.pm
Original file line number Diff line number Diff line change
Expand Up @@ -30,14 +30,17 @@ sub new {
bless $self, $class;

$self->{modes} = {
'cpu' => 'network::aruba::aoscx::snmp::mode::cpu',
'hardware' => 'network::aruba::aoscx::snmp::mode::hardware',
'interfaces' => 'snmp_standard::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'memory' => 'network::aruba::aoscx::snmp::mode::memory',
'stack' => 'network::aruba::aoscx::snmp::mode::stack',
'vsf' => 'network::aruba::aoscx::snmp::mode::vsf',
'vsx' => 'network::aruba::aoscx::snmp::mode::vsx'
'cpu' => 'network::aruba::aoscx::snmp::mode::cpu',
'hardware' => 'network::aruba::aoscx::snmp::mode::hardware',
'interfaces' => 'snmp_standard::mode::interfaces',
'list-interfaces' => 'snmp_standard::mode::listinterfaces',
'list-spanning-trees' => 'snmp_standard::mode::listspanningtrees',
'memory' => 'network::aruba::aoscx::snmp::mode::memory',
'spanning-tree' => 'snmp_standard::mode::spanningtree',
'stack' => 'network::aruba::aoscx::snmp::mode::stack',
'uptime' => 'snmp_standard::mode::uptime',
'vsf' => 'network::aruba::aoscx::snmp::mode::vsf',
'vsx' => 'network::aruba::aoscx::snmp::mode::vsx'
};

return $self;
Expand Down
35 changes: 35 additions & 0 deletions tests/network/aruba/aoscx/snmp/hardware.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
*** Settings ***

Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s
Test Setup Ctn Generic Suite Setup

*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=network::aruba::aoscx::snmp::plugin

*** Test Cases ***
hardware ${tc}
[Tags] network aruba
${command} Catenate
... ${CMD}
... --mode=hardware
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=network/aruba/aoscx/snmp/slim_aoscx-spanning-tree
... --snmp-timeout=1
... ${extra_options}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 ${EMPTY} OK: All 7 components are ok [1/1 psu, 6/6 temperatures]. | 'Anonymized 145#hardware.temperature.celsius'=60.00C;;;; 'Anonymized 096#hardware.temperature.celsius'=58.00C;;;; 'Anonymized 138#hardware.temperature.celsius'=20.50C;;;; 'Anonymized 186#hardware.temperature.celsius'=63.50C;;;; 'Anonymized 159#hardware.temperature.celsius'=63.25C;;;; 'Anonymized 101#hardware.temperature.celsius'=63.75C;;;; 'hardware.psu.count'=1;;;; 'hardware.temperature.count'=6;;;;
... 2 --component='.*' OK: All 7 components are ok [1/1 psu, 6/6 temperatures]. | 'Anonymized 145#hardware.temperature.celsius'=60.00C;;;; 'Anonymized 096#hardware.temperature.celsius'=58.00C;;;; 'Anonymized 138#hardware.temperature.celsius'=20.50C;;;; 'Anonymized 186#hardware.temperature.celsius'=63.50C;;;; 'Anonymized 159#hardware.temperature.celsius'=63.25C;;;; 'Anonymized 101#hardware.temperature.celsius'=63.75C;;;; 'hardware.psu.count'=1;;;; 'hardware.temperature.count'=6;;;;
... 3 --filter='psu' OK: All 6 components are ok [6/6 temperatures]. | 'Anonymized 145#hardware.temperature.celsius'=60.00C;;;; 'Anonymized 096#hardware.temperature.celsius'=58.00C;;;; 'Anonymized 138#hardware.temperature.celsius'=20.50C;;;; 'Anonymized 186#hardware.temperature.celsius'=63.50C;;;; 'Anonymized 159#hardware.temperature.celsius'=63.25C;;;; 'Anonymized 101#hardware.temperature.celsius'=63.75C;;;; 'hardware.temperature.count'=6;;;;
... 4 --no-component='CRITICAL' --filter='.*' CRITICAL: No components are checked.
... 5 --threshold-overload='fan,WARNING,string' OK: All 7 components are ok [1/1 psu, 6/6 temperatures]. | 'Anonymized 145#hardware.temperature.celsius'=60.00C;;;; 'Anonymized 096#hardware.temperature.celsius'=58.00C;;;; 'Anonymized 138#hardware.temperature.celsius'=20.50C;;;; 'Anonymized 186#hardware.temperature.celsius'=63.50C;;;; 'Anonymized 159#hardware.temperature.celsius'=63.25C;;;; 'Anonymized 101#hardware.temperature.celsius'=63.75C;;;; 'hardware.psu.count'=1;;;; 'hardware.temperature.count'=6;;;;
... 6 --warning='temperature,.*,30' WARNING: temperature 'Anonymized 145' is 60.00 C - temperature 'Anonymized 096' is 58.00 C - temperature 'Anonymized 186' is 63.50 C - temperature 'Anonymized 159' is 63.25 C - temperature 'Anonymized 101' is 63.75 C | 'Anonymized 145#hardware.temperature.celsius'=60.00C;0:30;;; 'Anonymized 096#hardware.temperature.celsius'=58.00C;0:30;;; 'Anonymized 138#hardware.temperature.celsius'=20.50C;0:30;;; 'Anonymized 186#hardware.temperature.celsius'=63.50C;0:30;;; 'Anonymized 159#hardware.temperature.celsius'=63.25C;0:30;;; 'Anonymized 101#hardware.temperature.celsius'=63.75C;0:30;;; 'hardware.psu.count'=1;;;; 'hardware.temperature.count'=6;;;;
... 7 --critical='temperature,.*,40' CRITICAL: temperature 'Anonymized 145' is 60.00 C - temperature 'Anonymized 096' is 58.00 C - temperature 'Anonymized 186' is 63.50 C - temperature 'Anonymized 159' is 63.25 C - temperature 'Anonymized 101' is 63.75 C | 'Anonymized 145#hardware.temperature.celsius'=60.00C;;0:40;; 'Anonymized 096#hardware.temperature.celsius'=58.00C;;0:40;; 'Anonymized 138#hardware.temperature.celsius'=20.50C;;0:40;; 'Anonymized 186#hardware.temperature.celsius'=63.50C;;0:40;; 'Anonymized 159#hardware.temperature.celsius'=63.25C;;0:40;; 'Anonymized 101#hardware.temperature.celsius'=63.75C;;0:40;; 'hardware.psu.count'=1;;;; 'hardware.temperature.count'=6;;;;
... 8 --warning='fan.speed,.*,1000' OK: All 7 components are ok [1/1 psu, 6/6 temperatures]. | 'Anonymized 145#hardware.temperature.celsius'=60.00C;;;; 'Anonymized 096#hardware.temperature.celsius'=58.00C;;;; 'Anonymized 138#hardware.temperature.celsius'=20.50C;;;; 'Anonymized 186#hardware.temperature.celsius'=63.50C;;;; 'Anonymized 159#hardware.temperature.celsius'=63.25C;;;; 'Anonymized 101#hardware.temperature.celsius'=63.75C;;;; 'hardware.psu.count'=1;;;; 'hardware.temperature.count'=6;;;;
... 9 --critical='fan.speed,.*,2000' OK: All 7 components are ok [1/1 psu, 6/6 temperatures]. | 'Anonymized 145#hardware.temperature.celsius'=60.00C;;;; 'Anonymized 096#hardware.temperature.celsius'=58.00C;;;; 'Anonymized 138#hardware.temperature.celsius'=20.50C;;;; 'Anonymized 186#hardware.temperature.celsius'=63.50C;;;; 'Anonymized 159#hardware.temperature.celsius'=63.25C;;;; 'Anonymized 101#hardware.temperature.celsius'=63.75C;;;; 'hardware.psu.count'=1;;;; 'hardware.temperature.count'=6;;;;
44 changes: 44 additions & 0 deletions tests/network/aruba/aoscx/snmp/interfaces.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
*** Settings ***

Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource

Test Timeout 120s
Test Setup Ctn Generic Suite Setup

*** Variables ***
${CMD} ${CENTREON_PLUGINS} --plugin=network::aruba::aoscx::snmp::plugin

*** Test Cases ***
interfaces ${tc}
[Tags] network aruba interfaces
${command} Catenate
... ${CMD}
... --mode=interfaces
... --hostname=${HOSTNAME}
... --snmp-version=${SNMPVERSION}
... --snmp-port=${SNMPPORT}
... --snmp-community=network/aruba/aoscx/snmp/slim_aoscx-spanning-tree
... --snmp-timeout=1
... ${extra_options}

Ctn Run Command And Check Result As Strings ${command} ${expected_result}

Examples: tc extra_options expected_result --
... 1 ${EMPTY} CRITICAL: Interface '1/1/10' Status : down (admin: up) - Interface '1/1/11' Status : down (admin: up) - Interface '1/1/12' Status : down (admin: up) - Interface '1/1/13' Status : down (admin: up) - Interface '1/1/14' Status : down (admin: up) - Interface '1/1/2' Status : down (admin: up) - Interface '1/1/4' Status : down (admin: up) - Interface '1/1/5' Status : down (admin: up) - Interface '1/1/6' Status : down (admin: up) - Interface '1/1/7' Status : down (admin: up) - Interface '1/1/8' Status : down (admin: up) - Interface '1/1/9' Status : down (admin: up)
... 2 --add-global OK: Total port : 18, AdminStatus Up : 18, AdminStatus Down : 0, OperStatus Up : 6, OperStatus Down : 12 | 'total_port'=18;;;0;18 'total_admin_up'=18;;;0;18 'total_admin_down'=0;;;0;18 'total_oper_up'=6;;;0;18 'global_oper_down'=12;;;0;18
... 3 --add-status CRITICAL: Interface '1/1/10' Status : down (admin: up) - Interface '1/1/11' Status : down (admin: up) - Interface '1/1/12' Status : down (admin: up) - Interface '1/1/13' Status : down (admin: up) - Interface '1/1/14' Status : down (admin: up) - Interface '1/1/2' Status : down (admin: up) - Interface '1/1/4' Status : down (admin: up) - Interface '1/1/5' Status : down (admin: up) - Interface '1/1/6' Status : down (admin: up) - Interface '1/1/7' Status : down (admin: up) - Interface '1/1/8' Status : down (admin: up) - Interface '1/1/9' Status : down (admin: up)
... 4 --add-duplex-status --warning-status='\\\%{opstatus} eq "warning"' CRITICAL: Interface '1/1/10' Status : down (admin: up) (duplex: fullDuplex) - Interface '1/1/11' Status : down (admin: up) (duplex: fullDuplex) - Interface '1/1/12' Status : down (admin: up) (duplex: fullDuplex) - Interface '1/1/13' Status : down (admin: up) (duplex: fullDuplex) - Interface '1/1/14' Status : down (admin: up) (duplex: fullDuplex) - Interface '1/1/2' Status : down (admin: up) (duplex: fullDuplex) - Interface '1/1/4' Status : down (admin: up) (duplex: fullDuplex) - Interface '1/1/5' Status : down (admin: up) (duplex: fullDuplex) - Interface '1/1/6' Status : down (admin: up) (duplex: fullDuplex) - Interface '1/1/7' Status : down (admin: up) (duplex: fullDuplex) - Interface '1/1/8' Status : down (admin: up) (duplex: fullDuplex) - Interface '1/1/9' Status : down (admin: up) (duplex: fullDuplex)
... 5 --add-traffic --name --interface='Anonymized 123' --warning-in-traffic=1:1 --speed=1 UNKNOWN: No entry found (maybe you should reload cache file)
... 6 --add-errors OK: All interfaces are ok
... 7 --add-cast --interface='1,1,14' OK: All interfaces are ok
... 8 --add-speed --interface='1,1,16' OK: All interfaces are ok | 'speed_1/1/1'=100000000b/s;;;0; 'speed_1/1/16'=1000000000b/s;;;0;
... 9 --add-volume --interface='1,1,10' --add-status='critical' CRITICAL: Interface '1/1/10' Status : down (admin: up)
... 10 --check-metrics='\\\%{opstatus} eq "up"' CRITICAL: Interface '1/1/10' Status : down (admin: up) - Interface '1/1/11' Status : down (admin: up) - Interface '1/1/12' Status : down (admin: up) - Interface '1/1/13' Status : down (admin: up) - Interface '1/1/14' Status : down (admin: up) - Interface '1/1/2' Status : down (admin: up) - Interface '1/1/4' Status : down (admin: up) - Interface '1/1/5' Status : down (admin: up) - Interface '1/1/6' Status : down (admin: up) - Interface '1/1/7' Status : down (admin: up) - Interface '1/1/8' Status : down (admin: up) - Interface '1/1/9' Status : down (admin: up)
... 11 --warning-status='\\\%{admstatus} eq "up"' --interface='16' WARNING: Interface '1/1/16' Status : up (admin: up)
... 12 --critical-status='\\\%{admstatus} eq "up" and \\\%{opstatus} ne "up"' CRITICAL: Interface '1/1/10' Status : down (admin: up) - Interface '1/1/11' Status : down (admin: up) - Interface '1/1/12' Status : down (admin: up) - Interface '1/1/13' Status : down (admin: up) - Interface '1/1/14' Status : down (admin: up) - Interface '1/1/2' Status : down (admin: up) - Interface '1/1/4' Status : down (admin: up) - Interface '1/1/5' Status : down (admin: up) - Interface '1/1/6' Status : down (admin: up) - Interface '1/1/7' Status : down (admin: up) - Interface '1/1/8' Status : down (admin: up) - Interface '1/1/9' Status : down (admin: up)
... 13 --warning-out-traffic='0' --critical-out-traffic=10 --warning-status='\\\%{opstatus} eq "up"' --interface='16' WARNING: Interface '1/1/16' Status : up (admin: up)
... 14 --warning-in-traffic='0' --critical-in-traffic=10 --critical-status='\\\%{opstatus} eq "up"' CRITICAL: Interface '1/1/1' Status : up (admin: up) - Interface '1/1/15' Status : up (admin: up) - Interface '1/1/16' Status : up (admin: up) - Interface 'Anonymized 124' Status : up (admin: up) - Interface '1/1/3' Status : up (admin: up) - Interface 'Anonymized 066' Status : up (admin: up)
... 15 --units-traffic='12%' CRITICAL: Interface '1/1/10' Status : down (admin: up) - Interface '1/1/11' Status : down (admin: up) - Interface '1/1/12' Status : down (admin: up) - Interface '1/1/13' Status : down (admin: up) - Interface '1/1/14' Status : down (admin: up) - Interface '1/1/2' Status : down (admin: up) - Interface '1/1/4' Status : down (admin: up) - Interface '1/1/5' Status : down (admin: up) - Interface '1/1/6' Status : down (admin: up) - Interface '1/1/7' Status : down (admin: up) - Interface '1/1/8' Status : down (admin: up) - Interface '1/1/9' Status : down (admin: up)
... 16 --units-errors='12%' CRITICAL: Interface '1/1/10' Status : down (admin: up) - Interface '1/1/11' Status : down (admin: up) - Interface '1/1/12' Status : down (admin: up) - Interface '1/1/13' Status : down (admin: up) - Interface '1/1/14' Status : down (admin: up) - Interface '1/1/2' Status : down (admin: up) - Interface '1/1/4' Status : down (admin: up) - Interface '1/1/5' Status : down (admin: up) - Interface '1/1/6' Status : down (admin: up) - Interface '1/1/7' Status : down (admin: up) - Interface '1/1/8' Status : down (admin: up) - Interface '1/1/9' Status : down (admin: up)
... 17 --units-cast='12%' CRITICAL: Interface '1/1/10' Status : down (admin: up) - Interface '1/1/11' Status : down (admin: up) - Interface '1/1/12' Status : down (admin: up) - Interface '1/1/13' Status : down (admin: up) - Interface '1/1/14' Status : down (admin: up) - Interface '1/1/2' Status : down (admin: up) - Interface '1/1/4' Status : down (admin: up) - Interface '1/1/5' Status : down (admin: up) - Interface '1/1/6' Status : down (admin: up) - Interface '1/1/7' Status : down (admin: up) - Interface '1/1/8' Status : down (admin: up) - Interface '1/1/9' Status : down (admin: up)
... 18 --display-transform-src='Anonymized' --display-transform-dst='Interface' --name --interface='Anonymized 124' OK: Interface 'Interface 124' Status : up (admin: up)
Loading

0 comments on commit c254a23

Please sign in to comment.