diff options
Diffstat (limited to 'usr/src/test/net-tests/tests')
-rw-r--r-- | usr/src/test/net-tests/tests/forwarding/README | 3 | ||||
-rw-r--r-- | usr/src/test/net-tests/tests/forwarding/ip_forwarding.ksh | 19 | ||||
-rw-r--r-- | usr/src/test/net-tests/tests/net_common.ksh | 45 |
3 files changed, 49 insertions, 18 deletions
diff --git a/usr/src/test/net-tests/tests/forwarding/README b/usr/src/test/net-tests/tests/forwarding/README index b291d5d45b..dbe8774a22 100644 --- a/usr/src/test/net-tests/tests/forwarding/README +++ b/usr/src/test/net-tests/tests/forwarding/README @@ -101,9 +101,6 @@ to router via mac-loopback. Requirements ------------ -* These tests are currently SmartOS specific as they rely on simnet - extensions only found in illumos-joyent. - * The client and server zones must provide `/usr/bin/socat`. It would be nice to use netcat but our native version is missing features like connection timeout. diff --git a/usr/src/test/net-tests/tests/forwarding/ip_forwarding.ksh b/usr/src/test/net-tests/tests/forwarding/ip_forwarding.ksh index d93260f86d..bf7a2255af 100644 --- a/usr/src/test/net-tests/tests/forwarding/ip_forwarding.ksh +++ b/usr/src/test/net-tests/tests/forwarding/ip_forwarding.ksh @@ -18,7 +18,7 @@ # # ip_forwarding.ksh -bcflnpuv <client> <router> <server> # -# Where client, router, and server are the UUIDs of three native +# Where client, router, and server are the names of three native # zones. The user must create and start these zones; but other # than that there is no special configuration required for them. # @@ -113,7 +113,7 @@ nt_rx_ip_cksum=0 nt_cleanup=1 nt_cleanup_only=0 -nt_tdirprefix=/tmp/${nt_tname} +nt_tdirprefix=/var/tmp/${nt_tname} nt_tdir=${nt_tdirprefix}.$$ nt_dfile=${nt_tdir}/${nt_tname}.data nt_efile=${nt_tdir}/${nt_tname}-expected-sha1 @@ -230,9 +230,18 @@ if ((nt_cleanup_only == 1)); then exit 0 fi -mkdir $nt_tdir -zlogin $nt_client mkdir $nt_tdir -zlogin $nt_server mkdir $nt_tdir +if ! mkdir $nt_tdir; then + fail "failed to mkdir $nt_tdir in GZ" +fi +dbg "created dir $nt_tdir in GZ" +if ! zlogin $nt_client mkdir $nt_tdir; then + fail "failed to mkdir $nt_tdir in $nt_client" +fi +dbg "created dir $nt_tdir in $nt_client" +if ! zlogin $nt_server mkdir $nt_tdir; then + fail "failed to mkdir $nt_tdir in $nt_server" +fi +dbg "created dir $nt_tdir in $nt_server" trap cleanup ERR diff --git a/usr/src/test/net-tests/tests/net_common.ksh b/usr/src/test/net-tests/tests/net_common.ksh index 0742775193..b83cda8c97 100644 --- a/usr/src/test/net-tests/tests/net_common.ksh +++ b/usr/src/test/net-tests/tests/net_common.ksh @@ -178,10 +178,13 @@ function vnic_exists fail "$0: incorrect number of args provided" fi - if dladm show-vnic -z $zone $name > /dev/null 2>&1; then - typeset avid=$(dladm show-vnic -z $zone -p -o vid $name) - typeset aover=$(dladm show-vnic -z $zone -p -o over $name) - if (($avid == $vid)) && [ $aover == $over ]; then + if dladm show-vnic $name > /dev/null 2>&1; then + typeset avid=$(dladm show-vnic -p -o vid $name) + typeset aover=$(dladm show-vnic -p -o over $name) + typeset azone=$(dladm show-linkprop -cp zone -o value $name) + if (($avid == $vid)) && [ $aover == $over ] && \ + [ $azone == $zone ] + then return 0 else return 1 @@ -211,14 +214,31 @@ function create_vnic fi dbg "creating VNIC: $vnic_info" - if dladm create-vnic -t -p zone=$zone -l $over \ - $vid_opt $name > /dev/null 2>&1 + if ! dladm create-vnic -t -l $over $vid_opt $name > /dev/null 2>&1 then - dbg "created VNIC: $vnic_info" + maybe_fail "$err" + return 1 + fi + + dbg "created VNIC: $vnic_info" + if ! zonecfg -z $zone "add net; set physical=$name; end"; then + maybe_fail "failed to assign $name to $zone" + return 1 + fi + + dbg "assigned VNIC $name to $zone" + if zoneadm -z $zone reboot; then + dbg "rebooted $zone" + # + # Make sure the vnic is visible before returning. Without this + # a create_addr command following immediately afterwards could + # fail because the zone is up but the vnic isn't visible yet. + # + sleep 1 return 0 fi - maybe_fail "$err" + maybe_fail "failed to reboot $zone" } function delete_vnic @@ -235,8 +255,13 @@ function delete_vnic fi dbg "assigning VNIC $name from $zone to GZ" - if ! dladm set-linkprop -t -z $zone -p zone=global $name; then - maybe_fail "$err1" + + if ! zonecfg -z $zone "remove net physical=$name"; then + maybe_fail "failed to remove $name from $zone" + return 1 + fi + if ! zoneadm -z $zone reboot; then + maybe_fail "failed to reboot $zone" return 1 fi |