aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorSteve McIntyre <steve.mcintyre@linaro.org>2015-07-24 18:29:56 +0100
committerSteve McIntyre <steve.mcintyre@linaro.org>2015-07-24 18:29:56 +0100
commit73917bf6e4dab525814fb85193b1de9adf04a21c (patch)
treea08b19ec88aa71655254b68747f2fddf2f8ee0ac /test
parent978c27170ae9dab3c63975a7c699a89d239af476 (diff)
Add test for 2 machines on vlandswitch03
Change-Id: If3017d5148472baa30c635879a47e74ab69171cf
Diffstat (limited to 'test')
-rw-r--r--test/test-693
1 files changed, 93 insertions, 0 deletions
diff --git a/test/test-6 b/test/test-6
new file mode 100644
index 0000000..a513993
--- /dev/null
+++ b/test/test-6
@@ -0,0 +1,93 @@
+#!/bin/bash
+#
+# Simple VLANd test script
+#
+# Check VLAN isolation for 2 machines on the same switch.
+
+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="arndale03 panda03" # Just 2 machines
+SWITCHES="vlandswitch03" # And we know which switch they're on
+
+# 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 a VLAN with tag 30, named "test30"
+log "Creating new VLAN tag 30"
+run_admin_command --create_vlan test30 30 false
+VLAN_ID=$(run_admin_command --lookup_vlan_by_tag 30)
+log "Created new VLAN with ID $VLAN_ID"
+
+# Wait 10s for everything to settle
+pause 10
+
+# Move some of the test machines to this new VLAN
+log "Moving arndale03 to VLAN ID $VLAN_ID"
+run_admin_command --set_port_current_vlan ${arndale03_PORT_ID} $VLAN_ID
+
+pause 60
+
+log "Moving panda03 to VLAN ID $VLAN_ID"
+run_admin_command --set_port_current_vlan ${panda03_PORT_ID} $VLAN_ID
+log "Done moving ports to VLAN ID $VLAN_ID"
+
+# 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 ${arndale03_PORT_ID}
+run_admin_command --restore_port_to_base_vlan ${panda03_PORT_ID}
+log "Done moving ports back to base"
+
+# Wait 30s for everything to settle
+pause 30
+
+# 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 VLAN"
+run_admin_command --delete_vlan ${VLAN_ID}
+
+# 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!