sodafoundation / delfin

delfin is the SODA Infrastructure Manager project which provides unified, intelligent and scalable resource management, alert and performance monitoring
https://sodafoundation.io/
Apache License 2.0
202 stars 355 forks source link

Inconsistent swagger description with implementation #1018

Open te-koyanagi opened 8 months ago

te-koyanagi commented 8 months ago

Issue/Feature Description: Found an inconsistentency in the swagger description with implementation (openapi-spec/swagger.yaml)

Why this issue to fixed / feature is needed(give scenarios or use cases): It must be correct for better user experience as no API document exists other than this swagger description.

How to reproduce, in case of a bug: Storage not found errors for the name "access-infos" and "snmp-configs" were returned for the following two APIs.

curl -s -X GET http://192.168.231.101:31000/v1/storages/access-infos
{
  "error_code": "StorageNotFound",
  "error_msg": "Storage access-infos could not be found.",
  "error_args": [
    "access-infos"
  ]
}

curl -s -X GET http://192.168.231.101:31000/v1/storages/snmp-configs
{
  "error_code": "StorageNotFound",
  "error_msg": "Storage snmp-configs could not be found.",
  "error_args": [
    "snmp-configs"
  ]
}

Following two APIs work as expected, but not in the swagger.yaml.

curl -s -X GET http://192.168.231.101:31000/v1/access-infos
{
  "access_infos": [
    {
      "created_at": "2024-01-26T04:48:40.545605",
      "updated_at": null,
      "storage_id": "db6e9a64-fc7c-4c10-a60b-a17abb7fabcf",
      "storage_name": null,
      "vendor": "huawei",
      "model": "oceanstor",
      "rest": {
        "host": "172.27.16.71",
        "port": 8088,
        "username": "admin"
      },
      "ssh": {},
      "cli": {},
      "smis": {},
      "extra_attributes": {
        "path": "storage.json"
      }
    }
  ]
}

curl -s -X GET http://192.168.231.101:31000/v1/snmp-configs
{
  "snmp_configs": []
}

Other Notes / Environment Information: (Please give the env information, log link or any useful information for this issue)

te-koyanagi commented 8 months ago

See the following document for the test configuration: https://docs.google.com/document/d/1WesXmZV0eRDgG2cjg2myqd5BK1t-Eg36O0IzkA6BTto/edit?usp=sharing