Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

1. Setup VM with:

  • CPU - 4

  • Memory - 8GB

  • Hard disk - 100GB

  • Have to use DEBUG build, where we have debug macro

Setup process is described in this instruction.

Info

Note : If you already created dilos_BASE BE according the instruction, and there is no any new tested stable version, just execute the following command:

beadm activate dilos_BASE

In other case if you have already the dilos_ISO_orig BE - make the command:

beadm activate dilos_ISO_orig

Then reboot and start the instruction from the section Step 6. Prepare VM for Tests Running:

reboot

If you have no one of these 2 BEs then start the instruction from the beginning.

Info

Note : Create ztest user if you forgot to do it according the instruction:

sudo useradd -m -d /var/ztest -g staff -s /bin/bash ztest

sudo passwd ztest

echo "ztest ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/ztest

2. Install packages for net tests:

Info

Note : If you already did it on the previous step when preparing VM to run, then you can skip this step and go to the next one.

Code Block
languagebash
sudo apt update
sudo apt install system-test-nettest testrunner python3

3. Login by user ztest and create zones:

Zones must be created according to the file:
/opt/net-tests/config/ip_forwarding.config
Currently accepted names: cz, sz, rz

Note

Important! Zones must be placed to the /zones directory like dhcp zone.

Configure, install and boot zones. The following is the configuration for the cz zone:

Code Block
languagebash
ztest@dilos:~# cat > cz.cfg <<EOT
create
set zonepath=/zones/cz
set autoboot=false
set ip-type=exclusive
add net
set physical=int1
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
ztest@dilos:~# sudo zonecfg -z cz -f cz.cfg
ztest@dilos:~# sudo zoneadm -z cz install && sudo zoneadm -z cz boot

For other zones settings will be the same. For the sz zone:

...

1. Setup VM with:

  • CPU - 4

  • Memory - 8GB

  • Hard disk - 100GB

  • Have to use DEBUG build, where we have debug macro

Setup process is described in this instruction.

Info

Note : If you already created dilos_BASE BE according the instruction, and there is no any new tested stable version, just execute the following command:

beadm activate dilos_BASE

In other case if you have already the dilos_ISO_orig BE - make the command:

beadm activate dilos_ISO_orig

Then reboot and start the instruction from the section Step 6. Prepare VM for Tests Running:

reboot

If you have no one of these 2 BEs then start the instruction from the beginning.

Info

Note : Create ztest user if you forgot to do it according the instruction:

sudo useradd -m -d /var/ztest -g staff -s /bin/bash ztest

sudo passwd ztest

echo "ztest ALL=(ALL:ALL) NOPASSWD: ALL" >> /etc/sudoers.d/ztest

2. Install packages for net tests:

Info

Note : If you already did it on the previous step when preparing VM to run, then you can skip this step and go to the next one.

Code Block
languagebash
sudo apt update
reboot
sudo apt install system-test-nettest testrunner python3

3. Login by user ztest and create zones:

Zones must be created according to the file:
/opt/net-tests/config/ip_forwarding.config
Currently accepted names: cz, sz, rz

Note

Important! Zones must be placed to the /zones directory like dhcp zone.

You can use the installation script or do the following steps.

First configure and install template zones cz-orig, sz-orig and rz-orig, from which test zones will be created later:

Code Block
ztest@dilos:~# cat > szcz-orig.cfg <<EOT
create
set zonepath=/zones/szcz-orig
set autoboot=false
set ip-type=exclusive
add net
set physical=int2int1
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
ztest@dilos:~# sudo zonecfg -z szcz-orig -f szcz-orig.cfg
ztest@dilos:~# sudo zoneadm -z szcz-orig install 2>&& sudo zoneadm -z sz boot

and for the rz zone:

Code Block
languagebash
ztest@dilos:1 | /usr/bin/tee -a /var/tmp/cz-orig-bts.log

ztest@dilos:~# cat > rzsz-orig.cfg <<EOT
create
set zonepath=/zones/rzsz-orig
set autoboot=false
set ip-type=exclusive
add net
set physical=int3int2
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
ztest@dilos:~# sudo zonecfg -z rzsz-orig -f rzsz-orig.cfg ztest@dilos:~#&& sudo zoneadm -z rzsz-orig install
&& sudo zoneadm -z rz boot

4. Install the socat package for every zone

The zones have not configured net, need to install it from the global zone.

Download it in the global zone:

Code Block
languagebash
apt download socat

