Merge branch 'master' into platform2.0
This commit is contained in:
commit
1cbc99d99e
@ -126,7 +126,7 @@ ifneq (,$(filter $(CONFIGURED_ARCH), armhf arm64))
|
||||
|
||||
DOCKER_MULTIARCH_CHECK := docker inspect --type image multiarch/qemu-user-static:register &> /dev/null || (echo "multiarch docker not found ..."; docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes)
|
||||
|
||||
DOCKER_SERVICE_MULTIARCH_CHECK := docker -H unix:///var/run/march/docker.sock info &> /dev/null || (echo "Docker march service not running..."; sudo rm -fr /var/run/march/docker*; (sudo $(SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH) &) &>/dev/null ; sleep 1; sudo $(SONIC_USERFACL_DOCKERD_FOR_MUTLIARCH);)
|
||||
DOCKER_SERVICE_MULTIARCH_CHECK := docker -H unix:///var/run/march/docker.sock info &> /dev/null || (echo "Docker march service not running..."; sudo rm -fr /var/run/march/*; (sudo $(SONIC_NATIVE_DOCKERD_FOR_MUTLIARCH) &) &>/dev/null ; sleep 1; sudo $(SONIC_USERFACL_DOCKERD_FOR_MUTLIARCH);)
|
||||
|
||||
# Docker service to load the compiled dockers-*.gz
|
||||
SONIC_NATIVE_DOCKERD_FOR_DOCKERFS := rm -fr $(PWD)/dockerfs/; mkdir -p $(PWD)/dockerfs/; sudo dockerd --storage-driver=overlay2 --iptables=false \
|
||||
|
12
README.md
12
README.md
@ -88,15 +88,23 @@ To build SONiC installer image and docker images, run the following commands:
|
||||
|
||||
## Usage for ARM Architecture
|
||||
To build Arm32 bit for (ARMHF) plaform
|
||||
ARM build has dependency in docker version 18,
|
||||
if docker version is 19, downgrade to 18 as below
|
||||
sudo apt-get install --allow-downgrades -y docker-ce=5:18.09.0~3-0~ubuntu-xenial
|
||||
sudo apt-get install --allow-downgrades -y docker-ce-cli=5:18.09.0~3-0~ubuntu-xenial
|
||||
|
||||
# Execute make configure once to configure ASIC and ARCH
|
||||
|
||||
make configure PLATFORM=[ASIC_VENDOR] PLATFORM_ARCH=armhf
|
||||
|
||||
**example**:
|
||||
make target/sonic-[ASIC_VENDER]-armhf.bin
|
||||
|
||||
# example:
|
||||
|
||||
make configure PLATFORM=marvell-armhf PLATFORM_ARCH=armhf
|
||||
|
||||
make target/sonic-marvell-armhf.bin
|
||||
|
||||
|
||||
|
||||
To build Arm64 bit for plaform
|
||||
@ -105,7 +113,7 @@ To build Arm64 bit for plaform
|
||||
|
||||
make configure PLATFORM=[ASIC_VENDOR] PLATFORM_ARCH=arm64
|
||||
|
||||
**example**:
|
||||
# example:
|
||||
|
||||
make configure PLATFORM=marvell-arm64 PLATFORM_ARCH=arm64
|
||||
|
||||
|
@ -342,31 +342,8 @@ sudo sed -i 's/^ListenAddress ::/#ListenAddress ::/' $FILESYSTEM_ROOT/etc/ssh/ss
|
||||
sudo sed -i 's/^#ListenAddress 0.0.0.0/ListenAddress 0.0.0.0/' $FILESYSTEM_ROOT/etc/ssh/sshd_config
|
||||
|
||||
## Config monit
|
||||
sudo sed -i '
|
||||
s/^# set logfile syslog/set logfile syslog/;
|
||||
s/^\s*set logfile \/var/# set logfile \/var/;
|
||||
s/^# set httpd port/set httpd port/;
|
||||
s/^# use address localhost/ use address localhost/;
|
||||
s/^# allow localhost/ allow localhost/;
|
||||
s/^# allow admin:monit/ allow admin:monit/;
|
||||
s/^# allow @monit/ allow @monit/;
|
||||
s/^# allow @users readonly/ allow @users readonly/
|
||||
' $FILESYSTEM_ROOT/etc/monit/monitrc
|
||||
|
||||
sudo tee -a $FILESYSTEM_ROOT/etc/monit/monitrc > /dev/null <<'EOF'
|
||||
check filesystem root-overlay with path /
|
||||
if space usage > 90% for 5 times within 10 cycles then alert
|
||||
check filesystem var-log with path /var/log
|
||||
if space usage > 90% for 5 times within 10 cycles then alert
|
||||
check system $HOST
|
||||
if memory usage > 50% for 5 times within 10 cycles then alert
|
||||
if cpu usage (user) > 90% for 5 times within 10 cycles then alert
|
||||
if cpu usage (system) > 90% for 5 times within 10 cycles then alert
|
||||
check process rsyslog with pidfile /var/run/rsyslogd.pid
|
||||
start program = "/bin/systemctl start rsyslog.service"
|
||||
stop program = "/bin/systemctl stop rsyslog.service"
|
||||
if totalmem > 800 MB for 5 times within 10 cycles then restart
|
||||
EOF
|
||||
sudo cp files/image_config/monit/monitrc $FILESYSTEM_ROOT/etc/monit/
|
||||
sudo chmod 600 $FILESYSTEM_ROOT/etc/monit/monitrc
|
||||
|
||||
## Config sysctl
|
||||
sudo mkdir -p $FILESYSTEM_ROOT/var/core
|
||||
@ -463,6 +440,9 @@ build_number: ${BUILD_NUMBER:-0}
|
||||
built_by: $USER@$BUILD_HOSTNAME
|
||||
EOF
|
||||
|
||||
## Copy over clean-up script
|
||||
sudo cp ./files/scripts/core_cleanup.py $FILESYSTEM_ROOT/usr/bin/core_cleanup.py
|
||||
|
||||
## Copy ASIC config checksum
|
||||
python files/build_scripts/generate_asic_config_checksum.py
|
||||
if [[ ! -f './asic_config_checksum' ]]; then
|
||||
|
@ -0,0 +1,2 @@
|
||||
{%- set default_topo = 't0' %}
|
||||
{%- include 'buffers_config.j2' %}
|
@ -0,0 +1,54 @@
|
||||
{%- set default_cable = '5m' %}
|
||||
|
||||
{%- macro generate_port_lists(PORT_ALL) %}
|
||||
{# Generate list of ports #}
|
||||
{%- for port_idx in range(0,12) %}
|
||||
{%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %}
|
||||
{%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- for port_idx in range(20,64) %}
|
||||
{%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %}
|
||||
{%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4 + 2)) %}{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- for port_idx in range(12,20) %}
|
||||
{%- if PORT_ALL.append("Ethernet%d" % (port_idx * 4)) %}{%- endif %}
|
||||
{%- endfor %}
|
||||
{%- endmacro %}
|
||||
|
||||
{%- macro generate_buffer_pool_and_profiles() %}
|
||||
"BUFFER_POOL": {
|
||||
"ingress_lossless_pool": {
|
||||
"size": "33096128",
|
||||
"type": "ingress",
|
||||
"mode": "dynamic",
|
||||
"xoff": "9098752"
|
||||
},
|
||||
"egress_lossy_pool": {
|
||||
"size": "28132416",
|
||||
"type": "egress",
|
||||
"mode": "dynamic"
|
||||
},
|
||||
"egress_lossless_pool": {
|
||||
"size": "43108416",
|
||||
"type": "egress",
|
||||
"mode": "static"
|
||||
}
|
||||
},
|
||||
"BUFFER_PROFILE": {
|
||||
"ingress_lossy_profile": {
|
||||
"pool":"[BUFFER_POOL|ingress_lossless_pool]",
|
||||
"size":"0",
|
||||
"dynamic_th":"3"
|
||||
},
|
||||
"egress_lossless_profile": {
|
||||
"pool":"[BUFFER_POOL|egress_lossless_pool]",
|
||||
"size":"1518",
|
||||
"static_th":"10777104"
|
||||
},
|
||||
"egress_lossy_profile": {
|
||||
"pool":"[BUFFER_POOL|egress_lossy_pool]",
|
||||
"size":"1518",
|
||||
"dynamic_th":"3"
|
||||
}
|
||||
},
|
||||
{%- endmacro %}
|
@ -0,0 +1,111 @@
|
||||
# LED microprocessor initialization for DellEMC-Z9264f
|
||||
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=32 REMAP_PORT_2=33 REMAP_PORT_1=34 REMAP_PORT_0=35
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=36 REMAP_PORT_6=37 REMAP_PORT_5=38 REMAP_PORT_4=39
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=4 REMAP_PORT_10=5 REMAP_PORT_9=6 REMAP_PORT_8=7
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=0 REMAP_PORT_14=1 REMAP_PORT_13=2 REMAP_PORT_12=3
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=56 REMAP_PORT_18=57 REMAP_PORT_17=58 REMAP_PORT_16=59
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=60 REMAP_PORT_22=61 REMAP_PORT_21=62 REMAP_PORT_20=63
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=28 REMAP_PORT_26=29 REMAP_PORT_25=30 REMAP_PORT_24=31
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=24 REMAP_PORT_30=25 REMAP_PORT_29=26 REMAP_PORT_28=27
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=48 REMAP_PORT_34=49 REMAP_PORT_33=50 REMAP_PORT_32=51
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=52 REMAP_PORT_38=53 REMAP_PORT_37=54 REMAP_PORT_36=55
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=20 REMAP_PORT_42=21 REMAP_PORT_41=22 REMAP_PORT_40=23
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=16 REMAP_PORT_46=17 REMAP_PORT_45=18 REMAP_PORT_44=19
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=40 REMAP_PORT_50=41 REMAP_PORT_49=42 REMAP_PORT_48=43
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=44 REMAP_PORT_54=45 REMAP_PORT_53=46 REMAP_PORT_52=47
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=12 REMAP_PORT_58=13 REMAP_PORT_57=14 REMAP_PORT_56=15
|
||||
m CMIC_LEDUP0_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=8 REMAP_PORT_62=9 REMAP_PORT_61=10 REMAP_PORT_60=11
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=0 REMAP_PORT_2=1 REMAP_PORT_1=2 REMAP_PORT_0=3
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=4 REMAP_PORT_6=5 REMAP_PORT_5=6 REMAP_PORT_4=7
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_8_11 REMAP_PORT_9=38 REMAP_PORT_8=39 REMAP_PORT_11=36 REMAP_PORT_10=37
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=32 REMAP_PORT_14=33 REMAP_PORT_13=34 REMAP_PORT_12=35
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=8 REMAP_PORT_18=9 REMAP_PORT_17=10 REMAP_PORT_16=11
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=12 REMAP_PORT_22=13 REMAP_PORT_21=14 REMAP_PORT_20=15
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=44 REMAP_PORT_26=45 REMAP_PORT_25=46 REMAP_PORT_24=47
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=40 REMAP_PORT_30=41 REMAP_PORT_29=42 REMAP_PORT_28=43
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=16 REMAP_PORT_34=17 REMAP_PORT_33=18 REMAP_PORT_32=19
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=20 REMAP_PORT_38=21 REMAP_PORT_37=22 REMAP_PORT_36=23
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=52 REMAP_PORT_42=53 REMAP_PORT_41=54 REMAP_PORT_40=55
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=48 REMAP_PORT_46=49 REMAP_PORT_45=50 REMAP_PORT_44=51
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=24 REMAP_PORT_50=25 REMAP_PORT_49=26 REMAP_PORT_48=27
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=28 REMAP_PORT_54=29 REMAP_PORT_53=30 REMAP_PORT_52=31
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=60 REMAP_PORT_58=61 REMAP_PORT_57=62 REMAP_PORT_56=63
|
||||
m CMIC_LEDUP1_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=56 REMAP_PORT_62=57 REMAP_PORT_61=58 REMAP_PORT_60=59
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=60 REMAP_PORT_2=61 REMAP_PORT_1=62 REMAP_PORT_0=63
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=56 REMAP_PORT_6=57 REMAP_PORT_5=58 REMAP_PORT_4=59
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=24 REMAP_PORT_10=25 REMAP_PORT_9=26 REMAP_PORT_8=27
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=28 REMAP_PORT_14=29 REMAP_PORT_13=30 REMAP_PORT_12=31
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=52 REMAP_PORT_18=53 REMAP_PORT_17=54 REMAP_PORT_16=55
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=48 REMAP_PORT_22=49 REMAP_PORT_21=50 REMAP_PORT_20=51
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=16 REMAP_PORT_26=17 REMAP_PORT_25=18 REMAP_PORT_24=19
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=20 REMAP_PORT_30=21 REMAP_PORT_29=22 REMAP_PORT_28=23
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=44 REMAP_PORT_34=45 REMAP_PORT_33=46 REMAP_PORT_32=47
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=40 REMAP_PORT_38=41 REMAP_PORT_37=42 REMAP_PORT_36=43
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=8 REMAP_PORT_42=9 REMAP_PORT_41=10 REMAP_PORT_40=11
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=12 REMAP_PORT_46=13 REMAP_PORT_45=14 REMAP_PORT_44=15
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=36 REMAP_PORT_50=37 REMAP_PORT_49=38 REMAP_PORT_48=39
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=32 REMAP_PORT_54=33 REMAP_PORT_53=34 REMAP_PORT_52=35
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=0 REMAP_PORT_58=1 REMAP_PORT_57=2 REMAP_PORT_56=3
|
||||
m CMIC_LEDUP2_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=4 REMAP_PORT_62=5 REMAP_PORT_61=6 REMAP_PORT_60=7
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=28 REMAP_PORT_2=29 REMAP_PORT_1=30 REMAP_PORT_0=31
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_4_7 REMAP_PORT_7=24 REMAP_PORT_6=25 REMAP_PORT_5=26 REMAP_PORT_4=27
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_8_11 REMAP_PORT_11=56 REMAP_PORT_10=57 REMAP_PORT_9=58 REMAP_PORT_8=59
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_12_15 REMAP_PORT_15=60 REMAP_PORT_14=61 REMAP_PORT_13=62 REMAP_PORT_12=63
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_16_19 REMAP_PORT_19=4 REMAP_PORT_18=5 REMAP_PORT_17=6 REMAP_PORT_16=7
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_20_23 REMAP_PORT_23=0 REMAP_PORT_22=1 REMAP_PORT_21=2 REMAP_PORT_20=3
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_24_27 REMAP_PORT_27=32 REMAP_PORT_26=33 REMAP_PORT_25=34 REMAP_PORT_24=35
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_28_31 REMAP_PORT_31=36 REMAP_PORT_30=37 REMAP_PORT_29=38 REMAP_PORT_28=39
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_32_35 REMAP_PORT_35=12 REMAP_PORT_34=13 REMAP_PORT_33=14 REMAP_PORT_32=15
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_36_39 REMAP_PORT_39=8 REMAP_PORT_38=9 REMAP_PORT_37=10 REMAP_PORT_36=11
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_40_43 REMAP_PORT_43=40 REMAP_PORT_42=41 REMAP_PORT_41=42 REMAP_PORT_40=43
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_44_47 REMAP_PORT_47=44 REMAP_PORT_46=45 REMAP_PORT_45=46 REMAP_PORT_44=47
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_48_51 REMAP_PORT_51=20 REMAP_PORT_50=21 REMAP_PORT_49=22 REMAP_PORT_48=23
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_52_55 REMAP_PORT_55=16 REMAP_PORT_54=17 REMAP_PORT_53=18 REMAP_PORT_52=19
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_56_59 REMAP_PORT_59=48 REMAP_PORT_58=49 REMAP_PORT_57=50 REMAP_PORT_56=51
|
||||
m CMIC_LEDUP3_PORT_ORDER_REMAP_60_63 REMAP_PORT_63=52 REMAP_PORT_62=53 REMAP_PORT_61=54 REMAP_PORT_60=55
|
||||
m CMIC_LEDUP4_PORT_ORDER_REMAP_0_3 REMAP_PORT_3=1 REMAP_PORT_1=0
|
||||
|
||||
led 0 stop
|
||||
led 0 prog \
|
||||
02 00 60 FE 2E FE 67 1C 86 FE 06 FE D2 40 71 04 \
|
||||
12 FF 85 05 D2 05 71 1A 52 00 3A 80 32 08 97 71 \
|
||||
23 77 4B 32 00 32 01 B7 97 75 32 12 BC FE FE 02 \
|
||||
0A 50 12 BC FE FE 95 75 3C 85 77 44 16 FF DA 02 \
|
||||
71 4B 77 44 22 0F 87 22 0E 87 57 22 0E 87 22 0E \
|
||||
87 57 22 0E 87 22 0F 87 57 00 00 00 00 00 00 00
|
||||
led 0 auto on
|
||||
led 0 start
|
||||
|
||||
led 1 stop
|
||||
led 1 prog \
|
||||
02 00 60 FE 2E FE 67 1C 86 FE 06 FE D2 40 71 04 \
|
||||
12 FF 85 05 D2 05 71 1A 52 00 3A 80 32 08 97 71 \
|
||||
23 77 4B 32 00 32 01 B7 97 75 32 12 BC FE FE 02 \
|
||||
0A 50 12 BC FE FE 95 75 3C 85 77 44 16 FF DA 02 \
|
||||
71 4B 77 44 22 0F 87 22 0E 87 57 22 0E 87 22 0E \
|
||||
87 57 22 0E 87 22 0F 87 57 00 00 00 00 00 00 00
|
||||
led 1 auto on
|
||||
led 1 start
|
||||
|
||||
led 2 stop
|
||||
led 2 prog \
|
||||
02 00 60 FE 2E FE 67 1C 86 FE 06 FE D2 40 71 04 \
|
||||
12 FF 85 05 D2 05 71 1A 52 00 3A 80 32 08 97 71 \
|
||||
23 77 4B 32 00 32 01 B7 97 75 32 12 BC FE FE 02 \
|
||||
0A 50 12 BC FE FE 95 75 3C 85 77 44 16 FF DA 02 \
|
||||
71 4B 77 44 22 0F 87 22 0E 87 57 22 0E 87 22 0E \
|
||||
87 57 22 0E 87 22 0F 87 57 00 00 00 00 00 00 00
|
||||
led 2 auto on
|
||||
led 2 start
|
||||
|
||||
led 3 stop
|
||||
led 3 prog \
|
||||
02 00 60 FE 2E FE 67 1C 86 FE 06 FE D2 40 71 04 \
|
||||
12 FF 85 05 D2 05 71 1A 52 00 3A 80 32 08 97 71 \
|
||||
23 77 4B 32 00 32 01 B7 97 75 32 12 BC FE FE 02 \
|
||||
0A 50 12 BC FE FE 95 75 3C 85 77 44 16 FF DA 02 \
|
||||
71 4B 77 44 22 0F 87 22 0E 87 57 22 0E 87 22 0E \
|
||||
87 57 22 0E 87 22 0F 87 57 00 00 00 00 00 00 00
|
||||
led 3 auto on
|
||||
led 3 start
|
@ -0,0 +1,17 @@
|
||||
# PG lossless profiles.
|
||||
# speed cable size xon xoff threshold xon_offset
|
||||
10000 5m 1248 2288 35776 -3 2288
|
||||
25000 5m 1248 2288 53248 -3 2288
|
||||
40000 5m 1248 2288 66560 -3 2288
|
||||
50000 5m 1248 2288 90272 -3 2288
|
||||
100000 5m 1248 2288 165568 -3 2288
|
||||
10000 40m 1248 2288 37024 -3 2288
|
||||
25000 40m 1248 2288 53248 -3 2288
|
||||
40000 40m 1248 2288 71552 -3 2288
|
||||
50000 40m 1248 2288 96096 -3 2288
|
||||
100000 40m 1248 2288 177632 -3 2288
|
||||
10000 300m 1248 2288 46176 -3 2288
|
||||
25000 300m 1248 2288 79040 -3 2288
|
||||
40000 300m 1248 2288 108160 -3 2288
|
||||
50000 300m 1248 2288 141856 -3 2288
|
||||
100000 300m 1248 2288 268736 -3 2288
|
@ -0,0 +1,121 @@
|
||||
# name lanes alias index speed
|
||||
Ethernet0 49,50 fiftyGigE1/1/1 1 50000
|
||||
Ethernet2 51,52 fiftyGigE1/1/2 1 50000
|
||||
Ethernet4 53,54 fiftyGigE1/2/1 2 50000
|
||||
Ethernet6 55,56 fiftyGigE1/2/2 2 50000
|
||||
Ethernet8 65,66 fiftyGigE1/3/1 3 50000
|
||||
Ethernet10 67,68 fiftyGigE1/3/2 3 50000
|
||||
Ethernet12 69,70 fiftyGigE1/4/1 4 50000
|
||||
Ethernet14 71,72 fiftyGigE1/4/2 4 50000
|
||||
Ethernet16 81,82 fiftyGigE1/5/1 5 50000
|
||||
Ethernet18 83,84 fiftyGigE1/5/2 5 50000
|
||||
Ethernet20 85,86 fiftyGigE1/6/1 6 50000
|
||||
Ethernet22 87,88 fiftyGigE1/6/2 6 50000
|
||||
Ethernet24 97,98 fiftyGigE1/7/1 7 50000
|
||||
Ethernet26 99,100 fiftyGigE1/7/2 7 50000
|
||||
Ethernet28 101,102 fiftyGigE1/8/1 8 50000
|
||||
Ethernet30 103,104 fiftyGigE1/8/2 8 50000
|
||||
Ethernet32 1,2 fiftyGigE1/9/1 9 50000
|
||||
Ethernet34 3,4 fiftyGigE1/9/2 9 50000
|
||||
Ethernet36 5,6 fiftyGigE1/10/1 10 50000
|
||||
Ethernet38 7,8 fiftyGigE1/10/2 10 50000
|
||||
Ethernet40 17,18 fiftyGigE1/11/1 11 50000
|
||||
Ethernet42 19,20 fiftyGigE1/11/2 11 50000
|
||||
Ethernet44 21,22 fiftyGigE1/12/1 12 50000
|
||||
Ethernet46 23,24 fiftyGigE1/12/2 12 50000
|
||||
Ethernet48 33,34,35,36 hundredGigE1/13 13 100000
|
||||
Ethernet52 37,38,39,40 hundredGigE1/14 14 100000
|
||||
Ethernet56 113,114,115,116 hundredGigE1/15 15 100000
|
||||
Ethernet60 117,118,119,120 hundredGigE1/16 16 100000
|
||||
Ethernet64 133,134,135,136 hundredGigE1/17 17 100000
|
||||
Ethernet68 129,130,131,132 hundredGigE1/18 18 100000
|
||||
Ethernet72 213,214,215,216 hundredGigE1/19 19 100000
|
||||
Ethernet76 209,210,211,212 hundredGigE1/20 20 100000
|
||||
Ethernet80 229,230 fiftyGigE1/21/1 21 50000
|
||||
Ethernet82 231,232 fiftyGigE1/21/2 21 50000
|
||||
Ethernet84 225,226 fiftyGigE1/22/1 22 50000
|
||||
Ethernet86 227,228 fiftyGigE1/22/2 22 50000
|
||||
Ethernet88 245,246 fiftyGigE1/23/1 23 50000
|
||||
Ethernet90 247,248 fiftyGigE1/23/2 23 50000
|
||||
Ethernet92 241,242 fiftyGigE1/24/1 24 50000
|
||||
Ethernet94 243,244 fiftyGigE1/24/2 24 50000
|
||||
Ethernet96 149,150 fiftyGigE1/25/1 25 50000
|
||||
Ethernet98 151,152 fiftyGigE1/25/2 25 50000
|
||||
Ethernet100 145,146 fiftyGigE1/26/1 26 50000
|
||||
Ethernet102 147,148 fiftyGigE1/26/2 26 50000
|
||||
Ethernet104 165,166 fiftyGigE1/27/1 27 50000
|
||||
Ethernet106 167,168 fiftyGigE1/27/2 27 50000
|
||||
Ethernet108 161,162 fiftyGigE1/28/1 28 50000
|
||||
Ethernet110 163,164 fiftyGigE1/28/2 28 50000
|
||||
Ethernet112 181,182 fiftyGigE1/29/1 29 50000
|
||||
Ethernet114 183,184 fiftyGigE1/29/2 29 50000
|
||||
Ethernet116 177,178 fiftyGigE1/30/1 30 50000
|
||||
Ethernet118 179,180 fiftyGigE1/30/2 30 50000
|
||||
Ethernet120 197,198 fiftyGigE1/31/1 31 50000
|
||||
Ethernet122 199,200 fiftyGigE1/31/2 31 50000
|
||||
Ethernet124 193,194 fiftyGigE1/32/1 32 50000
|
||||
Ethernet126 195,196 fiftyGigE1/32/2 32 50000
|
||||
Ethernet128 61,62 fiftyGigE1/33/1 33 50000
|
||||
Ethernet130 63,64 fiftyGigE1/33/2 33 50000
|
||||
Ethernet132 57,58 fiftyGigE1/34/1 34 50000
|
||||
Ethernet134 59,60 fiftyGigE1/34/2 34 50000
|
||||
Ethernet136 77,78 fiftyGigE1/35/1 35 50000
|
||||
Ethernet138 79,80 fiftyGigE1/35/2 35 50000
|
||||
Ethernet140 73,74 fiftyGigE1/36/1 36 50000
|
||||
Ethernet142 75,76 fiftyGigE1/36/2 36 50000
|
||||
Ethernet144 93,94 fiftyGigE1/37/1 37 50000
|
||||
Ethernet146 95,96 fiftyGigE1/37/2 37 50000
|
||||
Ethernet148 89,90 fiftyGigE1/38/1 38 50000
|
||||
Ethernet150 91,92 fiftyGigE1/38/2 38 50000
|
||||
Ethernet152 109,110 fiftyGigE1/39/1 39 50000
|
||||
Ethernet154 111,112 fiftyGigE1/39/2 39 50000
|
||||
Ethernet156 105,106 fiftyGigE1/40/1 40 50000
|
||||
Ethernet158 107,108 fiftyGigE1/40/2 40 50000
|
||||
Ethernet160 13,14 fiftyGigE1/41/1 41 50000
|
||||
Ethernet162 15,16 fiftyGigE1/41/2 41 50000
|
||||
Ethernet164 9,10 fiftyGigE1/42/1 42 50000
|
||||
Ethernet166 11,12 fiftyGigE1/42/2 42 50000
|
||||
Ethernet168 29,30 fiftyGigE1/43/1 43 50000
|
||||
Ethernet170 31,32 fiftyGigE1/43/2 43 50000
|
||||
Ethernet172 25,26 fiftyGigE1/44/1 44 50000
|
||||
Ethernet174 27,28 fiftyGigE1/44/2 44 50000
|
||||
Ethernet176 45,46 fiftyGigE1/45/1 45 50000
|
||||
Ethernet178 47,48 fiftyGigE1/45/2 45 50000
|
||||
Ethernet180 41,42 fiftyGigE1/46/1 46 50000
|
||||
Ethernet182 43,44 fiftyGigE1/46/2 46 50000
|
||||
Ethernet184 125,126 fiftyGigE1/47/1 47 50000
|
||||
Ethernet186 127,128 fiftyGigE1/47/2 47 50000
|
||||
Ethernet188 121,122 fiftyGigE1/48/1 48 50000
|
||||
Ethernet190 123,124 fiftyGigE1/48/2 48 50000
|
||||
Ethernet192 137,138 fiftyGigE1/49/1 49 50000
|
||||
Ethernet194 139,140 fiftyGigE1/49/2 49 50000
|
||||
Ethernet196 141,142 fiftyGigE1/50/1 50 50000
|
||||
Ethernet198 143,144 fiftyGigE1/50/2 50 50000
|
||||
Ethernet200 217,218 fiftyGigE1/51/1 51 50000
|
||||
Ethernet202 219,220 fiftyGigE1/51/2 51 50000
|
||||
Ethernet204 221,222 fiftyGigE1/52/1 52 50000
|
||||
Ethernet206 223,224 fiftyGigE1/52/2 52 50000
|
||||
Ethernet208 233,234 fiftyGigE1/53/1 53 50000
|
||||
Ethernet210 235,236 fiftyGigE1/53/2 53 50000
|
||||
Ethernet212 237,238 fiftyGigE1/54/1 54 50000
|
||||
Ethernet214 239,240 fiftyGigE1/54/2 54 50000
|
||||
Ethernet216 249,250 fiftyGigE1/55/1 55 50000
|
||||
Ethernet218 251,252 fiftyGigE1/55/2 55 50000
|
||||
Ethernet220 253,254 fiftyGigE1/56/1 56 50000
|
||||
Ethernet222 255,256 fiftyGigE1/56/2 56 50000
|
||||
Ethernet224 153,154 fiftyGigE1/57/1 57 50000
|
||||
Ethernet226 155,156 fiftyGigE1/57/2 57 50000
|
||||
Ethernet228 157,158 fiftyGigE1/58/1 58 50000
|
||||
Ethernet230 159,160 fiftyGigE1/58/2 58 50000
|
||||
Ethernet232 169,170 fiftyGigE1/59/1 59 50000
|
||||
Ethernet234 171,172 fiftyGigE1/59/2 59 50000
|
||||
Ethernet236 173,174 fiftyGigE1/60/1 60 50000
|
||||
Ethernet238 175,176 fiftyGigE1/60/2 60 50000
|
||||
Ethernet240 185,186 fiftyGigE1/61/1 61 50000
|
||||
Ethernet242 187,188 fiftyGigE1/61/2 61 50000
|
||||
Ethernet244 189,190 fiftyGigE1/62/1 62 50000
|
||||
Ethernet246 191,192 fiftyGigE1/62/2 62 50000
|
||||
Ethernet248 201,202 fiftyGigE1/63/1 63 50000
|
||||
Ethernet250 203,204 fiftyGigE1/63/2 63 50000
|
||||
Ethernet252 205,206 fiftyGigE1/64/1 64 50000
|
||||
Ethernet254 207,208 fiftyGigE1/64/2 64 50000
|
@ -0,0 +1 @@
|
||||
{%- include 'qos_config.j2' %}
|
@ -0,0 +1 @@
|
||||
SAI_INIT_CONFIG_FILE=/usr/share/sonic/hwsku/th2-z9264f-8x100G-112x50G.config.bcm
|
File diff suppressed because it is too large
Load Diff
@ -1,65 +1,65 @@
|
||||
# name lanes alias
|
||||
Ethernet0 73,74,75,76 hundredGigE1
|
||||
Ethernet4 65,66,67,68 hundredGigE2
|
||||
Ethernet8 81,82,83,84 hundredGigE3
|
||||
Ethernet12 89,90,91,92 hundredGigE4
|
||||
Ethernet16 105,106,107,108 hundredGigE5
|
||||
Ethernet20 97,98,99,100 hundredGigE6
|
||||
Ethernet24 113,114,115,116 hundredGigE7
|
||||
Ethernet28 121,122,123,124 hundredGigE8
|
||||
Ethernet32 41,42,43,44 hundredGigE9
|
||||
Ethernet36 33,34,35,36 hundredGigE10
|
||||
Ethernet40 49,50,51,52 hundredGigE11
|
||||
Ethernet44 57,58,59,60 hundredGigE12
|
||||
Ethernet48 137,138,139,140 hundredGigE13
|
||||
Ethernet52 129,130,131,132 hundredGigE14
|
||||
Ethernet56 145,146,147,148 hundredGigE15
|
||||
Ethernet60 153,154,155,156 hundredGigE16
|
||||
Ethernet64 173,174,175,176 hundredGigE17
|
||||
Ethernet68 165,166,167,168 hundredGigE18
|
||||
Ethernet72 181,182,183,184 hundredGigE19
|
||||
Ethernet76 189,190,191,192 hundredGigE20
|
||||
Ethernet80 13,14,15,16 hundredGigE21
|
||||
Ethernet84 5,6,7,8 hundredGigE22
|
||||
Ethernet88 29,30,31,32 hundredGigE23
|
||||
Ethernet92 21,22,23,24 hundredGigE24
|
||||
Ethernet96 205,206,207,208 hundredGigE25
|
||||
Ethernet100 197,198,199,200 hundredGigE26
|
||||
Ethernet104 213,214,215,216 hundredGigE27
|
||||
Ethernet108 221,222,223,224 hundredGigE28
|
||||
Ethernet112 229,230,231,232 hundredGigE29
|
||||
Ethernet116 237,238,239,240 hundredGigE30
|
||||
Ethernet120 245,246,247,248 hundredGigE31
|
||||
Ethernet124 253,254,255,256 hundredGigE32
|
||||
Ethernet128 69,70,71,72 hundredGigE33
|
||||
Ethernet132 77,78,79,80 hundredGigE34
|
||||
Ethernet136 93,94,95,96 hundredGigE35
|
||||
Ethernet140 85,86,87,88 hundredGigE36
|
||||
Ethernet144 101,102,103,104 hundredGigE37
|
||||
Ethernet148 109,110,111,112 hundredGigE38
|
||||
Ethernet152 125,126,127,128 hundredGigE39
|
||||
Ethernet156 117,118,119,120 hundredGigE40
|
||||
Ethernet160 37,38,39,40 hundredGigE41
|
||||
Ethernet164 45,46,47,48 hundredGigE42
|
||||
Ethernet168 61,62,63,64 hundredGigE43
|
||||
Ethernet172 53,54,55,56 hundredGigE44
|
||||
Ethernet176 133,134,135,136 hundredGigE45
|
||||
Ethernet180 141,142,143,144 hundredGigE46
|
||||
Ethernet184 157,158,159,160 hundredGigE47
|
||||
Ethernet188 149,150,151,152 hundredGigE48
|
||||
Ethernet192 161,162,163,164 hundredGigE49
|
||||
Ethernet196 169,170,171,172 hundredGigE50
|
||||
Ethernet200 185,186,187,188 hundredGigE51
|
||||
Ethernet204 177,178,179,180 hundredGigE52
|
||||
Ethernet208 1,2,3,4 hundredGigE53
|
||||
Ethernet212 9,10,11,12 hundredGigE54
|
||||
Ethernet216 25,26,27,28 hundredGigE55
|
||||
Ethernet220 17,18,19,20 hundredGigE56
|
||||
Ethernet224 193,194,195,196 hundredGigE57
|
||||
Ethernet228 201,202,203,204 hundredGigE58
|
||||
Ethernet232 217,218,219,220 hundredGigE59
|
||||
Ethernet236 209,210,211,212 hundredGigE60
|
||||
Ethernet240 225,226,227,228 hundredGigE61
|
||||
Ethernet244 233,234,235,236 hundredGigE62
|
||||
Ethernet248 249,250,251,252 hundredGigE63
|
||||
Ethernet252 241,242,243,244 hundredGigE64
|
||||
# name lanes alias index speed
|
||||
Ethernet0 73,74,75,76 hundredGigE1 0 100000
|
||||
Ethernet4 65,66,67,68 hundredGigE2 1 100000
|
||||
Ethernet8 81,82,83,84 hundredGigE3 2 100000
|
||||
Ethernet12 89,90,91,92 hundredGigE4 3 100000
|
||||
Ethernet16 105,106,107,108 hundredGigE5 4 100000
|
||||
Ethernet20 97,98,99,100 hundredGigE6 5 100000
|
||||
Ethernet24 113,114,115,116 hundredGigE7 6 100000
|
||||
Ethernet28 121,122,123,124 hundredGigE8 7 100000
|
||||
Ethernet32 41,42,43,44 hundredGigE9 8 100000
|
||||
Ethernet36 33,34,35,36 hundredGigE10 9 100000
|
||||
Ethernet40 49,50,51,52 hundredGigE11 10 100000
|
||||
Ethernet44 57,58,59,60 hundredGigE12 11 100000
|
||||
Ethernet48 137,138,139,140 hundredGigE13 12 100000
|
||||
Ethernet52 129,130,131,132 hundredGigE14 13 100000
|
||||
Ethernet56 145,146,147,148 hundredGigE15 14 100000
|
||||
Ethernet60 153,154,155,156 hundredGigE16 15 100000
|
||||
Ethernet64 173,174,175,176 hundredGigE17 16 100000
|
||||
Ethernet68 165,166,167,168 hundredGigE18 17 100000
|
||||
Ethernet72 181,182,183,184 hundredGigE19 18 100000
|
||||
Ethernet76 189,190,191,192 hundredGigE20 19 100000
|
||||
Ethernet80 13,14,15,16 hundredGigE21 20 100000
|
||||
Ethernet84 5,6,7,8 hundredGigE22 21 100000
|
||||
Ethernet88 29,30,31,32 hundredGigE23 22 100000
|
||||
Ethernet92 21,22,23,24 hundredGigE24 23 100000
|
||||
Ethernet96 205,206,207,208 hundredGigE25 24 100000
|
||||
Ethernet100 197,198,199,200 hundredGigE26 25 100000
|
||||
Ethernet104 213,214,215,216 hundredGigE27 26 100000
|
||||
Ethernet108 221,222,223,224 hundredGigE28 27 100000
|
||||
Ethernet112 229,230,231,232 hundredGigE29 28 100000
|
||||
Ethernet116 237,238,239,240 hundredGigE30 29 100000
|
||||
Ethernet120 245,246,247,248 hundredGigE31 30 100000
|
||||
Ethernet124 253,254,255,256 hundredGigE32 31 100000
|
||||
Ethernet128 69,70,71,72 hundredGigE33 32 100000
|
||||
Ethernet132 77,78,79,80 hundredGigE34 33 100000
|
||||
Ethernet136 93,94,95,96 hundredGigE35 34 100000
|
||||
Ethernet140 85,86,87,88 hundredGigE36 35 100000
|
||||
Ethernet144 101,102,103,104 hundredGigE37 36 100000
|
||||
Ethernet148 109,110,111,112 hundredGigE38 37 100000
|
||||
Ethernet152 125,126,127,128 hundredGigE39 38 100000
|
||||
Ethernet156 117,118,119,120 hundredGigE40 39 100000
|
||||
Ethernet160 37,38,39,40 hundredGigE41 40 100000
|
||||
Ethernet164 45,46,47,48 hundredGigE42 41 100000
|
||||
Ethernet168 61,62,63,64 hundredGigE43 42 100000
|
||||
Ethernet172 53,54,55,56 hundredGigE44 43 100000
|
||||
Ethernet176 133,134,135,136 hundredGigE45 44 100000
|
||||
Ethernet180 141,142,143,144 hundredGigE46 45 100000
|
||||
Ethernet184 157,158,159,160 hundredGigE47 46 100000
|
||||
Ethernet188 149,150,151,152 hundredGigE48 47 100000
|
||||
Ethernet192 161,162,163,164 hundredGigE49 48 100000
|
||||
Ethernet196 169,170,171,172 hundredGigE50 49 100000
|
||||
Ethernet200 185,186,187,188 hundredGigE51 50 100000
|
||||
Ethernet204 177,178,179,180 hundredGigE52 51 100000
|
||||
Ethernet208 1,2,3,4 hundredGigE53 52 100000
|
||||
Ethernet212 9,10,11,12 hundredGigE54 53 100000
|
||||
Ethernet216 25,26,27,28 hundredGigE55 54 100000
|
||||
Ethernet220 17,18,19,20 hundredGigE56 55 100000
|
||||
Ethernet224 193,194,195,196 hundredGigE57 56 100000
|
||||
Ethernet228 201,202,203,204 hundredGigE58 57 100000
|
||||
Ethernet232 217,218,219,220 hundredGigE59 58 100000
|
||||
Ethernet236 209,210,211,212 hundredGigE60 59 100000
|
||||
Ethernet240 225,226,227,228 hundredGigE61 60 100000
|
||||
Ethernet244 233,234,235,236 hundredGigE62 61 100000
|
||||
Ethernet248 249,250,251,252 hundredGigE63 62 100000
|
||||
Ethernet252 241,242,243,244 hundredGigE64 63 100000
|
||||
|
@ -43,146 +43,79 @@ class SfpUtil(SfpUtilBase):
|
||||
cmd = '/var/run/sfppresence'
|
||||
_port_to_eeprom_mapping = {}
|
||||
port_to_i2c_mapping = {
|
||||
61 : 25,
|
||||
62 : 26,
|
||||
63 : 27,
|
||||
64 : 28,
|
||||
55 : 29,
|
||||
56 : 30,
|
||||
53 : 31,
|
||||
54 : 32,
|
||||
9 : 33,
|
||||
10 : 34,
|
||||
11 : 35,
|
||||
12 : 36,
|
||||
1 : 37,
|
||||
2 : 38,
|
||||
3 : 39,
|
||||
4 : 40,
|
||||
6 : 41,
|
||||
5 : 42,
|
||||
8 : 43,
|
||||
7 : 44,
|
||||
13 : 45,
|
||||
14 : 46,
|
||||
15 : 47,
|
||||
16 : 48,
|
||||
17 : 49,
|
||||
18 : 50,
|
||||
19 : 51,
|
||||
20 : 52,
|
||||
25 : 53,
|
||||
26 : 54,
|
||||
27 : 55,
|
||||
28 : 56,
|
||||
29 : 57,
|
||||
30 : 58,
|
||||
31 : 59,
|
||||
32 : 60,
|
||||
21 : 61,
|
||||
22 : 62,
|
||||
23 : 63,
|
||||
24 : 64,
|
||||
41 : 65,
|
||||
42 : 66,
|
||||
43 : 67,
|
||||
44 : 68,
|
||||
33 : 69,
|
||||
34 : 70,
|
||||
35 : 71,
|
||||
36 : 72,
|
||||
45 : 73,
|
||||
46 : 74,
|
||||
47 : 75,
|
||||
48 : 76,
|
||||
37 : 77,
|
||||
38 : 78,
|
||||
39 : 79,
|
||||
40 : 80,
|
||||
57 : 81,
|
||||
58 : 82,
|
||||
59 : 83,
|
||||
60 : 84,
|
||||
49 : 85,
|
||||
50 : 86,
|
||||
51 : 87,
|
||||
52 : 88,}
|
||||
60 : 25,
|
||||
61 : 26,
|
||||
62 : 27,
|
||||
63 : 28,
|
||||
54 : 29,
|
||||
55 : 30,
|
||||
52 : 31,
|
||||
53 : 32,
|
||||
8 : 33,
|
||||
9 : 34,
|
||||
10 : 35,
|
||||
11 : 36,
|
||||
0 : 37,
|
||||
1 : 38,
|
||||
2 : 39,
|
||||
3 : 40,
|
||||
5 : 41,
|
||||
4 : 42,
|
||||
7 : 43,
|
||||
6 : 44,
|
||||
12 : 45,
|
||||
13 : 46,
|
||||
14 : 47,
|
||||
15 : 48,
|
||||
16 : 49,
|
||||
17 : 50,
|
||||
18 : 51,
|
||||
19 : 52,
|
||||
24 : 53,
|
||||
25 : 54,
|
||||
26 : 55,
|
||||
27 : 56,
|
||||
28 : 57,
|
||||
29 : 58,
|
||||
30 : 59,
|
||||
31 : 60,
|
||||
20 : 61,
|
||||
21 : 62,
|
||||
22 : 63,
|
||||
23 : 64,
|
||||
40 : 65,
|
||||
41 : 66,
|
||||
42 : 67,
|
||||
43 : 68,
|
||||
32 : 69,
|
||||
33 : 70,
|
||||
34 : 71,
|
||||
35 : 72,
|
||||
44 : 73,
|
||||
45 : 74,
|
||||
46 : 75,
|
||||
47 : 76,
|
||||
36 : 77,
|
||||
37 : 78,
|
||||
38 : 79,
|
||||
39 : 80,
|
||||
56 : 81,
|
||||
57 : 82,
|
||||
58 : 83,
|
||||
59 : 84,
|
||||
48 : 85,
|
||||
49 : 86,
|
||||
50 : 87,
|
||||
51 : 88,}
|
||||
|
||||
port_to_sysfs_map = [
|
||||
'/sys/bus/i2c/devices/37-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/38-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/39-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/40-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/42-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/41-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/44-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/43-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/33-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/34-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/35-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/36-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/45-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/46-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/47-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/48-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/49-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/50-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/51-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/52-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/61-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/62-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/63-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/64-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/53-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/54-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/55-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/56-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/57-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/58-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/59-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/60-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/69-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/70-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/71-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/72-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/77-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/78-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/79-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/80-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/65-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/66-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/67-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/68-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/73-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/74-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/75-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/76-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/85-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/86-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/87-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/88-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/31-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/32-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/29-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/30-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/81-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/82-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/83-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/84-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/25-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/26-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/27-0050/sfp_is_present',
|
||||
'/sys/bus/i2c/devices/28-0050/sfp_is_present'
|
||||
|
||||
]
|
||||
# sys.path.append('/usr/local/bin')
|
||||
_qsfp_ports = range(0, ports_in_block + 1)
|
||||
|
||||
|
||||
def __init__(self):
|
||||
eeprom_path = '/sys/bus/i2c/devices/{0}-0050/sfp_eeprom'
|
||||
for x in range(0, self._port_end + 1):
|
||||
port_eeprom_path = eeprom_path.format(self.port_to_i2c_mapping[x+1])
|
||||
eeprom_path = '/sys/bus/i2c/devices/{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)
|
||||
|
||||
@ -210,10 +143,9 @@ class SfpUtil(SfpUtilBase):
|
||||
if port_num < self._port_start or port_num > self._port_end:
|
||||
return False
|
||||
|
||||
path = "/sys/bus/i2c/devices/{0}-0050/sfp_is_present"
|
||||
port_ps = path.format(self.port_to_i2c_mapping[port_num+1])
|
||||
path = "/sys/bus/i2c/devices/19-0060/module_present_{0}"
|
||||
port_ps = path.format(port_num + 1)
|
||||
|
||||
|
||||
try:
|
||||
reg_file = open(port_ps)
|
||||
except IOError as e:
|
||||
@ -278,6 +210,8 @@ class SfpUtil(SfpUtilBase):
|
||||
current_sfp_values = [0] * 64
|
||||
previous_sfp_values = [0] * 64
|
||||
|
||||
path = "/sys/bus/i2c/devices/19-0060/module_present_{0}"
|
||||
|
||||
if not os.path.isfile(self.cmd):
|
||||
pass
|
||||
else:
|
||||
@ -287,9 +221,10 @@ class SfpUtil(SfpUtilBase):
|
||||
previous_sfp_values = self.read_from_file(self.cmd)
|
||||
|
||||
# Read the current values from sysfs
|
||||
for x in range(len(self.port_to_sysfs_map)):
|
||||
for x in range(self._port_start , self._port_end + 1):
|
||||
try:
|
||||
reg_file = open(self.port_to_sysfs_map[x], 'r')
|
||||
new_path = path.format(x + 1)
|
||||
reg_file = open(new_path, 'r')
|
||||
except IOError as e:
|
||||
print "Error: unable to open file: %s" % str(e)
|
||||
return False, defl_dict
|
||||
@ -305,7 +240,7 @@ class SfpUtil(SfpUtilBase):
|
||||
else:
|
||||
return False, defl_dict
|
||||
|
||||
def get_transceiver_change_event(self):
|
||||
def get_transceiver_change_event(self, timeout=2000):
|
||||
time.sleep(3)
|
||||
return self.sfp_detect()
|
||||
|
||||
|
@ -32,6 +32,7 @@ COPY ["dpkg_01_drop", "/etc/dpkg/dpkg.cfg.d/01_drop"]
|
||||
COPY ["sources.list.armhf", "/etc/apt/sources.list"]
|
||||
{% elif CONFIGURED_ARCH == "arm64" %}
|
||||
COPY ["sources.list.arm64", "/etc/apt/sources.list"]
|
||||
COPY ["aptconf_archive_expired_release", "/etc/apt/apt.conf.d"]
|
||||
{% else %}
|
||||
COPY ["sources.list", "/etc/apt/sources.list"]
|
||||
{% endif %}
|
||||
|
3
dockers/docker-base/aptconf_archive_expired_release
Normal file
3
dockers/docker-base/aptconf_archive_expired_release
Normal file
@ -0,0 +1,3 @@
|
||||
# Instruct apt-get to override expired releases repo list for jessie archives
|
||||
|
||||
Acquire::Check-Valid-Until "0";
|
@ -2,21 +2,17 @@
|
||||
|
||||
STATE_DB_IDX="6"
|
||||
|
||||
PORT_TABLE_PREFIX="PORT_TABLE"
|
||||
VLAN_TABLE_PREFIX="VLAN_TABLE"
|
||||
LAG_TABLE_PREFIX="LAG_TABLE"
|
||||
|
||||
function wait_until_iface_ready
|
||||
{
|
||||
TABLE_PREFIX=$1
|
||||
IFACE=$2
|
||||
IFACE_NAME=$1
|
||||
IFACE_CIDR=$2
|
||||
|
||||
echo "Waiting until interface $IFACE is ready..."
|
||||
echo "Waiting until interface ${IFACE_NAME} is ready..."
|
||||
|
||||
# Wait for the interface to come up
|
||||
# (i.e., interface is present in STATE_DB and state is "ok")
|
||||
while true; do
|
||||
RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "${TABLE_PREFIX}|${IFACE}" "state" 2> /dev/null)
|
||||
RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "INTERFACE_TABLE|${IFACE_NAME}|${IFACE_CIDR}" "state" 2> /dev/null)
|
||||
if [ x"$RESULT" == x"ok" ]; then
|
||||
break
|
||||
fi
|
||||
@ -24,24 +20,23 @@ function wait_until_iface_ready
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Interface ${IFACE} is ready!"
|
||||
echo "Interface ${IFACE_NAME} is ready!"
|
||||
}
|
||||
|
||||
|
||||
# Wait for all interfaces to be up and ready
|
||||
{% for name in PORT %}
|
||||
{% if name in INTERFACE %}
|
||||
wait_until_iface_ready ${PORT_TABLE_PREFIX} {{ name }}
|
||||
# Wait for all interfaces with IPv4 addresses to be up and ready
|
||||
{% for (name, prefix) in INTERFACE|pfx_filter %}
|
||||
{% if prefix | ipv4 %}
|
||||
wait_until_iface_ready {{ name }} {{ prefix }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for name in VLAN %}
|
||||
{% if name in VLAN_INTERFACE %}
|
||||
wait_until_iface_ready ${VLAN_TABLE_PREFIX} {{ name }}
|
||||
{% for (name, prefix) in VLAN_INTERFACE|pfx_filter %}
|
||||
{% if prefix | ipv4 %}
|
||||
wait_until_iface_ready {{ name }} {{ prefix }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% for name in PORTCHANNEL %}
|
||||
{% if name in PORTCHANNEL_INTERFACE %}
|
||||
wait_until_iface_ready ${LAG_TABLE_PREFIX} {{ name }}
|
||||
{% for (name, prefix) in PORTCHANNEL_INTERFACE|pfx_filter %}
|
||||
{% if prefix | ipv4 %}
|
||||
wait_until_iface_ready {{ name }} {{ prefix }}
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
|
@ -131,6 +131,8 @@ class LldpManager(object):
|
||||
For port `port_name`, look up the description and alias in the Config database,
|
||||
then form the appropriate lldpcli configuration command and run it.
|
||||
"""
|
||||
port_desc = None
|
||||
|
||||
# Retrieve all entires for this port from the Port table
|
||||
port_table = swsscommon.Table(self.config_db, swsscommon.CFG_PORT_TABLE_NAME)
|
||||
(status, fvp) = port_table.get(port_name)
|
||||
|
@ -29,11 +29,16 @@ RUN apt-get update && \
|
||||
libmnl0 \
|
||||
bridge-utils
|
||||
|
||||
{% if CONFIGURED_ARCH == "armhf" %}
|
||||
{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
|
||||
## Fix for gcc/python not found in arm docker
|
||||
RUN apt-get install -y gcc-6
|
||||
RUN ln -s -f /usr/bin/gcc-6 /usr/bin/arm-linux-gnueabihf-gcc
|
||||
RUN apt-get install -f -y python2.7 python2.7-dev
|
||||
RUN apt-get install -y gcc-6
|
||||
{% endif %}
|
||||
{% if CONFIGURED_ARCH == "armhf" %}
|
||||
RUN ln -s -f /usr/bin/gcc-6 /usr/bin/arm-linux-gnueabihf-gcc
|
||||
{% endif %}
|
||||
{% if CONFIGURED_ARCH == "arm64" %}
|
||||
RUN ln -s -f /usr/bin/gcc-6 /usr/bin/aarch64-linux-gnu-gcc
|
||||
{% endif %}
|
||||
|
||||
RUN pip install \
|
||||
@ -44,7 +49,7 @@ RUN pip install \
|
||||
netifaces==0.10.7 \
|
||||
monotonic==1.5
|
||||
|
||||
{% if CONFIGURED_ARCH == "armhf" %}
|
||||
{% if ( CONFIGURED_ARCH == "armhf" or CONFIGURED_ARCH == "arm64" ) %}
|
||||
# Remove installed gcc
|
||||
RUN apt-get remove -y gcc-6
|
||||
{% endif %}
|
||||
|
33
dockers/docker-sflow/Dockerfile.j2
Normal file
33
dockers/docker-sflow/Dockerfile.j2
Normal file
@ -0,0 +1,33 @@
|
||||
{% from "dockers/dockerfile-macros.j2" import install_debian_packages, install_python_wheels, copy_files %}
|
||||
FROM docker-config-engine-stretch
|
||||
|
||||
ARG docker_container_name
|
||||
RUN [ -f /etc/rsyslog.conf ] && sed -ri "s/%syslogtag%/$docker_container_name#%syslogtag%/;" /etc/rsyslog.conf
|
||||
|
||||
## Make apt-get non-interactive
|
||||
ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update && \
|
||||
apt-get install -f -y \
|
||||
dmidecode \
|
||||
libmnl0=1.0.4-2
|
||||
|
||||
{% if docker_sflow_debs.strip() -%}
|
||||
# Copy locally-built Debian package dependencies
|
||||
{{ copy_files("debs/", docker_sflow_debs.split(' '), "/debs/") }}
|
||||
|
||||
# Install locally-built Debian packages and implicitly install their dependencies
|
||||
{{ install_debian_packages(docker_sflow_debs.split(' ')) }}
|
||||
{%- endif %}
|
||||
|
||||
RUN apt-get clean -y && \
|
||||
apt-get autoclean -y && \
|
||||
apt-get autoremove -y && \
|
||||
rm -rf /debs
|
||||
|
||||
RUN sed -ri '/^DAEMON_ARGS=""/c DAEMON_ARGS="-c /var/log/hsflowd.crash"' /etc/init.d/hsflowd
|
||||
|
||||
COPY ["start.sh", "/usr/bin/"]
|
||||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
|
||||
|
||||
ENTRYPOINT ["/usr/bin/supervisord"]
|
10
dockers/docker-sflow/base_image_files/psample
Executable file
10
dockers/docker-sflow/base_image_files/psample
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
DOCKER_EXEC_FLAGS="i"
|
||||
|
||||
# Determine whether stdout is on a terminal
|
||||
if [ -t 1 ] ; then
|
||||
DOCKER_EXEC_FLAGS+="t"
|
||||
fi
|
||||
|
||||
docker exec -$DOCKER_EXEC_FLAGS sflow psample "$@"
|
10
dockers/docker-sflow/base_image_files/sflowtool
Executable file
10
dockers/docker-sflow/base_image_files/sflowtool
Executable file
@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
DOCKER_EXEC_FLAGS="i"
|
||||
|
||||
# Determine whether stdout is on a terminal
|
||||
if [ -t 1 ] ; then
|
||||
DOCKER_EXEC_FLAGS+="t"
|
||||
fi
|
||||
|
||||
docker exec -$DOCKER_EXEC_FLAGS sflow sflowtool "$@"
|
7
dockers/docker-sflow/start.sh
Executable file
7
dockers/docker-sflow/start.sh
Executable file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
rm -f /var/run/rsyslogd.pid
|
||||
|
||||
supervisorctl start rsyslogd
|
||||
|
||||
supervisorctl start sflowmgrd
|
28
dockers/docker-sflow/supervisord.conf
Normal file
28
dockers/docker-sflow/supervisord.conf
Normal file
@ -0,0 +1,28 @@
|
||||
[supervisord]
|
||||
logfile_maxbytes=1MB
|
||||
logfile_backups=2
|
||||
nodaemon=true
|
||||
|
||||
[program:start.sh]
|
||||
command=/usr/bin/start.sh
|
||||
priority=1
|
||||
autostart=true
|
||||
autorestart=false
|
||||
stdout_logfile=syslog
|
||||
stderr_logfile=syslog
|
||||
|
||||
[program:rsyslogd]
|
||||
command=/usr/sbin/rsyslogd -n
|
||||
priority=2
|
||||
autostart=false
|
||||
autorestart=false
|
||||
stdout_logfile=syslog
|
||||
stderr_logfile=syslog
|
||||
|
||||
[program:sflowmgrd]
|
||||
command=/usr/bin/sflowmgrd
|
||||
priority=3
|
||||
autostart=false
|
||||
autorestart=false
|
||||
stdout_logfile=syslog
|
||||
stderr_logfile=syslog
|
@ -33,7 +33,6 @@ RUN apt-get update && \
|
||||
{{ install_debian_packages(docker_snmp_sv2_debs.split(' ')) }}
|
||||
{%- endif %}
|
||||
|
||||
{%- if CONFIGURED_ARCH == "armhf" %}
|
||||
# Fix for hiredis compilation issues for ARM
|
||||
# python will throw for missing locale
|
||||
RUN apt-get install -y locales
|
||||
@ -42,7 +41,6 @@ RUN dpkg-reconfigure --frontend noninteractive locales
|
||||
ENV LC_CTYPE=en_US.UTF-8
|
||||
RUN sed -i '/^#.* en_US.* /s/^#//' /etc/locale.gen
|
||||
RUN locale-gen
|
||||
{% endif %}
|
||||
|
||||
# Install up-to-date version of pip
|
||||
RUN curl https://bootstrap.pypa.io/get-pip.py | python3.6
|
||||
|
@ -29,6 +29,7 @@
|
||||
|
||||
|
||||
{%- set pfc_to_pg_map_supported_asics = ['mellanox', 'barefoot', 'marvell'] -%}
|
||||
{%- set backend_device_types = ['BackEndToRRouter', 'BackEndLeafRouter'] -%}
|
||||
|
||||
|
||||
{
|
||||
@ -72,6 +73,20 @@
|
||||
"7": "7"
|
||||
}
|
||||
},
|
||||
{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types %}
|
||||
"DOT1P_TO_TC_MAP": {
|
||||
"AZURE": {
|
||||
"0": "0",
|
||||
"1": "1",
|
||||
"2": "2",
|
||||
"3": "3",
|
||||
"4": "4",
|
||||
"5": "5",
|
||||
"6": "6",
|
||||
"7": "7"
|
||||
}
|
||||
},
|
||||
{% else %}
|
||||
"DSCP_TO_TC_MAP": {
|
||||
"AZURE": {
|
||||
"0" : "1",
|
||||
@ -140,6 +155,7 @@
|
||||
"63": "1"
|
||||
}
|
||||
},
|
||||
{% endif %}
|
||||
"SCHEDULER": {
|
||||
"scheduler.0": {
|
||||
"type" : "DWRR",
|
||||
@ -160,7 +176,11 @@
|
||||
{% endif %}
|
||||
"PORT_QOS_MAP": {
|
||||
"{{ port_names_active }}": {
|
||||
{% if 'type' in DEVICE_METADATA['localhost'] and DEVICE_METADATA['localhost']['type'] in backend_device_types %}
|
||||
"dot1p_to_tc_map" : "[DOT1P_TO_TC_MAP|AZURE]",
|
||||
{% else %}
|
||||
"dscp_to_tc_map" : "[DSCP_TO_TC_MAP|AZURE]",
|
||||
{% endif %}
|
||||
"tc_to_queue_map" : "[TC_TO_QUEUE_MAP|AZURE]",
|
||||
"tc_to_pg_map" : "[TC_TO_PRIORITY_GROUP_MAP|AZURE]",
|
||||
"pfc_to_queue_map": "[MAP_PFC_PRIORITY_TO_QUEUE|AZURE]",
|
||||
|
14
files/build_templates/sflow.service.j2
Normal file
14
files/build_templates/sflow.service.j2
Normal file
@ -0,0 +1,14 @@
|
||||
[Unit]
|
||||
Description=sFlow container
|
||||
Requires=swss.service
|
||||
After=swss.service
|
||||
Before=ntp-config.service
|
||||
|
||||
[Service]
|
||||
User={{ sonicadmin_user }}
|
||||
ExecStartPre=/usr/bin/{{docker_container_name}}.sh start
|
||||
ExecStart=/usr/bin/{{docker_container_name}}.sh wait
|
||||
ExecStop=/usr/bin/{{docker_container_name}}.sh stop
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
@ -300,6 +300,14 @@ sudo cp $IMAGE_CONFIGS/platform/rc.local $FILESYSTEM_ROOT/etc/
|
||||
## copy blacklist file
|
||||
sudo cp $IMAGE_CONFIGS/platform/linux_kernel_bde.conf $FILESYSTEM_ROOT/etc/modprobe.d/
|
||||
|
||||
# Enable psample drivers to support sFlow on vs
|
||||
{% if sonic_asic_platform == "vs" %}
|
||||
sudo tee -a $FILESYSTEM_ROOT/etc/modules-load.d/modules.conf > /dev/null <<EOF
|
||||
psample
|
||||
act_sample
|
||||
EOF
|
||||
{% endif %}
|
||||
|
||||
## Bind docker path
|
||||
if [[ $CONFIGURED_ARCH == armhf || $CONFIGURED_ARCH == arm64 ]]; then
|
||||
sudo mkdir -p $FILESYSTEM_ROOT/dockerfs
|
||||
|
3
files/image_config/cron.d/core_cleanup
Normal file
3
files/image_config/cron.d/core_cleanup
Normal file
@ -0,0 +1,3 @@
|
||||
# Attempts to clean up core files every 2 hours
|
||||
* */2 * * * root /usr/bin/core_cleanup.py > /dev/null 2>&1
|
||||
|
308
files/image_config/monit/monitrc
Normal file
308
files/image_config/monit/monitrc
Normal file
@ -0,0 +1,308 @@
|
||||
###############################################################################
|
||||
## Monit control file
|
||||
###############################################################################
|
||||
##
|
||||
## Comments begin with a '#' and extend through the end of the line. Keywords
|
||||
## are case insensitive. All path's MUST BE FULLY QUALIFIED, starting with '/'.
|
||||
##
|
||||
## Below you will find examples of some frequently used statements. For
|
||||
## information about the control file and a complete list of statements and
|
||||
## options, please have a look in the Monit manual.
|
||||
##
|
||||
##
|
||||
###############################################################################
|
||||
## Global section
|
||||
###############################################################################
|
||||
##
|
||||
## Start Monit in the background (run as a daemon):
|
||||
#
|
||||
set daemon 120 # check services at 2-minute intervals
|
||||
# with start delay 240 # optional: delay the first check by 4-minutes (by
|
||||
# # default Monit check immediately after Monit start)
|
||||
#
|
||||
#
|
||||
## Set syslog logging. If you want to log to a standalone log file instead,
|
||||
## specify the full path to the log file
|
||||
#
|
||||
# set logfile /var/log/monit.log
|
||||
set logfile syslog
|
||||
#
|
||||
#
|
||||
## Set the location of the Monit lock file which stores the process id of the
|
||||
## running Monit instance. By default this file is stored in $HOME/.monit.pid
|
||||
#
|
||||
# set pidfile /var/run/monit.pid
|
||||
#
|
||||
## Set the location of the Monit id file which stores the unique id for the
|
||||
## Monit instance. The id is generated and stored on first Monit start. By
|
||||
## default the file is placed in $HOME/.monit.id.
|
||||
#
|
||||
# set idfile /var/.monit.id
|
||||
set idfile /var/lib/monit/id
|
||||
#
|
||||
## Set the location of the Monit state file which saves monitoring states
|
||||
## on each cycle. By default the file is placed in $HOME/.monit.state. If
|
||||
## the state file is stored on a persistent filesystem, Monit will recover
|
||||
## the monitoring state across reboots. If it is on temporary filesystem, the
|
||||
## state will be lost on reboot which may be convenient in some situations.
|
||||
#
|
||||
set statefile /var/lib/monit/state
|
||||
#
|
||||
#
|
||||
|
||||
## Set limits for various tests. The following example shows the default values:
|
||||
##
|
||||
# set limits {
|
||||
# programOutput: 512 B, # check program's output truncate limit
|
||||
# sendExpectBuffer: 256 B, # limit for send/expect protocol test
|
||||
# fileContentBuffer: 512 B, # limit for file content test
|
||||
# httpContentBuffer: 1 MB, # limit for HTTP content test
|
||||
# networkTimeout: 5 seconds # timeout for network I/O
|
||||
# programTimeout: 300 seconds # timeout for check program
|
||||
# stopTimeout: 30 seconds # timeout for service stop
|
||||
# startTimeout: 30 seconds # timeout for service start
|
||||
# restartTimeout: 30 seconds # timeout for service restart
|
||||
# }
|
||||
|
||||
## Set global SSL options (just most common options showed, see manual for
|
||||
## full list).
|
||||
#
|
||||
# set ssl {
|
||||
# verify : enable, # verify SSL certificates (disabled by default but STRONGLY RECOMMENDED)
|
||||
# selfsigned : allow # allow self signed SSL certificates (reject by default)
|
||||
# }
|
||||
#
|
||||
#
|
||||
## Set the list of mail servers for alert delivery. Multiple servers may be
|
||||
## specified using a comma separator. If the first mail server fails, Monit
|
||||
# will use the second mail server in the list and so on. By default Monit uses
|
||||
# port 25 - it is possible to override this with the PORT option.
|
||||
#
|
||||
# set mailserver mail.bar.baz, # primary mailserver
|
||||
# backup.bar.baz port 10025, # backup mailserver on port 10025
|
||||
# localhost # fallback relay
|
||||
#
|
||||
#
|
||||
## By default Monit will drop alert events if no mail servers are available.
|
||||
## If you want to keep the alerts for later delivery retry, you can use the
|
||||
## EVENTQUEUE statement. The base directory where undelivered alerts will be
|
||||
## stored is specified by the BASEDIR option. You can limit the queue size
|
||||
## by using the SLOTS option (if omitted, the queue is limited by space
|
||||
## available in the back end filesystem).
|
||||
#
|
||||
set eventqueue
|
||||
basedir /var/lib/monit/events # set the base directory where events will be stored
|
||||
slots 100 # optionally limit the queue size
|
||||
#
|
||||
#
|
||||
## Send status and events to M/Monit (for more informations about M/Monit
|
||||
## see https://mmonit.com/). By default Monit registers credentials with
|
||||
## M/Monit so M/Monit can smoothly communicate back to Monit and you don't
|
||||
## have to register Monit credentials manually in M/Monit. It is possible to
|
||||
## disable credential registration using the commented out option below.
|
||||
## Though, if safety is a concern we recommend instead using https when
|
||||
## communicating with M/Monit and send credentials encrypted. The password
|
||||
## should be URL encoded if it contains URL-significant characters like
|
||||
## ":", "?", "@".
|
||||
#
|
||||
# set mmonit http://monit:monit@192.168.1.10:8080/collector
|
||||
# # and register without credentials # Don't register credentials
|
||||
#
|
||||
#
|
||||
## Monit by default uses the following format for alerts if the the mail-format
|
||||
## statement is missing::
|
||||
## --8<--
|
||||
## set mail-format {
|
||||
## from: Monit <monit@$HOST>
|
||||
## subject: monit alert -- $EVENT $SERVICE
|
||||
## message: $EVENT Service $SERVICE
|
||||
## Date: $DATE
|
||||
## Action: $ACTION
|
||||
## Host: $HOST
|
||||
## Description: $DESCRIPTION
|
||||
##
|
||||
## Your faithful employee,
|
||||
## Monit
|
||||
## }
|
||||
## --8<--
|
||||
##
|
||||
## You can override this message format or parts of it, such as subject
|
||||
## or sender using the MAIL-FORMAT statement. Macros such as $DATE, etc.
|
||||
## are expanded at runtime. For example, to override the sender, use:
|
||||
#
|
||||
# set mail-format { from: monit@foo.bar }
|
||||
#
|
||||
#
|
||||
## You can set alert recipients whom will receive alerts if/when a
|
||||
## service defined in this file has errors. Alerts may be restricted on
|
||||
## events by using a filter as in the second example below.
|
||||
#
|
||||
# set alert sysadm@foo.bar # receive all alerts
|
||||
#
|
||||
## Do not alert when Monit starts, stops or performs a user initiated action.
|
||||
## This filter is recommended to avoid getting alerts for trivial cases.
|
||||
#
|
||||
# set alert your-name@your.domain not on { instance, action }
|
||||
#
|
||||
#
|
||||
## Monit has an embedded HTTP interface which can be used to view status of
|
||||
## services monitored and manage services from a web interface. The HTTP
|
||||
## interface is also required if you want to issue Monit commands from the
|
||||
## command line, such as 'monit status' or 'monit restart service' The reason
|
||||
## for this is that the Monit client uses the HTTP interface to send these
|
||||
## commands to a running Monit daemon. See the Monit Wiki if you want to
|
||||
## enable SSL for the HTTP interface.
|
||||
#
|
||||
set httpd unixsocket /var/run/monit.sock and
|
||||
allow localhost # allow localhost to connect to the server and
|
||||
#
|
||||
###############################################################################
|
||||
## Services
|
||||
###############################################################################
|
||||
##
|
||||
## Check general system resources such as load average, cpu and memory
|
||||
## usage. Each test specifies a resource, conditions and the action to be
|
||||
## performed should a test fail.
|
||||
#
|
||||
# check system $HOST
|
||||
# if loadavg (1min) > 4 then alert
|
||||
# if loadavg (5min) > 2 then alert
|
||||
# if cpu usage > 95% for 10 cycles then alert
|
||||
# if memory usage > 75% then alert
|
||||
# if swap usage > 25% then alert
|
||||
#
|
||||
#
|
||||
## Check if a file exists, checksum, permissions, uid and gid. In addition
|
||||
## to alert recipients in the global section, customized alert can be sent to
|
||||
## additional recipients by specifying a local alert handler. The service may
|
||||
## be grouped using the GROUP option. More than one group can be specified by
|
||||
## repeating the 'group name' statement.
|
||||
#
|
||||
# check file apache_bin with path /usr/local/apache/bin/httpd
|
||||
# if failed checksum and
|
||||
# expect the sum 8f7f419955cefa0b33a2ba316cba3659 then unmonitor
|
||||
# if failed permission 755 then unmonitor
|
||||
# if failed uid root then unmonitor
|
||||
# if failed gid root then unmonitor
|
||||
# alert security@foo.bar on {
|
||||
# checksum, permission, uid, gid, unmonitor
|
||||
# } with the mail-format { subject: Alarm! }
|
||||
# group server
|
||||
#
|
||||
#
|
||||
## Check that a process is running, in this case Apache, and that it respond
|
||||
## to HTTP and HTTPS requests. Check its resource usage such as cpu and memory,
|
||||
## and number of children. If the process is not running, Monit will restart
|
||||
## it by default. In case the service is restarted very often and the
|
||||
## problem remains, it is possible to disable monitoring using the TIMEOUT
|
||||
## statement. This service depends on another service (apache_bin) which
|
||||
## is defined above.
|
||||
#
|
||||
# check process apache with pidfile /usr/local/apache/logs/httpd.pid
|
||||
# start program = "/etc/init.d/httpd start" with timeout 60 seconds
|
||||
# stop program = "/etc/init.d/httpd stop"
|
||||
# if cpu > 60% for 2 cycles then alert
|
||||
# if cpu > 80% for 5 cycles then restart
|
||||
# if totalmem > 200.0 MB for 5 cycles then restart
|
||||
# if children > 250 then restart
|
||||
# if loadavg(5min) greater than 10 for 8 cycles then stop
|
||||
# if failed host www.tildeslash.com port 80 protocol http
|
||||
# and request "/somefile.html"
|
||||
# then restart
|
||||
# if failed port 443 protocol https with timeout 15 seconds then restart
|
||||
# if 3 restarts within 5 cycles then unmonitor
|
||||
# depends on apache_bin
|
||||
# group server
|
||||
#
|
||||
#
|
||||
## Check filesystem permissions, uid, gid, space and inode usage. Other services,
|
||||
## such as databases, may depend on this resource and an automatically graceful
|
||||
## stop may be cascaded to them before the filesystem will become full and data
|
||||
## lost.
|
||||
#
|
||||
# check filesystem datafs with path /dev/sdb1
|
||||
# start program = "/bin/mount /data"
|
||||
# stop program = "/bin/umount /data"
|
||||
# if failed permission 660 then unmonitor
|
||||
# if failed uid root then unmonitor
|
||||
# if failed gid disk then unmonitor
|
||||
# if space usage > 80% for 5 times within 15 cycles then alert
|
||||
# if space usage > 99% then stop
|
||||
# if inode usage > 30000 then alert
|
||||
# if inode usage > 99% then stop
|
||||
# group server
|
||||
#
|
||||
#
|
||||
## Check a file's timestamp. In this example, we test if a file is older
|
||||
## than 15 minutes and assume something is wrong if its not updated. Also,
|
||||
## if the file size exceed a given limit, execute a script
|
||||
#
|
||||
# check file database with path /data/mydatabase.db
|
||||
# if failed permission 700 then alert
|
||||
# if failed uid data then alert
|
||||
# if failed gid data then alert
|
||||
# if timestamp > 15 minutes then alert
|
||||
# if size > 100 MB then exec "/my/cleanup/script" as uid dba and gid dba
|
||||
#
|
||||
#
|
||||
## Check directory permission, uid and gid. An event is triggered if the
|
||||
## directory does not belong to the user with uid 0 and gid 0. In addition,
|
||||
## the permissions have to match the octal description of 755 (see chmod(1)).
|
||||
#
|
||||
# check directory bin with path /bin
|
||||
# if failed permission 755 then unmonitor
|
||||
# if failed uid 0 then unmonitor
|
||||
# if failed gid 0 then unmonitor
|
||||
#
|
||||
#
|
||||
## Check a remote host availability by issuing a ping test and check the
|
||||
## content of a response from a web server. Up to three pings are sent and
|
||||
## connection to a port and an application level network check is performed.
|
||||
#
|
||||
# check host myserver with address 192.168.1.1
|
||||
# if failed ping then alert
|
||||
# if failed port 3306 protocol mysql with timeout 15 seconds then alert
|
||||
# if failed port 80 protocol http
|
||||
# and request /some/path with content = "a string"
|
||||
# then alert
|
||||
#
|
||||
#
|
||||
## Check a network link status (up/down), link capacity changes, saturation
|
||||
## and bandwidth usage.
|
||||
#
|
||||
# check network public with interface eth0
|
||||
# if failed link then alert
|
||||
# if changed link then alert
|
||||
# if saturation > 90% then alert
|
||||
# if download > 10 MB/s then alert
|
||||
# if total uploaded > 1 GB in last hour then alert
|
||||
#
|
||||
#
|
||||
## Check custom program status output.
|
||||
#
|
||||
# check program myscript with path /usr/local/bin/myscript.sh
|
||||
# if status != 0 then alert
|
||||
#
|
||||
#
|
||||
###############################################################################
|
||||
## Includes
|
||||
###############################################################################
|
||||
##
|
||||
## It is possible to include additional configuration parts from other files or
|
||||
## directories.
|
||||
#
|
||||
include /etc/monit/conf.d/*
|
||||
include /etc/monit/conf-enabled/*
|
||||
#
|
||||
check filesystem root-overlay with path /
|
||||
if space usage > 90% for 5 times within 10 cycles then alert
|
||||
check filesystem var-log with path /var/log
|
||||
if space usage > 90% for 5 times within 10 cycles then alert
|
||||
check system $HOST
|
||||
if memory usage > 90% for 5 times within 10 cycles then alert
|
||||
if cpu usage (user) > 90% for 5 times within 10 cycles then alert
|
||||
if cpu usage (system) > 90% for 5 times within 10 cycles then alert
|
||||
check process rsyslog with pidfile /var/run/rsyslogd.pid
|
||||
start program = "/bin/systemctl start rsyslog.service"
|
||||
stop program = "/bin/systemctl stop rsyslog.service"
|
||||
if totalmem > 800 MB for 5 times within 10 cycles then restart
|
51
files/scripts/core_cleanup.py
Executable file
51
files/scripts/core_cleanup.py
Executable file
@ -0,0 +1,51 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
import syslog
|
||||
import os
|
||||
|
||||
from collections import defaultdict
|
||||
from datetime import datetime
|
||||
|
||||
SYSLOG_IDENTIFIER = 'core_cleanup.py'
|
||||
CORE_FILE_DIR = os.path.basename(__file__)
|
||||
MAX_CORE_FILES = 4
|
||||
|
||||
def log_info(msg):
|
||||
syslog.openlog(SYSLOG_IDENTIFIER)
|
||||
syslog.syslog(syslog.LOG_INFO, msg)
|
||||
syslog.closelog()
|
||||
|
||||
def log_error(msg):
|
||||
syslog.openlog(SYSLOG_IDENTIFIER)
|
||||
syslog.syslog(syslog.LOG_ERR, msg)
|
||||
syslog.closelog()
|
||||
|
||||
def main():
|
||||
if os.getuid() != 0:
|
||||
log_error('Root required to clean up core files')
|
||||
return
|
||||
|
||||
log_info('Cleaning up core files')
|
||||
core_files = [f for f in os.listdir(CORE_FILE_DIR) if os.path.isfile(os.path.join(CORE_FILE_DIR, f))]
|
||||
|
||||
core_files_by_process = defaultdict(list)
|
||||
for f in core_files:
|
||||
process = f.split('.')[0]
|
||||
curr_files = core_files_by_process[process]
|
||||
curr_files.append(f)
|
||||
|
||||
if len(curr_files) > MAX_CORE_FILES:
|
||||
curr_files.sort(reverse = True, key = lambda x: datetime.utcfromtimestamp(int(x.split('.')[1])))
|
||||
oldest_core = curr_files[MAX_CORE_FILES]
|
||||
log_info('Deleting {}'.format(oldest_core))
|
||||
try:
|
||||
os.remove(os.path.join(CORE_FILE_DIR, oldest_core))
|
||||
except:
|
||||
log_error('Unexpected error occured trying to delete {}'.format(oldest_core))
|
||||
core_files_by_process[process] = curr_files[0:MAX_CORE_FILES]
|
||||
|
||||
log_info('Finished cleaning up core files')
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
@ -1,9 +1,7 @@
|
||||
#!/bin/sh
|
||||
|
||||
# Copyright (C) 2014,2015 Curt Brune <curt@cumulusnetworks.com>
|
||||
# Copyright (C) 2015 david_yang <david_yang@accton.com>
|
||||
# Copyright (C) Marvell Inc
|
||||
#
|
||||
# SPDX-License-Identifier: GPL-2.0
|
||||
|
||||
set -e
|
||||
|
||||
@ -31,99 +29,22 @@ fi
|
||||
|
||||
echo "Installer: platform: $platform"
|
||||
|
||||
# install_uimage will be overriden from platform.conf as it is non generic
|
||||
install_uimage() {
|
||||
echo "Copying uImage to NOR flash:"
|
||||
flashcp -v demo-${platform}.itb $mtd_dev
|
||||
}
|
||||
|
||||
# hw_load will be overriden from platform.conf as it is non generic
|
||||
hw_load() {
|
||||
echo "cp.b $img_start \$loadaddr $img_sz"
|
||||
}
|
||||
|
||||
. ./platform.conf
|
||||
|
||||
#install_uimage
|
||||
|
||||
#hw_load_str="$(hw_load)"
|
||||
|
||||
echo "Copying uImage to NAND flash:"
|
||||
# global mount defines
|
||||
demo_dev=ubi0
|
||||
mtd_dev=/dev/$(cat /proc/mtd | grep "SONIC" | grep -o "mtd[0-9]")
|
||||
mtd_num=$(echo $mtd_dev | grep -o "[0-9]")
|
||||
demo_mount=/tmp
|
||||
onie_dev=$(blkid | grep ONIE-BOOT | head -n 1 | awk '{print $1}' | sed -e 's/:.*$//')
|
||||
|
||||
echo "Format mtd partition '$mtd_dev'"
|
||||
ubiformat $mtd_dev
|
||||
#attaches MTD devices (which describe raw flash) to UBI and creates corresponding UBI devices; ('-m 2' --> mtd2)
|
||||
echo "ubiattach mtd '$mtd_num'"
|
||||
ubiattach /dev/ubi_ctrl -m $mtd_num
|
||||
#creates UBI volumes on UBI devices
|
||||
ubimkvol /dev/$demo_dev -N $demo_dev -s 3700MiB
|
||||
|
||||
demo_mount=$(mktemp -d)
|
||||
mkdir -p $demo_mount
|
||||
echo "Mounting ubifs partition"
|
||||
mount -t ubifs /dev/ubi0_0 $demo_mount
|
||||
echo "Mounting $demo_dev on $demo_mount..."
|
||||
echo "sonic extract image starts ..."
|
||||
# Decompress the file for the file system directly to the partition
|
||||
unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mount/
|
||||
cd $demo_mount
|
||||
if [ -f fs.cpio ]
|
||||
then
|
||||
cpio -id < fs.cpio
|
||||
rm fs.cpio
|
||||
elif [ -f fs.squashfs ]
|
||||
then
|
||||
unsquashfs -f -d $demo_mount fs.squashfs
|
||||
rm -f fs.squashfs
|
||||
fi
|
||||
cd -
|
||||
TAR_EXTRA_OPTION="--numeric-owner"
|
||||
mkdir -p $demo_mount/var/lib/$DOCKERFS_DIR
|
||||
unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar -xpz $TAR_EXTRA_OPTION -f - -C $demo_mount/var/lib/$DOCKERFS_DIR
|
||||
|
||||
echo "unmounting nand partition"
|
||||
umount $demo_mount
|
||||
|
||||
echo "Updating U-Boot environment variables"
|
||||
#global uboot enviroment settings
|
||||
FW_ENV='/dev/mtd0 \t\t 0x00500000 \t 0x80000 \t 0x100000 \t 8'
|
||||
|
||||
kernel_addr=0x1100000
|
||||
fdt_addr=0x1000000
|
||||
|
||||
image_name="/boot/zImage"
|
||||
fdt_name="/boot/armada-385-ET6448M_4G_Nand.dtb"
|
||||
|
||||
#BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num' rootfstype=ubifs debug panic=1 ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}:${hostname}:${netdev}:off console=ttyS0,115200 ${othbootargs} ${mtdparts}'
|
||||
BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num' rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts}'
|
||||
UBI_LOAD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name;ubifsload $fdt_addr $fdt_name'
|
||||
UBIBOOTCMD='run ubi_sonic_boot_bootargs; run ubi_sonic_boot_load; bootz $kernel_addr - $fdt_addr'
|
||||
|
||||
|
||||
echo -e $FW_ENV > /etc/fw_env.config
|
||||
|
||||
fw_setenv -f image_name $image_name > /dev/null
|
||||
fw_setenv -f fdt_name $fdt_name > /dev/null
|
||||
fw_setenv -f kernel_addr $kernel_addr > /dev/null
|
||||
fw_setenv -f fdt_addr $fdt_addr > /dev/null
|
||||
|
||||
#make sure ubi number (0) and ubi volume name (ubi0) are set correctly in bootargs_root:
|
||||
#For example, the below command creates an 3000MiB volume on UBI device 0:
|
||||
#setenv bootargs_root root=ubi0:ubi0 rw ubi.mtd=2 rootfstype=ubifs
|
||||
|
||||
fw_setenv -f mtdids 'nand0=armada-nand' > /dev/null
|
||||
fw_setenv -f mtdparts 'mtdparts=armada-nand:10m(U-Boot)ro,208m@10m(ONIE),-(SONIC)' > /dev/null
|
||||
fw_setenv -f ubi_sonic_boot_mount_ubi 'ubi part SONIC; ubifsmount ubi0' > /dev/null
|
||||
|
||||
fw_setenv -f ubi_sonic_boot_bootargs $BOOTARGS > /dev/null
|
||||
fw_setenv -f ubi_sonic_boot_load $UBI_LOAD > /dev/null
|
||||
fw_setenv -f ubi_sonic_boot $UBIBOOTCMD > /dev/null
|
||||
fw_setenv -f bootcmd 'usb start; run ubi_sonic_boot' > /dev/null
|
||||
install_uimage
|
||||
|
||||
hw_load_str="$(hw_load)"
|
||||
|
||||
cd /
|
||||
|
||||
|
@ -1,3 +1,3 @@
|
||||
__all__ = ["platform", "chassis", "fan", "psu", "sfp"]
|
||||
__all__ = ["platform", "chassis", "module", "fan", "psu", "sfp", "thermal"]
|
||||
from sonic_platform import *
|
||||
|
||||
|
@ -20,13 +20,16 @@ try:
|
||||
from sonic_platform.sfp import Sfp
|
||||
from sonic_platform.psu import Psu
|
||||
from sonic_platform.fan import Fan
|
||||
from sonic_platform.module import Module
|
||||
from sonic_platform.thermal import Thermal
|
||||
from eeprom import Eeprom
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
MAX_S6100_MODULE = 4
|
||||
MAX_S6100_FAN = 4
|
||||
MAX_S6100_PSU = 2
|
||||
MAX_S6100_THERMAL = 10
|
||||
|
||||
BIOS_QUERY_VERSION_COMMAND = "dmidecode -s system-version"
|
||||
#components definitions
|
||||
@ -44,39 +47,6 @@ class Chassis(ChassisBase):
|
||||
HWMON_NODE = os.listdir(HWMON_DIR)[0]
|
||||
MAILBOX_DIR = HWMON_DIR + HWMON_NODE
|
||||
|
||||
PORT_START = 0
|
||||
PORT_END = 63
|
||||
PORTS_IN_BLOCK = (PORT_END + 1)
|
||||
IOM1_PORT_START = 0
|
||||
IOM2_PORT_START = 16
|
||||
IOM3_PORT_START = 32
|
||||
IOM4_PORT_START = 48
|
||||
|
||||
PORT_I2C_MAPPING = {}
|
||||
# 0th Index = i2cLine, 1st Index = EepromIdx in i2cLine
|
||||
EEPROM_I2C_MAPPING = {
|
||||
# IOM 1
|
||||
0: [6, 66], 1: [6, 67], 2: [6, 68], 3: [6, 69],
|
||||
4: [6, 70], 5: [6, 71], 6: [6, 72], 7: [6, 73],
|
||||
8: [6, 74], 9: [6, 75], 10: [6, 76], 11: [6, 77],
|
||||
12: [6, 78], 13: [6, 79], 14: [6, 80], 15: [6, 81],
|
||||
# IOM 2
|
||||
16: [8, 34], 17: [8, 35], 18: [8, 36], 19: [8, 37],
|
||||
20: [8, 38], 21: [8, 39], 22: [8, 40], 23: [8, 41],
|
||||
24: [8, 42], 25: [8, 43], 26: [8, 44], 27: [8, 45],
|
||||
28: [8, 46], 29: [8, 47], 30: [8, 48], 31: [8, 49],
|
||||
# IOM 3
|
||||
32: [7, 50], 33: [7, 51], 34: [7, 52], 35: [7, 53],
|
||||
36: [7, 54], 37: [7, 55], 38: [7, 56], 39: [7, 57],
|
||||
40: [7, 58], 41: [7, 59], 42: [7, 60], 43: [7, 61],
|
||||
44: [7, 62], 45: [7, 63], 46: [7, 64], 47: [7, 65],
|
||||
# IOM 4
|
||||
48: [9, 18], 49: [9, 19], 50: [9, 20], 51: [9, 21],
|
||||
52: [9, 22], 53: [9, 23], 54: [9, 24], 55: [9, 25],
|
||||
56: [9, 26], 57: [9, 27], 58: [9, 28], 59: [9, 29],
|
||||
60: [9, 30], 61: [9, 31], 62: [9, 32], 63: [9, 33]
|
||||
}
|
||||
|
||||
reset_reason_dict = {}
|
||||
reset_reason_dict[11] = ChassisBase.REBOOT_CAUSE_POWER_LOSS
|
||||
reset_reason_dict[33] = ChassisBase.REBOOT_CAUSE_WATCHDOG
|
||||
@ -94,6 +64,10 @@ class Chassis(ChassisBase):
|
||||
ChassisBase.__init__(self)
|
||||
# Initialize EEPROM
|
||||
self.sys_eeprom = Eeprom()
|
||||
for i in range(MAX_S6100_MODULE):
|
||||
module = Module(i)
|
||||
self._module_list.append(module)
|
||||
|
||||
for i in range(MAX_S6100_FAN):
|
||||
fan = Fan(i)
|
||||
self._fan_list.append(fan)
|
||||
@ -102,44 +76,15 @@ class Chassis(ChassisBase):
|
||||
psu = Psu(i)
|
||||
self._psu_list.append(psu)
|
||||
|
||||
for i in range(MAX_S6100_THERMAL):
|
||||
thermal = Thermal(i)
|
||||
self._thermal_list.append(thermal)
|
||||
|
||||
# Initialize component list
|
||||
self._component_name_list.append(COMPONENT_BIOS)
|
||||
self._component_name_list.append(SWITCH_CPLD)
|
||||
self._component_name_list.append(SMF_FPGA)
|
||||
|
||||
self._populate_port_i2c_mapping()
|
||||
|
||||
# sfp.py will read eeprom contents and retrive the eeprom data.
|
||||
# It will also provide support sfp controls like reset and setting
|
||||
# low power mode.
|
||||
# We pass the eeprom path and sfp control path from chassis.py
|
||||
# So that sfp.py implementation can be generic to all platforms
|
||||
eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/i2c-{1}/{1}-0050/eeprom"
|
||||
sfp_ctrl_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-003e/"
|
||||
for index in range(0, self.PORTS_IN_BLOCK):
|
||||
eeprom_path = eeprom_base.format(self.EEPROM_I2C_MAPPING[index][0],
|
||||
self.EEPROM_I2C_MAPPING[index][1])
|
||||
sfp_control = sfp_ctrl_base.format(self.PORT_I2C_MAPPING[index])
|
||||
sfp_node = Sfp(index, 'QSFP', eeprom_path, sfp_control, index)
|
||||
self._sfp_list.append(sfp_node)
|
||||
|
||||
def _populate_port_i2c_mapping(self):
|
||||
# port_num and i2c match
|
||||
for port_num in range(0, self.PORTS_IN_BLOCK):
|
||||
if((port_num >= self.IOM1_PORT_START) and
|
||||
(port_num < self.IOM2_PORT_START)):
|
||||
i2c_line = 14
|
||||
elif((port_num >= self.IOM2_PORT_START) and
|
||||
(port_num < self.IOM3_PORT_START)):
|
||||
i2c_line = 16
|
||||
elif((port_num >= self.IOM3_PORT_START) and
|
||||
(port_num <self.IOM4_PORT_START)):
|
||||
i2c_line = 15
|
||||
elif((port_num >= self.IOM4_PORT_START) and
|
||||
(port_num < self.PORTS_IN_BLOCK)):
|
||||
i2c_line = 17
|
||||
self.PORT_I2C_MAPPING[port_num] = i2c_line
|
||||
|
||||
def _get_pmc_register(self, reg_name):
|
||||
# On successful read, returns the value read from given
|
||||
# reg_name and on failure returns 'ERR'
|
||||
@ -241,6 +186,7 @@ class Chassis(ChassisBase):
|
||||
OCP ONIE TlvInfo EEPROM format and values are their corresponding
|
||||
values.
|
||||
"""
|
||||
return self.sys_eeprom.system_eeprom_info()
|
||||
|
||||
def get_reboot_cause(self):
|
||||
"""
|
||||
|
@ -21,11 +21,42 @@ class Eeprom(eeprom_tlvinfo.TlvInfoDecoder):
|
||||
def __init__(self):
|
||||
self.eeprom_path = "/sys/class/i2c-adapter/i2c-2/2-0050/eeprom"
|
||||
super(Eeprom, self).__init__(self.eeprom_path, 0, '', True)
|
||||
self.eeprom_tlv_dict = dict()
|
||||
try:
|
||||
self.eeprom_data = self.read_eeprom()
|
||||
except:
|
||||
self.eeprom_data = "N/A"
|
||||
raise RuntimeError("Eeprom is not Programmed")
|
||||
else:
|
||||
eeprom = self.eeprom_data
|
||||
|
||||
if not self.is_valid_tlvinfo_header(eeprom):
|
||||
return
|
||||
|
||||
total_length = (ord(eeprom[9]) << 8) | ord(eeprom[10])
|
||||
tlv_index = self._TLV_INFO_HDR_LEN
|
||||
tlv_end = self._TLV_INFO_HDR_LEN + total_length
|
||||
|
||||
while (tlv_index + 2) < len(eeprom) and tlv_index < tlv_end:
|
||||
if not self.is_valid_tlv(eeprom[tlv_index:]):
|
||||
break
|
||||
|
||||
tlv = eeprom[tlv_index:tlv_index + 2
|
||||
+ ord(eeprom[tlv_index + 1])]
|
||||
code = "0x%02X" % (ord(tlv[0]))
|
||||
|
||||
if ord(tlv[0]) == self._TLV_CODE_VENDOR_EXT:
|
||||
value = str((ord(tlv[2]) << 24) | (ord(tlv[3]) << 16) |
|
||||
(ord(tlv[4]) << 8) | ord(tlv[5]))
|
||||
value += str(tlv[6:6 + ord(tlv[1])])
|
||||
else:
|
||||
name, value = self.decoder(None, tlv)
|
||||
|
||||
self.eeprom_tlv_dict[code] = value
|
||||
if ord(eeprom[tlv_index]) == self._TLV_CODE_CRC_32:
|
||||
break
|
||||
|
||||
tlv_index += ord(eeprom[tlv_index+1]) + 2
|
||||
|
||||
|
||||
def serial_number_str(self):
|
||||
@ -76,3 +107,10 @@ class Eeprom(eeprom_tlvinfo.TlvInfoDecoder):
|
||||
|
||||
return results[2]
|
||||
|
||||
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_tlv_dict
|
||||
|
@ -26,7 +26,7 @@ class Fan(FanBase):
|
||||
HWMON_NODE = os.listdir(HWMON_DIR)[0]
|
||||
MAILBOX_DIR = HWMON_DIR + HWMON_NODE
|
||||
|
||||
def __init__(self, fantray_index, fan_index=1, psu_fan=False):
|
||||
def __init__(self, fantray_index=1, fan_index=1, psu_fan=False):
|
||||
self.is_psu_fan = psu_fan
|
||||
if not self.is_psu_fan:
|
||||
# API index is starting from 0, DellEMC platform index is starting
|
||||
@ -74,7 +74,7 @@ class Fan(FanBase):
|
||||
return "FanTray{}-Fan{}".format(
|
||||
self.fantrayindex, self.fanindex - 1)
|
||||
else:
|
||||
return "PSU{} Fan".format(self.index - 10)
|
||||
return "PSU{} Fan".format(self.fanindex - 10)
|
||||
|
||||
def get_model(self):
|
||||
"""
|
||||
@ -221,7 +221,7 @@ class Fan(FanBase):
|
||||
else:
|
||||
return self.STATUS_LED_COLOR_OFF
|
||||
|
||||
def get_target_speed(self):
|
||||
def get_target_speed(self):
|
||||
"""
|
||||
Retrieves the target (expected) speed of the fan
|
||||
Returns:
|
||||
|
@ -0,0 +1,226 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
########################################################################
|
||||
# DellEMC S6100
|
||||
#
|
||||
# Module contains an implementation of SONiC Platform Base API and
|
||||
# provides the Modules' information which are available in the platform
|
||||
#
|
||||
########################################################################
|
||||
|
||||
|
||||
try:
|
||||
import os
|
||||
from sonic_platform_base.module_base import ModuleBase
|
||||
from sonic_platform.sfp import Sfp
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
class Module(ModuleBase):
|
||||
"""DellEMC Platform-specific Module class"""
|
||||
|
||||
HWMON_DIR = "/sys/devices/platform/SMF.512/hwmon/"
|
||||
HWMON_NODE = os.listdir(HWMON_DIR)[0]
|
||||
MAILBOX_DIR = HWMON_DIR + HWMON_NODE
|
||||
|
||||
IOM_I2C_MAPPING = { 1: 14, 2: 16, 3: 15, 4: 17 }
|
||||
EEPROM_I2C_MAPPING = {
|
||||
# IOM 1
|
||||
0: [6, 66], 1: [6, 67], 2: [6, 68], 3: [6, 69],
|
||||
4: [6, 70], 5: [6, 71], 6: [6, 72], 7: [6, 73],
|
||||
8: [6, 74], 9: [6, 75], 10: [6, 76], 11: [6, 77],
|
||||
12: [6, 78], 13: [6, 79], 14: [6, 80], 15: [6, 81],
|
||||
# IOM 2
|
||||
16: [8, 34], 17: [8, 35], 18: [8, 36], 19: [8, 37],
|
||||
20: [8, 38], 21: [8, 39], 22: [8, 40], 23: [8, 41],
|
||||
24: [8, 42], 25: [8, 43], 26: [8, 44], 27: [8, 45],
|
||||
28: [8, 46], 29: [8, 47], 30: [8, 48], 31: [8, 49],
|
||||
# IOM 3
|
||||
32: [7, 50], 33: [7, 51], 34: [7, 52], 35: [7, 53],
|
||||
36: [7, 54], 37: [7, 55], 38: [7, 56], 39: [7, 57],
|
||||
40: [7, 58], 41: [7, 59], 42: [7, 60], 43: [7, 61],
|
||||
44: [7, 62], 45: [7, 63], 46: [7, 64], 47: [7, 65],
|
||||
# IOM 4
|
||||
48: [9, 18], 49: [9, 19], 50: [9, 20], 51: [9, 21],
|
||||
52: [9, 22], 53: [9, 23], 54: [9, 24], 55: [9, 25],
|
||||
56: [9, 26], 57: [9, 27], 58: [9, 28], 59: [9, 29],
|
||||
60: [9, 30], 61: [9, 31], 62: [9, 32], 63: [9, 33]
|
||||
}
|
||||
|
||||
def __init__(self, module_index):
|
||||
# Modules are 1-based in DellEMC platforms
|
||||
self.index = module_index + 1
|
||||
self.port_start = (self.index - 1) * 16
|
||||
self.port_end = (self.index * 16) - 1
|
||||
self.port_i2c_line = self.IOM_I2C_MAPPING[self.index]
|
||||
self._component_name_list = ['CPLD']
|
||||
self.eeprom_tlv_dict = dict()
|
||||
|
||||
self.iom_status_reg = "iom_status"
|
||||
self.iom_presence_reg = "iom_presence"
|
||||
|
||||
# Overriding _sfp_list class variable defined in ModuleBase, to
|
||||
# make it unique per Module object
|
||||
self._sfp_list = []
|
||||
|
||||
eeprom_base = "/sys/class/i2c-adapter/i2c-{0}/i2c-{1}/{1}-0050/eeprom"
|
||||
sfp_ctrl_base = "/sys/class/i2c-adapter/i2c-{0}/{0}-003e/"
|
||||
|
||||
# sfp.py will read eeprom contents and retrive the eeprom data.
|
||||
# It will also provide support sfp controls like reset and setting
|
||||
# low power mode.
|
||||
for index in range(self.port_start, self.port_end + 1):
|
||||
eeprom_path = eeprom_base.format(self.EEPROM_I2C_MAPPING[index][0],
|
||||
self.EEPROM_I2C_MAPPING[index][1])
|
||||
sfp_control = sfp_ctrl_base.format(self.port_i2c_line)
|
||||
sfp_node = Sfp(index, 'QSFP', eeprom_path, sfp_control, index)
|
||||
self._sfp_list.append(sfp_node)
|
||||
|
||||
def _get_pmc_register(self, reg_name):
|
||||
# On successful read, returns the value read from given
|
||||
# reg_name and on failure returns 'ERR'
|
||||
rv = 'ERR'
|
||||
mb_reg_file = self.MAILBOX_DIR + '/' + reg_name
|
||||
|
||||
if (not os.path.isfile(mb_reg_file)):
|
||||
return rv
|
||||
|
||||
try:
|
||||
with open(mb_reg_file, 'r') as fd:
|
||||
rv = fd.read()
|
||||
except Exception as error:
|
||||
rv = 'ERR'
|
||||
|
||||
rv = rv.rstrip('\r\n')
|
||||
rv = rv.lstrip(" ")
|
||||
return rv
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the name of the device
|
||||
|
||||
Returns:
|
||||
string: The name of the device
|
||||
"""
|
||||
return "IOM{}: 16xQSFP+".format(self.index)
|
||||
|
||||
def get_presence(self):
|
||||
"""
|
||||
Retrieves the presence of the Module
|
||||
|
||||
Returns:
|
||||
bool: True if Module is present, False if not
|
||||
"""
|
||||
status = False
|
||||
iom_presence = self._get_pmc_register(self.iom_presence_reg)
|
||||
if (iom_presence != 'ERR'):
|
||||
iom_presence = int(iom_presence,16)
|
||||
if (~iom_presence & (1 << (self.index - 1))):
|
||||
status = True
|
||||
|
||||
return status
|
||||
|
||||
def get_model(self):
|
||||
"""
|
||||
Retrieves the part number of the module
|
||||
|
||||
Returns:
|
||||
string: part number of module
|
||||
"""
|
||||
return 'NA'
|
||||
|
||||
def get_serial(self):
|
||||
"""
|
||||
Retrieves the serial number of the module
|
||||
|
||||
Returns:
|
||||
string: Serial number of module
|
||||
"""
|
||||
return 'NA'
|
||||
|
||||
def get_status(self):
|
||||
"""
|
||||
Retrieves the operational status of the Module
|
||||
|
||||
Returns:
|
||||
bool: True if Module is operating properly, False if not
|
||||
"""
|
||||
status = False
|
||||
iom_status = self._get_pmc_register(self.iom_status_reg)
|
||||
if (iom_status != 'ERR'):
|
||||
iom_status = int(iom_status,16)
|
||||
if (~iom_status & (1 << (self.index - 1))):
|
||||
status = True
|
||||
|
||||
return status
|
||||
|
||||
def get_base_mac(self):
|
||||
"""
|
||||
Retrieves the base MAC address for the module
|
||||
|
||||
Returns:
|
||||
A string containing the MAC address in the format
|
||||
'XX:XX:XX:XX:XX:XX'
|
||||
"""
|
||||
# In S6100, individual modules doesn't have MAC address
|
||||
return '00:00:00:00:00:00'
|
||||
|
||||
def get_serial_number(self):
|
||||
"""
|
||||
Retrieves the hardware serial number for the module
|
||||
|
||||
Returns:
|
||||
A string containing the hardware serial number for this module.
|
||||
"""
|
||||
return 'NA'
|
||||
|
||||
def get_system_eeprom_info(self):
|
||||
"""
|
||||
Retrieves the full content of system EEPROM information for the module
|
||||
|
||||
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_tlv_dict
|
||||
|
||||
def get_firmware_version(self, component_name):
|
||||
"""
|
||||
Retrieves platform-specific hardware/firmware versions for module
|
||||
componenets such as BIOS, CPLD, FPGA, etc.
|
||||
|
||||
Args:
|
||||
component_name: A string, the component name.
|
||||
|
||||
Returns:
|
||||
A string containing platform-specific component versions
|
||||
"""
|
||||
if component_name == 'CPLD':
|
||||
cpld_version_file = ("/sys/class/i2c-adapter/i2c-{0}/{0}-003e/"
|
||||
"iom_cpld_vers").format(self.port_i2c_line)
|
||||
|
||||
if (not os.path.isfile(cpld_version_file)):
|
||||
return 'NA'
|
||||
|
||||
try:
|
||||
with open(cpld_version_file, 'r') as fd:
|
||||
ver_str = fd.read()
|
||||
except Exception as error:
|
||||
return 'NA'
|
||||
|
||||
if ver_str == 'read error':
|
||||
return 'NA'
|
||||
|
||||
ver_str = ver_str.rstrip('\r\n')
|
||||
cpld_version = int(ver_str.split(':')[1], 16)
|
||||
major_version = (cpld_version & 0xF0) >> 4
|
||||
minor_version = cpld_version & 0xF
|
||||
|
||||
return "%d.%d" % (major_version, minor_version)
|
||||
else:
|
||||
return 'NA'
|
@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
########################################################################
|
||||
# DellEMC
|
||||
# DellEMC S6100
|
||||
#
|
||||
# Module contains an implementation of SONiC Platform Base API and
|
||||
# provides the PSUs' information which are available in the platform
|
||||
@ -43,10 +43,10 @@ class Psu(PsuBase):
|
||||
self._fan_list = []
|
||||
|
||||
# Passing True to specify it is a PSU fan
|
||||
psu_fan = Fan(self.index, True)
|
||||
psu_fan = Fan(fan_index=self.index, psu_fan=True)
|
||||
self._fan_list.append(psu_fan)
|
||||
|
||||
def get_pmc_register(self, reg_name):
|
||||
def _get_pmc_register(self, reg_name):
|
||||
# On successful read, returns the value read from given
|
||||
# reg_name and on failure returns 'ERR'
|
||||
rv = 'ERR'
|
||||
@ -82,7 +82,7 @@ class Psu(PsuBase):
|
||||
bool: True if PSU is present, False if not
|
||||
"""
|
||||
status = False
|
||||
psu_presence = self.get_pmc_register(self.psu_presence_reg)
|
||||
psu_presence = self._get_pmc_register(self.psu_presence_reg)
|
||||
if (psu_presence != 'ERR'):
|
||||
psu_presence = int(psu_presence, 16)
|
||||
# Checking whether bit 0 is not set
|
||||
@ -100,7 +100,7 @@ class Psu(PsuBase):
|
||||
"""
|
||||
# For Serial number "US-01234D-54321-25A-0123-A00", the part
|
||||
# number is "01234D"
|
||||
psu_serialno = self.get_pmc_register(self.psu_serialno_reg)
|
||||
psu_serialno = self._get_pmc_register(self.psu_serialno_reg)
|
||||
if (psu_serialno != 'ERR') and self.get_presence():
|
||||
if (len(psu_serialno.split('-')) > 1):
|
||||
psu_partno = psu_serialno.split('-')[1]
|
||||
@ -119,7 +119,7 @@ class Psu(PsuBase):
|
||||
string: Serial number of PSU
|
||||
"""
|
||||
# Sample Serial number format "US-01234D-54321-25A-0123-A00"
|
||||
psu_serialno = self.get_pmc_register(self.psu_serialno_reg)
|
||||
psu_serialno = self._get_pmc_register(self.psu_serialno_reg)
|
||||
if (psu_serialno == 'ERR') or not self.get_presence():
|
||||
psu_serialno = 'NA'
|
||||
|
||||
@ -133,7 +133,7 @@ class Psu(PsuBase):
|
||||
bool: True if PSU is operating properly, False if not
|
||||
"""
|
||||
status = False
|
||||
psu_status = self.get_pmc_register(self.psu_presence_reg)
|
||||
psu_status = self._get_pmc_register(self.psu_presence_reg)
|
||||
if (psu_status != 'ERR'):
|
||||
psu_status = int(psu_status, 16)
|
||||
# Checking whether both bit 3 and bit 2 are not set
|
||||
@ -150,7 +150,7 @@ class Psu(PsuBase):
|
||||
A float number, the output voltage in volts,
|
||||
e.g. 12.1
|
||||
"""
|
||||
psu_voltage = self.get_pmc_register(self.psu_voltage_reg)
|
||||
psu_voltage = self._get_pmc_register(self.psu_voltage_reg)
|
||||
if (psu_voltage != 'ERR') and self.get_presence():
|
||||
# Converting the value returned by driver which is in
|
||||
# millivolts to volts
|
||||
@ -168,7 +168,7 @@ class Psu(PsuBase):
|
||||
A float number, electric current in amperes,
|
||||
e.g. 15.4
|
||||
"""
|
||||
psu_current = self.get_pmc_register(self.psu_current_reg)
|
||||
psu_current = self._get_pmc_register(self.psu_current_reg)
|
||||
if (psu_current != 'ERR') and self.get_presence():
|
||||
# Converting the value returned by driver which is in
|
||||
# milliamperes to amperes
|
||||
@ -186,7 +186,7 @@ class Psu(PsuBase):
|
||||
A float number, the power in watts,
|
||||
e.g. 302.6
|
||||
"""
|
||||
psu_power = self.get_pmc_register(self.psu_power_reg)
|
||||
psu_power = self._get_pmc_register(self.psu_power_reg)
|
||||
if (psu_power != 'ERR') and self.get_presence():
|
||||
# Converting the value returned by driver which is in
|
||||
# microwatts to watts
|
||||
@ -196,7 +196,33 @@ class Psu(PsuBase):
|
||||
|
||||
return psu_power
|
||||
|
||||
def set_status_led(self):
|
||||
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.
|
||||
"""
|
||||
status = False
|
||||
if self.get_status() and self._fan_list[0].get_status():
|
||||
status = True
|
||||
|
||||
return status
|
||||
|
||||
def get_status_led(self):
|
||||
"""
|
||||
Gets the state of the PSU status LED
|
||||
|
||||
Returns:
|
||||
A string, one of the predefined STATUS_LED_COLOR_* strings.
|
||||
"""
|
||||
if self.get_powergood_status():
|
||||
return self.STATUS_LED_COLOR_GREEN
|
||||
else:
|
||||
return self.STATUS_LED_COLOR_OFF
|
||||
|
||||
def set_status_led(self, color):
|
||||
"""
|
||||
Sets the state of the PSU status LED
|
||||
Args:
|
||||
|
@ -0,0 +1,209 @@
|
||||
#!/usr/bin/env python
|
||||
|
||||
########################################################################
|
||||
# DellEMC S6100
|
||||
#
|
||||
# Module contains an implementation of SONiC Platform Base API and
|
||||
# provides the Thermals' information which are available in the platform
|
||||
#
|
||||
########################################################################
|
||||
|
||||
|
||||
try:
|
||||
import os
|
||||
from sonic_platform_base.thermal_base import ThermalBase
|
||||
except ImportError as e:
|
||||
raise ImportError(str(e) + "- required module not found")
|
||||
|
||||
|
||||
class Thermal(ThermalBase):
|
||||
"""DellEMC Platform-specific Thermal class"""
|
||||
|
||||
THERMAL_NAME = (
|
||||
'CPU On-board', 'ASIC On-board Front', 'System Front',
|
||||
'ASIC On-board Rear', 'Front GE board', 'Front SFP+ board',
|
||||
'CPU Core 0', 'CPU Core 1', 'CPU Core 2', 'CPU Core 3'
|
||||
)
|
||||
|
||||
def __init__(self, thermal_index):
|
||||
self.is_cpu_thermal = False
|
||||
self.index = thermal_index + 1
|
||||
|
||||
if self.index < 7:
|
||||
if self.index < 5:
|
||||
hwmon_temp_index = self.index
|
||||
else:
|
||||
hwmon_temp_index = self.index + 5
|
||||
|
||||
dev_path = "/sys/devices/platform/SMF.512/hwmon/"
|
||||
else:
|
||||
hwmon_temp_index = self.index - 5
|
||||
self.is_cpu_thermal = True
|
||||
dev_path = "/sys/devices/platform/coretemp.0/hwmon/"
|
||||
|
||||
hwmon_node = os.listdir(dev_path)[0]
|
||||
self.HWMON_DIR = dev_path + hwmon_node + '/'
|
||||
|
||||
self.thermal_status_file = self.HWMON_DIR \
|
||||
+ "temp{}_alarm".format(hwmon_temp_index)
|
||||
self.thermal_temperature_file = self.HWMON_DIR \
|
||||
+ "temp{}_input".format(hwmon_temp_index)
|
||||
self.thermal_high_threshold_file = self.HWMON_DIR \
|
||||
+ "temp{}_crit".format(hwmon_temp_index)
|
||||
self.thermal_low_threshold_file = self.HWMON_DIR \
|
||||
+ "temp{}_min".format(hwmon_temp_index)
|
||||
|
||||
def _read_sysfs_file(self, sysfs_file):
|
||||
# On successful read, returns the value read from given
|
||||
# sysfs_file and on failure returns 'ERR'
|
||||
rv = 'ERR'
|
||||
|
||||
if (not os.path.isfile(sysfs_file)):
|
||||
return rv
|
||||
|
||||
try:
|
||||
with open(sysfs_file, 'r') as fd:
|
||||
rv = fd.read()
|
||||
except Exception as error:
|
||||
rv = 'ERR'
|
||||
|
||||
rv = rv.rstrip('\r\n')
|
||||
rv = rv.lstrip(" ")
|
||||
return rv
|
||||
|
||||
def get_name(self):
|
||||
"""
|
||||
Retrieves the name of the thermal
|
||||
|
||||
Returns:
|
||||
string: The name of the thermal
|
||||
"""
|
||||
return self.THERMAL_NAME[self.index - 1]
|
||||
|
||||
def get_presence(self):
|
||||
"""
|
||||
Retrieves the presence of the thermal
|
||||
|
||||
Returns:
|
||||
bool: True if thermal is present, False if not
|
||||
"""
|
||||
return True
|
||||
|
||||
def get_model(self):
|
||||
"""
|
||||
Retrieves the model number (or part number) of the Thermal
|
||||
|
||||
Returns:
|
||||
string: Model/part number of Thermal
|
||||
"""
|
||||
return 'NA'
|
||||
|
||||
def get_serial(self):
|
||||
"""
|
||||
Retrieves the serial number of the Thermal
|
||||
|
||||
Returns:
|
||||
string: Serial number of Thermal
|
||||
"""
|
||||
return 'NA'
|
||||
|
||||
def get_status(self):
|
||||
"""
|
||||
Retrieves the operational status of the thermal
|
||||
|
||||
Returns:
|
||||
A boolean value, True if thermal is operating properly,
|
||||
False if not
|
||||
"""
|
||||
status = False
|
||||
if self.is_cpu_thermal:
|
||||
status = True
|
||||
else:
|
||||
thermal_status = self._read_sysfs_file(self.thermal_status_file)
|
||||
if (thermal_status != 'ERR'):
|
||||
thermal_status = int(thermal_status, 16)
|
||||
if thermal_status != 5:
|
||||
status = True
|
||||
|
||||
return status
|
||||
|
||||
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
|
||||
"""
|
||||
thermal_temperature = self._read_sysfs_file(
|
||||
self.thermal_temperature_file)
|
||||
if (thermal_temperature != 'ERR'):
|
||||
thermal_temperature = float(thermal_temperature) / 1000
|
||||
else:
|
||||
thermal_temperature = 0
|
||||
|
||||
return "{:.3f}".format(thermal_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
|
||||
"""
|
||||
thermal_high_threshold = self._read_sysfs_file(
|
||||
self.thermal_high_threshold_file)
|
||||
if (thermal_high_threshold != 'ERR'):
|
||||
thermal_high_threshold = float(thermal_high_threshold) / 1000
|
||||
else:
|
||||
thermal_high_threshold = 0
|
||||
|
||||
return "{:.3f}".format(thermal_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
|
||||
"""
|
||||
thermal_low_threshold = self._read_sysfs_file(
|
||||
self.thermal_low_threshold_file)
|
||||
if (thermal_low_threshold != 'ERR'):
|
||||
thermal_low_threshold = float(thermal_low_threshold) / 1000
|
||||
else:
|
||||
thermal_low_threshold = 0
|
||||
|
||||
return "{:.3f}".format(thermal_low_threshold)
|
||||
|
||||
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
|
||||
"""
|
||||
# Thermal threshold values are pre-defined based on HW.
|
||||
return False
|
||||
|
||||
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
|
||||
"""
|
||||
# Thermal threshold values are pre-defined based on HW.
|
||||
return False
|
@ -90,9 +90,10 @@ switch_board_modsel() {
|
||||
init_switch_port_led() {
|
||||
device="/usr/share/sonic/device"
|
||||
platform=$(/usr/local/bin/sonic-cfggen -H -v DEVICE_METADATA.localhost.platform)
|
||||
hwsku=$(cat /etc/sonic/config_db.json | grep "hwsku" | cut -d ":" -f2 | sed 's/"//g' | sed 's/,//g'| xargs )
|
||||
hwsku=$(cat /etc/sonic/config_db.json | grep -A10 "DEVICE_METADATA" | grep "hwsku" | cut -d ":" -f2 | sed 's/"//g' | sed 's/,//g'| xargs )
|
||||
|
||||
led_proc_init="$device/$platform/$hwsku/led_proc_init.soc"
|
||||
|
||||
# Remove old HWSKU LED file..
|
||||
rm -rf $device/$platform/led_proc_init.soc
|
||||
|
||||
|
@ -1,2 +1,2 @@
|
||||
obj-m:=x86-64-juniper-qfx5210-64x-fan.o x86-64-juniper-qfx5210-64x-sfp.o x86-64-juniper-qfx5210-64x-leds.o \
|
||||
obj-m:=x86-64-juniper-qfx5210-64x-fan.o x86-64-juniper-qfx5210-64x-leds.o \
|
||||
x86-64-juniper-qfx5210-64x-psu.o juniper_i2c_cpld.o ym2651y.o
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*
|
||||
* An hwmon driver for juniper qfx5210_64x Power Module
|
||||
*
|
||||
* Tested and validated on Juniper QFX5210
|
||||
* Modified and tested on Juniper QFX5210
|
||||
* Ciju Rajan K <crajank@juniper.net>
|
||||
*
|
||||
* Copyright (C) 2014 Accton Technology Corporation.
|
||||
@ -103,6 +103,30 @@ static const struct attribute_group qfx5210_64x_psu_group = {
|
||||
.attrs = qfx5210_64x_psu_attributes,
|
||||
};
|
||||
|
||||
/*
|
||||
* This function is defined in juniper_i2c_cpld.c
|
||||
*/
|
||||
extern int juniper_i2c_cpld_write(unsigned short, u8, u8);
|
||||
|
||||
/*
|
||||
* QFX5210 power off sequence
|
||||
*/
|
||||
static void qfx5210_cpld_power_off(void)
|
||||
{
|
||||
printk(KERN_ALERT "pm_power_off: qfx5210_cpld_power_off\n");
|
||||
(void) juniper_i2c_cpld_write(0x65, 0x14, 0x00);
|
||||
msleep(100);
|
||||
(void) juniper_i2c_cpld_write(0x77, 0x00, 0x01);
|
||||
msleep(100);
|
||||
(void) juniper_i2c_cpld_write(0x76, 0x00, 0x04);
|
||||
}
|
||||
|
||||
/*
|
||||
* Default platform pm_power_off handler
|
||||
*/
|
||||
static void (*default_pm_power_off)(void);
|
||||
|
||||
|
||||
static int qfx5210_64x_psu_probe(struct i2c_client *client,
|
||||
const struct i2c_device_id *dev_id)
|
||||
{
|
||||
@ -141,7 +165,12 @@ static int qfx5210_64x_psu_probe(struct i2c_client *client,
|
||||
|
||||
dev_info(&client->dev, "%s: psu '%s'\n",
|
||||
dev_name(data->hwmon_dev), client->name);
|
||||
|
||||
/*
|
||||
* Store the default poweroff handler for later usage
|
||||
*/
|
||||
default_pm_power_off = pm_power_off;
|
||||
pm_power_off = qfx5210_cpld_power_off;
|
||||
|
||||
return 0;
|
||||
|
||||
exit_remove:
|
||||
@ -161,6 +190,11 @@ static int qfx5210_64x_psu_remove(struct i2c_client *client)
|
||||
sysfs_remove_group(&client->dev.kobj, &qfx5210_64x_psu_group);
|
||||
kfree(data);
|
||||
|
||||
/*
|
||||
* Restore the poweroff handler
|
||||
*/
|
||||
pm_power_off = default_pm_power_off;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -56,8 +56,6 @@ args = []
|
||||
ALL_DEVICE = {}
|
||||
DEVICE_NO = {'led':4, 'fan':4,'thermal':6, 'psu':2, 'sfp':64}
|
||||
FORCE = 0
|
||||
#logging.basicConfig(filename= PROJECT_NAME+'.log', filemode='w',level=logging.DEBUG)
|
||||
#logging.basicConfig(level=logging.INFO)
|
||||
|
||||
|
||||
if DEBUG == True:
|
||||
@ -124,6 +122,7 @@ def main():
|
||||
print 'Error: Execution of "%s" failed', DisableWatchDogCmd
|
||||
return False
|
||||
|
||||
|
||||
CPUeepromFileCmd = 'cat /sys/devices/pci0000:00/0000:00:1f.3/i2c-0/0-0056/eeprom > /etc/init.d/eeprom_qfx5210_ascii'
|
||||
# Write the contents of CPU EEPROM to file
|
||||
try:
|
||||
@ -178,11 +177,11 @@ def driver_check():
|
||||
|
||||
kos = [
|
||||
'modprobe i2c_dev',
|
||||
'modprobe i2c_mux_pca954x',
|
||||
'modprobe i2c_mux_pca954x force_deselect_on_exit=1',
|
||||
'modprobe optoe',
|
||||
'modprobe juniper_i2c_cpld' ,
|
||||
'modprobe ym2651y' ,
|
||||
'modprobe x86-64-juniper-qfx5210-64x-fan' ,
|
||||
'modprobe x86-64-juniper-qfx5210-64x-sfp' ,
|
||||
'modprobe x86-64-juniper-qfx5210-64x-leds' ,
|
||||
'modprobe x86-64-juniper-qfx5210-64x-psu' ]
|
||||
|
||||
@ -220,7 +219,7 @@ i2c_bus = {'fan': ['17-0068'] ,
|
||||
i2c_nodes = {'fan': ['present', 'front_speed_rpm', 'rear_speed_rpm'] ,
|
||||
'thermal': ['hwmon/hwmon*/temp1_input'] ,
|
||||
'psu': ['psu_present ', 'psu_power_good'] ,
|
||||
'sfp': ['sfp_is_present ', 'sfp_tx_disable']}
|
||||
'sfp': ['sfp_is_present ', 'module_present']}
|
||||
|
||||
sfp_map = [37,38,39,40,42,41,44,43,33,34,35,36,45,46,47,48,49,50,51,52,
|
||||
61,62,63,64,53,54,55,56,57,58,59,60,69,70,71,72,77,78,79,80,65,
|
||||
@ -274,11 +273,17 @@ def device_install():
|
||||
return status
|
||||
|
||||
for i in range(0,len(sfp_map)):
|
||||
status, output =log_os_system("echo qfx5210_64x_port"+str(i+1)+" 0x50 > /sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device", 1)
|
||||
path = "/sys/bus/i2c/devices/i2c-"+str(sfp_map[i])+"/new_device"
|
||||
status, output =log_os_system("echo optoe1 0x50 > " + path, 1)
|
||||
if status:
|
||||
print output
|
||||
if FORCE == 0:
|
||||
return status
|
||||
return status
|
||||
status, output =log_os_system("echo Port"+str(i)+" > /sys/bus/i2c/devices/"+str(sfp_map[i])+"-0050/port_name", 1)
|
||||
if status:
|
||||
print output
|
||||
if FORCE == 0:
|
||||
return status
|
||||
return
|
||||
|
||||
def device_uninstall():
|
||||
@ -381,7 +386,8 @@ def devices_info():
|
||||
elif 'sfp' == key:
|
||||
for k in range(0,DEVICE_NO[key]):
|
||||
node = key+str(k+1)
|
||||
path = i2c_prefix+ str(sfp_map[k])+ buses[i]+"/"+ nodes[j]
|
||||
fmt = i2c_prefix+"19-0060/{0}_{1}"
|
||||
path = fmt.format(nodes[j], k+1)
|
||||
my_log(node+": "+ path)
|
||||
ALL_DEVICE[key][node].append(path)
|
||||
else:
|
||||
@ -416,10 +422,8 @@ def show_eeprom(index):
|
||||
print("Please install first!")
|
||||
return
|
||||
|
||||
if len(ALL_DEVICE)==0:
|
||||
devices_info()
|
||||
node = ALL_DEVICE['sfp'] ['sfp'+str(index)][0]
|
||||
node = node.replace(node.split("/")[-1], 'sfp_eeprom')
|
||||
i = int(index)-1
|
||||
node = i2c_prefix+ str(sfp_map[i])+ i2c_bus['sfp'][0]+"/"+ 'eeprom'
|
||||
# check if got hexdump command in current environment
|
||||
ret, log = log_os_system("which hexdump", 0)
|
||||
ret, log2 = log_os_system("which busybox hexdump", 0)
|
||||
@ -434,7 +438,7 @@ def show_eeprom(index):
|
||||
return 1
|
||||
|
||||
print node + ":"
|
||||
ret, log = log_os_system("cat "+node+"| "+hex_cmd+" -C", 1)
|
||||
ret, log = log_os_system(hex_cmd +" -C "+node, 1)
|
||||
if ret==0:
|
||||
print log
|
||||
else:
|
||||
|
7
platform/marvell-arm64/docker-ptf-mrvl.mk
Normal file
7
platform/marvell-arm64/docker-ptf-mrvl.mk
Normal file
@ -0,0 +1,7 @@
|
||||
# docker image for docker-ptf-mrvl
|
||||
|
||||
DOCKER_PTF_MRVL = docker-ptf-mrvl.gz
|
||||
$(DOCKER_PTF_MRVL)_PATH = $(DOCKERS_PATH)/docker-ptf-saithrift
|
||||
$(DOCKER_PTF_MRVL)_DEPENDS += $(PYTHON_SAITHRIFT)
|
||||
$(DOCKER_PTF_MRVL)_LOAD_DOCKERS += $(DOCKER_PTF)
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_PTF_MRVL)
|
15
platform/marvell-arm64/docker-saiserver-mrvl.mk
Normal file
15
platform/marvell-arm64/docker-saiserver-mrvl.mk
Normal file
@ -0,0 +1,15 @@
|
||||
# docker image for mrvl saiserver
|
||||
|
||||
DOCKER_SAISERVER_MRVL = docker-saiserver-mrvl.gz
|
||||
$(DOCKER_SAISERVER_MRVL)_PATH = $(PLATFORM_PATH)/docker-saiserver-mrvl
|
||||
$(DOCKER_SAISERVER_MRVL)_DEPENDS += $(SAISERVER)
|
||||
$(DOCKER_SAISERVER_MRVL)_FILES += $(DSSERVE) $(BCMCMD)
|
||||
$(DOCKER_SAISERVER_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_SAISERVER_MRVL)
|
||||
|
||||
$(DOCKER_SAISERVER_MRVL)_CONTAINER_NAME = saiserver
|
||||
$(DOCKER_SAISERVER_MRVL)_RUN_OPT += --net=host --privileged -t
|
||||
$(DOCKER_SAISERVER_MRVL)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
|
||||
$(DOCKER_SAISERVER_MRVL)_RUN_OPT += -v /var/run/docker-saiserver:/var/run/sswsyncd
|
||||
$(DOCKER_SAISERVER_MRVL)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
$(DOCKER_SAISERVER_MRVL)_RUN_OPT += -v /host/warmboot:/var/warmboot
|
@ -9,8 +9,9 @@ $(DOCKER_SYNCD_MRVL_RPC)_DEPENDS += $(SYNCD_RPC_DBG) \
|
||||
$(LIBSAIMETADATA_DBG) \
|
||||
$(LIBSAIREDIS_DBG)
|
||||
endif
|
||||
$(DOCKER_SYNCD_MRVL_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_MRVL)
|
||||
$(DOCKER_SYNCD_MRVL_RPC)_LOAD_DOCKERS += $(DOCKER_SYNCD_BASE)
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC)
|
||||
SONIC_STRETCH_DOCKERS += $(DOCKER_SYNCD_MRVL_RPC)
|
||||
ifeq ($(ENABLE_SYNCD_RPC),y)
|
||||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL_RPC)
|
||||
endif
|
||||
@ -19,3 +20,4 @@ $(DOCKER_SYNCD_MRVL_RPC)_CONTAINER_NAME = syncd
|
||||
$(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += --net=host --privileged -t
|
||||
$(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
|
||||
$(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
$(DOCKER_SYNCD_MRVL_RPC)_RUN_OPT += -v /host/warmboot:/var/warmboot
|
||||
|
@ -1,21 +1,13 @@
|
||||
# docker image for mrvl syncd
|
||||
|
||||
DOCKER_SYNCD_MRVL = docker-syncd-mrvl.gz
|
||||
$(DOCKER_SYNCD_MRVL)_PATH = $(PLATFORM_PATH)/docker-syncd-mrvl
|
||||
$(DOCKER_SYNCD_MRVL)_DEPENDS += $(SYNCD) $(MRVL_FPA) $(REDIS_TOOLS)
|
||||
ifeq ($(INSTALL_DEBUG_TOOLS), y)
|
||||
$(DOCKER_SYNCD_MRVL)_DEPENDS += $(SYNCD_DBG) \
|
||||
DOCKER_SYNCD_PLATFORM_CODE = mrvl
|
||||
include $(PLATFORM_PATH)/../template/docker-syncd-base.mk
|
||||
|
||||
$(DOCKER_SYNCD_BASE)_DEPENDS += $(SYNCD) $(PYTHON_SDK_API)
|
||||
|
||||
$(DOCKER_SYNCD_BASE)_DBG_DEPENDS += $(SYNCD_DBG) \
|
||||
$(LIBSWSSCOMMON_DBG) \
|
||||
$(LIBSAIMETADATA_DBG) \
|
||||
$(LIBSAIREDIS_DBG)
|
||||
endif
|
||||
$(DOCKER_SYNCD_MRVL)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE)
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL)
|
||||
ifneq ($(ENABLE_SYNCD_RPC),y)
|
||||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SYNCD_MRVL)
|
||||
endif
|
||||
|
||||
$(DOCKER_SYNCD_MRVL)_CONTAINER_NAME = syncd
|
||||
$(DOCKER_SYNCD_MRVL)_RUN_OPT += --net=host --privileged -t
|
||||
$(DOCKER_SYNCD_MRVL)_RUN_OPT += -v /host/machine.conf:/etc/machine.conf
|
||||
$(DOCKER_SYNCD_MRVL)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
$(DOCKER_SYNCD_BASE)_RUN_OPT += -v /host/warmboot:/var/warmboot
|
||||
|
@ -26,7 +26,7 @@ RUN dpkg -i \
|
||||
debs/{{ deb }}{{' '}}
|
||||
{%- endfor %}
|
||||
|
||||
COPY ["start.sh", "syncd.sh", "/usr/bin/"]
|
||||
COPY ["start.sh", "/usr/bin/"]
|
||||
COPY ["supervisord.conf", "/etc/supervisor/conf.d/"]
|
||||
|
||||
## Clean up
|
||||
@ -34,4 +34,3 @@ RUN apt-get clean -y; apt-get autoclean -y; apt-get autoremove -y
|
||||
RUN rm -rf /debs
|
||||
|
||||
ENTRYPOINT ["/usr/bin/supervisord"]
|
||||
|
||||
|
@ -5,4 +5,3 @@ rm -f /var/run/rsyslogd.pid
|
||||
supervisorctl start rsyslogd
|
||||
|
||||
supervisorctl start syncd
|
||||
|
||||
|
@ -26,4 +26,3 @@ autostart=false
|
||||
autorestart=false
|
||||
stdout_logfile=syslog
|
||||
stderr_logfile=syslog
|
||||
|
||||
|
@ -12,7 +12,7 @@ PYTHON_SAITHRIFT = python-saithrift_$(SAI_VER)_$(CONFIGURED_ARCH).deb
|
||||
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(PYTHON_SAITHRIFT)))
|
||||
|
||||
SAISERVER = saiserver_$(SAI_VER)_$(CONFIGURED_ARCH).deb
|
||||
$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(BRCM_SAI)
|
||||
$(SAISERVER)_RDEPENDS += $(LIBTHRIFT) $(MRVL_SAI)
|
||||
$(eval $(call add_extra_package,$(LIBSAITHRIFT_DEV),$(SAISERVER)))
|
||||
|
||||
SAISERVER_DBG = saiserver-dbg_$(SAI_VER)_$(CONFIGURED_ARCH).deb
|
||||
|
@ -1,8 +1,10 @@
|
||||
# linux kernel package for marvell arm64
|
||||
|
||||
KVERSION= 4.4.8
|
||||
KVERSION = 4.9.168
|
||||
|
||||
|
||||
LINUX_KERNEL= linux-image-4.4.8_4.4.8-4_arm64.deb
|
||||
$(LINUX_KERNEL)_PATH = /sonic
|
||||
SONIC_COPY_DEBS += $(LINUX_KERNEL)
|
||||
LINUX_KERNEL = linux-image-4.9.168-arm64.deb
|
||||
export LINUX_KERNEL
|
||||
|
||||
$(LINUX_KERNEL)_SRC_PATH = $(PLATFORM_PATH)/linux
|
||||
SONIC_MAKE_DEBS += $(LINUX_KERNEL)
|
||||
|
10
platform/marvell-arm64/linux/Makefile
Normal file
10
platform/marvell-arm64/linux/Makefile
Normal file
@ -0,0 +1,10 @@
|
||||
.ONESHELL:
|
||||
SHELL = /bin/bash
|
||||
.SHELLFLAGS += -e
|
||||
|
||||
LINUX_KERNEL_MRVL_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/arm64/kernel/$(LINUX_KERNEL)
|
||||
|
||||
$(addprefix $(DEST)/, $(LINUX_KERNEL)): $(DEST)/% :
|
||||
# get deb package
|
||||
wget -O $(DEST)/$(LINUX_KERNEL) $(LINUX_KERNEL_MRVL_URL)
|
||||
|
@ -1,7 +1,7 @@
|
||||
# sonic marvell one image installer
|
||||
|
||||
SONIC_ONE_IMAGE = sonic-marvell.bin
|
||||
$(SONIC_ONE_IMAGE)_MACHINE = marvell
|
||||
SONIC_ONE_IMAGE = sonic-marvell-arm64.bin
|
||||
$(SONIC_ONE_IMAGE)_MACHINE = marvell-arm64
|
||||
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
|
||||
$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
|
||||
ifeq ($(INSTALL_DEBUG_TOOLS),y)
|
||||
|
@ -2,16 +2,21 @@
|
||||
include $(PLATFORM_PATH)/sai.mk
|
||||
include $(PLATFORM_PATH)/docker-syncd-mrvl.mk
|
||||
include $(PLATFORM_PATH)/docker-syncd-mrvl-rpc.mk
|
||||
include $(PLATFORM_PATH)/docker-saiserver-mrvl.mk
|
||||
include $(PLATFORM_PATH)/libsaithrift-dev.mk
|
||||
include $(PLATFORM_PATH)/docker-ptf-mrvl.mk
|
||||
include $(PLATFORM_PATH)/one-image.mk
|
||||
include $(PLATFORM_PATH)/linux-kernel-arm64.mk
|
||||
ENABLE_SYSTEM_TELEMETRY = ""
|
||||
ENABLE_SYNCD_RPC = ""
|
||||
|
||||
|
||||
SONIC_ALL += $(SONIC_ONE_IMAGE) \
|
||||
$(DOCKER_FPM) \
|
||||
$(DOCKER_SYNCD_MRVL_RPC)
|
||||
$(DOCKER_FPM)
|
||||
#$(DOCKER_SYNCD_MRVL_RPC)
|
||||
|
||||
# Inject mrvl sai into sairedis
|
||||
$(LIBSAIREDIS)_DEPENDS += $(MRVL_FPA) $(MRVL_SAI) $(LIBSAITHRIFT_DEV_MRVL)
|
||||
$(LIBSAIREDIS)_DEPENDS += $(MRVL_SAI) $(LIBSAITHRIFT_DEV_MRVL)
|
||||
|
||||
# Runtime dependency on mrvl sai is set only for syncd
|
||||
$(SYNCD)_RDEPENDS += $(MRVL_SAI)
|
||||
|
@ -2,7 +2,7 @@
|
||||
SHELL = /bin/bash
|
||||
.SHELLFLAGS += -e
|
||||
|
||||
MRVL_SAI_URL = https://github.com/Marvell-switching/SAI-plugin/raw/$(MRVL_SAI_TAG)/sai_deb/$(MRVL_SAI)
|
||||
MRVL_SAI_URL = https://github.com/Marvell-switching/sonic-marvell-binaries/raw/master/arm64/sai-plugin/$(MRVL_SAI)
|
||||
|
||||
$(addprefix $(DEST)/, $(MRVL_SAI)): $(DEST)/% :
|
||||
# get deb package
|
||||
|
@ -1,7 +1,7 @@
|
||||
# sonic marvell one image installer
|
||||
|
||||
SONIC_ONE_IMAGE = sonic-marvell.bin
|
||||
$(SONIC_ONE_IMAGE)_MACHINE = marvell
|
||||
SONIC_ONE_IMAGE = sonic-marvell-armhf.bin
|
||||
$(SONIC_ONE_IMAGE)_MACHINE = marvell-armhf
|
||||
$(SONIC_ONE_IMAGE)_IMAGE_TYPE = onie
|
||||
$(SONIC_ONE_IMAGE)_INSTALLS += $(SYSTEMD_SONIC_GENERATOR)
|
||||
ifeq ($(INSTALL_DEBUG_TOOLS),y)
|
||||
|
@ -0,0 +1,143 @@
|
||||
# Copyright (C) Marvell Inc
|
||||
|
||||
# over ride default behaviour
|
||||
|
||||
echo "Preparing for installation ... "
|
||||
|
||||
# global defines
|
||||
kernel_addr=0x1100000
|
||||
fdt_addr=0x1000000
|
||||
|
||||
image_name="/boot/zImage"
|
||||
fdt_name="/boot/armada-385-ET6448M_4G_Nand.dtb"
|
||||
|
||||
# global mount defines
|
||||
demo_dev=ubi0
|
||||
mtd_dev=/dev/$(cat /proc/mtd | grep "SONIC" | grep -o "mtd[0-9]")
|
||||
mtd_num=$(echo $mtd_dev | grep -o "[0-9]")
|
||||
demo_mount=/tmp
|
||||
FW_ENV='/dev/mtd0 \t\t 0x00500000 \t 0x80000 \t 0x100000 \t 8'
|
||||
|
||||
BOOTARGS='setenv bootargs root='$demo_dev' rw rootwait ubi.mtd='$mtd_num' rootfstype=ubifs panic=1 console=ttyS0,115200 ${othbootargs} ${mtdparts}'
|
||||
UBI_LOAD='run ubi_sonic_boot_mount_ubi; ubifsload $kernel_addr $image_name;ubifsload $fdt_addr $fdt_name'
|
||||
UBIBOOTCMD='run ubi_sonic_boot_bootargs; run ubi_sonic_boot_load; bootz $kernel_addr - $fdt_addr'
|
||||
|
||||
et6448m_machine_conf() {
|
||||
SYSCTL_CFG=$demo_mount/usr/share/sonic/device/armhf-marvell_et6448m_52x-r0/syncd.conf
|
||||
|
||||
echo "Configure platform et6448m "
|
||||
rm $demo_mount/lib/udev/rules.d/73-usb-net-by-mac.rules
|
||||
rm -f $demo_mount/usr/bin/reboot || true
|
||||
rm -fr $demo_mount/host/machine.conf
|
||||
cp /etc/machine.conf $demo_mount/host/
|
||||
|
||||
SONIC_VERSION=$(cat $demo_mount/etc/sonic/sonic_version.yml | grep build_version | cut -f2 -d"'")
|
||||
FIRST_BOOT_FILE="$demo_mount/host/image-$SONIC_VERSION/platform"
|
||||
mkdir -p $FIRST_BOOT_FILE
|
||||
touch $FIRST_BOOT_FILE/firsttime
|
||||
|
||||
MAC_ADDR=$(fw_printenv | grep ^ethaddr= | cut -f2 -d"=")
|
||||
sed -i "s/switchMacAddress=.*/switchMacAddress=$MAC_ADDR/g" $demo_mount/usr/share/sonic/device/armhf-marvell_et6448m_52x-r0/et6448m/profile.ini
|
||||
|
||||
# IPv4 and IPv6 arp cache limits
|
||||
echo "sysctl -w net.ipv4.neigh.default.gc_thresh1=16000" >> $SYSCTL_CFG
|
||||
echo "sysctl -w net.ipv4.neigh.default.gc_thresh2=32000" >> $SYSCTL_CFG
|
||||
echo "sysctl -w net.ipv4.neigh.default.gc_thresh3=48000" >> $SYSCTL_CFG
|
||||
echo "sysctl -w net.ipv6.neigh.default.gc_thresh1=8000 " >> $SYSCTL_CFG
|
||||
echo "sysctl -w net.ipv6.neigh.default.gc_thresh2=16000" >> $SYSCTL_CFG
|
||||
echo "sysctl -w net.ipv6.neigh.default.gc_thresh3=32000" >> $SYSCTL_CFG
|
||||
}
|
||||
|
||||
prepare_uboot() {
|
||||
echo "Setting up U-Boot environment..."
|
||||
|
||||
echo -e $FW_ENV > /etc/fw_env.config
|
||||
|
||||
fw_setenv -f image_name $image_name > /dev/null
|
||||
fw_setenv -f fdt_name $fdt_name > /dev/null
|
||||
fw_setenv -f kernel_addr $kernel_addr > /dev/null
|
||||
fw_setenv -f fdt_addr $fdt_addr > /dev/null
|
||||
|
||||
#make sure ubi number (0) and ubi volume name (ubi0) are set correctly in bootargs_root:
|
||||
#For example, the below command creates an 3000MiB volume on UBI device 0:
|
||||
#setenv bootargs_root root=ubi0:ubi0 rw ubi.mtd=2 rootfstype=ubifs
|
||||
|
||||
fw_setenv -f mtdids 'nand0=armada-nand' > /dev/null
|
||||
fw_setenv -f mtdparts 'mtdparts=armada-nand:10m(U-Boot)ro,20m@10m(ONIE),-(SONIC)' > /dev/null
|
||||
fw_setenv -f ubi_sonic_boot_mount_ubi 'ubi part SONIC; ubifsmount ubi0' > /dev/null
|
||||
|
||||
fw_setenv -f ubi_sonic_boot_bootargs $BOOTARGS > /dev/null
|
||||
fw_setenv -f ubi_sonic_boot_load $UBI_LOAD > /dev/null
|
||||
fw_setenv -f ubi_sonic_boot $UBIBOOTCMD > /dev/null
|
||||
fw_setenv -f bootcmd 'usb start; run ubi_sonic_boot' > /dev/null
|
||||
|
||||
}
|
||||
|
||||
install_uimage() {
|
||||
|
||||
ubidetach /dev/ubi_ctrl -m $mtd_num 2>/dev/null || true
|
||||
|
||||
echo -en "Format mtd partition '$mtd_dev' "
|
||||
ubiformat $mtd_dev -y -q || {
|
||||
echo "Failed"
|
||||
}
|
||||
|
||||
#attaches MTD devices (which describe raw flash) to UBI and creates corresponding UBI devices; ('-m 2' --> mtd2)
|
||||
echo -en "ubiattach mtd '$mtd_num' "
|
||||
ubiattach /dev/ubi_ctrl -m $mtd_num || {
|
||||
echo "Failed"
|
||||
}
|
||||
|
||||
#creates UBI volumes on UBI devices
|
||||
ubimkvol /dev/$demo_dev -N $demo_dev -s 3900MiB
|
||||
|
||||
demo_mount=$(mktemp -d) || {
|
||||
echo "Error: Unable to create file sstem mount point"
|
||||
exit 1
|
||||
}
|
||||
|
||||
echo "Mounting $demo_dev on $demo_mount "
|
||||
mount -t ubifs /dev/ubi0_0 $demo_mount || {
|
||||
echo "Failed"
|
||||
}
|
||||
|
||||
echo "Extracting NOS "
|
||||
|
||||
# Decompress the file for the file system directly to the partition
|
||||
unzip -o $ONIE_INSTALLER_PAYLOAD -x "$FILESYSTEM_DOCKERFS" -d $demo_mount/
|
||||
cd $demo_mount
|
||||
|
||||
if [ -f fs.cpio ]; then
|
||||
cpio -id < fs.cpio
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "cpio extraction Failed"
|
||||
fi
|
||||
rm fs.cpio
|
||||
elif [ -f fs.squashfs ]; then
|
||||
unsquashfs -f -d $demo_mount $FILESYSTEM_SQUASHFS
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "unsquashfs extraction Failed"
|
||||
fi
|
||||
rm -f $FILESYSTEM_SQUASHFS
|
||||
fi
|
||||
|
||||
cd -
|
||||
TAR_EXTRA_OPTION="--numeric-owner"
|
||||
mkdir -p $demo_mount/var/lib/$DOCKERFS_DIR
|
||||
unzip -op $ONIE_INSTALLER_PAYLOAD "$FILESYSTEM_DOCKERFS" | tar -xpz $TAR_EXTRA_OPTION -f - -C $demo_mount/var/lib/$DOCKERFS_DIR
|
||||
|
||||
# Update uboot Environment
|
||||
prepare_uboot
|
||||
|
||||
# Platform configuration
|
||||
et6448m_machine_conf
|
||||
|
||||
# Unmounting mount path
|
||||
umount $demo_mount
|
||||
|
||||
echo "Reboot board to boot from installed OS"
|
||||
}
|
||||
|
||||
hw_load() {
|
||||
echo "mtdpart default && ubi part SONIC && ubifsmount 'demo_dev' && ubifsload '$kernel_addr' 'image_name'"
|
||||
}
|
@ -18,7 +18,7 @@ if [ -f /etc/sonic/config_db.json ]; then
|
||||
else
|
||||
# generate and merge buffers configuration into config file
|
||||
sonic-cfggen -t /usr/share/sonic/hwsku/buffers.json.j2 > /tmp/buffers.json
|
||||
sonic-cfggen -t /usr/share/sonic/hwsku/qos.json.j2 > /tmp/qos.json
|
||||
sonic-cfggen -j /etc/sonic/init_cfg.json -t /usr/share/sonic/hwsku/qos.json.j2 > /tmp/qos.json
|
||||
sonic-cfggen -p /usr/share/sonic/hwsku/port_config.ini -k $HWSKU --print-data > /tmp/ports.json
|
||||
sonic-cfggen -j /etc/sonic/init_cfg.json -j /tmp/buffers.json -j /tmp/qos.json -j /tmp/ports.json --print-data > /etc/sonic/config_db.json
|
||||
fi
|
||||
|
@ -8,6 +8,8 @@ ENV DEBIAN_FRONTEND=noninteractive
|
||||
|
||||
RUN apt-get update
|
||||
|
||||
RUN apt-get install -f -y iproute2=4.20.0-2~bpo9+1 libcap2-bin=1:2.25-1
|
||||
|
||||
COPY \
|
||||
{% for deb in docker_syncd_vs_debs.split(' ') -%}
|
||||
debs/{{ deb }}{{' '}}
|
||||
|
@ -95,3 +95,6 @@ FRR_USER_GID = 300
|
||||
|
||||
# Default VS build memory preparation
|
||||
DEFAULT_VS_PREPARE_MEM = yes
|
||||
|
||||
# ENABLE_SYSTEM_SFLOW - build docker-sonic-sflow for sFlow support
|
||||
ENABLE_SFLOW = y
|
||||
|
35
rules/docker-sflow.mk
Normal file
35
rules/docker-sflow.mk
Normal file
@ -0,0 +1,35 @@
|
||||
# docker image for sFlow agent
|
||||
|
||||
DOCKER_SFLOW_STEM = docker-sflow
|
||||
DOCKER_SFLOW = $(DOCKER_SFLOW_STEM).gz
|
||||
DOCKER_SFLOW_DBG = $(DOCKER_SFLOW_STEM)-$(DBG_IMAGE_MARK).gz
|
||||
|
||||
$(DOCKER_SFLOW)_PATH = $(DOCKERS_PATH)/$(DOCKER_SFLOW_STEM)
|
||||
|
||||
$(DOCKER_SFLOW)_DEPENDS += $(SWSS) $(REDIS_TOOLS) $(HSFLOWD) $(SFLOWTOOL) $(PSAMPLE)
|
||||
$(DOCKER_SFLOW)_DBG_DEPENDS = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_DEPENDS)
|
||||
$(DOCKER_TEAMD)_DBG_DEPENDS += $(SWSS_DBG) $(LIBSWSSCOMMON_DBG)
|
||||
$(DOCKER_SFLOW)_DBG_IMAGE_PACKAGES = $($(DOCKER_CONFIG_ENGINE_STRETCH)_DBG_IMAGE_PACKAGES)
|
||||
|
||||
$(DOCKER_SFLOW)_LOAD_DOCKERS += $(DOCKER_CONFIG_ENGINE_STRETCH)
|
||||
|
||||
SONIC_DOCKER_IMAGES += $(DOCKER_SFLOW)
|
||||
ifeq ($(ENABLE_SFLOW), y)
|
||||
SONIC_INSTALL_DOCKER_IMAGES += $(DOCKER_SFLOW)
|
||||
SONIC_STRETCH_DOCKERS += $(DOCKER_SFLOW)
|
||||
endif
|
||||
|
||||
SONIC_DOCKER_DBG_IMAGES += $(DOCKER_SFLOW_DBG)
|
||||
ifeq ($(ENABLE_SFLOW), y)
|
||||
SONIC_INSTALL_DOCKER_DBG_IMAGES += $(DOCKER_SFLOW_DBG)
|
||||
SONIC_STRETCH_DBG_DOCKERS += $(DOCKER_SFLOW_DBG)
|
||||
endif
|
||||
|
||||
$(DOCKER_SFLOW)_CONTAINER_NAME = sflow
|
||||
$(DOCKER_SFLOW)_RUN_OPT += --net=host --privileged -t
|
||||
$(DOCKER_SFLOW)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
|
||||
$(DOCKER_SFLOW)_RUN_OPT += -v /host/warmboot:/var/warmboot
|
||||
|
||||
$(DOCKER_SFLOW)_BASE_IMAGE_FILES += psample:/usr/bin/psample
|
||||
$(DOCKER_SFLOW)_BASE_IMAGE_FILES += sflowtool:/usr/bin/sflowtool
|
||||
|
49
rules/sflow.mk
Normal file
49
rules/sflow.mk
Normal file
@ -0,0 +1,49 @@
|
||||
# host-sflow package
|
||||
|
||||
HSFLOWD_VERSION = 2.0.21
|
||||
HSFLOWD_SUBVERSION = 8
|
||||
export HSFLOWD_VERSION HSFLOWD_SUBVERSION
|
||||
|
||||
HSFLOWD = hsflowd_$(HSFLOWD_VERSION)-$(HSFLOWD_SUBVERSION)_$(CONFIGURED_ARCH).deb
|
||||
$(HSFLOWD)_DEPENDS += $(LIBHIREDIS_DEV) $(LINUX_HEADERS) $(LINUX_HEADERS_COMMON)
|
||||
$(HSFLOWD)_SRC_PATH = $(SRC_PATH)/sflow/hsflowd
|
||||
|
||||
SONIC_MAKE_DEBS += $(HSFLOWD)
|
||||
SONIC_STRETCH_DEBS += $(HSFLOWD)
|
||||
|
||||
HSFLOWD_DBG = hsflowd-dbg_$(HSFLOWD_VERSION)-$(HSFLOWD_SUBVERSION)_$(CONFIGURED_ARCH).deb
|
||||
$(HSFLOWD_DBG)_DEPENDS += $(HSFLOWD)
|
||||
$(HSFLOWD_DBG)_RDEPENDS += $(HSFLOWD)
|
||||
$(eval $(call add_derived_package,$(HSFLOWD),$(HSFLOWD_DBG)))
|
||||
|
||||
export HSFLOWD HSFLOWD_DBG
|
||||
|
||||
# sflowtool package
|
||||
|
||||
SFLOWTOOL_VERSION = 5.04
|
||||
export SFLOWTOOL_VERSION
|
||||
|
||||
SFLOWTOOL = sflowtool_$(SFLOWTOOL_VERSION)_$(CONFIGURED_ARCH).deb
|
||||
$(SFLOWTOOL)_SRC_PATH = $(SRC_PATH)/sflow/sflowtool
|
||||
|
||||
SONIC_MAKE_DEBS += $(SFLOWTOOL)
|
||||
SONIC_STRETCH_DEBS += $(SFLOWTOOL)
|
||||
export SFLOWTOOL
|
||||
|
||||
# psample package
|
||||
|
||||
PSAMPLE_VERSION = 1.1
|
||||
PSAMPLE_SUBVERSION = 1
|
||||
export PSAMPLE_VERSION PSAMPLE_SUBVERSION
|
||||
|
||||
PSAMPLE = psample_$(PSAMPLE_VERSION)-$(PSAMPLE_SUBVERSION)_$(CONFIGURED_ARCH).deb
|
||||
$(PSAMPLE)_SRC_PATH = $(SRC_PATH)/sflow/psample
|
||||
|
||||
SONIC_MAKE_DEBS += $(PSAMPLE)
|
||||
SONIC_STRETCH_DEBS += $(PSAMPLE)
|
||||
export PSAMPLE
|
||||
|
||||
# The .c, .cpp, .h & .hpp files under src/{$DBG_SRC_ARCHIVE list}
|
||||
# are archived into debug one image to facilitate debugging.
|
||||
#
|
||||
DBG_SRC_ARCHIVE += sflow
|
@ -6,8 +6,9 @@ $(SONIC_PLATFORM_COMMON_PY2)_PYTHON_VERSION = 2
|
||||
SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY2)
|
||||
|
||||
# Als build sonic-platform-common into python3 wheel, so we can use PSU code in SNMP docker
|
||||
# Note: _DEPENDS macro is not defined
|
||||
SONIC_PLATFORM_COMMON_PY3 = sonic_platform_common-1.0-py3-none-any.whl
|
||||
$(SONIC_PLATFORM_COMMON_PY3)_SRC_PATH = $(SRC_PATH)/sonic-platform-common
|
||||
$(SONIC_PLATFORM_COMMON_PY3)_PYTHON_VERSION = 3
|
||||
# Synthetic dependency just to avoid race condition
|
||||
$(SONIC_PLATFORM_COMMON_PY3)_DEPENDS = $(SONIC_PLATFORM_COMMON_PY2)
|
||||
SONIC_PYTHON_WHEELS += $(SONIC_PLATFORM_COMMON_PY3)
|
||||
|
5
slave.mk
5
slave.mk
@ -108,6 +108,10 @@ ifeq ($(SONIC_INSTALL_DEBUG_TOOLS),y)
|
||||
INSTALL_DEBUG_TOOLS = y
|
||||
endif
|
||||
|
||||
ifeq ($(SONIC_ENABLE_SFLOW),y)
|
||||
ENABLE_SFLOW = y
|
||||
endif
|
||||
|
||||
include $(RULES_PATH)/functions
|
||||
include $(RULES_PATH)/*.mk
|
||||
ifneq ($(CONFIGURED_PLATFORM), undefined)
|
||||
@ -192,6 +196,7 @@ $(info "KERNEL_PROCURE_METHOD" : "$(KERNEL_PROCURE_METHOD)")
|
||||
$(info "BUILD_TIMESTAMP" : "$(BUILD_TIMESTAMP)")
|
||||
$(info "BLDENV" : "$(BLDENV)")
|
||||
$(info "VS_PREPARE_MEM" : "$(VS_PREPARE_MEM)")
|
||||
$(info "ENABLE_SFLOW" : "$(ENABLE_SFLOW)")
|
||||
$(info )
|
||||
|
||||
ifeq ($(SONIC_USE_DOCKER_BUILDKIT),y)
|
||||
|
29
src/sflow/hsflowd/Makefile
Normal file
29
src/sflow/hsflowd/Makefile
Normal file
@ -0,0 +1,29 @@
|
||||
.ONESHELL:
|
||||
SHELL = /bin/bash
|
||||
.SHELLFLAGS += -e
|
||||
|
||||
MAIN_TARGET = $(HSFLOWD)
|
||||
DERIVED_TARGET = $(HSFLOWD_DBG)
|
||||
|
||||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||
rm -fr ./host-sflow
|
||||
git clone https://github.com/sflow/host-sflow
|
||||
|
||||
pushd ./host-sflow
|
||||
git checkout -b sflow -f 996f5ec
|
||||
|
||||
# Apply patch series
|
||||
stg init
|
||||
stg import -s ../patch/series
|
||||
|
||||
mkdir -p debian
|
||||
cp -r DEBIAN_build/* debian
|
||||
chmod u+x debian/rules
|
||||
sed -i -e s/_VERSION_/$(HSFLOWD_VERSION)-$(HSFLOWD_SUBVERSION)/g debian/changelog
|
||||
|
||||
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS) --buildinfo-option=-u. --changes-option=-u.
|
||||
|
||||
mv $(DERIVED_TARGET) $* $(DEST)/
|
||||
popd
|
||||
|
||||
$(addprefix $(DEST)/, $(DERIVED_TARGET)): $(DEST)/% : $(DEST)/$(MAIN_TARGET)
|
39
src/sflow/hsflowd/patch/0001-host_sflow_psample.patch
Normal file
39
src/sflow/hsflowd/patch/0001-host_sflow_psample.patch
Normal file
@ -0,0 +1,39 @@
|
||||
diff -ruN a/src/Linux/linux/psample.h b/src/Linux/linux/psample.h
|
||||
--- a/src/Linux/linux/psample.h 1969-12-31 16:00:00.000000000 -0800
|
||||
+++ b/src/Linux/linux/psample.h 2019-07-20 08:45:58.715748881 -0700
|
||||
@@ -0,0 +1,35 @@
|
||||
+#ifndef __UAPI_PSAMPLE_H
|
||||
+#define __UAPI_PSAMPLE_H
|
||||
+
|
||||
+enum {
|
||||
+ /* sampled packet metadata */
|
||||
+ PSAMPLE_ATTR_IIFINDEX,
|
||||
+ PSAMPLE_ATTR_OIFINDEX,
|
||||
+ PSAMPLE_ATTR_ORIGSIZE,
|
||||
+ PSAMPLE_ATTR_SAMPLE_GROUP,
|
||||
+ PSAMPLE_ATTR_GROUP_SEQ,
|
||||
+ PSAMPLE_ATTR_SAMPLE_RATE,
|
||||
+ PSAMPLE_ATTR_DATA,
|
||||
+
|
||||
+ /* commands attributes */
|
||||
+ PSAMPLE_ATTR_GROUP_REFCOUNT,
|
||||
+
|
||||
+ __PSAMPLE_ATTR_MAX
|
||||
+};
|
||||
+
|
||||
+enum psample_command {
|
||||
+ PSAMPLE_CMD_SAMPLE,
|
||||
+ PSAMPLE_CMD_GET_GROUP,
|
||||
+ PSAMPLE_CMD_NEW_GROUP,
|
||||
+ PSAMPLE_CMD_DEL_GROUP,
|
||||
+};
|
||||
+
|
||||
+/* Can be overridden at runtime by module option */
|
||||
+#define PSAMPLE_ATTR_MAX (__PSAMPLE_ATTR_MAX - 1)
|
||||
+
|
||||
+#define PSAMPLE_NL_MCGRP_CONFIG_NAME "config"
|
||||
+#define PSAMPLE_NL_MCGRP_SAMPLE_NAME "packets"
|
||||
+#define PSAMPLE_GENL_NAME "psample"
|
||||
+#define PSAMPLE_GENL_VERSION 1
|
||||
+
|
||||
+#endif
|
108
src/sflow/hsflowd/patch/0002-host_sflow_debian.patch
Normal file
108
src/sflow/hsflowd/patch/0002-host_sflow_debian.patch
Normal file
@ -0,0 +1,108 @@
|
||||
diff -ruN a/DEBIAN_build/changelog b/DEBIAN_build/changelog
|
||||
--- a/DEBIAN_build/changelog 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ b/DEBIAN_build/changelog 2019-08-19 22:52:10.171736403 -0400
|
||||
@@ -0,0 +1,6 @@
|
||||
+hsflowd (_VERSION_) stable; urgency=medium
|
||||
+
|
||||
+ [ DellEMC ]
|
||||
+ * Initial release : hsflowd
|
||||
+
|
||||
+ -- DellEMC <support@dell.com> Mon, 29 Jul 2019 07:08:02 -0400
|
||||
diff -ruN a/DEBIAN_build/compat b/DEBIAN_build/compat
|
||||
--- a/DEBIAN_build/compat 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ b/DEBIAN_build/compat 2019-08-16 23:28:58.020938096 -0400
|
||||
@@ -0,0 +1 @@
|
||||
+9
|
||||
diff -ruN a/DEBIAN_build/control b/DEBIAN_build/control
|
||||
--- a/DEBIAN_build/control 2019-08-16 05:11:33.974949327 -0400
|
||||
+++ b/DEBIAN_build/control 2019-08-19 21:28:07.155722725 -0400
|
||||
@@ -1,9 +1,22 @@
|
||||
-Package: _PACKAGE_
|
||||
-Version: _VERSION_
|
||||
-Section: admin
|
||||
+Source: hsflowd
|
||||
+Maintainer: Neil McKee [neil.mckee@inmon.com]
|
||||
+Uploaders: DellEMC <support@dell.com>
|
||||
+Section: net
|
||||
+Priority: optional
|
||||
+Build-Depends: dh-exec (>=0.3), debhelper (>= 9), autotools-dev
|
||||
+Standards-Version: 1.0.0
|
||||
+
|
||||
+Package: hsflowd
|
||||
+Section: admin
|
||||
Priority: optional
|
||||
-Architecture: all
|
||||
+Architecture: any
|
||||
Essential: no
|
||||
-Maintainer: Neil McKee [neil.mckee@inmon.com]
|
||||
Description: sFlow(R) monitoring agent
|
||||
Homepage: sflow.net
|
||||
+
|
||||
+Package: hsflowd-dbg
|
||||
+Architecture: any
|
||||
+Section: debug
|
||||
+Priority: extra
|
||||
+Depends: hsflowd
|
||||
+Description: debugging symbols for hsflowd
|
||||
diff -ruN a/DEBIAN_build/rules b/DEBIAN_build/rules
|
||||
--- a/DEBIAN_build/rules 1969-12-31 19:00:00.000000000 -0500
|
||||
+++ b/DEBIAN_build/rules 2019-08-19 22:20:42.998569601 -0400
|
||||
@@ -0,0 +1,31 @@
|
||||
+#!/usr/bin/make -f
|
||||
+
|
||||
+# See debhelper(7) (uncomment to enable)
|
||||
+# output every command that modifies files on the build system.
|
||||
+export DH_VERBOSE = 1
|
||||
+
|
||||
+# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
|
||||
+DPKG_EXPORT_BUILDFLAGS = 1
|
||||
+include /usr/share/dpkg/default.mk
|
||||
+
|
||||
+%:
|
||||
+ dh $@
|
||||
+
|
||||
+binary:
|
||||
+ dh_gencontrol
|
||||
+ dh_strip -phsflowd --dbg-package=hsflowd-dbg
|
||||
+ dpkg-deb --build debian/hsflowd-dbg hsflowd-dbg_$(HSFLOWD_VERSION)-$(HSFLOWD_SUBVERSION)_$(CONFIGURED_ARCH).deb
|
||||
+ dpkg-deb --build debian/hsflowd hsflowd_$(HSFLOWD_VERSION)-$(HSFLOWD_SUBVERSION)_$(CONFIGURED_ARCH).deb
|
||||
+
|
||||
+override_dh_auto_build:
|
||||
+ make sonic-deb FEATURES="SONIC"
|
||||
+
|
||||
+override_dh_auto_configure:
|
||||
+
|
||||
+override_dh_auto_install:
|
||||
+
|
||||
+override_dh_auto_test:
|
||||
+
|
||||
+override_dh_auto_clean:
|
||||
+
|
||||
+override_dh_clean:
|
||||
diff -ruN a/Makefile b/Makefile
|
||||
--- a/Makefile 2019-08-16 21:34:25.167679297 -0400
|
||||
+++ b/Makefile 2019-08-19 22:20:23.758479002 -0400
|
||||
@@ -146,6 +146,23 @@
|
||||
cd ..; \
|
||||
dpkg-deb --build debian hsflowd_$${MYVER}-$${MYREL}_$$MYARCH.deb
|
||||
|
||||
+sonic-deb: $(PROG)
|
||||
+ MYARCH=`uname -m|sed 's/x86_64/amd64/'`; \
|
||||
+ MYVER=`./getVersion`; \
|
||||
+ MYREL=`./getRelease`; \
|
||||
+ PLATFORM=`uname`; \
|
||||
+ mkdir -p debian/usr/sbin; \
|
||||
+ mkdir -p debian/etc/init.d; \
|
||||
+ mkdir -p debian/etc/hsflowd/modules; \
|
||||
+ mkdir -p debian/lib/systemd/system; \
|
||||
+ mkdir -p debian/etc/dbus-1/system.d; \
|
||||
+ cd src/$$PLATFORM; $(MAKE) VERSION=$$MYVER RELEASE=$$MYREL INSTROOT="../../debian/hsflowd" install; cd ../..; \
|
||||
+ pwd; \
|
||||
+ cd debian/hsflowd; \
|
||||
+ find . -type d | xargs chmod 755; \
|
||||
+ md5sum `find usr etc -type f` > md5sums; \
|
||||
+ cd ../..;
|
||||
+
|
||||
xenserver: xenrpm
|
||||
cd xenserver-ddk; $(MAKE) clean; $(MAKE)
|
||||
|
2
src/sflow/hsflowd/patch/series
Normal file
2
src/sflow/hsflowd/patch/series
Normal file
@ -0,0 +1,2 @@
|
||||
0001-host_sflow_psample.patch
|
||||
0002-host_sflow_debian.patch
|
20
src/sflow/psample/Makefile
Normal file
20
src/sflow/psample/Makefile
Normal file
@ -0,0 +1,20 @@
|
||||
.ONESHELL:
|
||||
SHELL = /bin/bash
|
||||
.SHELLFLAGS += -e
|
||||
|
||||
MAIN_TARGET = $(PSAMPLE)
|
||||
|
||||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||
|
||||
rm -fr ./libpsample
|
||||
git clone https://github.com/Mellanox/libpsample.git
|
||||
cp -r debian libpsample
|
||||
|
||||
pushd ./libpsample
|
||||
git checkout -b libpsample -f e48fad2
|
||||
|
||||
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS)
|
||||
popd
|
||||
|
||||
mv $* $(DEST)/
|
||||
|
6
src/sflow/psample/debian/changelog
Normal file
6
src/sflow/psample/debian/changelog
Normal file
@ -0,0 +1,6 @@
|
||||
psample (1.1-1) UNRELEASED; urgency=medium
|
||||
|
||||
[ DellEMC ]
|
||||
* Initial release : based on https://github.com/Mellanox/libpsample
|
||||
|
||||
-- DellEMC <support@dell.com> Mon, 29 Jul 2019 07:08:02 -0400
|
1
src/sflow/psample/debian/compat
Normal file
1
src/sflow/psample/debian/compat
Normal file
@ -0,0 +1 @@
|
||||
9
|
11
src/sflow/psample/debian/control
Normal file
11
src/sflow/psample/debian/control
Normal file
@ -0,0 +1,11 @@
|
||||
Source: psample
|
||||
Maintainer: DellEMC <support@dell.com>
|
||||
Section: devel
|
||||
Priority: optional
|
||||
Build-Depends: dh-exec (>=0.3), debhelper (>= 9), autotools-dev
|
||||
Standards-Version: 1.0.0
|
||||
|
||||
Package: psample
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}
|
||||
Description: This package contains psample from https://github.com/Mellanox/libpsample
|
4
src/sflow/psample/debian/psample.install
Normal file
4
src/sflow/psample/debian/psample.install
Normal file
@ -0,0 +1,4 @@
|
||||
bin/psample usr/bin
|
||||
lib/libpsample.so.1.0 lib/x86_64-linux-gnu
|
||||
lib/libpsample.so.1 lib/x86_64-linux-gnu
|
||||
lib/libpsample.so lib/x86_64-linux-gnu
|
19
src/sflow/psample/debian/rules
Executable file
19
src/sflow/psample/debian/rules
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
# main packaging script based on dh7 syntax
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_build:
|
||||
cmake . && make
|
||||
|
||||
override_dh_auto_install:
|
||||
|
||||
override_dh_auto_test:
|
||||
|
||||
override_dh_auto_clean:
|
||||
|
||||
override_dh_strip:
|
||||
|
||||
override_dh_clean:
|
||||
|
19
src/sflow/sflowtool/Makefile
Normal file
19
src/sflow/sflowtool/Makefile
Normal file
@ -0,0 +1,19 @@
|
||||
.ONESHELL:
|
||||
SHELL = /bin/bash
|
||||
.SHELLFLAGS += -e
|
||||
|
||||
MAIN_TARGET = $(SFLOWTOOL)
|
||||
|
||||
$(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||
|
||||
rm -fr ./sflowtool
|
||||
git clone https://github.com/sflow/sflowtool
|
||||
cp -r debian sflowtool
|
||||
|
||||
pushd ./sflowtool
|
||||
git checkout -b sflowtool -f 6c2963b
|
||||
dpkg-buildpackage -rfakeroot -b -us -uc -j$(SONIC_CONFIG_MAKE_JOBS)
|
||||
popd
|
||||
|
||||
mv $* $(DEST)/
|
||||
|
6
src/sflow/sflowtool/debian/changelog
Normal file
6
src/sflow/sflowtool/debian/changelog
Normal file
@ -0,0 +1,6 @@
|
||||
sflowtool (5.04) UNRELEASED; urgency=medium
|
||||
|
||||
[ DellEMC ]
|
||||
* Initial release : based on https://github.com/sflow/sflowtool
|
||||
|
||||
-- DellEMC <support@dell.com> Mon, 29 Jul 2019 07:08:02 -0400
|
1
src/sflow/sflowtool/debian/compat
Normal file
1
src/sflow/sflowtool/debian/compat
Normal file
@ -0,0 +1 @@
|
||||
9
|
11
src/sflow/sflowtool/debian/control
Normal file
11
src/sflow/sflowtool/debian/control
Normal file
@ -0,0 +1,11 @@
|
||||
Source: sflowtool
|
||||
Maintainer: DellEMC <support@dell.com>
|
||||
Section: devel
|
||||
Priority: optional
|
||||
Build-Depends: dh-exec (>=0.3), debhelper (>= 9), autotools-dev
|
||||
Standards-Version: 1.0.0
|
||||
|
||||
Package: sflowtool
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}
|
||||
Description: This package contains sflowtool from https://github.com/sflow/sflowtool
|
19
src/sflow/sflowtool/debian/rules
Executable file
19
src/sflow/sflowtool/debian/rules
Executable file
@ -0,0 +1,19 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
# main packaging script based on dh7 syntax
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_build:
|
||||
./boot.sh && ./configure && make
|
||||
|
||||
override_dh_auto_install:
|
||||
|
||||
override_dh_auto_test:
|
||||
|
||||
override_dh_auto_clean:
|
||||
|
||||
override_dh_strip:
|
||||
|
||||
override_dh_clean:
|
||||
|
1
src/sflow/sflowtool/debian/sflowtool.install
Normal file
1
src/sflow/sflowtool/debian/sflowtool.install
Normal file
@ -0,0 +1 @@
|
||||
src/sflowtool usr/bin
|
@ -0,0 +1,211 @@
|
||||
From a5782d0673044ad0c621daed7975f53238bb038e Mon Sep 17 00:00:00 2001
|
||||
From: Renuka Manavalan <remanava@microsoft.com>
|
||||
Date: Tue, 10 Sep 2019 17:51:45 +0000
|
||||
Subject: [PATCH] Patch from SourceForge: net-snmp commit #793d59 Avoids snmpd
|
||||
crash when sub agent timesout.
|
||||
|
||||
---
|
||||
agent/mibgroup/agentx/master_admin.c | 1 +
|
||||
agent/snmp_agent.c | 81 ++++++++++++++++++----------
|
||||
include/net-snmp/agent/snmp_agent.h | 5 ++
|
||||
3 files changed, 60 insertions(+), 27 deletions(-)
|
||||
|
||||
diff --git a/agent/mibgroup/agentx/master_admin.c b/agent/mibgroup/agentx/master_admin.c
|
||||
index 4dc1aa7..8c1d194 100644
|
||||
--- a/agent/mibgroup/agentx/master_admin.c
|
||||
+++ b/agent/mibgroup/agentx/master_admin.c
|
||||
@@ -158,6 +158,7 @@ close_agentx_session(netsnmp_session * session, int sessid)
|
||||
for (sp = session->subsession; sp != NULL; sp = sp->next) {
|
||||
|
||||
if (sp->sessid == sessid) {
|
||||
+ netsnmp_remove_delegated_requests_for_session(sp);
|
||||
unregister_mibs_by_session(sp);
|
||||
unregister_index_by_session(sp);
|
||||
unregister_sysORTable_by_session(sp);
|
||||
diff --git a/agent/snmp_agent.c b/agent/snmp_agent.c
|
||||
index b96d650..7cacd1a 100644
|
||||
--- a/agent/snmp_agent.c
|
||||
+++ b/agent/snmp_agent.c
|
||||
@@ -1409,6 +1409,7 @@ init_agent_snmp_session(netsnmp_session * session, netsnmp_pdu *pdu)
|
||||
asp->treecache_num = -1;
|
||||
asp->treecache_len = 0;
|
||||
asp->reqinfo = SNMP_MALLOC_TYPEDEF(netsnmp_agent_request_info);
|
||||
+ asp->flags = SNMP_AGENT_FLAGS_NONE;
|
||||
DEBUGMSGTL(("verbose:asp", "asp %p reqinfo %p created\n",
|
||||
asp, asp->reqinfo));
|
||||
|
||||
@@ -1457,6 +1458,9 @@ netsnmp_check_for_delegated(netsnmp_agent_session *asp)
|
||||
|
||||
if (NULL == asp->treecache)
|
||||
return 0;
|
||||
+
|
||||
+ if (asp->flags & SNMP_AGENT_FLAGS_CANCEL_IN_PROGRESS)
|
||||
+ return 0;
|
||||
|
||||
for (i = 0; i <= asp->treecache_num; i++) {
|
||||
for (request = asp->treecache[i].requests_begin; request;
|
||||
@@ -1535,39 +1539,48 @@ int
|
||||
netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess)
|
||||
{
|
||||
netsnmp_agent_session *asp;
|
||||
- int count = 0;
|
||||
+ int total_count = 0;
|
||||
|
||||
for (asp = agent_delegated_list; asp; asp = asp->next) {
|
||||
/*
|
||||
* check each request
|
||||
*/
|
||||
+ int i;
|
||||
+ int count = 0;
|
||||
netsnmp_request_info *request;
|
||||
- for(request = asp->requests; request; request = request->next) {
|
||||
- /*
|
||||
- * check session
|
||||
- */
|
||||
- netsnmp_assert(NULL!=request->subtree);
|
||||
- if(request->subtree->session != sess)
|
||||
- continue;
|
||||
+ for (i = 0; i <= asp->treecache_num; i++) {
|
||||
+ for (request = asp->treecache[i].requests_begin; request;
|
||||
+ request = request->next) {
|
||||
+ /*
|
||||
+ * check session
|
||||
+ */
|
||||
+ netsnmp_assert(NULL!=request->subtree);
|
||||
+ if(request->subtree->session != sess)
|
||||
+ continue;
|
||||
|
||||
- /*
|
||||
- * matched! mark request as done
|
||||
- */
|
||||
- netsnmp_request_set_error(request, SNMP_ERR_GENERR);
|
||||
- ++count;
|
||||
+ /*
|
||||
+ * matched! mark request as done
|
||||
+ */
|
||||
+ netsnmp_request_set_error(request, SNMP_ERR_GENERR);
|
||||
+ ++count;
|
||||
+ }
|
||||
+ }
|
||||
+ if (count) {
|
||||
+ asp->flags |= SNMP_AGENT_FLAGS_CANCEL_IN_PROGRESS;
|
||||
+ total_count += count;
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* if we found any, that request may be finished now
|
||||
*/
|
||||
- if(count) {
|
||||
+ if(total_count) {
|
||||
DEBUGMSGTL(("snmp_agent", "removed %d delegated request(s) for session "
|
||||
- "%8p\n", count, sess));
|
||||
- netsnmp_check_outstanding_agent_requests();
|
||||
+ "%8p\n", total_count, sess));
|
||||
+ netsnmp_check_delegated_requests();
|
||||
}
|
||||
|
||||
- return count;
|
||||
+ return total_count;
|
||||
}
|
||||
|
||||
int
|
||||
@@ -2739,19 +2752,11 @@ handle_var_requests(netsnmp_agent_session *asp)
|
||||
return final_status;
|
||||
}
|
||||
|
||||
-/*
|
||||
- * loop through our sessions known delegated sessions and check to see
|
||||
- * if they've completed yet. If there are no more delegated sessions,
|
||||
- * check for and process any queued requests
|
||||
- */
|
||||
void
|
||||
-netsnmp_check_outstanding_agent_requests(void)
|
||||
+netsnmp_check_delegated_requests(void)
|
||||
{
|
||||
netsnmp_agent_session *asp, *prev_asp = NULL, *next_asp = NULL;
|
||||
|
||||
- /*
|
||||
- * deal with delegated requests
|
||||
- */
|
||||
for (asp = agent_delegated_list; asp; asp = next_asp) {
|
||||
next_asp = asp->next; /* save in case we clean up asp */
|
||||
if (!netsnmp_check_for_delegated(asp)) {
|
||||
@@ -2790,6 +2795,23 @@ netsnmp_check_outstanding_agent_requests(void)
|
||||
prev_asp = asp;
|
||||
}
|
||||
}
|
||||
+}
|
||||
+
|
||||
+
|
||||
+/*
|
||||
+ * loop through our sessions known delegated sessions and check to see
|
||||
+ * if they've completed yet. If there are no more delegated sessions,
|
||||
+ * check for and process any queued requests
|
||||
+ */
|
||||
+void
|
||||
+netsnmp_check_outstanding_agent_requests(void)
|
||||
+{
|
||||
+ netsnmp_agent_session *asp;
|
||||
+
|
||||
+ /*
|
||||
+ * deal with delegated requests
|
||||
+ */
|
||||
+ netsnmp_check_delegated_requests();
|
||||
|
||||
/*
|
||||
* if we are processing a set and there are more delegated
|
||||
@@ -2819,7 +2841,8 @@ netsnmp_check_outstanding_agent_requests(void)
|
||||
|
||||
netsnmp_processing_set = netsnmp_agent_queued_list;
|
||||
DEBUGMSGTL(("snmp_agent", "SET request remains queued while "
|
||||
- "delegated requests finish, asp = %8p\n", asp));
|
||||
+ "delegated requests finish, asp = %8p\n",
|
||||
+ agent_delegated_list));
|
||||
break;
|
||||
}
|
||||
#endif /* NETSNMP_NO_WRITE_SUPPORT */
|
||||
@@ -2880,6 +2903,10 @@ check_delayed_request(netsnmp_agent_session *asp)
|
||||
case SNMP_MSG_GETBULK:
|
||||
case SNMP_MSG_GETNEXT:
|
||||
netsnmp_check_all_requests_status(asp, 0);
|
||||
+ if (asp->flags & SNMP_AGENT_FLAGS_CANCEL_IN_PROGRESS) {
|
||||
+ DEBUGMSGTL(("snmp_agent","canceling next walk for asp %p\n", asp));
|
||||
+ break;
|
||||
+ }
|
||||
handle_getnext_loop(asp);
|
||||
if (netsnmp_check_for_delegated(asp) &&
|
||||
netsnmp_check_transaction_id(asp->pdu->transid) !=
|
||||
diff --git a/include/net-snmp/agent/snmp_agent.h b/include/net-snmp/agent/snmp_agent.h
|
||||
index aad8837..43f4fff 100644
|
||||
--- a/include/net-snmp/agent/snmp_agent.h
|
||||
+++ b/include/net-snmp/agent/snmp_agent.h
|
||||
@@ -32,6 +32,9 @@ extern "C" {
|
||||
#define SNMP_MAX_PDU_SIZE 64000 /* local constraint on PDU size sent by agent
|
||||
* (see also SNMP_MAX_MSG_SIZE in snmp_api.h) */
|
||||
|
||||
+#define SNMP_AGENT_FLAGS_NONE 0x0
|
||||
+#define SNMP_AGENT_FLAGS_CANCEL_IN_PROGRESS 0x1
|
||||
+
|
||||
/*
|
||||
* If non-zero, causes the addresses of peers to be logged when receptions
|
||||
* occur.
|
||||
@@ -205,6 +208,7 @@ extern "C" {
|
||||
int treecache_num; /* number of current cache entries */
|
||||
netsnmp_cachemap *cache_store;
|
||||
int vbcount;
|
||||
+ int flags;
|
||||
} netsnmp_agent_session;
|
||||
|
||||
/*
|
||||
@@ -240,6 +244,7 @@ extern "C" {
|
||||
int init_master_agent(void);
|
||||
void shutdown_master_agent(void);
|
||||
int agent_check_and_process(int block);
|
||||
+ void netsnmp_check_delegated_requests(void);
|
||||
void netsnmp_check_outstanding_agent_requests(void);
|
||||
|
||||
int netsnmp_request_set_error(netsnmp_request_info *request,
|
||||
--
|
||||
2.17.1
|
||||
|
@ -1,26 +0,0 @@
|
||||
From 84846206c7ee230bd7b6274af98513952c4a7a7f Mon Sep 17 00:00:00 2001
|
||||
From: Renuka Manavalan <remanava@microsoft.com>
|
||||
Date: Wed, 7 Aug 2019 21:48:33 +0000
|
||||
Subject: [PATCH] Release all requests that use this session.
|
||||
|
||||
---
|
||||
agent/snmp_agent.c | 3 ++-
|
||||
1 file changed, 2 insertions(+), 1 deletion(-)
|
||||
|
||||
diff --git a/agent/snmp_agent.c b/agent/snmp_agent.c
|
||||
index b96d650..ee3b0da 100644
|
||||
--- a/agent/snmp_agent.c
|
||||
+++ b/agent/snmp_agent.c
|
||||
@@ -1542,7 +1542,8 @@ netsnmp_remove_delegated_requests_for_session(netsnmp_session *sess)
|
||||
* check each request
|
||||
*/
|
||||
netsnmp_request_info *request;
|
||||
- for(request = asp->requests; request; request = request->next) {
|
||||
+ int i;
|
||||
+ for(i = 0, request = asp->requests; i < asp->vbcount; ++i, ++request) {
|
||||
/*
|
||||
* check session
|
||||
*/
|
||||
--
|
||||
2.17.1
|
||||
|
@ -3,4 +3,4 @@
|
||||
0003-CHANGES-BUG-2743-snmpd-crashes-when-receiving-a-GetN.patch
|
||||
0004-Disable-SNMPv1.patch
|
||||
0005-Port-OpenSSL-1.1.0-with-support-for-1.0.2.patch
|
||||
0006-Release-all-requests-that-use-this-session.patch
|
||||
0006-From-Jiri-Cervenka-snmpd-Fixed-agentx-crashing-and-or-freezing-on-timeout.patch
|
||||
|
@ -2,21 +2,17 @@
|
||||
|
||||
STATE_DB_IDX="6"
|
||||
|
||||
PORT_TABLE_PREFIX="PORT_TABLE"
|
||||
VLAN_TABLE_PREFIX="VLAN_TABLE"
|
||||
LAG_TABLE_PREFIX="LAG_TABLE"
|
||||
|
||||
function wait_until_iface_ready
|
||||
{
|
||||
TABLE_PREFIX=$1
|
||||
IFACE=$2
|
||||
IFACE_NAME=$1
|
||||
IFACE_CIDR=$2
|
||||
|
||||
echo "Waiting until interface $IFACE is ready..."
|
||||
echo "Waiting until interface ${IFACE_NAME} is ready..."
|
||||
|
||||
# Wait for the interface to come up
|
||||
# (i.e., interface is present in STATE_DB and state is "ok")
|
||||
while true; do
|
||||
RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "${TABLE_PREFIX}|${IFACE}" "state" 2> /dev/null)
|
||||
RESULT=$(redis-cli -n ${STATE_DB_IDX} HGET "INTERFACE_TABLE|${IFACE_NAME}|${IFACE_CIDR}" "state" 2> /dev/null)
|
||||
if [ x"$RESULT" == x"ok" ]; then
|
||||
break
|
||||
fi
|
||||
@ -24,14 +20,14 @@ function wait_until_iface_ready
|
||||
sleep 1
|
||||
done
|
||||
|
||||
echo "Interface ${IFACE} is ready!"
|
||||
echo "Interface ${IFACE_NAME} is ready!"
|
||||
}
|
||||
|
||||
|
||||
# Wait for all interfaces to be up and ready
|
||||
wait_until_iface_ready ${VLAN_TABLE_PREFIX} Vlan1000
|
||||
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel01
|
||||
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel02
|
||||
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel03
|
||||
wait_until_iface_ready ${LAG_TABLE_PREFIX} PortChannel04
|
||||
# Wait for all interfaces with IPv4 addresses to be up and ready
|
||||
wait_until_iface_ready Vlan1000 192.168.0.1/27
|
||||
wait_until_iface_ready PortChannel01 10.0.0.56/31
|
||||
wait_until_iface_ready PortChannel02 10.0.0.58/31
|
||||
wait_until_iface_ready PortChannel03 10.0.0.60/31
|
||||
wait_until_iface_ready PortChannel04 10.0.0.62/31
|
||||
|
||||
|
@ -1 +1 @@
|
||||
Subproject commit fe60afa7e24a7053a7bd9d7084268c1bbd203208
|
||||
Subproject commit ffb3bad2f355c28be201d5f27ac4564c46047593
|
@ -21,7 +21,7 @@ $(addprefix $(DEST)/, $(MAIN_TARGET)): $(DEST)/% :
|
||||
stg init
|
||||
stg import -s ../patch/series
|
||||
|
||||
ifeq ($(CONFIGURED_ARCH), armhf)
|
||||
ifneq (,$(filter $(CONFIGURED_ARCH), armhf arm64))
|
||||
stg import -s ../patch/series-armhf
|
||||
endif
|
||||
|
||||
|
@ -5,7 +5,7 @@ SHELL = /bin/bash
|
||||
MAIN_TARGET = libnss-tacplus_$(NSS_TACPLUS_VERSION)_$(CONFIGURED_ARCH).deb
|
||||
|
||||
GIT_APPLY = am
|
||||
ifeq ($(CONFIGURED_ARCH), armhf)
|
||||
ifneq (,$(filter $(CONFIGURED_ARCH), armhf arm64))
|
||||
# Workaround git am issue "Out of memory getdelim failed"
|
||||
GIT_APPLY = apply
|
||||
endif
|
||||
|
Loading…
Reference in New Issue
Block a user