Skip to content

Commit

Permalink
[calc] work around the docker bridge network issue (sonic-net#4433)
Browse files Browse the repository at this point in the history
What is the motivation for this PR?
There is a docker bridge network issue that would randomly cause "docker inspect bridge" to not show 'Gateway' IP.

Reference: moby/moby#26799

How did you do it?
We could use the 'Subnet' entry for the test purpose.

How did you verify/test it?
Run test against device exhibiting the docker bridge network issue.
  • Loading branch information
yxieca authored and 119064273 committed Jan 25, 2022
1 parent f572d75 commit e082fbf
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions tests/cacl/test_cacl_application.py
Expand Up @@ -21,8 +21,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():
Expand Down

0 comments on commit e082fbf

Please sign in to comment.