mirror of
https://github.com/centreon/centreon-plugins.git
synced 2025-07-29 16:45:04 +02:00
enh(mode): rationalized the get of SNMP communities from IPFabric + tests (#5121)
REFS: CTOR-598
This commit is contained in:
parent
6e2a8f53a4
commit
31639eae1d
@ -97,8 +97,7 @@ sub manage_selection {
|
|||||||
pagination => {
|
pagination => {
|
||||||
limit => undef,
|
limit => undef,
|
||||||
start => 0
|
start => 0
|
||||||
},
|
}
|
||||||
reports => '/technology/management/snmp/communities'
|
|
||||||
};
|
};
|
||||||
|
|
||||||
my $snmp_community_api_results = $options{custom}->request_api(
|
my $snmp_community_api_results = $options{custom}->request_api(
|
||||||
@ -110,7 +109,7 @@ sub manage_selection {
|
|||||||
for my $index (0 .. $#disco_data){
|
for my $index (0 .. $#disco_data){
|
||||||
next if (!defined($disco_data[$index]->{hostname}));
|
next if (!defined($disco_data[$index]->{hostname}));
|
||||||
if ($snmp_device->{hostname} eq $disco_data[$index]->{hostname}){
|
if ($snmp_device->{hostname} eq $disco_data[$index]->{hostname}){
|
||||||
$disco_data[$index]->{snmp_community} = $snmp_device->{name}->{data};
|
$disco_data[$index]->{snmp_community} = $snmp_device->{name};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
41
tests/apps/ipfabric/discovery.robot
Normal file
41
tests/apps/ipfabric/discovery.robot
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
*** Settings ***
|
||||||
|
|
||||||
|
|
||||||
|
Resource ${CURDIR}${/}..${/}..${/}resources/import.resource
|
||||||
|
|
||||||
|
Suite Setup Start Mockoon ${MOCKOON_JSON}
|
||||||
|
Suite Teardown Stop Mockoon
|
||||||
|
Test Timeout 120s
|
||||||
|
|
||||||
|
|
||||||
|
*** Variables ***
|
||||||
|
${MOCKOON_JSON} ${CURDIR}${/}ipfabric.mockoon.json
|
||||||
|
|
||||||
|
${CMD} ${CENTREON_PLUGINS} --plugin=apps::ipfabric::plugin
|
||||||
|
... --api-key=EEECGFCGFCGF
|
||||||
|
... --mode=discovery
|
||||||
|
... --http-peer-addr=127.0.0.1
|
||||||
|
... --proto=http
|
||||||
|
... --port=3000
|
||||||
|
... --prettify
|
||||||
|
|
||||||
|
*** Test Cases ***
|
||||||
|
Discovery ${tc}
|
||||||
|
[Tags] apps api ipfabric
|
||||||
|
${command} Catenate ${CMD}
|
||||||
|
... --hostname=${server_name}
|
||||||
|
|
||||||
|
${output} Run ${command} | wc -l
|
||||||
|
|
||||||
|
${output} Strip String ${output}
|
||||||
|
Should Be Equal As Strings
|
||||||
|
... ${output}
|
||||||
|
... ${expected_result}
|
||||||
|
... Wrong output result for command:\n${command}\n\nObtained:\n${output}\n\nExpected:\n${expected_result}\n
|
||||||
|
... values=False
|
||||||
|
... collapse_spaces=True
|
||||||
|
|
||||||
|
Examples: tc server_name expected_result --
|
||||||
|
... 1 cisco-live02.ipf.cx 5468
|
||||||
|
... 2 demo1.eu.ipfabric.io 99
|
||||||
|
|
281
tests/apps/ipfabric/ipfabric.mockoon.json
Normal file
281
tests/apps/ipfabric/ipfabric.mockoon.json
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user