Skip to content

Commit

Permalink
Ctor 396 pack centreon plugin cloud vmware velocloud restapi mode lis…
Browse files Browse the repository at this point in the history
…t edges don t retrieve informations and get http code 400 (#5133)
  • Loading branch information
omercier authored Aug 7, 2024
1 parent 0e25233 commit 792cefd
Show file tree
Hide file tree
Showing 5 changed files with 380 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/cloud/vmware/velocloud/restapi/custom/api.pm
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,8 @@ sub get_entreprise_id {

my $response = $self->request_api(
method => 'POST',
endpoint => '/enterprise/getEnterprise'
endpoint => '/enterprise/getEnterprise',
query_form_post => {}
);

$self->{entreprise_id} = $response->{id};
Expand Down
3 changes: 3 additions & 0 deletions tests/resources/spellcheck/stopwords.t
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
--api-filter-orgs
--api-password
--api-password
--api-path
--api-token
--api-username
--api-version
Expand Down Expand Up @@ -165,5 +166,7 @@ v1
v2
VDSL2
Veeam
VeloCloud
VMware
WSMAN
Kubernetes
43 changes: 43 additions & 0 deletions tests/robot/cloud/vmware/velocloud/restapi/edgestatus.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
*** Settings ***
Documentation VeloCloud REST API Edge Status
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource

Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s


*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}velocloud.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=cloud::vmware::velocloud::restapi::plugin
... --mode edge-status
... --hostname=${HOSTNAME}
... --username=XloginX
... --password=XpasswordX
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/

*** Test Cases ***
Edge Status ${tc}
[Tags] cloud api vmware
${command} Catenate ${CMD} ${extraoptions}
${output} Run ${command}

${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 extraoptions expected_result --
... 1 ${EMPTY} CRITICAL: Edge 'MYEDGE#02' State is 'OFFLINE', Service State is 'IN_SERVICE', HA State is 'READY', Activation State is 'ACTIVATED'
... 2 --critical-status='' OK: All edges status are ok
42 changes: 42 additions & 0 deletions tests/robot/cloud/vmware/velocloud/restapi/listedges.robot
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
*** Settings ***
Documentation VeloCloud REST API Edge Status
Resource ${CURDIR}${/}..${/}..${/}..${/}..${/}..${/}resources/import.resource

Suite Setup Start Mockoon ${MOCKOON_JSON}
Suite Teardown Stop Mockoon
Test Timeout 120s


*** Variables ***
${MOCKOON_JSON} ${CURDIR}${/}velocloud.mockoon.json
${HOSTNAME} 127.0.0.1
${APIPORT} 3000
${CMD} ${CENTREON_PLUGINS}
... --plugin=cloud::vmware::velocloud::restapi::plugin
... --mode list-edges
... --hostname=${HOSTNAME}
... --username=XloginX
... --password=XpasswordX
... --proto=http
... --port=${APIPORT}
... --custommode=api
... --statefile-dir=/dev/shm/

*** Test Cases ***
List Edges ${tc}
[Tags] cloud api vmware discovery
${command} Catenate ${CMD} ${extraoptions} | wc -l
${output} Run ${command}

${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 extraoptions expected_result --
... 1 ${EMPTY} 9
290 changes: 290 additions & 0 deletions tests/robot/cloud/vmware/velocloud/restapi/velocloud.mockoon.json

Large diffs are not rendered by default.

0 comments on commit 792cefd

Please sign in to comment.