Remove any null characters before parsing string in test_snmp_phy_entity#14596
Merged
bingwang-ms merged 1 commit intosonic-net:masterfrom Sep 18, 2024
Merged
Conversation
Signed-off-by: Janetxxx <janet970527@gmail.com>
r12f
approved these changes
Sep 18, 2024
bingwang-ms
approved these changes
Sep 18, 2024
Janetxxx
added a commit
to Janetxxx/sonic-mgmt
that referenced
this pull request
Sep 19, 2024
…hy_entity (sonic-net#14596)" This reverts commit 701e39e.
Merged
8 tasks
hdwhdw
pushed a commit
to hdwhdw/sonic-mgmt
that referenced
this pull request
Sep 20, 2024
sonic-net#14596) Signed-off-by: Janetxxx <janet970527@gmail.com>
wangxin
pushed a commit
that referenced
this pull request
Sep 23, 2024
…hy_entity (#14596)" (#14659) What is the motivation for this PR? Revert #14596 as it was temporary optics How did you do it? How did you verify/test it? Validate it in internal setup, TRANSCEIVER_INFO|Ethernet302 in STATE_DB is empty at the moment. Any platform specific information? str3-7060x6-64pe-1 Supported testbed topology if it's a new test case? t0-standalone-32
arista-hpandya
pushed a commit
to arista-hpandya/sonic-mgmt
that referenced
this pull request
Oct 2, 2024
sonic-net#14596) Signed-off-by: Janetxxx <janet970527@gmail.com>
arista-hpandya
pushed a commit
to arista-hpandya/sonic-mgmt
that referenced
this pull request
Oct 2, 2024
…hy_entity (sonic-net#14596)" (sonic-net#14659) What is the motivation for this PR? Revert sonic-net#14596 as it was temporary optics How did you do it? How did you verify/test it? Validate it in internal setup, TRANSCEIVER_INFO|Ethernet302 in STATE_DB is empty at the moment. Any platform specific information? str3-7060x6-64pe-1 Supported testbed topology if it's a new test case? t0-standalone-32
hdwhdw
pushed a commit
to hdwhdw/sonic-mgmt
that referenced
this pull request
Oct 10, 2024
…hy_entity (sonic-net#14596)" (sonic-net#14659) What is the motivation for this PR? Revert sonic-net#14596 as it was temporary optics How did you do it? How did you verify/test it? Validate it in internal setup, TRANSCEIVER_INFO|Ethernet302 in STATE_DB is empty at the moment. Any platform specific information? str3-7060x6-64pe-1 Supported testbed topology if it's a new test case? t0-standalone-32
vikshaw-Nokia
pushed a commit
to vikshaw-Nokia/sonic-mgmt
that referenced
this pull request
Oct 23, 2024
sonic-net#14596) Signed-off-by: Janetxxx <janet970527@gmail.com>
vikshaw-Nokia
pushed a commit
to vikshaw-Nokia/sonic-mgmt
that referenced
this pull request
Oct 23, 2024
…hy_entity (sonic-net#14596)" (sonic-net#14659) What is the motivation for this PR? Revert sonic-net#14596 as it was temporary optics How did you do it? How did you verify/test it? Validate it in internal setup, TRANSCEIVER_INFO|Ethernet302 in STATE_DB is empty at the moment. Any platform specific information? str3-7060x6-64pe-1 Supported testbed topology if it's a new test case? t0-standalone-32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of PR
Summary:
Fixes # (issue)
Type of change
Back port request
Approach
What is the motivation for this PR?
Solve
ValueErrorwhen parsing a string that contains null bytes (\x00).ast.literal_evalis essentially trying to compile a string into an Abstract Syntax Tree node, but it can't handle null bytes in the string. e,g.,node_or_string = '{\'ext_identifier\': \'Power Class 8 (16.0W Max)\', \'media_lane_count\': \'N/A\', \'ma: \'2024-05-23 \x00\x00\', \'active_apsel_hostlane7\': \'N/A\'}'This happens due to how the output is captured by the shell command execution
cmd = 'sonic-db-cli {} HGETALL \"{}\"'.format(db_id, key) output = duthost.shell(cmd)The output is being captured as a string with escaped single quotes and some null characters.How did you do it?
Remove any null characters before parsing string.
How did you verify/test it?
In snmp/test_snmp_phy_entity.py:
Any platform specific information?
str3-7060x6-64pe-1
Supported testbed topology if it's a new test case?
t0-standalone-32
Documentation