This commit is contained in:
jostar-yang 2024-03-25 11:21:27 +08:00 committed by GitHub
commit 04bbf04f49
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
20 changed files with 3145 additions and 104 deletions

View File

@ -0,0 +1,471 @@
- bus: '00'
dev: '00'
fn: '0'
id: 6f00
name: 'Host bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D DMI2
(rev 03)'
- bus: '00'
dev: '01'
fn: '0'
id: 6f02
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
Express Root Port 1 (rev 03)'
- bus: '00'
dev: '01'
fn: '1'
id: 6f03
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
Express Root Port 1 (rev 03)'
- bus: '00'
dev: '02'
fn: '0'
id: 6f04
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
Express Root Port 2 (rev 03)'
- bus: '00'
dev: '02'
fn: '1'
id: 6f05
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
Express Root Port 2 (rev 03)'
- bus: '00'
dev: '02'
fn: '2'
id: 6f06
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
Express Root Port 2 (rev 03)'
- bus: '00'
dev: '02'
fn: '3'
id: 6f07
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
Express Root Port 2 (rev 03)'
- bus: '00'
dev: '03'
fn: '0'
id: 6f08
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
Express Root Port 3 (rev 03)'
- bus: '00'
dev: '03'
fn: '1'
id: 6f09
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
Express Root Port 3 (rev 03)'
- bus: '00'
dev: '03'
fn: '2'
id: 6f0a
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
Express Root Port 3 (rev 03)'
- bus: '00'
dev: '03'
fn: '3'
id: 6f0b
name: 'PCI bridge: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D PCI
Express Root Port 3 (rev 03)'
- bus: '00'
dev: '05'
fn: '0'
id: 6f28
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Map/VTd_Misc/System Management (rev 03)'
- bus: '00'
dev: '05'
fn: '1'
id: 6f29
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D IIO Hot Plug (rev 03)'
- bus: '00'
dev: '05'
fn: '2'
id: 6f2a
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D IIO RAS/Control Status/Global Errors (rev 03)'
- bus: '00'
dev: '05'
fn: '4'
id: 6f2c
name: 'PIC: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon D I/O APIC (rev
03)'
- bus: '00'
dev: '14'
fn: '0'
id: 8c31
name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB
xHCI (rev 05)'
- bus: '00'
dev: '16'
fn: '0'
id: 8c3a
name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset
Family MEI Controller #1 (rev 04)'
- bus: '00'
dev: '16'
fn: '1'
id: 8c3b
name: 'Communication controller: Intel Corporation 8 Series/C220 Series Chipset
Family MEI Controller #2 (rev 04)'
- bus: '00'
dev: 1c
fn: '0'
id: 8c10
name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express
Root Port #1 (rev d5)'
- bus: '00'
dev: 1c
fn: '1'
id: 8c12
name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express
Root Port #2 (rev d5)'
- bus: '00'
dev: 1c
fn: '4'
id: 8c18
name: 'PCI bridge: Intel Corporation 8 Series/C220 Series Chipset Family PCI Express
Root Port #5 (rev d5)'
- bus: '00'
dev: 1d
fn: '0'
id: 8c26
name: 'USB controller: Intel Corporation 8 Series/C220 Series Chipset Family USB
EHCI #1 (rev 05)'
- bus: '00'
dev: 1f
fn: '0'
id: 8c54
name: 'ISA bridge: Intel Corporation C224 Series Chipset Family Server Standard
SKU LPC Controller (rev 05)'
- bus: '00'
dev: 1f
fn: '2'
id: 8c02
name: 'SATA controller: Intel Corporation 8 Series/C220 Series Chipset Family 6-port
SATA Controller 1 [AHCI mode] (rev 05)'
- bus: '00'
dev: 1f
fn: '3'
id: 8c22
name: 'SMBus: Intel Corporation 8 Series/C220 Series Chipset Family SMBus Controller
(rev 05)'
- bus: '03'
dev: '00'
fn: '0'
id: 6f50
name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology
Register DMA Channel 0'
- bus: '03'
dev: '00'
fn: '1'
id: 6f51
name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology
Register DMA Channel 1'
- bus: '03'
dev: '00'
fn: '2'
id: 6f52
name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology
Register DMA Channel 2'
- bus: '03'
dev: '00'
fn: '3'
id: 6f53
name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology
Register DMA Channel 3'
- bus: '05'
dev: '00'
fn: '0'
id: 15ab
name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane'
- bus: '05'
dev: '00'
fn: '1'
id: 15ab
name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane'
- bus: '07'
dev: '00'
fn: '0'
id: b870
name: 'Ethernet controller: Broadcom Inc. and subsidiaries Device b870 (rev 01)'
- bus: 0b
dev: '00'
fn: '0'
id: 165f
name: 'Ethernet controller: Broadcom Inc. and subsidiaries NetXtreme BCM5720 2-port
Gigabit Ethernet PCIe'
- bus: ff
dev: 0b
fn: '0'
id: 6f81
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D R3 QPI Link 0/1 (rev 03)'
- bus: ff
dev: 0b
fn: '1'
id: 6f36
name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D R3 QPI Link 0/1 (rev 03)'
- bus: ff
dev: 0b
fn: '2'
id: 6f37
name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D R3 QPI Link 0/1 (rev 03)'
- bus: ff
dev: 0b
fn: '3'
id: 6f76
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D R3 QPI Link Debug (rev 03)'
- bus: ff
dev: 0c
fn: '0'
id: 6fe0
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Caching Agent (rev 03)'
- bus: ff
dev: 0c
fn: '1'
id: 6fe1
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Caching Agent (rev 03)'
- bus: ff
dev: 0c
fn: '2'
id: 6fe2
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Caching Agent (rev 03)'
- bus: ff
dev: 0c
fn: '3'
id: 6fe3
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Caching Agent (rev 03)'
- bus: ff
dev: 0f
fn: '0'
id: 6ff8
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Caching Agent (rev 03)'
- bus: ff
dev: 0f
fn: '4'
id: 6ffc
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Caching Agent (rev 03)'
- bus: ff
dev: 0f
fn: '5'
id: 6ffd
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Caching Agent (rev 03)'
- bus: ff
dev: 0f
fn: '6'
id: 6ffe
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Caching Agent (rev 03)'
- bus: ff
dev: '10'
fn: '0'
id: 6f1d
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D R2PCIe Agent (rev 03)'
- bus: ff
dev: '10'
fn: '1'
id: 6f34
name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D R2PCIe Agent (rev 03)'
- bus: ff
dev: '10'
fn: '5'
id: 6f1e
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Ubox (rev 03)'
- bus: ff
dev: '10'
fn: '6'
id: 6f7d
name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Ubox (rev 03)'
- bus: ff
dev: '10'
fn: '7'
id: 6f1f
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Ubox (rev 03)'
- bus: ff
dev: '12'
fn: '0'
id: 6fa0
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Home Agent 0 (rev 03)'
- bus: ff
dev: '12'
fn: '1'
id: 6f30
name: 'Performance counters: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Home Agent 0 (rev 03)'
- bus: ff
dev: '13'
fn: '0'
id: 6fa8
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)'
- bus: ff
dev: '13'
fn: '1'
id: 6f71
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Target Address/Thermal/RAS (rev 03)'
- bus: ff
dev: '13'
fn: '2'
id: 6faa
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel Target Address Decoder (rev 03)'
- bus: ff
dev: '13'
fn: '3'
id: 6fab
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel Target Address Decoder (rev 03)'
- bus: ff
dev: '13'
fn: '4'
id: 6fac
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel Target Address Decoder (rev 03)'
- bus: ff
dev: '13'
fn: '5'
id: 6fad
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel Target Address Decoder (rev 03)'
- bus: ff
dev: '13'
fn: '6'
id: 6fae
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D DDRIO Channel 0/1 Broadcast (rev 03)'
- bus: ff
dev: '13'
fn: '7'
id: 6faf
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D DDRIO Global Broadcast (rev 03)'
- bus: ff
dev: '14'
fn: '0'
id: 6fb0
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel 0 Thermal Control (rev 03)'
- bus: ff
dev: '14'
fn: '1'
id: 6fb1
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel 1 Thermal Control (rev 03)'
- bus: ff
dev: '14'
fn: '2'
id: 6fb2
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel 0 Error (rev 03)'
- bus: ff
dev: '14'
fn: '3'
id: 6fb3
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel 1 Error (rev 03)'
- bus: ff
dev: '14'
fn: '4'
id: 6fbc
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D DDRIO Channel 0/1 Interface (rev 03)'
- bus: ff
dev: '14'
fn: '5'
id: 6fbd
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D DDRIO Channel 0/1 Interface (rev 03)'
- bus: ff
dev: '14'
fn: '6'
id: 6fbe
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D DDRIO Channel 0/1 Interface (rev 03)'
- bus: ff
dev: '14'
fn: '7'
id: 6fbf
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D DDRIO Channel 0/1 Interface (rev 03)'
- bus: ff
dev: '15'
fn: '0'
id: 6fb4
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel 2 Thermal Control (rev 03)'
- bus: ff
dev: '15'
fn: '1'
id: 6fb5
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel 3 Thermal Control (rev 03)'
- bus: ff
dev: '15'
fn: '2'
id: 6fb6
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel 2 Error (rev 03)'
- bus: ff
dev: '15'
fn: '3'
id: 6fb7
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Memory Controller 0 - Channel 3 Error (rev 03)'
- bus: ff
dev: 1e
fn: '0'
id: 6f98
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Power Control Unit (rev 03)'
- bus: ff
dev: 1e
fn: '1'
id: 6f99
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Power Control Unit (rev 03)'
- bus: ff
dev: 1e
fn: '2'
id: 6f9a
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Power Control Unit (rev 03)'
- bus: ff
dev: 1e
fn: '3'
id: 6fc0
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Power Control Unit (rev 03)'
- bus: ff
dev: 1e
fn: '4'
id: 6f9c
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Power Control Unit (rev 03)'
- bus: ff
dev: 1f
fn: '0'
id: 6f88
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Power Control Unit (rev 03)'
- bus: ff
dev: 1f
fn: '2'
id: 6f8a
name: 'System peripheral: Intel Corporation Xeon E7 v4/Xeon E5 v4/Xeon E3 v4/Xeon
D Power Control Unit (rev 03)'

View File

@ -34,7 +34,7 @@
{
"i2c":
{
"valmap": { "F2B":"EXHAUST", "B2F":"INTAKE" }
"valmap": { "F2B":"exhaust", "B2F":"intake" }
}
},
@ -47,7 +47,7 @@
{
"i2c":
{
"valmap": {"1":"EXHAUST", "0":"INTAKE"}
"valmap": {"1":"exhaust", "0":"intake"}
}
},
@ -61,7 +61,7 @@
"duty_cycle_to_pwm": "lambda dc: ((dc*100)/625 -1)",
"pwm_to_duty_cycle": "lambda pwm: (((pwm+1)*625+75)/100)"
"pwm_to_duty_cycle": "lambda pwm: (((pwm+1)*625)/100)"
}
}

View File

