forked from agama-project/agama
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7b9a3f7
commit 01c3419
Showing
17 changed files
with
210 additions
and
0 deletions.
There are no files selected for viewing
21 changes: 21 additions & 0 deletions
21
rust/agama-migrate-wicked/tests/bond_active-backup/system-connections/bond0.nmconnection
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,21 @@ | ||
[connection] | ||
id=bond0 | ||
uuid=a6902e59-964b-4651-b8d8-ffe67658ae9a | ||
type=bond | ||
interface-name=bond0 | ||
|
||
[bond] | ||
miimon=100 | ||
mode=active-backup | ||
primary=en0 | ||
|
||
[match] | ||
|
||
[ipv4] | ||
method=auto | ||
|
||
[ipv6] | ||
addr-gen-mode=default | ||
method=auto | ||
|
||
[proxy] |
11 changes: 11 additions & 0 deletions
11
rust/agama-migrate-wicked/tests/bond_active-backup/system-connections/en0.nmconnection
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,11 @@ | ||
[connection] | ||
id=en0 | ||
uuid=38d979e6-aa0e-4bae-8cff-a6dda281d0c7 | ||
type=ethernet | ||
interface-name=en0 | ||
master=bond0 | ||
slave-type=bond | ||
|
||
[ethernet] | ||
|
||
[match] |
11 changes: 11 additions & 0 deletions
11
rust/agama-migrate-wicked/tests/bond_active-backup/system-connections/en1.nmconnection
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,11 @@ | ||
[connection] | ||
id=en1 | ||
uuid=9269bbb4-a771-406f-ba66-3f65ed15634c | ||
type=ethernet | ||
interface-name=en1 | ||
master=bond0 | ||
slave-type=bond | ||
|
||
[ethernet] | ||
|
||
[match] |
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
rust/agama-migrate-wicked/tests/ipv4+6_dhcp/system-connections/eth0.nmconnection
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,18 @@ | ||
[connection] | ||
id=eth0 | ||
uuid=a123047b-232e-4b86-9f69-851e7690deaa | ||
type=ethernet | ||
interface-name=eth0 | ||
|
||
[ethernet] | ||
|
||
[match] | ||
|
||
[ipv4] | ||
method=auto | ||
|
||
[ipv6] | ||
addr-gen-mode=default | ||
method=auto | ||
|
||
[proxy] |
File renamed without changes.
20 changes: 20 additions & 0 deletions
20
rust/agama-migrate-wicked/tests/ipv4_static/system-connections/eth1.nmconnection
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,20 @@ | ||
[connection] | ||
id=eth1 | ||
uuid=4935f592-3e86-491b-847b-2ce4f180001c | ||
type=ethernet | ||
interface-name=eth1 | ||
|
||
[ethernet] | ||
|
||
[match] | ||
|
||
[ipv4] | ||
address1=192.168.100.5/24 | ||
address2=192.168.101.5/24 | ||
method=manual | ||
|
||
[ipv6] | ||
addr-gen-mode=default | ||
method=auto | ||
|
||
[proxy] |
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
rust/agama-migrate-wicked/tests/ipv6_auto/system-connections/eth2.nmconnection
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,18 @@ | ||
[connection] | ||
id=eth2 | ||
uuid=85378eec-2abb-4cbb-a3d3-69c10921b2e0 | ||
type=ethernet | ||
interface-name=eth2 | ||
|
||
[ethernet] | ||
|
||
[match] | ||
|
||
[ipv4] | ||
method=auto | ||
|
||
[ipv6] | ||
addr-gen-mode=default | ||
method=auto | ||
|
||
[proxy] |
File renamed without changes.
18 changes: 18 additions & 0 deletions
18
rust/agama-migrate-wicked/tests/ipv6_dhcp/system-connections/eth3.nmconnection
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,18 @@ | ||
[connection] | ||
id=eth3 | ||
uuid=ee291fe1-7dd3-4376-9c63-4228fab9df27 | ||
type=ethernet | ||
interface-name=eth3 | ||
|
||
[ethernet] | ||
|
||
[match] | ||
|
||
[ipv4] | ||
method=auto | ||
|
||
[ipv6] | ||
addr-gen-mode=default | ||
method=auto | ||
|
||
[proxy] |
File renamed without changes.
20 changes: 20 additions & 0 deletions
20
rust/agama-migrate-wicked/tests/ipv6_static/system-connections/eth4.nmconnection
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,20 @@ | ||
[connection] | ||
id=eth4 | ||
uuid=79dac508-d8ae-4bae-82bc-8590c9e501cd | ||
type=ethernet | ||
interface-name=eth4 | ||
|
||
[ethernet] | ||
|
||
[match] | ||
|
||
[ipv4] | ||
method=auto | ||
|
||
[ipv6] | ||
addr-gen-mode=default | ||
address1=2001:db8:0:1::5/64 | ||
address2=2001:db8:0:2::5/64 | ||
method=manual | ||
|
||
[proxy] |
File renamed without changes.
21 changes: 21 additions & 0 deletions
21
rust/agama-migrate-wicked/tests/single_gateway/system-connections/eth0.nmconnection
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,21 @@ | ||
[connection] | ||
id=eth0 | ||
uuid=676a03ec-54a6-4e45-b7ab-2eb0e1c18a75 | ||
type=ethernet | ||
interface-name=eth0 | ||
|
||
[ethernet] | ||
|
||
[match] | ||
|
||
[ipv4] | ||
address1=192.168.101.5/24,192.168.102.1 | ||
address2=192.168.102.5/24 | ||
method=manual | ||
|
||
[ipv6] | ||
addr-gen-mode=default | ||
address1=2001:db8:1::5/64,2001:db8:1::1 | ||
method=manual | ||
|
||
[proxy] |
File renamed without changes.
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,52 @@ | ||
#!/bin/bash | ||
RED='\033[0;31m' | ||
GREEN='\033[0;32m' | ||
NC='\033[0m' | ||
TEST_DIRS=$(ls -d */) | ||
RESULT=0 | ||
MIGRATE_WICKED_BIN=../../target/debug/migrate-wicked | ||
|
||
error_msg() { | ||
echo -e "${RED}Test $1: $2${NC}" | ||
} | ||
|
||
if [[ $(ls -A /etc/NetworkManager/system-connections/) ]]; then | ||
echo -e "${RED}There are already NM connections. You may be running this script on a live system, which is highly discouraged!${NC}" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -f $MIGRATE_WICKED_BIN ]; then | ||
echo -e "${RED}No migrate-wicked binary found${NC}" | ||
exit 1 | ||
fi | ||
|
||
for TEST_DIR in ${TEST_DIRS}; do | ||
$MIGRATE_WICKED_BIN show $TEST_DIR/wicked_xml | ||
if [ $? -ne 0 ]; then | ||
error_msg ${TEST_DIR/\//} "Show command failed" | ||
RESULT=1 | ||
fi | ||
$MIGRATE_WICKED_BIN migrate $TEST_DIR/wicked_xml | ||
if [ $? -ne 0 ]; then | ||
error_msg ${TEST_DIR/\//} "Migration failed" | ||
RESULT=1 | ||
continue | ||
fi | ||
for cmp_file in $(ls $TEST_DIR/system-connections/); do | ||
diff --unified=0 -I uuid $TEST_DIR/system-connections/$cmp_file /etc/NetworkManager/system-connections/${cmp_file/\./\*.} | ||
if [ $? -ne 0 ]; then | ||
error_msg ${TEST_DIR/\//} "NM Connection $cmp_file didn't match\n" | ||
RESULT=1 | ||
else | ||
echo -e "${GREEN}Migration for connection ${cmp_file/\.*/} successful${NC}\n" | ||
fi | ||
done | ||
rm -f /etc/NetworkManager/system-connections/* | ||
done | ||
|
||
if [ $RESULT -eq 0 ]; then | ||
echo -e "${GREEN}All tests successful${NC}" | ||
else | ||
echo -e "${RED}Some tests were unsuccessful${NC}" | ||
fi | ||
exit $RESULT |