From ee48767a11a437830c78c5461ae97766ad2c8ec8 Mon Sep 17 00:00:00 2001 From: sfarouq-ext <116093375+sfarouq-ext@users.noreply.github.com> Date: Wed, 5 Feb 2025 11:43:25 +0100 Subject: [PATCH] enh(add new test mode): network::fortinet::fortigate::snmp, Mode(sdwan) (#5421) Co-authored-by: Patrick Refs:CTOR-1322 --- .../fortinet/fortigate/snmp/mode/sdwan.pm | 6 ++-- .../snmp/fortinet-fortigate.snmpwalk | 11 ++++++ .../fortinet/fortigate/snmp/sdawn.robot | 36 +++++++++++++++++++ tests/resources/spellcheck/stopwords.txt | 2 ++ 4 files changed, 52 insertions(+), 3 deletions(-) create mode 100644 tests/network/fortinet/fortigate/snmp/fortinet-fortigate.snmpwalk create mode 100644 tests/network/fortinet/fortigate/snmp/sdawn.robot diff --git a/src/centreon/common/fortinet/fortigate/snmp/mode/sdwan.pm b/src/centreon/common/fortinet/fortigate/snmp/mode/sdwan.pm index 7fb29f1669..50411049fe 100644 --- a/src/centreon/common/fortinet/fortigate/snmp/mode/sdwan.pm +++ b/src/centreon/common/fortinet/fortigate/snmp/mode/sdwan.pm @@ -314,9 +314,9 @@ sub manage_selection { name => $self->{sdwan}->{$_}->{name}, vdom => $result->{vdom}, ifName => $result->{ifName}, - in => $result->{traffic_in} * 1000 * 1000, - out => $result->{traffic_out} * 1000 * 1000, - bi => $result->{traffic_bi} * 1000 * 1000, + in => $result->{traffic_in} * 1000, + out => $result->{traffic_out} * 1000, + bi => $result->{traffic_bi} * 1000, }; $self->{sdwan}->{$_}->{jitter} = { diff --git a/tests/network/fortinet/fortigate/snmp/fortinet-fortigate.snmpwalk b/tests/network/fortinet/fortigate/snmp/fortinet-fortigate.snmpwalk new file mode 100644 index 0000000000..4901e04e5d --- /dev/null +++ b/tests/network/fortinet/fortigate/snmp/fortinet-fortigate.snmpwalk @@ -0,0 +1,11 @@ +.1.3.6.1.4.1.12356.101.4.9.2.1.2.7 = STRING: fgVWLHealthCheckLinkName +.1.3.6.1.4.1.12356.101.4.9.2.1.4.7 = INTEGER: 0 +.1.3.6.1.4.1.12356.101.4.9.2.1.5.7 = STRING: 8.617 +.1.3.6.1.4.1.12356.101.4.9.2.1.6.7 = STRING: 0.065 +.1.3.6.1.4.1.12356.101.4.9.2.1.9.7 = STRING: 0.000 +.1.3.6.1.4.1.12356.101.4.9.2.1.10.7 = STRING: root +.1.3.6.1.4.1.12356.101.4.9.2.1.11.7 = INTEGER: 27453 +.1.3.6.1.4.1.12356.101.4.9.2.1.12.7 = INTEGER: 29552 +.1.3.6.1.4.1.12356.101.4.9.2.1.13.7 = INTEGER: 57005 +.1.3.6.1.4.1.12356.101.4.9.2.1.14.7 = STRING: wan1 +.2.3.6.1.4.1.12356.101.4.9.2.1.2.7 = STRING: INTERNET \ No newline at end of file diff --git a/tests/network/fortinet/fortigate/snmp/sdawn.robot b/tests/network/fortinet/fortigate/snmp/sdawn.robot new file mode 100644 index 0000000000..0792cc5d0d --- /dev/null +++ b/tests/network/fortinet/fortigate/snmp/sdawn.robot @@ -0,0 +1,36 @@ +*** Settings *** +Documentation Check sd-wan links. + +Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}resources/import.resource + +Suite Setup Ctn Generic Suite Setup +Test Timeout 120s + + +*** Variables *** +${CMD} ${CENTREON_PLUGINS} --plugin=network::fortinet::fortigate::snmp::plugin + +*** Test Cases *** +sdwan ${tc} + [Tags] network sdwan + ${command} Catenate + ... ${CMD} + ... --mode=sdwan + ... --hostname=${HOSTNAME} + ... --snmp-version=${SNMPVERSION} + ... --snmp-port=${SNMPPORT} + ... --snmp-community=network/fortinet/fortigate/snmp/fortinet-fortigate + ... --snmp-timeout=10 + ... --snmp-retries=3 + ... ${extra_options} + + Ctn Run Command And Check Result As Strings ${command} ${expected_result} + + Examples: tc extra_options expected_result -- + ... 1 --filter-vdom='root' OK: sd-wan 'fgVWLHealthCheckLinkName' [vdom: root] [interface: wan1] state: up - traffic traffic-in : Buffer creation, traffic-out : Buffer creation, traffic-bi : Buffer creation - latency: 8.617ms - jitter: 0.065ms - packet loss: 0.000% | 'root~fgVWLHealthCheckLinkName~wan1#sdwan.latency.milliseconds'=8.62ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.jitter.milliseconds'=0.07ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.packetloss.percentage'=0.000%;;;0;100 + ... 2 --unknown-status='\\\%{vdom} eq "root"' UNKNOWN: sd-wan 'fgVWLHealthCheckLinkName' [vdom: root] [interface: wan1] state: up | 'root~fgVWLHealthCheckLinkName~wan1#sdwan.latency.milliseconds'=8.62ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.jitter.milliseconds'=0.07ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.packetloss.percentage'=0.000%;;;0;100 + ... 3 --warning-status='\\\%{state} eq "up"' WARNING: sd-wan 'fgVWLHealthCheckLinkName' [vdom: root] [interface: wan1] state: up | 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.in.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.out.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.bi.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.latency.milliseconds'=8.62ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.jitter.milliseconds'=0.07ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.packetloss.percentage'=0.000%;;;0;100 + ... 4 --critical-status='\\\%{state} eq "up"' CRITICAL: sd-wan 'fgVWLHealthCheckLinkName' [vdom: root] [interface: wan1] state: up | 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.in.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.out.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.bi.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.latency.milliseconds'=8.62ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.jitter.milliseconds'=0.07ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.packetloss.percentage'=0.000%;;;0;100 + ... 5 --critical-status='\\\%{vdom} eq "root"' --warning-traffic-in=0 --critical-traffic-in=8 CRITICAL: sd-wan 'fgVWLHealthCheckLinkName' [vdom: root] [interface: wan1] state: up | 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.in.bitspersecond'=0.00b/s;0:0;0:8;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.out.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.bi.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.latency.milliseconds'=8.62ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.jitter.milliseconds'=0.07ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.packetloss.percentage'=0.000%;;;0;100 + ... 6 ${EMPTY} OK: sd-wan 'fgVWLHealthCheckLinkName' [vdom: root] [interface: wan1] state: up - traffic in: 0.00 b/s, out: 0.00 b/s, bi: 0.00 b/s - latency: 8.617ms - jitter: 0.065ms - packet loss: 0.000% | 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.in.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.out.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.bi.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.latency.milliseconds'=8.62ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.jitter.milliseconds'=0.07ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.packetloss.percentage'=0.000%;;;0;100 + ... 7 --warning-status='\\\%{vdom} eq "root"' --warning-latency=8 --critical-latency=16 WARNING: sd-wan 'fgVWLHealthCheckLinkName' [vdom: root] [interface: wan1] state: up - latency: 8.617ms | 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.in.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.out.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.traffic.bi.bitspersecond'=0.00b/s;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.latency.milliseconds'=8.62ms;0:8;0:16;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.jitter.milliseconds'=0.07ms;;;0; 'root~fgVWLHealthCheckLinkName~wan1#sdwan.packetloss.percentage'=0.000%;;;0;100 \ No newline at end of file diff --git a/tests/resources/spellcheck/stopwords.txt b/tests/resources/spellcheck/stopwords.txt index 6a4440a8cb..193162aeeb 100644 --- a/tests/resources/spellcheck/stopwords.txt +++ b/tests/resources/spellcheck/stopwords.txt @@ -192,6 +192,7 @@ out-fc-wait out-mcast out-ucast overprovisioning +packetloss partiallyActive --patch-redhat perfdata @@ -260,6 +261,7 @@ userpass --use-ucd v1 v2 +vdom VDSL2 Veeam VeloCloud