Skip to content

Commit

Permalink
Add support for enable_ipv6
Browse files Browse the repository at this point in the history
Signed-off-by: Maximilian R <[email protected]>
  • Loading branch information
maxi0604 authored and p12tic committed Mar 9, 2024
1 parent bba1f33 commit 969edb8
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions podman_compose.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
24 changes: 24 additions & 0 deletions pytests/test_network_create_args.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,29 @@ def test_minimal(self):
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": [],
Expand Down Expand Up @@ -131,6 +154,7 @@ def test_complete(self):
"opt2=value2",
"--ipam-driver",
"default",
"--ipv6",
"--subnet",
"192.168.0.0/24",
"--ip-range",
Expand Down

0 comments on commit 969edb8

Please sign in to comment.