openbmc-test-automation icon indicating copy to clipboard operation
openbmc-test-automation copied to clipboard

[Redfish]SNMP test ValueError: The HTTP status code was not valid.

Open allen810118 opened this issue 1 year ago • 14 comments

I am testing SNMP via Redfish, And the following error is displayed in the results of multiple test cases: image

I wonder if there are any additional requirements for testing SNMP via Redfish?

allen810118 avatar Sep 13 '23 08:09 allen810118

@prkatti1 @meghagn12345 Can u respond ?

gkeishin avatar Sep 15 '23 08:09 gkeishin

If you are trying to add SNMP manager which is already present, then it will show this error.

meghagn5 avatar Sep 15 '23 08:09 meghagn5

curl -k -H "X-Auth-Token:${bmc_token}" -X GET https://${bmc}/redfish/v1/EventService/Subscriptions/snmp1 { "@odata.id": "/redfish/v1/EventService/Subscriptions/snmp1", "@odata.type": "#EventDestination.v1_8_0.EventDestination", "Context": "", "Destination": "snmp://xx.xx.xx.xx:162", "EventFormatType": "Event", "Id": "snmp1", "Name": "Event Destination snmp1", "Protocol": "SNMPv2c", "SubscriptionType": "SNMPTrap" }bash-4.2$ curl -k -H "X-Auth-Token $bmc_token" -X POST https://${bmc}/redfish/v1/EventService/Subscriptions -d '{"Destination": "snmp://xx.xx.xx.xx:162", "SubscriptionType": "SNMPTrap", "Protocol": "SNMPv2c"}' { "[email protected]": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The requested resource of type EventDestination.v1_8_0.EventDestination with the property Destination with the value 'snmp://xx.xx.xx.xx:162' already exists.", "MessageArgs": [ "EventDestination.v1_8_0.EventDestination", "Destination", "snmp://xx.xx.xx.xx:162" ], "MessageId": "Base.1.13.0.ResourceAlreadyExists", "MessageSeverity": "Critical", "Resolution": "Do not repeat the create operation as the resource has already been created." } ] }

bash-4.2$ curl -k -H "X-Auth-Token: $bmc_token" -X POST https://${bmc}/redfish/v1/EventService/Subscriptions -d '{"Destination": "snmp://xx.xx.xx.xx:162", "SubscriptionType": "SNMPTrap", "Protocol": "SNMP2c"}' -vv

< HTTP/1.1 400 Bad Request

meghagn5 avatar Sep 15 '23 08:09 meghagn5

@allen810118 does the above information help ?

gkeishin avatar Sep 15 '23 08:09 gkeishin

@meghagn5 I have not yet any subscriptions.

allen@allen:~$ curl -k -H "X-Auth-Token:${bmc_token}" -X GET https://${bmc}/redfish/v1/EventService/Subscriptions/ { "@odata.id": "/redfish/v1/EventService/Subscriptions", "@odata.type": "#EventDestinationCollection.EventDestinationCollection", "Members": [], "[email protected]": 0, "Name": "Event Destination Collections" }

and I tried to create a subscription based on your curl command, but it seems that it was not successful.

allen@allen:~$ curl -k -H "X-Auth-Token:${bmc_token}" -X POST https://${bmc}/redfish/v1/EventService/Subscriptions -d '{"Destination": "snmp://10.6.6.6:162", "SubscriptionType": "SNMPTrap", "Protocol": "SNMPv2c"}' { "[email protected]": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The value 'snmp://10.6.6.6:162' for the property Destination is of a different format than the property can accept.", "MessageArgs": [ "snmp://10.6.6.6:162", "Destination" ], "MessageId": "Base.1.11.0.PropertyValueFormatError", "MessageSeverity": "Warning", "Resolution": "Correct the value for the property in the request body and resubmit the request if the operation failed." } ] }

I'm not sure if this is due to the same error as what happened with the robot file?

allen810118 avatar Sep 18 '23 01:09 allen810118

@allen810118 as error says it is property value error, means the IP or port number which you are passing is not valid as per this error.

meghagn5 avatar Sep 20 '23 02:09 meghagn5

@allen810118 as error says it is property value error, means the IP or port number which you are passing is not valid as per this error.

But this set of IP and Port is obtained from reference to the "test_bmc_snmp_trap.robot" . I directly used it without making any modifications to the original code, but it seems to be invalid. And as far as I know, ports 161 and 162 should be used by SNMP Manager, there shouldn't be any errors.

Do you have any suggestions for this?

allen810118 avatar Sep 20 '23 03:09 allen810118

Tried with same command, it is working fine.

curl -k -H "X-Auth-Token:${bmc_token}" -X POST https://${bmc}/redfish/v1/EventService/Subscriptions -d '{"Destination": "snmp://10.6.6.6:162", "SubscriptionType": "SNMPTrap", "Protocol": "SNMPv2c"}' { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The resource has been created successfully.", "MessageArgs": [], "MessageId": "Base.1.13.0.Created", "MessageSeverity": "OK", "Resolution": "None." } ] }

meghagn5 avatar Sep 26 '23 07:09 meghagn5

Tried with same command, it is working fine.

curl -k -H "X-Auth-Token:${bmc_token}" -X POST https://${bmc}/redfish/v1/EventService/Subscriptions -d '{"Destination": "snmp://10.6.6.6:162", "SubscriptionType": "SNMPTrap", "Protocol": "SNMPv2c"}' { "@Message.ExtendedInfo": [ { "@odata.type": "#Message.v1_1_1.Message", "Message": "The resource has been created successfully.", "MessageArgs": [], "MessageId": "Base.1.13.0.Created", "MessageSeverity": "OK", "Resolution": "None." } ] }

May I ask what versions of openbmc and automation test you used when testing with this command? Last week during testing, I found that different versions yield different results. This may be the reason why I am unable to execute the command.

allen810118 avatar Oct 02 '23 01:10 allen810118

@allen810118 can you please share me the version where you were hitting this issue.

meghagn5 avatar Oct 06 '23 11:10 meghagn5

@meghagn5 The openbmc versions we use are all following version 2.12.0.

allen810118 avatar Oct 11 '23 05:10 allen810118

@meghagn5 @prkatti1 any update?

gkeishin avatar Oct 18 '23 13:10 gkeishin

@allen810118 this code is working fine for us and we are not facing an issue , we also tested it manually & it is working fine consistently.

If you are facing the issue manually also means, please open a defect against SNMP.

meghagn5 avatar Nov 09 '23 06:11 meghagn5

Hi all, I have a simulate issue Test "Configure SNMP Manager On BMC And Verify" on version v4.0_stable, test result was failed. But this test item result on version 3.0_stable was passed. I checked the log, and found the error reason is "No JSON object could be decoded". Then I noticed that POST request content was "body=data=10.6.6.6&data=162". This was not json object. And test on version 3.0_stable, POST request was correct that content was "body={"data": ["10.6.6.6", 162]} ".

Those different contents ware created by python or utility robot files? On v4.0_stable test environment, used "Python 3.8.10". How do I check the test environment is correct for testing? image

Julia-Delta avatar May 20 '24 02:05 Julia-Delta