mirror of https://github.com/docker/docker-py.git
Send LinkLocalIPs as part of IPAMConfig dictionary
Signed-off-by: Joffrey F <joffrey@docker.com>
This commit is contained in:
parent
30644d8ae0
commit
cea7376086
|
@ -894,15 +894,15 @@ def create_endpoint_config(version, aliases=None, links=None,
|
||||||
if ipv6_address:
|
if ipv6_address:
|
||||||
ipam_config['IPv6Address'] = ipv6_address
|
ipam_config['IPv6Address'] = ipv6_address
|
||||||
|
|
||||||
if ipam_config:
|
|
||||||
endpoint_config['IPAMConfig'] = ipam_config
|
|
||||||
|
|
||||||
if link_local_ips is not None:
|
if link_local_ips is not None:
|
||||||
if version_lt(version, '1.24'):
|
if version_lt(version, '1.24'):
|
||||||
raise errors.InvalidVersion(
|
raise errors.InvalidVersion(
|
||||||
'link_local_ips is not supported for API version < 1.24'
|
'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
|
return endpoint_config
|
||||||
|
|
||||||
|
|
|
@ -249,6 +249,27 @@ class TestNetworks(helpers.BaseTestCase):
|
||||||
'2001:389::f00d'
|
'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')
|
@requires_api_version('1.22')
|
||||||
def test_create_with_links(self):
|
def test_create_with_links(self):
|
||||||
net_name, net_id = self.create_network()
|
net_name, net_id = self.create_network()
|
||||||
|
|
Loading…
Reference in New Issue