[platform]: Fix Belgite platform issues (#13389)
As part of platform hardening this commit fixes several platform issues in various components like PSU, FAN, Temperature, LED.
This commit is contained in:
parent
63f2ab2cc3
commit
892f26556c
@ -0,0 +1,284 @@
|
||||
{
|
||||
"interfaces": {
|
||||
"Ethernet0": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet1": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet2": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet3": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet4": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet5": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet6": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet7": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet8": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet9": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet10": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet11": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet12": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet13": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet14": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet15": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet16": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet17": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet18": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet19": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet20": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet21": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet22": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet23": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet24": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet25": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet26": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet27": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet28": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet29": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet30": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet31": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet32": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet33": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet34": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet35": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet36": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet37": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet38": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet39": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet40": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet41": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet42": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet43": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet44": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet45": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet46": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet47": {
|
||||
"default_brkout_mode": "1x1000[100,10]",
|
||||
"autoneg": "on",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet48": {
|
||||
"default_brkout_mode": "1x10G[1G]",
|
||||
"autoneg": "off",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet49": {
|
||||
"default_brkout_mode": "1x10G[1G]",
|
||||
"autoneg": "off",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet50": {
|
||||
"default_brkout_mode": "1x10G[1G]",
|
||||
"autoneg": "off",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet51": {
|
||||
"default_brkout_mode": "1x10G[1G]",
|
||||
"autoneg": "off",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet52": {
|
||||
"default_brkout_mode": "1x10G[1G]",
|
||||
"autoneg": "off",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet53": {
|
||||
"default_brkout_mode": "1x10G[1G]",
|
||||
"autoneg": "off",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet54": {
|
||||
"default_brkout_mode": "1x10G[1G]",
|
||||
"autoneg": "off",
|
||||
"fec": "none"
|
||||
},
|
||||
"Ethernet55": {
|
||||
"default_brkout_mode": "1x10G[1G]",
|
||||
"autoneg": "off",
|
||||
"fec": "none"
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
@ -105,7 +105,7 @@ unsigned short portmap[] = {
|
||||
1, 2, 3, 4, 5, 6, 7, 8,
|
||||
9, 10, 11, 12, 24, 23, 22, 21,
|
||||
20, 19, 18, 17, 16, 15, 14, 13,
|
||||
58, 60, 57, 59, 64, 62, 63, 61
|
||||
60, 58, 59, 57, 62, 64, 61, 63
|
||||
};
|
||||
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
m0 load 0 0x3800 /usr/share/sonic/platform/custom_led.bin
|
||||
led auto on
|
||||
led start
|
||||
|
||||
|
@ -5,7 +5,7 @@
|
||||
{
|
||||
"i2c":
|
||||
{
|
||||
"valmap-SFP28": {"1":false, "0":true }
|
||||
"valmap-SFP+": {"1":false, "0":true }
|
||||
}
|
||||
}
|
||||
},
|
||||
@ -29,7 +29,7 @@
|
||||
{
|
||||
"i2c":
|
||||
{
|
||||
"valmap": { "F2B":"INTAKE", "B2F":"EXHAUST" }
|
||||
"valmap": { "0":"INTAKE", "1":"EXHAUST" }
|
||||
}
|
||||
},
|
||||
"PSU_FAN_MAX_SPEED":"18000"
|
||||
@ -50,10 +50,6 @@
|
||||
"valmap": {"1":false, "0":true}
|
||||
}
|
||||
},
|
||||
"fan_master_led_color":
|
||||
{
|
||||
"colmap": {"green":"green", "red":"amber"}
|
||||
},
|
||||
"duty_cycle_to_pwm": "lambda dc: dc*255/100",
|
||||
|
||||
"pwm_to_duty_cycle": "lambda pwm: pwm/255*100"
|
||||
|
@ -179,7 +179,7 @@
|
||||
{ "attr_name":"psu_v_out", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
|
||||
{ "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_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0xc5", "attr_mask":"0x18", "attr_cmpval":"0x08", "attr_len":"1"},
|
||||
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x58", "attr_devtype":"pmbus", "attr_offset":"0x80", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"1"},
|
||||
{ "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"}
|
||||
]
|
||||
@ -215,7 +215,7 @@
|
||||
{ "attr_name":"psu_v_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8b", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
|
||||
{ "attr_name":"psu_i_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8c", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
|
||||
{ "attr_name":"psu_p_out", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x96", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
|
||||
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0xc5", "attr_mask":"0x18", "attr_cmpval":"0x08", "attr_len":"1"},
|
||||
{ "attr_name":"psu_fan_dir", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x80", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"1"},
|
||||
{ "attr_name":"psu_fan1_speed_rpm", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x90", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"},
|
||||
{ "attr_name":"psu_temp1_input", "attr_devaddr":"0x59", "attr_devtype":"pmbus", "attr_offset":"0x8d", "attr_mask":"0x0", "attr_cmpval":"0xff", "attr_len":"2"}
|
||||
]
|
||||
@ -283,7 +283,7 @@
|
||||
},
|
||||
"PORT49":
|
||||
{
|
||||
"dev_info": { "device_type":"SFP28", "device_name":"PORT49", "device_parent":"MUX2"},
|
||||
"dev_info": { "device_type":"SFP+", "device_name":"PORT49", "device_parent":"MUX2"},
|
||||
"dev_attr": { "dev_idx":"49"},
|
||||
"i2c":
|
||||
{
|
||||
@ -324,7 +324,7 @@
|
||||
},
|
||||
"PORT50":
|
||||
{
|
||||
"dev_info": { "device_type":"SFP28", "device_name":"PORT50", "device_parent":"MUX2"},
|
||||
"dev_info": { "device_type":"SFP+", "device_name":"PORT50", "device_parent":"MUX2"},
|
||||
"dev_attr": { "dev_idx":"50"},
|
||||
"i2c":
|
||||
{
|
||||
@ -366,7 +366,7 @@
|
||||
},
|
||||
"PORT51":
|
||||
{
|
||||
"dev_info": { "device_type":"SFP28", "device_name":"PORT51", "device_parent":"MUX2"},
|
||||
"dev_info": { "device_type":"SFP+", "device_name":"PORT51", "device_parent":"MUX2"},
|
||||
"dev_attr": { "dev_idx":"51"},
|
||||
"i2c":
|
||||
{
|
||||
@ -407,7 +407,7 @@
|
||||
},
|
||||
"PORT52":
|
||||
{
|
||||
"dev_info": { "device_type":"SFP28", "device_name":"PORT52", "device_parent":"MUX2"},
|
||||
"dev_info": { "device_type":"SFP+", "device_name":"PORT52", "device_parent":"MUX2"},
|
||||
"dev_attr": { "dev_idx":"52"},
|
||||
"i2c":
|
||||
{
|
||||
@ -449,7 +449,7 @@
|
||||
},
|
||||
"PORT53":
|
||||
{
|
||||
"dev_info": { "device_type":"SFP28", "device_name":"PORT53", "device_parent":"MUX2"},
|
||||
"dev_info": { "device_type":"SFP+", "device_name":"PORT53", "device_parent":"MUX2"},
|
||||
"dev_attr": { "dev_idx":"53"},
|
||||
"i2c":
|
||||
{
|
||||
@ -491,7 +491,7 @@
|
||||
},
|
||||
"PORT54":
|
||||
{
|
||||
"dev_info": { "device_type":"SFP28", "device_name":"PORT54", "device_parent":"MUX2"},
|
||||
"dev_info": { "device_type":"SFP+", "device_name":"PORT54", "device_parent":"MUX2"},
|
||||
"dev_attr": { "dev_idx":"54"},
|
||||
"i2c":
|
||||
{
|
||||
@ -532,7 +532,7 @@
|
||||
},
|
||||
"PORT55":
|
||||
{
|
||||
"dev_info": { "device_type":"SFP28", "device_name":"PORT55", "device_parent":"MUX2"},
|
||||
"dev_info": { "device_type":"SFP+", "device_name":"PORT55", "device_parent":"MUX2"},
|
||||
"dev_attr": { "dev_idx":"55"},
|
||||
"i2c":
|
||||
{
|
||||
@ -573,7 +573,7 @@
|
||||
},
|
||||
"PORT56":
|
||||
{
|
||||
"dev_info": { "device_type":"SFP28", "device_name":"PORT56", "device_parent":"MUX2"},
|
||||
"dev_info": { "device_type":"SFP+", "device_name":"PORT56", "device_parent":"MUX2"},
|
||||
"dev_attr": { "dev_idx":"56"},
|
||||
"i2c":
|
||||
{
|
||||
@ -642,7 +642,7 @@
|
||||
[
|
||||
{"attr_name":"STATUS_LED_COLOR_AMBER","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x1","swpld_addr_offset":"0x43"},
|
||||
{"attr_name":"STATUS_LED_COLOR_GREEN","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x2","swpld_addr_offset":"0x43"},
|
||||
{"attr_name":"STATUS_LED_COLOR_OFF","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x0","swpld_addr_offset":"0x43"}
|
||||
{"attr_name":"STATUS_LED_COLOR_OFF","swpld_addr":"0x32","attr_devtype":"cpld","attr_devname":"CPLD1", "bits":"5:4","descr":"","value":"0x3","swpld_addr_offset":"0x43"}
|
||||
]
|
||||
}
|
||||
},
|
||||
@ -666,7 +666,7 @@
|
||||
"attr_list":
|
||||
[
|
||||
{"attr_name":"STATUS_LED_COLOR_GREEN","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x1","swpld_addr":"0x32","swpld_addr_offset":"0x37"},
|
||||
{"attr_name":"STATUS_LED_COLOR_AMBER","attr_devtype":"cpld","attr_devname":"CPLD1B","bits":"1:0","descr":"","value":"0x2","swpld_addr":"0x32","swpld_addr_offset":"0x37"}
|
||||
{"attr_name":"STATUS_LED_COLOR_AMBER","attr_devtype":"cpld","attr_devname":"CPLD1","bits":"1:0","descr":"","value":"0x2","swpld_addr":"0x32","swpld_addr_offset":"0x37"}
|
||||
]
|
||||
}
|
||||
},
|
||||
|
@ -11,10 +11,7 @@
|
||||
"name": "SWCPLD"
|
||||
},
|
||||
{
|
||||
"name": "Main_BIOS"
|
||||
},
|
||||
{
|
||||
"name": "Backup_BIOS"
|
||||
"name": "BIOS"
|
||||
}
|
||||
],
|
||||
"fans": [
|
||||
@ -391,5 +388,398 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"interfaces": {}
|
||||
"interfaces": {
|
||||
"Ethernet0": {
|
||||
"index": "1",
|
||||
"lanes": "26",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/1"]
|
||||
}
|
||||
},
|
||||
"Ethernet1": {
|
||||
"index": "2",
|
||||
"lanes": "25",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/2"]
|
||||
}
|
||||
},
|
||||
"Ethernet2": {
|
||||
"index": "3",
|
||||
"lanes": "28",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/3"]
|
||||
}
|
||||
},
|
||||
"Ethernet3": {
|
||||
"index": "4",
|
||||
"lanes": "27",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/4"]
|
||||
}
|
||||
},
|
||||
"Ethernet4": {
|
||||
"index": "5",
|
||||
"lanes": "30",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/5"]
|
||||
}
|
||||
},
|
||||
"Ethernet5": {
|
||||
"index": "6",
|
||||
"lanes": "29",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/6"]
|
||||
}
|
||||
},
|
||||
"Ethernet6": {
|
||||
"index": "7",
|
||||
"lanes": "32",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/7"]
|
||||
}
|
||||
},
|
||||
"Ethernet7": {
|
||||
"index": "8",
|
||||
"lanes": "31",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/8"]
|
||||
}
|
||||
},
|
||||
"Ethernet8": {
|
||||
"index": "9",
|
||||
"lanes": "34",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/9"]
|
||||
}
|
||||
},
|
||||
"Ethernet9": {
|
||||
"index": "10",
|
||||
"lanes": "33",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/10"]
|
||||
}
|
||||
},
|
||||
"Ethernet10": {
|
||||
"index": "11",
|
||||
"lanes": "36",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/11"]
|
||||
}
|
||||
},
|
||||
"Ethernet11": {
|
||||
"index": "12",
|
||||
"lanes": "35",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/12"]
|
||||
}
|
||||
},
|
||||
"Ethernet12": {
|
||||
"index": "13",
|
||||
"lanes": "38",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/13"]
|
||||
}
|
||||
},
|
||||
"Ethernet13": {
|
||||
"index": "14",
|
||||
"lanes": "37",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/14"]
|
||||
}
|
||||
},
|
||||
"Ethernet14": {
|
||||
"index": "15",
|
||||
"lanes": "40",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/15"]
|
||||
}
|
||||
},
|
||||
"Ethernet15": {
|
||||
"index": "16",
|
||||
"lanes": "39",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/16"]
|
||||
}
|
||||
},
|
||||
"Ethernet16": {
|
||||
"index": "17",
|
||||
"lanes": "42",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/17"]
|
||||
}
|
||||
},
|
||||
"Ethernet17": {
|
||||
"index": "18",
|
||||
"lanes": "41",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/18"]
|
||||
}
|
||||
},
|
||||
"Ethernet18": {
|
||||
"index": "19",
|
||||
"lanes": "44",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/19"]
|
||||
}
|
||||
},
|
||||
"Ethernet19": {
|
||||
"index": "20",
|
||||
"lanes": "43",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/20"]
|
||||
}
|
||||
},
|
||||
"Ethernet20": {
|
||||
"index": "21",
|
||||
"lanes": "50",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/21"]
|
||||
}
|
||||
},
|
||||
"Ethernet21": {
|
||||
"index": "22",
|
||||
"lanes": "49",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/22"]
|
||||
}
|
||||
},
|
||||
"Ethernet22": {
|
||||
"index": "23",
|
||||
"lanes": "52",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/23"]
|
||||
}
|
||||
},
|
||||
"Ethernet23": {
|
||||
"index": "24",
|
||||
"lanes": "51",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/24"]
|
||||
}
|
||||
},
|
||||
"Ethernet24": {
|
||||
"index": "25",
|
||||
"lanes": "2",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/25"]
|
||||
}
|
||||
},
|
||||
"Ethernet25": {
|
||||
"index": "26",
|
||||
"lanes": "1",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/26"]
|
||||
}
|
||||
},
|
||||
"Ethernet26": {
|
||||
"index": "27",
|
||||
"lanes": "4",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/27"]
|
||||
}
|
||||
},
|
||||
"Ethernet27": {
|
||||
"index": "28",
|
||||
"lanes": "3",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/28"]
|
||||
}
|
||||
},
|
||||
"Ethernet28": {
|
||||
"index": "29",
|
||||
"lanes": "6",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/29"]
|
||||
}
|
||||
},
|
||||
"Ethernet29": {
|
||||
"index": "30",
|
||||
"lanes": "5",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/30"]
|
||||
}
|
||||
},
|
||||
"Ethernet30": {
|
||||
"index": "31",
|
||||
"lanes": "8",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/31"]
|
||||
}
|
||||
},
|
||||
"Ethernet31": {
|
||||
"index": "32",
|
||||
"lanes": "7",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/32"]
|
||||
}
|
||||
},
|
||||
"Ethernet32": {
|
||||
"index": "33",
|
||||
"lanes": "10",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/33"]
|
||||
}
|
||||
},
|
||||
"Ethernet33": {
|
||||
"index": "34",
|
||||
"lanes": "9",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/34"]
|
||||
}
|
||||
},
|
||||
"Ethernet34": {
|
||||
"index": "35",
|
||||
"lanes": "12",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/35"]
|
||||
}
|
||||
},
|
||||
"Ethernet35": {
|
||||
"index": "36",
|
||||
"lanes": "11",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/36"]
|
||||
}
|
||||
},
|
||||
"Ethernet36": {
|
||||
"index": "37",
|
||||
"lanes": "14",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/37"]
|
||||
}
|
||||
},
|
||||
"Ethernet37": {
|
||||
"index": "38",
|
||||
"lanes": "13",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/38"]
|
||||
}
|
||||
},
|
||||
"Ethernet38": {
|
||||
"index": "39",
|
||||
"lanes": "16",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/39"]
|
||||
}
|
||||
},
|
||||
"Ethernet39": {
|
||||
"index": "40",
|
||||
"lanes": "15",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/40"]
|
||||
}
|
||||
},
|
||||
"Ethernet40": {
|
||||
"index": "41",
|
||||
"lanes": "18",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/41"]
|
||||
}
|
||||
},
|
||||
"Ethernet41": {
|
||||
"index": "42",
|
||||
"lanes": "17",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/42"]
|
||||
}
|
||||
},
|
||||
"Ethernet42": {
|
||||
"index": "43",
|
||||
"lanes": "20",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/43"]
|
||||
}
|
||||
},
|
||||
"Ethernet43": {
|
||||
"index": "44",
|
||||
"lanes": "19",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/44"]
|
||||
}
|
||||
},
|
||||
"Ethernet44": {
|
||||
"index": "45",
|
||||
"lanes": "22",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/45"]
|
||||
}
|
||||
},
|
||||
"Ethernet45": {
|
||||
"index": "46",
|
||||
"lanes": "21",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/46"]
|
||||
}
|
||||
},
|
||||
"Ethernet46": {
|
||||
"index": "47",
|
||||
"lanes": "24",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/47"]
|
||||
}
|
||||
},
|
||||
"Ethernet47": {
|
||||
"index": "48",
|
||||
"lanes": "23",
|
||||
"breakout_modes": {
|
||||
"1x1000[100,10]": ["Ethernet1/0/48"]
|
||||
}
|
||||
},
|
||||
"Ethernet48": {
|
||||
"index": "49",
|
||||
"lanes": "60",
|
||||
"breakout_modes": {
|
||||
"1x10G[1G]": ["Ethernet1/0/49"]
|
||||
}
|
||||
},
|
||||
"Ethernet49": {
|
||||
"index": "50",
|
||||
"lanes": "58",
|
||||
"breakout_modes": {
|
||||
"1x10G[1G]": ["Ethernet1/0/50"]
|
||||
}
|
||||
},
|
||||
"Ethernet50": {
|
||||
"index": "51",
|
||||
"lanes": "59",
|
||||
"breakout_modes": {
|
||||
"1x10G[1G]": ["Ethernet1/0/51"]
|
||||
}
|
||||
},
|
||||
"Ethernet51": {
|
||||
"index": "52",
|
||||
"lanes": "57",
|
||||
"breakout_modes": {
|
||||
"1x10G[1G]": ["Ethernet1/0/52"]
|
||||
}
|
||||
},
|
||||
"Ethernet52": {
|
||||
"index": "53",
|
||||
"lanes": "62",
|
||||
"breakout_modes": {
|
||||
"1x10G[1G]": ["Ethernet1/0/53"]
|
||||
}
|
||||
},
|
||||
"Ethernet53": {
|
||||
"index": "54",
|
||||
"lanes": "64",
|
||||
"breakout_modes": {
|
||||
"1x10G[1G]": ["Ethernet1/0/54"]
|
||||
}
|
||||
},
|
||||
"Ethernet54": {
|
||||
"index": "55",
|
||||
"lanes": "61",
|
||||
"breakout_modes": {
|
||||
"1x10G[1G]": ["Ethernet1/0/55"]
|
||||
}
|
||||
},
|
||||
"Ethernet55": {
|
||||
"index": "56",
|
||||
"lanes": "63",
|
||||
"breakout_modes": {
|
||||
"1x10G[1G]": ["Ethernet1/0/56"]
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,10 @@
|
||||
{
|
||||
"chassis": {
|
||||
"E1070": {
|
||||
"component": {
|
||||
"SWCPLD": {},
|
||||
"BIOS": {}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
78
device/celestica/x86_64-cel_belgite-r0/plugins/psuutil.py
Normal file
78
device/celestica/x86_64-cel_belgite-r0/plugins/psuutil.py
Normal file
@ -0,0 +1,78 @@
|
||||
#
|
||||
# psuutil.py
|
||||
# Platform-specific PSU status interface for SONiC
|
||||
#
|
||||
|
||||
import os
|
||||
|
||||
try:
|
||||
from sonic_psu.psu_base import PsuBase
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
class PsuUtil(PsuBase):
|
||||
"""Platform-specific PSUutil class"""
|
||||
|
||||
def __init__(self):
|
||||
PsuBase.__init__(self)
|
||||
|
||||
def get_num_psus(self):
|
||||
"""
|
||||
Retrieves the number of PSUs available on the device
|
||||
:return: An integer, the number of PSUs available on the device
|
||||
"""
|
||||
return 2
|
||||
|
||||
def get_psu_status(self, index):
|
||||
"""
|
||||
Retrieves the oprational status of power supply unit (PSU) defined
|
||||
by 1-based index <index>
|
||||
:param index: An integer, 1-based index of the PSU of which to query status
|
||||
:return: Boolean, True if PSU is operating properly, False if PSU is faulty
|
||||
"""
|
||||
if index is None:
|
||||
return False
|
||||
|
||||
if index == 1:
|
||||
status_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-4/4-0058/psu_power_good"
|
||||
elif index == 2:
|
||||
status_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-4/4-0059/psu_power_good"
|
||||
else:
|
||||
return False
|
||||
|
||||
try:
|
||||
with open(status_path, 'r') as fd:
|
||||
status = fd.read().rstrip('\r\n')
|
||||
if status == '0':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except IOError:
|
||||
return False
|
||||
|
||||
def get_psu_presence(self, index):
|
||||
"""
|
||||
Retrieves the presence status of power supply unit (PSU) defined
|
||||
by 1-based index <index>
|
||||
:param index: An integer, 1-based index of the PSU of which to query status
|
||||
:return: Boolean, True if PSU is plugged, False if not
|
||||
"""
|
||||
if index is None:
|
||||
return False
|
||||
|
||||
if index == 1:
|
||||
status_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-4/4-0058/psu_present"
|
||||
elif index == 2:
|
||||
status_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-4/4-0059/psu_present"
|
||||
else:
|
||||
return False
|
||||
|
||||
try:
|
||||
with open(status_path, 'r') as fd:
|
||||
status = fd.read().rstrip('\r\n')
|
||||
if status == '1':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except IOError:
|
||||
return False
|
142
device/celestica/x86_64-cel_belgite-r0/plugins/sfputil.py
Normal file
142
device/celestica/x86_64-cel_belgite-r0/plugins/sfputil.py
Normal file
@ -0,0 +1,142 @@
|
||||
# Platform-specific SFP transceiver interface for SONiC
|
||||
#
|
||||
|
||||
try:
|
||||
import time
|
||||
from sonic_sfp.sfputilbase import SfpUtilBase
|
||||
except ImportError as e:
|
||||
raise ImportError("%s - required module not found" % str(e))
|
||||
|
||||
|
||||
class SfpUtil(SfpUtilBase):
|
||||
"""Platform-specific SfpUtil class"""
|
||||
|
||||
PORT_START = 1
|
||||
PORT_END = 56
|
||||
SFP_PORT_START = 49
|
||||
SFP_PORT_END = 56
|
||||
SFP_I2C_BUS_START = 0xa
|
||||
PORTS_IN_BLOCK = 56
|
||||
|
||||
_port_to_eeprom_mapping = {}
|
||||
sfp_status_dict = {}
|
||||
|
||||
@property
|
||||
def port_start(self):
|
||||
return self.PORT_START
|
||||
|
||||
@property
|
||||
def port_end(self):
|
||||
return self.PORT_END
|
||||
|
||||
@property
|
||||
def qsfp_ports(self):
|
||||
return list(range(self.PORT_START, self.PORTS_IN_BLOCK + 1))
|
||||
|
||||
@property
|
||||
def port_to_eeprom_mapping(self):
|
||||
return self._port_to_eeprom_mapping
|
||||
|
||||
def __init__(self):
|
||||
# Override port_to_eeprom_mapping for class initialization
|
||||
eeprom_path = '/sys/bus/i2c/devices/i2c-{0}/{0}-0050/eeprom'
|
||||
|
||||
for port_idx in range(self.SFP_PORT_START, self.SFP_PORT_END + 1):
|
||||
self._port_to_eeprom_mapping[port_idx] = eeprom_path.format(self.SFP_I2C_BUS_START + (port_idx - self.SFP_PORT_START))
|
||||
self.sfp_status_dict[port_idx] = 0 #Initialize all modules as absent/removed
|
||||
SfpUtilBase.__init__(self)
|
||||
|
||||
def get_presence(self, port_num):
|
||||
# Check for invalid port_num
|
||||
if port_num < self.SFP_PORT_START or port_num > self.SFP_PORT_END:
|
||||
return False
|
||||
|
||||
sfp_status_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-9/i2c-{0}/{0}-0066/xcvr_present"\
|
||||
.format(self.SFP_I2C_BUS_START + (port_num - self.SFP_PORT_START))
|
||||
try:
|
||||
with open(sfp_status_path, 'r') as fd:
|
||||
status = fd.read().rstrip('\r\n')
|
||||
if status == '0':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except IOError as e:
|
||||
print("Error: unable to open file: %s" % str(e))
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
def get_low_power_mode(self, port_num):
|
||||
# Check for invalid port_num
|
||||
if port_num < self.SFP_PORT_START or port_num > self.SFP_PORT_END:
|
||||
return False
|
||||
|
||||
sfp_lpmode_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-9/i2c-{0}/{0}-0066/xcvr_lpmode"\
|
||||
.format(self.SFP_I2C_BUS_START + (port_num - self.SFP_PORT_START))
|
||||
try:
|
||||
with open(sfp_lpmode_path, 'r') as fd:
|
||||
status = fd.read().rstrip('\r\n')
|
||||
if status == '1':
|
||||
return True
|
||||
else:
|
||||
return False
|
||||
except IOError as e:
|
||||
print("Error: unable to open file: %s" % str(e))
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
def set_low_power_mode(self, port_num, lpmode):
|
||||
# Check for invalid port_num
|
||||
if port_num < self.SFP_PORT_START or port_num > self.SFP_PORT_END:
|
||||
return False
|
||||
|
||||
sfp_lpmode_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-9/i2c-{0}/{0}-0066/xcvr_lpmode"\
|
||||
.format(self.SFP_I2C_BUS_START + (port_num - self.SFP_PORT_START))
|
||||
try:
|
||||
with open(sfp_lpmode_path, 'w') as fd:
|
||||
if lpmode:
|
||||
fd.write('1')
|
||||
else:
|
||||
fd.write('0')
|
||||
|
||||
return True
|
||||
except IOError as e:
|
||||
print("Error: unable to open file: %s" % str(e))
|
||||
return False
|
||||
|
||||
return False
|
||||
|
||||
def reset(self, port_num):
|
||||
# SFP reset is not supported
|
||||
return False
|
||||
|
||||
def get_transceiver_change_event(self, timeout=0):
|
||||
sfp_dict = {}
|
||||
|
||||
SFP_REMOVED = '0'
|
||||
SFP_INSERTED = '1'
|
||||
|
||||
SFP_PRESENT = True
|
||||
SFP_ABSENT = False
|
||||
|
||||
start_time = time.time()
|
||||
time_period = timeout/float(1000) #Convert msecs to secs
|
||||
|
||||
while time.time() < (start_time + time_period) or timeout == 0:
|
||||
for port_idx in range(self.SFP_PORT_START, self.SFP_PORT_END + 1):
|
||||
if self.sfp_status_dict[port_idx] == SFP_REMOVED and \
|
||||
self.get_presence(port_idx) == SFP_PRESENT:
|
||||
sfp_dict[str(port_idx)] = SFP_INSERTED
|
||||
self.sfp_status_dict[port_idx] = SFP_INSERTED
|
||||
elif self.sfp_status_dict[port_idx] == SFP_INSERTED and \
|
||||
self.get_presence(port_idx) == SFP_ABSENT:
|
||||
sfp_dict[str(port_idx)] = SFP_REMOVED
|
||||
self.sfp_status_dict[port_idx] = SFP_REMOVED
|
||||
|
||||
if sfp_dict != {}:
|
||||
return (True, {'sfp':sfp_dict})
|
||||
|
||||
time.sleep(0.5)
|
||||
|
||||
return (True, {}) # Timeout
|
@ -1,4 +1,6 @@
|
||||
{
|
||||
"skip_ledd": true,
|
||||
"skip_pcied": true
|
||||
"skip_pcied": true,
|
||||
"skip_fancontrol": true,
|
||||
"skip_xcvrd_cmis_mgr": true
|
||||
}
|
||||
|
@ -3,13 +3,13 @@
|
||||
"devices_to_ignore": [
|
||||
"asic",
|
||||
"psu.temperature",
|
||||
"PSU2 Fan",
|
||||
"PSU1 Fan"
|
||||
"PSU1_FAN1",
|
||||
"PSU2_FAN1"
|
||||
],
|
||||
"user_defined_checkers": [],
|
||||
"polling_interval": 60,
|
||||
"led_color": {
|
||||
"fault": "orange",
|
||||
"fault": "amber",
|
||||
"normal": "green",
|
||||
"booting": "orange_blink"
|
||||
}
|
||||
|
@ -4,6 +4,7 @@
|
||||
#
|
||||
#############################################################################
|
||||
import os
|
||||
import time
|
||||
|
||||
try:
|
||||
from sonic_platform_pddf_base.pddf_chassis import PddfChassis
|
||||
@ -14,26 +15,29 @@ try:
|
||||
import sys
|
||||
import subprocess
|
||||
from sonic_py_common import device_info
|
||||
from sonic_platform_base.sfp_base import SfpBase
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
NUM_COMPONENT = 3
|
||||
FAN_DIRECTION_FILE_PATH = "/var/fan_direction"
|
||||
NUM_COMPONENT = 2
|
||||
|
||||
class Chassis(PddfChassis):
|
||||
"""
|
||||
PDDF Platform-specific Chassis class
|
||||
"""
|
||||
sfp_status_dict = {}
|
||||
|
||||
def __init__(self, pddf_data=None, pddf_plugin_data=None):
|
||||
|
||||
PddfChassis.__init__(self, pddf_data, pddf_plugin_data)
|
||||
vendor_ext = self._eeprom.vendor_ext_str()
|
||||
with open(FAN_DIRECTION_FILE_PATH, "w+") as f:
|
||||
f.write(vendor_ext)
|
||||
(self.platform, self.hwsku) = device_info.get_platform_and_hwsku()
|
||||
|
||||
self.__initialize_components()
|
||||
self.sfp_port_list = list(range(49, 56+1))
|
||||
|
||||
for port_idx in self.sfp_port_list:
|
||||
present = self.get_sfp(port_idx).get_presence()
|
||||
self.sfp_status_dict[port_idx] = '1' if present else '0'
|
||||
|
||||
def __initialize_components(self):
|
||||
from sonic_platform.component import Component
|
||||
@ -122,11 +126,13 @@ class Chassis(PddfChassis):
|
||||
|
||||
return (reboot_cause, description)
|
||||
|
||||
def get_serial(self):
|
||||
return self._eeprom.serial_number_str()
|
||||
|
||||
def get_revision(self):
|
||||
return self._eeprom.revision_str()
|
||||
version_str = self._eeprom.revision_str()
|
||||
|
||||
if version_str != "NA":
|
||||
return str(bytearray(version_str, 'ascii')[0])
|
||||
|
||||
return version_str
|
||||
|
||||
@staticmethod
|
||||
def get_position_in_parent():
|
||||
@ -134,19 +140,7 @@ class Chassis(PddfChassis):
|
||||
|
||||
@staticmethod
|
||||
def is_replaceable():
|
||||
return True
|
||||
|
||||
def get_base_mac(self):
|
||||
return self._eeprom.base_mac_addr()
|
||||
|
||||
def get_system_eeprom_info(self):
|
||||
return self._eeprom.system_eeprom_info()
|
||||
|
||||
def get_name(self):
|
||||
return self.modelstr()
|
||||
|
||||
def get_model(self):
|
||||
return self._eeprom.part_number_str()
|
||||
return False
|
||||
|
||||
def set_status_led(self, color):
|
||||
color_dict = {
|
||||
@ -155,8 +149,94 @@ class Chassis(PddfChassis):
|
||||
'amber': "STATUS_LED_COLOR_AMBER",
|
||||
'off': "STATUS_LED_COLOR_OFF"
|
||||
}
|
||||
return self.set_system_led("SYS_LED", color_dict.get(color, "off"))
|
||||
return self.set_system_led("SYS_LED", color_dict.get(color, "STATUS_LED_COLOR_OFF"))
|
||||
|
||||
def get_status_led(self):
|
||||
return self.get_system_led("SYS_LED")
|
||||
|
||||
def get_port_or_cage_type(self, index):
|
||||
"""
|
||||
Retrieves sfp port or cage type corresponding to physical port <index>
|
||||
|
||||
Args:
|
||||
index: An integer (>=0), the index of the sfp to retrieve.
|
||||
The index should correspond to the physical port in a chassis.
|
||||
For example:-
|
||||
1 for Ethernet0, 2 for Ethernet4 and so on for one platform.
|
||||
0 for Ethernet0, 1 for Ethernet4 and so on for another platform.
|
||||
|
||||
Returns:
|
||||
The masks of all types of port or cage that can be supported on the port
|
||||
Types are defined in sfp_base.py
|
||||
Eg.
|
||||
Both SFP and SFP+ are supported on the port, the return value should be 0x0a
|
||||
which is 0x02 | 0x08
|
||||
"""
|
||||
if index in range(1, 48+1):
|
||||
return SfpBase.SFP_PORT_TYPE_BIT_RJ45
|
||||
elif index in range(49, 56+1):
|
||||
return (SfpBase.SFP_PORT_TYPE_BIT_SFP | SfpBase.SFP_PORT_TYPE_BIT_SFP_PLUS)
|
||||
else:
|
||||
raise NotImplementedError
|
||||
|
||||
def get_change_event(self, timeout=0):
|
||||
"""
|
||||
Returns a nested dictionary containing all devices which have
|
||||
experienced a change at chassis level
|
||||
|
||||
Args:
|
||||
timeout: Timeout in milliseconds (optional). If timeout == 0,
|
||||
this method will block until a change is detected.
|
||||
|
||||
Returns:
|
||||
(bool, dict):
|
||||
- True if call successful, False if not;
|
||||
- A nested dictionary where key is a device type,
|
||||
value is a dictionary with key:value pairs in the format of
|
||||
{'device_id':'device_event'},
|
||||
where device_id is the device ID for this device and
|
||||
device_event,
|
||||
status='1' represents device inserted,
|
||||
status='0' represents device removed.
|
||||
Ex. {'fan':{'0':'0', '2':'1'}, 'sfp':{'11':'0'}}
|
||||
indicates that fan 0 has been removed, fan 2
|
||||
has been inserted and sfp 11 has been removed.
|
||||
Specifically for SFP event, besides SFP plug in and plug out,
|
||||
there are some other error event could be raised from SFP, when
|
||||
these error happened, SFP eeprom will not be avalaible, XCVRD shall
|
||||
stop to read eeprom before SFP recovered from error status.
|
||||
status='2' I2C bus stuck,
|
||||
status='3' Bad eeprom,
|
||||
status='4' Unsupported cable,
|
||||
status='5' High Temperature,
|
||||
status='6' Bad cable.
|
||||
"""
|
||||
|
||||
sfp_dict = {}
|
||||
|
||||
SFP_REMOVED = '0'
|
||||
SFP_INSERTED = '1'
|
||||
|
||||
SFP_PRESENT = True
|
||||
SFP_ABSENT = False
|
||||
|
||||
start_time = time.time()
|
||||
time_period = timeout/float(1000) #Convert msecs to secs
|
||||
|
||||
while time.time() < (start_time + time_period) or timeout == 0:
|
||||
for port_idx in self.sfp_port_list:
|
||||
if self.sfp_status_dict[port_idx] == SFP_REMOVED and \
|
||||
self.get_sfp(port_idx).get_presence() == SFP_PRESENT:
|
||||
sfp_dict[port_idx] = SFP_INSERTED
|
||||
self.sfp_status_dict[port_idx] = SFP_INSERTED
|
||||
elif self.sfp_status_dict[port_idx] == SFP_INSERTED and \
|
||||
self.get_sfp(port_idx).get_presence() == SFP_ABSENT:
|
||||
sfp_dict[port_idx] = SFP_REMOVED
|
||||
self.sfp_status_dict[port_idx] = SFP_REMOVED
|
||||
|
||||
if sfp_dict:
|
||||
return True, {'sfp':sfp_dict}
|
||||
|
||||
time.sleep(0.5)
|
||||
|
||||
return True, {'sfp':{}} # Timeout
|
||||
|
@ -9,21 +9,19 @@
|
||||
#############################################################################
|
||||
|
||||
import subprocess
|
||||
import time
|
||||
|
||||
try:
|
||||
from sonic_platform_base.component_base import ComponentBase
|
||||
from sonic_py_common.general import getstatusoutput_noshell_pipe
|
||||
#from helper import APIHelper
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
SWCPLD_VERSION_PATH = ["i2cget", "-y", "-f", "2", "0x32", "0"]
|
||||
BIOS_VERSION_PATH_CMD1 = ["dmidecode", "-t", "bios"]
|
||||
BIOS_VERSION_PATH_CMD2 = ["grep", "Version"]
|
||||
COMPONENT_NAME_LIST = ["SWCPLD", "Main_BIOS", "Backup_BIOS"]
|
||||
COMPONENT_DES_LIST = ["Use for boot control and BIOS switch",
|
||||
"Main basic Input/Output System",
|
||||
"Backup basic Input/Output System"]
|
||||
SWCPLD_VERSION_PATH = ['i2cget', '-y', '-f', '2', '0x32', '0']
|
||||
BIOS_VERSION_PATH = ['dmidecode', '-s', 'bios-version']
|
||||
COMPONENT_NAME_LIST = ["SWCPLD", "BIOS"]
|
||||
COMPONENT_DES_LIST = ["Used for managing the chassis and SFP+ ports (49-56)",
|
||||
"Basic Input/Output System"]
|
||||
|
||||
|
||||
class Component(ComponentBase):
|
||||
@ -34,43 +32,32 @@ class Component(ComponentBase):
|
||||
def __init__(self, component_index):
|
||||
ComponentBase.__init__(self)
|
||||
self.index = component_index
|
||||
#self._api_helper = APIHelper()
|
||||
self.name = self.get_name()
|
||||
|
||||
def run_command(self,cmd):
|
||||
responses = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True).stdout.read()
|
||||
return responses
|
||||
|
||||
def __get_bios_version(self):
|
||||
# Retrieves the BIOS firmware version
|
||||
result = self.run_command(["i2cget", "-y", "-f", "2", "0x32", "0x19"])
|
||||
if result.strip() == "0x01":
|
||||
if self.name == "Main_BIOS":
|
||||
_, version = getstatusoutput_noshell_pipe(BIOS_VERSION_PATH_CMD1, BIOS_VERSION_PATH_CMD2)
|
||||
bios_version = version.strip().split(" ")[1]
|
||||
return str(bios_version)
|
||||
elif self.name == "Backup_BIOS":
|
||||
bios_version = "na"
|
||||
return bios_version
|
||||
version = "N/A"
|
||||
|
||||
elif result.strip() == "0x03":
|
||||
if self.name == "Backup_BIOS":
|
||||
_, version = getstatusoutput_noshell_pipe(BIOS_VERSION_PATH_CMD1, BIOS_VERSION_PATH_CMD2)
|
||||
bios_version = version.strip().split(" ")[1]
|
||||
return str(bios_version)
|
||||
elif self.name == "Main_BIOS":
|
||||
bios_version = "na"
|
||||
return bios_version
|
||||
try:
|
||||
p = subprocess.Popen(BIOS_VERSION_PATH, stdout=subprocess.PIPE, universal_newlines=True)
|
||||
data = p.communicate()
|
||||
version = data[0].strip()
|
||||
except IOError:
|
||||
pass
|
||||
|
||||
return version
|
||||
|
||||
def __get_cpld_version(self):
|
||||
if self.name == "SWCPLD":
|
||||
ver = self.run_command(SWCPLD_VERSION_PATH)
|
||||
print("ver is %s" % ver)
|
||||
ver = ver.strip().split("x")[1]
|
||||
print("ver2 is %s" % ver)
|
||||
version = int(ver.strip()) / 10
|
||||
return str(version)
|
||||
version = "N/A"
|
||||
try:
|
||||
p = subprocess.Popen(SWCPLD_VERSION_PATH, stdout=subprocess.PIPE, universal_newlines=True)
|
||||
data = p.communicate()
|
||||
ver = int(data[0].strip(), 16)
|
||||
version = "{0}.{1}".format(ver >> 4, ver & 0x0F)
|
||||
except (IOError, ValueError):
|
||||
pass
|
||||
|
||||
return version
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
@ -96,7 +83,7 @@ class Component(ComponentBase):
|
||||
"""
|
||||
fw_version = None
|
||||
|
||||
if "BIOS" in self.name:
|
||||
if self.name == "BIOS":
|
||||
fw_version = self.__get_bios_version()
|
||||
elif "CPLD" in self.name:
|
||||
fw_version = self.__get_cpld_version()
|
||||
|
@ -9,7 +9,6 @@ except ImportError as e:
|
||||
# add function:set_status_led,
|
||||
# Solve the problem that when a fan is pulled out, the Fan LED on the front panel is still green Issue-#11525
|
||||
# ------------------------------------------------------------------
|
||||
FAN_DIRECTION_FILE_PATH = "/var/fan_direction"
|
||||
|
||||
|
||||
class Fan(PddfFan):
|
||||
@ -32,8 +31,22 @@ class Fan(PddfFan):
|
||||
# this value in derived pddf fan class
|
||||
return 20
|
||||
|
||||
|
||||
def get_presence(self):
|
||||
if self.is_psu_fan:
|
||||
#For PSU, FAN must be present when PSU is present
|
||||
try:
|
||||
cmd = ['i2cget', '-y', '-f', '0x2', '0x32', '0x41']
|
||||
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True)
|
||||
data = p.communicate()
|
||||
status = int(data[0].strip(), 16)
|
||||
if (self.fans_psu_index == 1 and (status & 0x10) == 0) or \
|
||||
(self.fans_psu_index == 2 and (status & 0x20) == 0):
|
||||
return True
|
||||
except (IOError, ValueError):
|
||||
pass
|
||||
|
||||
return False
|
||||
else:
|
||||
#Overwirte the PDDF Common since the FANs on Belgite are all Fixed and present
|
||||
return True
|
||||
|
||||
@ -46,102 +59,35 @@ class Fan(PddfFan):
|
||||
depending on fan direction
|
||||
"""
|
||||
if self.is_psu_fan:
|
||||
cmd_num = "58" if self.fans_psu_index == 1 else "59"
|
||||
cmd = ["i2cget", "-y", "-f", "4", "", "0x80"]
|
||||
cmd[4] = "0x" + cmd_num
|
||||
res = subprocess.Popen(cmd, stdout=subprocess.PIPE, universal_newlines=True).stdout.read()
|
||||
# F2B
|
||||
if res.strip() == "0x01":
|
||||
direction = "EXHAUST"
|
||||
# Belgite PSU module only has EXHAUST fan
|
||||
return "EXHAUST"
|
||||
else:
|
||||
direction = "INTAKE"
|
||||
else:
|
||||
direction = "INTAKE"
|
||||
with open(FAN_DIRECTION_FILE_PATH, "r") as f:
|
||||
fan_direction = f.read()
|
||||
if fan_direction.strip() == "FB":
|
||||
direction = "EXHAUST"
|
||||
return direction
|
||||
return super().get_direction()
|
||||
|
||||
|
||||
def get_status(self):
|
||||
speed = self.get_speed_rpm()
|
||||
status = True if (speed != 0) else False
|
||||
return status
|
||||
|
||||
def get_target_speed(self):
|
||||
def get_status_led(self):
|
||||
"""
|
||||
Retrieves the target (expected) speed of the fan
|
||||
Gets the state of the fan status LED
|
||||
|
||||
Returns:
|
||||
An integer, the percentage of full fan speed, in the range 0 (off)
|
||||
to 100 (full speed)
|
||||
A string, one of the predefined STATUS_LED_COLOR_* strings above
|
||||
"""
|
||||
target_speed = 0
|
||||
if self.is_psu_fan:
|
||||
# Target speed not usually supported for PSU fans
|
||||
target_speed = "N/A"
|
||||
return "N/A"
|
||||
else:
|
||||
idx = (self.fantray_index - 1) * 1 + self.fan_index
|
||||
attr = "fan" + str(idx) + "_pwm"
|
||||
pwm_path = "/sys/devices/pci0000:00/0000:00:12.0/i2c-0/i2c-2/2-0066/" + attr
|
||||
pwm = 0
|
||||
with open(pwm_path, "r") as f:
|
||||
pwm = f.read()
|
||||
|
||||
percentage = int(pwm.strip())
|
||||
speed_percentage = int(round(percentage / 255 * 100))
|
||||
target_speed = speed_percentage
|
||||
|
||||
return target_speed
|
||||
return super().get_status_led()
|
||||
|
||||
def set_status_led(self, color):
|
||||
color_dict = {"green": "STATUS_LED_COLOR_GREEN",
|
||||
"red": "STATUS_LED_COLOR_AMBER"}
|
||||
color = color_dict.get(color, "off")
|
||||
index = str(self.fantray_index - 1)
|
||||
led_device_name = "FANTRAY{}".format(self.fantray_index) + "_LED"
|
||||
|
||||
result, msg = self.pddf_obj.is_supported_sysled_state(led_device_name, color)
|
||||
if result is False:
|
||||
return False
|
||||
device_name = self.pddf_obj.data[led_device_name]['dev_info']['device_name']
|
||||
self.pddf_obj.create_attr('device_name', device_name, self.pddf_obj.get_led_path())
|
||||
self.pddf_obj.create_attr('index', index, self.pddf_obj.get_led_path())
|
||||
self.pddf_obj.create_attr('color', color, self.pddf_obj.get_led_cur_state_path())
|
||||
|
||||
self.pddf_obj.create_attr('dev_ops', 'set_status', self.pddf_obj.get_led_path())
|
||||
return True
|
||||
|
||||
@staticmethod
|
||||
def get_model():
|
||||
"""
|
||||
Retrieves the model number (or part number) of the device
|
||||
Sets the state of the fan module status LED
|
||||
|
||||
Args:
|
||||
color: A string representing the color with which to set the
|
||||
fan module status LED
|
||||
|
||||
Returns:
|
||||
string: Model/part number of device
|
||||
"""
|
||||
model = "Unknown"
|
||||
return model
|
||||
|
||||
@staticmethod
|
||||
def get_serial():
|
||||
"""
|
||||
Retrieves the serial number of the device
|
||||
Returns:
|
||||
string: Serial number of device
|
||||
"""
|
||||
serial = "Unknown"
|
||||
return serial
|
||||
|
||||
def get_position_in_parent(self):
|
||||
"""
|
||||
Retrieves the fan/psu fan index number
|
||||
"""
|
||||
return self.fantray_index if not self.is_psu_fan else self.fans_psu_index + 4
|
||||
|
||||
@staticmethod
|
||||
def is_replaceable():
|
||||
"""
|
||||
Retrieves whether the device is replaceable
|
||||
bool: True if status LED state is set successfully, False if not
|
||||
"""
|
||||
if self.is_psu_fan:
|
||||
return False
|
||||
else:
|
||||
return super().set_status_led(color)
|
||||
|
@ -53,3 +53,21 @@ class Psu(PddfPsu):
|
||||
|
||||
def temperature(self):
|
||||
return self.get_temperature()
|
||||
|
||||
def get_voltage_high_threshold(self):
|
||||
"""
|
||||
Retrieves the high threshold PSU voltage output
|
||||
Returns:
|
||||
A float number, the high threshold output voltage in volts,
|
||||
e.g. 12.1
|
||||
"""
|
||||
return 12.6
|
||||
|
||||
def get_voltage_low_threshold(self):
|
||||
"""
|
||||
Retrieves the low threshold PSU voltage output
|
||||
Returns:
|
||||
A float number, the low threshold output voltage in volts,
|
||||
e.g. 12.1
|
||||
"""
|
||||
return 11.4
|
||||
|
@ -7,4 +7,7 @@ sleep 0.1
|
||||
#Set LM75 shutdown enable
|
||||
sudo i2cset -y -f 2 0x32 0x45 0x1
|
||||
|
||||
# set sys led green status
|
||||
sudo i2cset -y -f 2 0x32 0x43 0xec
|
||||
|
||||
echo -2 | tee /sys/bus/i2c/drivers/pca954x/*-00*/idle_state
|
||||
|
Loading…
Reference in New Issue
Block a user