@ -5,7 +5,7 @@
"num_fantrays":6,
"num_fans_pertray":2,
"num_ports":34,
"num_temps":5,
"num_temps":10,
"pddf_dev_types":
{
"description":"AS7726 - Below is the list of supported PDDF device types (chip names) for various components. If any component uses some other driver, we will create the client using 'echo <dev-address> <dev-type> > <path>/new_device' method",
@ -1545,7 +1545,7 @@
"dev_info": { "device_type":"", "device_name":"PORT33-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT33"},
"i2c":
{
"topo_info": { "parent_bus":"0xf", "dev_addr":"0x50", "dev_type":"optoe1"},
"topo_info": { "parent_bus":"0xf", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
@ -1584,7 +1584,7 @@
"dev_info": { "device_type":"", "device_name":"PORT34-EEPROM", "device_parent":"MUX2", "virt_parent":"PORT34"},
"i2c":
{
"topo_info": { "parent_bus":"0x10", "dev_addr":"0x50", "dev_type":"optoe1"},
"topo_info": { "parent_bus":"0x10", "dev_addr":"0x50", "dev_type":"optoe2"},
"attr_list":
[
{ "attr_name":"eeprom"}
@ -1657,7 +1657,11 @@
{ "attr_name":"psu_i_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out_max", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out_min", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_out_max", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_temp1_high_threshold", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xa8", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}
]
}
},
@ -1705,7 +1709,11 @@
{ "attr_name":"psu_i_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_out", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out_max", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa5", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_v_out_min", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa4", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_p_out_max", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa7", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
{ "attr_name":"psu_temp1_high_threshold", "attr_devaddr":"0x5b", "attr_devtype":"pmbus", "attr_offset":"0xa8", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}
]
}
},
@ -1865,7 +1873,82 @@
]
}
},
"TEMP6" :
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP6"},
"dev_attr": { "display_name":"CPU_Package_temp"},
"i2c":
{
"path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"},
"attr_list":
[
{ "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp1_crit"},
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp1_max"},
{ "attr_name": "temp1_input"}
]
}
},
"TEMP7" :
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP7"},
"dev_attr": { "display_name":"CPU_Core_0_temp"},
"i2c":
{
"path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"},
"attr_list":
[
{ "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp2_crit"},
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp2_max"},
{ "attr_name": "temp1_input", "drv_attr_name":"temp2_input"}
]
}
},
"TEMP8" :
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP8"},
"dev_attr": { "display_name":"CPU_Core_1_temp"},
"i2c":
{
"path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"},
"attr_list":
[
{ "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp3_crit"},
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp3_max"},
{ "attr_name": "temp1_input", "drv_attr_name":"temp3_input"}
]
}
},
"TEMP9" :
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP9"},
"dev_attr": { "display_name":"CPU_Core_2_temp"},
"i2c":
{
"path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"},
"attr_list":
[
{ "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp4_crit"},
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp4_max"},
{ "attr_name": "temp1_input", "drv_attr_name":"temp4_input"}
]
}
},
"TEMP10" :
{
"dev_info": { "device_type":"TEMP_SENSOR", "device_name":"TEMP10"},
"dev_attr": { "display_name":"CPU_Core_3_temp"},
"i2c":
{
"path_info": {"sysfs_base_path": "/sys/class/hwmon/hwmon0"},
"attr_list":
[
{ "attr_name": "temp1_high_crit_threshold", "drv_attr_name":"temp5_crit"},
{ "attr_name": "temp1_high_threshold", "drv_attr_name":"temp5_max"},
{ "attr_name": "temp1_input", "drv_attr_name":"temp5_input"}
]
}
},
"SYSSTATUS":
{
"dev_info":{ "device_type":"SYSSTAT", "device_name":"SYSSTATUS"},
@ -1890,12 +1973,12 @@
"LOC_LED":
{
"dev_info": { "device_type":"LED", "device_name":"LOC_LED"},
"dev_attr": { "index":"0"},
"dev_attr": { "index":"0", "flag": "rw"},
"i2c" : {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_BLUE", "descr" : "", "bits" : "7", "value" : "0x0", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"},
{"attr_name":"STATUS_LED_COLOR_OFF", "descr" : "", "bits" : "7", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}
{"attr_name":"blue", "descr" : "", "bits" : "7", "value" : "0x0", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"},
{"attr_name":"off", "descr" : "", "bits" : "7", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}
]
}
},
@ -1903,13 +1986,13 @@
"DIAG_LED":
{
"dev_info": { "device_type":"LED", "device_name":"DIAG_LED"},
"dev_attr": { "index":"0"},
"dev_attr": { "index":"0", "flag": "rw"},
"i2c" : {
"attr_list":
[
{"attr_name":"STATUS_LED_COLOR_GREEN", "descr" : "", "bits" : "1:0", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"},
{"attr_name":"STATUS_LED_COLOR_RED", "descr" : "" ,"bits" : "1:0", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"},
{"attr_name":"STATUS_LED_COLOR_OFF", "descr" : "" ,"bits" : "1:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}
{"attr_name":"green", "descr" : "", "bits" : "1:0", "value" : "0x2", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"},
{"attr_name":"red", "descr" : "" ,"bits" : "1:0", "value" : "0x1", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"},
{"attr_name":"off", "descr" : "" ,"bits" : "1:0", "value" : "0x3", "swpld_addr" : "0x60", "swpld_addr_offset" : "0x41"}
]
}

View File

@ -0,0 +1,902 @@
{
"chassis": {
"name": "7726-32X",
"thermal_manager":false,
"status_led": {
"controllable": true,
"colors": ["green", "red", "off"]
},
"components": [
{
"name": "MB_CPLD1"
},
{
"name": "MB_CPLD2"
},
{
"name": "MB_CPLD3"
},
{
"name": "FAN_CPLD"
},
{
"name": "CPU_CPLD"
},
{
"name": "BIOS"
}
],
"fans": [
{
"name": "FAN-1F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-1R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-2F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-2R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-3F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-3R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-4F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-4R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-5F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-5R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-6F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-6R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
}
],
"fan_drawers":[
{
"name": "FanTray1",
"status_led": {
"controllable": false
},
"num_fans" : 2,
"fans": [
{
"name": "FAN-1F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-1R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
}
]
},
{
"name": "FanTray2",
"status_led": {
"controllable": false
},
"num_fans" : 2,
"fans": [
{
"name": "FAN-2F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-2R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
}
]
},
{
"name": "FanTray3",
"status_led": {
"controllable": false
},
"num_fans" : 2,
"fans": [
{
"name": "FAN-3F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-3R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
}
]
},
{
"name": "FanTray4",
"status_led": {
"controllable": false
},
"num_fans" : 2,
"fans": [
{
"name": "FAN-4F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-4R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
}
]
},
{
"name": "FanTray5",
"status_led": {
"controllable": false
},
"num_fans" : 2,
"fans": [
{
"name": "FAN-5F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-5R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
}
]
},
{
"name": "FanTray6",
"status_led": {
"controllable": false
},
"num_fans" : 2,
"fans": [
{
"name": "FAN-6F",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
},
{
"name": "FAN-6R",
"speed": {
"controllable": true,
"minimum": 32
},
"status_led": {
"controllable": false
}
}
]
}
],
"psus": [
{
"name": "PSU-1",
"status_led": {
"controllable": false
},
"fans": [
{
"name": "PSU-1 FAN-1"
}
],
"thermals": [
{
"name": "PSU-1 temp sensor 1",
"controllable": false,
"low-crit-threshold": false,
"high-crit-threshold": false
}
]
},
{
"name": "PSU-2",
"status_led": {
"controllable": false
},
"fans": [
{
"name": "PSU-2 FAN-1"
}
],
"thermals": [
{
"name": "PSU-2 temp sensor 2",
"controllable": false,
"low-crit-threshold": false,
"high-crit-threshold": false
}
]
}
],
"thermals": [
{
"name": "CB_temp(0x4B)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": false
},
{
"name": "FB_temp(0x4C)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": false
},
{
"name": "MB_FrontMAC_temp(0x49)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": false
},
{
"name": "MB_LeftCenter_temp(0x4A)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": false
},
{
"name": "MB_RearMAC_temp(0x48)",
"controllable": true,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": false
},
{
"name": "CPU_Package_temp",
"controllable": false,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_0_temp",
"controllable": false,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_1_temp",
"controllable": false,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_2_temp",
"controllable": false,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
},
{
"name": "CPU_Core_3_temp",
"controllable": false,
"low-threshold": false,
"high-threshold": true,
"low-crit-threshold": false,
"high-crit-threshold": true
}
],
"sfps": [
{
"name": "Ethernet0"
},
{
"name": "Ethernet4"
},
{
"name": "Ethernet8"
},
{
"name": "Ethernet12"
},
{
"name": "Ethernet16"
},
{
"name": "Ethernet20"
},
{
"name": "Ethernet24"
},
{
"name": "Ethernet28"
},
{
"name": "Ethernet32"
},
{
"name": "Ethernet36"
},
{
"name": "Ethernet40"
},
{
"name": "Ethernet44"
},
{
"name": "Ethernet48"
},
{
"name": "Ethernet52"
},
{
"name": "Ethernet56"
},
{
"name": "Ethernet60"
},
{
"name": "Ethernet64"
},
{
"name": "Ethernet68"
},
{
"name": "Ethernet72"
},
{
"name": "Ethernet76"
},
{
"name": "Ethernet80"
},
{
"name": "Ethernet84"
},
{
"name": "Ethernet88"
},
{
"name": "Ethernet92"
},
{
"name": "Ethernet96"
},
{
"name": "Ethernet100"
},
{
"name": "Ethernet104"
},
{
"name": "Ethernet108"
},
{
"name": "Ethernet112"
},
{
"name": "Ethernet116"
},
{
"name": "Ethernet120"
},
{
"name": "Ethernet124"
}
]
},
"interfaces": {
"Ethernet0": {
"index": "1,1,1,1",
"lanes": "1,2,3,4",
"breakout_modes": {
"1x100G[40G]": ["Eth1(Port1)"],
"2x50G": ["Eth1/1(Port1)", "Eth1/2(Port1)"],
"4x25G": ["Eth1/1(Port1)", "Eth1/2(Port1)", "Eth1/3(Port1)", "Eth1/4(Port1)"],
"4x10G": ["Eth1/1(Port1)", "Eth1/2(Port1)", "Eth1/3(Port1)", "Eth1/4(Port1)"]
}
},
"Ethernet4": {
"index": "2,2,2,2",
"lanes": "5,6,7,8",
"breakout_modes": {
"1x100G[40G]": ["Eth2(Port2)"],
"2x50G": ["Eth2/1(Port2)", "Eth2/2(Port2)"],
"4x25G": ["Eth2/1(Port2)", "Eth2/2(Port2)", "Eth2/3(Port2)", "Eth2/4(Port2)"],
"4x10G": ["Eth2/1(Port2)", "Eth2/2(Port2)", "Eth2/3(Port2)", "Eth2/4(Port2)"]
}
},
"Ethernet8": {
"index": "3,3,3,3",
"lanes": "9,10,11,12",
"breakout_modes": {
"1x100G[40G]": ["Eth3(Port3)"],
"2x50G": ["Eth3/1(Port3)", "Eth3/2(Port3)"],
"4x25G": ["Eth3/1(Port3)", "Eth3/2(Port3)", "Eth3/3(Port3)", "Eth3/4(Port3)"],
"4x10G": ["Eth3/1(Port3)", "Eth3/2(Port3)", "Eth3/3(Port3)", "Eth3/4(Port3)"]
}
},
"Ethernet12": {
"index": "4,4,4,4",
"lanes": "13,14,15,16",
"breakout_modes": {
"1x100G[40G]": ["Eth4(Port4)"],
"2x50G": ["Eth4/1(Port4)", "Eth4/2(Port4)"],
"4x25G": ["Eth4/1(Port4)", "Eth4/2(Port4)", "Eth4/3(Port4)", "Eth4/4(Port4)"],
"4x10G": ["Eth4/1(Port4)", "Eth4/2(Port4)", "Eth4/3(Port4)", "Eth4/4(Port4)"]
}
},
"Ethernet16": {
"index": "5,5,5,5",
"lanes": "17,18,19,20",
"breakout_modes": {
"1x100G[40G]": ["Eth5(Port5)"],
"2x50G": ["Eth5/1(Port5)", "Eth5/2(Port5)"],
"4x25G": ["Eth5/1(Port5)", "Eth5/2(Port5)", "Eth5/3(Port5)", "Eth5/4(Port5)"],
"4x10G": ["Eth5/1(Port5)", "Eth5/2(Port5)", "Eth5/3(Port5)", "Eth5/4(Port5)"]
}
},
"Ethernet20": {
"index": "6,6,6,6",
"lanes": "21,22,23,24",
"breakout_modes": {
"1x100G[40G]": ["Eth6(Port6)"],
"2x50G": ["Eth6/1(Port6)", "Eth6/2(Port6)"],
"4x25G": ["Eth6/1(Port6)", "Eth6/2(Port6)", "Eth6/3(Port6)", "Eth6/4(Port6)"],
"4x10G": ["Eth6/1(Port6)", "Eth6/2(Port6)", "Eth6/3(Port6)", "Eth6/4(Port6)"]
}
},
"Ethernet24": {
"index": "7,7,7,7",
"lanes": "25,26,27,28",
"breakout_modes": {
"1x100G[40G]": ["Eth7(Port7)"],
"2x50G": ["Eth7/1(Port7)", "Eth7/2(Port7)"],
"4x25G": ["Eth7/1(Port7)", "Eth7/2(Port7)", "Eth7/3(Port7)", "Eth7/4(Port7)"],
"4x10G": ["Eth7/1(Port7)", "Eth7/2(Port7)", "Eth7/3(Port7)", "Eth7/4(Port7)"]
}
},
"Ethernet28": {
"index": "8,8,8,8",
"lanes": "29,30,31,32",
"breakout_modes": {
"1x100G[40G]": ["Eth8(Port8)"],
"2x50G": ["Eth8/1(Port8)", "Eth8/2(Port8)"],
"4x25G": ["Eth8/1(Port8)", "Eth8/2(Port8)", "Eth8/3(Port8)", "Eth8/4(Port8)"],
"4x10G": ["Eth8/1(Port8)", "Eth8/2(Port8)", "Eth8/3(Port8)", "Eth8/4(Port8)"]
}
},
"Ethernet32": {
"index": "9,9,9,9",
"lanes": "33,34,35,36",
"breakout_modes": {
"1x100G[40G]": ["Eth9(Port9)"],
"2x50G": ["Eth9/1(Port9)", "Eth9/2(Port9)"],
"4x25G": ["Eth9/1(Port9)", "Eth9/2(Port9)", "Eth9/3(Port9)", "Eth9/4(Port9)"],
"4x10G": ["Eth9/1(Port9)", "Eth9/2(Port9)", "Eth9/3(Port9)", "Eth9/4(Port9)"]
}
},
"Ethernet36": {
"index": "10,10,10,10",
"lanes": "37,38,39,40",
"breakout_modes": {
"1x100G[40G]": ["Eth10(Port10)"],
"2x50G": ["Eth10/1(Port10)", "Eth10/2(Port10)"],
"4x25G": ["Eth10/1(Port10)", "Eth10/2(Port10)", "Eth10/3(Port10)", "Eth10/4(Port10)"],
"4x10G": ["Eth10/1(Port10)", "Eth10/2(Port10)", "Eth10/3(Port10)", "Eth10/4(Port10)"]
}
},
"Ethernet40": {
"index": "11,11,11,11",
"lanes": "41,42,43,44",
"breakout_modes": {
"1x100G[40G]": ["Eth11(Port11)"],
"2x50G": ["Eth11/1(Port11)", "Eth11/2(Port11)"],
"4x25G": ["Eth11/1(Port11)", "Eth11/2(Port11)", "Eth11/3(Port11)", "Eth11/4(Port11)"],
"4x10G": ["Eth11/1(Port11)", "Eth11/2(Port11)", "Eth11/3(Port11)", "Eth11/4(Port11)"]
}
},
"Ethernet44": {
"index": "12,12,12,12",
"lanes": "45,46,47,48",
"breakout_modes": {
"1x100G[40G]": ["Eth12(Port12)"],
"2x50G": ["Eth12/1(Port12)", "Eth12/2(Port12)"],
"4x25G": ["Eth12/1(Port12)", "Eth12/2(Port12)", "Eth12/3(Port12)", "Eth12/4(Port12)"],
"4x10G": ["Eth12/1(Port12)", "Eth12/2(Port12)", "Eth12/3(Port12)", "Eth12/4(Port12)"]
}
},
"Ethernet48": {
"index": "13,13,13,13",
"lanes": "49,50,51,52",
"breakout_modes": {
"1x100G[40G]": ["Eth13(Port13)"],
"2x50G": ["Eth13/1(Port13)", "Eth13/2(Port13)"],
"4x25G": ["Eth13/1(Port13)", "Eth13/2(Port13)", "Eth13/3(Port13)", "Eth13/4(Port13)"],
"4x10G": ["Eth13/1(Port13)", "Eth13/2(Port13)", "Eth13/3(Port13)", "Eth13/4(Port13)"]
}
},
"Ethernet52": {
"index": "14,14,14,14",
"lanes": "53,54,55,56",
"breakout_modes": {
"1x100G[40G]": ["Eth14(Port14)"],
"2x50G": ["Eth14/1(Port14)", "Eth14/2(Port14)"],
"4x25G": ["Eth14/1(Port14)", "Eth14/2(Port14)", "Eth14/3(Port14)", "Eth14/4(Port14)"],
"4x10G": ["Eth14/1(Port14)", "Eth14/2(Port14)", "Eth14/3(Port14)", "Eth14/4(Port14)"]
}
},
"Ethernet56": {
"index": "15,15,15,15",
"lanes": "57,58,59,60",
"breakout_modes": {
"1x100G[40G]": ["Eth15(Port15)"],
"2x50G": ["Eth15/1(Port15)", "Eth15/2(Port15)"],
"4x25G": ["Eth15/1(Port15)", "Eth15/2(Port15)", "Eth15/3(Port15)", "Eth15/4(Port15)"],
"4x10G": ["Eth15/1(Port15)", "Eth15/2(Port15)", "Eth15/3(Port15)", "Eth15/4(Port15)"]
}
},
"Ethernet60": {
"index": "16,16,16,16",
"lanes": "61,62,63,64",
"breakout_modes": {
"1x100G[40G]": ["Eth16(Port16)"],
"2x50G": ["Eth16/1(Port16)", "Eth16/2(Port16)"],
"4x25G": ["Eth16/1(Port16)", "Eth16/2(Port16)", "Eth16/3(Port16)", "Eth16/4(Port16)"],
"4x10G": ["Eth16/1(Port16)", "Eth16/2(Port16)", "Eth16/3(Port16)", "Eth16/4(Port16)"]
}
},
"Ethernet64": {
"index": "17,17,17,17",
"lanes": "65,66,67,68",
"breakout_modes": {
"1x100G[40G]": ["Eth17(Port17)"],
"2x50G": ["Eth17/1(Port17)", "Eth17/2(Port17)"],
"4x25G": ["Eth17/1(Port17)", "Eth17/2(Port17)", "Eth17/3(Port17)", "Eth17/4(Port17)"],
"4x10G": ["Eth17/1(Port17)", "Eth17/2(Port17)", "Eth17/3(Port17)", "Eth17/4(Port17)"]
}
},
"Ethernet68": {
"index": "18,18,18,18",
"lanes": "69,70,71,72",
"breakout_modes": {
"1x100G[40G]": ["Eth18(Port18)"],
"2x50G": ["Eth18/1(Port18)", "Eth18/2(Port18)"],
"4x25G": ["Eth18/1(Port18)", "Eth18/2(Port18)", "Eth18/3(Port18)", "Eth18/4(Port18)"],
"4x10G": ["Eth18/1(Port18)", "Eth18/2(Port18)", "Eth18/3(Port18)", "Eth18/4(Port18)"]
}
},
"Ethernet72": {
"index": "19,19,19,19",
"lanes": "73,74,75,76",
"breakout_modes": {
"1x100G[40G]": ["Eth19(Port19)"],
"2x50G": ["Eth19/1(Port19)", "Eth19/2(Port19)"],
"4x25G": ["Eth19/1(Port19)", "Eth19/2(Port19)", "Eth19/3(Port19)", "Eth19/4(Port19)"],
"4x10G": ["Eth19/1(Port19)", "Eth19/2(Port19)", "Eth19/3(Port19)", "Eth19/4(Port19)"]
}
},
"Ethernet76": {
"index": "20,20,20,20",
"lanes": "77,78,79,80",
"breakout_modes": {
"1x100G[40G]": ["Eth20(Port20)"],
"2x50G": ["Eth20/1(Port20)", "Eth20/2(Port20)"],
"4x25G": ["Eth20/1(Port20)", "Eth20/2(Port20)", "Eth20/3(Port20)", "Eth20/4(Port20)"],
"4x10G": ["Eth20/1(Port20)", "Eth20/2(Port20)", "Eth20/3(Port20)", "Eth20/4(Port20)"]
}
},
"Ethernet80": {
"index": "21,21,21,21",
"lanes": "81,82,83,84",
"breakout_modes": {
"1x100G[40G]": ["Eth21(Port21)"],
"2x50G": ["Eth21/1(Port21)", "Eth21/2(Port21)"],
"4x25G": ["Eth21/1(Port21)", "Eth21/2(Port21)", "Eth21/3(Port21)", "Eth21/4(Port21)"],
"4x10G": ["Eth21/1(Port21)", "Eth21/2(Port21)", "Eth21/3(Port21)", "Eth21/4(Port21)"]
}
},
"Ethernet84": {
"index": "22,22,22,22",
"lanes": "85,86,87,88",
"breakout_modes": {
"1x100G[40G]": ["Eth22(Port22)"],
"2x50G": ["Eth22/1(Port22)", "Eth22/2(Port22)"],
"4x25G": ["Eth22/1(Port22)", "Eth22/2(Port22)", "Eth22/3(Port22)", "Eth22/4(Port22)"],
"4x10G": ["Eth22/1(Port22)", "Eth22/2(Port22)", "Eth22/3(Port22)", "Eth22/4(Port22)"]
}
},
"Ethernet88": {
"index": "23,23,23,23",
"lanes": "89,90,91,92",
"breakout_modes": {
"1x100G[40G]": ["Eth23(Port23)"],
"2x50G": ["Eth23/1(Port23)", "Eth23/2(Port23)"],
"4x25G": ["Eth23/1(Port23)", "Eth23/2(Port23)", "Eth23/3(Port23)", "Eth23/4(Port23)"],
"4x10G": ["Eth23/1(Port23)", "Eth23/2(Port23)", "Eth23/3(Port23)", "Eth23/4(Port23)"]
}
},
"Ethernet92": {
"index": "24,24,24,24",
"lanes": "93,94,95,96",
"breakout_modes": {
"1x100G[40G]": ["Eth24(Port24)"],
"2x50G": ["Eth24/1(Port24)", "Eth24/2(Port24)"],
"4x25G": ["Eth24/1(Port24)", "Eth24/2(Port24)", "Eth24/3(Port24)", "Eth24/4(Port24)"],
"4x10G": ["Eth24/1(Port24)", "Eth24/2(Port24)", "Eth24/3(Port24)", "Eth24/4(Port24)"]
}
},
"Ethernet96": {
"index": "25,25,25,25",
"lanes": "97,98,99,100",
"breakout_modes": {
"1x100G[40G]": ["Eth25(Port25)"],
"2x50G": ["Eth25/1(Port25)", "Eth25/2(Port25)"],
"4x25G": ["Eth25/1(Port25)", "Eth25/2(Port25)", "Eth25/3(Port25)", "Eth25/4(Port25)"],
"4x10G": ["Eth25/1(Port25)", "Eth25/2(Port25)", "Eth25/3(Port25)", "Eth25/4(Port25)"]
}
},
"Ethernet100": {
"index": "26,26,26,26",
"lanes": "101,102,103,104",
"breakout_modes": {
"1x100G[40G]": ["Eth26(Port26)"],
"2x50G": ["Eth26/1(Port26)", "Eth26/2(Port26)"],
"4x25G": ["Eth26/1(Port26)", "Eth26/2(Port26)", "Eth26/3(Port26)", "Eth26/4(Port26)"],
"4x10G": ["Eth26/1(Port26)", "Eth26/2(Port26)", "Eth26/3(Port26)", "Eth26/4(Port26)"]
}
},
"Ethernet104": {
"index": "27,27,27,27",
"lanes": "105,106,107,108",
"breakout_modes": {
"1x100G[40G]": ["Eth27(Port27)"],
"2x50G": ["Eth27/1(Port27)", "Eth27/2(Port27)"],
"4x25G": ["Eth27/1(Port27)", "Eth27/2(Port27)", "Eth27/3(Port27)", "Eth27/4(Port27)"],
"4x10G": ["Eth27/1(Port27)", "Eth27/2(Port27)", "Eth27/3(Port27)", "Eth27/4(Port27)"]
}
},
"Ethernet108": {
"index": "28,28,28,28",
"lanes": "109,110,111,112",
"breakout_modes": {
"1x100G[40G]": ["Eth28(Port28)"],
"2x50G": ["Eth28/1(Port28)", "Eth28/2(Port28)"],
"4x25G": ["Eth28/1(Port28)", "Eth28/2(Port28)", "Eth28/3(Port28)", "Eth28/4(Port28)"],
"4x10G": ["Eth28/1(Port28)", "Eth28/2(Port28)", "Eth28/3(Port28)", "Eth28/4(Port28)"]
}
},
"Ethernet112": {
"index": "29,29,29,29",
"lanes": "113,114,115,116",
"breakout_modes": {
"1x100G[40G]": ["Eth29(Port29)"],
"2x50G": ["Eth29/1(Port29)", "Eth29/2(Port29)"],
"4x25G": ["Eth29/1(Port29)", "Eth29/2(Port29)", "Eth29/3(Port29)", "Eth29/4(Port29)"],
"4x10G": ["Eth29/1(Port29)", "Eth29/2(Port29)", "Eth29/3(Port29)", "Eth29/4(Port29)"]
}
},
"Ethernet116": {
"index": "30,30,30,30",
"lanes": "117,118,119,120",
"breakout_modes": {
"1x100G[40G]": ["Eth30(Port30)"],
"2x50G": ["Eth30/1(Port30)", "Eth30/2(Port30)"],
"4x25G": ["Eth30/1(Port30)", "Eth30/2(Port30)", "Eth30/3(Port30)", "Eth30/4(Port30)"],
"4x10G": ["Eth30/1(Port30)", "Eth30/2(Port30)", "Eth30/3(Port30)", "Eth30/4(Port30)"]
}
},
"Ethernet120": {
"index": "31,31,31,31",
"lanes": "121,122,123,124",
"breakout_modes": {
"1x100G[40G]": ["Eth31(Port31)"],
"2x50G": ["Eth31/1(Port31)", "Eth31/2(Port31)"],
"4x25G": ["Eth31/1(Port31)", "Eth31/2(Port31)", "Eth31/3(Port31)", "Eth31/4(Port31)"],
"4x10G": ["Eth31/1(Port31)", "Eth31/2(Port31)", "Eth31/3(Port31)", "Eth31/4(Port31)"]
}
},
"Ethernet124": {
"index": "32,32,32,32",
"lanes": "125,126,127,128",
"breakout_modes": {
"1x100G[40G]": ["Eth32(Port32)"],
"2x50G": ["Eth32/1(Port32)", "Eth32/2(Port32)"],
"4x25G": ["Eth32/1(Port32)", "Eth32/2(Port32)", "Eth32/3(Port32)", "Eth32/4(Port32)"],
"4x10G": ["Eth32/1(Port32)", "Eth32/2(Port32)", "Eth32/3(Port32)", "Eth32/4(Port32)"]
}
}
}
}

View File

@ -0,0 +1,14 @@
{
"chassis": {
"7726-32X-O-AC-F": {
"component": {
"MB_CPLD1": { },
"MB_CPLD2": { },
"MB_CPLD3": { },
"FAN_CPLD": { },
"CPU_CPLD": { },
"BIOS": { }
}
}
}
}

View File

@ -1,5 +1,4 @@
{
"skip_ledd": true,
"skip_pcied": true
"skip_ledd": true
}

View File

@ -0,0 +1,13 @@
{
"services_to_ignore": [],
"devices_to_ignore": [
"asic"
],
"user_defined_checkers": [],
"polling_interval": 60,
"led_color": {
"fault": "amber",
"normal": "green",
"booting": "off"
}
}

View File

@ -45,7 +45,6 @@ static struct as7726_32x_fan_data *as7726_32x_fan_update_device(struct device *d
static ssize_t fan_show_value(struct device *dev, struct device_attribute *da, char *buf);
static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da,
const char *buf, size_t count);
static ssize_t get_sys_temp(struct device *dev, struct device_attribute *da, char *buf);
/* fan related data, the index should match sysfs_fan_attributes
*/
@ -294,7 +293,7 @@ static ssize_t set_duty_cycle(struct device *dev, struct device_attribute *da,
if (value < 0 || value > FAN_MAX_DUTY_CYCLE)
return -EINVAL;
as7726_32x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */
//as7726_32x_fan_write_value(client, 0x33, 0); /* Disable fan speed watch dog */
as7726_32x_fan_write_value(client, fan_reg[FAN_DUTY_CYCLE_PERCENTAGE], duty_cycle_to_reg_val(value));
return count;
}

View File

@ -8,58 +8,59 @@
try:
import sys
import time
from sonic_platform_pddf_base.pddf_chassis import PddfChassis
from .event import SfpEvent
from .helper import APIHelper
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
NUM_COMPONENT = 6
HOST_REBOOT_CAUSE_PATH = "/host/reboot-cause/"
PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/api_files/reboot-cause/"
REBOOT_CAUSE_FILE = "reboot-cause.txt"
class Chassis(PddfChassis):
"""
PDDF Platform-specific Chassis class
"""
SYSLED_DEV_NAME = "DIAG_LED"
def __init__(self, pddf_data=None, pddf_plugin_data=None):
PddfChassis.__init__(self, pddf_data, pddf_plugin_data)
self.__initialize_components()
self._api_helper = APIHelper()
self._sfpevent = SfpEvent(self.get_all_sfps())
def __initialize_components(self):
from sonic_platform.component import Component
for index in range(NUM_COMPONENT):
component = Component(index)
self._component_list.append(component)
# Provide the functions/variables below for which implementation is to be overwritten
sfp_change_event_data = {'valid': 0, 'last': 0, 'present': 0}
def get_change_event(self, timeout=2000):
now = time.time()
port_dict = {}
change_dict = {}
change_dict['sfp'] = port_dict
def get_change_event(self, timeout=0):
return self._sfpevent.get_sfp_event(timeout)
if timeout < 1000:
timeout = 1000
timeout = timeout / float(1000) # Convert to secs
def get_reboot_cause(self):
"""
Retrieves the cause of the previous reboot
if now < (self.sfp_change_event_data['last'] + timeout) and self.sfp_change_event_data['valid']:
return True, change_dict
bitmap = 0
for i in range(34):
modpres = self.get_sfp(i+1).get_presence()
if modpres:
bitmap = bitmap | (1 << i)
Returns:
A tuple (string, string) where the first element is a string
containing the cause of the previous reboot. This string must be
one of the predefined strings in this class. If the first string
is "REBOOT_CAUSE_HARDWARE_OTHER", the second string can be used
to pass a description of the reboot cause.
"""
changed_ports = self.sfp_change_event_data['present'] ^ bitmap
if changed_ports:
for i in range(34):
if (changed_ports & (1 << i)):
if (bitmap & (1 << i)) == 0:
port_dict[i+1] = '0'
else:
port_dict[i+1] = '1'
reboot_cause_path = (HOST_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE)
sw_reboot_cause = self._api_helper.read_txt_file(
reboot_cause_path) or "Unknown"
# Update teh cache dict
self.sfp_change_event_data['present'] = bitmap
self.sfp_change_event_data['last'] = now
self.sfp_change_event_data['valid'] = 1
return True, change_dict
else:
return True, change_dict
return ('REBOOT_CAUSE_NON_HARDWARE', sw_reboot_cause)
def get_sfp(self, index):
@ -84,3 +85,48 @@ class Chassis(PddfChassis):
sys.stderr.write("SFP index {} out of range (1-{})\n".format(
index, len(self._sfp_list)))
return sfp
def initizalize_system_led(self):
return
def get_status_led(self):
return self.get_system_led(self.SYSLED_DEV_NAME)
def set_status_led(self, color):
return self.set_system_led(self.SYSLED_DEV_NAME, color)
def get_port_or_cage_type(self, port):
from sonic_platform_base.sfp_base import SfpBase
if port in range(1, 32):
return SfpBase.SFP_PORT_TYPE_BIT_QSFP | SfpBase.SFP_PORT_TYPE_BIT_QSFP_PLUS | SfpBase.SFP_PORT_TYPE_BIT_QSFP28
else:
return SfpBase.SFP_PORT_TYPE_BIT_SFP | SfpBase.SFP_PORT_TYPE_BIT_SFP_PLUS
def get_position_in_parent(self):
"""
Retrieves 1-based relative physical position in parent device.
If the agent cannot determine the parent-relative position
for some reason, or if the associated value of
entPhysicalContainedIn is'0', then the value '-1' is returned
Returns:
integer: The 1-based relative physical position in parent device
or -1 if cannot determine the position
"""
return -1
def is_replaceable(self):
"""
Indicate whether this device is replaceable.
Returns:
bool: True if it is replaceable.
"""
return False
def get_revision(self):
"""
Retrieves the hardware revision of the device
Returns:
string: Revision value of device
"""
return self._eeprom.revision_str()

View File

@ -0,0 +1,191 @@
#############################################################################
#
# Component contains an implementation of SONiC Platform Base API and
# provides the components firmware management function
#
#############################################################################
try:
import os
import json
from sonic_platform_base.component_base import ComponentBase
from sonic_py_common.general import getstatusoutput_noshell
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
CPLD_ADDR_MAPPING = {
"MB_CPLD1": ['11', '0x60'],
"MB_CPLD2": ['12', '0x62'],
"MB_CPLD3": ['13', '0x64'],
"FAN_CPLD": ['54', '0x66'],
"CPU_CPLD": ['0', '0x65'],
}
SYSFS_PATH = "/sys/bus/i2c/devices/"
BIOS_VERSION_PATH = "/sys/class/dmi/id/bios_version"
COMPONENT_LIST= [
("MB_CPLD1", "Mainboard CPLD(0x60)"),
("MB_CPLD2", "Mainboard CPLD(0x62)"),
("MB_CPLD3", "Mainboard CPLD(0x64)"),
("FAN_CPLD", "Fan board CPLD(0x66)"),
("CPU_CPLD", "CPU CPLD(0x65)"),
("BIOS", "Basic Input/Output System")
]
class Component(ComponentBase):
"""Platform-specific Component class"""
DEVICE_TYPE = "component"
def __init__(self, component_index=0):
self.index = component_index
self.name = self.get_name()
def __get_bios_version(self):
# Retrieves the BIOS firmware version
try:
with open(BIOS_VERSION_PATH, 'r') as fd:
bios_version = fd.read()
return bios_version.strip()
except Exception as e:
return None
def __get_cpld_version(self):
# Retrieves the CPLD firmware version
cpld_version = dict()
for cpld_name in CPLD_ADDR_MAPPING:
cmd = ["i2cget", "-f", "-y", CPLD_ADDR_MAPPING[cpld_name][0], CPLD_ADDR_MAPPING[cpld_name][1], "0x1"]
status, value = getstatusoutput_noshell(cmd)
if not status:
cpld_version_raw = value.rstrip()
cpld_version[cpld_name] = "{}".format(int(cpld_version_raw,16))
return cpld_version
def get_name(self):
"""
Retrieves the name of the component
Returns:
A string containing the name of the component
"""
return COMPONENT_LIST[self.index][0]
def get_description(self):
"""
Retrieves the description of the component
Returns:
A string containing the description of the component
"""
return COMPONENT_LIST[self.index][1]
def get_firmware_version(self):
"""
Retrieves the firmware version of module
Returns:
string: The firmware versions of the module
"""
fw_version = None
if self.name == "BIOS":
fw_version = self.__get_bios_version()
elif "CPLD" in self.name:
cpld_version = self.__get_cpld_version()
fw_version = cpld_version.get(self.name)
return fw_version
def install_firmware(self, image_path):
"""
Install firmware to module
Args:
image_path: A string, path to firmware image
Returns:
A boolean, True if install successfully, False if not
"""
ret, output = getstatusoutput_noshell(["tar", "-C", "/tmp", "-xzf", image_path ] )
if ret != 0 :
print("Installation failed because of wrong image package")
return False
if False == os.path.exists("/tmp/install.json") :
print("Installation failed without jsonfile")
return False
input_file = open ('/tmp/install.json')
json_array = json.load(input_file)
ret = 1
for item in json_array:
if item.get('id')==None or item.get('path')==None:
continue
if self.name == item['id'] and item['path'] and item.get('cpu'):
print( "Find", item['id'], item['path'], item['cpu'] )
ret, output = getstatusoutput_noshell(["/tmp/run_install.sh", item['id'], item['path'], item['cpu'] ])
if ret==0:
break
elif self.name == item['id'] and item['path']:
print( "Find", item['id'], item['path'] )
ret, output = getstatusoutput_noshell(["/tmp/run_install.sh", item['id'], item['path'] ])
if ret==0:
break
if ret==0:
return True
else :
return False
def get_presence(self):
"""
Retrieves the presence of the device
Returns:
bool: True if device is present, False if not
"""
return True
def get_model(self):
"""
Retrieves the model number (or part number) of the device
Returns:
string: Model/part number of device
"""
return 'N/A'
def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
return 'N/A'
def get_status(self):
"""
Retrieves the operational status of the device
Returns:
A boolean value, True if device is operating properly, False if not
"""
return True
def get_position_in_parent(self):
"""
Retrieves 1-based relative physical position in parent device.
If the agent cannot determine the parent-relative position
for some reason, or if the associated value of
entPhysicalContainedIn is'0', then the value '-1' is returned
Returns:
integer: The 1-based relative physical position in parent device
or -1 if cannot determine the position
"""
return -1
def is_replaceable(self):
"""
Indicate whether this device is replaceable.
Returns:
bool: True if it is replaceable.
"""
return False

View File

@ -0,0 +1,109 @@
try:
import time
from sonic_py_common.logger import Logger
from .sfp import Sfp
except ImportError as e:
raise ImportError(repr(e) + " - required module not found")
POLL_INTERVAL_IN_SEC = 1
# SFP errors that will block eeprom accessing
SFP_BLOCKING_ERRORS = [
Sfp.SFP_ERROR_BIT_I2C_STUCK,
Sfp.SFP_ERROR_BIT_BAD_EEPROM,
Sfp.SFP_ERROR_BIT_UNSUPPORTED_CABLE,
Sfp.SFP_ERROR_BIT_HIGH_TEMP,
Sfp.SFP_ERROR_BIT_BAD_CABLE
]
class SfpEvent:
''' Listen to insert/remove sfp events '''
def __init__(self, sfp_list):
self._sfp_list = sfp_list
self._logger = Logger()
self._sfp_change_event_data = {'present': 0}
def get_presence_bitmap(self):
bitmap = 0
for sfp in self._sfp_list:
modpres = sfp.get_presence()
i=sfp.get_position_in_parent() - 1
if modpres:
bitmap = bitmap | (1 << i)
return bitmap
def get_sfp_event(self, timeout=2000):
port_dict = {}
change_dict = {}
change_dict['sfp'] = port_dict
if timeout < 1000:
cd_ms = 1000
else:
cd_ms = timeout
while cd_ms > 0:
bitmap = self.get_presence_bitmap()
changed_ports = self._sfp_change_event_data['present'] ^ bitmap
if changed_ports != 0:
break
time.sleep(POLL_INTERVAL_IN_SEC)
# timeout=0 means wait for event forever
if timeout != 0:
cd_ms = cd_ms - POLL_INTERVAL_IN_SEC * 1000
if changed_ports != 0:
for sfp in self._sfp_list:
i=sfp.get_position_in_parent() - 1
if (changed_ports & (1 << i)) == 0:
continue
if (bitmap & (1 << i)) == 0:
port_dict[i+1] = '0'
else:
# sfp.refresh_optoe_dev_class()
sfp_state_bits = self.get_sfp_state_bits(sfp, True)
sfp_state_bits = self.check_sfp_blocking_errors(sfp_state_bits)
port_dict[i+1] = str(sfp_state_bits)
# Update the cache dict
self._sfp_change_event_data['present'] = bitmap
return True, change_dict
else:
return True, change_dict
def get_sfp_state_bits(self, sfp, present):
sfp_state_bits = 0
if present is True:
sfp_state_bits |= Sfp.SFP_STATUS_BIT_INSERTED
else:
return sfp_state_bits
status = sfp.validate_eeprom()
if status is None:
sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK
return sfp_state_bits
elif status is not True:
sfp_state_bits |= Sfp.SFP_ERROR_BIT_BAD_EEPROM
return sfp_state_bits
status = sfp.validate_temperature()
if status is None:
sfp_state_bits |= Sfp.SFP_ERROR_BIT_I2C_STUCK
return sfp_state_bits
elif status is not True:
sfp_state_bits |= Sfp.SFP_ERROR_BIT_HIGH_TEMP
return sfp_state_bits
return sfp_state_bits
def check_sfp_blocking_errors(self, sfp_state_bits):
for i in SFP_BLOCKING_ERRORS:
if (i & sfp_state_bits) == 0:
continue
sfp_state_bits |= Sfp.SFP_ERROR_BIT_BLOCKING
return sfp_state_bits

View File

@ -6,6 +6,9 @@ try:
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
FAN_NAME_LIST = ["FAN-1F", "FAN-1R", "FAN-2F", "FAN-2R",
"FAN-3F", "FAN-3R", "FAN-4F", "FAN-4R",
"FAN-5F", "FAN-5R", "FAN-6F", "FAN-6R"]
class Fan(PddfFan):
"""PDDF Platform-Specific Fan class"""
@ -15,5 +18,61 @@ class Fan(PddfFan):
PddfFan.__init__(self, tray_idx, fan_idx, pddf_data, pddf_plugin_data, is_psu_fan, psu_index)
# Provide the functions/variables below for which implementation is to be overwritten
# Since AS4630 psu_fan airflow direction cant be read from sysfs, it is fixed as 'F2B' or 'intake'
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
fan_name = FAN_NAME_LIST[(self.fantray_index-1)*2 + self.fan_index-1] \
if not self.is_psu_fan \
else "PSU-{} FAN-{}".format(self.fans_psu_index, self.fan_index)
return fan_name
def get_model(self):
"""
Retrieves the model number (or part number) of the device
Returns:
string: Model/part number of device
"""
return "N/A"
def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
return "N/A"
def get_target_speed(self):
"""
Retrieves the target (expected) speed of the fan
Returns:
An integer, the percentage of full fan speed, in the range 0 (off)
to 100 (full speed)
"""
if self.is_psu_fan:
return super().get_speed()
else:
return super().get_target_speed()
def get_direction(self):
"""
Retrieves the direction of fan
Returns:
A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST
depending on fan direction
"""
direction = super().get_direction()
if direction is not None and len(direction) > 0:
return direction
return 'N/A'

View File

@ -15,3 +15,27 @@ class FanDrawer(PddfFanDrawer):
PddfFanDrawer.__init__(self, tray_idx, pddf_data, pddf_plugin_data)
# Provide the functions/variables below for which implementation is to be overwritten
def get_name(self):
"""
Retrieves the fan drawer name
Returns:
string: The name of the device
"""
return "FanTray{}".format(self.fantray_index)
def get_model(self):
"""
Retrieves the model number (or part number) of the device
Returns:
string: Model/part number of device
"""
return self._fan_list[0].get_model()
def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
return self._fan_list[0].get_serial()

View File

@ -0,0 +1,368 @@
import os
import struct
import json
import fcntl
from mmap import *
from sonic_py_common import device_info
from sonic_py_common import logger
from threading import Lock
from typing import cast
from sonic_py_common.general import getstatusoutput_noshell_pipe
from sonic_py_common.general import getstatusoutput_noshell
HOST_CHK_CMD = ["docker"]
EMPTY_STRING = ""
class APIHelper():
def __init__(self):
(self.platform, self.hwsku) = device_info.get_platform_and_hwsku()
def is_host(self):
try:
status, output = getstatusoutput_noshell(HOST_CHK_CMD)
return status == 0
except Exception:
return False
def pci_get_value(self, resource, offset):
status = True
result = ""
try:
fd = os.open(resource, os.O_RDWR)
mm = mmap(fd, 0)
mm.seek(int(offset))
read_data_stream = mm.read(4)
result = struct.unpack('I', read_data_stream)
except Exception:
status = False
return status, result
def run_interactive_command(self, cmd):
try:
os.system(cmd)
except Exception:
return False
return True
def read_txt_file(self, file_path):
try:
with open(file_path, 'r', errors='replace') as fd:
data = fd.read()
ret = data.strip()
if len(ret) > 0:
return ret
except IOError:
pass
return None
def write_txt_file(self, file_path, value):
try:
with open(file_path, 'w') as fd:
fd.write(str(value))
except IOError:
return False
return True
def ipmi_raw(self, netfn, cmd):
status = True
result = ""
try:
err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'raw', str(netfn), str(cmd)])
if err == [0]:
result = raw_data.strip()
else:
status = False
except Exception:
status = False
return status, result
def ipmi_fru_id(self, id, key=None):
status = True
result = ""
try:
if (key is None):
err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)])
else:
err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'fru', 'print', str(id)], ['grep', str(key)])
if err == [0] or err == [0, 0]:
result = raw_data.strip()
else:
status = False
except Exception:
status = False
return status, result
def ipmi_set_ss_thres(self, id, threshold_key, value):
status = True
result = ""
try:
err, raw_data = getstatusoutput_noshell_pipe(['ipmitool', 'sensor', 'thresh', str(id), str(threshold_key), str(value)])
if err == [0]:
result = raw_data.strip()
else:
status = False
except Exception:
status = False
return status, result
class FileLock:
"""
Due to pmon docker not installing the py-filelock, this class
implements a simple file lock feature.
Ref: https://github.com/tox-dev/py-filelock/blob/main/src/filelock/
"""
def __init__(self, lock_file):
self._lock_file = lock_file
self._thread_lock = Lock()
self.is_locked = False
def acquire(self):
with self._thread_lock:
if self.is_locked:
return
fd = os.open(self._lock_file, flags=(os.O_RDWR | os.O_CREAT | os.O_TRUNC))
fcntl.flock(fd, fcntl.LOCK_EX)
self._lock_file_fd = fd
self.is_locked = True
def release(self):
with self._thread_lock:
if self.is_locked:
fd = cast(int, self._lock_file_fd)
self._lock_file_fd = None
fcntl.flock(fd, fcntl.LOCK_UN)
os.close(fd)
self.is_locked = False
def __enter__(self):
self.acquire()
return self
def __exit__(self, exc_type, exc_val, traceback):
self.release()
def __del__(self):
self.release()
DEVICE_THRESHOLD_JSON_PATH = "/tmp/device_threshold.json"
class DeviceThreshold:
HIGH_THRESHOLD = 'high_threshold'
LOW_THRESHOLD = 'low_threshold'
HIGH_CRIT_THRESHOLD = 'high_critical_threshold'
LOW_CRIT_THRESHOLD = 'low_critical_threshold'
NOT_AVAILABLE = 'N/A'
def __init__(self, th_name = NOT_AVAILABLE):
self.flock = FileLock("{}.lock".format(DEVICE_THRESHOLD_JSON_PATH))
self.name = th_name
self.__log = logger.Logger(log_identifier="DeviceThreshold")
self.__db_data = {}
self.__db_mtime = 0
def __reload_db(self):
try:
db_data = {}
with self.flock:
with open(DEVICE_THRESHOLD_JSON_PATH, "r") as db_file:
db_data = json.load(db_file)
except Exception as e:
self.__log.log_warning('{}'.format(str(e)))
return None
return db_data
def __get_data(self, field):
"""
Retrieves data frome JSON file by field
Args :
field: String
Returns:
A string if getting is successfully, 'N/A' if not
"""
if os.path.exists(DEVICE_THRESHOLD_JSON_PATH):
new_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH)
if new_mtime != self.__db_mtime:
new_data = self.__reload_db()
if new_data is not None:
self.__db_data = new_data
self.__db_mtime = new_mtime
if self.name not in self.__db_data.keys():
return self.NOT_AVAILABLE
if field not in self.__db_data[self.name].keys():
return self.NOT_AVAILABLE
return self.__db_data[self.name][field]
def __set_data(self, field, new_val):
"""
Set data to JSON file by field
Args :
field: String
new_val: String
Returns:
A boolean, True if setting is set successfully, False if not
"""
if self.name not in self.__db_data.keys():
self.__db_data[self.name] = {}
old_val = self.__db_data[self.name].get(field, None)
if old_val is not None and old_val == new_val:
return True
self.__db_data[self.name][field] = new_val
try:
with self.flock:
db_data = {}
mode = "r+" if os.path.exists(DEVICE_THRESHOLD_JSON_PATH) else "w+"
with open(DEVICE_THRESHOLD_JSON_PATH, mode) as db_file:
if mode == "r+":
db_data = json.load(db_file)
if self.name not in db_data.keys():
db_data[self.name] = {}
db_data[self.name][field] = new_val
if mode == "r+":
db_file.seek(0)
# erase old data
db_file.truncate(0)
# write all data
json.dump(db_data, db_file, indent=4)
self.__db_mtime = os.path.getmtime(DEVICE_THRESHOLD_JSON_PATH)
except Exception as e:
self.__log.log_error('{}'.format(str(e)))
return False
return True
def get_high_threshold(self):
"""
Retrieves the high threshold temperature from JSON file.
Returns:
string : the high threshold temperature of thermal,
e.g. "30.125"
"""
return self.__get_data(self.HIGH_THRESHOLD)
def set_high_threshold(self, temperature):
"""
Sets the high threshold temperature of thermal
Args :
temperature: A string of temperature, e.g. "30.125"
Returns:
A boolean, True if threshold is set successfully, False if not
"""
if isinstance(temperature, str) is not True:
raise TypeError('The parameter requires string type.')
try:
if temperature != self.NOT_AVAILABLE:
float(temperature)
except ValueError:
raise ValueError('The parameter requires a float string. ex:\"30.1\"')
return self.__set_data(self.HIGH_THRESHOLD, temperature)
def get_low_threshold(self):
"""
Retrieves the low threshold temperature from JSON file.
Returns:
string : the low threshold temperature of thermal,
e.g. "30.125"
"""
return self.__get_data(self.LOW_THRESHOLD)
def set_low_threshold(self, temperature):
"""
Sets the low threshold temperature of thermal
Args :
temperature: A string of temperature, e.g. "30.125"
Returns:
A boolean, True if threshold is set successfully, False if not
"""
if isinstance(temperature, str) is not True:
raise TypeError('The parameter requires string type.')
try:
if temperature != self.NOT_AVAILABLE:
float(temperature)
except ValueError:
raise ValueError('The parameter requires a float string. ex:\"30.1\"')
return self.__set_data(self.LOW_THRESHOLD, temperature)
def get_high_critical_threshold(self):
"""
Retrieves the high critical threshold temperature from JSON file.
Returns:
string : the high critical threshold temperature of thermal,
e.g. "30.125"
"""
return self.__get_data(self.HIGH_CRIT_THRESHOLD)
def set_high_critical_threshold(self, temperature):
"""
Sets the high critical threshold temperature of thermal
Args :
temperature: A string of temperature, e.g. "30.125"
Returns:
A boolean, True if threshold is set successfully, False if not
"""
if isinstance(temperature, str) is not True:
raise TypeError('The parameter requires string type.')
try:
if temperature != self.NOT_AVAILABLE:
float(temperature)
except ValueError:
raise ValueError('The parameter requires a float string. ex:\"30.1\"')
return self.__set_data(self.HIGH_CRIT_THRESHOLD, temperature)
def get_low_critical_threshold(self):
"""
Retrieves the low critical threshold temperature from JSON file.
Returns:
string : the low critical threshold temperature of thermal,
e.g. "30.125"
"""
return self.__get_data(self.LOW_CRIT_THRESHOLD)
def set_low_critical_threshold(self, temperature):
"""
Sets the low critical threshold temperature of thermal
Args :
temperature: A string of temperature, e.g. "30.125"
Returns:
A boolean, True if threshold is set successfully, False if not
"""
if isinstance(temperature, str) is not True:
raise TypeError('The parameter requires string type.')
try:
if temperature != self.NOT_AVAILABLE:
float(temperature)
except ValueError:
raise ValueError('The parameter requires a float string. ex:\"30.1\"')
return self.__set_data(self.LOW_CRIT_THRESHOLD, temperature)

