forked from containers/netavark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request containers#1125 from M1cha/host-veth-name
Support changing host veth name
- Loading branch information
Showing
6 changed files
with
122 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
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,30 @@ | ||
#!/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 | ||
assert "$output" "==" 'Device "my-veth" does not exist.' | ||
} | ||
|
||
@test bridge - existing veth name { | ||
expected_rc=1 run_netavark --file ${TESTSDIR}/testfiles/bridge-vethname-exists.json setup $(get_container_netns_path) | ||
assert_json ".error" "create veth pair: interface eth0 already exists on container namespace or podman0 exists on host namespace: Netlink error: File exists (os error 17)" | ||
|
||
expected_rc=1 run_in_host_netns ip -j --details link show my-veth | ||
assert "$output" "==" 'Device "my-veth" does not exist.' | ||
} |
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" | ||
} | ||
] | ||
} | ||
} | ||
} |