aboutsummaryrefslogtreecommitdiff
path: root/test/test-6
blob: a513993e913e7be361de479ef00bf13901bb7fbf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
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!