In the current version, the name of the downloaded file is socat_1.7.3.1-2+deb9u1+dilos2_solaris-i386.deb

Install into the zones:

Code Block
languagebash
sudo apt -y -o Dir=/zones/cz/root update
sudo apt -y -o Dir=/zones/cz/root upgrade
sudo dpkg -i --root=/zones/cz/root socat_1.7.3.1-2+deb9u1+dilos2_solaris-i386.deb

sudo apt -y -o Dir=/zones/sz/root update
sudo apt -y -o Dir=/zones/sz/root upgrade
sudo dpkg -i --root=/zones/sz/root socat_1.7.3.1-2+deb9u1+dilos2_solaris-i386.deb

sudo apt -y -o Dir=/zones/rz/root update
sudo apt -y -o Dir=/zones/rz/root upgrade
sudo dpkg -i --root=/zones/rz/root socat_1.7.3.1-2+deb9u1+dilos2_solaris-i386.deb

sudo reboot

5. Launch tests

Check that dhcp zone and server are running after reboot and run test zones and tests:

Code Block
languagebash
sudo zoneadm -z cz boot && sudo zoneadm -z sz boot && sudo zoneadm -z rz boot
sudo /opt/net-tests/bin/nettest

Wait for several minutes and have found full logs at:

/var/tmp/test_results/<ISO TIME>

Info

Note : You can run the test using a shell script. It can be created with any text editor or by executing the following command:

ztest@zone:~# cat > test-script.sh <<EOT

#!/bin/bash

LOG="/var/tmp/nettest.\$(date +%F-%T).txt"

echo Booting zones...

sudo zoneadm -z cz boot && sudo zoneadm -z sz boot && sudo zoneadm -z rz boot

echo Done. Starting tests...

uname -a > a.tmp

echo "" >> a.tmp

echo ============================= IP Address ====================== 2>&1 | /usr/bin/tee -a \${LOG}

sudo ifconfig | grep -A 1 vmxnet3s0 2>&1 | /usr/bin/tee -a \${LOG}

echo =============================== Zones =========================

ztest@dilos:~# cat > rz-orig.cfg <<EOT
create
set zonepath=/zones/rz-orig
set autoboot=false
set ip-type=exclusive
add net
set physical=int3
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
ztest@dilos:~# sudo zonecfg -z rz-orig -f rz-orig.cfg && sudo zoneadm -z rz-orig install

You can check that zone instillation procedure was successfully by entering the following command:

Code Block
grep -e 'WARNING:' -e 'warning:' -e 'W:' -e 'error:' -e 'ERROR:' /var/tmp/cz-orig-bts.log | sort -u

Now configure test zones. The following is the configuration for the cz zone:

Code Block
languagebash
ztest@dilos:~# cat > cz.cfg <<EOT
create
set zonepath=/zones/cz
set autoboot=false
set ip-type=exclusive
add net
set physical=int1
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
ztest@dilos:~# sudo zonecfg -z cz -f cz.cfg

For other zones settings will be the same. For the sz zone:

Code Block
languagebash
ztest@dilos:~# cat > sz.cfg <<EOT
create
set zonepath=/zones/sz
set autoboot=false
set ip-type=exclusive
add net
set physical=int2
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
ztest@dilos:~# sudo zonecfg -z sz -f sz.cfg

and for the rz zone:

Code Block
languagebash
ztest@dilos:~# cat > rz.cfg <<EOT
create
set zonepath=/zones/rz
set autoboot=false
set ip-type=exclusive
add net
set physical=int3
set global-nic="vsw0"
add property (name="ip",value="dhcp")
add property (name="primary",value="true")
end
commit
exit
EOT
ztest@dilos:~# sudo zonecfg -z rz -f rz.cfg

Install the socat package for every template zone

The zones have not configured net, need to install it from the global zone. Download the package inside the global zone:

Code Block
languagebash
apt download socat
Info

Note: After downloading you can know the name of the package by the command:

ls -l | grep socat | sed 's/^.* //'

Install it into the zones:

Code Block
languagebash
sudo apt -y -o Dir=/zones/cz-orig/root update
sudo apt -y -o Dir=/zones/cz-orig/root upgrade
sudo dpkg -i --root=/zones/cz-orig/root socat_*.deb

sudo apt -y -o Dir=/zones/sz-orig/root update
sudo apt -y -o Dir=/zones/sz-orig/root upgrade
sudo dpkg -i --root=/zones/sz-orig/root socat_*.deb

