File tree 2 files changed +30
-5
lines changed
dockers/docker-dhcp-relay
2 files changed +30
-5
lines changed Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
2
3
+ function wait_until_iface_exists
4
+ {
5
+ IFACE=$1
6
+
7
+ echo " Waiting for interface ${IFACE} ..."
8
+
9
+ # Wait for the interface to come up (i.e., 'ip link show' returns 0)
10
+ until ip link show $IFACE > /dev/null 2>&1 ; do
11
+ sleep 1
12
+ done
13
+
14
+ echo " Interface ${IFACE} is created"
15
+ }
16
+
17
+ # Create isc-dhcp-relay config file
3
18
sonic-cfggen -m /etc/sonic/minigraph.xml -t /usr/share/sonic/templates/isc-dhcp-relay.j2 > /etc/default/isc-dhcp-relay
4
19
5
20
rm -f /var/run/rsyslogd.pid
6
21
7
22
supervisorctl start rsyslogd
8
23
9
- VLAN_IFACE_NAME=` sonic-cfggen -m /etc/sonic/minigraph.xml -v " minigraph_vlan_interfaces[0]['attachto']" `
24
+ # Wait for all interfaces to come up before starting the DHCP relay
25
+
26
+ FRONT_PANEL_IFACES=$( sonic-cfggen -m /etc/sonic/minigraph.xml --var-json " minigraph_interfaces" | grep " \" attachto\" :" | sed ' s/^\s*"attachto":\s"\(.*\)".*$/\1/' )
27
+ for IFACE in $FRONT_PANEL_IFACES ; do
28
+ wait_until_iface_exists $IFACE
29
+ done
30
+
31
+ VLAN_IFACES=$( sonic-cfggen -m /etc/sonic/minigraph.xml --var-json " minigraph_vlan_interfaces" | grep " \" attachto\" :" | sed ' s/^\s*"attachto":\s"\(.*\)".*$/\1/' )
32
+ for IFACE in $VLAN_IFACES ; do
33
+ wait_until_iface_exists $IFACE
34
+ done
10
35
11
- # Wait for the VLAN to come up (i.e., 'ip link show' returns 0 )
12
- until ip link show $VLAN_IFACE_NAME > /dev/null 2>&1 ; do
13
- sleep 1
36
+ PORTCHANNEL_IFACES= $( sonic-cfggen -m /etc/sonic/minigraph.xml --var-json " minigraph_portchannel_interfaces " | grep " \" attachto \" : " | sed ' s/^\s*"attachto":\s"\(.*\)".*$/\1/ ' )
37
+ for IFACE in $PORTCHANNEL_IFACES ; do
38
+ wait_until_iface_exists $IFACE
14
39
done
15
40
16
41
# Start the DHCP relay
Original file line number Diff line number Diff line change 1
1
[Unit]
2
2
Description=DHCP relay container
3
3
Requires=docker.service
4
- After=interfaces-config .service
4
+ After=swss .service
5
5
6
6
[Service]
7
7
User={{ sonicadmin_user }}
You can’t perform that action at this time.
0 commit comments