Skip to content

[snmp] Add test cases for SONiC physical entity MIB feature#2379

Merged
qiluo-msft merged 14 commits intosonic-net:masterfrom
Junchao-Mellanox:phy-mibs-snmp
Dec 2, 2020
Merged

[snmp] Add test cases for SONiC physical entity MIB feature#2379
qiluo-msft merged 14 commits intosonic-net:masterfrom
Junchao-Mellanox:phy-mibs-snmp

Conversation

@Junchao-Mellanox
Copy link
Contributor

Description of PR

Summary:
Add test cases for SONiC physical entity MIB feature

Type of change

  • Bug fix
  • Testbed and Framework(new/improvement)
  • Test case(new/improvement)

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?

  1. Adjust snmp_facts.py to support new MIB objects
  2. Add test case to verify transceiver related entities
  3. Add test case to verify PSU related entities
  4. Add test case to verify fan related entities
  5. Add test case to verify thermal related entities
  6. Add test case to verify PSU/fan remove

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

@Junchao-Mellanox
Copy link
Contributor Author

@Junchao-Mellanox
Copy link
Contributor Author

retest vsimage please

@wangxin
Copy link
Collaborator

wangxin commented Oct 23, 2020

retest this please

@lguohan
Copy link
Contributor

lguohan commented Oct 24, 2020

can you please add the test to kvmtest.sh?

@Junchao-Mellanox
Copy link
Contributor Author

kvmtest.sh

Done.

@Junchao-Mellanox
Copy link
Contributor Author

retest vsimage please

2 similar comments
@Junchao-Mellanox
Copy link
Contributor Author

retest vsimage please

@Junchao-Mellanox
Copy link
Contributor Author

retest vsimage please

@liat-grozovik
Copy link
Collaborator

retest vsimage please

@liat-grozovik
Copy link
Collaborator

@Junchao-Mellanox kindly reminder that this feature will go only to master towards 202012.
As of that we need a way to run snmp test on 201911 which has no such capability. Should it work or need to find a solution to detect if the version expected to support this extended mib?

@Junchao-Mellanox
Copy link
Contributor Author

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.

@Junchao-Mellanox
Copy link
Contributor Author

retest vsimage please

1 similar comment
@keboliu
Copy link
Contributor

keboliu commented Nov 4, 2020

retest vsimage please

@keboliu
Copy link
Contributor

keboliu commented Nov 4, 2020

retest this please

@Junchao-Mellanox
Copy link
Contributor Author

retest vsimage please

3 similar comments
@Junchao-Mellanox
Copy link
Contributor Author

retest vsimage please

@Junchao-Mellanox
Copy link
Contributor Author

retest vsimage please

@Junchao-Mellanox
Copy link
Contributor Author

retest vsimage please

@Junchao-Mellanox
Copy link
Contributor Author

retest vsimage please

SENSOR_TYPE_PORT_TX_BIAS + 4,
SENSOR_TYPE_VOLTAGE]

# Redis Constants
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 29, 2020

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

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
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 29, 2020

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

"""
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')
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 29, 2020

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

"""
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')
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 29, 2020

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

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@wangxin What is best practice to skip test case in vsimage test?


In reply to: 532159260 [](ancestors = 532159260)

Copy link
Collaborator

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

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)
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 29, 2020

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

for item in psu_status:
if not item['psu_on']:
psu_controller.turn_on_psu(item["psu_id"])
time.sleep(5)
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 29, 2020

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

Copy link
Contributor Author

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.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to sleep only once after all PSU turned on?


In reply to: 532159395 [](ancestors = 532159395)

