From 2adc17f7f1e2e183107853aff62052ca04290b67 Mon Sep 17 00:00:00 2001 From: Ying Xie Date: Wed, 6 Oct 2021 14:32:15 -0700 Subject: [PATCH] [calc] work around the docker bridge network issue There is a docker bridge network issue that would randomly cause "docker inspect bridge" to not show 'Gateway' IP. We could use the 'Subnet' entry for the test purpose. Signed-off-by: Ying Xie --- tests/cacl/test_cacl_application.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/tests/cacl/test_cacl_application.py b/tests/cacl/test_cacl_application.py index 6375473fedc..e5e85409eae 100644 --- a/tests/cacl/test_cacl_application.py +++ b/tests/cacl/test_cacl_application.py @@ -37,8 +37,21 @@ def docker_network(duthost): ipam_info = json.loads(output['stdout'])[0]['IPAM'] docker_network = {} - docker_network['bridge'] = {'IPv4Address' : ipam_info['Config'][0]['Gateway'], - 'IPv6Address' : ipam_info['Config'][1]['Gateway'] } + """ + FIXME: Work around dockerd issue. The Gateway entry might be missing. In that case, use 'Subnet' instead. + Sample output when docker hit the issue (Note that the IPv6 gateway is missing): + "Config": [ + { + "Subnet": "240.127.1.1/24", + "Gateway": "240.127.1.1" + }, + { + "Subnet": "fd00::/80" + } + ] + """ + docker_network['bridge'] = {'IPv4Address' : ipam_info['Config'][0].get('Gateway', ipam_info['Config'][0].get('Subnet')), + 'IPv6Address' : ipam_info['Config'][1].get('Gateway', ipam_info['Config'][1].get('Subnet')) } docker_network['container'] = {} for k,v in docker_containers_info.items():