sudo apt -y -o Dir=/zones/rz-orig/root update
sudo apt -y -o Dir=/zones/rz-orig/root upgrade
sudo dpkg -i --root=/zones/rz-orig/root socat_*.deb

sudo reboot

4. Login by user ztest and run tests

Check that dhcp zone and server are running after reboot and run test zones and tests:

Code Block
languagebash
sudo zoneadm -z cz halt
sudo zoneadm -z cz uninstall -F
sudo zfs destroy -fr rpool/zones/cz
sudo zoneadm -z cz clone \cz-orig && sudo zoneadm -z \cz boot
sudo zoneadm -z sz halt
sudo zoneadm -z sz uninstall -F
sudo zfs destroy -fr rpool/zones/sz
sudo zoneadm -z sz clone \sz-orig && sudo zoneadm -z \sz boot
sudo zoneadm -z rz halt
sudo zoneadm -z rz uninstall -F
sudo zfs destroy -fr rpool/zones/rz
sudo zoneadm -z rz clone \rz-orig && sudo zoneadm -z \rz boot

Wait while dynamic addresses will be received in every test zones and run tests:

Code Block
sudo /opt/net-tests/bin/nettest
Expand
titleTo understand that dynamic address is received,

for example, for cz zone you can with the command:

Code Block
sudo zlogin -l root cz ifconfig

You will get an answer like this:

Code Block
lo0: flags=2001000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv4,VIRTUAL> mtu 8232 index 1
        inet 127.0.0.1 netmask ff000000 
int0: flags=1000843<UP,BROADCAST,RUNNING,MULTICAST,IPv4> mtu 9000 index 2
        inet 192.168.0.100 netmask ffffff00 broadcast 192.168.0.255
        ether 2:8:20:f1:af:75 
lo0: flags=2002000849<UP,LOOPBACK,RUNNING,MULTICAST,IPv6,VIRTUAL> mtu 8252 index 1
        inet6 ::1/128 

First it can be empty, then with inet 0.0.0.0address for int0 interface here, and then with real received address - here it is inet 192.168.0.100.

The same way you can use for sz an rz zones as well.

Wait for several minutes and have found full logs at:

/var/tmp/test_results/<ISO TIME>

Info

Note : You can run the test using a shell script. It can be created with any text editor or by executing the following command:

ztest@zone:~# cat > test-script.sh <<EOT

#!/bin/bash

boot_zone() {

echo Shutting down zone \$1...

sudo zoneadm -z \$1 halt

echo Cleaning zone \$1 dataset...

sudo zoneadm -z \$1 uninstall -F

sudo zfs destroy -fr rpool/zones/\$1

echo Booting zone \$1...

sudo zoneadm -z \$1 clone \$1-orig && sudo zoneadm -z \$1 boot

ip=""

while [ "\${ip}" == "" ] || [ "\${ip}" == "0.0.0.0" ]

do

ip=\$(sudo zlogin -l root \$1 ifconfig | grep -A 1 "\${2}" | sed "/\${2}/d; s/^[ \\t]*inet[ \\t]*//; s/[ \\t]*netmask.*\$//")

done

echo "Zone:\$1 ------> \$2:\$ip"

}

echo Starting tests...

ipa=\$(sudo ifconfig | grep -A 1 vmxnet3s0 | sed '1d; s/^[ \\t]*inet[ \\t]*//; s/[ \\t]*netmask.*\$//')

if [ -n "\$1" ]; then

CLOG="/var/tmp/net-stability.\$(date +%F-%T).txt"

echo "=== Stability net tests \$(date +%F-%T) ===" > \${CLOG}

for (( i=1; i<=\$1; i++ ))

do

echo "------------------ Pass \${i} ---------------------" 2>&1 | /usr/bin/tee -a \${CLOG}

boot_zone cz int1

boot_zone sz int2

boot_zone rz int3

LOG="/var/tmp/net-test.\$i.txt"

uname -a > \${LOG}

echo "IP Address : \${ipa}" >> \${LOG}

echo "" >> \${LOG}

echo ----------------------------- IP Address ---------------------- 2>&1 | /usr/bin/tee -a \${LOG}

sudo ifconfig | grep -A 1 vmxnet3s0 2>&1 | /usr/bin/tee -a \${LOG}

echo ------------------------------- Zones ------------------------- 2>&1 | /usr/bin/tee -a \${LOG}

sudo zoneadm list -v 2>&1 | /usr/bin/tee -a \${LOG}

echo ---------------------------- DHCP Server ---------------------- 2>&1 | /usr/bin/tee -a \${LOG}