:param pattern: Redis key pattern
:return: A list of key name in string
"""
cmd = 'redis-cli --raw -n {} KEYS \"{}\"'.format(db_id, pattern)
Copy link
Contributor

@qiluo-msft qiluo-msft Nov 29, 2020

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

Copy link
Contributor

@qiluo-msft qiluo-msft left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As comments

@Junchao-Mellanox
Copy link
Contributor Author

Hi @wangxin , it seems the test was not skipped in vsimage after adding the pytest mark. I see following error in the test result:

11:08:57      @pytest.mark.device_type('physical')
11:08:57      def test_fan_info(duthost, snmp_physical_entity_info):
11:08:57          """
11:08:57          Verify fan information in physical entity mib with redis database
11:08:57          :param duthost: DUT host object
11:08:57          :param snmp_physical_entity_info: Physical entity information from snmp fact
11:08:57          :return:
11:08:57          """
11:08:57          keys = redis_get_keys(duthost, STATE_DB, FAN_KEY_TEMPLATE.format('*'))
11:08:57  >       assert keys, 'Fan information does not exist in DB'
11:08:57  E       AssertionError: Fan information does not exist in DB

@wangxin
Copy link
Collaborator

wangxin commented Dec 1, 2020

If all the test cases in this test script need physical testbed, then it should not be added to the list in kvmtest.sh.

@qiluo-msft qiluo-msft merged commit 92cb763 into sonic-net:master Dec 2, 2020
@Junchao-Mellanox Junchao-Mellanox deleted the phy-mibs-snmp branch December 3, 2020 05:30
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…aemon] advance submodule head (sonic-net#11652)

linkmgrd:
* 17240f1 2022-08-02 | [active-active] Update unhealthy label definition (sonic-net#102) (HEAD -> 202205, github/202205) [Jing Zhang]
* 99a7b4b 2022-07-28 | Update the definition of healthy label (sonic-net#99) [Jing Zhang]
* 551144b 2022-08-08 | [Active-Standby]Remove unnecessary `handleMuxWaitTimeout` logs (sonic-net#100) [Jing Zhang]

utilities:
* 8cbbe4f 2022-08-08 | [crm] add checking for CRM interval range (sonic-net#2293) (HEAD -> 202205, github/202205) [Andriy Yurkiv]
* 7dac7a7 2022-08-03 | Fix version in db_migrator  for `PORT_QOS_MAP|global` (#2289) [bingwang-ms]
* e14f0c9 2022-08-03 | Add override testcase to verify removal (#2288) [jingwenxie]
* 61ea21d 2022-07-29 | [watermarkstat] Fix CLI script for unconfigured PG counters (sonic-net#2239) [Nazarii Hnydyn]
* e206e2d 2022-05-19 | [portconfig] Allow to configure interface mtu for physical ports only [Sudharsan Dhamal Gopalarathnam]
* 9751479 2022-08-01 | Transfer organization from Azure to sonic-net (sonic-net#2285) [Liu Shilong]
* 218b175 2022-07-29 | [202205][counters] Keep counters cache in a single directory (sonic-net#2280) [Stepan Blyshchak]

swss:
* d772a70 2022-08-09 | [muxorch] return true if the nbr IP is in the skip_neighbors list (sonic-net#2407) (HEAD -> 202205) [Nikola Dancejic]
* a3ac275 2022-08-08 | [EVPN]Modified tunnel creation logic when creating tunnel in VRF-VNI map creation flow (sonic-net#2404) (HEAD -> 202205) [Sudharsan Dhamal Gopalarathnam]
* 67c1376 2022-08-09 | [QoS] Fix issue: the WRED profile can not be set if current min > new max or current max < new min (sonic-net#2379) [Stephen Sun]
* 0295a35 2022-07-21 | [Buffer Orch] Support removing buffer port profile list (sonic-net#2371) [Stephen Sun]
* 450e9ec 2022-07-07 | Fix: missing sonic-db-cli in docker-sonic-vs image (sonic-net#2357) [Qi Luo]
* c1c1147 2022-06-02 | Purge package sonic-db-cli which depends on libswsscommon (sonic-net#2308) [Qi Luo]

swss-common:
* 749cd6f 2022-07-21 | Fix PING database command not backward compatible with python version issue. (sonic-net#650) (HEAD -> 202205) [Hua Liu]
* 4fa7484 2022-06-27 | Fix: missing sonic-db-cli in docker-sonic-vs image (sonic-net#640) [Qi Luo]
* 4d0dc7a 2022-06-23 | [sonic-cli] Fix sonic-db-cli output format not backward compatible with python version issue. (sonic-net#631) [Hua Liu]
* c5573fe 2022-06-03 | Purge package sonic-db-cli which depends on libswsscommon (sonic-net#628) [Qi Luo]
* 0ade483 2022-08-02 | Add docker-mux related table names  (sonic-net#627) [Jing Zhang]
* 675d793 2022-05-26 | Re-write sonic-db-cli with c++ for sonic startup performance issue (sonic-net#607) [Hua Liu]
* 1155773 2022-08-01 | Transfer organization from Azure to sonic-net (sonic-net#661) (github/202205) [Liu Shilong]

sairedis:
* c62a453 2022-06-03 | Purge package sonic-db-cli which depends on libswsscommon (sonic-net#1057) (HEAD -> 202205) [Qi Luo]
* 8be9292 2022-07-20 | [syncd] Remove error message when tryTranslateVidToRid fails (sonic-net#1048) [Kamil Cudnik]
* eb552ee 2022-08-01 | Transfer organization from Azure to sonic-net (sonic-net#1099) (github/202205) [Liu Shilong]

platform-daemon:
* d150229 2022-08-11 | Correct the peer forwarding state table (sonic-net#281) (HEAD -> 202205) [Longxiang Lyu]
* 9507e6c 2022-08-10 | [ycabled] remove some spurious logs (sonic-net#282) (HEAD -> 202205) [vdahiya12]

Signed-off-by: Ying Xie <[email protected]>
kazinator-arista pushed a commit to kazinator-arista/sonic-mgmt that referenced this pull request Mar 4, 2026
…rm-common] advance submodule head (sonic-net#12492)

linkmgrd:
* d7d6635 2022-10-21 | Fix link prober state event report twice issue (sonic-net#149) (HEAD -> 202205) [Longxiang Lyu]
* 0ef3296 2022-10-21 | [active-active] Add support to send/handle mux probe request (sonic-net#147) [Longxiang Lyu]
* a66fa34 2022-10-17 | [active-active] Fix config reload (sonic-net#145) [Longxiang Lyu]
* 7e1c820 2022-10-11 | [Active-Standby] avoid posting mux metrics event when receiving unsolicited mux state notification  (sonic-net#142) [Jing Zhang]
* 237cfd2 2022-10-07 | [Active-Active] Update default route shutdown heartbeat logic (sonic-net#141) [Jing Zhang]

utilities:
* 415d30e 2022-10-23 | [techsupport] Adding FRR EVPN dumps (sonic-net#2442) (HEAD -> 202205) [Sudharsan Dhamal Gopalarathnam]
* b3ffe45 2022-10-21 | [show][muxcable] add support for show mux firmware version all (sonic-net#2441) [vdahiya12]
* 7d68534 2022-10-19 | [app_ext] [auto-ts] Add available_mem_threshold option (sonic-net#2423) [Vivek]
* 52b9c16 2022-10-07 | [muxcable][config] add CLI support for mux mode detach (sonic-net#2425) [Jing Zhang]
* 14646ff 2022-10-10 | [show priority-group drop counters] Remove backup with cached PG drop counters after 'config reload' (sonic-net#2386) [Andriy Yurkiv]
* dffcc53 2022-10-11 | Add a subcommand to display a hexdump of transceiver EEPROM page (sonic-net#2379) [mihirpat1]
* 86175c2 2022-10-17 | [chassis]Add fabric counter cli commands (sonic-net#1860) [Maxime Lorrillere]

swss:
* 6fe0afd 2022-10-25 | [portsorch] remove port OID from saiOidToAlias map on port deletion (sonic-net#2483) (HEAD -> 202205, github/202205) [Stepan Blyshchak]
* 7290d66 2022-10-07 | [vlanmgr] Disable `arp_evict_nocarrier` for vlan host intf (sonic-net#2469) [Longxiang Lyu]
* d074001 2022-10-05 | [chassis][voq]Collect counters for fabric links (sonic-net#1944) [Maxime Lorrillere]
* 3a0353a 2022-10-18 | [counters][202205] Improve performance by polling only configured ports buffer queue/pg counters (sonic-net#2474) [Vadym Hlushko]
* 2feb39d 2022-10-14 | [202205] [crm] Fix issue with continues EXCEEDED and CLEAR logs for ACL group/table counters (sonic-net#2482) [Volodymyr Samotiy]

sairedis:
* 326b630 2022-10-21 | [gbsyncd] Add asic db prefix for channel NOTIFICATIONS (sonic-net#1129) (HEAD -> 202205) [Junhua Zhai]

platform-daemon:
* 6dbda9b 2022-10-25 | [ycabled] fix no port/state returned by grpc server (sonic-net#308) (HEAD -> 202205) [vdahiya12]
* 3d1228a 2022-10-20 | Fix xcvrd to support 400G ZR optic (sonic-net#293) [Bohan Yang]

platform-common:
* c04d710 2022-09-29 | Read CMIS data path state duration (sonic-net#312) (HEAD -> 202205) [Bohan Yang]

Signed-off-by: Ying Xie <[email protected]>

Signed-off-by: Ying Xie <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants