New test: Lagscope (TCP latency test)

This commit is contained in:
Shital Savekar 2017-06-09 11:14:07 +00:00
Родитель 0c658b33e3
Коммит b62aca0a57
3 изменённых файлов: 435 добавлений и 0 удалений

Просмотреть файл

@ -7107,6 +7107,20 @@
<param>testDuration=300</param>
</TestParameters>
<Priority>P0</Priority>
</test>
<test>
<testName>ICA-PERF-LAGSCOPE-TEST</testName>
<testScript>
</testScript>
<testScriptps1>ICA-PERF-LAGSCOPE-TEST.ps1</testScriptps1>
<setupType>M1S1</setupType>
<SupportedExecutionModes>AzureServiceManagement,AzureResourceManager</SupportedExecutionModes>
<SubtestValues>SOME,TEXTS,NEEDS,TO,BE,PRESENT,HERE,FOR,PRINTING,TEST,SUMMARY</SubtestValues>
<files>.\remote-scripts\azuremodules.sh</files>
<TestParameters>
<param>pingIteration=1000000</param>
</TestParameters>
<Priority>P0</Priority>
</test>
<test>
<testName>ICA-PERF-FIO-TEST-4K</testName>
@ -8252,6 +8266,12 @@
<Name>ICA-PERF-NTTTCP-TEST</Name>
</test>
</Cycle>
<Cycle>
<cycleName>PERF-LAGSCOPE</cycleName>
<test>
<Name>ICA-PERF-LAGSCOPE-TEST</Name>
</test>
</Cycle>
<Cycle>
<cycleName>PERF-TCPv6</cycleName>
<test>

Просмотреть файл

