Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[SAI-PTF] Convert generated enum code from ctypesgen into pythoon enu…
…m class why When ctypesgen generated the python code for c++ enum, the python cannot be logged by it enum name, we need to change it to enum class. the code like ```C++ /** * @brief SAI common API type */ typedef enum _sai_common_api_t { SAI_COMMON_API_CREATE = 0, SAI_COMMON_API_REMOVE = 1, SAI_COMMON_API_SET = 2, SAI_COMMON_API_GET = 3, SAI_COMMON_API_BULK_CREATE = 4, SAI_COMMON_API_BULK_REMOVE = 5, SAI_COMMON_API_BULK_SET = 6, SAI_COMMON_API_BULK_GET = 7, SAI_COMMON_API_MAX = 8, } sai_common_api_t; ``` original converted by ctypesgen ``` enum__sai_common_api_t = c_int# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_CREATE = 0# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_REMOVE = 1# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_SET = 2# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_GET = 3# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_BULK_CREATE = 4# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_BULK_REMOVE = 5# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_BULK_SET = 6# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_BULK_GET = 7# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_MAX = 8# /usr/include/sai/saitypes.h: 183 sai_common_api_t = enum__sai_common_api_t# /usr/include/sai/saitypes.h: 183 enum__sai_object_type_t = c_int# /usr/include/sai/saitypes.h: 294 ``` new code ``` class sai_common_api(SAIEnum): SAI_COMMON_API_CREATE = 0# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_REMOVE = 1# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_SET = 2# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_GET = 3# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_BULK_CREATE = 4# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_BULK_REMOVE = 5# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_BULK_SET = 6# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_BULK_GET = 7# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_MAX = 8# /usr/include/sai/saitypes.h: 183 SAI_COMMON_API_CREATE = sai_common_api.SAI_COMMON_API_CREATE SAI_COMMON_API_REMOVE = sai_common_api.SAI_COMMON_API_REMOVE SAI_COMMON_API_SET = sai_common_api.SAI_COMMON_API_SET SAI_COMMON_API_GET = sai_common_api.SAI_COMMON_API_GET SAI_COMMON_API_BULK_CREATE = sai_common_api.SAI_COMMON_API_BULK_CREATE SAI_COMMON_API_BULK_REMOVE = sai_common_api.SAI_COMMON_API_BULK_REMOVE SAI_COMMON_API_BULK_SET = sai_common_api.SAI_COMMON_API_BULK_SET SAI_COMMON_API_BULK_GET = sai_common_api.SAI_COMMON_API_BULK_GET SAI_COMMON_API_MAX = sai_common_api.SAI_COMMON_API_MAX ``` how Convert the python code after generated from ctypesgen verify pipeline local testing Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
- Loading branch information