Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SAI-PTF] API Logger - reformat dict in return value #1689

Merged

Conversation

richardyu-ms
Copy link
Collaborator

Why
Base on some requirement, when logging the return value is a dict, need return the value for each key as a string.

For example, returning this.

 "[{
'client': <sai_thrift.sai_rpc.Client object at 0x7fd9b46861d0>,
'port_oid': 4294967303,
'hw_lane_list': sai_thrift_object_list_t(count=100, idlist=[1,2,34])
}]"

it returned as (see the ' around the value too below)

"[{
'client': '<sai_thrift.sai_rpc.Client object at 0x7fd9b46861d0>', 'port_oid': '4294967303',
'hw_lane_list': 'sai_thrift_object_list_t(count=100, idlist=[1,2,34])' }]"

How
Convert the dict value to string

Test:
Unit test and DUT test

Signed-off-by: richardyu-ms richard.yu@microsoft.com

Why
Base on some requirement, when logging the return value is a dict, need return the value for each key as a string.

For example,  returning this.
```
 "[{
'client': <sai_thrift.sai_rpc.Client object at 0x7fd9b46861d0>,
'port_oid': 4294967303,
'hw_lane_list': sai_thrift_object_list_t(count=100, idlist=[1,2,34])
}]"
```
 it returned as (see the ' around the value too below)
 ```
"[{
'client': '<sai_thrift.sai_rpc.Client object at 0x7fd9b46861d0>',
'port_oid': '4294967303',
'hw_lane_list': 'sai_thrift_object_list_t(count=100, idlist=[1,2,34])'
}]"
```

How
Convert the dict value to string

Test:
Unit test and DUT test

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
@richardyu-ms richardyu-ms merged commit 9c82b01 into opencomputeproject:v1.10 Dec 22, 2022
@richardyu-ms richardyu-ms deleted the api_logger_str_val_1.10 branch December 22, 2022 05:05
richardyu-ms added a commit to richardyu-ms/sonic-sairedis that referenced this pull request Dec 22, 2022
- opencomputeproject/SAI@9c82b01 opencomputeproject/SAI#1689

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
richardyu-ms added a commit to sonic-net/sonic-sairedis that referenced this pull request Dec 22, 2022
* [202205][Submodule][SAI]Advance SAI head pointer

include changes
- opencomputeproject/SAI#1684 opencomputeproject/SAI@b465243

* change
- opencomputeproject/SAI@9c82b01 opencomputeproject/SAI#1689

Signed-off-by: richardyu-ms <richard.yu@microsoft.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants