enh(mode): rationalized the get of SNMP communities from IPFabric + tests (#5121)

REFS: CTOR-598
This commit is contained in:
omercier 2024-09-02 09:32:01 +02:00 committed by GitHub
parent 6e2a8f53a4
commit 31639eae1d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 324 additions and 3 deletions

View File

@ -97,8 +97,7 @@ sub manage_selection {
pagination => {
limit => undef,
start => 0
},
reports => '/technology/management/snmp/communities'
}
};
my $snmp_community_api_results = $options{custom}->request_api(
@ -110,7 +109,7 @@ sub manage_selection {
for my $index (0 .. $#disco_data){
next if (!defined($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};
}
}
}

View 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

File diff suppressed because one or more lines are too long