Work around weird lldpd behaviour. Write config files instead of using lldpcli.

This commit is contained in:
Henning Stahlke 2022-02-05 23:38:10 +01:00
parent 52cb2e0bfe
commit 77313fad93
3 changed files with 20 additions and 9 deletions

View File

@ -3,11 +3,10 @@ RUN apk add --no-cache nano openvswitch tcpdump net-snmp lldpd
RUN mkdir -p /run/openvswitch && mkdir -p /var/log/openvswitch
COPY snmpd.conf /etc/snmp/snmpd.conf
COPY lldpd.conf /etc/lldpd.d/lldpd.conf
COPY boot.sh /bin/boot.sh
RUN chmod a+x /bin/boot.sh
COPY rstp /bin/rstp
RUN chmod a+x /bin/rstp
COPY boot.sh /bin/boot.sh
RUN chmod a+x /bin/boot.sh
VOLUME /etc/openvswitch/
VOLUME /etc/lldpd.d/

View File

@ -68,17 +68,27 @@ done
/sbin/udhcpc -R --timeout=1 --tryagain=1 -b -p /var/run/udhcpc.$MGMT_IF.pid -i $MGMT_IF
[ "$LLDP" == "1" ] && /usr/sbin/lldpd -x
[ "$SNMP" == "1" ] && /usr/sbin/snmpd
if [ -n "$LLDP_CHASSIS_ID" ]; then
lldpcli configure system chassisid $LLDP_CHASSIS_ID
echo "Setting LLDP chassis ID to '$LLDP_CHASSIS_ID' "
echo "configure system chassisid $LLDP_CHASSIS_ID" > /etc/lldpd.d/90_chassis-id.conf
else
echo "" > /etc/lldpd.d/90_chassis-id.conf
fi
if [ "$LLDP_PID_TYPE" == "ifname" ]; then
lldpcli configure lldp portidsubtype ifname
echo "Setting LLDP port ID type to '$LLDP_PID_TYPE' "
echo "configure lldp portidsubtype ifname" > /etc/lldpd.d/90_portidsubtype.conf
elif [ "$LLDP_PID_TYPE" == "mac" ]; then
lldpcli configure lldp portidsubtype macaddress
echo "Setting LLDP port ID type to '$LLDP_PID_TYPE' "
echo "configure lldp portidsubtype macaddress" > /etc/lldpd.d/90_portidsubtype.conf
else
echo "" > /etc/lldpd.d/90_portidsubtype.conf
fi
[ "$SNMP" == "1" ] && /usr/sbin/snmpd
if [ "$LLDP" == "1" ]; then
/usr/sbin/lldpd -x
fi
/bin/sh

View File

@ -1,5 +1,7 @@
#
# lldpd configuration examples
# GNS3 lldpd configuration examples
# Some items can be configured from env variables (e.g TLV 1 and 2)
# see /bin/boot.sh
#
## timers