Skip to content

Commit

Permalink
Extend rfc3433.py to support more Physical Entity Sensor MIB entries
Browse files Browse the repository at this point in the history
**- What I did**

Extend RFC3433 implementation with:

1. FAN tachometers
2. PSU current sensor
3. PSU voltage sensor
4. PSU power sensor
5. PSU temp sensor
6. Chassis temp sensor

MIB HLD update PR to reflect this change please refer to: sonic-net/SONiC#766

A fix for the LGTM checker

**- How I did it**
1. Refactor sensor data parsing class by adding a base class  BaseSensorData;  inherit  TransceiverSensorData, PSUSensorData, FANSensorData, and ThermalSensorData from it to reduce redundant code.
2. Adding more sensor MIB entry class: PSUTempSensor, PSUVoltageSensor, PSUCurrentSensor, PSUPowerSensor, FANSpeedSensor, and ThermalSensor.
3. Separate MIB update to different functions according to different sensors types: update_xcvr_dom_data, update_psu_sensor_data, update_fan_sensor_data, and update_thermal_sensor_data.
4. Add unit test cases to cover the new added MIB entries.
5. Add lgtm.yaml to fix the LGTM checker.

**- How to verify it**

Manual test and run updated community SNMP test case(sonic-net/sonic-mgmt#3357).
  • Loading branch information
qiluo-msft committed May 18, 2021
1 parent 4e063e4 commit 28b9dfd
Show file tree
Hide file tree
Showing 10 changed files with 1,057 additions and 192 deletions.
25 changes: 25 additions & 0 deletions lgtm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
extraction:
python:
python_setup:
version: "3"
prepare:
packages:
- libxml-simple-perl
- aspell
- aspell-en
- libhiredis-dev
- libnl-3-dev
- libnl-genl-3-dev
- libnl-route-3-dev
- libnl-nf-3-dev
- libzmq3-dev
- libzmq5
- swig3.0
- libpython2.7-dev
- libgtest-dev
- dh-exec
- doxygen
- graphviz
after_prepare:
- git clone https://github.com/Azure/sonic-py-swsssdk.git; pushd sonic-py-swsssdk; python3 setup.py bdist_wheel; popd
- pip3 install --upgrade --user sonic-py-swsssdk/dist/swsssdk-2.0.1-py3-none-any.whl
2 changes: 2 additions & 0 deletions src/sonic_ax_impl/mibs/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
TABLE_NAME_SEPARATOR_COLON = ':'
TABLE_NAME_SEPARATOR_VBAR = '|'

HOST_NAMESPACE_DB_IDX = 0

redis_kwargs = {'unix_socket_path': '/var/run/redis/redis.sock'}


Expand Down
3 changes: 1 addition & 2 deletions src/sonic_ax_impl/mibs/ietf/rfc2737.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
from .physical_entity_sub_oid_generator import get_psu_sensor_sub_id
from .physical_entity_sub_oid_generator import get_transceiver_sub_id
from .physical_entity_sub_oid_generator import get_transceiver_sensor_sub_id
from .transceiver_sensor_data import TransceiverSensorData

from .sensor_data import TransceiverSensorData

@unique
class PhysicalClass(int, Enum):
Expand Down
Loading

0 comments on commit 28b9dfd

Please sign in to comment.