Kaydet (Commit) cea73760 authored tarafından Joffrey F's avatar Joffrey F

Send LinkLocalIPs as part of IPAMConfig dictionary

Signed-off-by: 's avatarJoffrey F <joffrey@docker.com>
üst 30644d8a
......@@ -894,15 +894,15 @@ def create_endpoint_config(version, aliases=None, links=None,
if ipv6_address:
ipam_config['IPv6Address'] = ipv6_address
if ipam_config:
endpoint_config['IPAMConfig'] = ipam_config
if link_local_ips is not None:
if version_lt(version, '1.24'):
raise errors.InvalidVersion(
'link_local_ips is not supported for API version < 1.24'
)
endpoint_config['LinkLocalIPs'] = link_local_ips
ipam_config['LinkLocalIPs'] = link_local_ips
if ipam_config:
endpoint_config['IPAMConfig'] = ipam_config
return endpoint_config
......
......@@ -249,6 +249,27 @@ class TestNetworks(helpers.BaseTestCase):
'2001:389::f00d'
)
@requires_api_version('1.24')
def test_create_with_linklocal_ips(self):
container = self.client.create_container(
'busybox', 'top',
networking_config=self.client.create_networking_config(
{
'bridge': self.client.create_endpoint_config(
link_local_ips=['169.254.8.8']
)
}
),
host_config=self.client.create_host_config(network_mode='bridge')
)
self.tmp_containers.append(container)
self.client.start(container)
container_data = self.client.inspect_container(container)
net_cfg = container_data['NetworkSettings']['Networks']['bridge']
assert 'IPAMConfig' in net_cfg
assert 'LinkLocalIPs' in net_cfg['IPAMConfig']
assert net_cfg['IPAMConfig']['LinkLocalIPs'] == ['169.254.8.8']
@requires_api_version('1.22')
def test_create_with_links(self):
net_name, net_id = self.create_network()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment