diff --git a/dockers/docker-lldp-sv2/Dockerfile.j2 b/dockers/docker-lldp-sv2/Dockerfile.j2 index 158d5b52ffe7..bfb1f9ca678a 100644 --- a/dockers/docker-lldp-sv2/Dockerfile.j2 +++ b/dockers/docker-lldp-sv2/Dockerfile.j2 @@ -30,7 +30,7 @@ RUN pip install /python-wheels/swsssdk-2.0.1-py2-none-any.whl && \ COPY ["start.sh", "/usr/bin/"] COPY ["supervisord.conf", "/etc/supervisor/conf.d/"] -COPY ["reconfigure.sh", "/opt/"] +COPY ["reconfigure.sh", "/usr/bin/"] COPY ["lldpd.conf.j2", "/usr/share/sonic/templates/"] COPY ["lldpd", "/etc/default/"] diff --git a/dockers/docker-lldp-sv2/reconfigure.sh b/dockers/docker-lldp-sv2/reconfigure.sh index 9f42a33a24b4..515e771aa6f2 100755 --- a/dockers/docker-lldp-sv2/reconfigure.sh +++ b/dockers/docker-lldp-sv2/reconfigure.sh @@ -2,9 +2,8 @@ set -e -num_of_interfaces=32 -if_step=4 -last_if_idx=$((num_of_interfaces*if_step - if_step)) +# TODO: Listen to state database when it is ready +interfaces=$(sonic-cfggen -d -v "PORT.keys() | join(' ')") function wait_until_if_exists { @@ -31,23 +30,23 @@ function wait_until_if_not_exists while /bin/true ; do # wait until all interfaces are created - echo Wait until all ifaces are created - for i in $(seq 0 $if_step $last_if_idx) + echo Wait until all interfaces are created + for i in $interfaces do - wait_until_if_exists "Ethernet$i" + wait_until_if_exists $i done echo Wait 10 seconds while lldpd finds new interfaces sleep 10 # apply lldpd configuration - echo apply lldpd configuration + echo Apply lldpd configuration lldpcli -c /etc/lldpd.conf # wait until all interfaces are destroyed echo Wait until all ifaces are destroyed - for i in $(seq 0 $if_step $last_if_idx) + for i in $interfaces do - wait_until_if_not_exists "Ethernet$i" + wait_until_if_not_exists $i done done diff --git a/dockers/docker-lldp-sv2/supervisord.conf b/dockers/docker-lldp-sv2/supervisord.conf index 505b72d18227..ab62d9ed2e87 100644 --- a/dockers/docker-lldp-sv2/supervisord.conf +++ b/dockers/docker-lldp-sv2/supervisord.conf @@ -33,7 +33,7 @@ stdout_logfile=syslog stderr_logfile=syslog [program:lldpd-conf-reload] -command=/opt/reconfigure.sh +command=/usr/bin/reconfigure.sh priority=150 autostart=false autorestart=false