-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge remote-tracking branch 'upstream/master'
- Loading branch information
Showing
32 changed files
with
1,329 additions
and
333 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the Apache License. | ||
# | ||
# Description: | ||
# Disable VF, verify SR-IOV Failover is working | ||
# | ||
######################################################################## | ||
remote_user="root" | ||
if [ ! -e sriov_constants.sh ]; then | ||
cp /${remote_user}/sriov_constants.sh . | ||
fi | ||
# Source SR-IOV_Utils.sh. This is the script that contains all the | ||
# SR-IOV basic functions (checking drivers, checking VFs, assigning IPs) | ||
. SR-IOV-Utils.sh || { | ||
echo "ERROR: unable to source SR-IOV_Utils.sh!" | ||
echo "TestAborted" > state.txt | ||
exit 0 | ||
} | ||
|
||
# Check if the SR-IOV driver is in use | ||
VerifyVF | ||
if [ $? -ne 0 ]; then | ||
LogErr "VF is not loaded! Make sure you are using compatible hardware" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
# Create an 1gb file to be sent from VM1 to VM2 | ||
Create1Gfile | ||
if [ $? -ne 0 ]; then | ||
LogErr "Could not create the 1gb file on VM1!" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
|
||
# Check if the VF count inside the VM is the same as the expected count | ||
vf_count=$(find /sys/devices -name net -a -ipath '*vmbus*' | grep -c pci) | ||
if [ $vf_count -ne $NIC_COUNT ]; then | ||
LogErr "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
UpdateSummary "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" | ||
|
||
# Extract VF name | ||
synthetic_interface=$(ip addr | grep $VF_IP1 | awk '{print $NF}') | ||
LogMsg "Synthetic interface found: $synthetic_interface" | ||
vf_interface=$(find /sys/devices/* -name "*${synthetic_interface}*" | grep "pci" | sed 's/\// /g' | awk '{print $12}') | ||
LogMsg "Virtual function found: $vf_interface" | ||
|
||
# Put VF down | ||
ip link set dev $vf_interface down | ||
ping -c 11 "$VF_IP2" >/dev/null 2>&1 | ||
if [ 0 -eq $? ]; then | ||
LogMsg "Successfully pinged $VF_IP2 with VF down" | ||
else | ||
LogErr "Unable to ping $VF_IP2 with VF down" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
# Send 1GB file from VM1 to VM2 via synthetic interface | ||
scp -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$output_file" "$remote_user"@"$VF_IP2":/tmp/"$output_file" | ||
if [ 0 -ne $? ]; then | ||
LogErr "Unable to send the file from VM1 to VM2 ($VF_IP2)" | ||
SetTestStateFailed | ||
exit 0 | ||
else | ||
LogMsg "Successfully sent $output_file to $VF_IP2" | ||
fi | ||
# Get TX value for synthetic interface after sending the file | ||
tx_value=$(cat /sys/class/net/${synthetic_interface}/statistics/tx_packets) | ||
LogMsg "TX value after sending the file: $tx_value" | ||
if [ $tx_value -lt 10000 ]; then | ||
LogErr "Insufficient TX packets sent on ${synthetic_interface}" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
|
||
# Put VF up | ||
ip link set dev $vf_interface up | ||
ping -c 11 "$VF_IP2" >/dev/null 2>&1 | ||
if [ 0 -ne $? ]; then | ||
LogErr "Unable to ping $VF_IP2 with VF down" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
# Send 1GB file from VM1 to VM2 via VF | ||
scp -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$output_file" "$remote_user"@"$VF_IP2":/tmp/"$output_file" | ||
if [ 0 -ne $? ]; then | ||
LogErr "Unable to send the file from VM1 to VM2 ($VF_IP2)" | ||
SetTestStateFailed | ||
exit 0 | ||
else | ||
LogMsg "Successfully sent $output_file to $VF_IP2" | ||
fi | ||
# Get TX value for VF after sending the file | ||
tx_value=$(cat /sys/class/net/${vf_interface}/statistics/tx_packets) | ||
LogMsg "TX value after sending the file: $tx_value" | ||
if [ $tx_value -lt 10000 ]; then | ||
LogErr "Insufficient TX packets sent on ${vf_interface}" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
|
||
UpdateSummary "Successfully disabled and enabled VF" | ||
SetTestStateCompleted | ||
exit 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
#!/bin/bash | ||
|
||
# Copyright (c) Microsoft Corporation. All rights reserved. | ||
# Licensed under the Apache License. | ||
# | ||
# Description: | ||
# This SR-IOV test will run iPerf3 for 30 minutes and checks | ||
# if network connectivity is lost at any point | ||
# | ||
######################################################################## | ||
remote_user="root" | ||
if [ ! -e sriov_constants.sh ]; then | ||
cp /${remote_user}/sriov_constants.sh . | ||
fi | ||
export PATH="/usr/local/bin:${PATH}" | ||
# Source SR-IOV_Utils.sh. This is the script that contains all the | ||
# SR-IOV basic functions (checking drivers, checking VFs, assigning IPs) | ||
. SR-IOV-Utils.sh || { | ||
echo "ERROR: unable to source SR-IOV_Utils.sh!" | ||
echo "TestAborted" > state.txt | ||
exit 0 | ||
} | ||
|
||
# Check if the SR-IOV driver is in use | ||
VerifyVF | ||
if [ $? -ne 0 ]; then | ||
LogErr "VF is not loaded! Make sure you are using compatible hardware" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
|
||
# Check if the VF count inside the VM is the same as the expected count | ||
vf_count=$(find /sys/devices -name net -a -ipath '*vmbus*' | grep pci | wc -l) | ||
if [ $vf_count -ne $NIC_COUNT ]; then | ||
LogErr "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
UpdateSummary "Expected VF count: $NIC_COUNT. Actual VF count: $vf_count" | ||
|
||
# Start iPerf server on dependency VM | ||
ssh -i "$HOME"/.ssh/"$SSH_PRIVATE_KEY" -o StrictHostKeyChecking=no "$remote_user"@"$VF_IP2" 'iperf3 -s > perfResults.log &' | ||
if [ $? -ne 0 ]; then | ||
LogErr "Could not start iPerf3 on VM2 (VF_IP: ${VF_IP2})" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
|
||
# Start iPerf client | ||
iperf3 -t 1800 -c ${VF_IP2} --logfile perfResults.log | ||
if [ $? -ne 0 ]; then | ||
LogErr "Could not start iPerf3 on VM1 (VF_IP: ${VF_IP1})" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
|
||
# Check for errors | ||
if [ ! -e perfResults.log ]; then | ||
LogErr "iPerf3 didn't run!" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
|
||
iperf_errors=$(cat perfResults.log | grep -i error) | ||
if [ $? -eq 0 ]; then | ||
LogErr "iPerf3 had errors while running" | ||
LogErr $iperf_errors | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
|
||
# Get the throughput | ||
throughput=$(tail -4 perfResults.log | head -1 | awk '{print $7}') | ||
UpdateSummary "iPerf3 throughput is $throughput gbps" | ||
|
||
# Check the connection again | ||
ping -c 11 ${VF_IP2} > pingResults.log | ||
if [ $? -ne 0 ]; then | ||
LogErr "Could not ping from VM1 to VM2 after iPerf3 finished the run" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
cat pingResults.log | grep " 0%" | ||
if [ $? -ne 0 ]; then | ||
LogErr "Ping shows that packets were lost between VM1 and VM" | ||
SetTestStateFailed | ||
exit 0 | ||
fi | ||
|
||
UpdateSummary "Ping was succesful between VM1 and VM2 after iPerf3 finished the run" | ||
SetTestStateCompleted | ||
exit 0 |
Oops, something went wrong.