View File

@ -0,0 +1,19 @@
#############################################################################
# Edgecore
#
# Module contains an implementation of SONiC Platform Base API and
# provides the fan status which are available in the platform
# Base PCIe class
#############################################################################
try:
from sonic_platform_base.sonic_pcie.pcie_common import PcieUtil
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
class Pcie(PcieUtil):
"""Edgecore Platform-specific PCIe class"""
def __init__(self, platform_path):
PcieUtil.__init__(self, platform_path)

View File

@ -11,34 +11,120 @@ except ImportError as e:
class Psu(PddfPsu):
"""PDDF Platform-Specific PSU class"""
PLATFORM_PSU_CAPACITY = 1200
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfPsu.__init__(self, index, pddf_data, pddf_plugin_data)
# Provide the functions/variables below for which implementation is to be overwritten
def get_maximum_supplied_power(self):
def get_voltage_high_threshold(self):
"""
Retrieves the maximum supplied power by PSU (or PSU capacity)
Retrieves the high threshold PSU voltage output
Returns:
A float number, the maximum power output in Watts.
e.g. 1200.1
A float number, the high threshold output voltage in volts,
e.g. 12.1
"""
return float(self.PLATFORM_PSU_CAPACITY)
return 14.72
def get_capacity(self):
def get_voltage_low_threshold(self):
"""
Gets the capacity (maximum output power) of the PSU in watts
Retrieves the low threshold PSU voltage output
Returns:
A float number, the low threshold output voltage in volts,
e.g. 12.1
"""
return 7.68
def get_name(self):
return "PSU-{}".format(self.psu_index)
def get_temperature_high_threshold(self):
"""
Retrieves the high threshold temperature of PSU
Returns:
A float number, the high threshold temperature of PSU in Celsius
up to nearest thousandth of one degree Celsius, e.g. 30.125
"""
threshold = super().get_temperature_high_threshold()
for psu_thermal_idx in range(self.num_psu_thermals):
try:
tmp = self._thermal_list[psu_thermal_idx].get_high_threshold()
if threshold > tmp or threshold == 0.0:
threshold = tmp
except Exception:
pass
return threshold
def get_revision(self):
"""
Retrieves the hardware revision of the device
Returns:
An integer, the capacity of PSU
string: Revision value of device
"""
return (self.PLATFORM_PSU_CAPACITY)
return 'N/A'
def get_type(self):
def get_model(self):
"""
Gets the type of the PSU
Retrieves the model number (or part number) of the device
Returns:
A string, the type of PSU (AC/DC)
string: Model/part number of device
"""
return "AC"
model = super().get_model()
if model and model.strip() == "":
return None
return model
def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
serial = super().get_serial()
if serial and serial.strip() == "":
return None
return serial
def get_voltage(self):
"""
Retrieves current PSU voltage output
Returns:
A float number, the output voltage in volts,
e.g. 12.1
"""
if self.get_status() is not True:
return 0.0
return super().get_voltage()
def get_current(self):
"""
Retrieves present electric current supplied by PSU
Returns:
A float number, electric current in amperes,
e.g. 15.4
"""
if self.get_status() is not True:
return 0.0
return super().get_current()
def get_power(self):
"""
Retrieves current energy supplied by PSU
Returns:
A float number, the power in watts,
e.g. 302.6
"""
if self.get_status() is not True:
return 0.0
return super().get_power()

