-
Notifications
You must be signed in to change notification settings - Fork 85
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
network: bridge: add support for host_interface_name option
Fixes containers/netavark#24523 Signed-off-by: Michael Zimmermann <[email protected]>
- Loading branch information
Showing
5 changed files
with
114 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
#!/usr/bin/env bats -*- bats -*- | ||
# | ||
# bridge driver tests with static veth names | ||
# | ||
|
||
load helpers | ||
|
||
@test bridge - valid veth name { | ||
run_netavark --file ${TESTSDIR}/testfiles/bridge-vethname.json setup $(get_container_netns_path) | ||
|
||
run_in_host_netns ip -j --details link show my-veth | ||
link_info="$output" | ||
assert_json "$link_info" '.[].flags[] | select(.=="UP")' == "UP" "Host veth is up" | ||
assert_json "$link_info" ".[].linkinfo.info_kind" == "veth" "The veth interface is actually a veth" | ||
assert_json "$link_info" ".[].master" "==" "podman0" "veth is part of the correct bridge" | ||
|
||
run_netavark --file ${TESTSDIR}/testfiles/bridge-vethname.json teardown $(get_container_netns_path) | ||
|
||
# check if the interface gets removed | ||
expected_rc=1 run_in_host_netns ip -j --details link show my-veth | ||
} | ||
|
||
@test bridge - existing veth name { | ||
expected_rc=1 run_netavark --file ${TESTSDIR}/testfiles/bridge-vethname-exists.json setup $(get_container_netns_path) | ||
expected_rc=1 run_in_host_netns ip -j --details link show my-veth | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"container_id": "6ce776ea58b5", | ||
"container_name": "testcontainer", | ||
"networks": { | ||
"podman": { | ||
"interface_name": "eth0", | ||
"static_ips": [ | ||
"10.88.0.2" | ||
], | ||
"options": { | ||
"host_interface_name": "podman0" | ||
} | ||
} | ||
}, | ||
"network_info": { | ||
"podman": { | ||
"dns_enabled": false, | ||
"driver": "bridge", | ||
"id": "53ce4390f2adb1681eb1a90ec8b48c49c015e0a8d336c197637e7f65e365fa9e", | ||
"internal": false, | ||
"ipv6_enabled": false, | ||
"name": "podman", | ||
"network_interface": "podman0", | ||
"subnets": [ | ||
{ | ||
"gateway": "10.88.0.1", | ||
"subnet": "10.88.0.0/16" | ||
} | ||
] | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
{ | ||
"container_id": "6ce776ea58b5", | ||
"container_name": "testcontainer", | ||
"networks": { | ||
"podman": { | ||
"interface_name": "eth0", | ||
"static_ips": [ | ||
"10.88.0.2" | ||
], | ||
"options": { | ||
"host_interface_name": "my-veth" | ||
} | ||
} | ||
}, | ||
"network_info": { | ||
"podman": { | ||
"dns_enabled": false, | ||
"driver": "bridge", | ||
"id": "53ce4390f2adb1681eb1a90ec8b48c49c015e0a8d336c197637e7f65e365fa9e", | ||
"internal": false, | ||
"ipv6_enabled": false, | ||
"name": "podman", | ||
"network_interface": "podman0", | ||
"subnets": [ | ||
{ | ||
"gateway": "10.88.0.1", | ||
"subnet": "10.88.0.0/16" | ||
} | ||
] | ||
} | ||
} | ||
} |