Skip to content

Commit 0a54c46

Browse files
Pterosauryxieca
authored andcommitted
[docker-macsec]: Add dependencies of MACsec (#11770)
Why I did it If the SWSS services was restarted, the MACsec service should also be restarted. Otherwise the data in wpa_supplicant and orchagent will not be consistent. How I did it Add dependency in docker-macsec.mk. How to verify it Manually check by 'sudo service swss restart'. The MACsec container should be started after swss, the syslog will look like Sep 8 14:36:29.562953 sonic INFO swss.sh[9661]: Starting existing swss container with HWSKU Force10-S6000 Sep 8 14:36:30.024399 sonic DEBUG container: container_start: BEGIN ... Sep 8 14:36:33.391706 sonic INFO systemd[1]: Starting macsec container... Sep 8 14:36:33.392925 sonic INFO systemd[1]: Starting Management Framework container... Signed-off-by: Ze Gan <[email protected]>
1 parent b4bf4ac commit 0a54c46

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

files/scripts/swss.sh

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ function read_dependent_services()
3030
fi
3131

3232
if [[ -f ${ETC_SONIC_PATH}/${SERVICE}_multi_inst_dependent ]]; then
33-
MULTI_INST_DEPENDENT="${MULTI_INST_DEPENDENT} cat ${ETC_SONIC_PATH}/${SERVICE}_multi_inst_dependent"
33+
MULTI_INST_DEPENDENT="${MULTI_INST_DEPENDENT} $(cat ${ETC_SONIC_PATH}/${SERVICE}_multi_inst_dependent)"
3434
fi
3535
}
3636

@@ -308,6 +308,19 @@ function check_peer_gbsyncd()
308308
fi
309309
}
310310

311+
function check_macsec()
312+
{
313+
MACSEC_STATE=`show feature status | grep macsec | awk '{print $2}'`
314+
315+
if [[ ${MACSEC_STATE} == 'enabled' ]]; then
316+
if [ "$DEV" ]; then
317+
DEPENDENT="${DEPENDENT} macsec@${DEV}"
318+
else
319+
DEPENDENT="${DEPENDENT} macsec"
320+
fi
321+
fi
322+
}
323+
311324
if [ "$DEV" ]; then
312325
NET_NS="$NAMESPACE_PREFIX$DEV" #name of the network namespace
313326
SONIC_DB_CLI="sonic-db-cli -n $NET_NS"
@@ -319,6 +332,7 @@ else
319332
fi
320333

321334
check_peer_gbsyncd
335+
check_macsec
322336
read_dependent_services
323337

324338
case "$1" in

rules/docker-macsec.mk

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,9 @@ $(DOCKER_MACSEC)_RUN_OPT += --privileged -t
4242
$(DOCKER_MACSEC)_RUN_OPT += -v /etc/sonic:/etc/sonic:ro
4343
$(DOCKER_MACSEC)_RUN_OPT += -v /host/warmboot:/var/warmboot
4444

45+
$(DOCKER_MACSEC)_SERVICE_REQUIRES = updategraph
46+
$(DOCKER_MACSEC)_SERVICE_AFTER = swss syncd
47+
4548
$(DOCKER_MACSEC)_CLI_CONFIG_PLUGIN = /cli/config/plugins/macsec.py
4649
$(DOCKER_MACSEC)_CLI_SHOW_PLUGIN = /cli/show/plugins/show_macsec.py
4750
$(DOCKER_MACSEC)_CLI_CLEAR_PLUGIN = /cli/clear/plugins/clear_macsec_counter.py

0 commit comments

Comments
 (0)