View File

@ -1,7 +1,10 @@
#!/usr/bin/env python
try:
import natsort
from sonic_platform_pddf_base.pddf_sfp import PddfSfp
from sonic_platform_base.sonic_sfp.sfputilhelper import SfpUtilHelper
from sonic_py_common import device_info
except ImportError as e:
raise ImportError (str(e) + "- required module not found")
@ -11,7 +14,180 @@ class Sfp(PddfSfp):
PDDF Platform-Specific Sfp class
"""
SFP_TYPE_CODE_LIST = [
0x03, # SFP/SFP+/SFP28
0x0b # DWDM-SFP/SFP+
]
QSFP_TYPE_CODE_LIST = [
0x0c, # QSFP
0x0d, # QSFP+ or later
0x11, # QSFP28 or later
0xe1 # QSFP28 EDFA
]
def __init__(self, index, pddf_data=None, pddf_plugin_data=None):
PddfSfp.__init__(self, index, pddf_data, pddf_plugin_data)
self.index = self.port_index
# Provide the functions/variables below for which implementation is to be overwritten
def __get_path_to_port_config_file(self):
platform, hwsku = device_info.get_platform_and_hwsku()
hwsku_path = "/".join(["/usr/share/sonic/platform",hwsku])
return "/".join([hwsku_path, "port_config.ini"])
def get_name(self):
"""
Retrieves the name of the device
Returns:
string: The name of the device
"""
sfputil_helper = SfpUtilHelper()
sfputil_helper.read_porttab_mappings(
self.__get_path_to_port_config_file())
logical_port_list = sfputil_helper.logical
logical_port_list = natsort.natsorted(logical_port_list)
name = logical_port_list[self.port_index-1] or "Unknown"
return name
def __validate_eeprom_sfp(self):
checksum_test = 0
eeprom_raw = self.read_eeprom(0, 96)
if eeprom_raw is None:
return None
for i in range(0, 63):
checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF
else:
if checksum_test != eeprom_raw[63]:
return False
checksum_test = 0
for i in range(64, 95):
checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF
else:
if checksum_test != eeprom_raw[95]:
return False
api = self.get_xcvr_api()
if api is None:
return False
if api.is_flat_memory():
return True
checksum_test = 0
eeprom_raw = self.read_eeprom(384, 96)
if eeprom_raw is None:
return None
for i in range(0, 95):
checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF
else:
if checksum_test != eeprom_raw[95]:
return False
return True
def __validate_eeprom_qsfp(self):
checksum_test = 0
eeprom_raw = self.read_eeprom(128, 96)
if eeprom_raw is None:
return None
for i in range(0, 63):
checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF
else:
if checksum_test != eeprom_raw[63]:
return False
checksum_test = 0
for i in range(64, 95):
checksum_test = (checksum_test + eeprom_raw[i]) & 0xFF
else:
if checksum_test != eeprom_raw[95]:
return False
api = self.get_xcvr_api()
if api is None:
return False
if api.is_flat_memory():
return True
return True
def validate_eeprom(self):
id_byte_raw = self.read_eeprom(0, 1)
if id_byte_raw is None:
return None
id = id_byte_raw[0]
if id in self.QSFP_TYPE_CODE_LIST:
return self.__validate_eeprom_qsfp()
elif id in self.SFP_TYPE_CODE_LIST:
return self.__validate_eeprom_sfp()
else:
return False
def validate_temperature(self):
temperature = self.get_temperature()
if temperature is None:
return None
threshold_dict = self.get_transceiver_threshold_info()
if threshold_dict is None:
return None
if isinstance(temperature, float) is not True:
return True
if isinstance(threshold_dict['temphighalarm'], float) is not True:
return True
return threshold_dict['temphighalarm'] > temperature
def __get_error_description(self):
if not self.get_presence():
return self.SFP_STATUS_UNPLUGGED
err_stat = self.SFP_STATUS_BIT_INSERTED
status = self.validate_eeprom()
if status is not True:
err_stat = (err_stat | self.SFP_ERROR_BIT_BAD_EEPROM)
status = self.validate_temperature()
if status is not True:
err_stat = (err_stat | self.SFP_ERROR_BIT_HIGH_TEMP)
if err_stat is self.SFP_STATUS_BIT_INSERTED:
return self.SFP_STATUS_OK
else:
err_desc = ''
cnt = 0
for key in self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT:
if (err_stat & key) != 0:
if cnt > 0:
err_desc = err_desc + "|"
cnt = cnt + 1
err_desc = err_desc + self.SFP_ERROR_BIT_TO_DESCRIPTION_DICT[key].replace(" ", "_")
return err_desc
def get_error_description(self):
"""
Retrives the error descriptions of the SFP module
Returns:
String that represents the current error descriptions of vendor specific errors
In case there are multiple errors, they should be joined by '|',
like: "Bad EEPROM|Unsupported cable"
"""
try:
ret = super().get_error_description()
if ret is not None:
return ret
except NotImplementedError:
pass
return self.__get_error_description()

View File

@ -3,15 +3,294 @@
try:
from sonic_platform_pddf_base.pddf_thermal import PddfThermal
from .helper import DeviceThreshold
except ImportError as e:
raise ImportError(str(e) + "- required module not found")
NOT_AVAILABLE = DeviceThreshold.NOT_AVAILABLE
HIGH_THRESHOLD = DeviceThreshold.HIGH_THRESHOLD
LOW_THRESHOLD = DeviceThreshold.LOW_THRESHOLD
HIGH_CRIT_THRESHOLD = DeviceThreshold.HIGH_CRIT_THRESHOLD
LOW_CRIT_THRESHOLD = DeviceThreshold.LOW_CRIT_THRESHOLD
DEFAULT_THRESHOLD = {
'CB_temp(0x4B)' : {
HIGH_THRESHOLD : '80.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : NOT_AVAILABLE,
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
},
'FB_temp(0x4C)' : {
HIGH_THRESHOLD : '80.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : NOT_AVAILABLE,
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
},
'MB_FrontMAC_temp(0x49)' : {
HIGH_THRESHOLD : '80.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : NOT_AVAILABLE,
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
},
'MB_LeftCenter_temp(0x4A)' : {
HIGH_THRESHOLD : '80.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : NOT_AVAILABLE,
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
},
'MB_RearMAC_temp(0x48)' : {
HIGH_THRESHOLD : '80.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : NOT_AVAILABLE,
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
},
'CPU_Package_temp' : {
HIGH_THRESHOLD : '82.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : '104.0',
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
},
'CPU_Core_0_temp' : {
HIGH_THRESHOLD : '82.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : '104.0',
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
},
'CPU_Core_1_temp' : {
HIGH_THRESHOLD : '82.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : '104.0',
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
},
'CPU_Core_2_temp' : {
HIGH_THRESHOLD : '82.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : '104.0',
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
},
'CPU_Core_3_temp' : {
HIGH_THRESHOLD : '82.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : '104.0',
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
},
'PSU-1 temp sensor 1' : {
HIGH_THRESHOLD : '80.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : NOT_AVAILABLE,
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
},
'PSU-2 temp sensor 1' : {
HIGH_THRESHOLD : '80.0',
LOW_THRESHOLD : NOT_AVAILABLE,
HIGH_CRIT_THRESHOLD : NOT_AVAILABLE,
LOW_CRIT_THRESHOLD : NOT_AVAILABLE
}
}
class Thermal(PddfThermal):
"""PDDF Platform-Specific Thermal class"""
def __init__(self, index, pddf_data=None, pddf_plugin_data=None, is_psu_thermal=False, psu_index=0):
PddfThermal.__init__(self, index, pddf_data, pddf_plugin_data, is_psu_thermal, psu_index)
# Threshold Configuration
self.__conf = DeviceThreshold(self.get_name())
# Default threshold.
self.__default_threshold = DEFAULT_THRESHOLD[self.get_name()]
self.min_temperature = None
self.max_temperature = None
self.pddf_obj = pddf_data
self.thermal_obj_name = "TEMP{}".format(self.thermal_index)
self.thermal_obj = self.pddf_obj.data[self.thermal_obj_name]
# Provide the functions/variables below for which implementation is to be overwritten
def get_name(self):
if self.is_psu_thermal:
return "PSU-{0} temp sensor 1".format(self.thermals_psu_index)
else:
if 'dev_attr' in self.thermal_obj.keys():
if 'display_name' in self.thermal_obj['dev_attr']:
return str(self.thermal_obj['dev_attr']['display_name'])
# In case of errors
return "Temp sensor {0}".format(self.thermal_index)
def get_status(self):
get_temp=self.get_temperature()
if get_temp is not None:
return True if get_temp else False
def get_temperature(self):
current = super().get_temperature()
if self.min_temperature is None or \
current < self.min_temperature:
self.min_temperature = current
if self.max_temperature is None or \
current > self.max_temperature:
self.max_temperature = current
return current
def set_high_threshold(self, temperature):
try:
value = float(temperature)
except Exception:
return False
# The new value can not be more than the default value.
default_value = self.__default_threshold[HIGH_THRESHOLD]
if default_value != NOT_AVAILABLE:
if value > float(default_value):
return False
try:
self.__conf.set_high_threshold(str(value))
except Exception:
return False
return True
def get_high_threshold(self):
value = self.__conf.get_high_threshold()
if value != NOT_AVAILABLE:
return float(value)
default_value = self.__default_threshold[HIGH_THRESHOLD]
if default_value != NOT_AVAILABLE:
return float(default_value)
raise NotImplementedError
def set_low_threshold(self, temperature):
try:
value = float(temperature)
except Exception:
return False
# The new value can not be less than the default value.
default_value = self.__default_threshold[LOW_THRESHOLD]
if default_value != NOT_AVAILABLE:
if value < float(default_value):
return False
try:
self.__conf.set_low_threshold(str(value))
except Exception:
return False
return True
def get_low_threshold(self):
value = self.__conf.get_low_threshold()
if value != NOT_AVAILABLE:
return float(value)
default_value = self.__default_threshold[LOW_THRESHOLD]
if default_value != NOT_AVAILABLE:
return float(default_value)
raise NotImplementedError
def set_high_critical_threshold(self, temperature):
try:
value = float(temperature)
except Exception:
return False
# The new value can not be more than the default value.
default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD]
if default_value != NOT_AVAILABLE:
if value > float(default_value):
return False
try:
self.__conf.set_high_critical_threshold(str(value))
except Exception:
return False
return True
def get_high_critical_threshold(self):
value = self.__conf.get_high_critical_threshold()
if value != NOT_AVAILABLE:
return float(value)
default_value = self.__default_threshold[HIGH_CRIT_THRESHOLD]
if default_value != NOT_AVAILABLE:
return float(default_value)
raise NotImplementedError
def set_low_critical_threshold(self, temperature):
try:
value = float(temperature)
except Exception:
return False
# The new value can not be less than the default value.
default_value = self.__default_threshold[LOW_CRIT_THRESHOLD]
if default_value != NOT_AVAILABLE:
if value < float(default_value):
return False
try:
self.__conf.set_low_critical_threshold(str(value))
except Exception:
return False
return True
def get_low_critical_threshold(self):
value = self.__conf.get_low_critical_threshold()
if value != NOT_AVAILABLE:
return float(value)
default_value = self.__default_threshold[LOW_CRIT_THRESHOLD]
if default_value != NOT_AVAILABLE:
return float(default_value)
raise NotImplementedError
def get_model(self):
"""
Retrieves the model number (or part number) of the device
Returns:
string: Model/part number of device
"""
return 'N/A'
def get_serial(self):
"""
Retrieves the serial number of the device
Returns:
string: Serial number of device
"""
return 'N/A'
def get_minimum_recorded(self):
"""
Retrieves the minimum recorded temperature of thermal
Returns:
A float number, the minimum recorded temperature of thermal in Celsius
up to nearest thousandth of one degree Celsius, e.g. 30.125
"""
if self.min_temperature is None:
self.get_temperature()
return self.min_temperature
def get_maximum_recorded(self):
"""
Retrieves the maximum recorded temperature of thermal
Returns:
A float number, the maximum recorded temperature of thermal in Celsius
up to nearest thousandth of one degree Celsius, e.g. 30.125
"""
if self.max_temperature is None:
self.get_temperature()
return self.max_temperature

View File

@ -21,6 +21,7 @@
# 4/20/2018: Jostar modify for as7726_32x
# 12/03/2018:Jostar modify for as7726_32x thermal plan
# 11/16/2020:Jostar modify for as7726_32x thermal plan based on PDDF
# 11/19/2023:Jostar modify to add kick fan-wdt
# ------------------------------------------------------------------
try:
@ -32,6 +33,7 @@ try:
import logging.handlers
import time
from sonic_platform import platform
from sonic_py_common.general import getstatusoutput_noshell
except ImportError as e:
raise ImportError('%s - required module not found' % str(e))
@ -162,7 +164,7 @@ class device_monitor(object):
}
fan_dir= platform_chassis.get_fan(0).get_direction()
if fan_dir == 'EXHAUST':
if fan_dir == 'exhaust':
fan_policy = fan_policy_f2b
else:
fan_policy = fan_policy_b2f
@ -305,15 +307,47 @@ def main(argv):
global platform_chassis
platform_chassis = platform.Platform().get_chassis()
#cmd_str = ["i2cset", "-y", "-f", "54", "0x66", "0x33", "0x0"]
#status, output = getstatusoutput_noshell(cmd_str)
#if status:
# print("Warning: Fan speed watchdog could not be disabled")
cmd_str = ["i2cset", "-y", "-f", "54", "0x66", "0x33", "0x1"]
status, output = getstatusoutput_noshell(cmd_str)
if status:
print("Warning: Fan speed watchdog could not be enabled")
#Timer need to be set after enable.
#if set timer is eralier than enable wdt. Speed will become to wdt speed after 6sec.
cmd_str = ["i2cset", "-y", "-f", "54", "0x66", "0x31", "0xF0"]
status, output = getstatusoutput_noshell(cmd_str)
if status:
print("Warning: Fan speed watchdog timer could not be disabled")
platform_chassis.get_fan(0).set_speed(38)
print("set default fan speed to 37.5%")
monitor = device_monitor(log_file, log_level)
cmd_kick = ["i2cset", "-y", "-f", "54", "0x66", "0x31", "0xF0"] #kick WDT
cmd_check_wdt = ["i2cget", "-y", "-f", "54", "0x66", "0x33"]
# Loop forever, doing something useful hopefully:
while True:
monitor.manage_fans()
getstatusoutput_noshell(cmd_kick)
time.sleep(10)
#polling to check fan-wdt status
status, output = getstatusoutput_noshell(cmd_check_wdt)
if status is not None:
val= int(output,16)
if (val & 0x1) == 0:
logging.warning('Detect Fan-WDT disable')
logging.warning('Try to enable Fan-WDT')
cmd_str = ["i2cset", "-y", "-f", "54", "0x66", "0x33", "0x1"]
getstatusoutput_noshell(cmd_str)
cmd_str = ["i2cset", "-y", "-f", "54", "0x66", "0x31", "0xF0"]
getstatusoutput_noshell(cmd_str)
if __name__ == '__main__':
main(sys.argv[1:])

View File

@ -16,22 +16,27 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
"""
Usage: %(scriptName)s [options] command object
usage: accton_as7726_32x_util.py [-h] [-d] [-f] {install,clean,threshold} ...
options:
-h | --help : this help message
-d | --debug : run with debug mode
-f | --force : ignore error during installation or clean
command:
install : install drivers and generate related sysfs nodes
clean : uninstall drivers and remove related sysfs nodes
AS7726-32X Platform Utility
optional arguments:
-h, --help show this help message and exit
-d, --debug run with debug mode
-f, --force ignore error during installation or clean
Utility Command:
{install,clean,threshold}
install : install drivers and generate related sysfs nodes
clean : uninstall drivers and remove related sysfs nodes
threshold : modify thermal threshold
"""
import subprocess
import getopt
import sys
import logging
import re
import time
import argparse
from sonic_py_common.general import getstatusoutput_noshell
PROJECT_NAME = 'as7726_32x'
@ -109,37 +114,44 @@ def main():
global DEBUG
global args
global FORCE
global THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH
if len(sys.argv)<2:
show_help()
util_parser = argparse.ArgumentParser(description="AS7726-32X Platform Utility")
util_parser.add_argument("-d", "--debug", dest='debug', action='store_true', default=False,
help="run with debug mode")
util_parser.add_argument("-f", "--force", dest='force', action='store_true', default=False,
help="ignore error during installation or clean")
subcommand = util_parser.add_subparsers(dest='cmd', title='Utility Command', required=True)
subcommand.add_parser('install', help=': install drivers and generate related sysfs nodes')
subcommand.add_parser('clean', help=': uninstall drivers and remove related sysfs nodes')
threshold_parser = subcommand.add_parser('threshold', help=': modify thermal threshold')
threshold_parser.add_argument("-l", dest='list', action='store_true', default=False,
help="list avaliable thermal")
threshold_parser.add_argument("-t", dest='thermal', type=str, metavar='THERMAL_NAME',
help="thermal name, ex: -t 'Temp sensor 1'")
threshold_parser.add_argument("-ht", dest='high_threshold', type=restricted_float,
metavar='THRESHOLD_VALUE',
help="high threshold: %.1f ~ %.1f" % (THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH))
threshold_parser.add_argument("-hct", dest='high_crit_threshold', type=restricted_float,
metavar='THRESHOLD_VALUE',
help="high critical threshold : %.1f ~ %.1f" % (THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH))
args = util_parser.parse_args()
options, args = getopt.getopt(sys.argv[1:], 'hdf', ['help',
'debug',
'force',
])
if DEBUG == True:
print(options)
print(args)
print((len(sys.argv)))
for opt, arg in options:
if opt in ('-h', '--help'):
show_help()
elif opt in ('-d', '--debug'):
DEBUG = True
logging.basicConfig(level=logging.INFO)
elif opt in ('-f', '--force'):
FORCE = 1
else:
logging.info('no option')
for arg in args:
if arg == 'install':
do_install()
elif arg == 'clean':
do_uninstall()
else:
show_help()
DEBUG = args.debug
if DEBUG:
logging.basicConfig(level=logging.INFO)
FORCE = 1 if args.force else 0
if args.cmd == 'install':
do_install()
elif args.cmd == 'clean':
do_uninstall()
elif args.cmd == 'threshold':
do_threshold()
return 0
@ -365,5 +377,162 @@ def device_exist():
ret2, log = log_os_system("ls "+i2c_prefix+"i2c-2", 0)
return not(ret1 or ret2)
THRESHOLD_RANGE_LOW = 30.0
THRESHOLD_RANGE_HIGH = 110.0
# Code to initialize chassis object
init_chassis_code = \
"import sonic_platform.platform\n"\
"platform = sonic_platform.platform.Platform()\n"\
"chassis = platform.get_chassis()\n\n"
# Looking for thermal
looking_for_thermal_code = \
"thermal = None\n"\
"all_thermals = chassis.get_all_thermals()\n"\
"for psu in chassis.get_all_psus():\n"\
" all_thermals += psu.get_all_thermals()\n"\
"for tmp in all_thermals:\n"\
" if '{}' == tmp.get_name():\n"\
" thermal = tmp\n"\
" break\n"\
"if thermal == None:\n"\
" print('{} not found!')\n"\
" exit(1)\n\n"
def avaliable_thermals():
global init_chassis_code
get_all_thermal_name_code = \
"thermal_list = []\n"\
"all_thermals = chassis.get_all_thermals()\n"\
"for psu in chassis.get_all_psus():\n"\
" all_thermals += psu.get_all_thermals()\n"\
"for tmp in all_thermals:\n"\
" thermal_list.append(tmp.get_name())\n"\
"print(str(thermal_list)[1:-1])\n"
all_code = "{}{}".format(init_chassis_code, get_all_thermal_name_code)
status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code])
if status != 0:
return ""
return output
def restricted_float(x):
global THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH
try:
x = float(x)
except ValueError:
raise argparse.ArgumentTypeError("%r not a floating-point literal" % (x,))
if x < THRESHOLD_RANGE_LOW or x > THRESHOLD_RANGE_HIGH:
raise argparse.ArgumentTypeError("%r not in range [%.1f ~ %.1f]" %
(x, THRESHOLD_RANGE_LOW, THRESHOLD_RANGE_HIGH))
return x
def get_high_threshold(name):
global init_chassis_code, looking_for_thermal_code
get_high_threshold_code = \
"try:\n"\
" print(thermal.get_high_threshold())\n"\
" exit(0)\n"\
"except NotImplementedError:\n"\
" print('Not implement the get_high_threshold method!')\n"\
" exit(1)"
all_code = "{}{}{}".format(init_chassis_code, looking_for_thermal_code.format(name, name),
get_high_threshold_code)
status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code])
if status == 1:
return None
return float(output)
def get_high_crit_threshold(name):
global init_chassis_code, looking_for_thermal_code
get_high_crit_threshold_code = \
"try:\n"\
" print(thermal.get_high_critical_threshold())\n"\
" exit(0)\n"\
"except NotImplementedError:\n"\
" print('Not implement the get_high_critical_threshold method!')\n"\
" exit(1)"
all_code = "{}{}{}".format(init_chassis_code, looking_for_thermal_code.format(name, name),
get_high_crit_threshold_code)
status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code])
if status == 1:
return None
return float(output)
def do_threshold():
global args, init_chassis_code, looking_for_thermal_code
if args.list:
print("Thermals: " + avaliable_thermals())
return
if args.thermal is None:
print("The following arguments are required: -t")
return
set_threshold_code = ""
if args.high_threshold is not None:
if args.high_crit_threshold is not None and \
args.high_threshold >= args.high_crit_threshold:
print("Invalid Threshold!(High threshold can not be more than " \
"or equal to high critical threshold.)")
exit(1)
high_crit = get_high_crit_threshold(args.thermal)
if high_crit is not None and \
args.high_threshold >= high_crit:
print("Invalid Threshold!(High threshold can not be more than " \
"or equal to high critical threshold.)")
exit(1)
set_threshold_code += \
"try:\n"\
" if thermal.set_high_threshold({}) is False:\n"\
" print('{}: set_high_threshold failure!')\n"\
" exit(1)\n"\
"except NotImplementedError:\n"\
" print('Not implement the set_high_threshold method!')\n"\
"print('Apply the new high threshold successfully.')\n"\
"\n".format(args.high_threshold, args.thermal)
if args.high_crit_threshold is not None:
high = get_high_threshold(args.thermal)
if high is not None and \
args.high_crit_threshold <= high:
print("Invalid Threshold!(High critical threshold can not " \
"be less than or equal to high threshold.)")
exit(1)
set_threshold_code += \
"try:\n"\
" if thermal.set_high_critical_threshold({}) is False:\n"\
" print('{}: set_high_critical_threshold failure!')\n"\
" exit(1)\n"\
"except NotImplementedError:\n"\
" print('Not implement the set_high_critical_threshold method!')\n"\
"print('Apply the new high critical threshold successfully.')\n"\
"\n".format(args.high_crit_threshold, args.thermal)
if set_threshold_code == "":
return
all_code = "{}{}{}".format(init_chassis_code, looking_for_thermal_code.format(args.thermal, args.thermal), set_threshold_code)
status, output = getstatusoutput_noshell(["docker", "exec", "pmon", "python3", "-c", all_code])
print(output)
if __name__ == "__main__":
main()