Add support for enable_ipv6

Signed-off-by: Maximilian R <maxi.rostock@outlook.de>
This commit is contained in:
Maximilian R 2023-08-23 17:48:32 +02:00 committed by Povilas Kanapickas
parent bba1f33d51
commit 969edb88d0
2 changed files with 27 additions and 0 deletions

View File

@ -705,6 +705,9 @@ def get_network_create_args(net_desc, proj_name, net_name):
if ipam_driver:
args.extend(("--ipam-driver", ipam_driver))
ipam_config_ls = ipam.get("config", None) or []
if net_desc.get("enable_ipv6", None):
args.append("--ipv6")
if is_dict(ipam_config_ls):
ipam_config_ls = [ipam_config_ls]
for ipam_config in ipam_config_ls:

View File

@ -26,6 +26,29 @@ class TestGetNetworkCreateArgs(unittest.TestCase):
args = get_network_create_args(net_desc, proj_name, net_name)
self.assertEqual(args, expected_args)
def test_ipv6(self):
net_desc = {
"labels": [],
"internal": False,
"driver": None,
"driver_opts": {},
"ipam": {"config": []},
"enable_ipv6": True,
}
proj_name = "test_project"
net_name = "test_network"
expected_args = [
"create",
"--label",
f"io.podman.compose.project={proj_name}",
"--label",
f"com.docker.compose.project={proj_name}",
"--ipv6",
net_name,
]
args = get_network_create_args(net_desc, proj_name, net_name)
self.assertEqual(args, expected_args)
def test_bridge(self):
net_desc = {
"labels": [],
@ -131,6 +154,7 @@ class TestGetNetworkCreateArgs(unittest.TestCase):
"opt2=value2",
"--ipam-driver",
"default",
"--ipv6",
"--subnet",
"192.168.0.0/24",
"--ip-range",