Skip to content

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

Merged
richardyu-ms merged 1 commit intoopencomputeproject:v1.11from
richardyu-ms:api_logger_str_val_1.11
Dec 22, 2022
Merged

[SAI-PTF] API Logger - reformat dict in return value#1690
richardyu-ms merged 1 commit intoopencomputeproject:v1.11from
richardyu-ms:api_logger_str_val_1.11

Conversation

@richardyu-ms
Copy link
Copy Markdown
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 [email protected]

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 <[email protected]>
@richardyu-ms richardyu-ms merged commit 1390cee into opencomputeproject:v1.11 Dec 22, 2022
@richardyu-ms richardyu-ms deleted the api_logger_str_val_1.11 branch December 22, 2022 05:05
richardyu-ms added a commit to richardyu-ms/sonic-sairedis that referenced this pull request Dec 22, 2022
richardyu-ms added a commit to sonic-net/sonic-sairedis that referenced this pull request Dec 22, 2022
richardyu-ms added a commit to richardyu-ms/SAI that referenced this pull request Jan 3, 2023
…ect#1690)

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 <[email protected]>

Signed-off-by: richardyu-ms <[email protected]>
richardyu-ms added a commit that referenced this pull request Jan 3, 2023
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 <[email protected]>

Signed-off-by: richardyu-ms <[email protected]>

Signed-off-by: richardyu-ms <[email protected]>
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