diff options
author | Steve McIntyre <steve.mcintyre@linaro.org> | 2015-07-24 18:50:16 +0100 |
---|---|---|
committer | Steve McIntyre <steve.mcintyre@linaro.org> | 2015-07-24 18:50:16 +0100 |
commit | 19ed41a3ff89c8570c32820f2df0c04624c0769f (patch) | |
tree | 6cf8e37434e004653b455bd6cacffe3c8bc5b71f /test | |
parent | 73917bf6e4dab525814fb85193b1de9adf04a21c (diff) |
Add a much more complex test
Set up 2 VLANs across 2 switches each, each with 2 machines. Check for
isolation using 4 machines (1 on each switch again) remaining on the
base VLAN.
Change-Id: Iab68b860ef3779e303cc20d67915edfaa8578e67
Diffstat (limited to 'test')
-rw-r--r-- | test/test-7 | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/test/test-7 b/test/test-7 new file mode 100644 index 0000000..2d19e8b --- /dev/null +++ b/test/test-7 @@ -0,0 +1,113 @@ +#!/bin/bash +# +# More complex VLANd test script +# +# Check VLAN isolation for 4 machines in 2 VLANs scattered across +# multiple switches. + +set -e + +# List all the switches and hosts we need to use, if not using all of +# them. We can make tests run faster by not involving *all* of them in +# every test. +HOSTS="imx5301 panda01 arndale02 arndale03" # 4 machines for + # primary testing +HOSTS="$HOSTS imx5302 arndale01 panda02 panda03" # 4 machines on the + # same switches as + # observers + +#SWITCHES="vlandswitch05" # Let the system work things out + +# Show more detail during test output +VERBOSE=1 + +# And give a filename for logging +LOGFILE=$0-$$.log + +# Include the core test wrapper code that makes life easier +DIR=$(dirname $0) +. ${DIR}/test-common + +# Ensure all the ports we're using are on their base VLANs +log "checking base VLANs" +verify_all_hosts_are_base +log "$HOSTS are all on their base VLANs - good" + +# Clear old logfiles from our test machines +stop_logging +clear_logs + +# Start all the test machines logging, then wait 60s to let all of +# them show baseline results before we start testing +start_logging +pause 60 + +# Create 2 VLANs: tag 30, named "test30" and tag 31, named "test31" +log "Creating new VLAN tag 30" +run_admin_command --create_vlan test30 30 false +VLAN_ID1=$(run_admin_command --lookup_vlan_by_tag 30) +log "Created new VLAN with ID $VLAN_ID1" + +log "Creating new VLAN tag 31" +run_admin_command --create_vlan test31 31 false +VLAN_ID2=$(run_admin_command --lookup_vlan_by_tag 31) +log "Created new VLAN with ID $VLAN_ID2" + +# Wait 10s for everything to settle +pause 10 + +# Move some of the test machines to these new VLANs, pausing at each +# setup +log "Moving imx5301 to VLAN ID $VLAN_ID1" +run_admin_command --set_port_current_vlan ${imx5301_PORT_ID} $VLAN_ID1 +pause 60 +log "Moving panda01 to VLAN ID $VLAN_ID1" +run_admin_command --set_port_current_vlan ${panda01_PORT_ID} $VLAN_ID1 +log "Done moving ports to VLAN ID $VLAN_ID1" + +log "Moving arndale02 to VLAN ID $VLAN_ID2" +run_admin_command --set_port_current_vlan ${arndale02_PORT_ID} $VLAN_ID2 +pause 60 +log "Moving arndale03 to VLAN ID $VLAN_ID2" +run_admin_command --set_port_current_vlan ${arndale03_PORT_ID} $VLAN_ID2 +log "Done moving ports to VLAN ID $VLAN_ID2" + +# Wait 60s for everything to settle and logs to show it again +pause 60 + +# Move test machines back to their base VLANs +log "Moving ports back to base" +run_admin_command --restore_port_to_base_vlan ${imx5301_PORT_ID} +run_admin_command --restore_port_to_base_vlan ${panda01_PORT_ID} +run_admin_command --restore_port_to_base_vlan ${arndale02_PORT_ID} +run_admin_command --restore_port_to_base_vlan ${arndale03_PORT_ID} +log "Done moving ports back to base" + +# Wait 60s for everything to settle +pause 60 + +# Check that they're all back on their base VLANs +log "Checking base VLANs after the test" +verify_all_hosts_are_base + +log "Delete the test VLANs" +run_admin_command --delete_vlan ${VLAN_ID1} +run_admin_command --delete_vlan ${VLAN_ID2} + +# Stop all the test machines logging (and wait 60s) +stop_logging +pause 20 + +log "Test done, grab logs" +# Grab logs from the machines +grab_logs >> $LOGFILE + +# Clear old logs +clear_logs + +# And now sort the logs so we have clean output +sort -u $LOGFILE + +echo "Full details are in $LOGFILE, use \"sort -u $LOGFILE\" to read them in order." + +# DONE! |