sudo svcs -z dhcp isc-dhcp-server 2>&1 | /usr/bin/tee -a \${LOG}

echo ------------------------------- Tests ------------------------- 2>&1 | /usr/bin/tee -a \${LOG}

sudo /opt/net-tests/bin/nettest /var/tmp 2>&1 | /usr/bin/tee -a /var/tmp/a.tmp

percent="\$(grep 'Percent passed:' /var/tmp/a.tmp | sed 's/Percent passed:[ \\t]*//; s/[ \\t]*\$//')"

folder="\$(grep 'Log directory:' /var/tmp/a.tmp | sed 's/Log directory:[ \\t]*//; s/[ \\t]*\$//')"

rt="\$(grep 'Running Time:' /var/tmp/a.tmp | sed 's/Running Time:[ \\t]*//; s/[ \\t]*\$//')"

echo " Percent passed: \${percent}" >> \${CLOG}

echo " Running Time: \${rt}" >> \${CLOG}

sed -n '/Results Summary/,/Log directory:/p' /var/tmp/a.tmp >> \${LOG}

echo "" >> \${LOG}

cat /var/tmp/a.tmp >> \${LOG}

rm -f /var/tmp/a.tmp

if [ "\${percent}" == "100.0%" ]; then

sudo rm -f \${LOG}

sudo rm -r -f \${folder}

else

echo " PASS \${i} IS FAILED! (See \${LOG})" >> \${CLOG}

echo "Fault on \${i} pass! Just \${percent} are successfull. You can find logs in \${folder}." 2>&1 | /usr/bin/tee -a \${LOG}

exit 1

fi

done

else

boot_zone cz int1

boot_zone sz int2

boot_zone rz int3

LOG="/var/tmp/nettest.\$(date +%F-%T).txt"

uname -a > \${LOG}

echo "IP Address : \${ipa}" >> \${LOG}

echo "" >> \${LOG}

echo ----------------------------- IP Address ---------------------- 2>&1 | /usr/bin/tee -a \${LOG}

sudo ifconfig | grep -A 1 vmxnet3s0 2>&1 | /usr/bin/tee -a \${LOG}

echo ------------------------------- Zones ------------------------- 2>&1 | /usr/bin/tee -a \${LOG}

sudo zoneadm list -v 2>&1 | /usr/bin/tee -a \${LOG}

echo ============================ DHCP Server ====================== ---------------------------- DHCP Server ---------------------- 2>&1 | /usr/bin/tee -a \${LOG}

sudo svcs -z dhcp isc-dhcp-server 2>&1 | /usr/bin/tee -a \${LOG}

echo =============================== Tests ========================= ------------------------------- Tests ------------------------- 2>&1 | /usr/bin/tee -a \${LOG}

sudo /opt/net-tests/bin/nettest /var/tmp 2>&1 | /usr/bin/tee -a \${LOG}/var/tmp/a.tmp

sed -n '/Results Summary/,/Log directory:/p' /var/tmp/a.tmp >> \${LOG} >> a.tmp

fail=\$(sed -n '/^FAIL[ \\t]*/p' /var/tmp/a.tmp | sed 's/^FAIL[ \\t]*//; s/[ \\t]*\$//')

pass=\$(sed -n '/^PASS[ \\t]*/p' /var/tmp/a.tmp | sed 's/^PASS[ \\t]*//; s/[ \\t]*\$//')

total=0

if [ "\${pass}" != "" ]; then

total=\$((\${total} + \${pass}))

fi

if [ "\${fail}" != "" ]; then

total=\$((\${total} + \${fail}))

fi

echo "TOTAL TESTS: \$total" >> a.tmp

echo "---------------------------------------------------------" >> a.tmp

echo "" >> a.tmp

cat \${LOG} >> a.tmp

sudo mv -f a.tmp \${LOG}\${total} + \${fail}))

fi

echo "TOTAL TESTS: \${total}" >> \${LOG}

echo "" >> \${LOG}

cat /var/tmp/a.tmp >> \${LOG}

rm -f /var/tmp/a.tmp

fi

EOT

ztest@zone:~# sed -i '/./!d' test-script.sh && chmod 777 test-script.sh

You can run the test script in a single mode, i.e. all tests will be executed once (./test-script.sh - without parameters). After running of this script you will find the log in the /var/tmp/nettest.<ISO TIME>.txt file. It will contain information in the format that is used in Test Results.

...

 Running in stability mode