diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/buffers.json.j2 b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/buffers.json.j2 new file mode 100644 index 000000000000..1083a6210fc9 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/buffers.json.j2 @@ -0,0 +1,2 @@ +{%- set default_topo = 't0' %} +{%- include 'buffers_config.j2' %} diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/buffers_defaults_t0.j2 b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/buffers_defaults_t0.j2 new file mode 100644 index 000000000000..64735cf0e29e --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/buffers_defaults_t0.j2 @@ -0,0 +1,86 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '4194304' %} +{% set ingress_lossy_pool_size = '7340032' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '7340032' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,47) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} + {% for port_idx in range(48,55) %} + {% if PORT.append("Ethernet%d" % (48 + ( port_idx - 48 )*4)) %}{% endif %} + {% endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"4096", + "dynamic_th":"0", + "xon":"18432", + "xoff":"18432" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"4096", + "dynamic_th":"7", + "xon":"18432", + "xoff":"18432" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { + "profile" : "q_lossy_profile" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }{% if not loop.last %},{% endif %} +{% endfor %} + } +{%- endmacro %} diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/buffers_defaults_t1.j2 b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/buffers_defaults_t1.j2 new file mode 100644 index 000000000000..cea4955456bf --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/buffers_defaults_t1.j2 @@ -0,0 +1,86 @@ +{% set default_cable = '5m' %} +{% set ingress_lossless_pool_size = '2097152' %} +{% set ingress_lossy_pool_size = '5242880' %} +{% set egress_lossless_pool_size = '16777152' %} +{% set egress_lossy_pool_size = '5242880' %} + +{%- macro generate_port_lists(PORT_ALL) %} + {# Generate list of ports #} + {%- for port_idx in range(0,47) %} + {%- if PORT_ALL.append("Ethernet%d" % (port_idx)) %}{%- endif %} + {%- endfor %} + {% for port_idx in range(48,55) %} + {% if PORT.append("Ethernet%d" % (48+(port_idx-48)*4)) %}{% endif %} + {% endfor %} +{%- endmacro %} + +{%- macro generate_buffer_pool_and_profiles() %} + "BUFFER_POOL": { + "ingress_lossless_pool": { + "size": "{{ ingress_lossless_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "ingress_lossy_pool": { + "size": "{{ ingress_lossy_pool_size }}", + "type": "ingress", + "mode": "dynamic" + }, + "egress_lossless_pool": { + "size": "{{ egress_lossless_pool_size }}", + "type": "egress", + "mode": "dynamic" + }, + "egress_lossy_pool": { + "size": "{{ egress_lossy_pool_size }}", + "type": "egress", + "mode": "dynamic" + } + }, + "BUFFER_PROFILE": { + "ingress_lossless_profile": { + "pool":"ingress_lossless_pool", + "size":"4096", + "dynamic_th":"0", + "xon":"18432", + "xoff":"18432" + }, + "ingress_lossy_profile": { + "pool":"ingress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + }, + "egress_lossless_profile": { + "pool":"egress_lossless_pool", + "size":"4096", + "dynamic_th":"7", + "xon":"18432", + "xoff":"18432" + }, + "egress_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + }, + "q_lossy_profile": { + "pool":"egress_lossy_pool", + "size":"4096", + "dynamic_th":"3" + } + }, +{%- endmacro %} + +{%- macro generate_queue_buffers(port_names) %} + "BUFFER_QUEUE": { +{% for port in port_names.split(',') %} + "{{ port }}|0-2": { + "profile" : "q_lossy_profile" + }, +{% endfor %} +{% for port in port_names.split(',') %} + "{{ port }}|3-4": { + "profile" : "egress_lossless_profile" + }{% if not loop.last %},{% endif %} +{% endfor %} + } +{%- endmacro %} diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/hwsku.json b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/hwsku.json new file mode 100644 index 000000000000..203aa5a34047 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/hwsku.json @@ -0,0 +1,164 @@ +{ + "interfaces": { + "Ethernet0": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet4": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet8": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet12": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet16": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet20": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet24": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet28": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet32": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet36": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet40": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet44": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet48": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet52": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet56": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet60": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet64": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet68": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet72": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet76": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet80": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet84": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet88": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet92": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet96": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet100": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet104": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet108": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet112": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet116": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet120": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + }, + "Ethernet124": { + "default_brkout_mode": "1x100G[40G]", + "autoneg": "off", + "fec": "rs" + } + } +} diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/pg_profile_lookup.ini b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/pg_profile_lookup.ini new file mode 100644 index 000000000000..26287e4b6fea --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/pg_profile_lookup.ini @@ -0,0 +1,17 @@ +# PG lossless profiles. +# speed cable size xon xoff threshold + 10000 5m 34816 18432 16384 0 + 25000 5m 34816 18432 16384 0 + 40000 5m 34816 18432 16384 0 + 50000 5m 34816 18432 16384 0 + 100000 5m 36864 18432 18432 0 + 10000 40m 36864 18432 18432 0 + 25000 40m 39936 18432 21504 0 + 40000 40m 41984 18432 23552 0 + 50000 40m 41984 18432 23552 0 + 100000 40m 54272 18432 35840 0 + 10000 300m 49152 18432 30720 0 + 25000 300m 71680 18432 53248 0 + 40000 300m 94208 18432 75776 0 + 50000 300m 94208 18432 75776 0 + 100000 300m 184320 18432 165888 0 diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/port_config.ini b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/port_config.ini new file mode 100644 index 000000000000..180555196c18 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/port_config.ini @@ -0,0 +1,33 @@ +# name lanes alias speed autoneg fec index +Ethernet0 0,1,2,3 Ethernet0 100000 0 rs 0 +Ethernet4 4,5,6,7 Ethernet4 100000 0 rs 1 +Ethernet8 8,9,10,11 Ethernet8 100000 0 rs 2 +Ethernet12 12,13,14,15 Ethernet12 100000 0 rs 3 +Ethernet16 16,17,18,19 Ethernet16 100000 0 rs 4 +Ethernet20 20,21,22,23 Ethernet20 100000 0 rs 5 +Ethernet24 24,25,26,27 Ethernet24 100000 0 rs 6 +Ethernet28 28,29,30,31 Ethernet28 100000 0 rs 7 +Ethernet32 32,33,34,35 Ethernet32 100000 0 rs 8 +Ethernet36 36,37,38,39 Ethernet36 100000 0 rs 9 +Ethernet40 40,41,42,43 Ethernet40 100000 0 rs 10 +Ethernet44 44,45,46,47 Ethernet44 100000 0 rs 11 +Ethernet48 48,49,50,51 Ethernet48 100000 0 rs 12 +Ethernet52 52,53,54,55 Ethernet52 100000 0 rs 13 +Ethernet56 56,57,58,59 Ethernet56 100000 0 rs 14 +Ethernet60 60,61,62,63 Ethernet60 100000 0 rs 15 +Ethernet64 64,65,66,67 Ethernet64 100000 0 rs 16 +Ethernet68 68,69,70,71 Ethernet68 100000 0 rs 17 +Ethernet72 72,73,74,75 Ethernet72 100000 0 rs 18 +Ethernet76 76,77,78,79 Ethernet76 100000 0 rs 19 +Ethernet80 80,81,82,83 Ethernet80 100000 0 rs 20 +Ethernet84 84,85,86,87 Ethernet84 100000 0 rs 21 +Ethernet88 88,89,90,91 Ethernet88 100000 0 rs 22 +Ethernet92 92,93,94,95 Ethernet92 100000 0 rs 23 +Ethernet96 96,97,98,99 Ethernet96 100000 0 rs 24 +Ethernet100 100,101,102,103 Ethernet100 100000 0 rs 25 +Ethernet104 104,105,106,107 Ethernet104 100000 0 rs 26 +Ethernet108 108,109,110,111 Ethernet108 100000 0 rs 27 +Ethernet112 112,113,114,115 Ethernet112 100000 0 rs 28 +Ethernet116 116,117,118,119 Ethernet116 100000 0 rs 29 +Ethernet120 120,121,122,123 Ethernet120 100000 0 rs 30 +Ethernet124 124,125,126,127 Ethernet124 100000 0 rs 31 diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/qos.json.j2 b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/qos.json.j2 new file mode 100644 index 000000000000..f7cd608b6b66 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/qos.json.j2 @@ -0,0 +1,10 @@ +{%- macro generate_tc_to_pg_map() %} + "TC_TO_PRIORITY_GROUP_MAP": { + "AZURE": { + "3": "3", + "4": "4" + } + }, +{%- endmacro %} + +{%- include 'qos_config.j2' %} \ No newline at end of file diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/sai.profile b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/sai.profile new file mode 100644 index 000000000000..81f300522592 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/sai.profile @@ -0,0 +1,2 @@ +SAI_KEY_WARM_BOOT_WRITE_FILE=/var/warmboot/sai-warmboot.bin +SAI_KEY_WARM_BOOT_READ_FILE=/var/warmboot/sai-warmboot.bin \ No newline at end of file diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/switch-tna-sai.conf b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/switch-tna-sai.conf new file mode 100644 index 000000000000..23707a4ee919 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/aurora-710/switch-tna-sai.conf @@ -0,0 +1,39 @@ +{ + "chip_list": [ + { + "chip_family": "Tofino", + "sds_fw_path": "share/tofino_sds_fw/avago/firmware", + "instance": 0 + } + ], + "p4_devices": [ + { + "device-id": 0, + "agent0": "lib/platform/x86_64-netberg_aurora_710-r0/libpltfm_mgr.so", + "p4_programs": [ + { + "p4_pipelines": [ + { + "p4_pipeline_name": "pipe", + "config": "share/switch/pipe/tofino.bin", + "context": "share/switch/pipe/context.json" + } + ], + "program-name": "switch", + "bfrt-config": "share/switch/bf-rt.json", + "model_json_path" : "share/switch/aug_model.json", + "switchapi_port_add": false, + "non_default_port_ppgs": 5 + } + ] + } + ], + "switch_options": [ + { + "device-id": 0, + "model_json_path": "share/switch/aug_model.json", + "non_default_port_ppgs": 5, + "switchapi_port_add": false + } + ] +} diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/default_sku b/device/netberg/x86_64-netberg_aurora_710-r0/default_sku new file mode 100644 index 000000000000..d6002ac2c9ba --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/default_sku @@ -0,0 +1 @@ +aurora-710 t1 diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/fancontrol b/device/netberg/x86_64-netberg_aurora_710-r0/fancontrol new file mode 100644 index 000000000000..dc303afac034 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/fancontrol @@ -0,0 +1,12 @@ +# Configuration file generated by pwmconfig, changes will be lost +INTERVAL=10 +DEVPATH=hwmon1=devices/pci0000:00/0000:00:1f.3/i2c-0/i2c-56/56-002f +DEVNAME=hwmon1=w83795adg +FCTEMPS=hwmon1/device/pwm2=hwmon2/temp2_input hwmon1/device/pwm1=hwmon2/temp2_input +FCFANS=hwmon1/device/pwm2=hwmon1/device/fan8_input hwmon1/device/pwm2=hwmon1/device/fan7_input hwmon1/device/pwm2=hwmon1/device/fan6_input hwmon1/device/pwm2=hwmon1/device/fan5_input hwmon1/device/pwm1=hwmon1/device/fan4_input hwmon1/device/pwm1=hwmon1/device/fan3_input hwmon1/device/pwm1=hwmon1/device/fan2_input hwmon1/device/pwm1=hwmon1/device/fan1_input +# TODO: check the temp value with HW after board ready +MINTEMP=hwmon1/device/pwm2=20 hwmon1/device/pwm1=20 +MAXTEMP=hwmon1/device/pwm2=60 hwmon1/device/pwm1=60 +MINSTART=hwmon1/device/pwm2=75 hwmon1/device/pwm1=75 +MINSTOP=hwmon1/device/pwm2=22 hwmon1/device/pwm1=22 + diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/installer.conf b/device/netberg/x86_64-netberg_aurora_710-r0/installer.conf new file mode 100644 index 000000000000..925a32fc0c3a --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/installer.conf @@ -0,0 +1,3 @@ +CONSOLE_PORT=0x3f8 +CONSOLE_DEV=0 +CONSOLE_SPEED=115200 diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/pcie.yaml b/device/netberg/x86_64-netberg_aurora_710-r0/pcie.yaml new file mode 100644 index 000000000000..adafbe61e649 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/pcie.yaml @@ -0,0 +1,417 @@ +- 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: '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: '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: '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: 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: 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: '01' + dev: '00' + fn: '0' + id: 6f50 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 0' +- bus: '01' + dev: '00' + fn: '1' + id: 6f51 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 1' +- bus: '01' + dev: '00' + fn: '2' + id: 6f52 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 2' +- bus: '01' + dev: '00' + fn: '3' + id: 6f53 + name: 'System peripheral: Intel Corporation Xeon Processor D Family QuickData Technology + Register DMA Channel 3' +- bus: '02' + dev: '00' + fn: '0' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '02' + dev: '00' + fn: '1' + id: 15ab + name: 'Ethernet controller: Intel Corporation Ethernet Connection X552 10 GbE Backplane' +- bus: '04' + dev: '00' + fn: '0' + id: '0010' + name: 'Unassigned class [ff00]: Device 1d1c:0010 (rev 10)' +- bus: 08 + dev: '00' + fn: '0' + id: '1533' + name: 'Ethernet controller: Intel Corporation I210 Gigabit Network Connection (rev + 03)' +- 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)' diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/platform_asic b/device/netberg/x86_64-netberg_aurora_710-r0/platform_asic new file mode 100644 index 000000000000..88d88117928c --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/platform_asic @@ -0,0 +1 @@ +barefoot diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/plugins/eeprom.py b/device/netberg/x86_64-netberg_aurora_710-r0/plugins/eeprom.py new file mode 100644 index 000000000000..18c3e5f05a57 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/plugins/eeprom.py @@ -0,0 +1,22 @@ +#!/usr/bin/env python + +############################################################################# +# Netberg Aurora 710 +# +# Platform and model specific eeprom subclass, inherits from the base class, +# and provides the followings: +# - the eeprom format definition +# - specific encoder/decoder if there is special need +############################################################################# + +try: + from sonic_eeprom import eeprom_tlvinfo +except ImportError, e: + raise ImportError (str(e) + "- required module not found") + + +class board(eeprom_tlvinfo.TlvInfoDecoder): + + def __init__(self, name, path, cpld_root, ro): + self.eeprom_path = "/sys/class/i2c-adapter/i2c-0/0-0055/eeprom" + super(board, self).__init__(self.eeprom_path, 0, '', True) diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/plugins/psuutil.py b/device/netberg/x86_64-netberg_aurora_710-r0/plugins/psuutil.py new file mode 100644 index 000000000000..25cdfb031882 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/plugins/psuutil.py @@ -0,0 +1,107 @@ +# +# psuutil.py +# Platform-specific PSU status interface for SONiC +# + + +import os.path + +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""" + + GPIO_OFFSET = 0 + SYS_GPIO_DIR = "/sys/class/gpio/" + + def set_gpio_offset(self): + sys_gpio_dir = "/sys/class/gpio" + self.GPIO_OFFSET = 0 + gpiochip_no = 0 + for d in os.listdir(sys_gpio_dir): + if "gpiochip" in d: + try: + gpiochip_no = int(d[8:],10) + except ValueError as e: + print "Error: %s" % str(e) + if gpiochip_no > 255: + self.GPIO_OFFSET=256 + return True + return True + + def __init__(self): + self.set_gpio_offset() + PsuBase.__init__(self) + + + # Get sysfs attribute + def get_attr_value(self, attr_path): + + retval = 'ERR' + if (not os.path.isfile(attr_path)): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open ", attr_path, " file !") + + retval = retval.rstrip('\r\n') + return retval + + 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 + """ + MAX_PSUS = 2 + return MAX_PSUS + + def get_psu_status(self, index): + """ + Retrieves the oprational status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is operating properly, False if PSU is\ + faulty + """ + status = 0 + gpio_path = [ 'gpio'+str(99+self.GPIO_OFFSET)+'/value', 'gpio'+str(96+self.GPIO_OFFSET)+'/value' ] + attr_path = self.SYS_GPIO_DIR + gpio_path[index-1] + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 10) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + + def get_psu_presence(self, index): + """ + Retrieves the presence status of power supply unit (PSU) defined + by index + :param index: An integer, index of the PSU of which to query status + :return: Boolean, True if PSU is plugged, False if not + """ + status = 0 + gpio_path = [ 'gpio'+str(100+self.GPIO_OFFSET)+'/value', 'gpio'+str(97+self.GPIO_OFFSET)+'/value' ] + attr_path = self.SYS_GPIO_DIR + gpio_path[index-1] + + attr_value = self.get_attr_value(attr_path) + + if (attr_value != 'ERR'): + attr_value = int(attr_value, 10) + # Check for PSU status + if (attr_value == 1): + status = 1 + + return status + diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/plugins/sfputil.py b/device/netberg/x86_64-netberg_aurora_710-r0/plugins/sfputil.py new file mode 100644 index 000000000000..00c5e10e0b0d --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/plugins/sfputil.py @@ -0,0 +1,332 @@ +# sfputil.py +# +# Platform-specific SFP transceiver interface for SONiC +# + +import os + +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 = 0 + PORT_END = 33 + SFP_PORT_START = 32 + PORTS_IN_BLOCK = 34 + GPIO_OFFSET = 0 + + BASE_DIR_PATH = "/sys/class/gpio/gpio{0}/direction" + BASE_VAL_PATH = "/sys/class/gpio/gpio{0}/value" + + _port_to_eeprom_mapping = {} + port_to_i2c_mapping = { + 0: 10, + 1: 9, + 2: 12, + 3: 11, + 4: 14, + 5: 13, + 6: 16, + 7: 15, + 8: 18, + 9: 17, + 10: 20, + 11: 19, + 12: 22, + 13: 21, + 14: 24, + 15: 23, + 16: 26, + 17: 25, + 18: 28, + 19: 27, + 20: 30, + 21: 29, + 22: 32, + 23: 31, + 24: 34, + 25: 33, + 26: 36, + 27: 35, + 28: 38, + 29: 37, + 30: 40, + 31: 39, + 32: 45, + 33: 46 + } + + abs_to_gpio_mapping = {} + lpmode_to_gpio_mapping = {} + reset_to_gpio_mapping = {} + + @property + def port_start(self): + return self.PORT_START + + @property + def port_end(self): + return self.PORT_END + + @property + def qsfp_ports(self): + return range(0, self.PORTS_IN_BLOCK + 1) + + @property + def port_to_eeprom_mapping(self): + return self._port_to_eeprom_mapping + @property + def sfp_port_start(self): + return self.SFP_PORT_START + + def set_gpio_offset(self): + sys_gpio_dir = "/sys/class/gpio" + self.GPIO_OFFSET = 0 + gpiochip_no = 0 + for d in os.listdir(sys_gpio_dir): + if "gpiochip" in d: + try: + gpiochip_no = int(d[8:],10) + except ValueError as e: + print "Error: %s" % str(e) + if gpiochip_no > 255: + self.GPIO_OFFSET=256 + return True + return True + + def init_abs_to_gpio_mapping(self): + self.abs_to_gpio_mapping = { + 0: 241+self.GPIO_OFFSET, + 1: 240+self.GPIO_OFFSET, + 2: 243+self.GPIO_OFFSET, + 3: 242+self.GPIO_OFFSET, + 4: 245+self.GPIO_OFFSET, + 5: 244+self.GPIO_OFFSET, + 6: 247+self.GPIO_OFFSET, + 7: 246+self.GPIO_OFFSET, + 8: 249+self.GPIO_OFFSET, + 9: 248+self.GPIO_OFFSET, + 10: 251+self.GPIO_OFFSET, + 11: 250+self.GPIO_OFFSET, + 12: 253+self.GPIO_OFFSET, + 13: 252+self.GPIO_OFFSET, + 14: 255+self.GPIO_OFFSET, + 15: 254+self.GPIO_OFFSET, + 16: 225+self.GPIO_OFFSET, + 17: 224+self.GPIO_OFFSET, + 18: 227+self.GPIO_OFFSET, + 19: 226+self.GPIO_OFFSET, + 20: 229+self.GPIO_OFFSET, + 21: 228+self.GPIO_OFFSET, + 22: 231+self.GPIO_OFFSET, + 23: 230+self.GPIO_OFFSET, + 24: 233+self.GPIO_OFFSET, + 25: 232+self.GPIO_OFFSET, + 26: 235+self.GPIO_OFFSET, + 27: 234+self.GPIO_OFFSET, + 28: 237+self.GPIO_OFFSET, + 29: 236+self.GPIO_OFFSET, + 30: 239+self.GPIO_OFFSET, + 31: 238+self.GPIO_OFFSET, + 32: 177+self.GPIO_OFFSET, + 33: 176+self.GPIO_OFFSET + } + return True + + def init_lpmode_to_gpio_mapping(self): + self.lpmode_to_gpio_mapping = { + 0: 161+self.GPIO_OFFSET, + 1: 160+self.GPIO_OFFSET, + 2: 163+self.GPIO_OFFSET, + 3: 162+self.GPIO_OFFSET, + 4: 165+self.GPIO_OFFSET, + 5: 164+self.GPIO_OFFSET, + 6: 167+self.GPIO_OFFSET, + 7: 166+self.GPIO_OFFSET, + 8: 169+self.GPIO_OFFSET, + 9: 168+self.GPIO_OFFSET, + 10: 171+self.GPIO_OFFSET, + 11: 170+self.GPIO_OFFSET, + 12: 173+self.GPIO_OFFSET, + 13: 172+self.GPIO_OFFSET, + 14: 175+self.GPIO_OFFSET, + 15: 174+self.GPIO_OFFSET, + 16: 145+self.GPIO_OFFSET, + 17: 144+self.GPIO_OFFSET, + 18: 147+self.GPIO_OFFSET, + 19: 146+self.GPIO_OFFSET, + 20: 149+self.GPIO_OFFSET, + 21: 148+self.GPIO_OFFSET, + 22: 151+self.GPIO_OFFSET, + 23: 150+self.GPIO_OFFSET, + 24: 153+self.GPIO_OFFSET, + 25: 152+self.GPIO_OFFSET, + 26: 155+self.GPIO_OFFSET, + 27: 154+self.GPIO_OFFSET, + 28: 157+self.GPIO_OFFSET, + 29: 156+self.GPIO_OFFSET, + 30: 159+self.GPIO_OFFSET, + 31: 158+self.GPIO_OFFSET + } + return True + + def init_reset_to_gpio_mapping(self): + self.reset_to_gpio_mapping = { + 0: 129+self.GPIO_OFFSET, + 1: 128+self.GPIO_OFFSET, + 2: 131+self.GPIO_OFFSET, + 3: 130+self.GPIO_OFFSET, + 4: 133+self.GPIO_OFFSET, + 5: 132+self.GPIO_OFFSET, + 6: 135+self.GPIO_OFFSET, + 7: 134+self.GPIO_OFFSET, + 8: 137+self.GPIO_OFFSET, + 9: 136+self.GPIO_OFFSET, + 10: 139+self.GPIO_OFFSET, + 11: 138+self.GPIO_OFFSET, + 12: 141+self.GPIO_OFFSET, + 13: 140+self.GPIO_OFFSET, + 14: 143+self.GPIO_OFFSET, + 15: 142+self.GPIO_OFFSET, + 16: 113+self.GPIO_OFFSET, + 17: 112+self.GPIO_OFFSET, + 18: 115+self.GPIO_OFFSET, + 19: 114+self.GPIO_OFFSET, + 20: 117+self.GPIO_OFFSET, + 21: 116+self.GPIO_OFFSET, + 22: 119+self.GPIO_OFFSET, + 23: 118+self.GPIO_OFFSET, + 24: 121+self.GPIO_OFFSET, + 25: 120+self.GPIO_OFFSET, + 26: 123+self.GPIO_OFFSET, + 27: 122+self.GPIO_OFFSET, + 28: 125+self.GPIO_OFFSET, + 29: 124+self.GPIO_OFFSET, + 30: 127+self.GPIO_OFFSET, + 31: 126+self.GPIO_OFFSET + } + return True + + def __init__(self): + # Init abs, lpmode, and reset to gpio mapping + self.set_gpio_offset() + self.init_abs_to_gpio_mapping() + self.init_lpmode_to_gpio_mapping() + self.init_reset_to_gpio_mapping() + + # Override port_to_eeprom_mapping for class initialization + eeprom_path = "/sys/class/i2c-adapter/i2c-{0}/{0}-0050/eeprom" + + for x in range(self.port_start, self.port_end + 1): + port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x]) + self.port_to_eeprom_mapping[x] = port_eeprom_path + + SfpUtilBase.__init__(self) + + def get_presence(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.port_end: + return False + + try: + abs_device_file = self.BASE_VAL_PATH.format( + self.abs_to_gpio_mapping[port_num]) + val_file = open(abs_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def get_low_power_mode(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.sfp_port_start: # TBD + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file) + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + content = val_file.readline().rstrip() + val_file.close() + + # content is a string, either "0" or "1" + if content == "1": + return True + + return False + + def set_low_power_mode(self, port_num, lpmode): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.sfp_port_start: # TBD + return False + + try: + lpmode_val_device_file = self.BASE_VAL_PATH.format( + self.lpmode_to_gpio_mapping[port_num]) + val_file = open(lpmode_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1" if lpmode is True else "0") + val_file.close() + + return True + + def reset(self, port_num): + # Check for invalid port_num + if port_num < self.port_start or port_num > self.sfp_port_start: # TBD + return False + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("1") + val_file.close() + + # Sleep 1 second to allow it to settle + time.sleep(1) + + try: + reset_val_device_file = self.BASE_VAL_PATH.format( + self.reset_to_gpio_mapping[port_num]) + val_file = open(reset_val_device_file, "w") + except IOError as e: + print "Error: unable to open file: %s" % str(e) + return False + + val_file.write("0") + val_file.close() + + return True + + def get_transceiver_change_event(self): + """ + TODO: This function need to be implemented + when decide to support monitoring SFP(Xcvrd) + on this platform. + """ + raise NotImplementedError diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/pmon_daemon_control.json b/device/netberg/x86_64-netberg_aurora_710-r0/pmon_daemon_control.json new file mode 100644 index 000000000000..94592fa8cebc --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/pmon_daemon_control.json @@ -0,0 +1,3 @@ +{ + "skip_ledd": true +} diff --git a/device/netberg/x86_64-netberg_aurora_710-r0/sensors.conf b/device/netberg/x86_64-netberg_aurora_710-r0/sensors.conf new file mode 100644 index 000000000000..eb991d771d15 --- /dev/null +++ b/device/netberg/x86_64-netberg_aurora_710-r0/sensors.conf @@ -0,0 +1,76 @@ +# libsensors configuration file +chip "i350bb-*" + ignore loc1 + +chip "jc42-*" + label temp1 "DIMM Temp" + set temp1_max 50 + set temp1_crit 85 + +bus "i2c-0" "I2C I801" +chip "tmp75-i2c-*-4f" + label temp1 "CPU Board Temp" + set temp1_max 50 + +bus "i2c-41" "i2c-7-switch (chan_id 0)" +chip "tmp75-i2c-*-48" + label temp1 "Near PSU1" + set temp1_max 50 +chip "tmp75-i2c-*-4a" + label temp1 "Rear MAC" + set temp1_max 50 +chip "tmp75-i2c-*-4b" + label temp1 "Near Port 32" + set temp1_max 50 +chip "tmp75-i2c-*-4d" + label temp1 "Near PSU2" + set temp1_max 50 +chip "lm86-i2c-*-4c" + label temp1 "Front MAC" + label temp2 "ASIC Core Temp" + set temp1_min 20 + set temp1_max 65 + set temp1_crit 70 + set temp2_min 20 + set temp2_max 70 + set temp2_crit 80 + +bus "i2c-56" "i2c-0-mux (chan_id 7)" +chip "w83795adg-*" + label in0 "0.9V" + set in0_max 0.927 + set in0_min 0.873 + label in1 "VDD" + set in1_max 0.962 + set in1_min 0.717 + ignore in2 + ignore in3 + ignore in4 + ignore in5 + ignore in6 + ignore in7 + label in12 "2.5V" + #compute in12 (2*4*@)/10, @-(2*4*@/10) + compute in12 @/(1+(3/10)), @*(1+(3/10)) + set in12_max 2.625 + set in12_min 2.375 + # in12 and in13 are the same source + ignore in13 + ignore in14 + ignore in15 + ignore in16 + label fan1 "FANTRAY 1-A" + label fan2 "FANTRAY 1-B" + label fan3 "FANTRAY 2-A" + label fan4 "FANTRAY 2-B" + label fan5 "FANTRAY 3-A" + label fan6 "FANTRAY 3-B" + label fan7 "FANTRAY 4-A" + label fan8 "FANTRAY 4-B" + ignore temp1 + ignore temp2 + ignore temp3 + ignore temp4 + ignore temp5 + ignore temp6 + ignore intrusion0 diff --git a/dockers/docker-database/flush_unused_database b/dockers/docker-database/flush_unused_database index 11eb7215ebd0..f4c1efdc1268 100755 --- a/dockers/docker-database/flush_unused_database +++ b/dockers/docker-database/flush_unused_database @@ -1,6 +1,5 @@ #!/usr/bin/python3 from swsscommon import swsscommon -import redis import subprocess import time import syslog @@ -26,7 +25,18 @@ for instname, v in instlists.items(): continue try: - r = redis.Redis(host=insthost, unix_socket_path=instsocket, db=dbid) - r.flushdb() - except (redis.exceptions.ConnectionError): + # Migrate code from py-redis to swsscommon, original code: + # r = redis.Redis(host=insthost, unix_socket_path=instsocket, db=dbid) + # py-redis will use TCP connection when unix_socket_path is None + # https://github.com/redis/redis-py/blob/d95d8a24ed2af3eae80b7b0f14cbccc9dbe86e96/redis/client.py#L1006 + if instsocket is not None: + # connect with Unix socket + connector = swsscommon.DBConnector(dbid, instsocket, 0) + else: + # connect with TCP socket + port = swsscommon.SonicDBConfig.getDbPort(dbname); + connector = swsscommon.DBConnector(dbid, insthost, port, 0) + + connector.flushdb() + except RuntimeError: syslog.syslog(syslog.LOG_INFO,"flushdb:Redis Unix Socket connection error for path {} and dbaname {}".format(instsocket, dbname)) diff --git a/files/build/versions/build/build-sonic-slave-bullseye/versions-py3-all-armhf b/files/build/versions/build/build-sonic-slave-bullseye/versions-py3-all-armhf index cd01abdaf741..46df813bf748 100644 --- a/files/build/versions/build/build-sonic-slave-bullseye/versions-py3-all-armhf +++ b/files/build/versions/build/build-sonic-slave-bullseye/versions-py3-all-armhf @@ -2,3 +2,4 @@ bcrypt==3.2.2 bitarray==1.5.3 click==7.0 requests==2.31.0 +zipp==1.2.0 diff --git a/files/build/versions/default/versions-git b/files/build/versions/default/versions-git index bf87b6ba4461..5af180d0b622 100644 --- a/files/build/versions/default/versions-git +++ b/files/build/versions/default/versions-git @@ -1,11 +1,11 @@ -https://chromium.googlesource.com/chromium/tools/depot_tools.git==90fed308660fd53ac4247b7242f280b01731b1c7 +https://chromium.googlesource.com/chromium/tools/depot_tools.git==60c4b8810bdc3107a9a0c7046b79ee3a95df47fb https://github.com/aristanetworks/swi-tools.git==b5f087e4774168bf536360d43c9c509c8f14ad9f https://github.com/CESNET/libyang.git==ea94c8b9f513f8a6ddc6ce1540fa41eaf4c8922a https://github.com/daveolson53/audisp-tacplus.git==559c9f22edd4f2dea0ecedffb3ad9502b12a75b6 https://github.com/daveolson53/libnss-tacplus.git==19008ab68d9d504aa58eb34d5f564755a1613b8b https://github.com/dyninc/OpenBFDD.git==e35f43ad8d2b3f084e96a84c392528a90d05a287 -https://github.com/flashrom/flashrom.git==1ee04cd5ac8bb636182d9d7c259110638b83c8b1 -https://github.com/FreeRADIUS/freeradius-server.git==14ddc663bc17ccdc6a7c860cfb188c58fb5536d1 +https://github.com/flashrom/flashrom.git==b66f4766b5d7dc614ad609f27dd2794e06b5e2a4 +https://github.com/FreeRADIUS/freeradius-server.git==dfd71b9085ec4dd5c89b8930f8ea1a9a951730bb https://github.com/FreeRADIUS/pam_radius.git==8d373539bb9f13b0abfe8bcae0095a930a00fad0 https://github.com/jeroennijhof/pam_tacplus.git==4284d9016e64def2bb81d5f50f96dc3b59bfdc39 https://github.com/jpirko/libteam.git==7cb5de8b01be132bd4150eff460bfd83296414b6 diff --git a/files/build/versions/default/versions-mirror b/files/build/versions/default/versions-mirror index 81b26f1d331e..e94fc9b36397 100644 --- a/files/build/versions/default/versions-mirror +++ b/files/build/versions/default/versions-mirror @@ -1,15 +1,15 @@ deb.nodesource.com_node%5f14.x_dists_bullseye==2023-02-17T00:35:28Z deb.nodesource.com_node%5f14.x_dists_buster==2023-02-17T00:35:28Z -debian==20230625T000121Z -debian-security==20230625T000122Z +debian==20230702T000215Z +debian-security==20230702T000635Z download.docker.com_linux_debian_dists_bullseye==2023-06-09T17:17:20Z download.docker.com_linux_debian_dists_buster==2023-05-26T07:49:38Z packages.microsoft.com_repos_sonic-dev_dists_jessie==2022-10-31T19:34:29Z -packages.trafficmanager.net_snapshot_debian-security_20230625T000122Z_dists_bullseye-security==2023-06-22T22:43:03Z -packages.trafficmanager.net_snapshot_debian-security_20230625T000122Z_dists_buster_updates==2023-06-22T22:43:03Z -packages.trafficmanager.net_snapshot_debian_20230625T000121Z_dists_bullseye==2023-06-10T08:52:21Z -packages.trafficmanager.net_snapshot_debian_20230625T000121Z_dists_bullseye-backports==2023-06-24T20:43:09Z -packages.trafficmanager.net_snapshot_debian_20230625T000121Z_dists_bullseye-updates==2023-06-24T20:43:09Z -packages.trafficmanager.net_snapshot_debian_20230625T000121Z_dists_buster==2023-06-10T08:53:33Z -packages.trafficmanager.net_snapshot_debian_20230625T000121Z_dists_buster-backports==2023-06-24T20:43:09Z -packages.trafficmanager.net_snapshot_debian_20230625T000121Z_dists_buster-updates==2023-06-10T08:55:10Z +packages.trafficmanager.net_snapshot_debian-security_20230702T000635Z_dists_bullseye-security==2023-06-30T18:02:52Z +packages.trafficmanager.net_snapshot_debian-security_20230702T000635Z_dists_buster_updates==2023-06-30T18:02:52Z +packages.trafficmanager.net_snapshot_debian_20230702T000215Z_dists_bullseye==2023-06-10T08:52:21Z +packages.trafficmanager.net_snapshot_debian_20230702T000215Z_dists_bullseye-backports==2023-07-01T20:27:39Z +packages.trafficmanager.net_snapshot_debian_20230702T000215Z_dists_bullseye-updates==2023-07-01T20:27:39Z +packages.trafficmanager.net_snapshot_debian_20230702T000215Z_dists_buster==2023-06-10T08:53:33Z +packages.trafficmanager.net_snapshot_debian_20230702T000215Z_dists_buster-backports==2023-07-01T20:27:39Z +packages.trafficmanager.net_snapshot_debian_20230702T000215Z_dists_buster-updates==2023-06-10T08:55:10Z diff --git a/files/build/versions/dockers/docker-base-buster/versions-deb-buster b/files/build/versions/dockers/docker-base-buster/versions-deb-buster index 73cdf27b1c74..bf57849d20b0 100644 --- a/files/build/versions/dockers/docker-base-buster/versions-deb-buster +++ b/files/build/versions/dockers/docker-base-buster/versions-deb-buster @@ -33,8 +33,8 @@ libpgm-5.2-0==5.2.122~dfsg-3 libprocps7==2:3.3.15-2 libpsl5==0.20.2-2 libpython3-stdlib==3.7.3-1 -libpython3.7-minimal==3.7.3-2+deb10u4 -libpython3.7-stdlib==3.7.3-2+deb10u4 +libpython3.7-minimal==3.7.3-2+deb10u5 +libpython3.7-stdlib==3.7.3-2+deb10u5 libreadline7==7.0-5 librtmp1==2.4+20151223.gitfa8646d.1-2 libsasl2-2==2.1.27+dfsg-1+deb10u2 @@ -58,8 +58,8 @@ python3==3.7.3-1 python3-distutils==3.7.3-1 python3-lib2to3==3.7.3-1 python3-minimal==3.7.3-1 -python3.7==3.7.3-2+deb10u4 -python3.7-minimal==3.7.3-2+deb10u4 +python3.7==3.7.3-2+deb10u5 +python3.7-minimal==3.7.3-2+deb10u5 readline-common==7.0-5 redis-tools==5:6.0.6-1~bpo10+1 rsyslog==8.1901.0-1+deb10u2 diff --git a/files/build/versions/dockers/docker-config-engine-buster/versions-deb-buster b/files/build/versions/dockers/docker-config-engine-buster/versions-deb-buster index 67de9912f7b7..05c07be507e9 100644 --- a/files/build/versions/dockers/docker-config-engine-buster/versions-deb-buster +++ b/files/build/versions/dockers/docker-config-engine-buster/versions-deb-buster @@ -9,7 +9,7 @@ libnl-cli-3-200==3.5.0-1 libnl-genl-3-200==3.5.0-1 libnl-nf-3-200==3.5.0-1 libnl-route-3-200==3.5.0-1 -libpython3.7==3.7.3-2+deb10u4 +libpython3.7==3.7.3-2+deb10u5 libswsscommon==1.0.0 libyang==1.0.73 libyang-cpp==1.0.73 diff --git a/files/build/versions/dockers/docker-config-engine-buster/versions-py3 b/files/build/versions/dockers/docker-config-engine-buster/versions-py3 index 70d81e6f2d3f..34dccf18bf2d 100644 --- a/files/build/versions/dockers/docker-config-engine-buster/versions-py3 +++ b/files/build/versions/dockers/docker-config-engine-buster/versions-py3 @@ -15,6 +15,6 @@ redis-dump-load==1.1 regex==2023.6.3 six==1.16.0 tabulate==0.8.2 -typing_extensions==4.6.3 +typing_extensions==4.7.1 xmltodict==0.12.0 zipp==3.15.0 diff --git a/files/build/versions/dockers/docker-ptf/versions-deb-buster b/files/build/versions/dockers/docker-ptf/versions-deb-buster index 149586560650..4aa5c3dc84a4 100644 --- a/files/build/versions/dockers/docker-ptf/versions-deb-buster +++ b/files/build/versions/dockers/docker-ptf/versions-deb-buster @@ -97,7 +97,7 @@ libblas3==3.8.0-2 libboost-atomic1.71.0==1.71.0-6~bpo10+1 libbrotli1==1.0.7-2+deb10u1 libbsd0==0.9.1-2+deb10u1 -libc-ares2==1.14.0-1+deb10u2 +libc-ares2==1.14.0-1+deb10u3 libc-dev-bin==2.28-10+deb10u2 libc6-dbg==2.28-10+deb10u2 libc6-dev==2.28-10+deb10u2 @@ -110,9 +110,9 @@ libcgraph6==2.40.1-6+deb10u1 libcolord2==1.4.3-4 libcroco3==0.6.12-3 libcryptsetup12==2:2.1.0-5+deb10u2 -libcups2==2.2.10-6+deb10u7 +libcups2==2.2.10-6+deb10u8 libcupsfilters1==1.21.6-5+deb10u1 -libcupsimage2==2.2.10-6+deb10u7 +libcupsimage2==2.2.10-6+deb10u8 libcurl3-gnutls==7.64.0-4+deb10u6 libcurl4==7.64.0-4+deb10u6 libdaemon0==0.14-7 @@ -274,13 +274,13 @@ libnl-genl-3-200==3.4.0-1 libnl-nf-3-200==3.4.0-1 libnl-route-3-200==3.4.0-1 libnpth0==1.6-1 -libnss-systemd==241-7~deb10u9 +libnss-systemd==241-7~deb10u10 libogg0==1.3.2-1+b1 libopenjp2-7==2.3.0-2+deb10u2 libopts25==1:5.18.12-4 libopus0==1.3-1 liborc-0.4-0==1:0.4.28-3.1 -libpam-systemd==241-7~deb10u9 +libpam-systemd==241-7~deb10u10 libpango-1.0-0==1.42.4-8~deb10u1 libpangocairo-1.0-0==1.42.4-8~deb10u1 libpangoft2-1.0-0==1.42.4-8~deb10u1 @@ -313,10 +313,10 @@ libpython2.7-minimal==2.7.16-2+deb10u2 libpython2.7-stdlib==2.7.16-2+deb10u2 libpython3-dev==3.7.3-1 libpython3-stdlib==3.7.3-1 -libpython3.7==3.7.3-2+deb10u4 -libpython3.7-dev==3.7.3-2+deb10u4 -libpython3.7-minimal==3.7.3-2+deb10u4 -libpython3.7-stdlib==3.7.3-2+deb10u4 +libpython3.7==3.7.3-2+deb10u5 +libpython3.7-dev==3.7.3-2+deb10u5 +libpython3.7-minimal==3.7.3-2+deb10u5 +libpython3.7-stdlib==3.7.3-2+deb10u5 libqt5core5a==5.11.3+dfsg1-1+deb10u5 libqt5dbus5==5.11.3+dfsg1-1+deb10u5 libqt5gui5==5.11.3+dfsg1-1+deb10u5 @@ -357,7 +357,7 @@ libssl-dev==1.1.1n-0+deb10u5 libssl1.1==1.1.1n-0+deb10u5 libstdc++-8-dev==8.3.0-6 libsynctex2==2018.20181218.49446-1+deb10u2 -libsystemd0==241-7~deb10u9 +libsystemd0==241-7~deb10u10 libtacacs+1==4.0.4.27a-3 libtcl8.6==8.6.9+dfsg-2 libteam-utils==1.28-1 @@ -379,7 +379,7 @@ libtk8.6==8.6.9-2 libtry-tiny-perl==0.30-1 libtsan0==8.3.0-6 libubsan1==8.3.0-6 -libudev1==241-7~deb10u9 +libudev1==241-7~deb10u10 libunbound8==1.9.0-2+deb10u3 liburi-perl==1.76-1 libutempter0==1.1.6-3 @@ -406,10 +406,10 @@ libwscodecs2==2.6.20-0+deb10u7 libwsutil9==2.6.20-0+deb10u7 libwww-perl==6.36-2 libwww-robotrules-perl==6.02-1 -libx11-6==2:1.6.7-1+deb10u2 -libx11-data==2:1.6.7-1+deb10u2 +libx11-6==2:1.6.7-1+deb10u3 +libx11-data==2:1.6.7-1+deb10u3 libx11-protocol-perl==0.56-7 -libx11-xcb1==2:1.6.7-1+deb10u2 +libx11-xcb1==2:1.6.7-1+deb10u3 libxau6==1:1.0.8-1+b2 libxaw7==2:1.0.13-1+b2 libxcb-dri2-0==1.13.1-2 @@ -551,10 +551,10 @@ python3-venv==3.7.3-1 python3-wcwidth==0.1.7+dfsg1-3 python3-wheel==0.32.3-2 python3-xdg==0.25-5 -python3.7==3.7.3-2+deb10u4 -python3.7-dev==3.7.3-2+deb10u4 -python3.7-minimal==3.7.3-2+deb10u4 -python3.7-venv==3.7.3-2+deb10u4 +python3.7==3.7.3-2+deb10u5 +python3.7-dev==3.7.3-2+deb10u5 +python3.7-minimal==3.7.3-2+deb10u5 +python3.7-venv==3.7.3-2+deb10u5 qt5-gtk-platformtheme==5.11.3+dfsg1-1+deb10u5 qttranslations5-l10n==5.11.3-2 readline-common==7.0-5 @@ -563,8 +563,8 @@ rsyslog==8.1901.0-1+deb10u2 sensible-utils==0.0.12 shared-mime-info==1.10-1 sntp==1:4.2.8p12+dfsg-4 -systemd==241-7~deb10u9 -systemd-sysv==241-7~deb10u9 +systemd==241-7~deb10u10 +systemd-sysv==241-7~deb10u10 t1utils==1.41-3 tacacs+==4.0.4.27a-3 tcpdump==4.9.3-1~deb10u2 diff --git a/files/build/versions/dockers/sonic-slave-bullseye/versions-deb-bullseye b/files/build/versions/dockers/sonic-slave-bullseye/versions-deb-bullseye index 16db332eb677..f00d84d22692 100644 --- a/files/build/versions/dockers/sonic-slave-bullseye/versions-deb-bullseye +++ b/files/build/versions/dockers/sonic-slave-bullseye/versions-deb-bullseye @@ -24,9 +24,9 @@ autopoint==0.21-4 autotools-dev==20180224.1+nmu1 bash-completion==1:2.11-2 bc==1.07.1-2+b2 -bind9-dnsutils==1:9.16.37-1~deb11u1 -bind9-host==1:9.16.37-1~deb11u1 -bind9-libs==1:9.16.37-1~deb11u1 +bind9-dnsutils==1:9.16.42-1~deb11u1 +bind9-host==1:9.16.42-1~deb11u1 +bind9-libs==1:9.16.42-1~deb11u1 binfmt-support==2.2.1-1+deb11u1 binutils==2.35.2-2 binutils-common==2.35.2-2 @@ -87,7 +87,7 @@ distro-info-data==0.51+deb11u3 dkms==2.8.4-3 dmeventd==2:1.02.175-2.1 dmsetup==2:1.02.175-2.1 -dnsutils==1:9.16.37-1~deb11u1 +dnsutils==1:9.16.42-1~deb11u1 docbook==4.5-6 docbook-dsssl==1.79-9.2 docbook-to-man==1:2.0.0-45 diff --git a/files/build/versions/dockers/sonic-slave-buster/versions-deb-buster b/files/build/versions/dockers/sonic-slave-buster/versions-deb-buster index 0ef357e93936..bd236b2649cc 100644 --- a/files/build/versions/dockers/sonic-slave-buster/versions-deb-buster +++ b/files/build/versions/dockers/sonic-slave-buster/versions-deb-buster @@ -338,8 +338,8 @@ libbsd-dev==0.9.1-2+deb10u1 libbsd0==0.9.1-2+deb10u1 libbsh-java==2.0b4-19 libbz2-dev==1.0.6-9.2~deb10u2 -libc-ares-dev==1.14.0-1+deb10u2 -libc-ares2==1.14.0-1+deb10u2 +libc-ares-dev==1.14.0-1+deb10u3 +libc-ares2==1.14.0-1+deb10u3 libc-dev-bin==2.28-10+deb10u2 libc-l10n==2.28-10+deb10u2 libc6-dbg==2.28-10+deb10u2 @@ -413,9 +413,9 @@ libcryptsetup12==2:2.1.0-5+deb10u2 libcrystalhd3==1:0.0~git20110715.fdd2f19-13 libcunit1==2.1-3-dfsg-2+b12 libcunit1-dev==2.1-3-dfsg-2+b12 -libcups2==2.2.10-6+deb10u7 +libcups2==2.2.10-6+deb10u8 libcupsfilters1==1.21.6-5+deb10u1 -libcupsimage2==2.2.10-6+deb10u7 +libcupsimage2==2.2.10-6+deb10u8 libcurl3-gnutls==7.64.0-4+deb10u6 libcurl4==7.64.0-4+deb10u6 libcurl4-openssl-dev==7.64.0-4+deb10u6 @@ -841,7 +841,7 @@ libnorm-dev==1.5.8+dfsg2-1 libnorm1==1.5.8+dfsg2-1 libnpth0==1.6-1 libnspr4==2:4.20-1 -libnss-systemd==241-7~deb10u9 +libnss-systemd==241-7~deb10u10 libnss3==2:3.42.1-1+deb10u6 libnuma-dev==2.0.12-1 libnuma1==2.0.12-1 @@ -878,7 +878,7 @@ libpackage-stash-perl==0.38-1 libpackage-stash-xs-perl==0.29-1 libpackagekit-glib2-18==1.1.12-5 libpadwalker-perl==2.3-1+b1 -libpam-systemd==241-7~deb10u9 +libpam-systemd==241-7~deb10u10 libpam0g-dev==1.3.1-5 libpango-1.0-0==1.42.4-8~deb10u1 libpango1.0-dev==1.42.4-8~deb10u1 @@ -976,11 +976,11 @@ libpython3-all-dev==3.7.3-1 libpython3-dbg==3.7.3-1 libpython3-dev==3.7.3-1 libpython3-stdlib==3.7.3-1 -libpython3.7==3.7.3-2+deb10u4 -libpython3.7-dbg==3.7.3-2+deb10u4 -libpython3.7-dev==3.7.3-2+deb10u4 -libpython3.7-minimal==3.7.3-2+deb10u4 -libpython3.7-stdlib==3.7.3-2+deb10u4 +libpython3.7==3.7.3-2+deb10u5 +libpython3.7-dbg==3.7.3-2+deb10u5 +libpython3.7-dev==3.7.3-2+deb10u5 +libpython3.7-minimal==3.7.3-2+deb10u5 +libpython3.7-stdlib==3.7.3-2+deb10u5 libqdox-java==1.12.1-3 libqdox2-java==2.0~M10-1 libqt4-dbus==4:4.8.7+dfsg-18+deb10u1 @@ -1114,7 +1114,8 @@ libswresample3==7:4.1.11-0+deb10u1 libswscale5==7:4.1.11-0+deb10u1 libsynctex2==2018.20181218.49446-1+deb10u2 libsys-hostname-long-perl==1.5-1 -libsystemd-dev==241-7~deb10u9 +libsystemd-dev==241-7~deb10u10 +libsystemd0==241-7~deb10u10 libtag1v5==1.11.1+dfsg.1-0.3+deb10u1 libtag1v5-vanilla==1.11.1+dfsg.1-0.3+deb10u1 libtask-weaken-perl==1.06-1 @@ -1155,7 +1156,8 @@ libtype-tiny-xs-perl==0.014-1+b1 libtypes-serialiser-perl==1.0-1 libubsan1==8.3.0-6 libuchardet0==0.0.6-3 -libudev-dev==241-7~deb10u9 +libudev-dev==241-7~deb10u10 +libudev1==241-7~deb10u10 libunbound8==1.9.0-2+deb10u3 libunicode-utf8-perl==0.62-1 libunwind-dev==1.2.1-10~deb10u1 @@ -1216,12 +1218,12 @@ libwrap0==7.6.q-28 libwrap0-dev==7.6.q-28 libwww-perl==6.36-2 libwww-robotrules-perl==6.02-1 -libx11-6==2:1.6.7-1+deb10u2 -libx11-data==2:1.6.7-1+deb10u2 -libx11-dev==2:1.6.7-1+deb10u2 +libx11-6==2:1.6.7-1+deb10u3 +libx11-data==2:1.6.7-1+deb10u3 +libx11-dev==2:1.6.7-1+deb10u3 libx11-protocol-perl==0.56-7 -libx11-xcb-dev==2:1.6.7-1+deb10u2 -libx11-xcb1==2:1.6.7-1+deb10u2 +libx11-xcb-dev==2:1.6.7-1+deb10u3 +libx11-xcb1==2:1.6.7-1+deb10u3 libx264-155==2:0.155.2917+git0a84d98-2 libx265-165==2.9-4 libx32asan5==8.3.0-6 @@ -1643,10 +1645,10 @@ python3-unidiff==0.5.4-1 python3-urllib3==1.24.1-1 python3-wheel==0.32.3-2 python3-xdg==0.25-5 -python3.7==3.7.3-2+deb10u4 -python3.7-dbg==3.7.3-2+deb10u4 -python3.7-dev==3.7.3-2+deb10u4 -python3.7-minimal==3.7.3-2+deb10u4 +python3.7==3.7.3-2+deb10u5 +python3.7-dbg==3.7.3-2+deb10u5 +python3.7-dev==3.7.3-2+deb10u5 +python3.7-minimal==3.7.3-2+deb10u5 qdbus==4:4.8.7+dfsg-18+deb10u1 qemu-kvm==1:3.1+dfsg-8+deb10u10 qemu-system-common==1:3.1+dfsg-8+deb10u10 @@ -1704,8 +1706,8 @@ strace==4.26-0.2 sudo==1.8.27-1+deb10u5 swig==3.0.12-2 swig3.0==3.0.12-2 -systemd==241-7~deb10u9 -systemd-sysv==241-7~deb10u9 +systemd==241-7~deb10u10 +systemd-sysv==241-7~deb10u10 t1utils==1.41-3 tcl==8.6.9+1 tcl8.6==8.6.9+dfsg-2 diff --git a/files/build/versions/dockers/sonic-slave-buster/versions-py3 b/files/build/versions/dockers/sonic-slave-buster/versions-py3 index db0d9fcfdbfa..870d7ad1938e 100644 --- a/files/build/versions/dockers/sonic-slave-buster/versions-py3 +++ b/files/build/versions/dockers/sonic-slave-buster/versions-py3 @@ -73,7 +73,7 @@ setuptools==49.6.0 six==1.12.0 sphinx==1.8.4 sphinx-rtd-theme==0.4.3 -typing_extensions==4.6.3 +typing_extensions==4.7.1 unattended-upgrades==0.1 unidiff==0.5.4 urllib3==1.24.1 diff --git a/files/build_templates/docker_image_ctl.j2 b/files/build_templates/docker_image_ctl.j2 index 4b0bf80231f8..c14bedfd6f32 100644 --- a/files/build_templates/docker_image_ctl.j2 +++ b/files/build_templates/docker_image_ctl.j2 @@ -157,9 +157,9 @@ function waitForAllInstanceDatabaseConfigJsonFilesReady() done fi # Delay a second to allow all instance database_config.json files to be completely generated and fully accessible. - # This delay is needed to make sure that the database_config.json files are correctly rendered from j2 template + # This delay is needed to make sure that the database_config.json files are correctly rendered from j2 template # files ( renderning takes some time ) - sleep 1 + sleep 1 fi } {%- endif %} @@ -240,7 +240,7 @@ function postStartAction() mv $WARM_DIR/dump.rdb $WARM_DIR/dump.rdb.old else # If there is a config_db.json dump file, load it. - if [ -r /etc/sonic/config_db$DEV.json ]; then + if [ -r /etc/sonic/config_db$DEV.json ]; then if [ -r /etc/sonic/init_cfg.json ]; then $SONIC_CFGGEN -j /etc/sonic/init_cfg.json -j /etc/sonic/config_db$DEV.json --write-to-db @@ -323,7 +323,7 @@ start() { {%- if sonic_asic_platform == "broadcom" %} {%- if docker_container_name == "syncd" %} - # Set the SYNCD_SHM_SIZE if this variable not defined + # Set the SYNCD_SHM_SIZE if this variable not defined BRCM_PLATFORM_COMMON_DIR=/usr/share/sonic/device/x86_64-broadcom_common SYNCD_SHM_INI=$BRCM_PLATFORM_COMMON_DIR/syncd_shm.ini @@ -545,14 +545,15 @@ start() { {%- if docker_container_name == "syncd" %} -v /var/log/mellanox:/var/log/mellanox:rw \ -v mlnx_sdk_socket:/var/run/sx_sdk \ - -v mlnx_sdk_ready:/tmp \ + -v /tmp/nv-syncd-shared/:/tmp \ -v /dev/shm:/dev/shm:rw \ -v /var/log/sai_failure_dump:/var/log/sai_failure_dump:rw \ -e SX_API_SOCKET_FILE=/var/run/sx_sdk/sx_api.sock \ {%- elif docker_container_name == "pmon" %} -v /var/run/hw-management:/var/run/hw-management:rw \ -v mlnx_sdk_socket:/var/run/sx_sdk \ - -v mlnx_sdk_ready:/tmp \ + -v /tmp/nv-syncd-shared/:/tmp \ + -v /dev/shm:/dev/shm:rw \ -e SX_API_SOCKET_FILE=/var/run/sx_sdk/sx_api.sock \ -v /dev/shm:/dev/shm:rw \ {%- else %} diff --git a/files/build_templates/per_namespace/syncd.service.j2 b/files/build_templates/per_namespace/syncd.service.j2 index b509e7732cfd..1fb803390a80 100644 --- a/files/build_templates/per_namespace/syncd.service.j2 +++ b/files/build_templates/per_namespace/syncd.service.j2 @@ -19,6 +19,10 @@ After=updategraph.service BindsTo=sonic.target After=sonic.target Before=ntp-config.service +{% if sonic_asic_platform == 'mellanox' %} +Requires=nv-syncd-shared.service +After=nv-syncd-shared.service +{% endif %} [Service] User=root diff --git a/files/build_templates/sonic_debian_extension.j2 b/files/build_templates/sonic_debian_extension.j2 index c4d56cf443b2..87e48c59eee3 100644 --- a/files/build_templates/sonic_debian_extension.j2 +++ b/files/build_templates/sonic_debian_extension.j2 @@ -951,6 +951,10 @@ MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME=$(basename {{mlnx_platform_api_py3_wheel_path sudo cp {{mlnx_platform_api_py3_wheel_path}} $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME sudo https_proxy=$https_proxy LANG=C chroot $FILESYSTEM_ROOT pip3 install $MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME sudo rm -rf $FILESYSTEM_ROOT/$MLNX_SONIC_PLATFORM_PY3_WHEEL_NAME + +# Install service that manages Nvidia specific shared storage +sudo cp platform/mellanox/nv-syncd-shared/nv-syncd-shared.service $FILESYSTEM_ROOT_USR_LIB_SYSTEMD_SYSTEM/ +sudo LANG=C chroot $FILESYSTEM_ROOT systemctl enable nv-syncd-shared {% endif %} {%- if SONIC_ROUTING_STACK == "frr" %} diff --git a/files/scripts/arp_update b/files/scripts/arp_update index 4b25973cfc02..f267e05a54cc 100755 --- a/files/scripts/arp_update +++ b/files/scripts/arp_update @@ -89,32 +89,47 @@ while /bin/true; do eval `eval $ip6cmd` if [[ $SUBTYPE == "dualtor" ]]; then - # manually set any remaining FAILED/INCOMPLETE entries to permanently INCOMPLETE - # this prevents any remaining INCOMPLETE entries from automatically transitioning to FAILED - # once these entries are incomplete, any subsequent neighbor advertisement messages - # are able to resolve the entry - - # generates the following command for each failed or incomplete IPv6 neighbor - # ip neigh replace dev nud incomplete - neigh_replace_template="sed -e 's/^/ip neigh replace /' -e 's/,/ dev /' -e 's/$/ nud incomplete;/'" - ip_neigh_replace_cmd="ip -6 neigh show | grep -v fe80 | grep $vlan | grep -E 'FAILED|INCOMPLETE' | cut -d ' ' -f 1,3 --output-delimiter=',' | $neigh_replace_template" - eval `eval $ip_neigh_replace_cmd` - - # on dual ToR devices, try to resolve failed neighbor entries since - # these entries will have tunnel routes installed, preventing normal - # neighbor resolution (SWSS PR #2137) - - # since ndisc6 is a userland process, the above ndisc6 commands are - # insufficient to update the kernel neighbor table for failed entries - - # we don't need to do this for ipv4 neighbors since arping is able to - # update the kernel neighbor table - - # generates the following command for each failed or incomplete IPv6 neighbor + # capture all current failed/incomplete IPv6 neighbors in the kernel to avoid situations where new neighbors are learned + # in the middle of the below sequence of commands + unresolved_kernel_neighbors=$(ip -6 neigh show | grep -v fe80 | grep $vlan | grep -E 'FAILED|INCOMPLETE') + failed_kernel_neighbors=$(echo "$unresolved_kernel_neighbors" | grep FAILED | cut -d ' ' -f 1) + + # it's possible for kernel neighbors to fall out of sync with the hardware + # this can result in failed neighbors entries that don't have corresponding zero MAC neighbor entries + # and therefore don't have tunnel routes installed in the hardware + # flush these neighbors from the kernel to force relearning and resync them to the hardware: + # 1. for every FAILED or INCOMPLETE neighbor in the kernel, check if there is a corresponding zero MAC neighbor in APPL_DB + # 2. if no zero MAC neighbor entry exists, flush the kernel neighbor entry + # - generates the command 'ip neigh flush ' for all such neighbors + unsync_neighbors=$(echo "$unresolved_kernel_neighbors" | cut -d ' ' -f 1 | xargs -I{} bash -c "if [[ -z \"\$(sonic-db-cli APPL_DB hget NEIGH_TABLE:$vlan:{} neigh)\" ]]; then echo '{}'; fi") + if [[ ! -z "$unsync_neighbors" ]]; then + ip_neigh_flush_cmd="echo \"$unsync_neighbors\" | sed -e 's/^/ip neigh flush /' -e 's/$/;/'" + eval `eval "$ip_neigh_flush_cmd"` + sleep 2 + fi + + # generates the following command for each FAILED or INCOMPLETE IPv6 neighbor # timeout 0.2 ping -n -q -i 0 -c 1 -W 1 -I >/dev/null - ping6_template="sed -e 's/^/timeout 0.2 ping /' -e 's/,/ -n -q -i 0 -c 1 -W 1 -I /' -e 's/$/ >\/dev\/null;/'" - failed_ip6_neigh_cmd="ip -6 neigh show | grep -v fe80 | grep $vlan | grep -E 'FAILED|INCOMPLETE' | cut -d ' ' -f 1,3 --output-delimiter=',' | $ping6_template" - eval `eval $failed_ip6_neigh_cmd` + if [[ ! -z "$unresolved_kernel_neighbors" ]]; then + ping6_template="sed -e 's/^/timeout 0.2 ping /' -e 's/,/ -n -q -i 0 -c 1 -W 1 -I /' -e 's/$/ >\/dev\/null;/'" + failed_ip6_neigh_cmd="echo \"$unresolved_kernel_neighbors\" | cut -d ' ' -f 1,3 --output-delimiter=',' | $ping6_template" + eval `eval "$failed_ip6_neigh_cmd"` + # allow some time for any transient INCOMPLETE neighbors to transition to FAILED + sleep 5 + fi + + # manually set any remaining FAILED entries to permanently INCOMPLETE + # once these entries are INCOMPLETE, any subsequent neighbor advertisement messages are able to resolve the entry + # ignore INCOMPLETE neighbors since if they are transiently incomplete (i.e. new kernel neighbors that we are attempting to resolve for the first time), + # setting them to permanently incomplete here means the kernel will never generate a netlink message for that neighbor + # generates the following command for each FAILED IPv6 neighbor + # ip neigh replace dev nud incomplete + failed_kernel_neighbors=$(ip -6 neigh show | grep -v fe80 | grep $vlan | grep -E 'FAILED') + if [[ ! -z "$failed_kernel_neighbors" ]]; then + neigh_replace_template="sed -e 's/^/ip neigh replace /' -e 's/,/ dev /' -e 's/$/ nud incomplete;/'" + ip_neigh_replace_cmd="echo \"$failed_kernel_neighbors\" | cut -d ' ' -f 1,3 --output-delimiter=',' | $neigh_replace_template" + eval `eval "$ip_neigh_replace_cmd"` + fi fi done diff --git a/platform/barefoot/one-image.mk b/platform/barefoot/one-image.mk index d282fec5640a..798a0d678a0d 100644 --- a/platform/barefoot/one-image.mk +++ b/platform/barefoot/one-image.mk @@ -14,6 +14,7 @@ $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9180_32X_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(INGRASYS_S9280_64X_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(BFN_MONTARA_QS_PLATFORM_MODULE) $(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(NETBERG_AURORA_610_PLATFORM_MODULE) +$(SONIC_ONE_IMAGE)_LAZY_INSTALLS += $(NETBERG_AURORA_710_PLATFORM_MODULE) ifeq ($(INSTALL_DEBUG_TOOLS),y) $(SONIC_ONE_IMAGE)_DOCKERS += $(SONIC_INSTALL_DOCKER_DBG_IMAGES) $(SONIC_ONE_IMAGE)_DOCKERS += $(filter-out $(patsubst %-$(DBG_IMAGE_MARK).gz,%.gz, $(SONIC_INSTALL_DOCKER_DBG_IMAGES)), $(SONIC_INSTALL_DOCKER_IMAGES)) diff --git a/platform/barefoot/platform-modules-netberg.mk b/platform/barefoot/platform-modules-netberg.mk index 1d65b3324d03..aeaac7f79e6b 100644 --- a/platform/barefoot/platform-modules-netberg.mk +++ b/platform/barefoot/platform-modules-netberg.mk @@ -1,16 +1,19 @@ -# Netberg Aurora 610 Platform modules +# Netberg tofino-based platforms modules -NETBERG_AURORA_610_PLATFORM_MODULE_VERSION = 1.1.0 +NETBERG_AURORA_610_PLATFORM_MODULE_VERSION = 1.1.1 +NETBERG_AURORA_710_PLATFORM_MODULE_VERSION = 1.1.1 export NETBERG_AURORA_610_PLATFORM_MODULE_VERSION +export NETBERG_AURORA_710_PLATFORM_MODULE_VERSION NETBERG_AURORA_610_PLATFORM_MODULE = sonic-platform-netberg-aurora-610_$(NETBERG_AURORA_610_PLATFORM_MODULE_VERSION)_amd64.deb $(NETBERG_AURORA_610_PLATFORM_MODULE)_SRC_PATH = $(PLATFORM_PATH)/sonic-platform-modules-netberg $(NETBERG_AURORA_610_PLATFORM_MODULE)_DEPENDS += $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON) $(NETBERG_AURORA_610_PLATFORM_MODULE)_PLATFORM = x86_64-netberg_aurora_610-r0 -SONIC_DPKG_DEBS += $(NETBERG_AURORA_610_PLATFORM_MODULE) -export NETBERG_AURORA_610_PLATFORM_MODULE +SONIC_DPKG_DEBS += $(NETBERG_AURORA_610_PLATFORM_MODULE) -#$(eval $(call add_extra_package,$(NETBERG_AURORA_610_PLATFORM_MODULE))) +NETBERG_AURORA_710_PLATFORM_MODULE = sonic-platform-netberg-aurora-710_$(NETBERG_AURORA_710_PLATFORM_MODULE_VERSION)_amd64.deb +$(NETBERG_AURORA_710_PLATFORM_MODULE)_PLATFORM = x86_64-netberg_aurora_710-r0 +$(eval $(call add_extra_package,$(NETBERG_AURORA_610_PLATFORM_MODULE),$(NETBERG_AURORA_710_PLATFORM_MODULE))) diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/.gitignore b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/.gitignore new file mode 100644 index 000000000000..912bdc23edd4 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/.gitignore @@ -0,0 +1,23 @@ +# kernel module build +*.o +*.ko +*.mod.c +*.mod.o +*.cmd +Module.symvers +modules.order + +# debian packaging +*.debhelper +*.log +DEBIAN +.tmp_versions +.finished.build +*.substvars + +# python +*.pyc +/build +/*.egg-info +/venv +/.pybuild diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/README.md b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/README.md new file mode 100644 index 000000000000..549ce695d67d --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/README.md @@ -0,0 +1,185 @@ +# Netberg Aurora 710 Platform Driver for SONiC + +Copyright (C) 2019 Netberg, Inc. + +This program is free software: you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation, either version 3 of the License, or +(at your option) any later version. + +This program is distributed in the hope that it will be useful, +but WITHOUT ANY WARRANTY; without even the implied warranty of +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. + +You should have received a copy of the GNU General Public License +along with this program. If not, see . + + +## Licensing terms + +The Licensing terms of the files within this project is split 2 parts. +The Linux kernel is released under the GNU General Public License version 2. +All other code is released under the GNU General Public License version 3. +Please see the LICENSE file for copies of both licenses. + +## Contents of this package + + - service/ + > Service config files for platform initialization and monitoring + - utils/ + > Scripts useful during platform bringup and sysfs function + - conf/ + > Platform configure files. + +## Kernel modules and drivers + +The driver for interacting with Netberg Aurora 710 is contained in the I2C +kernel module and initialization script. The initialization script loads +the modules in the correct order. It has been built and tested against +the Linux 3.16 kernel. + +The initialization script will modprobe the needed modules, navigate to the +module's device directory in sysfs, and write configuration data to +the kernel module. + +### IGB + +This is OOB Ports on front panel for management plane. + +The IGB module must be loaded first on Netberg Aurora 710 platform. + +### I2C i801 + +The I2C i801 on Netberg Aurora 710 can be found in +`/sys/bus/i2c/devices/i2c-0/` + +This is I2C bus for Clock Gen, DIMM channel and digital potentiometers. + +The i801 module must be loaded second on Netberg Aurora 710. + +### I2C iSMT + +The I2C iSMT module on Aurora 710 can be found in +`/sys/bus/i2c/devices/i2c-1/` + +This is I2C bus for CPLD, HWM, power controller and I2C Switches. + +The i801 module must be loaded third on Netberg Aurora 710. + +### I2C PCA9548 +The PCA9548 module on Aurora 710 can be found in +`/sys/bus/i2c/devices/i2c-2/` , `/sys/bus/i2c/devices/i2c-3/`, +`/sys/bus/i2c/devices/i2c-4/`, `/sys/bus/i2c/devices/i2c-5/`, +`/sys/bus/i2c/devices/i2c-6/`, `/sys/bus/i2c/devices/i2c-7/`, +`/sys/bus/i2c/devices/i2c-8/`, `/sys/bus/i2c/devices/i2c-9/`. + +The pca9548 module for zQSFP module get/set functions, PSU information, +fan status and EEPROM. + +## Hardware components + +The hardware components are initialized in the init script on Aurora 710. +The following describes manual initialization as well as interaction. +The examples below are just for Netberg Aurora 710 platform. + +### Hardware initialization + +When the sonic-platform-netberg-aurora-710 package is installed on the Aurora 710, +it is automatically initialized. If you want to manual initialization, the +utility command usage as follows: +``` + i2c_utils.sh i2c_init +``` + +### EEPROM + +The EEPROM is including the board SKU, model name, vendor name, serial number, +and other information can be accessed with the specific eeprom kernel module. +After using `modprobe eeprom_mb` to detect the eeprom, it will show up in sysfs. + +The hexdump utility can be used to decode the raw output of the EEPROM. +For example, +``` + bash# echo "mb_eeprom 0x54" > /sys/bus/i2c/devices/i2c-9/new_device + bash# cat /sys/bus/i2c/drivers/mb_eeprom/9-0054/eeprom | hexdump -C +``` + +### Front panel LEDs + +LEDs can be setup on/off by using i2c utility `/usr/sbin/i2c_utils.sh`. +Utility function command usage as follows: + +``` +Status LED: + i2c_utils.sh i2c_sys_led green|amber on|off + +Fan status LED: + i2c_utils.sh i2c_fan_led green|amber on|off + +PSU1 status LED: + i2c_utils.sh i2c_psu1_led green|amber on|off + +PSU2 status LED: + i2c_utils.sh i2c_psu2_led green|amber on|off + +``` +QSFP Module Port LEDs control by ASIC library. + + +### Fan speed + +Fan speed are controlled by the w83795 kernel module. +It can be found in `/sys/class/hwmon/hwmon3/device/`. +If they were compiled as modules, you will need to modprobe w83795 for +their sysfs entries to show up. Each fan has an `fan_input` file +for reading the fan speed. And `pwm1` setting fan1 to fan4, +`pwm2` setting fan5 to fan8. + +There is docker-platform-monitor container installed fancontrol package that can +automatic control platform fan speed. + + +### Temperature sensors + +Temperature sensors are controlled by the w83795 kernel +module. It can be found in `/sys/class/hwmon/hwmon3/device/`. +If they were compiled as modules, then you will need to modprobe w83795 for +their sysfs entries to show up. +`temp1_input` is front MAC temperature sensor. `temp2_input` is rear MAC +temperature sensor. + +There is docker-platform-monitor container installed lm-sensors package that can +monitor platform temperature. And `sensors` command can show each +temperature sensors status. + +### Power supplies + +Power supplies status and its EEPROM info can be used i2c utility +`/usr/sbin/i2c_utils.sh` to get. +The usage as follows: +``` +PSU EEPROM: + i2c_utils.sh i2c_psu_eeprom_get + hexdump -C psu0.rom + hexdump -C psu1.rom + +PSU Status: + i2c_utils.sh i2c_psu_status +``` + +### QSFPs +QSFP modules are managed by the pca9548 kernel driver. +The i2c utility `/usr/sbin/i2c_utils.sh` can be used to get status and +module EEPROM informations. +The usage as follows: +``` +QSFP EEPROM: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + +QSFP Insert Event: + i2c_utils.sh i2c_qsfp_eeprom_get [1-32] + 0 => not insert + 1 => inserted +``` + diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/modules/Makefile b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/modules/Makefile new file mode 100644 index 000000000000..e69de29bb2d1 diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/service/aurora-710-monitor.service b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/service/aurora-710-monitor.service new file mode 100644 index 000000000000..ac6ed5bae8c4 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/service/aurora-710-monitor.service @@ -0,0 +1,18 @@ +[Unit] +Description= This Platform Monitor service is to initialize platform and monitor platform. +Before=platform-monitor.service +After=sysinit.target +Wants=fancontrol.service +Wants=qsfp-monitor.service +DefaultDependencies=no + +[Service] +ExecStart=/usr/sbin/i2c_init.sh +KillSignal=SIGKILL +SuccessExitStatus=SIGKILL + +# Resource Limitations +LimitCORE=infinity + +[Install] +WantedBy=multi-user.target diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/setup.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/setup.py new file mode 100644 index 000000000000..3f0e99b5bd21 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/setup.py @@ -0,0 +1,27 @@ +#!/usr/bin/env python + +import os +from setuptools import setup +os.listdir + +setup( + name='sonic_platform', + version='1.0', + description='Netberg Aurora 710 sonic platform API', + + packages=['sonic_platform'], + package_dir={'sonic_platform': 'sonic_platform'}, + + classifiers=[ + 'Development Status :: 3 - Beta', + 'Environment :: Plugins', + 'Intended Audience :: Developers', + 'Intended Audience :: Information Technology', + 'Intended Audience :: System Administrators', + 'License :: OSI Approved :: Apache Software License', + 'Natural Language :: English', + 'Operating System :: POSIX :: Linux', + 'Programming Language :: Python :: 3.7', + 'Topic :: Utilities', + ], +) diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/__init__.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/__init__.py new file mode 100644 index 000000000000..d5f19f74f4c6 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/__init__.py @@ -0,0 +1,2 @@ +__all__ = ['chassis', 'eeprom', 'platform', 'psu', 'sfp'] +from . import platform diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/chassis.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/chassis.py new file mode 100644 index 000000000000..e2128141012a --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/chassis.py @@ -0,0 +1,237 @@ +try: + import re + from sonic_platform_base.chassis_base import ChassisBase + from sonic_platform.eeprom import Eeprom + from sonic_platform.fan_drawer import FanDrawer + from sonic_platform.psu import Psu + from sonic_platform.sfp import Sfp + from sonic_platform.thermal import Thermal + from sonic_platform.component import Component + from sonic_platform.watchdog import Watchdog + from sonic_platform.event_monitor import EventMonitor +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +PMON_REBOOT_CAUSE_PATH = "/usr/share/sonic/platform/reboot-cause/" +REBOOT_CAUSE_FILE = "reboot-cause.txt" +PREV_REBOOT_CAUSE_FILE = "previous-reboot-cause.txt" +monitor = None + + +class Chassis(ChassisBase): + + __num_of_fantrays = 4 + __num_of_psus = 2 + __num_of_sfps = 32 + __num_of_thermals = 12 + __num_of_components = 1 + + def __init__(self): + ChassisBase.__init__(self) + + # Initialize EEPROM + self._eeprom = Eeprom() + self._eeprom_data = self._eeprom.get_eeprom_data() + + # Initialize FAN + for index in range(self.__num_of_fantrays): + fandrawer = FanDrawer(index) + self._fan_drawer_list.append(fandrawer) + self._fan_list.extend(fandrawer._fan_list) + + # Initialize PSU + for index in range(self.__num_of_psus): + psu = Psu(index) + self._psu_list.append(psu) + self._fan_list.extend(psu._fan_list) + + # Initialize SFP + for index in range(self.__num_of_sfps): + sfp = Sfp(index) + self._sfp_list.append(sfp) + + # Initialize THERMAL + for index in range(self.__num_of_thermals): + thermal = Thermal(index) + self._thermal_list.append(thermal) + + # Initialize COMPONENT + for index in range(self.__num_of_components): + component = Component(index) + self._component_list.append(component) + + # Initialize WATCHDOG + self._watchdog = Watchdog() + + def __read_txt_file(self, file_path): + try: + with open(file_path, 'r') as fd: + data = fd.read() + return data.strip() + except IOError: + pass + return None + + +############################################## +# Device methods +############################################## + + + def get_name(self): + """ + Retrieves the name of the chassis + Returns: + string: The name of the chassis + """ + return self._eeprom.modelstr() + + def get_presence(self): + """ + Retrieves the presence of the chassis + Returns: + bool: True if chassis is present, False if not + """ + return True + + def get_model(self): + """ + Retrieves the model number (or part number) of the chassis + Returns: + string: Model/part number of chassis + """ + return self._eeprom.part_number_str() + + def get_serial(self): + """ + Retrieves the serial number of the chassis + Returns: + string: Serial number of chassis + """ + return self._eeprom.serial_number_str() + + def get_status(self): + """ + Retrieves the operational status of the chassis + Returns: + bool: A boolean value, True if chassis is operating properly + False if not + """ + return True + +############################################## +# Chassis methods +############################################## + + def get_base_mac(self): + """ + Retrieves the base MAC address for the chassis + + Returns: + A string containing the MAC address in the format + 'XX:XX:XX:XX:XX:XX' + """ + return self._eeprom.base_mac_addr(self._eeprom_data) + + def get_serial_number(self): + """ + Retrieves the hardware serial number for the chassis + + Returns: + A string containing the hardware serial number for this chassis. + """ + return self._eeprom.serial_number_str() + + def get_system_eeprom_info(self): + """ + Retrieves the full content of system EEPROM information for the chassis + + Returns: + A dictionary where keys are the type code defined in + OCP ONIE TlvInfo EEPROM format and values are their corresponding + values. + Ex. { '0x21':'AG9064', '0x22':'V1.0', '0x23':'AG9064-0109867821', + '0x24':'001c0f000fcd0a', '0x25':'02/03/2018 16:22:00', + '0x26':'01', '0x27':'REV01', '0x28':'AG9064-C2358-16G'} + """ + return self._eeprom.system_eeprom_info() + + def get_reboot_cause(self): + """ + Retrieves the cause of the previous reboot + 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. + """ + description = 'None' + reboot_cause = self.REBOOT_CAUSE_HARDWARE_OTHER + + reboot_cause_path = PMON_REBOOT_CAUSE_PATH + REBOOT_CAUSE_FILE + prev_reboot_cause_path = PMON_REBOOT_CAUSE_PATH + PREV_REBOOT_CAUSE_FILE + + sw_reboot_cause = self.__read_txt_file(reboot_cause_path) or "Unknown" + prev_sw_reboot_cause = self.__read_txt_file( + prev_reboot_cause_path) or "Unknown" + + if sw_reboot_cause == "Unknown" and prev_sw_reboot_cause in ("Unknown", self.REBOOT_CAUSE_POWER_LOSS): + reboot_cause = self.REBOOT_CAUSE_POWER_LOSS + description = prev_sw_reboot_cause + elif sw_reboot_cause != "Unknown": + reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE + description = sw_reboot_cause + elif prev_reboot_cause_path != "Unknown": + reboot_cause = self.REBOOT_CAUSE_NON_HARDWARE + description = prev_sw_reboot_cause + + return (reboot_cause, description) + + 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. + """ + global monitor + port_dict = {} + while True: + with EventMonitor(timeout) as monitor: + while True: + event = monitor.get_events() + + if not bool(event): + return True, {'sfp': port_dict} + else: + if event['SUBSYSTEM'] == 'swps': + portname = event['DEVPATH'].split("/")[-1] + rc = re.match(r"port(?P\d+)", portname) + if rc is not None: + if event['ACTION'] == "remove": + remove_num = int(rc.group("num")) + port_dict[remove_num] = "0" + elif event['ACTION'] == "add": + add_num = int(rc.group("num")) + port_dict[add_num] = "1" + return True, {'sfp': port_dict} + return False, {'sfp': port_dict} + else: + pass diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/component.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/component.py new file mode 100644 index 000000000000..278317f553b0 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/component.py @@ -0,0 +1,106 @@ +#!/usr/bin/env python + +try: + import os + import subprocess + import logging + from sonic_platform_base.component_base import ComponentBase + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +OS_SYSTEM_SUCCESS = 0 + +MAIN_BIOS_INDEX = 0 + +COMPONENT_NAME_LIST = [ + "Main BIOS", +] + +COMPONENT_DESC_LIST = [ + "Main BIOS", +] + + +class Component(ComponentBase): + + def __get_attr_value(self, attr_path): + + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open file: %s", attr_path) + + retval = retval.rstrip(' \t\n\r') + return retval + + def __set_attr_value(self, attr_path, value): + try: + with open(attr_path, 'r+') as reg_file: + reg_file.write(value) + except IOError as e: + logging.error("Error: unable to open file: %s", str(e)) + return False + + return True + + def __get_bios_version(self): + """ + Retrieves the firmware version of the BIOS + Returns: + A string containing the firmware version of the BIOS + """ + try: + cmd = ['dmidecode', '-s', 'bios-version'] + if os.geteuid() != 0: + cmd.insert(0, 'sudo') + return subprocess.check_output(cmd).strip().decode() + except subprocess.CalledProcessError as e: + raise RuntimeError("Failed to get BIOS version") + + __get_version_callback_list = { + MAIN_BIOS_INDEX: __get_bios_version, + } + + def __init__(self, component_index): + self.index = component_index + + def get_name(self): + """ + Retrieves the name of the component + Returns: + A string containing the name of the component + """ + return COMPONENT_NAME_LIST[self.index] + + def get_description(self): + """ + Retrieves the description of the component + Returns: + A string containing the description of the component + """ + return COMPONENT_DESC_LIST[self.index] + + def get_firmware_version(self): + """ + Retrieves the firmware version of the component + Returns: + A string containing the firmware version of the component + """ + return self.__get_version_callback_list[self.index](self) + + def install_firmware(self, image_path): + """ + Installs firmware to the component + Args: + image_path: A string, path to firmware image + Returns: + A boolean, True if install was successful, False if not + """ + return self.__install_firmware_callback_list[self.index](self, image_path) diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/eeprom.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/eeprom.py new file mode 100644 index 000000000000..e3cf2b56be46 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/eeprom.py @@ -0,0 +1,114 @@ +#!/usr/bin/env python + +try: + import sys + import re + if sys.version_info.major == 3: + from io import StringIO + else: + from cStringIO import StringIO + # from sonic_platform_base.sonic_eeprom import eeprom_dts + from sonic_platform_base.sonic_eeprom import eeprom_tlvinfo +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Eeprom(eeprom_tlvinfo.TlvInfoDecoder): + + EEPROM_DECODE_HEADLINES = 6 + + def __init__(self): + self._eeprom_path = "/sys/bus/i2c/devices/0-0055/eeprom" + super(Eeprom, self).__init__(self._eeprom_path, 0, '', True) + self._eeprom = self._load_eeprom() + + def __parse_output(self, decode_output): + decode_output.replace('\0', '') + lines = decode_output.split('\n') + lines = lines[self.EEPROM_DECODE_HEADLINES:] + _eeprom_info_dict = dict() + + for line in lines: + match = re.search( + r'(0x[0-9a-fA-F]{2})([\s]+[\S]+[\s]+)([\S]+)', line) + if match is not None: + idx = match.group(1) + value = match.group(3).rstrip('\0') + _eeprom_info_dict[idx] = value + return _eeprom_info_dict + + def _load_eeprom(self): + original_stdout = sys.stdout + sys.stdout = StringIO() + err = self.read_eeprom_db() + if err: + pass + else: + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + return self.__parse_output(decode_output) + + status = self.check_status() + if status < 'ok': + return {} + + data = self.read_eeprom() + if data is None: + return 0 + + self.decode_eeprom(data) + decode_output = sys.stdout.getvalue() + sys.stdout = original_stdout + + is_valid = self.is_checksum_valid(data) + if not is_valid: + return {} + + return self.__parse_output(decode_output) + + def get_eeprom(self): + return self._eeprom + + def serial_number_str(self): + """ + Returns the serial number + """ + return self._eeprom.get('0x23', "Undefined.") + + def base_mac_addr(self, ee): + """ + Returns the base mac address found in the system EEPROM + """ + return self._eeprom.get('0x24', "Undefined.") + + def modelstr(self): + """ + Returns the Model name + """ + return self._eeprom.get('0x28', "Undefined.") + + def part_number_str(self): + """ + Returns the part number + """ + return self._eeprom.get('0x22', "Undefined.") + + def revision_str(self): + """ + Returns the device revision + """ + return self._eeprom.get('0x26', "Undefined.") + + def serial_str(self): + return self._eeprom.get('0x2F', "Undefined.") + + def system_eeprom_info(self): + """ + Returns a dictionary, where keys are the type code defined in + ONIE EEPROM format and values are their corresponding values + found in the system EEPROM. + """ + return self._eeprom + + def get_eeprom_data(self): + return self._eeprom diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/event_monitor.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/event_monitor.py new file mode 100644 index 000000000000..3b966023339e --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/event_monitor.py @@ -0,0 +1,95 @@ +# +# event_monitor.py +# Description: module to minitor events +# + +try: + import socket + from collections import OrderedDict + import os +except ImportError as e: + raise ImportError("%s - required module not found" % str(e)) + + +NETLINK_KOBJECT_UEVENT = 15 + + +class EventMonitor: + + def __init__(self, timeout): + self.recieved_events = OrderedDict() + self.socket = socket.socket( + socket.AF_NETLINK, socket.SOCK_DGRAM, NETLINK_KOBJECT_UEVENT) + self.timeout = timeout + + def start(self): + self.socket.bind((os.getpid(), -1)) + + if self.timeout == 0: + self.socket.settimeout(None) + else: + self.socket.settimeout(self.timeout/1000.0) + + def stop(self): + self.socket.close() + + def __enter__(self): + self.start() + return self + + def __exit__(self, exc_type, exc_value, traceback): + self.stop() + + def __iter__(self): + while True: + for item in self.next_events(): + yield item + + def next_events(self): + try: + data = self.socket.recv(16384) + event = {} + for item in data.split(b'\x00'): + if not item: + # check if we have an event and if we already received it + if event and event['SEQNUM'] not in self.recieved_events: + self.recieved_events[event['SEQNUM']] = None + if len(self.recieved_events) > 100: + self.recieved_events.popitem(last=False) + yield event + event = {} + else: + try: + k, v = item.split(b'=', 1) + event[k.decode('ascii')] = v.decode('ascii') + except ValueError: + pass + except socket.timeout: + yield event + + def get_events(self): + event = {} + while True: + try: + data = self.socket.recv(16384) + + for item in data.split(b'\x00'): + if not item: + # check if we have an event and if we already received it + # if no item and event empty, means received garbled + if bool(event): + if event['SEQNUM'] not in self.recieved_events: + self.recieved_events[event['SEQNUM']] = None + if len(self.recieved_events) > 100: + self.recieved_events.popitem(last=False) + return event + else: + event = {} + else: + try: + k, v = item.split(b'=', 1) + event[k] = v + except ValueError: + pass + except socket.timeout: + return event diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/fan.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/fan.py new file mode 100644 index 000000000000..42da0454aee6 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/fan.py @@ -0,0 +1,216 @@ +#!/usr/bin/env python +# +# Name: fan.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + import logging + import os + from sonic_platform_base.fan_base import FanBase + from sonic_py_common.logger import Logger +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +MAX_FAN_RPM = 22000 +MAX_PSU_FAN_RPM = 18000 + +MAX_PWM_OF_FAN = 255 + + +FAN_SYS_FS = "/sys/class/hwmon/hwmon1/device/fan{}_input" +FAN_ALARM_SYS_FS = "/sys/class/hwmon/hwmon1/device/fan{}_alarm" + +PSU_FAN_SYS_FS = "/sys/class/hwmon/hwmon{}/fan1_input" +PSU_FAN_ALARM_SYS_FS = "/sys/class/hwmon/hwmon{}/fan1_alarm" + + +logger = Logger('sonic-platform-fan') + + +class Fan(FanBase): + + def __init__(self, index, psu_fan=False): + self.__psu_fan = psu_fan + + if psu_fan: + self.__index = index + self.__rpm = PSU_FAN_SYS_FS.format(8 + self.__index) + self.__alarm = PSU_FAN_ALARM_SYS_FS.format(8 + self.__index) + else: + self.__index = 8 - index + self.__rpm = FAN_SYS_FS.format(self.__index) + self.__alarm = FAN_ALARM_SYS_FS.format(self.__index) + + def __get_attr_value(self, attr_path): + + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except Exception as error: + logging.error("Unable to open file: %s", attr_path) + + retval = retval.rstrip(' \t\n\r') + return retval + + +############################################## +# Device methods +############################################## + + def get_name(self): + """ + Retrieves the name of the device + + Returns: + string: The name of the device + """ + return "FAN{}".format(self.__index) if not self.__psu_fan else "PSU{}_FAN".format(self.__index+1) + + def get_presence(self): + """ + Retrieves the presence of the device + + Returns: + bool: True if device is present, False if not + """ + return self.get_status() + + 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 + """ + status = False + + rv = self.__get_attr_value(self.__alarm) + if rv != 'ERR': + if rv == '0': + status = True + else: + raise SyntaxError + + return status + + def is_replaceable(self): + """ + Indicate whether Fan is replaceable. + Returns: + bool: True if it is replaceable. + """ + return False + + def get_position_in_parent(self): + return self.__index + + +############################################## +# FAN methods +############################################## + + def get_direction(self): + """ + Retrieves the direction of fan + + Returns: + A string, either FAN_DIRECTION_INTAKE or FAN_DIRECTION_EXHAUST + depending on fan direction + """ + return 'N/A' + + def get_speed(self): + """ + Retrieves the speed of fan as a percentage of full speed + + Returns: + An integer, the percentage of full fan speed, in the range 0 (off) + to 100 (full speed) + """ + speed = 44 + rv = self.__get_attr_value(self.__rpm) + + if rv != 'ERR': + speed = int( + rv) * 100 // (MAX_PSU_FAN_RPM if self.__psu_fan else MAX_FAN_RPM) + + return speed + + 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) + """ + return self.get_speed() + + def get_speed_tolerance(self): + """ + Retrieves the speed tolerance of the fan + + Returns: + An integer, the percentage of variance from target speed which is + considered tolerable + """ + raise NotImplementedError + + def set_speed(self, speed): + """ + Sets the fan speed + + Args: + speed: An integer, the percentage of full fan speed to set fan to, + in the range 0 (off) to 100 (full speed) + + Returns: + A boolean, True if speed is set successfully, False if not + """ + return False + + def set_status_led(self, color): + """ + 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: + bool: True if status LED state is set successfully, False if not + """ + return False + + def get_status_led(self): + """ + Gets the state of the fan status LED + + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + return None diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/fan_drawer.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/fan_drawer.py new file mode 100644 index 000000000000..25006dd92c80 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/fan_drawer.py @@ -0,0 +1,23 @@ +try: + from sonic_platform_base.fan_drawer_base import FanDrawerBase + from sonic_platform.fan import Fan +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class FanDrawer(FanDrawerBase): + """ Platform-specific Fan class""" + + def __init__(self, fantray_index): + FanDrawerBase.__init__(self) + self.fantray_index = fantray_index + self._fan_list.append(Fan(2 * fantray_index)) + self._fan_list.append(Fan(2 * fantray_index + 1)) + + def get_name(self): + """ + Retrieves the fan drawer name + Returns: + string: The name of the device + """ + return "FanTray{}".format(self.fantray_index+1) diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/platform.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/platform.py new file mode 100644 index 000000000000..a2ffe0a47e78 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/platform.py @@ -0,0 +1,20 @@ +#!/usr/bin/env python +# +# Name: platform.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + + +try: + from sonic_platform_base.platform_base import PlatformBase + from sonic_platform.chassis import Chassis +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Platform(PlatformBase): + + def __init__(self): + PlatformBase.__init__(self) + self._chassis = Chassis() diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/psu.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/psu.py new file mode 100644 index 000000000000..dd89a86339c9 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/psu.py @@ -0,0 +1,327 @@ +try: + from sonic_platform_base.psu_base import PsuBase + from sonic_py_common.logger import Logger + from sonic_platform.fan import Fan + import subprocess +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +VOLTAGE_HIGH_THRESHOLD = 13.4 +VOLTAGE_LOW_THRESHOLD = 10.2 +TEMPERATURE_HIGH_THRESHOLD = 70.0 +MAX_SUPPLIED_POWER = 550.0 + +GPIO_OFFSET = 9984 + +PSU_SYS_FS = "/sys/class/hwmon/hwmon{}/" + +PSU_EXIST_INPOWER = "/sys/class/gpio/gpio{}/value" + +PSU_EEPROM = "/sys/bus/i2c/devices/{}-0050/eeprom" + +logger = Logger('sonic-platform-psu') + + +class Psu(PsuBase): + + __name_of_psus = ['PSU1', 'PSU2'] + + def __init__(self, index): + PsuBase.__init__(self) + + self.__index = index + + # Presence: PSU1: GPIO_OFFSET+100; PSU2: GPIO_OFFSET+97 + self.__psu_presence_attr = PSU_EXIST_INPOWER.format( + GPIO_OFFSET + 100 - 3 * self.__index) + + # Powerstatus: PSU1: GPIO_OFFSET+99; PSU2: GPIO_OFFSET+96 + self.__psu_inpower_status_attr = PSU_EXIST_INPOWER.format( + GPIO_OFFSET + 99 - 3 * self.__index) + + psun_sys_fs = PSU_SYS_FS.format(8 + self.__index) + + # /sys/bus/i2c/devices/i2c-57/57-0058/hwmon/hwmon8/in2_input + self.__psu_voltage_out_attr = psun_sys_fs + "in2_input" + + # /sys/bus/i2c/devices/i2c-57/57-0058/hwmon/hwmon8/curr2_input + self.__psu_current_out_attr = psun_sys_fs + "curr2_input" + + # /sys/bus/i2c/devices/i2c-57/57-0058/hwmon/hwmon8/power2_input + self.__psu_power_out_attr = psun_sys_fs + "power2_input" + + # /sys/bus/i2c/devices/i2c-57/57-0058/hwmon/hwmon8/temp2_input + self.__psu_temperature_attr = psun_sys_fs + "temp2_input" + + self.__psu_eeprom_attr = PSU_EEPROM.format(57 + index) + + self._fan_list.append(Fan(index=self.__index, psu_fan=True)) + + def __eeprom_read_bytes(self, start, end): + try: + val = open(self.__psu_eeprom_attr, "rb").read()[start:end] + except Exception: + val = None + return val.decode('ascii') + + def __get_attr_value(self, filepath): + try: + with open(filepath, 'r') as fd: + # text + data = fd.readlines() + return data[0].rstrip('\r\n') + except FileNotFoundError: + logger.log_error(f"File {filepath} not found. Aborting") + except (OSError, IOError) as ex: + logger.log_error("Cannot open - {}: {}".format(filepath, repr(ex))) + + return 'ERR' +############################################## +# Device methods +############################################## + + def get_name(self): + """ + Retrieves the name of the device + + Returns: + string: The name of the device + """ + return self.__name_of_psus[self.__index] + + def get_presence(self): + """ + Retrieves the presence of the device + + Returns: + bool: True if device is present, False if not + """ + presence = False + attr_path = self.__psu_presence_attr + + attr_rv = self.__get_attr_value(attr_path) + if attr_rv != 'ERR': + if attr_rv == "1": + presence = True + else: + raise SyntaxError + + return presence + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + + Returns: + string: Model/part number of device + """ + return self.__eeprom_read_bytes(22, 34) + + def get_serial(self): + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + return self.__eeprom_read_bytes(50, 61) + + def get_revision(self): + """ + Retrieves the hardware revision of the device + + Returns: + string: Revision value of device + """ + return self.__eeprom_read_bytes(46, 48) + + def get_status(self): + """ + Retrieves the operational status of the device + + Returns: + A boolean value, True if device is operating properly, False if not + """ + inpower = False + attr_rv = self.__get_attr_value(self.__psu_inpower_status_attr) + if attr_rv != 'ERR': + if attr_rv == "1": + inpower = True + + return self.get_presence() and inpower + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True + +############################################## +# PSU methods +############################################## + + def get_voltage(self): + """ + Retrieves current PSU voltage output + + Returns: + A float number, the output voltage in volts, + e.g. 12.1 + """ + attr_path = self.__psu_voltage_out_attr + + attr_rv = self.__get_attr_value(attr_path) + if attr_rv != 'ERR': + voltage_out = float(attr_rv) / 1000 + else: + raise SyntaxError + + return voltage_out + + def get_current(self): + """ + Retrieves present electric current supplied by PSU + + Returns: + A float number, the electric current in amperes, e.g 15.4 + """ + attr_path = self.__psu_current_out_attr + + attr_rv = self.__get_attr_value(attr_path) + if attr_rv != 'ERR': + current_out = float(attr_rv) / 1000 + else: + raise SyntaxError + + return current_out + + def get_power(self): + """ + Retrieves current energy supplied by PSU + + Returns: + A float number, the power in watts, e.g. 302.6 + """ + attr_path = self.__psu_power_out_attr + + attr_rv = self.__get_attr_value(attr_path) + if attr_rv != 'ERR': + power_out = float(attr_rv) / 1000000 + else: + raise SyntaxError + + return power_out + + def get_temperature(self): + """ + Retrieves current temperature reading from PSU + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + attr_rv = self.__get_attr_value(self.__psu_temperature_attr) + if attr_rv != 'ERR': + temperature = float(attr_rv) / 1000 + else: + raise SyntaxError + + return temperature + + def get_powergood_status(self): + """ + Retrieves the powergood status of PSU + + Returns: + A boolean, True if PSU has stablized its output voltages and passed all + its internal self-tests, False if not. + """ + powergood_status = False + voltage_out = self.get_voltage() + + # Check the voltage out with 12V, plus or minus 20 percentage. + if self.get_voltage_low_threshold() <= voltage_out <= self.get_voltage_high_threshold(): + powergood_status = True + + return powergood_status + + 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 VOLTAGE_HIGH_THRESHOLD + + 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 VOLTAGE_LOW_THRESHOLD + + 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 + """ + return TEMPERATURE_HIGH_THRESHOLD + + def get_maximum_supplied_power(self): + """ + Retrieves the maximum supplied power by PSU + Returns: + A float number, the maximum power output in Watts. + e.g. 1200.1 + """ + return MAX_SUPPLIED_POWER + + def set_status_led(self, color): + """ + Sets the state of the PSU status LED + + Args: + color: A string representing the color with which to set the + PSU status LED + + Returns: + bool: True if status LED state is set successfully, False if not + """ + value = 0 + # PSU1: mask = 8 + # PSU2: mask = 16 + mask = 8 + 8 * self.__index + + if color == self.STATUS_LED_COLOR_GREEN: + value = 0x00 + elif color == self.STATUS_LED_COLOR_AMBER: + value = 0xFF + else: + logger.log_error( + "Invalid Parameters. LED Color {} doesn't support".format(color)) + return False + + ret_val, log = subprocess.getstatusoutput( + "i2cset -m {} -y -r 50 0x75 2 {}".format(mask, value)) + + if ret_val != 0: + logger.log_error("Unable set PSU{} color with following i2cset output {} ".format( + self.__index + 1, log)) + return False + + return True + + def get_status_led(self): + """ + Gets the state of the PSU status LED + + Returns: + A string, one of the predefined STATUS_LED_COLOR_* strings above + """ + raise NotImplementedError diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/sfp.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/sfp.py new file mode 100644 index 000000000000..bb42dea1e080 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/sfp.py @@ -0,0 +1,197 @@ +#!/usr/bin/env python + +try: + from sonic_platform_base.sonic_xcvr.sfp_optoe_base import SfpOptoeBase + from sonic_py_common.logger import Logger + +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +SFP_TYPE = "SFP" +QSFP_TYPE = "QSFP" +QSFP_DD_TYPE = "QSFP_DD" + +GPIO_OFFSET = 9984 +GPIO_VALUE = "/sys/class/gpio/gpio{}/value" +EEPROM_PATH = "/sys/bus/i2c/devices/{}-0050/eeprom" + +logger = Logger('sonic-platform-sfp') + +class Sfp(SfpOptoeBase): + """ + BFN Platform-specific SFP class + """ + + def __init__(self, port_num): + SfpOptoeBase.__init__(self) + self.index = port_num + self.port_num = port_num + self.sfp_type = QSFP_TYPE + + self.eeprom_path = EEPROM_PATH.format(9 + (port_num ^ 1)) + # print(self.eeprom_path) + + def __get_attr_value(self, filepath): + try: + with open(filepath, 'r') as fd: + # text + data = fd.readlines() + return data[0].rstrip('\r\n') + except FileNotFoundError: + logger.log_error(f"File {filepath} not found. Aborting") + except (OSError, IOError) as ex: + logger.log_error("Cannot open - {}: {}".format(filepath, repr(ex))) + + return 'ERR' + + def get_presence(self): + """ + Retrieves the presence of the sfp + """ + presence = False + + gpio = GPIO_OFFSET + 224 + (16 if self.index < 16 else - 16) + attr_rv = self.__get_attr_value( + GPIO_VALUE.format(gpio + (self.index) ^ 1)) + if attr_rv != 'ERR': + if attr_rv == "1": + presence = True + else: + raise SyntaxError + + return presence + + def get_lpmode(self): + """ + Retrieves the lpmode (low power mode) status of this SFP + """ + lpmode = False + gpio = GPIO_OFFSET + 160 + (16 if self.index < 16 else - 16) + attr_rv = self.__get_attr_value( + GPIO_VALUE.format(gpio + (self.index) ^ 1)) + if attr_rv != 'ERR': + if attr_rv == "1": + lpmode = True + else: + raise SyntaxError + + return lpmode + + def set_lpmode(self, lpmode): + """ + Sets the lpmode (low power mode) of SFP + """ + return False + + def get_eeprom_path(self): + return self.eeprom_path + + def write_eeprom(self, offset, num_bytes, write_buffer): + # Not supported at the moment + return False + + def get_name(self): + """ + Retrieves the name of the device + Returns: + string: The name of the device + """ + return "sfp{}".format(self.index) + + def get_reset_status(self): + """ + Retrieves the reset status of SFP + """ + status = False + gpio = GPIO_OFFSET + 128 + (16 if self.index < 16 else - 16) + attr_rv = self.__get_attr_value( + GPIO_VALUE.format(gpio + (self.index) ^ 1)) + if attr_rv != 'ERR': + if attr_rv == "1": + status = True + else: + raise SyntaxError + + return status + + def reset(self): + """ + Reset SFP and return all user module settings to their default srate. + """ + return False + + def get_status(self): + """ + Retrieves the operational status of the device + """ + reset = self.get_reset_status() + + if reset: + status = False + else: + status = True + + return status + + def get_position_in_parent(self): + """ + Retrieves 1-based relative physical position in parent device. + Returns: + integer: The 1-based relative physical position in parent + device or -1 if cannot determine the position + """ + return self.index + + def is_replaceable(self): + """ + Indicate whether this device is replaceable. + Returns: + bool: True if it is replaceable. + """ + return True + + 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" + """ + if not self.get_presence(): + return self.SFP_STATUS_UNPLUGGED + return self.SFP_STATUS_OK + + def tx_disable(self, tx_disable): + """ + Disable SFP TX for all channels + Args: + tx_disable : A Boolean, True to enable tx_disable mode, False to disable + tx_disable mode. + Returns: + A boolean, True if tx_disable is set successfully, False if not + """ + if self.sfp_type == QSFP_TYPE: + return self.tx_disable_channel(0xF, tx_disable) + return False + + def tx_disable_channel(self, channel, disable): + """ + Sets the tx_disable for specified SFP channels + + Args: + channel : A hex of 4 bits (bit 0 to bit 3) which represent channel 0 to 3, + e.g. 0x5 for channel 0 and channel 2. + disable : A boolean, True to disable TX channels specified in channel, + False to enable + + Returns: + A boolean, True if successful, False if not + """ + return False + + def get_power_override(self): + return False + + def set_power_override(self, power_override, power_set): + return False diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/thermal.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/thermal.py new file mode 100644 index 000000000000..514ff2da0d65 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/thermal.py @@ -0,0 +1,219 @@ +#!/usr/bin/env python +# +# Name: thermal.py, version: 1.0 +# +# Description: Module contains the definitions of SONiC platform APIs +# + +try: + import os + import logging + from sonic_platform_base.thermal_base import ThermalBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + + +class Thermal(ThermalBase): + + __core_temp_path = "/sys/devices/platform/coretemp.0/hwmon/hwmon0/temp{}_{}" + __switch_thermal_path = "/sys/class/hwmon/hwmon{}/temp{}_{}" + __name_of_thermal = [ + "Core 0", + "Core 1", + "Core 2", + "Core 3", + "Core 4", + "Front MAC", + "ASIC Core", + "CPU Board", + "Near PSU1", + "Rear MAC", + "Near Port 32", + "Near PSU2" + ] + __thermal_path_list = [ + __core_temp_path.format(1, "input"), + __core_temp_path.format(2, "input"), + __core_temp_path.format(3, "input"), + __core_temp_path.format(4, "input"), + __core_temp_path.format(5, "input"), + __switch_thermal_path.format(2, 1, "input"), + __switch_thermal_path.format(2, 2, "input"), + __switch_thermal_path.format(3, 1, "input"), + __switch_thermal_path.format(4, 1, "input"), + __switch_thermal_path.format(5, 1, "input"), + __switch_thermal_path.format(6, 1, "input"), + __switch_thermal_path.format(7, 1, "input") + ] + __max_temp_path_list = [ + __core_temp_path.format(1, "max"), + __core_temp_path.format(2, "max"), + __core_temp_path.format(3, "max"), + __core_temp_path.format(4, "max"), + __core_temp_path.format(5, "max"), + __switch_thermal_path.format(2, 1, "max"), + __switch_thermal_path.format(2, 2, "max"), + __switch_thermal_path.format(3, 1, "max"), + __switch_thermal_path.format(4, 1, "max"), + __switch_thermal_path.format(5, 1, "max"), + __switch_thermal_path.format(6, 1, "max"), + __switch_thermal_path.format(7, 1, "max") + ] + + def __init__(self, index): + self.__index = index + + self.__thermal_temp_attr = self.__thermal_path_list[self.__index] + self.__max_temp_attr = self.__max_temp_path_list[self.__index] + + def __get_attr_value(self, attr_path): + + retval = 'ERR' + if not os.path.isfile(attr_path): + return retval + + try: + with open(attr_path, 'r') as fd: + retval = fd.read() + except FileNotFoundError: + logging.error("File %s not found. Aborting", attr_path) + except (OSError, IOError) as ex: + logging.error("Cannot open - %s: %s", attr_path, repr(ex)) + + retval = retval.rstrip(' \t\n\r') + return retval + + +############################################## +# Device methods +############################################## + + + def get_name(self): + """ + Retrieves the name of the device + + Returns: + string: The name of the device + """ + return self.__name_of_thermal[self.__index] + + def get_presence(self): + """ + Retrieves the presence of the device + + Returns: + bool: True if device is present, False if not + """ + attr_path = self.__thermal_temp_attr + return os.path.isfile(attr_path) + + def get_model(self): + """ + Retrieves the model number (or part number) of the device + + Returns: + string: Model/part number of device + """ + raise NotImplementedError + + def get_serial(self): + """ + Retrieves the serial number of the device + + Returns: + string: Serial number of device + """ + raise NotImplementedError + + def get_status(self): + """ + Retrieves the operational status of the device + + Returns: + A boolean value, True if device is operating properly, False if not + """ + status = False + if self.get_presence(): + status = True + + return status + +############################################## +# THERMAL methods +############################################## + + def get_temperature(self): + """ + Retrieves current temperature reading from thermal + + Returns: + A float number of current temperature in Celsius up to nearest thousandth + of one degree Celsius, e.g. 30.125 + """ + attr_path = self.__thermal_temp_attr + + attr_rv = self.__get_attr_value(attr_path) + if attr_rv != 'ERR': + temperature = float(attr_rv) / 1000 + else: + raise SyntaxError + + return temperature + + def get_high_threshold(self): + """ + Retrieves the high threshold temperature of thermal + + Returns: + A float number, the high threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + attr_path = self.__max_temp_attr + + if attr_path == '': + raise NotImplementedError + else: + attr_rv = self.__get_attr_value(attr_path) + if attr_rv != 'ERR': + high_threshold = float(attr_rv) / 1000 + else: + raise SyntaxError + + return high_threshold + + def get_low_threshold(self): + """ + Retrieves the low threshold temperature of thermal + + Returns: + A float number, the low threshold temperature of thermal in Celsius + up to nearest thousandth of one degree Celsius, e.g. 30.125 + """ + raise NotImplementedError + + def set_high_threshold(self, temperature): + """ + Sets the high threshold temperature of thermal + + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + + Returns: + A boolean, True if threshold is set successfully, False if not + """ + raise NotImplementedError + + def set_low_threshold(self, temperature): + """ + Sets the low threshold temperature of thermal + + Args : + temperature: A float number up to nearest thousandth of one degree Celsius, + e.g. 30.125 + + Returns: + A boolean, True if threshold is set successfully, False if not + """ + raise NotImplementedError diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/watchdog.py b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/watchdog.py new file mode 100644 index 000000000000..e3df1b3f8614 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/sonic_platform/watchdog.py @@ -0,0 +1,251 @@ +#!/usr/bin/env python + +############################################################################# +# +# Module contains an implementation of SONiC Platform Base API and +# provides the Watchdog information +# +############################################################################# + +import fcntl +import os +import array + +try: + from sonic_platform_base.watchdog_base import WatchdogBase +except ImportError as e: + raise ImportError(str(e) + "- required module not found") + +""" ioctl constants """ +IO_WRITE = 0x40000000 +IO_READ = 0x80000000 +IO_READ_WRITE = 0xC0000000 +IO_SIZE_INT = 0x00040000 +IO_SIZE_40 = 0x00280000 +IO_TYPE_WATCHDOG = ord('W') << 8 + +WDR_INT = IO_READ | IO_SIZE_INT | IO_TYPE_WATCHDOG +WDR_40 = IO_READ | IO_SIZE_40 | IO_TYPE_WATCHDOG +WDWR_INT = IO_READ_WRITE | IO_SIZE_INT | IO_TYPE_WATCHDOG + +""" Watchdog ioctl commands """ +WDIOC_GETSUPPORT = 0 | WDR_40 +WDIOC_GETSTATUS = 1 | WDR_INT +WDIOC_GETBOOTSTATUS = 2 | WDR_INT +WDIOC_GETTEMP = 3 | WDR_INT +WDIOC_SETOPTIONS = 4 | WDR_INT +WDIOC_KEEPALIVE = 5 | WDR_INT +WDIOC_SETTIMEOUT = 6 | WDWR_INT +WDIOC_GETTIMEOUT = 7 | WDR_INT +WDIOC_SETPRETIMEOUT = 8 | WDWR_INT +WDIOC_GETPRETIMEOUT = 9 | WDR_INT +WDIOC_GETTIMELEFT = 10 | WDR_INT + +""" Watchdog status constants """ +WDIOS_DISABLECARD = 0x0001 +WDIOS_ENABLECARD = 0x0002 + +WDT_COMMON_ERROR = -1 +WD_MAIN_IDENTITY = "iTCO_wdt" +WDT_SYSFS_PATH = "/sys/class/watchdog/" + + +class Watchdog(WatchdogBase): + + def __init__(self): + + self.watchdog = None + self.armed = False + + def _is_wd_main(self, dev): + """ + Checks watchdog identity + """ + identity = self._read_file( + "{}/{}/identity".format(WDT_SYSFS_PATH, dev)) + return identity == WD_MAIN_IDENTITY + + def _get_wdt(self): + """ + Retrieves watchdog device + """ + wdt_main_dev_list = [dev for dev in os.listdir( + "/dev/") if dev.startswith("watchdog") and self._is_wd_main(dev)] + if not wdt_main_dev_list: + return None + wdt_main_dev_name = wdt_main_dev_list[0] + watchdog_device_path = "/dev/{}".format(wdt_main_dev_name) + try: + watchdog = os.open(watchdog_device_path, os.O_RDWR) + except (FileNotFoundError, IOError, OSError): + watchdog = None + except SystemExit: + pass + + return watchdog, wdt_main_dev_name + + def _read_file(self, file_path): + """ + Read text file + """ + try: + with open(file_path, "r") as fd: + txt = fd.read() + except IOError: + return WDT_COMMON_ERROR + return txt.strip() + + def _enable(self): + """ + Turn on the watchdog timer + """ + req = array.array('h', [WDIOS_ENABLECARD]) + fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False) + + def _disable(self): + """ + Turn off the watchdog timer + """ + if self.watchdog is None: + return WDT_COMMON_ERROR + req = array.array('h', [WDIOS_DISABLECARD]) + fcntl.ioctl(self.watchdog, WDIOC_SETOPTIONS, req, False) + + def _keepalive(self): + """ + Keep alive watchdog timer + """ + fcntl.ioctl(self.watchdog, WDIOC_KEEPALIVE) + + def _settimeout(self, seconds): + """ + Set watchdog timer timeout + @param seconds - timeout in seconds + @return is the actual set timeout + """ + req = array.array('I', [seconds]) + fcntl.ioctl(self.watchdog, WDIOC_SETTIMEOUT, req, True) + return int(req[0]) + + def _gettimeout(self, timeout_path): + """ + Get watchdog timeout + @return watchdog timeout + """ + if self.watchdog is None: + return WDT_COMMON_ERROR + req = array.array('I', [0]) + fcntl.ioctl(self.watchdog, WDIOC_GETTIMEOUT, req, True) + + return int(req[0]) + + def _gettimeleft(self): + """ + Get time left before watchdog timer expires + @return time left in seconds + """ + req = array.array('I', [0]) + fcntl.ioctl(self.watchdog, WDIOC_GETTIMELEFT, req, True) + + return int(req[0]) + + def _set_arm(self): + self.watchdog, self.wdt_main_dev_name = self._get_wdt() + self.status_path = "/sys/class/watchdog/%s/status" % self.wdt_main_dev_name + self.state_path = "/sys/class/watchdog/%s/state" % self.wdt_main_dev_name + self.timeout_path = "/sys/class/watchdog/%s/timeout" % self.wdt_main_dev_name + # Set default value + self._disable() + self.timeout = self._gettimeout(self.timeout_path) + + ################################################################# + + def arm(self, seconds): + """ + Arm the hardware watchdog with a timeout of seconds. + If the watchdog is currently armed, calling this function will + simply reset the timer to the provided value. If the underlying + hardware does not support the value provided in , this + method should arm the watchdog with the *next greater* available + value. + Returns: + An integer specifying the *actual* number of seconds the watchdog + was armed with. On failure returns -1. + """ + if self.watchdog is None: + self._set_arm() + + ret = WDT_COMMON_ERROR + if seconds < 0 or self.watchdog is None: + return ret + + try: + if self.timeout != seconds: + self.timeout = self._settimeout(seconds) + if self.armed: + self._keepalive() + else: + self._enable() + self.armed = True + ret = self.timeout + except IOError as e: + pass + + return ret + + def disarm(self): + """ + Disarm the hardware watchdog + Returns: + A boolean, True if watchdog is disarmed successfully, False if not + """ + disarmed = False + if self.watchdog is None: + return disarmed + + if self.is_armed(): + try: + self._disable() + self.armed = False + disarmed = True + except IOError: + pass + + return disarmed + + def is_armed(self): + """ + Retrieves the armed state of the hardware watchdog. + Returns: + A boolean, True if watchdog is armed, False if not + """ + + return self.armed + + def get_remaining_time(self): + """ + If the watchdog is armed, retrieve the number of seconds remaining on + the watchdog timer + Returns: + An integer specifying the number of seconds remaining on thei + watchdog timer. If the watchdog is not armed, returns -1. + """ + + timeleft = WDT_COMMON_ERROR + if self.watchdog is None: + return WDT_COMMON_ERROR + + if self.armed: + try: + timeleft = self._gettimeleft() + except IOError: + pass + + return timeleft + + def __del__(self): + """ + Close watchdog + """ + if self.watchdog is not None: + os.close(self.watchdog) diff --git a/platform/barefoot/sonic-platform-modules-netberg/aurora-710/utils/i2c_init.sh b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/utils/i2c_init.sh new file mode 100755 index 000000000000..52576eac3f6d --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/aurora-710/utils/i2c_init.sh @@ -0,0 +1,404 @@ +#!/bin/bash + +# vdd value for mac +rov_val_array=( 0.85 0.82 0.77 0.87 0.74 0.84 0.79 0.89 ) +rov_reg_array=( 0x24 0x21 0x1c 0x26 0x19 0x23 0x1e 0x28 ) + +#GPIO Offset +GPIO_OFFSET=0 + +function _set_gpio_offset { + GPIO_OFFSET=0 + gpio_base_max=`cat /sys/class/gpio/gpiochip*/base | sort -n | tail -1` + GPIO_OFFSET=$(($gpio_base_max - 240)) + echo "set GPIO_OFFSET=${GPIO_OFFSET}" +} + +#GPIO Init +function i2c_gpio_init { + local i=0 + #ABS Port 0-15 + echo "pca9535 0x20" > /sys/bus/i2c/devices/i2c-5/new_device + _set_gpio_offset + #for i in {240..255}; + for((i=${GPIO_OFFSET}+240;i<=${GPIO_OFFSET}+255;i++)); + do + echo $i > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio${i}/active_low + done + + #ABS Port 16-31 + echo "pca9535 0x21" > /sys/bus/i2c/devices/i2c-5/new_device + #for i in {224..239}; + for((i=${GPIO_OFFSET}+224;i<=${GPIO_OFFSET}+239;i++)); + do + echo $i > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio${i}/active_low + done + + #INT Port 0-15 + echo "pca9535 0x22" > /sys/bus/i2c/devices/i2c-5/new_device + #for i in {208..223}; + for((i=${GPIO_OFFSET}+208;i<=${GPIO_OFFSET}+223;i++)); + do + echo $i > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio${i}/active_low + done + + #INT Port 16-31 + echo "pca9535 0x23" > /sys/bus/i2c/devices/i2c-5/new_device + #for i in {192..207}; + for((i=${GPIO_OFFSET}+192;i<=${GPIO_OFFSET}+207;i++)); + do + echo $i > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio${i}/active_low + done + + #SFP+ + echo "pca9535 0x27" > /sys/bus/i2c/devices/i2c-5/new_device + #for i in {176..191}; + for((i=${GPIO_OFFSET}+176;i<=${GPIO_OFFSET}+191;i++)); + do + echo $i > /sys/class/gpio/export + case ${i} in + #176|177|178|179|182|183|188|189|190|191) + $((${GPIO_OFFSET}+176)) | \ + $((${GPIO_OFFSET}+177)) | \ + $((${GPIO_OFFSET}+178)) | \ + $((${GPIO_OFFSET}+179)) | \ + $((${GPIO_OFFSET}+182)) | \ + $((${GPIO_OFFSET}+183)) | \ + $((${GPIO_OFFSET}+188)) | \ + $((${GPIO_OFFSET}+189)) | \ + $((${GPIO_OFFSET}+190)) | \ + $((${GPIO_OFFSET}+191)) ) + echo 1 > /sys/class/gpio/gpio${i}/active_low + ;; + #180|181|184|185|186|187) + $((${GPIO_OFFSET}+180)) | \ + $((${GPIO_OFFSET}+181)) | \ + $((${GPIO_OFFSET}+184)) | \ + $((${GPIO_OFFSET}+185)) | \ + $((${GPIO_OFFSET}+186)) | \ + $((${GPIO_OFFSET}+187)) ) + echo out > /sys/class/gpio/gpio${i}/direction + ;; + esac + + done + + #LP Mode Port 0-15 + echo "pca9535 0x20" > /sys/bus/i2c/devices/i2c-6/new_device + #for i in {160..175}; + for((i=${GPIO_OFFSET}+160;i<=${GPIO_OFFSET}+175;i++)); + do + echo $i > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio${i}/direction + done + + #LP Mode Port 16-31 + echo "pca9535 0x21" > /sys/bus/i2c/devices/i2c-6/new_device + #for i in {144..159}; + for((i=${GPIO_OFFSET}+144;i<=${GPIO_OFFSET}+159;i++)); + do + echo $i > /sys/class/gpio/export + echo out > /sys/class/gpio/gpio${i}/direction + done + + #RST Port 0-15 + echo "pca9535 0x22" > /sys/bus/i2c/devices/i2c-6/new_device + #for i in {128..143}; + for((i=${GPIO_OFFSET}+128;i<=${GPIO_OFFSET}+143;i++)); + do + echo $i > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio${i}/active_low + echo low > /sys/class/gpio/gpio${i}/direction + done + + #RST Port 16-31 + echo "pca9535 0x23" > /sys/bus/i2c/devices/i2c-6/new_device + #for i in {112..127}; + for((i=${GPIO_OFFSET}+112;i<=${GPIO_OFFSET}+127;i++)); + do + echo $i > /sys/class/gpio/export + echo 1 > /sys/class/gpio/gpio${i}/active_low + echo low > /sys/class/gpio/gpio${i}/direction + #echo out > /sys/class/gpio/gpio${i}/direction + #echo 0 > /sys/class/gpio/gpio${i}/value + done + + #PSU I/O on Dummy Board 0x25 + echo "pca9535 0x25" > /sys/bus/i2c/devices/i2c-0/new_device + #for i in {96..111}; + for((i=${GPIO_OFFSET}+96;i<=${GPIO_OFFSET}+111;i++)); + do + echo $i > /sys/class/gpio/export + case ${i} in + #97|98|100|101|102|105|106|108) + $((${GPIO_OFFSET}+97)) | \ + $((${GPIO_OFFSET}+98)) | \ + $((${GPIO_OFFSET}+100)) | \ + $((${GPIO_OFFSET}+101)) | \ + $((${GPIO_OFFSET}+102)) | \ + $((${GPIO_OFFSET}+105)) | \ + $((${GPIO_OFFSET}+106)) | \ + $((${GPIO_OFFSET}+108)) ) + echo 1 > /sys/class/gpio/gpio${i}/active_low + ;; + #98|101|106|107|108) + $((${GPIO_OFFSET}+98)) | \ + $((${GPIO_OFFSET}+101)) | \ + $((${GPIO_OFFSET}+106)) | \ + $((${GPIO_OFFSET}+107)) | \ + $((${GPIO_OFFSET}+108)) ) + echo out > /sys/class/gpio/gpio${i}/direction + ;; + esac + done +} + +#IO Expander Init +function _i2c_io_exp_init { + # Reset BMC Dummy Board + i2cset -y -r 0 0x26 4 0x00 + i2cset -y -r 0 0x26 5 0x00 + i2cset -y -r 0 0x26 2 0x3F + i2cset -y -r 0 0x26 3 0x1F + i2cset -y -r 0 0x26 6 0xC0 + i2cset -y -r 0 0x26 7 0x00 + + # CPU Board + i2cset -y -r 0 0x77 6 0xFF + i2cset -y -r 0 0x77 7 0xFF + + # init SMBUS1 ABS + i2cset -y -r 5 0x20 4 0x00 + i2cset -y -r 5 0x20 5 0x00 + i2cset -y -r 5 0x20 6 0xFF + i2cset -y -r 5 0x20 7 0xFF + + i2cset -y -r 5 0x21 4 0x00 + i2cset -y -r 5 0x21 5 0x00 + i2cset -y -r 5 0x21 6 0xFF + i2cset -y -r 5 0x21 7 0xFF + + i2cset -y -r 5 0x22 4 0x00 + i2cset -y -r 5 0x22 5 0x00 + i2cset -y -r 5 0x22 6 0xFF + i2cset -y -r 5 0x22 7 0xFF + + i2cset -y -r 5 0x23 4 0x00 + i2cset -y -r 5 0x23 5 0x00 + i2cset -y -r 5 0x23 2 0xCF + i2cset -y -r 5 0x23 3 0xF0 + i2cset -y -r 5 0x23 6 0xCF + i2cset -y -r 5 0x23 7 0xF0 + + # init SFP + i2cset -y -r 5 0x27 4 0x00 + i2cset -y -r 5 0x27 5 0x00 + i2cset -y -r 5 0x27 2 0x00 + i2cset -y -r 5 0x27 3 0x00 + i2cset -y -r 5 0x27 6 0xCF + i2cset -y -r 5 0x27 7 0xF0 + + # set ZQSFP LP_MODE = 0 + i2cset -y -r 6 0x20 4 0x00 + i2cset -y -r 6 0x20 5 0x00 + i2cset -y -r 6 0x20 2 0x00 + i2cset -y -r 6 0x20 3 0x00 + i2cset -y -r 6 0x20 6 0x00 + i2cset -y -r 6 0x20 7 0x00 + + i2cset -y -r 6 0x21 4 0x00 + i2cset -y -r 6 0x21 5 0x00 + i2cset -y -r 6 0x21 2 0x00 + i2cset -y -r 6 0x21 3 0x00 + i2cset -y -r 6 0x21 6 0x00 + i2cset -y -r 6 0x21 7 0x00 + + # set ZQSFP RST = 1 + i2cset -y -r 6 0x22 4 0x00 + i2cset -y -r 6 0x22 5 0x00 + i2cset -y -r 6 0x22 2 0xFF + i2cset -y -r 6 0x22 3 0xFF + i2cset -y -r 6 0x22 6 0x00 + i2cset -y -r 6 0x22 7 0x00 + + i2cset -y -r 6 0x23 4 0x00 + i2cset -y -r 6 0x23 5 0x00 + i2cset -y -r 6 0x23 2 0xFF + i2cset -y -r 6 0x23 3 0xFF + i2cset -y -r 6 0x23 6 0x00 + i2cset -y -r 6 0x23 7 0x00 + + # init Host GPIO + i2cset -y -r 0 0x74 4 0x00 + i2cset -y -r 0 0x74 5 0x00 + i2cset -y -r 0 0x74 2 0x0F + i2cset -y -r 0 0x74 3 0xDF + i2cset -y -r 0 0x74 6 0x08 + i2cset -y -r 0 0x74 7 0x1F + + # init Board ID + i2cset -y -r 51 0x27 4 0x00 + i2cset -y -r 51 0x27 5 0x00 + i2cset -y -r 51 0x27 6 0xFF + i2cset -y -r 51 0x27 7 0xFF + + # init Board ID of Dummy BMC Board + i2cset -y -r 0 0x24 4 0x00 + i2cset -y -r 0 0x24 5 0x00 + i2cset -y -r 0 0x24 6 0xFF + i2cset -y -r 0 0x24 7 0xFF + + # init PSU I/O (BAREFOOT_IO_EXP_PSU_ID) + i2cset -y -r 0 0x25 4 0x00 + i2cset -y -r 0 0x25 5 0x00 + i2cset -y -r 0 0x25 2 0x00 + i2cset -y -r 0 0x25 3 0x1D + i2cset -y -r 0 0x25 6 0xDB + i2cset -y -r 0 0x25 7 0x03 + + # init FAN I/O (BAREFOOT_IO_EXP_FAN_ID) + i2cset -y -r 59 0x20 4 0x00 + i2cset -y -r 59 0x20 5 0x00 + i2cset -y -r 59 0x20 2 0x11 + i2cset -y -r 59 0x20 3 0x11 + i2cset -y -r 59 0x20 6 0xCC + i2cset -y -r 59 0x20 7 0xCC + + # init Fan + # select bank 0 + i2cset -y -r 56 0x2F 0x00 0x80 + + # enable FANIN 1-8 + i2cset -y -r 56 0x2F 0x06 0xFF + + # disable FANIN 9-14 + i2cset -y -r 56 0x2F 0x07 0x00 + + # select bank 2 + i2cset -y -r 56 0x2F 0x00 0x82 + + # set PWM mode in FOMC + i2cset -y -r 56 0x2F 0x0F 0x00 + + # init VOLMON + i2cset -y -r 56 0x2F 0x00 0x80 + i2cset -y -r 56 0x2F 0x01 0x1C + i2cset -y -r 56 0x2F 0x00 0x80 + i2cset -y -r 56 0x2F 0x02 0xFF + i2cset -y -r 56 0x2F 0x03 0x50 + i2cset -y -r 56 0x2F 0x04 0x0A + i2cset -y -r 56 0x2F 0x00 0x80 + i2cset -y -r 56 0x2F 0x01 0x1D +} + +function mac_vdd_init { + # read mac vid register value from CPLD + val=`i2cget -y 44 0x33 0x42 2>/dev/null` + + # get vid form register value [0:2] + vid=$(($val & 0x7)) + + # get rov val and reg according to vid + rov_val=${rov_val_array[$vid]} + rov_reg=${rov_reg_array[$vid]} + echo "vid=${vid}, rov_val=${rov_val}, rov_reg=${rov_reg}" + + # write the rov reg to rov + i2cset -y -r 8 0x22 0x21 ${rov_reg} w + + if [ $? -eq 0 ]; then + echo "set ROV for mac vdd done" + else + echo "set ROV for mac vdd fail" + fi +} + +rmmod i2c_i801 +modprobe i2c_i801 +modprobe i2c_dev +modprobe i2c_mux_pca954x + +echo 'pca9548 0x70' > /sys/bus/i2c/devices/i2c-0/new_device +#todo: switch to channels +echo 'pca9548 0x71' > /sys/bus/i2c/devices/i2c-1/new_device +echo 'pca9548 0x71' > /sys/bus/i2c/devices/i2c-2/new_device +echo 'pca9548 0x71' > /sys/bus/i2c/devices/i2c-3/new_device +echo 'pca9548 0x71' > /sys/bus/i2c/devices/i2c-4/new_device +echo 'pca9548 0x71' > /sys/bus/i2c/devices/i2c-7/new_device +echo 'pca9548 0x76' > /sys/bus/i2c/devices/i2c-0/new_device +echo 'pca9545 0x72' > /sys/bus/i2c/devices/i2c-0/new_device + + +echo '-2' > /sys/bus/i2c/devices/0-0070/idle_state +echo '-2' > /sys/bus/i2c/devices/1-0071/idle_state +echo '-2' > /sys/bus/i2c/devices/2-0071/idle_state +echo '-2' > /sys/bus/i2c/devices/3-0071/idle_state +echo '-2' > /sys/bus/i2c/devices/4-0071/idle_state +echo '-2' > /sys/bus/i2c/devices/7-0071/idle_state +echo '-2' > /sys/bus/i2c/devices/0-0076/idle_state +echo '-2' > /sys/bus/i2c/devices/0-0072/idle_state + + + +# i2cget -y 44 0x74 2 + +_i2c_io_exp_init + +echo 'w83795adg 0x2F' > /sys/bus/i2c/devices/i2c-56/new_device + +sleep 1 + +echo 120 > /sys/class/hwmon/hwmon1/device/pwm1 +echo 120 > /sys/class/hwmon/hwmon1/device/pwm2 + +#TMP75 Init +echo "lm86 0x4c" > /sys/bus/i2c/devices/i2c-53/new_device # ASIC Coretemp and Front MAC +echo "tmp75 0x4f" > /sys/bus/i2c/devices/i2c-0/new_device #CPU Board +echo "tmp75 0x48" > /sys/bus/i2c/devices/i2c-53/new_device # Near PSU1 +echo "tmp75 0x4a" > /sys/bus/i2c/devices/i2c-53/new_device # Rear MAC +echo "tmp75 0x4b" > /sys/bus/i2c/devices/i2c-53/new_device # Near Port 32 +echo "tmp75 0x4d" > /sys/bus/i2c/devices/i2c-53/new_device # Near PSU2 + + + +rmmod gpio-pca953x +rmmod gpio_ich + +modprobe gpio-pca953x +sleep 1 + +i2c_gpio_init + +modprobe at24 + +#Init MB EEPROM +echo "24c32 0x55" > /sys/bus/i2c/devices/i2c-0/new_device + +# modprobe eeprom +# PS EEPROM +echo "spd 0x50" > /sys/bus/i2c/devices/i2c-58/new_device #PS0 +echo "spd 0x50" > /sys/bus/i2c/devices/i2c-57/new_device #PS1 + +#modprobe pmbus + +# PS PMBUS +echo "pmbus 0x58" > /sys/bus/i2c/devices/i2c-58/new_device #PS0 +echo "pmbus 0x58" > /sys/bus/i2c/devices/i2c-57/new_device #PS1 + +#QSFP EEPROM +modprobe optoe +for i in {9..40}; +do + echo "optoe1 0x50" > /sys/bus/i2c/devices/i2c-$i/new_device +done + +# init SFP0/1 EEPROM +echo "optoe2 0x50" > /sys/bus/i2c/devices/i2c-45/new_device +echo "optoe2 0x50" > /sys/bus/i2c/devices/i2c-46/new_device + +mac_vdd_init + diff --git a/platform/barefoot/sonic-platform-modules-netberg/debian/changelog b/platform/barefoot/sonic-platform-modules-netberg/debian/changelog index 9948453bcf78..f88da8ffc3d4 100644 --- a/platform/barefoot/sonic-platform-modules-netberg/debian/changelog +++ b/platform/barefoot/sonic-platform-modules-netberg/debian/changelog @@ -1,12 +1,17 @@ +platform-driver (1.1.1) unstable; urgency=low + + * Add support for Aurora 710 + + -- developer Fri, 26 Aug 2022 11:00:00 +0800 + platform-driver (1.1.0) unstable; urgency=low * Add support for Aurora 610 - -- developer Fri, 26 May 2017 11:00:00 +0800 + -- developer Fri, 26 May 2022 11:00:00 +0800 platform-driver (1.0.0) unstable; urgency=low * Initial commit -- developer Wed, 05 Oct 2016 16:30:45 +0800 - diff --git a/platform/barefoot/sonic-platform-modules-netberg/debian/control b/platform/barefoot/sonic-platform-modules-netberg/debian/control index fb1fb68f6e49..5a25891f69de 100644 --- a/platform/barefoot/sonic-platform-modules-netberg/debian/control +++ b/platform/barefoot/sonic-platform-modules-netberg/debian/control @@ -5,7 +5,10 @@ Maintainer: Netberg Build-Depends: debhelper (>= 9) Standards-Version: 1.0.0 +Package: sonic-platform-netberg-aurora-710 +Architecture: amd64 +Description: This package contains Aurora 710 platform driver utility for SONiC project. + Package: sonic-platform-netberg-aurora-610 Architecture: amd64 Description: This package contains Aurora 610 platform driver utility for SONiC project. - diff --git a/platform/barefoot/sonic-platform-modules-netberg/debian/rules b/platform/barefoot/sonic-platform-modules-netberg/debian/rules index 99c1bcc408cd..1806928f393c 100755 --- a/platform/barefoot/sonic-platform-modules-netberg/debian/rules +++ b/platform/barefoot/sonic-platform-modules-netberg/debian/rules @@ -8,7 +8,7 @@ PACKAGE_PRE_NAME := sonic-platform-netberg KVERSION ?= $(shell uname -r) KERNEL_SRC := /lib/modules/$(KVERSION) MOD_SRC_DIR:= $(shell pwd) -MODULE_DIRS:= aurora-610 +MODULE_DIRS:= aurora-610 aurora-710 MODULE_DIR := modules UTILS_DIR := utils SERVICE_DIR := service @@ -31,6 +31,9 @@ override_dh_auto_install: $(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ cp $(MOD_SRC_DIR)/$${mod}/$(MODULE_DIR)/*.ko \ debian/$(PACKAGE_PRE_NAME)-$${mod}/$(KERNEL_SRC)/$(INSTALL_MOD_DIR); \ + dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} usr/sbin; \ + cp $(MOD_SRC_DIR)/$${mod}/$(UTILS_DIR)/*.sh \ + debian/$(PACKAGE_PRE_NAME)-$${mod}/usr/sbin; \ dh_installdirs -p$(PACKAGE_PRE_NAME)-$${mod} lib/systemd/system; \ cp $(MOD_SRC_DIR)/$${mod}/$(SERVICE_DIR)/*.service \ debian/$(PACKAGE_PRE_NAME)-$${mod}/lib/systemd/system; \ diff --git a/platform/barefoot/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-710.init b/platform/barefoot/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-710.init new file mode 100644 index 000000000000..973490cc96e0 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-710.init @@ -0,0 +1,40 @@ +#!/bin/bash + +### BEGIN INIT INFO +# Provides: setup-board +# Required-Start: +# Required-Stop: +# Should-Start: +# Should-Stop: +# Default-Start: S +# Default-Stop: 0 6 +# Short-Description: Setup Aurora-710 board. +### END INIT INFO + +case "$1" in +start) + echo -n "Setting up board... " + + depmod -a + i2c_init.sh + + echo "done." + ;; + +stop) + + echo "done." + + ;; + +force-reload|restart) + echo "Not supported" + ;; + +*) + echo "Usage: /etc/init.d/sonic-platform-netberg-aurora-710.init {start|stop}" + exit 1 + ;; +esac + +exit 0 diff --git a/platform/barefoot/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-710.install b/platform/barefoot/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-710.install new file mode 100644 index 000000000000..e3d68e37d1f6 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-710.install @@ -0,0 +1 @@ +aurora-710/modules/sonic_platform-1.0-py3-none-any.whl usr/share/sonic/device/x86_64-netberg_aurora_710-r0 diff --git a/platform/barefoot/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-710.postinst b/platform/barefoot/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-710.postinst new file mode 100755 index 000000000000..dba1e5e12013 --- /dev/null +++ b/platform/barefoot/sonic-platform-modules-netberg/debian/sonic-platform-netberg-aurora-710.postinst @@ -0,0 +1,9 @@ +#!/bin/sh +set -e + +PLATFORM_NAME=x86_64-netberg_aurora_710-r0 +SONIC_PLATFORM_WHEEL_PY3="/usr/share/sonic/device/${PLATFORM_NAME}/sonic_platform-1.0-py3-none-any.whl" +python3 -m pip install ${SONIC_PLATFORM_WHEEL_PY3} + +#DEBHELPER# + diff --git a/platform/broadcom/sonic-platform-modules-nokia b/platform/broadcom/sonic-platform-modules-nokia index b027ce0fbccc..c976714e3f39 160000 --- a/platform/broadcom/sonic-platform-modules-nokia +++ b/platform/broadcom/sonic-platform-modules-nokia @@ -1 +1 @@ -Subproject commit b027ce0fbcccaff92d42ef05c05e87922f9161ba +Subproject commit c976714e3f39fc22b5c616ae0f4aadbd2bd4360f diff --git a/platform/mellanox/nv-syncd-shared/nv-syncd-shared.service b/platform/mellanox/nv-syncd-shared/nv-syncd-shared.service new file mode 100644 index 000000000000..a298b4fae926 --- /dev/null +++ b/platform/mellanox/nv-syncd-shared/nv-syncd-shared.service @@ -0,0 +1,17 @@ +[Unit] +Description=Manage Nvidia specific syncd shared volume +Requires=docker.service +After=docker.service +BindsTo=sonic.target +After=sonic.target +PartOf=syncd.service + +[Service] +Type=oneshot +RemainAfterExit=yes +ExecStart=rm -rf /tmp/nv-syncd-shared/ +ExecStart=mkdir -p /tmp/nv-syncd-shared/ + +[Install] +WantedBy=sonic.target + diff --git a/src/sonic-config-engine/tests/test_cfggen_from_yang.py b/src/sonic-config-engine/tests/test_cfggen_from_yang.py index 4f4cdb841465..5886b2cc882f 100644 --- a/src/sonic-config-engine/tests/test_cfggen_from_yang.py +++ b/src/sonic-config-engine/tests/test_cfggen_from_yang.py @@ -276,3 +276,14 @@ def test_fabric_monitor_data_table(self): "monPollThreshRecovery": "8" } }) + + def test_fabric_port_table(self): + arg = ["--var-json", "FABRIC_PORT"] + output = json.loads(self.run_script_with_yang_arg(arg)) + assert(output == {\ + "Fabric0": { + "alias": "Fabric0", + "isolateStatus": "False", + "lanes": "0" + } + }) diff --git a/src/sonic-config-engine/tests/test_yang_data.json b/src/sonic-config-engine/tests/test_yang_data.json index 51a1c6a94590..41aab043d4be 100644 --- a/src/sonic-config-engine/tests/test_yang_data.json +++ b/src/sonic-config-engine/tests/test_yang_data.json @@ -388,5 +388,17 @@ "monPollThreshRecovery": "8" } } + }, + "sonic-fabric-port:sonic-fabric-port": { + "sonic-fabric-port:FABRIC_PORT": { + "FABRIC_PORT_LIST": [ + { + "name": "Fabric0", + "alias": "Fabric0", + "isolateStatus": "False", + "lanes": "0" + } + ] + } } } diff --git a/src/sonic-host-services b/src/sonic-host-services index eab4a9ee30be..bc08806b6400 160000 --- a/src/sonic-host-services +++ b/src/sonic-host-services @@ -1 +1 @@ -Subproject commit eab4a9ee30be81da70d38f1320c37caef261e7e3 +Subproject commit bc08806b64002c506b8401eae5d9e1c760651e49 diff --git a/src/sonic-platform-common b/src/sonic-platform-common index 4d270f07e040..10af810fa1d4 160000 --- a/src/sonic-platform-common +++ b/src/sonic-platform-common @@ -1 +1 @@ -Subproject commit 4d270f07e040e35b7fc90be6e38bd5feb6e163ed +Subproject commit 10af810fa1d40347ab8556e79374e6c94a99a22d diff --git a/src/sonic-restapi b/src/sonic-restapi index 1c50caaeda51..a69ba06560eb 160000 --- a/src/sonic-restapi +++ b/src/sonic-restapi @@ -1 +1 @@ -Subproject commit 1c50caaeda51081e44789ddd5527e01c9e02bf9e +Subproject commit a69ba06560eb9d2a9b5ace43e22e9665fa986d33 diff --git a/src/sonic-swss b/src/sonic-swss index a67f684f448d..ffce92658da0 160000 --- a/src/sonic-swss +++ b/src/sonic-swss @@ -1 +1 @@ -Subproject commit a67f684f448d45c5b6c4a7be6ccd4218d0ccd57e +Subproject commit ffce92658da01e8a8f613dc1d89f9b439509d1be diff --git a/src/sonic-swss-common b/src/sonic-swss-common index d6453bcb372b..dffd76a857e7 160000 --- a/src/sonic-swss-common +++ b/src/sonic-swss-common @@ -1 +1 @@ -Subproject commit d6453bcb372b2fc93995ef6ccf5a40f0638506a8 +Subproject commit dffd76a857e74321917080d75e62568ff3a480e3 diff --git a/src/sonic-yang-models/doc/Configuration.md b/src/sonic-yang-models/doc/Configuration.md index 3590adea6b98..ab633a715850 100644 --- a/src/sonic-yang-models/doc/Configuration.md +++ b/src/sonic-yang-models/doc/Configuration.md @@ -34,6 +34,7 @@ Table of Contents * [FG_NHG_MEMBER](#fg_nhg_member) * [FG_NHG_PREFIX](#fg_nhg_prefix) * [FABRIC_MONITOR](#fabric-monitor) + * [FABRIC_PORT](#fabric-port) * [FLEX_COUNTER_TABLE](#flex_counter_table) * [Hash](#hash) * [IPv6 Link-local] (#ipv6-link-local) @@ -1063,6 +1064,24 @@ The FG_NHG_PREFIX table provides the FG_NHG_PREFIX for which FG behavior is desi ``` +### FABRIC_PORT +``` +{ +"FABRIC_PORT": { + "Fabric0": { + "alias": "Fabric0", + "isolateStatus": "False", + "lanes": "0" + }, + "Fabric1": { + "alias": "Fabric1", + "isolateStatus": "False", + "lanes": "1" + } + } +} + +``` ### MPLS_TC_TO_TC_MAP ``` diff --git a/src/sonic-yang-models/setup.py b/src/sonic-yang-models/setup.py index d6aeb3e0d88e..b4bdc2da47f0 100644 --- a/src/sonic-yang-models/setup.py +++ b/src/sonic-yang-models/setup.py @@ -117,6 +117,7 @@ def run(self): './yang-models/sonic-events-syncd.yang', './yang-models/sonic-extension.yang', './yang-models/sonic-fabric-monitor.yang', + './yang-models/sonic-fabric-port.yang', './yang-models/sonic-flex_counter.yang', './yang-models/sonic-fine-grained-ecmp.yang', './yang-models/sonic-feature.yang', @@ -209,6 +210,7 @@ def run(self): './cvlyang-models/sonic-device_neighbor_metadata.yang', './cvlyang-models/sonic-extension.yang', './cvlyang-models/sonic-fabric-monitor.yang', + './cvlyang-models/sonic-fabric-port.yang', './cvlyang-models/sonic-flex_counter.yang', './cvlyang-models/sonic-feature.yang', './cvlyang-models/sonic-fine-grained-ecmp.yang', diff --git a/src/sonic-yang-models/tests/files/sample_config_db.json b/src/sonic-yang-models/tests/files/sample_config_db.json index 37a8e024e4d4..2de693e58579 100644 --- a/src/sonic-yang-models/tests/files/sample_config_db.json +++ b/src/sonic-yang-models/tests/files/sample_config_db.json @@ -1273,6 +1273,18 @@ "monPollThreshRecovery": "8" } }, + "FABRIC_PORT": { + "Fabric0": { + "alias": "Fabric0", + "isolateStatus": "False", + "lanes": "0" + }, + "Fabric1": { + "alias": "Fabric1", + "isolateStatus": "False", + "lanes": "1" + } + }, "FLEX_COUNTER_TABLE": { "PFCWD": { "FLEX_COUNTER_STATUS": "enable" diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests/fabric_port.json b/src/sonic-yang-models/tests/yang_model_tests/tests/fabric_port.json new file mode 100644 index 000000000000..8c8db3ca1655 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests/fabric_port.json @@ -0,0 +1,5 @@ +{ + "FABRIC_PORT_POSITIVE_CONFIG": { + "desc": "Configure FABRIC_PORT no failure." + } +} diff --git a/src/sonic-yang-models/tests/yang_model_tests/tests_config/fabric_port.json b/src/sonic-yang-models/tests/yang_model_tests/tests_config/fabric_port.json new file mode 100644 index 000000000000..278834826120 --- /dev/null +++ b/src/sonic-yang-models/tests/yang_model_tests/tests_config/fabric_port.json @@ -0,0 +1,16 @@ +{ + "FABRIC_PORT_POSITIVE_CONFIG": { + "sonic-fabric-port:sonic-fabric-port": { + "sonic-fabric-port:FABRIC_PORT": { + "FABRIC_PORT_LIST": [ + { + "name": "Fabric0", + "alias": "Fabric0", + "isolateStatus": "False", + "lanes": "0" + } + ] + } + } + } +} diff --git a/src/sonic-yang-models/yang-models/sonic-fabric-port.yang b/src/sonic-yang-models/yang-models/sonic-fabric-port.yang new file mode 100644 index 000000000000..f2266507deef --- /dev/null +++ b/src/sonic-yang-models/yang-models/sonic-fabric-port.yang @@ -0,0 +1,61 @@ +module sonic-fabric-port{ + + yang-version 1.1; + + namespace "http://github.com/sonic-net/sonic-fabric-port"; + prefix fabric-port; + + import sonic-types { + prefix stypes; + } + + description "FABRIC_PORT yang Module for SONiC OS"; + + revision 2023-03-14 { + description "First Revision"; + } + + container sonic-fabric-port { + + container FABRIC_PORT { + + description "FABRIC_PORT part of config_db.json"; + + list FABRIC_PORT_LIST { + + key "name"; + + leaf name { + type string { + length 1..128; + } + } + + leaf isolateStatus { + description "Isolation status of a fabric port"; + type stypes:boolean_type; + default "False"; + } + + leaf alias { + description "Alias of a fabric port"; + type string { + length 1..128; + } + } + + leaf lanes { + description "Lanes of a fabric port"; + mandatory true; + type string { + length 1..128; + } + } + + } /* end of list FABRIC_PORT_LIST */ + + } /* end of container FABRIC_PORT */ + + } /* end of container sonic-fabric-port */ + +} /* end of module sonic-fabric-port */