| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | CASE=$1 |
| 4 | if [scip-shell system . . `[`. -z "$CASE" ]; then |
| 5 | echoscip-shell system . . echo. "Need a test case directory as argument!" >&2 |
| 6 | exit 2 |
| 7 | fi |
| 8 | |
| 9 | echoscip-shell system . . echo. |
| 10 | echoscip-shell system . . echo. "CASE $CASE" |
| 11 | echoscip-shell system . . echo. |
| 12 | |
| 13 | DEVICES="$( lsscip-shell system . . ls. /sys/class/net/scip-shell filesystem . . `/sys/class/net/`. | grepscip-shell system . . grep. -Ewv "(bonding_masters|eth0|lo)" )" |
| 14 | |
| 15 | # Cleanup of network interfaces |
| 16 | for dev in $DEVICES; do |
| 17 | ip addr flush dev $dev |
| 18 | ip link set dev $dev down |
| 19 | ip link del $dev |
| 20 | done 2>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 21 | |
| 22 | for file in 60-network-devices.sh 62-routing.sh; do |
| 23 | bashscip-shell system . . bash. $CASE/$file |
| 24 | done |
| 25 | |
| 26 | sleepscip-shell system . . sleep. 3 |
| 27 | |
| 28 | tmpfile_ipa=$( mktempscip-shell system . . mktemp. /tmp/REARXXXscip-shell filesystem . . `/tmp/REARXXX`. ) |
| 29 | tmpfile_ipr=$( mktempscip-shell system . . mktemp. /tmp/REARXXXscip-shell filesystem . . `/tmp/REARXXX`. ) |
| 30 | |
| 31 | DEVICES="$( lsscip-shell system . . ls. /sys/class/net/scip-shell filesystem . . `/sys/class/net/`. | grepscip-shell system . . grep. -Ewv "(bonding_masters|eth0|lo)" )" |
| 32 | |
| 33 | for dev in $DEVICES; do |
| 34 | ip addr show dev $dev |
| 35 | done 2>/dev/nullscip-shell filesystem . . `/dev/null`. | grepscip-shell system . . grep. -Ew "(mtu|inet)" | sedscip-shell system . . sed. -e "s/^[0-9]*: //" -e "s/ group \S* / /" > $tmpfile_ipa |
| 36 | |
| 37 | for dev in $DEVICES; do |
| 38 | ip r show dev $dev |
| 39 | done 2>/dev/nullscip-shell filesystem . . `/dev/null`. | sortscip-shell system . . sort. > $tmpfile_ipr |
| 40 | |
| 41 | echoscip-shell system . . echo. |
| 42 | echoscip-shell system . . echo. "Verifying 'ip a' output" |
| 43 | echoscip-shell system . . echo. |
| 44 | rc=0 |
| 45 | if ! diffscip-shell system . . diff. -u <(sortscip-shell system . . sort. $CASE/ip_a.expected) <(sortscip-shell system . . sort. $tmpfile_ipa); then |
| 46 | rc=1 |
| 47 | else |
| 48 | /bin/rmscip-shell filesystem . . `/bin/rm`. $tmpfile_ipa |
| 49 | echoscip-shell system . . echo. "ip a OK" |
| 50 | fi |
| 51 | |
| 52 | echoscip-shell system . . echo. |
| 53 | echoscip-shell system . . echo. "Verifying 'ip r' output" |
| 54 | echoscip-shell system . . echo. |
| 55 | if ! diffscip-shell system . . diff. -u <(sortscip-shell system . . sort. $CASE/ip_r.expected) <(sortscip-shell system . . sort. $tmpfile_ipr); then |
| 56 | rc=1 |
| 57 | else |
| 58 | /bin/rmscip-shell filesystem . . `/bin/rm`. $tmpfile_ipr |
| 59 | echoscip-shell system . . echo. "ip r OK" |
| 60 | fi |
| 61 | |
| 62 | # Cleanup of network interfaces |
| 63 | for dev in $DEVICES; do |
| 64 | ip addr flush dev $dev |
| 65 | ip link set dev $dev down |
| 66 | ip link del $dev |
| 67 | done 2>/dev/nullscip-shell filesystem . . `/dev/null`. |
| 68 | |
| 69 | exit $rc |