@ -0,0 +1,232 @@
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$noClient = $true
$noServer = $true
foreach ( $vmData in $allVMData )
{
if ( $vmData.RoleName -imatch "client" )
{
$clientVMData = $vmData
$noClient = $false
}
elseif ( $vmData.RoleName -imatch "server" )
{
$noServer = $fase
$serverVMData = $vmData
}
}
if ( $noClient )
{
Throw "No any master VM defined. Be sure that, Client VM role name matches with the pattern `"*master*`". Aborting Test."
}
if ( $noServer )
{
Throw "No any slave VM defined. Be sure that, Server machine role names matches with pattern `"*slave*`" Aborting Test."
}
#region CONFIGURE VM FOR TERASORT TEST
LogMsg "CLIENT VM details :"
LogMsg " RoleName : $($clientVMData.RoleName)"
LogMsg " Public IP : $($clientVMData.PublicIP)"
LogMsg " SSH Port : $($clientVMData.SSHPort)"
LogMsg "SERVER VM details :"
LogMsg " RoleName : $($serverVMData.RoleName)"
LogMsg " Public IP : $($serverVMData.PublicIP)"
LogMsg " SSH Port : $($serverVMData.SSHPort)"
#
# PROVISION VMS FOR LISA WILL ENABLE ROOT USER AND WILL MAKE ENABLE PASSWORDLESS AUTHENTICATION ACROSS ALL VMS IN SAME HOSTED SERVICE.
#
ProvisionVMsForLisa -allVMData $allVMData -installPackagesOnRoleNames "none"
#endregion
LogMsg "Generating constansts.sh ..."
$constantsFile = "$LogDir\constants.sh"
Set-Content -Value "#Generated by Azure Automation." -Path $constantsFile
Add-Content -Value "server=$($serverVMData.InternalIP)" -Path $constantsFile
Add-Content -Value "client=$($clientVMData.InternalIP)" -Path $constantsFile
foreach ( $param in $currentTestData.TestParameters.param)
{
if ($param -imatch "pingIteration")
{
$pingIteration=$param.Trim().Replace("pingIteration=","")
}
Add-Content -Value "$param" -Path $constantsFile
}
LogMsg "constanst.sh created successfully..."
LogMsg (Get-Content -Path $constantsFile)
#endregion
#region EXECUTE TEST
$myString = @"
cd /root/
./perf_lagscope.sh &> lagscopeConsoleLogs.txt
. azuremodules.sh
collect_VM_properties
"@
Set-Content "$LogDir\StartLagscopeTest.sh" $myString
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files ".\$constantsFile,.\remote-scripts\azuremodules.sh,.\remote-scripts\perf_lagscope.sh,.\$LogDir\StartLagscopeTest.sh" -username "root" -password $password -upload
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files $currentTestData.files -username "root" -password $password -upload
$out = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh"
$testJob = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "/root/StartLagscopeTest.sh" -RunInBackground
#endregion
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
{
$currentStatus = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "tail -1 lagscopeConsoleLogs.txt"
LogMsg "Current Test Staus : $currentStatus"
WaitFor -seconds 20
}
$finalStatus = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "cat /root/state.txt"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "lagscope-n$pingIteration-output.txt"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "VM_properties.csv"
$out=Read-Host -Prompt "Continue?"
$testSummary = $null
$lagscopeReportLog = Get-Content -Path "$LogDir\lagscope-n$pingIteration-output.txt"
LogMsg $lagscopeReportLog
try
{
$matchLine= (Select-String -Path "$LogDir\lagscope-n$pingIteration-output.txt" -Pattern "Average").Line
$minimumLat = $matchLine.Split(",").Split("=").Trim().Replace("us","")[1]
$maximumLat = $matchLine.Split(",").Split("=").Trim().Replace("us","")[3]
$averageLat = $matchLine.Split(",").Split("=").Trim().Replace("us","")[5]
$resultSummary += CreateResultSummary -testResult $minimumLat -metaData "Minimum Latency" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$resultSummary += CreateResultSummary -testResult $maximumLat -metaData "Maximum Latency" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$resultSummary += CreateResultSummary -testResult $maximumLat -metaData "Average Latency" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
catch
{
$resultSummary += CreateResultSummary -testResult "Error in parsing logs." -metaData "LAGSCOPE" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
#endregion
if ( $finalStatus -imatch "TestFailed")
{
LogErr "Test failed. Last known status : $currentStatus."
$testResult = "FAIL"
}
elseif ( $finalStatus -imatch "TestAborted")
{
LogErr "Test Aborted. Last known status : $currentStatus."
$testResult = "ABORTED"
}
elseif ( $finalStatus -imatch "TestCompleted")
{
LogMsg "Test Completed."
$testResult = "PASS"
}
elseif ( $finalStatus -imatch "TestRunning")
{
LogMsg "Powershell backgroud job for test is completed but VM is reporting that test is still running. Please check $LogDir\zkConsoleLogs.txt"
LogMsg "Contests of summary.log : $testSummary"
$testResult = "PASS"
}
LogMsg "Test result : $testResult"
LogMsg "Test Completed"
LogMsg "Uploading the test results.."
$dataSource = $xmlConfig.config.Azure.database.server
$user = $xmlConfig.config.Azure.database.user
$password = $xmlConfig.config.Azure.database.password
$database = $xmlConfig.config.Azure.database.dbname
$dataTableName = $xmlConfig.config.Azure.database.dbtable
$TestCaseName = $xmlConfig.config.Azure.database.testTag
if ($dataSource -And $user -And $password -And $database -And $dataTableName)
{
$GuestDistro = cat "$LogDir\VM_properties.csv" | Select-String "OS type"| %{$_ -replace ",OS type,",""}
#$TestCaseName = "LINUX-NEXT-UPSTREAM-TEST"
if ( $UseAzureResourceManager )
{
$HostType = "Azure-ARM"
}
else
{
$HostType = "Azure"
}
$HostBy = ($xmlConfig.config.Azure.General.Location).Replace('"','')
$HostOS = cat "$LogDir\VM_properties.csv" | Select-String "Host Version"| %{$_ -replace ",Host Version,",""}
$GuestOSType = "Linux"
$GuestDistro = cat "$LogDir\VM_properties.csv" | Select-String "OS type"| %{$_ -replace ",OS type,",""}
$GuestSize = $clientVMData.InstanceSize
$KernelVersion = cat "$LogDir\VM_properties.csv" | Select-String "Kernel version"| %{$_ -replace ",Kernel version,",""}
$IPVersion = "IPv4"
$ProtocolType = "TCP"
if($EnableAcceleratedNetworking)
{
$DataPath = "SRIOV"
}
else
{
$DataPath = "Synthetic"
}
$connectionString = "Server=$dataSource;uid=$user; pwd=$password;Database=$database;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;"
$SQLQuery = "INSERT INTO $dataTableName (TestCaseName,TestDate,HostType,HostBy,HostOS,GuestOSType,GuestDistro,GuestSize,KernelVersion,IPVersion,ProtocolType,DataPath,MaxLatency_us,AverageLatency_us,MinLatency_us,Latency95Percentile_us,Latency99Percentile_us) VALUES "
#Percentile Values are not calculated yet. will be added in future.
$Latency95Percentile_us = 0
$Latency99Percentile_us = 0
$SQLQuery += "('$TestCaseName','$(Get-Date -Format yyyy-MM-dd)','$HostType','$HostBy','$HostOS','$GuestOSType','$GuestDistro','$GuestSize','$KernelVersion','$IPVersion','$ProtocolType','$DataPath','$maximumLat','$averageLat','$minimumLat','$Latency95Percentile_us','$Latency99Percentile_us'),"
$SQLQuery = $SQLQuery.TrimEnd(',')
LogMsg $SQLQuery
$connection = New-Object System.Data.SqlClient.SqlConnection
$connection.ConnectionString = $connectionString
$connection.Open()
$command = $connection.CreateCommand()
$command.CommandText = $SQLQuery
$result = $command.executenonquery()
$connection.Close()
LogMsg "Uploading the test results done!!"
}
else
{
LogMsg "Invalid database details. Failed to upload result to database!"
}
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = "LAGSCOPE RESULT"
if (!$testResult)
{
$testResult = "Aborted"
}
$resultArr += $testResult
}
}
else
{
$testResult = "Aborted"
$resultArr += $testResult
}
$result = GetFinalResultHeader -resultarr $resultArr
#Clean up the setup
DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
#Return the result and summery to the test suite script..
return $result, $resultSummary

