-
Notifications
You must be signed in to change notification settings - Fork 710
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
[snmp] Add test cases for SONiC physical entity MIB feature #2379
Conversation
retest vsimage please |
retest this please |
can you please add the test to kvmtest.sh? |
Done. |
retest vsimage please |
2 similar comments
retest vsimage please |
retest vsimage please |
retest vsimage please |
@Junchao-Mellanox kindly reminder that this feature will go only to master towards 202012. |
Hi @liat-grozovik , we can do this in sonic-tool. In sonic-tool, we can disable cases according to the image branch name. So once we merge this test case to our local repo, we need add the case to sonic-tool and disable it on 201911 branch in snmp.cases file. |
retest vsimage please |
1 similar comment
retest vsimage please |
retest this please |
retest vsimage please |
3 similar comments
retest vsimage please |
retest vsimage please |
retest vsimage please |
retest vsimage please |
tests/snmp/test_snmp_phy_entity.py
Outdated
SENSOR_TYPE_PORT_TX_BIAS + 4, | ||
SENSOR_TYPE_VOLTAGE] | ||
|
||
# Redis Constants |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Redis [](start = 2, length = 5)
Suggest remove Redis
#Closed
tests/snmp/test_snmp_phy_entity.py
Outdated
assert fan_snmp_fact['entPhysMfgName'] == '' | ||
assert fan_snmp_fact['entPhysModelName'] == '' if is_null_str(fan_info['model']) else fan_info['model'] | ||
assert fan_snmp_fact['entPhysIsFRU'] == REPLACEABLE if fan_info[ | ||
'is_replaceable'] == 'True' else NOT_REPLACEABLE |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'is_replaceable' [](start = 67, length = 16)
Line breaking at a weird position. #Closed
tests/snmp/test_snmp_phy_entity.py
Outdated
""" | ||
keys = redis_get_keys(duthost, STATE_DB, PSU_KEY_TEMPLATE.format('*')) | ||
if not keys: | ||
pytest.skip('PSU information not exists in DB, skipping this test') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not exists [](start = 37, length = 10)
does not exist #Closed
tests/snmp/test_snmp_phy_entity.py
Outdated
""" | ||
keys = redis_get_keys(duthost, STATE_DB, PSU_KEY_TEMPLATE.format('*')) | ||
if not keys: | ||
pytest.skip('PSU information not exists in DB, skipping this test') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pytest.skip [](start = 8, length = 11)
There are many pytest.skip()
. Seems are a valid failure case.
Do you skip just for backward-compatible? If yes, I think this is not a good method. #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I skip this for vsimage test. I found this testcase will be ran in vsimage, and there is no PSU information in DB.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can mark the test case like below to specify that this test case is only applicable for physical testbed, not for vsimage.
@pytest.mark.device_type('physical')
def test_xxx
tests/snmp/test_snmp_phy_entity.py
Outdated
assert sensor_snmp_fact['entPhysContainedIn'] == psu_oid | ||
assert sensor_snmp_fact['entPhysClass'] == PHYSICAL_CLASS_SENSOR | ||
assert sensor_snmp_fact['entPhyParentRelPos'] == sensor_tuple[1] | ||
assert sensor_snmp_fact['entPhysName'] == '{} for {}'.format(sensor_tuple[0], psu_name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
'{} for {}'.format(sensor_tuple[0], psu_name) [](start = 50, length = 45)
Appear twice, use a variable? #Closed
tests/snmp/test_snmp_phy_entity.py
Outdated
for item in psu_status: | ||
if not item['psu_on']: | ||
psu_controller.turn_on_psu(item["psu_id"]) | ||
time.sleep(5) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
time.sleep(5) [](start = 12, length = 13)
What if no sleep? #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PSU may take a few seconds to power on, so I add a sleep here, this code is similar with some test cases in platform tests.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tests/snmp/test_snmp_phy_entity.py
Outdated
:param pattern: Redis key pattern | ||
:return: A list of key name in string | ||
""" | ||
cmd = 'redis-cli --raw -n {} KEYS \"{}\"'.format(db_id, pattern) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
redis-cli [](start = 11, length = 9)
redis-cli
will not aware of multi-DB or multi-namespace. Use sonic-db-cli
#Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As comments
Hi @wangxin , it seems the test was not skipped in vsimage after adding the pytest mark. I see following error in the test result:
|
If all the test cases in this test script need physical testbed, then it should not be added to the list in |
…l physical entites such as fan, PSU
Description of PR
Summary:
Add test cases for SONiC physical entity MIB feature
Type of change
Approach
What is the motivation for this PR?
There is no regression test case for physical entity MIB before, and we create a few new test cases to cover the existing/new MIB objects.
How did you do it?
How did you verify/test it?
Run the new regression test cases
Any platform specific information?
N/A
Supported testbed topology if it's a new test case?
N/A
Documentation