Просмотреть файл

@ -0,0 +1,183 @@
#!/bin/bash
#######################################################################
#
# Linux on Hyper-V and Azure Test Code, ver. 1.0.0
# Copyright (c) Microsoft Corporation
#
# All rights reserved.
# Licensed under the Apache License, Version 2.0 (the ""License"");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
#
# THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS
# OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION
# ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR
# PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT.
#
# See the Apache Version 2.0 License for specific language governing
# permissions and limitations under the License.
#
#######################################################################
#######################################################################
#
# perf_lagscope.sh
# Author : SHITAL SAVEKAR <v-shisav@microsoft.com>
#
# Description:
# Download and run lagscope latency tests.
# This script needs to be run on client VM.
#
# Supported Distros:
# Ubuntu 16.04
#######################################################################
CONSTANTS_FILE="./constants.sh"
ICA_TESTRUNNING="TestRunning" # The test is running
ICA_TESTCOMPLETED="TestCompleted" # The test completed successfully
ICA_TESTABORTED="TestAborted" # Error during the setup of the test
ICA_TESTFAILED="TestFailed" # Error occurred during the test
touch ./lagscopeTest.log
InstallLAGSCOPE() {
DISTRO=`grep -ihs "buntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux" /etc/{issue,*release,*version}`
if [[ $DISTRO =~ "Ubuntu" ]];
then
LogMsg "Detected UBUNTU"
LogMsg "Configuring ${1} for lagscope test..."
ssh ${1} "apt-get update"
ssh ${1} "apt-get -y install libaio1 sysstat git bc make gcc"
ssh ${1} "rm -rf lagscope"
ssh ${1} "git clone https://github.com/Microsoft/lagscope"
ssh ${1} "cd lagscope/src && make && make install"
elif [[ $DISTRO =~ "Red Hat Enterprise Linux Server release 6" ]];
then
LogMsg "Detected Redhat 6.x"
ssh ${1} "rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm"
ssh ${1} "yum -y --nogpgcheck install libaio1 sysstat git bc make gcc"
ssh ${1} "yum -y --nogpgcheck install gcc-c++"
ssh ${1} "wget http://ftp.heanet.ie/mirrors/gnu/libc/glibc-2.14.1.tar.gz"
ssh ${1} "tar xvf glibc-2.14.1.tar.gz"
ssh ${1} "mv glibc-2.14.1 glibc-2.14 && cd glibc-2.14 && mkdir build && cd build && ../configure --prefix=/opt/glibc-2.14 && make && make install && export LD_LIBRARY_PATH=/opt/glibc-2.14/lib:$LD_LIBRARY_PATH"
ssh ${1} "rm -rf lagscope"
ssh ${1} "git clone https://github.com/Microsoft/lagscope"
ssh ${1} "cd lagscope/src && make && make install"
ssh ${1} "iptables -F"
elif [[ $DISTRO =~ "Red Hat Enterprise Linux Server release 7" ]];
then
LogMsg "Detected Redhat 7.x"
ssh ${1} "rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
ssh ${1} "yum -y --nogpgcheck install libaio1 sysstat git bc make gcc"
ssh ${1} "rm -rf lagscope"
ssh ${1} "git clone https://github.com/Microsoft/lagscope"
ssh ${1} "cd lagscope/src && make && make install"
ssh ${1} "iptables -F"
elif [[ $DISTRO =~ "CentOS Linux release 6" ]];
then
LogMsg "Detected CentOS 6.x"
ssh ${1} "rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm"
ssh ${1} "yum -y --nogpgcheck install libaio1 sysstat git bc make gcc"
ssh ${1} "yum -y --nogpgcheck install gcc-c++"
ssh ${1} "rm -rf lagscope"
ssh ${1} "git clone https://github.com/Microsoft/lagscope"
ssh ${1} "cd lagscope/src && make && make install"
ssh ${1} "iptables -F"
elif [[ $DISTRO =~ "CentOS Linux release 7" ]];
then
LogMsg "Detected CentOS 7.x"
ssh ${1} "rpm -ivh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm"
ssh ${1} "yum -y --nogpgcheck install libaio1 sysstat git bc make gcc"
ssh ${1} "rm -rf lagscope"
ssh ${1} "git clone https://github.com/Microsoft/lagscope"
ssh ${1} "cd lagscope/src && make && make install"
ssh ${1} "iptables -F"
elif [[ $DISTRO =~ "SUSE Linux Enterprise Server 12" ]];
then
LogMsg "Detected SLES12"
ssh ${1} "zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys remove gettext-runtime-mini*"
ssh ${1} "zypper --no-gpg-checks --non-interactive --gpg-auto-import-keys install sysstat git bc make gcc grub2"
ssh ${1} "rm -rf lagscope"
ssh ${1} "git clone https://github.com/Microsoft/lagscope"
ssh ${1} "cd lagscope/src && make && make install"
ssh ${1} "iptables -F"
else
LogMsg "Unknown Distro"
UpdateTestState "TestAborted"
UpdateSummary "Unknown Distro, test aborted"
return 1
fi
}
LogMsg()
{
echo `date "+%b %d %Y %T"` : "${1}" # Add the time stamp to the log message
echo "${1}" >> ./ntttcpTest.log
}
UpdateTestState()
{
echo "${1}" > ./state.txt
}
if [ -e ${CONSTANTS_FILE} ]; then
source ${CONSTANTS_FILE}
else
errMsg="Error: missing ${CONSTANTS_FILE} file"
LogMsg "${errMsg}"
UpdateTestState $ICA_TESTABORTED
exit 10
fi
if [ ! ${server} ]; then
errMsg="Please add/provide value for server in constants.sh. server=<server ip>"
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
if [ ! ${client} ]; then
errMsg="Please add/provide value for client in constants.sh. client=<client ip>"
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
if [ ! ${pingIteration} ]; then
errMsg="Please add/provide value for pingIteration in constants.sh. pingIteration=1000000"
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
#Make & build ntttcp on client and server Machine
LogMsg "Configuring client ${client}..."
InstallLAGSCOPE ${client}
LogMsg "Configuring server ${server}..."
InstallLAGSCOPE ${server}
#Now, start the ntttcp client on client VM.
LogMsg "Now running Lagscope test"
LogMsg "Starting server."
ssh root@${server} "lagscope -r -D"
sleep 1
LogMsg "Starting client."
ssh root@${client} "lagscope -s${server} -i0 -n${pingIteration} -H > lagscope-n${pingIteration}-output.txt"
LogMsg "Test finsished."
UpdateTestState ICA_TESTCOMPLETED