Merge pull request #181 from iamshital/master

Added RDMA 2VM, RDMA 16VM, Orion, NTTTCP, REDIS Benchmark tests + HTML reporting from automation + Support for IPv6 Deployments.
This commit is contained in:
Vivek Yadav 2017-03-22 14:12:21 -07:00 коммит произвёл GitHub
Родитель 63023129a6 660c2739b1
Коммит b1fe41c7d7
49 изменённых файлов: 9459 добавлений и 675 удалений

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

@ -7,9 +7,10 @@
# - VHD preparation : Installing packages required by ICA, LIS drivers and waagent
# - Uplaoding test VHD to cloud
# - Invokes azure test suite
## Author : v-shisav@microsoft.com
## Author : v-ampaw@microsoft.com
###############################################################################################
param ([string] $xmlConfigFile, [switch] $eMail, [string] $logFilename="azure_ica.log", [switch] $runtests, [switch]$onCloud, [switch] $vhdprep, [switch]$upload, [switch] $help, [string] $Distro, [string] $cycleName, [string] $TestPriority, [string]$osImage, [switch]$EconomyMode, [switch]$keepReproInact, [string] $DebugDistro, [switch]$UseAzureResourceManager, [string] $OverrideVMSize)
param ([string] $xmlConfigFile, [switch] $eMail, [string] $logFilename="azure_ica.log", [switch] $runtests, [switch]$onCloud, [switch] $vhdprep, [switch]$upload, [switch] $help, [string] $Distro, [string] $cycleName, [string] $TestPriority, [string]$osImage, [switch]$EconomyMode, [switch]$keepReproInact, [string] $DebugDistro, [switch]$UseAzureResourceManager, [string] $OverrideVMSize, [string]$customKernel, [string] $customLIS, [string]$customLISBranch)
Import-Module .\TestLibs\AzureWinUtils.psm1 -Force -Scope Global
Import-Module .\TestLibs\RDFELibs.psm1 -Force -Scope Global
@ -35,6 +36,29 @@ if ( $OverrideVMSize )
{
Set-Variable -Name OverrideVMSize -Value $OverrideVMSize -Scope Global
}
if ( $customKernel )
{
Set-Variable -Name customKernel -Value $customKernel -Scope Global
}
if ( $customLIS )
{
Set-Variable -Name customLIS -Value $customLIS -Scope Global
}
if ( $customLISBranch )
{
Set-Variable -Name customLISBranch -Value $customLISBranch -Scope Global
}
if ( $xmlConfig.config.Azure.General.StorageAccount -imatch "NewStorage_" )
{
$NewASMStorageAccountType = ($xmlConfig.config.Azure.General.StorageAccount).Replace("NewStorage_","")
Set-Variable -Name NewASMStorageAccountType -Value $NewASMStorageAccountType -Scope Global
}
if ( $xmlConfig.config.Azure.General.ARMStorageAccount -imatch "NewStorage_" )
{
$NewARMStorageAccountType = ($xmlConfig.config.Azure.General.ARMStorageAccount).Replace("NewStorage_","")
Set-Variable -Name NewARMStorageAccountType -Value $NewASMStorageAccountType -Scope Global
}
try
{
@ -42,6 +66,7 @@ try
# Work flow starts here
# Creating TestResults directory
$testResults = "TestResults"
if (! (test-path $testResults))
{
mkdir $testResults | out-null
@ -75,9 +100,11 @@ try
Set-Variable -Name testStartTime -Value $testStartTime -Scope Global
$fname = [System.IO.Path]::GetFilenameWithoutExtension($xmlConfigFile)
$testDir = $testResults + "\" + $fname + "-" + $testStartTime.ToString("yyyyMMdd-HHmmss")
$testDir = $testResults + "\" + $fname + "-" + $testStartTime.ToString("yyyyMMdd-HHmmss") + "-$(Get-Random -Maximum 999 -Minimum 111)"
mkdir $testDir -ErrorAction SilentlyContinue | out-null
Set-Content -Value "" -Path .\report\testSummary.html -Force | Out-Null
Set-Content -Value "" -Path .\report\AdditionalInfo.html -Force | Out-Null
if ($logFilename)
{
@ -86,9 +113,11 @@ try
$logFile = $testDir + "\" + $logfile
Set-Variable -Name logfile -Value $logFile -Scope Global
Set-Content -Path .\report\lastLogDirectory.txt -Value $testDir
Set-Variable -Name Distro -Value $Distro -Scope Global
Set-Variable -Name onCloud -Value $onCloud -Scope Global
Set-Variable -Name xmlConfig -Value $xmlConfig -Scope Global
Set-Content -Path .\report\lastLogDirectory.txt -Value $testDir
Set-Variable -Name vnetIsAllConfigured -Value $false -Scope Global
if($EconomyMode)
{
@ -101,9 +130,15 @@ try
else
{
Set-Variable -Name EconomyMode -Value $false -Scope Global
Set-Variable -Name keepReproInact -Value $false -Scope Global
if($keepReproInact)
{
Set-Variable -Name keepReproInact -Value $true -Scope Global
}
else
{
Set-Variable -Name keepReproInact -Value $false -Scope Global
}
}
$AzureSetup = $xmlConfig.config.Azure.General
LogMsg ("Info : AzureAutomationManager.ps1 - LIS on Azure Automation")
LogMsg ("Info : Created test results directory:", $testDir)
@ -144,6 +179,10 @@ try
{
LogMsg "*************AZURE SERVICE MANAGEMENT MODE****************"
}
if($keepReproInact)
{
LogMsg "PLEASE NOTE: keepReproInact is set. VMs will not be deleted after test is finished even if, test gets PASS."
}
}
if($upload)
{
@ -214,8 +253,11 @@ try
}
catch
{
$line = $_.InvocationInfo.ScriptLineNumber
$script_name = ($_.InvocationInfo.ScriptName).Replace($PWD,".")
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
LogErr "EXCEPTION : $ErrorMessage"
LogErr "Source : Line $line in script $script_name."
}
Finally
{

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

@ -1,4 +1,4 @@
#v-shisav : STILL IN BETA VERSION
#v-shisav : STILL IN BETA VERSION
param($xmlConfig, [string] $Distro, [string] $cycleName)
@ -17,6 +17,26 @@ Import-Module .\TestLibs\PerfTest\PerfTest.psm1 -Force
Function CollectLogs()
{}
Function AddReproVMDetailsToHtmlReport()
{
$reproVMHtmlText += "<br><font size=`"2`"><em>Repro VMs: </em></font>"
if ( $UserAzureResourceManager )
{
foreach ( $vm in $allVMData )
{
$reproVMHtmlText += "<br><font size=`"2`">ResourceGroup : $($vm.ResourceGroup), IP : $($vm.PublicIP), SSH : $($vm.SSHPort)</font>"
}
}
else
{
foreach ( $vm in $allVMData )
{
$reproVMHtmlText += "<br><font size=`"2`">ServiceName : $($vm.ServiceName), IP : $($vm.PublicIP), SSH : $($vm.SSHPort)</font>"
}
}
return $reproVMHtmlText
}
Function GetCurrentCycleData($xmlConfig, $cycleName)
{
foreach ($Cycle in $xmlConfig.config.testCycles.Cycle )
@ -84,25 +104,55 @@ Function RunTestsOnCycle ($cycleName , $xmlConfig, $Distro )
{
$StartTime = [Datetime]::Now.ToUniversalTime()
LogMsg "Starting the Cycle - $($CycleName.ToUpper())"
$xmlConfig.config.Azure.Deployment.Data.Distro | ? { $_.name -eq $Distro} | % {
if ( $_.OsImage )
{
$BaseOsImage = $_.OsImage.ToUpper()
Set-Variable -Name BaseOsImage -Value $BaseOsImage -Scope Global
LogMsg "Base image name - $BaseOsImage"
}
if ( $_.OsVHD )
{
$BaseOsVHD = $_.OsVHD.ToUpper()
Set-Variable -Name BaseOsVHD -Value $BaseOsVHD -Scope Global
LogMsg "Base VHD name - $BaseOsVHD"
}
}
if (!$BaseOsImage -and !$BaseOSVHD)
$executionCount = 0
foreach ( $tempDistro in $xmlConfig.config.Azure.Deployment.Data.Distro )
{
Throw "Please give ImageName or OsVHD for deployment."
if ( ($tempDistro.Name).ToUpper() -eq ($Distro).ToUpper() )
{
if ( $UseAzureResourceManager )
{
if ( $tempDistro.ARMImage )
{
Set-Variable -Name ARMImage -Value $tempDistro.ARMImage -Scope Global
#if ( $ARMImage.Version -imatch "latest" )
#{
# LogMsg "Getting latest image details..."
# $armTempImages = Get-AzureRmVMImage -Location ($xmlConfig.config.Azure.General.Location).Replace('"','') -PublisherName $ARMImage.Publisher -Offer $ARMImage.Offer -Skus $ARMImage.Sku
# $ARMImage.Version = [string](($armTempImages[$armTempImages.Count - 1]).Version)
#}
LogMsg "ARMImage name - $($ARMImage.Publisher) : $($ARMImage.Offer) : $($ARMImage.Sku) : $($ARMImage.Version)"
}
if ( $tempDistro.OsVHD )
{
$BaseOsVHD = $tempDistro.OsVHD.ToUpper()
Set-Variable -Name BaseOsVHD -Value $BaseOsVHD -Scope Global
LogMsg "Base VHD name - $BaseOsVHD"
}
}
else
{
if ( $tempDistro.OsImage )
{
$BaseOsImage = $tempDistro.OsImage.ToUpper()
Set-Variable -Name BaseOsImage -Value $BaseOsImage -Scope Global
LogMsg "Base image name - $BaseOsImage"
}
}
}
}
if (!$BaseOsImage -and !$UseAzureResourceManager)
{
Throw "Please give ImageName or OsVHD for ASM deployment."
}
if (!$($ARMImage.Publisher) -and !$BaseOSVHD -and $UseAzureResourceManager)
{
Throw "Please give ARM Image / VHD for ARM deployment."
}
LogMsg "Loading the cycle Data..."
$currentCycleData = GetCurrentCycleData -xmlConfig $xmlConfig -cycleName $cycleName
$xmlElementsToAdd = @("currentTest", "stateTimeStamp", "state", "emailSummary", "htmlSummary", "jobID", "testCaseResults")
@ -169,6 +219,7 @@ Function RunTestsOnCycle ($cycleName , $xmlConfig, $Distro )
}
if ($currentTestData)
{
if ( $UseAzureResourceManager -and !($currentTestData.SupportedExecutionModes -imatch "AzureResourceManager"))
{
LogMsg "$($currentTestData.testName) does not support AzureResourceManager execution mode."
@ -201,6 +252,7 @@ Function RunTestsOnCycle ($cycleName , $xmlConfig, $Distro )
$command = ".\remote-scripts\" + $testScriptPs1
LogMsg "Starting test $($currentTestData.testName)"
$testResult = Invoke-Expression $command
$executionCount += 1
$testResult = RefineTestResult1 -tempResult $testResult
$endTime = [Datetime]::Now.ToUniversalTime()
$vmRam= GetTestVMHardwareDetails -xmlConfigFile $xmlConfig -setupType $testSetup -RAM
@ -208,7 +260,6 @@ Function RunTestsOnCycle ($cycleName , $xmlConfig, $Distro )
$testRunDuration = GetStopWatchElapasedTime $stopWatch "mm"
$testCycle.emailSummary += "$($currentTestData.testName) Execution Time: $testRunDuration minutes<br />"
$testCycle.emailSummary += " $($currentTestData.testName) : $testResult <br />"
$testCycle.htmlSummary += "<tr><td>$($currentTestData.testName) - Execution Time : </td><td> $testRunDuration min</td></tr>"
$testResultRow = ""
LogMsg "~~~~~~~~~~~~~~~TEST END : $($currentTestData.testName)~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"
}
@ -223,6 +274,7 @@ Function RunTestsOnCycle ($cycleName , $xmlConfig, $Distro )
$testSuiteResultDetails.totalPassTc = $testSuiteResultDetails.totalPassTc +1
$testResultRow = "<span style='color:green;font-weight:bolder'>PASS</span>"
FinishLogTestCase $testcase
$testCycle.htmlSummary += "<tr><td><font size=`"3`">$executionCount</font></td><td>$($currentTestData.testName)</td><td>$testRunDuration min</td><td>$testResultRow</td></tr>"
}
elseif($testResult -imatch "FAIL")
{
@ -230,6 +282,7 @@ Function RunTestsOnCycle ($cycleName , $xmlConfig, $Distro )
$testResultRow = "<span style='color:red;font-weight:bolder'>FAIL</span>"
$caseLog = Get-Content -Raw $testCaseLogFile
FinishLogTestCase $testcase "FAIL" "$($test.Name) failed." $caseLog
$testCycle.htmlSummary += "<tr><td><font size=`"3`">$executionCount</font></td><td>$($currentTestData.testName)$(AddReproVMDetailsToHtmlReport)</td><td>$testRunDuration min</td><td>$testResultRow</td></tr>"
}
elseif($testResult -imatch "ABORTED")
{
@ -237,8 +290,9 @@ Function RunTestsOnCycle ($cycleName , $xmlConfig, $Distro )
$testResultRow = "<span style='background-color:yellow;font-weight:bolder'>ABORT</span>"
$caseLog = Get-Content -Raw $testCaseLogFile
FinishLogTestCase $testcase "ERROR" "$($test.Name) is aborted." $caseLog
$testCycle.htmlSummary += "<tr><td><font size=`"3`">$executionCount</font></td><td>$($currentTestData.testName)$(AddReproVMDetailsToHtmlReport)</td><td>$testRunDuration min</td><td>$testResultRow</td></tr>"
}
$testCycle.htmlSummary += "<tr><td> $($currentTestData.testName) </td><td> $testResultRow </td></tr>"
}
else
{
@ -255,6 +309,8 @@ Function RunTestsOnCycle ($cycleName , $xmlConfig, $Distro )
$startTime = [Datetime]::Now.ToUniversalTime()
$testResult = Invoke-Expression $command
$testResult = RefineTestResult2 -testResult $testResult
$tempHtmlText = ($testResult[1]).Substring(0,((($testResult[1]).Length)-6))
$executionCount += 1
$testRunDuration = GetStopWatchElapasedTime $stopWatch "mm"
$testRunDuration = $testRunDuration.ToString()
$testCycle.emailSummary += "$($currentTestData.testName) Execution Time: $testRunDuration minutes<br />"
@ -271,20 +327,27 @@ Function RunTestsOnCycle ($cycleName , $xmlConfig, $Distro )
if($testResult[0] -imatch "PASS")
{
$testSuiteResultDetails.totalPassTc = $testSuiteResultDetails.totalPassTc +1
$testResultRow = "<span style='color:green;font-weight:bolder'>PASS</span>"
FinishLogTestCase $testcase
$testCycle.htmlSummary += "<tr><td><font size=`"3`">$executionCount</font></td><td>$tempHtmlText</td><td>$testRunDuration min</td><td>$testResultRow</td></tr>"
}
elseif($testResult[0] -imatch "FAIL")
{
$testSuiteResultDetails.totalFailTc = $testSuiteResultDetails.totalFailTc +1
$caseLog = Get-Content -Raw $testCaseLogFile
$testResultRow = "<span style='color:red;font-weight:bolder'>FAIL</span>"
FinishLogTestCase $testcase "FAIL" "$($test.Name) failed." $caseLog
$testCycle.htmlSummary += "<tr><td><font size=`"3`">$executionCount</font></td><td>$tempHtmlText$(AddReproVMDetailsToHtmlReport)</td><td>$testRunDuration min</td><td>$testResultRow</td></tr>"
}
elseif($testResult[0] -imatch "ABORTED")
{
$testSuiteResultDetails.totalAbortedTc = $testSuiteResultDetails.totalAbortedTc +1
$caseLog = Get-Content -Raw $testCaseLogFile
$testResultRow = "<span style='background-color:yellow;font-weight:bolder'>ABORT</span>"
FinishLogTestCase $testcase "ERROR" "$($test.Name) is aborted." $caseLog
$testCycle.htmlSummary += "<tr><td><font size=`"3`">$executionCount</font></td><td>$tempHtmlText$(AddReproVMDetailsToHtmlReport)</td><td>$testRunDuration min</td><td>$testResultRow</td></tr>"
}
}
$currentJobs = Get-Job
foreach ( $job in $currentJobs )

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -0,0 +1,4 @@
echo 'iface eth0 inet6 auto' >> /etc/network/interfaces.d/50-cloud-init.cfg
echo 'up sleep 5' >> /etc/network/interfaces.d/50-cloud-init.cfg
echo 'up dhclient -1 -6 -cf /etc/dhcp/dhclient6.conf -lf /var/lib/dhcp/dhclient6.eth0.leases -v eth0 || true' >> /etc/network/interfaces.d/50-cloud-init.cfg
ifdown eth0 && ifup eth0

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

@ -65,7 +65,10 @@ done
echo "COREOS"
exitVal=0
fi
elif [ -e /usr/share/clear/version ]; then
tmp=`cat /usr/share/clear/version`
echo "CLEARLINUX"
exitVal=0
fi
return $exitVal
}

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

@ -32,18 +32,28 @@
$location = $region;
}
if ( $location -imatch "-" )
{
$RGCount = $setupTypeData.HostedService.Count
$xRegionTest = $true
$xRegionTotalLocations = $location.Split("-").Count
$xRegionLocations = $location.Split("-")
$locationCounter = 0
LogMsg "$RGCount Resource groups will be deployed in $($xRegionLocations.Replace('-',' and '))"
}
foreach ($RG in $setupTypeData.HostedService )
{
$curtime = Get-Date
$randomNumber = Get-Random -Maximum 9999 -Minimum 1111
$isServiceDeployed = "False"
$retryDeployment = 0
if ( $RG.Tag -ne $null )
{
$groupName = "ICA-RG-" + $RG.Tag + "-" + $Distro + "-" + $curtime.Month + "-" + $curtime.Day + "-" + $curtime.Hour + "-" + $curtime.Minute + "-" + $curtime.Second
$groupName = "ICA-RG-" + $RG.Tag + "-" + $Distro + "-" + $curtime.Month + "-" + $curtime.Day + "-" + $curtime.Hour + "-" + $curtime.Minute + "-" + $randomNumber
}
else
{
$groupName = "ICA-RG-" + $setupType + "-" + $Distro + "-" + $curtime.Month + "-" + $curtime.Day + "-" + $curtime.Hour + "-" + $curtime.Minute + "-" + $curtime.Second
$groupName = "ICA-RG-" + $setupType + "-" + $Distro + "-" + $curtime.Month + "-" + $curtime.Day + "-" + $curtime.Hour + "-" + $curtime.Minute + "-" + $randomNumber
}
if($isMultiple -eq "True")
{
@ -57,6 +67,12 @@
$isRGDeleted = DeleteResourceGroup -RGName $groupName
if ($isRGDeleted)
{
if ( $xRegionTest )
{
$location = $xRegionLocations[$locationCounter]
$locationCounter += 1
}
$isServiceCreated = CreateResourceGroup -RGName $groupName -location $location
if ($isServiceCreated -eq "True")
{
@ -122,6 +138,15 @@ Function DeleteResourceGroup([string]$RGName, [switch]$KeepDisks)
{
Remove-AzureRmResourceGroup -Name $RGName -Force -Verbose
$retValue = $?
$ARMStorageAccount = $xmlConfig.config.Azure.General.ARMStorageAccount
if ( $NewARMStorageAccountType )
{
LogMsg "No need to remove residual VHDs, as storage account in $RGName is deleted."
}
else
{
RemoveResidualResourceGroupVHDs -ResourceGroup $RGName -storageAccount $ARMStorageAccount
}
}
else
{
@ -131,6 +156,25 @@ Function DeleteResourceGroup([string]$RGName, [switch]$KeepDisks)
return $retValue
}
Function RemoveResidualResourceGroupVHDs($ResourceGroup,$storageAccount)
{
# Verify that the OS VHD does not already exist
$azureStorage = $storageAccount
LogMsg "Removing residual VHDs of $ResourceGroup from $azureStorage..."
$storageContext = (Get-AzureRmStorageAccount | Where-Object{$_.StorageAccountName -match $azureStorage}).Context
$storageBlob = Get-AzureStorageBlob -Context $storageContext -Container "vhds"
$vhdList = $storageBlob | Where-Object{$_.Name -match "$ResourceGroup"}
if ($vhdList)
{
# Remove VHD files
foreach($diskName in $vhdList.Name)
{
LogMsg "Removing VHD $diskName"
Remove-AzureStorageBlob -Blob $diskname -Container vhds -Context $storageContext -Verbose -ErrorAction SilentlyContinue
}
}
}
Function CreateResourceGroup([string]$RGName, $location)
{
$FailCounter = 0
@ -192,6 +236,16 @@ Function CreateResourceGroupDeployment([string]$RGName, $location, $setupType, $
{
LogErr "Failed to Resource Group."
$retValue = $false
$VMsCreated = Get-AzureRmVM -ResourceGroupName $RGName
if ( $VMsCreated )
{
LogMsg "Keeping Failed resource group, as we found $($VMsCreated.Count) VM(s) deployed."
}
else
{
LogMsg "Removing Failed resource group, as we found 0 VM(s) deployed."
DeleteResourceGroup -RGName $RGName
}
}
}
catch
@ -212,17 +266,26 @@ if($storageAccount)
{
$StorageAccountName = $storageAccount
}
LogMsg "Getting Storage Account : $StorageAccountName details ..."
$StorageAccountType = (Get-AzureRmStorageAccount | where {$_.StorageAccountName -eq $StorageAccountName}).Sku.Tier.ToString()
if($StorageAccountType -match 'Premium')
if ( $NewARMStorageAccountType )
{
$StorageAccountType = "Premium_LRS"
LogMsg "New storage account of type : $NewARMStorageAccountType will be created in $RGName."
$StorageAccountRG = $RGName
}
else
{
$StorageAccountType = "Standard_LRS"
LogMsg "Getting Existing Storage Account : $StorageAccountName details ..."
$StorageAccountType = (Get-AzureRmStorageAccount | where {$_.StorageAccountName -eq $StorageAccountName}).Sku.Tier.ToString()
$StorageAccountRG = (Get-AzureRmStorageAccount | where {$_.StorageAccountName -eq $StorageAccountName}).ResourceGroupName.ToString()
if($StorageAccountType -match 'Premium')
{
$StorageAccountType = "Premium_LRS"
}
else
{
$StorageAccountType = "Standard_LRS"
}
LogMsg "Storage Account Type : $StorageAccountType"
}
LogMsg "Storage Account Type : $StorageAccountType"
$HS = $RGXMLData
$setupType = $Setup
$totalVMs = 0
@ -236,12 +299,19 @@ $indents += $indent
$RGRandomNumber = $((Get-Random -Maximum 999999 -Minimum 100000))
$RGrandomWord = ([System.IO.Path]::GetRandomFileName() -replace '[^a-z]')
$dnsNameForPublicIP = $($RGName.ToLower() -replace '[^a-z0-9]')
$virtualNetworkName = $($RGName.ToUpper() -replace '[^a-z]') + "VNET"
$dnsNameForPublicIPv6 = $($RGName.ToLower() -replace '[^a-z0-9]') + "v6"
#$virtualNetworkName = $($RGName.ToUpper() -replace '[^a-z]') + "VNET"
$virtualNetworkName = "VirtualNetwork"
$defaultSubnetName = "Subnet1"
$availibilitySetName = $($RGName.ToUpper() -replace '[^a-z]') + "AvSet"
$LoadBalancerName = $($RGName.ToUpper() -replace '[^a-z]') + "LoadBalancer"
$apiVersion = "2015-05-01-preview"
$PublicIPName = $($RGName.ToUpper() -replace '[^a-z]') + "PublicIP"
#$availibilitySetName = $($RGName.ToUpper() -replace '[^a-z]') + "AvSet"
$availibilitySetName = "AvailibilitySet"
#$LoadBalancerName = $($RGName.ToUpper() -replace '[^a-z]') + "LoadBalancer"
$LoadBalancerName = "LoadBalancer"
$apiVersion = "2016-03-30"
#$PublicIPName = $($RGName.ToUpper() -replace '[^a-z]') + "PublicIPv4"
$PublicIPName = "PublicIPv4"
#$PublicIPv6Name = $($RGName.ToUpper() -replace '[^a-z]') + "PublicIPv6"
$PublicIPv6Name = "PublicIPv6"
$sshPath = '/home/' + $user + '/.ssh/authorized_keys'
$sshKeyData = ""
if ( $CurrentTestData.ProvisionTimeExtensions )
@ -273,10 +343,23 @@ if ( $CurrentTestData.ProvisionTimeExtensions )
$extensionXML = [xml]$extensionString
}
LogMsg "ARM Storage Account : $StorageAccountName"
if ( $NewARMStorageAccountType )
{
$LocationLower = $Location.Replace(" ","").ToLower().Replace('"','')
#$StorageAccountName = $($NewARMStorageAccountType.ToLower().Replace("_","").Replace("standard","std").Replace("premium","prm")) + "$RGRandomNumber" + "$LocationLower"
$StorageAccountName = $($NewARMStorageAccountType.ToLower().Replace("_","")) + "$RGRandomNumber"
#$StorageAccountName = "$LocationLower" + "$RGRandomNumber"
LogMsg "Using New ARM Storage Account : $StorageAccountName"
$StorageAccountType= $NewARMStorageAccountType
}
else
{
LogMsg "Using ARM Storage Account : $StorageAccountName"
}
$bootDiagnosticsSA = "icadiagnostic$RGRandomNumber"
LogMsg "Using API VERSION : $apiVersion"
$ExistingVnet = $null
if ($RGXMLData.ARMVnetName)
if ($RGXMLData.ARMVnetName -ne $null)
{
$ExistingVnet = $RGXMLData.ARMVnetName
LogMsg "Getting $ExistingVnet Virtual Netowrk info ..."
@ -301,15 +384,47 @@ for ($i =0; $i -lt 30; $i++)
#Check if the deployment Type is single VM deployment or multiple VM deployment
$numberOfVMs = 0
$EnableIPv6 = $false
$ForceLoadBalancerForSingleVM = $false
foreach ( $newVM in $RGXMLData.VirtualMachine)
{
$numberOfVMs += 1
if ( !$EnableIPv6 )
{
foreach ( $endpoint in $newVM.EndPoints )
{
if ( $endpoint.EnableIPv6 -eq "True" )
{
$EnableIPv6 = $true
}
if ( $endpoint.LoadBalanced -eq "True" )
{
$ForceLoadBalancerForSingleVM = $true
}
}
}
}
$StorageProfileScriptBlock = {
Add-Content -Value "$($indents[4])^storageProfile^: " -Path $jsonFile
Add-Content -Value "$($indents[4]){" -Path $jsonFile
if (!$osVHD)
if ($ARMImage -and !$osVHD)
{
LogMsg "├Using ARMImage : $($ARMImage.Publisher):$($ARMImage.Offer):$($ARMImage.Sku):$($ARMImage.Version)"
Add-Content -Value "$($indents[5])^imageReference^ : " -Path $jsonFile
Add-Content -Value "$($indents[5]){" -Path $jsonFile
$publisher = $ARMImage.Publisher
$offer = $ARMImage.Offer
$sku = $ARMImage.Sku
$version = $ARMImage.Version
Add-Content -Value "$($indents[6])^publisher^: ^$publisher^," -Path $jsonFile
Add-Content -Value "$($indents[6])^offer^: ^$offer^," -Path $jsonFile
Add-Content -Value "$($indents[6])^sku^: ^$sku^," -Path $jsonFile
Add-Content -Value "$($indents[6])^version^: ^$version^" -Path $jsonFile
Add-Content -Value "$($indents[5])}," -Path $jsonFile
}
elseif ($CurrentTestData.Publisher -and $CurrentTestData.Offer)
{
Add-Content -Value "$($indents[5])^imageReference^ : " -Path $jsonFile
Add-Content -Value "$($indents[5]){" -Path $jsonFile
@ -344,7 +459,6 @@ $StorageProfileScriptBlock = {
}
else
{
LogMsg "├Using ImageName : $osImage"
Add-Content -Value "$($indents[6])^name^: ^$vmName-OSDisk^," -Path $jsonFile
Add-Content -Value "$($indents[6])^createOption^: ^FromImage^," -Path $jsonFile
Add-Content -Value "$($indents[6])^vhd^: " -Path $jsonFile
@ -354,7 +468,34 @@ $StorageProfileScriptBlock = {
Add-Content -Value "$($indents[6])^caching^: ^ReadWrite^" -Path $jsonFile
}
Add-Content -Value "$($indents[5])}" -Path $jsonFile
Add-Content -Value "$($indents[5])}," -Path $jsonFile
$dataDiskAdded = $false
Add-Content -Value "$($indents[5])^dataDisks^ : " -Path $jsonFile
Add-Content -Value "$($indents[5])[" -Path $jsonFile
foreach ( $dataDisk in $newVM.DataDisk )
{
if ( $dataDisk.LUN -ge 0 )
{
if( $dataDiskAdded )
{
Add-Content -Value "$($indents[6])," -Path $jsonFile
}
Add-Content -Value "$($indents[6]){" -Path $jsonFile
Add-Content -Value "$($indents[7])^name^: ^$vmName-disk-lun-$($dataDisk.LUN)^," -Path $jsonFile
Add-Content -Value "$($indents[7])^diskSizeGB^: ^$($dataDisk.DiskSizeInGB)^," -Path $jsonFile
Add-Content -Value "$($indents[7])^lun^: ^$($dataDisk.LUN)^," -Path $jsonFile
Add-Content -Value "$($indents[7])^createOption^: ^Empty^," -Path $jsonFile
Add-Content -Value "$($indents[7])^caching^: ^$($dataDisk.HostCaching)^," -Path $jsonFile
Add-Content -Value "$($indents[7])^vhd^:" -Path $jsonFile
Add-Content -Value "$($indents[7]){" -Path $jsonFile
Add-Content -Value "$($indents[8])^uri^: ^[concat('http://',variables('StorageAccountName'),'.blob.core.windows.net/vhds/','$vmName-$RGrandomWord-disk-lun-$($dataDisk.LUN).vhd')]^" -Path $jsonFile
Add-Content -Value "$($indents[7])}" -Path $jsonFile
Add-Content -Value "$($indents[6])}" -Path $jsonFile
LogMsg "Added $($dataDisk.DiskSizeInGB)GB Datadisk to $($dataDisk.LUN)."
$dataDiskAdded = $true
}
}
Add-Content -Value "$($indents[5])]" -Path $jsonFile
Add-Content -Value "$($indents[4])}" -Path $jsonFile
}
@ -366,15 +507,20 @@ Set-Content -Value "$($indents[0]){" -Path $jsonFile -Force
Add-Content -Value "$($indents[1])^parameters^: {}," -Path $jsonFile
Add-Content -Value "$($indents[1])^variables^:" -Path $jsonFile
Add-Content -Value "$($indents[1]){" -Path $jsonFile
#region Variables
Add-Content -Value "$($indents[2])^StorageAccountName^: ^$StorageAccountName^," -Path $jsonFile
Add-Content -Value "$($indents[2])^dnsNameForPublicIP^: ^$dnsNameForPublicIP^," -Path $jsonFile
Add-Content -Value "$($indents[2])^dnsNameForPublicIPv6^: ^$dnsNameForPublicIPv6^," -Path $jsonFile
Add-Content -Value "$($indents[2])^adminUserName^: ^$user^," -Path $jsonFile
Add-Content -Value "$($indents[2])^adminPassword^: ^$($password.Replace('"',''))^," -Path $jsonFile
Add-Content -Value "$($indents[2])^sshKeyPublicThumbPrint^: ^$sshPublicKeyThumbprint^," -Path $jsonFile
Add-Content -Value "$($indents[2])^sshKeyPath^: ^$sshPath^," -Path $jsonFile
Add-Content -Value "$($indents[2])^sshKeyData^: ^$sshKeyData^," -Path $jsonFile
Add-Content -Value "$($indents[2])^location^: ^$($Location.Replace('"',''))^," -Path $jsonFile
Add-Content -Value "$($indents[2])^publicIPAddressName^: ^$PublicIPName^," -Path $jsonFile
Add-Content -Value "$($indents[2])^publicIPv4AddressName^: ^$PublicIPName^," -Path $jsonFile
Add-Content -Value "$($indents[2])^publicIPv6AddressName^: ^$PublicIPv6Name^," -Path $jsonFile
Add-Content -Value "$($indents[2])^virtualNetworkName^: ^$virtualNetworkName^," -Path $jsonFile
Add-Content -Value "$($indents[2])^nicName^: ^$nicName^," -Path $jsonFile
Add-Content -Value "$($indents[2])^addressPrefix^: ^10.0.0.0/16^," -Path $jsonFile
@ -399,8 +545,10 @@ Set-Content -Value "$($indents[0]){" -Path $jsonFile -Force
Add-Content -Value "$($indents[2])^availabilitySetName^: ^$availibilitySetName^," -Path $jsonFile
Add-Content -Value "$($indents[2])^lbName^: ^$LoadBalancerName^," -Path $jsonFile
Add-Content -Value "$($indents[2])^lbID^: ^[resourceId('Microsoft.Network/loadBalancers',variables('lbName'))]^," -Path $jsonFile
Add-Content -Value "$($indents[2])^frontEndIPConfigID^: ^[concat(variables('lbID'),'/frontendIPConfigurations/LoadBalancerFrontEnd')]^," -Path $jsonFile
Add-Content -Value "$($indents[2])^lbPoolID^: ^[concat(variables('lbID'),'/backendAddressPools/BackendPool1')]^," -Path $jsonFile
Add-Content -Value "$($indents[2])^frontEndIPv4ConfigID^: ^[concat(variables('lbID'),'/frontendIPConfigurations/LoadBalancerFrontEndIPv4')]^," -Path $jsonFile
Add-Content -Value "$($indents[2])^frontEndIPv6ConfigID^: ^[concat(variables('lbID'),'/frontendIPConfigurations/LoadBalancerFrontEndIPv6')]^," -Path $jsonFile
Add-Content -Value "$($indents[2])^lbIPv4PoolID^: ^[concat(variables('lbID'),'/backendAddressPools/BackendPoolIPv4')]^," -Path $jsonFile
Add-Content -Value "$($indents[2])^lbIPv6PoolID^: ^[concat(variables('lbID'),'/backendAddressPools/BackendPoolIPv6')]^," -Path $jsonFile
Add-Content -Value "$($indents[2])^lbProbeID^: ^[concat(variables('lbID'),'/probes/tcpProbe')]^" -Path $jsonFile
#Add more variables here, if required..
#Add more variables here, if required..
@ -409,6 +557,8 @@ Set-Content -Value "$($indents[0]){" -Path $jsonFile -Force
Add-Content -Value "$($indents[1])}," -Path $jsonFile
LogMsg "Added Variables.."
#endregion
#region Define Resources
Add-Content -Value "$($indents[1])^resources^:" -Path $jsonFile
Add-Content -Value "$($indents[1])[" -Path $jsonFile
@ -419,7 +569,7 @@ Set-Content -Value "$($indents[0]){" -Path $jsonFile -Force
Add-Content -Value "$($indents[2]){" -Path $jsonFile
Add-Content -Value "$($indents[3])^apiVersion^: ^$apiVersion^," -Path $jsonFile
Add-Content -Value "$($indents[3])^type^: ^Microsoft.Network/publicIPAddresses^," -Path $jsonFile
Add-Content -Value "$($indents[3])^name^: ^[variables('publicIPAddressName')]^," -Path $jsonFile
Add-Content -Value "$($indents[3])^name^: ^[variables('publicIPv4AddressName')]^," -Path $jsonFile
Add-Content -Value "$($indents[3])^location^: ^[variables('location')]^," -Path $jsonFile
Add-Content -Value "$($indents[3])^properties^:" -Path $jsonFile
Add-Content -Value "$($indents[3]){" -Path $jsonFile
@ -433,6 +583,40 @@ Set-Content -Value "$($indents[0]){" -Path $jsonFile -Force
LogMsg "Added Public IP Address $PublicIPName.."
#endregion
#region New ARM Storage Account, if necessory!
if ( $NewARMStorageAccountType )
{
Add-Content -Value "$($indents[2]){" -Path $jsonFile
Add-Content -Value "$($indents[3])^apiVersion^: ^2015-06-15^," -Path $jsonFile
Add-Content -Value "$($indents[3])^type^: ^Microsoft.Storage/storageAccounts^," -Path $jsonFile
Add-Content -Value "$($indents[3])^name^: ^[variables('StorageAccountName')]^," -Path $jsonFile
Add-Content -Value "$($indents[3])^location^: ^[variables('location')]^," -Path $jsonFile
Add-Content -Value "$($indents[3])^properties^:" -Path $jsonFile
Add-Content -Value "$($indents[3]){" -Path $jsonFile
Add-Content -Value "$($indents[4])^accountType^: ^$($NewARMStorageAccountType.Trim())^" -Path $jsonFile
Add-Content -Value "$($indents[3])}" -Path $jsonFile
Add-Content -Value "$($indents[2])}," -Path $jsonFile
LogMsg "Added New Storage Account $StorageAccountName.."
}
#endregion
#region New ARM Bood Diagnostic Account
Add-Content -Value "$($indents[2]){" -Path $jsonFile
Add-Content -Value "$($indents[3])^apiVersion^: ^2015-06-15^," -Path $jsonFile
Add-Content -Value "$($indents[3])^type^: ^Microsoft.Storage/storageAccounts^," -Path $jsonFile
Add-Content -Value "$($indents[3])^name^: ^$bootDiagnosticsSA^," -Path $jsonFile
Add-Content -Value "$($indents[3])^location^: ^[variables('location')]^," -Path $jsonFile
Add-Content -Value "$($indents[3])^properties^:" -Path $jsonFile
Add-Content -Value "$($indents[3]){" -Path $jsonFile
Add-Content -Value "$($indents[4])^accountType^: ^Standard_LRS^" -Path $jsonFile
Add-Content -Value "$($indents[3])}" -Path $jsonFile
Add-Content -Value "$($indents[2])}," -Path $jsonFile
LogMsg "Added boot diagnostic Storage Account $bootDiagnosticsSA.."
#endregion
#region virtualNetworks
if (!$ExistingVnet)
{
@ -477,9 +661,31 @@ Set-Content -Value "$($indents[0]){" -Path $jsonFile -Force
#endregion
#region publicIPAddresses
if ( $EnableIPv6 )
{
Add-Content -Value "$($indents[2]){" -Path $jsonFile
Add-Content -Value "$($indents[3])^apiVersion^: ^$apiVersion^," -Path $jsonFile
Add-Content -Value "$($indents[3])^type^: ^Microsoft.Network/publicIPAddresses^," -Path $jsonFile
Add-Content -Value "$($indents[3])^name^: ^[variables('publicIPv6AddressName')]^," -Path $jsonFile
Add-Content -Value "$($indents[3])^location^: ^[variables('location')]^," -Path $jsonFile
Add-Content -Value "$($indents[3])^properties^:" -Path $jsonFile
Add-Content -Value "$($indents[3]){" -Path $jsonFile
Add-Content -Value "$($indents[4])^publicIPAllocationMethod^: ^[variables('publicIPAddressType')]^," -Path $jsonFile
Add-Content -Value "$($indents[4])^publicIPAddressVersion^: ^IPv6^," -Path $jsonFile
Add-Content -Value "$($indents[4])^dnsSettings^: " -Path $jsonFile
Add-Content -Value "$($indents[4]){" -Path $jsonFile
Add-Content -Value "$($indents[5])^domainNameLabel^: ^[variables('dnsNameForPublicIPv6')]^" -Path $jsonFile
Add-Content -Value "$($indents[4])}" -Path $jsonFile
Add-Content -Value "$($indents[3])}" -Path $jsonFile
Add-Content -Value "$($indents[2])}," -Path $jsonFile
LogMsg "Added Public IPv6 Address $PublicIPv6Name.."
}
#endregion
#region Multiple VM Deployment
if ( $numberOfVMs -gt 1 )
if ( ($numberOfVMs -gt 1) -or ($EnableIPv6) -or ($ForceLoadBalancerForSingleVM) )
{
#region availabilitySets
Add-Content -Value "$($indents[2]){" -Path $jsonFile
@ -503,28 +709,57 @@ Set-Content -Value "$($indents[0]){" -Path $jsonFile -Force
Add-Content -Value "$($indents[3])^location^: ^[variables('location')]^," -Path $jsonFile
Add-Content -Value "$($indents[3])^dependsOn^: " -Path $jsonFile
Add-Content -Value "$($indents[3])[" -Path $jsonFile
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]^" -Path $jsonFile
if ( $EnableIPv6 )
{
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPv6AddressName'))]^," -Path $jsonFile
}
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPv4AddressName'))]^" -Path $jsonFile
Add-Content -Value "$($indents[3])]," -Path $jsonFile
Add-Content -Value "$($indents[3])^properties^:" -Path $jsonFile
Add-Content -Value "$($indents[3]){" -Path $jsonFile
Add-Content -Value "$($indents[4])^frontendIPConfigurations^: " -Path $jsonFile
Add-Content -Value "$($indents[4])[" -Path $jsonFile
Add-Content -Value "$($indents[5]){" -Path $jsonFile
Add-Content -Value "$($indents[6])^name^: ^LoadBalancerFrontEnd^," -Path $jsonFile
Add-Content -Value "$($indents[6])^name^: ^LoadBalancerFrontEndIPv4^," -Path $jsonFile
Add-Content -Value "$($indents[6])^properties^:" -Path $jsonFile
Add-Content -Value "$($indents[6]){" -Path $jsonFile
Add-Content -Value "$($indents[7])^publicIPAddress^:" -Path $jsonFile
Add-Content -Value "$($indents[7]){" -Path $jsonFile
Add-Content -Value "$($indents[8])^id^: ^[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]^" -Path $jsonFile
Add-Content -Value "$($indents[8])^id^: ^[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPv4AddressName'))]^" -Path $jsonFile
Add-Content -Value "$($indents[7])}" -Path $jsonFile
Add-Content -Value "$($indents[6])}" -Path $jsonFile
Add-Content -Value "$($indents[5])}" -Path $jsonFile
#region IPV6 frondend loadbalancer config
if ( $EnableIPv6 )
{
Add-Content -Value "$($indents[5])," -Path $jsonFile
Add-Content -Value "$($indents[5]){" -Path $jsonFile
Add-Content -Value "$($indents[6])^name^: ^LoadBalancerFrontEndIPv6^," -Path $jsonFile
Add-Content -Value "$($indents[6])^properties^:" -Path $jsonFile
Add-Content -Value "$($indents[6]){" -Path $jsonFile
Add-Content -Value "$($indents[7])^publicIPAddress^:" -Path $jsonFile
Add-Content -Value "$($indents[7]){" -Path $jsonFile
Add-Content -Value "$($indents[8])^id^: ^[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPv6AddressName'))]^" -Path $jsonFile
Add-Content -Value "$($indents[7])}" -Path $jsonFile
Add-Content -Value "$($indents[6])}" -Path $jsonFile
Add-Content -Value "$($indents[5])}" -Path $jsonFile
}
#endregion
Add-Content -Value "$($indents[4])]," -Path $jsonFile
Add-Content -Value "$($indents[4])^backendAddressPools^:" -Path $jsonFile
Add-Content -Value "$($indents[4])[" -Path $jsonFile
Add-Content -Value "$($indents[5]){" -Path $jsonFile
Add-Content -Value "$($indents[6])^name^:^BackendPool1^" -Path $jsonFile
Add-Content -Value "$($indents[6])^name^:^BackendPoolIPv4^" -Path $jsonFile
Add-Content -Value "$($indents[5])}" -Path $jsonFile
if ( $EnableIPv6 )
{
Add-Content -Value "$($indents[5])," -Path $jsonFile
Add-Content -Value "$($indents[5]){" -Path $jsonFile
Add-Content -Value "$($indents[6])^name^:^BackendPoolIPv6^" -Path $jsonFile
Add-Content -Value "$($indents[5])}" -Path $jsonFile
}
Add-Content -Value "$($indents[4])]," -Path $jsonFile
#region Normal Endpoints
@ -557,7 +792,7 @@ foreach ( $newVM in $RGXMLData.VirtualMachine)
Add-Content -Value "$($indents[6]){" -Path $jsonFile
Add-Content -Value "$($indents[7])^frontendIPConfiguration^:" -Path $jsonFile
Add-Content -Value "$($indents[7]){" -Path $jsonFile
Add-Content -Value "$($indents[8])^id^: ^[variables('frontEndIPConfigID')]^" -Path $jsonFile
Add-Content -Value "$($indents[8])^id^: ^[variables('frontEndIPv4ConfigID')]^" -Path $jsonFile
Add-Content -Value "$($indents[7])}," -Path $jsonFile
Add-Content -Value "$($indents[7])^protocol^: ^$($endpoint.Protocol)^," -Path $jsonFile
Add-Content -Value "$($indents[7])^frontendPort^: ^$($endpoint.PublicPort)^," -Path $jsonFile
@ -614,20 +849,35 @@ foreach ( $newVM in $RGXMLData.VirtualMachine)
Add-Content -Value "$($indents[7])^frontendIPConfiguration^:" -Path $jsonFile
Add-Content -Value "$($indents[7]){" -Path $jsonFile
Add-Content -Value "$($indents[8])^id^: ^[variables('frontEndIPConfigID')]^" -Path $jsonFile
if ($endpoint.EnableIPv6 -eq "True")
{
Add-Content -Value "$($indents[8])^id^: ^[variables('frontEndIPv6ConfigID')]^" -Path $jsonFile
}
else
{
Add-Content -Value "$($indents[8])^id^: ^[variables('frontEndIPv4ConfigID')]^" -Path $jsonFile
}
Add-Content -Value "$($indents[7])}," -Path $jsonFile
Add-Content -Value "$($indents[7])^backendAddressPool^:" -Path $jsonFile
Add-Content -Value "$($indents[7]){" -Path $jsonFile
Add-Content -Value "$($indents[8])^id^: ^[variables('lbPoolID')]^" -Path $jsonFile
if ($endpoint.EnableIPv6 -eq "True")
{
Add-Content -Value "$($indents[8])^id^: ^[variables('lbIPv6PoolID')]^" -Path $jsonFile
}
else
{
Add-Content -Value "$($indents[8])^id^: ^[variables('lbIPv4PoolID')]^" -Path $jsonFile
}
Add-Content -Value "$($indents[7])}," -Path $jsonFile
Add-Content -Value "$($indents[7])^protocol^: ^$($endpoint.Protocol)^," -Path $jsonFile
Add-Content -Value "$($indents[7])^frontendPort^: ^$($endpoint.PublicPort)^," -Path $jsonFile
Add-Content -Value "$($indents[7])^backendPort^: ^$($endpoint.LocalPort)^," -Path $jsonFile
Add-Content -Value "$($indents[7])^enableFloatingIP^: false," -Path $jsonFile
Add-Content -Value "$($indents[7])^backendPort^: ^$($endpoint.LocalPort)^" -Path $jsonFile
if ( $endpoint.ProbePort )
{
$probePorts += 1
Add-Content -Value "$($indents[7])," -Path $jsonFile
Add-Content -Value "$($indents[7])^probe^:" -Path $jsonFile
Add-Content -Value "$($indents[7]){" -Path $jsonFile
Add-Content -Value "$($indents[8])^id^: ^[concat(variables('lbID'),'/probes/$RGName-LB-$($endpoint.Name)-probe')]^" -Path $jsonFile
@ -636,7 +886,12 @@ foreach ( $newVM in $RGXMLData.VirtualMachine)
}
else
{
if ( $endpoint.EnableIPv6 -ne "True" )
{
Add-Content -Value "$($indents[7])," -Path $jsonFile
Add-Content -Value "$($indents[7])^enableFloatingIP^: false," -Path $jsonFile
Add-Content -Value "$($indents[7])^idleTimeoutInMinutes^: 5" -Path $jsonFile
}
}
Add-Content -Value "$($indents[6])}" -Path $jsonFile
Add-Content -Value "$($indents[5])}" -Path $jsonFile
@ -763,7 +1018,11 @@ foreach ( $newVM in $RGXMLData.VirtualMachine)
Add-Content -Value "$($indents[3])^location^: ^[variables('location')]^," -Path $jsonFile
Add-Content -Value "$($indents[3])^dependsOn^: " -Path $jsonFile
Add-Content -Value "$($indents[3])[" -Path $jsonFile
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]^," -Path $jsonFile
if ( $EnableIPv6 )
{
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPv6AddressName'))]^," -Path $jsonFile
}
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPv4AddressName'))]^," -Path $jsonFile
if(!$ExistingVnet)
{
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]^," -Path $jsonFile
@ -775,15 +1034,17 @@ foreach ( $newVM in $RGXMLData.VirtualMachine)
Add-Content -Value "$($indents[3]){" -Path $jsonFile
Add-Content -Value "$($indents[4])^ipConfigurations^: " -Path $jsonFile
Add-Content -Value "$($indents[4])[" -Path $jsonFile
#region IPv4 Config
Add-Content -Value "$($indents[5]){" -Path $jsonFile
Add-Content -Value "$($indents[6])^name^: ^ipconfig1^," -Path $jsonFile
Add-Content -Value "$($indents[6])^name^: ^IPv4Config1^," -Path $jsonFile
Add-Content -Value "$($indents[6])^properties^: " -Path $jsonFile
Add-Content -Value "$($indents[6]){" -Path $jsonFile
Add-Content -Value "$($indents[7])^privateIPAddressVersion^:^IPv4^," -Path $jsonFile
Add-Content -Value "$($indents[7])^loadBalancerBackendAddressPools^:" -Path $jsonFile
Add-Content -Value "$($indents[7])[" -Path $jsonFile
Add-Content -Value "$($indents[8]){" -Path $jsonFile
Add-Content -Value "$($indents[9])^id^: ^[concat(variables('lbID'), '/backendAddressPools/BackendPool1')]^" -Path $jsonFile
Add-Content -Value "$($indents[9])^id^: ^[concat(variables('lbID'), '/backendAddressPools/BackendPoolIPv4')]^" -Path $jsonFile
Add-Content -Value "$($indents[8])}" -Path $jsonFile
Add-Content -Value "$($indents[7])]," -Path $jsonFile
@ -824,6 +1085,30 @@ foreach ( $newVM in $RGXMLData.VirtualMachine)
Add-Content -Value "$($indents[7])^privateIPAllocationMethod^: ^Dynamic^" -Path $jsonFile
Add-Content -Value "$($indents[6])}" -Path $jsonFile
Add-Content -Value "$($indents[5])}" -Path $jsonFile
#endregion
#region IPv6 Config...
if ( $EnableIPv6 )
{
Add-Content -Value "$($indents[5])," -Path $jsonFile
Add-Content -Value "$($indents[5]){" -Path $jsonFile
Add-Content -Value "$($indents[6])^name^: ^IPv6Config1^," -Path $jsonFile
Add-Content -Value "$($indents[6])^properties^: " -Path $jsonFile
Add-Content -Value "$($indents[6]){" -Path $jsonFile
Add-Content -Value "$($indents[7])^privateIPAddressVersion^:^IPv6^," -Path $jsonFile
Add-Content -Value "$($indents[7])^loadBalancerBackendAddressPools^:" -Path $jsonFile
Add-Content -Value "$($indents[7])[" -Path $jsonFile
Add-Content -Value "$($indents[8]){" -Path $jsonFile
Add-Content -Value "$($indents[9])^id^: ^[concat(variables('lbID'), '/backendAddressPools/BackendPoolIPv6')]^" -Path $jsonFile
Add-Content -Value "$($indents[8])}" -Path $jsonFile
Add-Content -Value "$($indents[7])]," -Path $jsonFile
Add-Content -Value "$($indents[7])^privateIPAllocationMethod^: ^Dynamic^" -Path $jsonFile
Add-Content -Value "$($indents[6])}" -Path $jsonFile
Add-Content -Value "$($indents[5])}" -Path $jsonFile
}
#endregion
Add-Content -Value "$($indents[4])]" -Path $jsonFile
Add-Content -Value "$($indents[3])}" -Path $jsonFile
Add-Content -Value "$($indents[2])}," -Path $jsonFile
@ -840,6 +1125,10 @@ foreach ( $newVM in $RGXMLData.VirtualMachine)
Add-Content -Value "$($indents[3])^dependsOn^: " -Path $jsonFile
Add-Content -Value "$($indents[3])[" -Path $jsonFile
Add-Content -Value "$($indents[4])^[concat('Microsoft.Compute/availabilitySets/', variables('availabilitySetName'))]^," -Path $jsonFile
if ( $NewARMStorageAccountType)
{
Add-Content -Value "$($indents[4])^[concat('Microsoft.Storage/storageAccounts/', variables('StorageAccountName'))]^," -Path $jsonFile
}
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/networkInterfaces/', '$NIC')]^" -Path $jsonFile
Add-Content -Value "$($indents[3])]," -Path $jsonFile
@ -903,6 +1192,18 @@ foreach ( $newVM in $RGXMLData.VirtualMachine)
Add-Content -Value "$($indents[4])}" -Path $jsonFile
#endregion
#region Enable boot dignostics.
Add-Content -Value "$($indents[4])," -Path $jsonFile
Add-Content -Value "$($indents[4])^diagnosticsProfile^: " -Path $jsonFile
Add-Content -Value "$($indents[4]){" -Path $jsonFile
Add-Content -Value "$($indents[5])^bootDiagnostics^: " -Path $jsonFile
Add-Content -Value "$($indents[5]){" -Path $jsonFile
Add-Content -Value "$($indents[6])^enabled^: true," -Path $jsonFile
Add-Content -Value "$($indents[6])^storageUri^: ^[reference(resourceId('$RGName', 'Microsoft.Storage/storageAccounts', '$bootDiagnosticsSA'), '2015-06-15').primaryEndpoints['blob']]^" -Path $jsonFile
Add-Content -Value "$($indents[5])}" -Path $jsonFile
Add-Content -Value "$($indents[4])}" -Path $jsonFile
#endregion
Add-Content -Value "$($indents[3])}" -Path $jsonFile
LogMsg "Attached Network Interface Card `"$NIC`" to Virtual Machine `"$vmName`"."
#endregion
@ -919,7 +1220,7 @@ foreach ( $newVM in $RGXMLData.VirtualMachine)
#endregion
#region Single VM Deployment...
if ( $numberOfVMs -eq 1)
if ( ($numberOfVMs -eq 1) -and !$EnableIPv6 -and !$ForceLoadBalancerForSingleVM )
{
if($newVM.RoleName)
{
@ -955,7 +1256,8 @@ if ( $numberOfVMs -eq 1)
Add-Content -Value "$($indents[3])^location^: ^[variables('location')]^," -Path $jsonFile
Add-Content -Value "$($indents[3])^dependsOn^: " -Path $jsonFile
Add-Content -Value "$($indents[3])[" -Path $jsonFile
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPAddressName'))]^," -Path $jsonFile
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/publicIPAddresses/', variables('publicIPv4AddressName'))]^," -Path $jsonFile
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/networkSecurityGroups/', '$SecurityGroupName')]^," -Path $jsonFile
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/virtualNetworks/', variables('virtualNetworkName'))]^" -Path $jsonFile
Add-Content -Value "$($indents[3])]," -Path $jsonFile
@ -964,13 +1266,13 @@ if ( $numberOfVMs -eq 1)
Add-Content -Value "$($indents[4])^ipConfigurations^: " -Path $jsonFile
Add-Content -Value "$($indents[4])[" -Path $jsonFile
Add-Content -Value "$($indents[5]){" -Path $jsonFile
Add-Content -Value "$($indents[6])^name^: ^ipconfig1^," -Path $jsonFile
Add-Content -Value "$($indents[6])^name^: ^IPv4Config1^," -Path $jsonFile
Add-Content -Value "$($indents[6])^properties^: " -Path $jsonFile
Add-Content -Value "$($indents[6]){" -Path $jsonFile
Add-Content -Value "$($indents[7])^privateIPAllocationMethod^: ^Dynamic^," -Path $jsonFile
Add-Content -Value "$($indents[7])^publicIPAddress^:" -Path $jsonFile
Add-Content -Value "$($indents[7]){" -Path $jsonFile
Add-Content -Value "$($indents[8])^id^: ^[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPAddressName'))]^" -Path $jsonFile
Add-Content -Value "$($indents[8])^id^: ^[resourceId('Microsoft.Network/publicIPAddresses',variables('publicIPv4AddressName'))]^" -Path $jsonFile
Add-Content -Value "$($indents[7])}," -Path $jsonFile
Add-Content -Value "$($indents[7])^subnet^:" -Path $jsonFile
Add-Content -Value "$($indents[7]){" -Path $jsonFile
@ -1007,7 +1309,7 @@ if ( $numberOfVMs -eq 1)
Add-Content -Value "$($indents[4])^ipConfigurations^: " -Path $jsonFile
Add-Content -Value "$($indents[4])[" -Path $jsonFile
Add-Content -Value "$($indents[5]){" -Path $jsonFile
Add-Content -Value "$($indents[6])^name^: ^ipconfig1^," -Path $jsonFile
Add-Content -Value "$($indents[6])^name^: ^IPv4Config1^," -Path $jsonFile
Add-Content -Value "$($indents[6])^properties^: " -Path $jsonFile
Add-Content -Value "$($indents[6]){" -Path $jsonFile
Add-Content -Value "$($indents[7])^subnet^:" -Path $jsonFile
@ -1101,6 +1403,10 @@ if ( $numberOfVMs -eq 1)
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/networkInterfaces/', '$NicName')]^," -Path $jsonFile
LogMsg "Added Nic $NicName to virtualMachines"
}
if ( $NewARMStorageAccountType)
{
Add-Content -Value "$($indents[4])^[concat('Microsoft.Storage/storageAccounts/', variables('StorageAccountName'))]^," -Path $jsonFile
}
Add-Content -Value "$($indents[4])^[concat('Microsoft.Network/networkInterfaces/', '$NIC')]^" -Path $jsonFile
LogMsg "Added Nic $NIC to virtualMachines"
#endregion
@ -1156,6 +1462,8 @@ if ( $numberOfVMs -eq 1)
Add-Content -Value "$($indents[6])}" -Path $jsonFile
}
#endregion
Add-Content -Value "$($indents[5])]" -Path $jsonFile
<#
Add-Content -Value "$($indents[5])]," -Path $jsonFile
Add-Content -Value "$($indents[5])^inputEndpoints^: " -Path $jsonFile
Add-Content -Value "$($indents[5])[" -Path $jsonFile
@ -1179,12 +1487,31 @@ if ( $numberOfVMs -eq 1)
$EndPointAdded = $true
}
#endregion
Add-Content -Value "$($indents[5])]" -Path $jsonFile
#>
Add-Content -Value "$($indents[4])}" -Path $jsonFile
#endregion
LogMsg "Added Network Profile."
#region Enable boot dignostics.
Add-Content -Value "$($indents[4])," -Path $jsonFile
Add-Content -Value "$($indents[4])^diagnosticsProfile^: " -Path $jsonFile
Add-Content -Value "$($indents[4]){" -Path $jsonFile
Add-Content -Value "$($indents[5])^bootDiagnostics^: " -Path $jsonFile
Add-Content -Value "$($indents[5]){" -Path $jsonFile
Add-Content -Value "$($indents[6])^enabled^: true," -Path $jsonFile
Add-Content -Value "$($indents[6])^storageUri^: ^[reference(resourceId('$RGName', 'Microsoft.Storage/storageAccounts', '$bootDiagnosticsSA'), '2015-06-15').primaryEndpoints['blob']]^" -Path $jsonFile
Add-Content -Value "$($indents[5])}" -Path $jsonFile
Add-Content -Value "$($indents[4])}" -Path $jsonFile
LogMsg "Added Diagnostics Profile."
#endregion
Add-Content -Value "$($indents[3])}" -Path $jsonFile
LogMsg "Added Network Profile."
#endregion
LogMsg "Added Virtual Machine $vmName"
Add-Content -Value "$($indents[2])}" -Path $jsonFile

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

@ -100,7 +100,18 @@ function GetTestSummary($testCycle, [DateTime] $StartTime, [string] $xmlFilename
$testSuiteRunDuration=$testSuiteRunDuration.Days.ToString() + ":" + $testSuiteRunDuration.hours.ToString() + ":" + $testSuiteRunDuration.minutes.ToString()
$str = "<br />Test Results Summary<br />"
$str += "ICA test run on " + $startTime
$str += "<br />Image under test " + $distro
if ( $BaseOsImage )
{
$str += "<br />Image under test " + $BaseOsImage
}
if ( $BaseOSVHD )
{
$str += "<br />VHD under test " + $BaseOSVHD
}
if ( $ARMImage )
{
$str += "<br />ARM Image under test " + "$($ARMImage.Publisher) : $($ARMImage.Offer) : $($ARMImage.Sku) : $($ARMImage.Version)"
}
$str += "<br />Total Executed TestCases " + $testSuiteResultDetails.totalTc + " (" + $testSuiteResultDetails.totalPassTc + " Pass" + ", " + $testSuiteResultDetails.totalFailTc + " Fail" + ", " + $testSuiteResultDetails.totalAbortedTc + " Abort)"
$str += "<br />Total Execution Time(dd:hh:mm) " + $testSuiteRunDuration.ToString()
$str += "<br />XML file: $xmlFilename<br /><br />"
@ -113,21 +124,29 @@ function GetTestSummary($testCycle, [DateTime] $StartTime, [string] $xmlFilename
$str += "</pre>"
$plainTextSummary = $str
$strHtml = "<style type='text/css'>" +
".TFtable{width:800px; border-collapse:collapse; }" +
".TFtable{width:1024px; border-collapse:collapse; }" +
".TFtable td{ padding:7px; border:#4e95f4 1px solid;}" +
".TFtable tr{ background: #b8d1f3;}" +
".TFtable tr:nth-child(odd){ background: #dbe1e9;}" +
".TFtable tr:nth-child(even){background: #ffffff;}</style>" +
"<Html><head><title>Test Results Summary</title></head>" +
"<body style = 'font-family:sans-serif;font-size:13px;color:#000000;margin:0px;padding:30px'>" +
"<br/><h1 style='background-color:lightblue;width:800'>Test Results Summary - ${xmlFilename} </h1>"
$strHtml += "<h2 style='background-color:lightblue;width:800'>ICA test run on - " + $startTime + "</h2><span style='font-size: medium'>"
$strHtml += "<br /><br/>Image under test - " + $distrHtmlo
$strHtml += "<br /><br/>Total Executed TestCases - " + $testSuiteResultDetails.totalTc + " (" +
$testSuiteResultDetails.totalPassTc + " - <span style='background-color:green'>PASS</span>" + ", " +
$testSuiteResultDetails.totalFailTc + " - <span style='background-color:red'>FAIL</span>" + ", " +
$testSuiteResultDetails.totalAbortedTc + " - <span style='background-color:yellow'>ABORTED</span>)"
"<br/><h1 style='background-color:lightblue;width:1024'>Test Results Summary</h1>"
$strHtml += "<h2 style='background-color:lightblue;width:1024'>ICA test run on - " + $startTime + "</h2><span style='font-size: medium'>"
if ( $BaseOsImage )
{
$strHtml += '<p>Image under test - <span style="font-family:courier new,courier,monospace;">' + "$BaseOsImage</span></p>"
}
if ( $BaseOSVHD )
{
$strHtml += '<p>VHD under test - <span style="font-family:courier new,courier,monospace;">' + "$BaseOsVHD</span></p>"
}
if ( $ARMImage )
{
$strHtml += '<p>ARM Image under test - <span style="font-family:courier new,courier,monospace;">' + "$($ARMImage.Publisher) : $($ARMImage.Offer) : $($ARMImage.Sku) : $($ARMImage.Version)</span></p>"
}
$strHtml += '<p>Total Executed TestCases - <strong><span style="font-size:16px;">' + "$($testSuiteResultDetails.totalTc)" + '</span></strong><br />' + '[&nbsp;<span style="font-size:16px;"><span style="color:#008000;"><strong>' + $testSuiteResultDetails.totalPassTc + ' </strong></span></span> - PASS, <span style="font-size:16px;"><span style="color:#ff0000;"><strong>' + "$($testSuiteResultDetails.totalFailTc)" + '</strong></span></span>- FAIL, <span style="font-size:16px;"><span style="color:#ff0000;"><strong><span style="background-color:#ffff00;">' + "$($testSuiteResultDetails.totalAbortedTc)" +'</span></strong></span></span> - ABORTED ]</p>'
$strHtml += "<br /><br/>Total Execution Time(dd:hh:mm) " + $testSuiteRunDuration.ToString()
$strHtml += "<br /><br/>XML file: $xmlFilename<br /><br /></span>"
@ -704,4 +723,4 @@ Function RunAzureCmd ($AzureCmdlet, $maxWaitTimeSeconds = 600, [string]$storagea
}
Throw "Failed to execute Azure command."
}
}
}

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

@ -15,14 +15,11 @@ Function ProvisionVMsForLisa($allVMData, $installPackagesOnRoleNames)
$out = Invoke-WebRequest -Uri $scriptUrl -OutFile "$LogDir\$scriptName"
LogMsg "Time taken: $((Get-Date).Subtract($start_time).Seconds) second(s)"
Set-Content -Value "echo `"Host *`" > /home/$user/.ssh/config" -Path "$LogDir\disableHostKeyVerification.sh"
Add-Content -Value "echo StrictHostKeyChecking=no >> /home/$user/.ssh/config" -Path "$LogDir\disableHostKeyVerification.sh"
Add-Content -Value "echo IdentityFile /root/$sshPrivateKey >> /home/$user/.ssh/config" -Path "$LogDir\disableHostKeyVerification.sh"
$keysGenerated = $false
foreach ( $vmData in $allVMData )
{
LogMsg "Configuring $($vmData.RoleName) for LISA test..."
RemoteCopy -uploadTo $vmData.PublicIP -port $vmData.SSHPort -files ".\remote-scripts\enableRoot.sh,$sshPrivateKeyPath,.\$LogDir\disableHostKeyVerification.sh,.\$LogDir\provisionLinuxForLisa.sh" -username $user -password $password -upload
RemoteCopy -uploadTo $vmData.PublicIP -port $vmData.SSHPort -files ".\remote-scripts\enableRoot.sh,.\remote-scripts\enablePasswordLessRoot.sh,.\$LogDir\provisionLinuxForLisa.sh" -username $user -password $password -upload
$out = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username $user -password $password -command "chmod +x /home/$user/*.sh" -runAsSudo
$rootPasswordSet = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username $user -password $password -command "/home/$user/enableRoot.sh -password $($password.Replace('"',''))" -runAsSudo
LogMsg $rootPasswordSet
@ -34,12 +31,49 @@ Function ProvisionVMsForLisa($allVMData, $installPackagesOnRoleNames)
{
Throw "Failed to enable root password / starting SSHD service. Please check logs. Aborting test."
}
$out = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "chmod 600 /home/$user/$sshPrivateKey && cp -ar /home/$user/* /root/"
$out = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "mkdir -p /root/.ssh/ && cp /home/$user/.ssh/authorized_keys /root/.ssh/"
$out = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "/home/$user/disableHostKeyVerification.sh"
$out = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "cp /home/$user/.ssh/config /root/.ssh/"
$out = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "service sshd restart"
LogMsg "$($vmData.RoleName) preparation finished."
$out = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "cp -ar /home/$user/*.sh ."
if ( $keysGenerated )
{
RemoteCopy -uploadTo $vmData.PublicIP -port $vmData.SSHPort -files ".\$LogDir\sshFix.tar" -username "root" -password $password -upload
$keyCopyOut = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "./enablePasswordLessRoot.sh"
LogMsg $keyCopyOut
if ( $keyCopyOut -imatch "KEY_COPIED_SUCCESSFULLY" )
{
$keysGenerated = $true
LogMsg "SSH keys copied to $($vmData.RoleName)"
$md5sumCopy = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "md5sum .ssh/id_rsa"
if ( $md5sumGen -eq $md5sumCopy )
{
LogMsg "md5sum check success for .ssh/id_rsa."
}
else
{
Throw "md5sum check failed for .ssh/id_rsa. Aborting test."
}
}
else
{
Throw "Error in copying SSH key to $($vmData.RoleName)"
}
}
else
{
$out = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "rm -rf /root/sshFix*"
$keyGenOut = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "./enablePasswordLessRoot.sh"
LogMsg $keyGenOut
if ( $keyGenOut -imatch "KEY_GENERATED_SUCCESSFULLY" )
{
$keysGenerated = $true
LogMsg "SSH keys generated in $($vmData.RoleName)"
RemoteCopy -download -downloadFrom $vmData.PublicIP -port $vmData.SSHPort -files "/root/sshFix.tar" -username "root" -password $password -downloadTo $LogDir
$md5sumGen = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "md5sum .ssh/id_rsa"
}
else
{
Throw "Error in generating SSH key in $($vmData.RoleName)"
}
}
}
$packageInstallJobs = @()
@ -101,4 +135,213 @@ Function ProvisionVMsForLisa($allVMData, $installPackagesOnRoleNames)
WaitFor -seconds 10
}
}
}
function InstallCustomKernel ($customKernel, $allVMData, [switch]$RestartAfterUpgrade)
{
try
{
$customKernel = $customKernel.Trim()
if( ($customKernel -ne "linuxnext") -and ($customKernel -ne "netnext") -and !($customKernel.EndsWith(".deb")) -and !($customKernel.EndsWith(".rpm")) )
{
LogErr "Only linuxnext and netnext version is supported. Other version will be added soon. Use -customKernel linuxnext. Or use -customKernel <link to deb file>"
}
else
{
$scriptName = "customKernelInstall.sh"
$jobCount = 0
$kernelSuccess = 0
$packageInstallJobs = @()
foreach ( $vmData in $allVMData )
{
RemoteCopy -uploadTo $vmData.PublicIP -port $vmData.SSHPort -files ".\remote-scripts\$scriptName,.\SetupScripts\DetectLinuxDistro.sh" -username $user -password $password -upload
$out = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username $user -password $password -command "chmod +x *.sh" -runAsSudo
$currentKernelVersion = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username $user -password $password -command "uname -r"
LogMsg "Executing $scriptName ..."
$jobID = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username $user -password $password -command "/home/$user/$scriptName -customKernel $customKernel -logFolder /home/$user" -RunInBackground -runAsSudo
$packageInstallObj = New-Object PSObject
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name ID -Value $jobID
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name RoleName -Value $vmData.RoleName
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name PublicIP -Value $vmData.PublicIP
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name SSHPort -Value $vmData.SSHPort
$packageInstallJobs += $packageInstallObj
$jobCount += 1
#endregion
}
$packageInstallJobsRunning = $true
while ($packageInstallJobsRunning)
{
$packageInstallJobsRunning = $false
foreach ( $job in $packageInstallJobs )
{
if ( (Get-Job -Id $($job.ID)).State -eq "Running" )
{
$currentStatus = RunLinuxCmd -ip $job.PublicIP -port $job.SSHPort -username $user -password $password -command "tail -n 1 build-customKernel.txt"
LogMsg "Package Installation Status for $($job.RoleName) : $currentStatus"
$packageInstallJobsRunning = $true
}
else
{
if ( !(Test-Path -Path "$LogDir\$($job.RoleName)-build-customKernel.txt" ) )
{
RemoteCopy -download -downloadFrom $job.PublicIP -port $job.SSHPort -files "build-customKernel.txt" -username $user -password $password -downloadTo $LogDir
if ( ( Get-Content "$LogDir\build-customKernel.txt" ) -imatch "CUSTOM_KERNEL_SUCCESS" )
{
$kernelSuccess += 1
}
Rename-Item -Path "$LogDir\build-customKernel.txt" -NewName "$($job.RoleName)-build-customKernel.txt" -Force | Out-Null
}
}
}
if ( $packageInstallJobsRunning )
{
WaitFor -seconds 10
}
}
if ( $kernelSuccess -eq $jobCount )
{
LogMsg "Kernel upgraded to `"$customKernel`" successfully in all VMs."
if ( $RestartAfterUpgrade )
{
LogMsg "Now restarting VMs..."
$restartStatus = RestartAllDeployments -allVMData $allVMData
if ( $restartStatus -eq "True")
{
$upgradedKernelVersion = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username $user -password $password -command "uname -r"
LogMsg "Old kernel: $currentKernelVersion"
LogMsg "New kernel: $upgradedKernelVersion"
Add-Content -Value "Old kernel: $currentKernelVersion" -Path .\report\AdditionalInfo.html -Force
Add-Content -Value "New kernel: $upgradedKernelVersion" -Path .\report\AdditionalInfo.html -Force
if ($currentKernelVersion -eq $upgradedKernelVersion)
{
LogErr "Kernel version is same after restarting VMs."
return $false
}
else
{
return $true
}
}
else
{
return $false
}
}
return $true
}
else
{
LogErr "Kernel upgrade failed in $($jobCount-$kernelSuccess) VMs."
return $false
}
}
}
catch
{
LogErr "Exception in InstallCustomKernel."
return $false
}
}
function InstallcustomLIS ($customLIS, $customLISBranch, $allVMData, [switch]$RestartAfterUpgrade)
{
try
{
$customLIS = $customLIS.Trim()
if( ($customLIS -ne "lisnext") -and !($customLIS.EndsWith("tar.gz")))
{
LogErr "Only lisnext and *.tar.gz links are supported. Use -customLIS lisnext -LISbranch <branch name>. Or use -customLIS <link to tar.gz file>"
}
else
{
ProvisionVMsForLisa -allVMData $allVMData -installPackagesOnRoleNames none
$scriptName = "customLISInstall.sh"
$jobCount = 0
$lisSuccess = 0
$packageInstallJobs = @()
foreach ( $vmData in $allVMData )
{
RemoteCopy -uploadTo $vmData.PublicIP -port $vmData.SSHPort -files ".\remote-scripts\$scriptName,.\SetupScripts\DetectLinuxDistro.sh" -username "root" -password $password -upload
$out = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "chmod +x *.sh" -runAsSudo
$currentlisVersion = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "modinfo hv_vmbus"
LogMsg "Executing $scriptName ..."
$jobID = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "/root/$scriptName -customLIS $customLIS -LISbranch $customLISBranch" -RunInBackground -runAsSudo
$packageInstallObj = New-Object PSObject
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name ID -Value $jobID
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name RoleName -Value $vmData.RoleName
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name PublicIP -Value $vmData.PublicIP
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name SSHPort -Value $vmData.SSHPort
$packageInstallJobs += $packageInstallObj
$jobCount += 1
#endregion
}
$packageInstallJobsRunning = $true
while ($packageInstallJobsRunning)
{
$packageInstallJobsRunning = $false
foreach ( $job in $packageInstallJobs )
{
if ( (Get-Job -Id $($job.ID)).State -eq "Running" )
{
$currentStatus = RunLinuxCmd -ip $job.PublicIP -port $job.SSHPort -username "root" -password $password -command "tail -n 1 build-customLIS.txt"
LogMsg "Package Installation Status for $($job.RoleName) : $currentStatus"
$packageInstallJobsRunning = $true
}
else
{
if ( !(Test-Path -Path "$LogDir\$($job.RoleName)-build-customLIS.txt" ) )
{
RemoteCopy -download -downloadFrom $job.PublicIP -port $job.SSHPort -files "build-customLIS.txt" -username "root" -password $password -downloadTo $LogDir
if ( ( Get-Content "$LogDir\build-customLIS.txt" ) -imatch "CUSTOM_LIS_SUCCESS" )
{
$lisSuccess += 1
}
Rename-Item -Path "$LogDir\build-customLIS.txt" -NewName "$($job.RoleName)-build-customLIS.txt" -Force | Out-Null
}
}
}
if ( $packageInstallJobsRunning )
{
WaitFor -seconds 10
}
}
if ( $lisSuccess -eq $jobCount )
{
LogMsg "lis upgraded to `"$customLIS`" successfully in all VMs."
if ( $RestartAfterUpgrade )
{
LogMsg "Now restarting VMs..."
$restartStatus = RestartAllDeployments -allVMData $allVMData
if ( $restartStatus -eq "True")
{
$upgradedlisVersion = RunLinuxCmd -ip $vmData.PublicIP -port $vmData.SSHPort -username "root" -password $password -command "modinfo hv_vmbus"
LogMsg "Old lis: $currentlisVersion"
LogMsg "New lis: $upgradedlisVersion"
Add-Content -Value "Old lis: $currentlisVersion" -Path .\report\AdditionalInfo.html -Force
Add-Content -Value "New lis: $upgradedlisVersion" -Path .\report\AdditionalInfo.html -Force
return $true
}
else
{
return $false
}
}
return $true
}
else
{
LogErr "lis upgrade failed in $($jobCount-$lisSuccess) VMs."
return $false
}
}
}
catch
{
LogErr "Exception in InstallcustomLIS."
return $false
}
}

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

@ -846,15 +846,16 @@ Function CreateAllDeployments($setupType, $xmlConfig, $Distro, [string]$region =
foreach ($img in $osImage)
{
$curtime = Get-Date
$randomNumber = Get-Random -Maximum 999 -Minimum 111 -SetSeed (Get-Random -Maximum 999 -Minimum 111 )
$isServiceDeployed = "False"
$retryDeployment = 0
if ( $HS.Tag -ne $null )
{
$serviceName = "ICA-HS-" + $HS.Tag + "-" + $Distro + "-" + $curtime.Month + "-" + $curtime.Day + "-" + $curtime.Hour + "-" + $curtime.Minute + "-" + $curtime.Second
$serviceName = "ICA-HS-" + $HS.Tag + "-" + $Distro + "-" + $curtime.Month + "-" + $curtime.Day + "-" + $curtime.Hour + "-" + $curtime.Minute + "-" + $randomNumber
}
else
{
$serviceName = "ICA-HS-" + $setupType + "-" + $Distro + "-" + $curtime.Month + "-" + $curtime.Day + "-" + $curtime.Hour + "-" + $curtime.Minute + "-" + $curtime.Second
$serviceName = "ICA-HS-" + $setupType + "-" + $Distro + "-" + $curtime.Month + "-" + $curtime.Day + "-" + $curtime.Hour + "-" + $curtime.Minute + "-" + $randomNumber
}
if($isMultiple -eq "True")
{
@ -955,6 +956,11 @@ Function VerifyAllDeployments($servicesToVerify, [Switch]$GetVMProvisionTime)
{
LogMsg ""
LogMsg "$serviceName is Ready.."
if ( $currentTestData.InitialWaitSeconds )
{
LogMsg "Waiting for initial wait time. $($currentTestData.InitialWaitSeconds) seconds."
WaitFor -seconds $currentTestData.InitialWaitSeconds
}
Write-Host ""
$retValue = "True"
}
@ -1386,6 +1392,26 @@ Function DeployVMs ($xmlConfig, $setupType, $Distro, $getLogsIfFailed = $false,
}
$retValue = DeployManagementServices -xmlConfig $xmlConfig -setupType $setupType -Distro $Distro -getLogsIfFailed $getLogsIfFailed -GetDeploymentStatistics $GetDeploymentStatistics -region $region -storageAccount $storageAccount -timeOutSeconds $timeOutSeconds
}
if ( $retValue -and $customKernel)
{
LogMsg "Custom kernel: $customKernel will be installed on all machines..."
$kernelUpgradeStatus = InstallCustomKernel -customKernel $customKernel -allVMData $allVMData -RestartAfterUpgrade
if ( !$kernelUpgradeStatus )
{
LogErr "Custom Kernel: $customKernel installation FAIL. Aborting tests."
$retValue = ""
}
}
if ( $retValue -and $customLIS)
{
LogMsg "Custom LIS: $customLIS will be installed on all machines..."
$LISUpgradeStatus = InstallCustomLIS -customLIS $customLIS -allVMData $allVMData -customLISBranch $customLISBranch -RestartAfterUpgrade
if ( !$LISUpgradeStatus )
{
LogErr "Custom Kernel: $customKernel installation FAIL. Aborting tests."
$retValue = ""
}
}
return $retValue
}
@ -1934,8 +1960,29 @@ Function RemoteCopy($uploadTo, $downloadFrom, $downloadTo, $port, $files, $usern
else
{
LogMsg "Uploading $tarFileName to $username : $uploadTo, port $port using Password authentication"
echo y | .\tools\pscp -pw $password -q -P $port $tarFileName $username@${uploadTo}:
$returnCode = $LASTEXITCODE
$curDir = $PWD
$uploadStatusRandomFile = "UploadStatusFile" + (Get-Random -Maximum 9999 -Minimum 1111) + ".txt"
$uploadStartTime = Get-Date
$uploadJob = Start-Job -ScriptBlock { cd $args[0]; Write-Host $args; Set-Content -Value "1" -Path $args[6]; $username = $args[4]; $uploadTo = $args[5]; echo y | .\tools\pscp -v -pw $args[1] -q -P $args[2] $args[3] $username@${uploadTo}: ; Set-Content -Value $LASTEXITCODE -Path $args[6];} -ArgumentList $curDir,$password,$port,$tarFileName,$username,${uploadTo},$uploadStatusRandomFile
sleep -Milliseconds 100
$uploadJobStatus = Get-Job -Id $uploadJob.Id
$uploadTimout = $false
while (( $uploadJobStatus.State -eq "Running" ) -and ( !$uploadTimout ))
{
Write-Host "." -NoNewline
$now = Get-Date
if ( ($now - $uploadStartTime).TotalSeconds -gt 600 )
{
$uploadTimout = $true
LogErr "Upload Timout!"
}
sleep -Seconds 1
$uploadJobStatus = Get-Job -Id $uploadJob.Id
}
Write-Host ""
$returnCode = Get-Content -Path $uploadStatusRandomFile
Remove-Item -Force $uploadStatusRandomFile | Out-Null
Remove-Job -Id $uploadJob.Id -Force | Out-Null
}
if(($returnCode -ne 0) -and ($retry -ne $maxRetry))
{
@ -1998,8 +2045,29 @@ Function RemoteCopy($uploadTo, $downloadFrom, $downloadTo, $port, $files, $usern
else
{
LogMsg "Uploading $testFile to $username : $uploadTo, port $port using Password authentication"
echo y | .\tools\pscp -pw $password -q -P $port $testFile $username@${uploadTo}:
$returnCode = $LASTEXITCODE
$curDir = $PWD
$uploadStatusRandomFile = "UploadStatusFile" + (Get-Random -Maximum 9999 -Minimum 1111) + ".txt"
$uploadStartTime = Get-Date
$uploadJob = Start-Job -ScriptBlock { cd $args[0]; Write-Host $args; Set-Content -Value "1" -Path $args[6]; $username = $args[4]; $uploadTo = $args[5]; echo y | .\tools\pscp -v -pw $args[1] -q -P $args[2] $args[3] $username@${uploadTo}: ; Set-Content -Value $LASTEXITCODE -Path $args[6];} -ArgumentList $curDir,$password,$port,$testFile,$username,${uploadTo},$uploadStatusRandomFile
sleep -Milliseconds 100
$uploadJobStatus = Get-Job -Id $uploadJob.Id
$uploadTimout = $false
while (( $uploadJobStatus.State -eq "Running" ) -and ( !$uploadTimout ))
{
Write-Host "." -NoNewline
$now = Get-Date
if ( ($now - $uploadStartTime).TotalSeconds -gt 600 )
{
$uploadTimout = $true
LogErr "Upload Timout!"
}
sleep -Seconds 1
$uploadJobStatus = Get-Job -Id $uploadJob.Id
}
Write-Host ""
$returnCode = Get-Content -Path $uploadStatusRandomFile
Remove-Item -Force $uploadStatusRandomFile | Out-Null
Remove-Job -Id $uploadJob.Id -Force | Out-Null
}
if(($returnCode -ne 0) -and ($retry -ne $maxRetry))
{
@ -2046,14 +2114,56 @@ Function RemoteCopy($uploadTo, $downloadFrom, $downloadTo, $port, $files, $usern
if($usePrivateKey)
{
LogMsg "Downloading $testFile from $username : $downloadFrom,port $port to $downloadTo using PrivateKey authentication"
echo y | .\tools\pscp -i .\ssh\$sshKey -q -P $port $username@${downloadFrom}:$testFile $downloadTo
$returnCode = $LASTEXITCODE
$curDir = $PWD
$downloadStatusRandomFile = "DownloadStatusFile" + (Get-Random -Maximum 9999 -Minimum 1111) + ".txt"
$downloadStartTime = Get-Date
$downloadJob = Start-Job -ScriptBlock { $curDir=$args[0];$sshKey=$args[1];$port=$args[2];$testFile=$args[3];$username=$args[4];${downloadFrom}=$args[5];$downloadTo=$args[6];$downloadStatusRandomFile=$args[7]; cd $curDir; Set-Content -Value "1" -Path $args[6]; echo y | .\tools\pscp -i .\ssh\$sshKey -q -P $port $username@${downloadFrom}:$testFile $downloadTo; Set-Content -Value $LASTEXITCODE -Path $downloadStatusRandomFile;} -ArgumentList $curDir,$sshKey,$port,$testFile,$username,${downloadFrom},$downloadTo,$downloadStatusRandomFile
sleep -Milliseconds 100
$downloadJobStatus = Get-Job -Id $downloadJob.Id
$downloadTimout = $false
while (( $downloadJobStatus.State -eq "Running" ) -and ( !$downloadTimout ))
{
Write-Host "." -NoNewline
$now = Get-Date
if ( ($now - $downloadStartTime).TotalSeconds -gt 600 )
{
$downloadTimout = $true
LogErr "Download Timout!"
}
sleep -Seconds 1
$downloadJobStatus = Get-Job -Id $downloadJob.Id
}
Write-Host ""
$returnCode = Get-Content -Path $downloadStatusRandomFile
Remove-Item -Force $downloadStatusRandomFile | Out-Null
Remove-Job -Id $downloadJob.Id -Force | Out-Null
}
else
{
LogMsg "Downloading $testFile from $username : $downloadFrom,port $port to $downloadTo using Password authentication"
echo y | .\tools\pscp -pw $password -q -P $port $username@${downloadFrom}:$testFile $downloadTo
$returnCode = $LASTEXITCODE
$curDir = $PWD
$downloadStatusRandomFile = "DownloadStatusFile" + (Get-Random -Maximum 9999 -Minimum 1111) + ".txt"
$downloadStartTime = Get-Date
$downloadJob = Start-Job -ScriptBlock { $curDir=$args[0];$password=$args[1];$port=$args[2];$testFile=$args[3];$username=$args[4];${downloadFrom}=$args[5];$downloadTo=$args[6];$downloadStatusRandomFile=$args[7]; cd $curDir; Set-Content -Value "1" -Path $args[6]; ; echo y | .\tools\pscp -pw $password -q -P $port $username@${downloadFrom}:$testFile $downloadTo ; Set-Content -Value $LASTEXITCODE -Path $downloadStatusRandomFile;} -ArgumentList $curDir,$password,$port,$testFile,$username,${downloadFrom},$downloadTo,$downloadStatusRandomFile
sleep -Milliseconds 100
$downloadJobStatus = Get-Job -Id $downloadJob.Id
$downloadTimout = $false
while (( $downloadJobStatus.State -eq "Running" ) -and ( !$downloadTimout ))
{
Write-Host "." -NoNewline
$now = Get-Date
if ( ($now - $downloadStartTime).TotalSeconds -gt 600 )
{
$downloadTimout = $true
LogErr "Download Timout!"
}
sleep -Seconds 1
$downloadJobStatus = Get-Job -Id $downloadJob.Id
}
Write-Host ""
$returnCode = Get-Content -Path $downloadStatusRandomFile
Remove-Item -Force $downloadStatusRandomFile | Out-Null
Remove-Job -Id $downloadJob.Id -Force | Out-Null
}
if(($returnCode -ne 0) -and ($retry -ne $maxRetry))
{
@ -2088,9 +2198,20 @@ Function RemoteCopy($uploadTo, $downloadFrom, $downloadTo, $port, $files, $usern
Function WrapperCommandsToFile([string] $username,[string] $password,[string] $ip,[string] $command, [int] $port)
{
$command | out-file -encoding ASCII -filepath runtest.sh
RemoteCopy -upload -uploadTo $ip -username $username -port $port -password $password -files '.\runtest.sh'
del runtest.sh
if ( ( $lastLinuxCmd -eq $command) -and ($lastIP -eq $ip) -and ($lastPort -eq $port) -and ($lastUser -eq $username) )
{
#Skip upload if current command is same as last command.
}
else
{
Set-Variable -Name lastLinuxCmd -Value $command -Scope Global
Set-Variable -Name lastIP -Value $ip -Scope Global
Set-Variable -Name lastPort -Value $port -Scope Global
Set-Variable -Name lastUser -Value $username -Scope Global
$command | out-file -encoding ASCII -filepath "$LogDir\runtest.sh"
RemoteCopy -upload -uploadTo $ip -username $username -port $port -password $password -files ".\$LogDir\runtest.sh"
del "$LogDir\runtest.sh"
}
}
Function RunLinuxCmd([string] $username,[string] $password,[string] $ip,[string] $command, [int] $port, [switch]$runAsSudo, [Boolean]$WriteHostOnly, [Boolean]$NoLogsPlease, [switch]$ignoreLinuxExitCode, [int]$runMaxAllowedTime = 300, [switch]$RunInBackGround)
@ -2392,7 +2513,7 @@ Function RunLinuxCmd([string] $username,[string] $password,[string] $ip,[string]
if($timeOut)
{
$retValue = ""
Throw "Tmeout while executing command : $command"
LogErr "Tmeout while executing command : $command"
}
LogErr "Linux machine returned exit code : $($LinuxExitCode.Split("-")[4])"
if ($attemptswt -eq $maxRetryCount -and $attemptswot -eq $maxRetryCount)
@ -2403,7 +2524,7 @@ Function RunLinuxCmd([string] $username,[string] $password,[string] $ip,[string]
{
if ($notExceededTimeLimit)
{
LogMsg "Failed to execute : $command. Retrying..."
LogErr "Failed to execute : $command. Retrying..."
}
}
}
@ -2437,6 +2558,7 @@ Function DoTestCleanUp($result, $testName, $DeployedServices, $ResourceGroups, [
#Removal of background
LogMsg "Removing Background Job ID : $taskID..."
Remove-Job -Id $taskID -Force
Remove-Item $LogDir\CurrentTestBackgroundJobs.txt -ErrorAction SilentlyContinue
}
$user=$xmlConfig.config.Azure.Deployment.Data.UserName
if ( !$SkipVerifyKernelLogs )
@ -2486,16 +2608,24 @@ Function DoTestCleanUp($result, $testName, $DeployedServices, $ResourceGroups, [
$isVMLogsCollected = $true }
else
{
LogMsg "Cleaning up deployed test virtual machines."
$isClened = DeleteService -serviceName $hsDetails.ServiceName
if ($isClened -contains "False")
if ( $keepReproInact )
{
LogMsg "Skipping cleanup due to 'keepReproInact' flag is set."
}
else
{
LogMsg "CleanUP unsuccessful for $($hsDetails.ServiceName).. Please delete the services manually."
}
else
{
LogMsg "CleanUP Successful for $($hsDetails.ServiceName).."
LogMsg "Collecting VM logs of PASS test case.."
$out = GetVMLogs -allVMData $allVMData
LogMsg "Cleaning up deployed test virtual machines."
$isClened = DeleteService -serviceName $hsDetails.ServiceName
if ($isClened -contains "False")
{
LogMsg "CleanUP unsuccessful for $($hsDetails.ServiceName).. Please delete the services manually."
}
else
{
LogMsg "CleanUP Successful for $($hsDetails.ServiceName).."
}
}
}
}
@ -2555,28 +2685,38 @@ Function DoTestCleanUp($result, $testName, $DeployedServices, $ResourceGroups, [
else
{
$RGdetails = Get-AzureRmResourceGroup -Name $group
if ( ( $RGdetails.Tags[0].Name -eq $preserveKeyword ) -and ( $RGdetails.Tags[0].Value -eq "yes" ))
{
LogMsg "Skipping Cleanup of preserved resource group."
LogMsg "Collecting VM logs.."
if ( !$isVMLogsCollected)
{
GetVMLogs -allVMData $allVMData
}
$isVMLogsCollected = $true
}
if ( $RGdetails.Tags )
{
if ( ( $RGdetails.Tags[0].Name -eq $preserveKeyword ) -and ( $RGdetails.Tags[0].Value -eq "yes" ))
{
LogMsg "Skipping Cleanup of preserved resource group."
LogMsg "Collecting VM logs.."
if ( !$isVMLogsCollected)
{
GetVMLogs -allVMData $allVMData
}
$isVMLogsCollected = $true
}
}
else
{
LogMsg "Cleaning up deployed test virtual machines."
$isClened = DeleteResourceGroup -RGName $group
if (!$isClened)
{
LogMsg "CleanUP unsuccessful for $group.. Please delete the services manually."
}
else
{
LogMsg "CleanUP Successful for $group.."
}
if ( $keepReproInact )
{
LogMsg "Skipping cleanup due to 'keepReproInact' flag is set."
}
else
{
LogMsg "Cleaning up deployed test virtual machines."
$isClened = DeleteResourceGroup -RGName $group
if (!$isClened)
{
LogMsg "CleanUP unsuccessful for $group.. Please delete the services manually."
}
else
{
LogMsg "CleanUP Successful for $group.."
}
}
}
}
}
@ -2584,7 +2724,10 @@ Function DoTestCleanUp($result, $testName, $DeployedServices, $ResourceGroups, [
{
LogMsg "Preserving the Resource Group(s) $group"
LogMsg "Setting tags : preserve = yes; testName = $testName"
$out = Set-AzureRmResourceGroup -Name $group -Tag @{Name =$preserveKeyword; Value = "yes"},@{Name ="testName"; Value = "$testName"}
$hash = @{}
$hash.Add($preserveKeyword,"yes")
$hash.Add("testName","$testName")
$out = Set-AzureRmResourceGroup -Name $group -Tag $hash
LogMsg "Collecting VM logs.."
if ( !$isVMLogsCollected)
{
@ -4346,11 +4489,15 @@ Function GetAllDeployementData($DeployedServices, $ResourceGroups)
$objNode = New-Object -TypeName PSObject
Add-Member -InputObject $objNode -MemberType NoteProperty -Name ServiceName -Value $ServiceName -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name ResourceGroupName -Value $ResourceGroupName -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name Location -Value $ResourceGroupName -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name RoleName -Value $RoleName -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name PublicIP -Value $PublicIP -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name PublicIPv6 -Value $PublicIP -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name InternalIP -Value $InternalIP -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name URL -Value $URL -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name URLv6 -Value $URL -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name Status -Value $Status -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name InstanceSize -Value $InstanceSize -Force
return $objNode
}
@ -4359,22 +4506,29 @@ Function GetAllDeployementData($DeployedServices, $ResourceGroups)
foreach ($ResourceGroup in $ResourceGroups.Split("^"))
{
LogMsg "Collecting $ResourceGroup data.."
$allRGResources = (Get-AzureRmResource | where { $_.ResourceGroupName -eq $ResourceGroup } | Select ResourceType).ResourceType
LogMsg " Microsoft.Network/publicIPAddresses data collection in progress.."
$RGIPdata = Get-AzureRmResource -ResourceGroupName $ResourceGroup -ResourceType "Microsoft.Network/publicIPAddresses" -Verbose -ExpandProperties
LogMsg " Microsoft.Compute/virtualMachines data collection in progress.."
$RGVMs = Get-AzureRmResource -ResourceGroupName $ResourceGroup -ResourceType "Microsoft.Compute/virtualMachines" -Verbose -ExpandProperties
LogMsg " Microsoft.Network/networkInterfaces data collection in progress.."
$NICdata = Get-AzureRmResource -ResourceGroupName $ResourceGroup -ResourceType "Microsoft.Network/networkInterfaces" -Verbose -ExpandProperties
$currentRGLocation = (Get-AzureRmResourceGroup -ResourceGroupName $ResourceGroup).Location
$numberOfVMs = 0
foreach ($testVM in $RGVMs)
{
$numberOfVMs += 1
}
if ( $numberOfVMs -gt 1 )
if ( ($numberOfVMs -gt 1) -or (($RGIPData | where { $_.Properties.publicIPAddressVersion -eq "IPv6" }).Properties.ipAddress) -or ($allRGResources -contains "Microsoft.Network/loadBalancers"))
{
LogMsg " Microsoft.Network/loadBalancers data collection in progress.."
$LBdata = Get-AzureRmResource -ResourceGroupName $ResourceGroup -ResourceType "Microsoft.Network/loadBalancers" -ExpandProperties -Verbose
}
foreach ($testVM in $RGVMs)
{
$QuickVMNode = CreateQuickVMNode
if ( $numberOfVMs -gt 1 )
if ( ( $numberOfVMs -gt 1 ) -or (($RGIPData | where { $_.Properties.publicIPAddressVersion -eq "IPv6" }).Properties.ipAddress) -or ($allRGResources -contains "Microsoft.Network/loadBalancers"))
{
$InboundNatRules = $LBdata.Properties.InboundNatRules
foreach ($endPoint in $InboundNatRules)
@ -4406,10 +4560,11 @@ Function GetAllDeployementData($DeployedServices, $ResourceGroups)
}
else
{
$AllEndpoints = $testVM.Properties.NetworkProfile.InputEndpoints
foreach ($endPoint in $AllEndpoints)
LogMsg " Microsoft.Network/networkSecurityGroups data collection in progress.."
$SGData = Get-AzureRmResource -ResourceGroupName $ResourceGroup -ResourceName "SG-$ResourceGroup" -ResourceType "Microsoft.Network/networkSecurityGroups" -ExpandProperties
foreach ($securityRule in $SGData.Properties.securityRules)
{
Add-Member -InputObject $QuickVMNode -MemberType NoteProperty -Name "$($endPoint.EndpointName)Port" -Value $endPoint.PublicPort -Force
Add-Member -InputObject $QuickVMNode -MemberType NoteProperty -Name "$($securityRule.name)Port" -Value $securityRule.properties.destinationPortRange -Force
}
if($AllEndpoints.Length -eq 0)
{
@ -4428,10 +4583,15 @@ Function GetAllDeployementData($DeployedServices, $ResourceGroups)
}
}
$QuickVMNode.ResourceGroupName = $ResourceGroup
$QuickVMNode.PublicIP = $RGIPdata.Properties.IpAddress
$QuickVMNode.URL = $RGIPdata.Properties.DnsSettings.Fqdn
$QuickVMNode.PublicIP = ($RGIPData | where { $_.Properties.publicIPAddressVersion -eq "IPv4" }).Properties.ipAddress
$QuickVMNode.PublicIPv6 = ($RGIPData | where { $_.Properties.publicIPAddressVersion -eq "IPv6" }).Properties.ipAddress
$QuickVMNode.URL = ($RGIPData | where { $_.Properties.publicIPAddressVersion -eq "IPv4" }).Properties.dnsSettings.fqdn
$QuickVMNode.URLv6 = ($RGIPData | where { $_.Properties.publicIPAddressVersion -eq "IPv6" }).Properties.dnsSettings.fqdn
$QuickVMNode.RoleName = $testVM.ResourceName
$QuickVMNode.Status = $testVM.Properties.ProvisioningState
$QuickVMNode.InstanceSize = $testVM.Properties.hardwareProfile.vmSize
$QuickVMNode.Location = $currentRGLocation
$allDeployedVMs += $QuickVMNode
}
LogMsg "Collected $ResourceGroup data!"
@ -4453,6 +4613,7 @@ Function GetAllDeployementData($DeployedServices, $ResourceGroups)
$QuickVMNode.RoleName = $testVM.InstanceName
$QuickVMNode.PublicIP = $AllEndpoints[0].Vip
$QuickVMNode.InternalIP = $testVM.IpAddress
$QuickVMNode.InstanceSize = $testVM.InstanceSize
foreach ($endpoint in $AllEndpoints)
{
Add-Member -InputObject $QuickVMNode -MemberType NoteProperty -Name "$($endpoint.Name)Port" -Value $endpoint.Port -Force

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

@ -2,14 +2,14 @@
<Extensions>
<Extension>
<Name>CustomScriptTouchCommand</Name>
<OfficialName>CustomScriptForLinux</OfficialName>
<Publisher>Microsoft.OSTCExtensions</Publisher>
<OfficialName>CustomScript</OfficialName>
<Publisher>Microsoft.Azure.Extensions</Publisher>
<PublicConfiguration>
<timestamp>EXECUTE-PS-(Get-Date).ticks</timestamp>
<commandToExecute>touch /var/log/CustomExtensionSuccessful</commandToExecute>
</PublicConfiguration>
<Version>1.*</Version>
<LatestVersion>1.4</LatestVersion>
<Version>2.*</Version>
<LatestVersion>2.0</LatestVersion>
</Extension>
<Extension>
<Name>OsPatching</Name>

9
XML/NttcpTestPlan.csv Normal file
Просмотреть файл

@ -0,0 +1,9 @@
S.No.,Region,VMSize,StorageAccount,ARMStorageAccount
1,Japan East,A11,konkacijapaneast1,konkacijapaneastv2
2,East Asia,Standard_D14,konkacieastasia,konkacieastasiav2
3,Australia East,Standard_D5_v2,konkaciaustraliaeast1,konkaciaustraliaeastv2
4,West Europe,Standard_D14_v2,konkaciwesteurope,konkaciwesteuropev2
5,Central US,Standard_D15_v2,konkacicentralus,konkacicentralusv2
6,East US 2,Standard_G4,konkacieastus2,konkacieastus2v2
7,West US,Standard_G5,konkaciwestus1,konkaciwestusv2
8,South India,Standard_F16,konkacisouthindia1,konkacisouthindiav2
1 S.No. Region VMSize StorageAccount ARMStorageAccount
2 1 Japan East A11 konkacijapaneast1 konkacijapaneastv2
3 2 East Asia Standard_D14 konkacieastasia konkacieastasiav2
4 3 Australia East Standard_D5_v2 konkaciaustraliaeast1 konkaciaustraliaeastv2
5 4 West Europe Standard_D14_v2 konkaciwesteurope konkaciwesteuropev2
6 5 Central US Standard_D15_v2 konkacicentralus konkacicentralusv2
7 6 East US 2 Standard_G4 konkacieastus2 konkacieastus2v2
8 7 West US Standard_G5 konkaciwestus1 konkaciwestusv2
9 8 South India Standard_F16 konkacisouthindia1 konkacisouthindiav2

22
XML/NttcpTestPlanFull.csv Normal file
Просмотреть файл

@ -0,0 +1,22 @@
S.No.,Region,VMSize,StorageAccount (Classic),StorageAccount (ARM)
1,East US 2,Standard_GS4,konkacieastus2,konkacieastus2v2
2,West US,Standard_G5,konkaciwestus1,konkaciwestusv2
3,West Europe,Standard_DS14,konkaciwesteurope,konkaciwesteuropev2
4,Southeast Asia,Standard_D13,konkacisoutheastasia,
5,Australia East,Standard_D5_v2,konkaciaustraliaeast1,konkaciaustraliaeastv2
6,Canada Central,Basic_A4,konkacicanadacentral1,konkacicanadacentral
7,Canada East,Standard_D13_v2,konkacicanadaeast1,konkacicanadaeast
8,Central US,Standard_D4,konkacicentralus,konkacicentralusv2
9,West Central US,Standard_F8,konkaciwestcentralus1,konkaciwestcentralus
10,South India,Standard_D14_v2,konkacisouthindia1,konkacisouthindia
11,East Asia,Standard_D14,konkacieastasia,konkacieastasiav2
12,Brazil South,Standard_D4_v2,konkacibrazilsouth1,konkacibrazilsouth
13,Australia Southeast,A7,knkaciaustraliasouthest,konkaciaustraliasouthest
14,South India,Standard_F16,konkacisouthindia1,
15,East US,Standard_DS13,konkacieastus,konkacieastusv2
16,North Central US,A9,konkacinorthcentralus1,konkacinorthcentralus
17,South Central US,A8,konkacisouthcentralus,
18,UK WEST,Standard_DS4_v2,konkaciukwest1,konkaciukwest
19,North Europe,A10,konkacinortheurope,konkacineuropev2
20,West Europe,Standard_G3,konkaciwesteurope,konkaciwesteuropev2
21,Japan East,A11,konkacijapaneast1,konkacijapaneast
1 S.No. Region VMSize StorageAccount (Classic) StorageAccount (ARM)
2 1 East US 2 Standard_GS4 konkacieastus2 konkacieastus2v2
3 2 West US Standard_G5 konkaciwestus1 konkaciwestusv2
4 3 West Europe Standard_DS14 konkaciwesteurope konkaciwesteuropev2
5 4 Southeast Asia Standard_D13 konkacisoutheastasia
6 5 Australia East Standard_D5_v2 konkaciaustraliaeast1 konkaciaustraliaeastv2
7 6 Canada Central Basic_A4 konkacicanadacentral1 konkacicanadacentral
8 7 Canada East Standard_D13_v2 konkacicanadaeast1 konkacicanadaeast
9 8 Central US Standard_D4 konkacicentralus konkacicentralusv2
10 9 West Central US Standard_F8 konkaciwestcentralus1 konkaciwestcentralus
11 10 South India Standard_D14_v2 konkacisouthindia1 konkacisouthindia
12 11 East Asia Standard_D14 konkacieastasia konkacieastasiav2
13 12 Brazil South Standard_D4_v2 konkacibrazilsouth1 konkacibrazilsouth
14 13 Australia Southeast A7 knkaciaustraliasouthest konkaciaustraliasouthest
15 14 South India Standard_F16 konkacisouthindia1
16 15 East US Standard_DS13 konkacieastus konkacieastusv2
17 16 North Central US A9 konkacinorthcentralus1 konkacinorthcentralus
18 17 South Central US A8 konkacisouthcentralus
19 18 UK WEST Standard_DS4_v2 konkaciukwest1 konkaciukwest
20 19 North Europe A10 konkacinortheurope konkacineuropev2
21 20 West Europe Standard_G3 konkaciwesteurope konkaciwesteuropev2
22 21 Japan East A11 konkacijapaneast1 konkacijapaneast

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

@ -0,0 +1,104 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<config>
<global>
<logfileRootDir>TestResults</logfileRootDir>
<defaultSnapshot>ICABase</defaultSnapshot>
<email>
<recipients>
<to>myself@mycompany.com</to>
</recipients>
<sender>myself@mycompany.com</sender>
<subject>LIS Performance Test Results</subject>
<smtpServer>mysmtphost.mycompany.com</smtpServer>
</email>
<!-- Optional testParams go here -->
<testParams>
</testParams>
</global>
<testSuites>
<suite>
<suiteName>MangoDbBenchmark</suiteName>
<suiteTests>
<suiteTest>Perf_MD_1Mil-100C</suiteTest>
</suiteTests>
</suite>
</testSuites>
<testCases>
<test>
<testName>Perf_MD_1Mil-100C</testName>
<testScript>performance_md.sh</testScript>
<files>remote-scripts/ica/performance_md.sh</files>
<testParams>
<param>MONGODB_VERSION=2.4.0</param>
<param>MD_SERVER=192.168.1.1</param>
<mdparam>recordcount=20000000</mdparam>
<mdparam>operationcount=20000000</mdparam>
<mdparam>readallfields=true</mdparam>
<mdparam>workload=com.yahoo.ycsb.workloads.CoreWorkload</mdparam>
<mdparam>operationcount=20000000</mdparam>
<mdparam>readproportion=0.5</mdparam>
<mdparam>updateproportion=0.5</mdparam>
<mdparam>requestdistribution=zipfian</mdparam>
<mdparam>threadcount=8</mdparam>
<mdparam>maxexecutiontime=900</mdparam>
</testParams>
<uploadFiles>
<file>mdtest.log</file>
</uploadFiles>
<timeout>1200</timeout>
<OnError>Continue</OnError>
</test>
</testCases>
<VMs>
<vm>
<role>SUT1</role>
<hvServer>LIS-HOST01</hvServer>
<vmName>VM-MD-Server</vmName>
<os>Linux</os>
<ipv4></ipv4>
<sshKey>id_rsa.ppk</sshKey>
<suite>MangoDbBenchmark</suite>
<preStartConfig>
<file>.\setupscripts\Config-VM.ps1</file>
<file>.\setupscripts\Insert-ISO.ps1</file>
</preStartConfig>
</vm>
<vm>
<role>SUT2</role>
<hvServer>LIS-HOST01</hvServer>
<vmName>VM-MD-Client</vmName>
<os>Linux</os>
<ipv4></ipv4>
<sshKey>id_rsa.ppk</sshKey>
<suite>MangoDbBenchmark</suite>
<preStartConfig>
<file>.\setupscripts\Config-VM.ps1</file>
<file>.\setupscripts\Insert-ISO.ps1</file>
</preStartConfig>
</vm>
</VMs>
</config>

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

@ -0,0 +1,210 @@
# This script deploys the VMs for the LVM functional test and trigger the test.
# 1. dos2unix, tar, git, make must be installed in the test image
#
# Author: Sivakanth Rebba
# Email : v-sirebb@microsoft.com
#
###################################################################################
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force -Verbose:$false
$result = ""
$testResult = ""
$resultArr = @()
$SAName = $currentTestData.remoteSA
$SAPrimaryKey = (Get-AzureStorageKey -StorageAccountName $SAName).Primary
$SAContainer = $currentTestData.remoteSAContainer
$remoteDebPath = $currentTestData.remoteDEBPath
$imageType = $currentTestData.imageType
$BaseOsImageName = GetOSImageFromDistro -Distro $Distro -xmlConfig $xmlConfig
LogMsg "Remote Storage Account to copy deb package : $SAName"
Logmsg "Image type : $imageType"
if($imageType -imatch "Standard")
{
LogMsg "BaseOsImageName : $BaseOsImageName"
LogMsg "Collecting latest $imageType ubuntu image from Azure gallery.."
$latestLinuxImage = (Get-AzureVMImage | where {$_.ImageName -imatch "Ubuntu-16_04-LTS-amd64-server" } | sort PublishedDate -Descending)[0].ImageName
LogMsg "Latest $imageType Image from Azure gallery : $latestLinuxImage"
$latestOsImage = SetOSImageToDistro -Distro $Distro -xmlConfig $xmlConfig -ImageName $latestLinuxImage
LogMsg "Is $imageType latestOsImage SET : $latestOsImage"
}
elseif($imageType -imatch "Daily")
{
LogMsg "BaseOsImageName : $BaseOsImageName"
LogMsg "Collecting latest ubuntu $imageType image from Azure gallery"
$latestLinuxImage = (Get-AzureVMImage | where {$_.ImageName -imatch "Ubuntu_DAILY_BUILD-xenial-16_04-" } | sort PublishedDate -Descending)[0].ImageName
LogMsg "Latest $imageType Image from Azure gallery : $latestLinuxImage"
$latestOsImage = SetOSImageToDistro -Distro $Distro -xmlConfig $xmlConfig -ImageName $latestLinuxImage
LogMsg "Is $imageType latestOsImage SET : $latestOsImage"
}
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$allVMData = GetAllDeployementData -DeployedServices $isDeployed
Set-Variable -Name AllVMData -Value $allVMData
[string] $ServiceName = $allVMData.ServiceName
$hs1VIP = $allVMData.PublicIP
$hs1ServiceUrl = $allVMData.URL
$hs1vm1IP = $allVMData.InternalIP
$hs1vm1Hostname = $allVMData.RoleName
$hs1vm1sshport = $allVMData.SSHPort
$DetectedDistro = DetectLinuxDistro -VIP $hs1VIP -SSHport $hs1vm1sshport -testVMUser $user -testVMPassword $password
if ( $DetectedDistro -imatch "UBUNTU" )
{
LogMsg "Installing basic required packages wget tar git dos2unix mdadm"
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "apt-get install --force-yes -y wget tar git dos2unix" -runAsSudo 2>&1
}
elseif(($DetectedDistro -imatch "SLES") -or ($DetectedDistro -imatch "SUSE"))
{
LogMsg "Installing basic required packages wget tar git dos2unix"
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "zypper --non-interactive install wget tar git dos2unix" -runAsSudo 2>&1
}
elseif(($DetectedDistro -imatch "CENTOS") -or ($DetectedDistro -imatch "REDHAT") -or ($DetectedDistro -imatch "ORACLE"))
{
LogMsg "Installing basic required packages wget tar git dos2unix"
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "yum install --nogpgcheck -y wget tar git dos2unix" -runAsSudo 2>&1
}
else
{
LogMsg "Detect distro is unknown.."
}
$out = RemoteCopy -uploadTo $hs1VIP -port $hs1vm1sshport -files $currentTestData.files -username $user -password $password -upload
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "dos2unix *.sh" -runAsSudo 2>&1
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "chmod +x *.sh" -runAsSudo 2>&1
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "mkdir -p code" -runAsSudo
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "mv *.sh code/" -runAsSudo
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "chmod +x code/*.sh" -runAsSudo
LogMsg "Linux Next build deb package generate STARTED.."
$KernelVersion = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "uname -r 2>&1" -runAsSudo
LogMsg "Kernel Version : $KernelVersion"
Set-Content -Value "bash /home/$user/code/$($currentTestData.testScript) $user > /home/$user/code/linuxNextBuildTest.txt" -Path "$LogDir\StartTest.sh"
$out = RemoteCopy -uploadTo $hs1VIP -port $hs1vm1sshport -files ".\$LogDir\StartTest.sh" -username $user -password $password -upload
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "mv StartTest.sh /home/$user/code/" -runAsSudo
$testJob = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "bash /home/$user/code/StartTest.sh" -runAsSudo -RunInBackground
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
{
$linuxNextBuildInfo = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "cat /home/$user/code/linuxNextBuildTest.txt | tail -1 " -runAsSudo
$BuildStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "cat /home/$user/code/build.log | tail -1 " -runAsSudo
LogMsg "** Current TEST Staus : $linuxNextBuildInfo"
LogMsg "** Current BUILD Staus : $BuildStatus"
WaitFor -seconds 10
}
$testStartUpStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "cat /home/$user/code/state.txt" -runAsSudo
$linuxNextBuildInfo = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "cat /home/$user/code/linuxNextBuildTest.txt " -runAsSudo
if (($testStartUpStatus -eq "TestCompleted") -or ($linuxNextBuildInfo -imatch "Updating test case state to completed"))
{
LogMsg "Linux Next build deb package generated successfully download deb package from /home/$user/code."
$debPackageStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "ls /home/$user/linux-image*.deb" -runAsSudo
if ($debPackageStatus -imatch "No such file or directory")
{
LogMsg "DEB package not availabe.. "
$testResult = "FAIL"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "LINUX-NEXT DEB CREATION" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
LogMsg "Generation of deb package from Linux Next build is SUCCESS.."
$testResult = "PASS"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "LINUX-NEXT DEB CREATION" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$defualtKernelVersion = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "uname -r" -runAsSudo
LogMsg "DEFAULT KERNEL VERSION : $defualtKernelVersion"
LogMsg "Verification of created linux-next .deb package installtion .."
$debCheckStattus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "dpkg -i linux-image*.deb >> debPackageinstalltion.log" -runAsSudo
$restartvmstatus = RestartAllDeployments -allVMData $allVMData
if ($restartvmstatus -eq "True")
{
$testDuration=0
LogMsg "VMs Restarted Successfully"
$latestKernelVersion = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "uname -r" -runAsSudo
LogMsg "LATEST KERNEL VERSION : $latestKernelVersion"
if(($latestKernelVersion -ne $defualtKernelVersion) -and ($latestKernelVersion -imatch "next"))
{
$testResult = "PASS"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "LINUX-NEXT DEB INSTALLATION : $latestKernelVersion" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
LogMsg "DEFAULT KERNEL VERSION : $defualtKernelVersion"
LogMsg "LATEST KERNEL VERSION : $latestKernelVersion"
$out = RemoteCopy -download -downloadFrom $hs1VIP -files "/home/$user/*.deb, /home/$user/code/*.txt, /home/$user/code/*.log, /home/$user/code/*.sh" -downloadTo $LogDir -port $hs1vm1sshport -username $user -password $password 2>&1 | Out-Null
$debPackageName = (ls $LogDir | where {$_.Name -imatch "linux-image"}).Name
$debPackageFilePath = "$LogDir\$debPackageName"
$debPackageUploadInfo = Set-AzureStorageBlobContent -File $debPackageFilePath -Container $SAContainer -Blob $debPackageName -Context (New-AzureStorageContext -StorageAccountName $SAName -StorageAccountKey $SAPrimaryKey) -Force ; $debPackageuploadStatus = $?
$debPackageUploadInfo1 = Set-AzureStorageBlobContent -File $debPackageFilePath -Container $SAContainer -Blob "linuxnext-latest.deb" -Context (New-AzureStorageContext -StorageAccountName $SAName -StorageAccountKey $SAPrimaryKey) -Force ; $debPackageuploadStatus1 = $?
if (($debPackageuploadStatus -imatch "True") -and ($debPackageuploadStatus1 -imatch "True"))
{
LogMsg "Uploading $debPackageName into $SAContainer container is SUCCESS"
LogMsg "Uploading linuxnext-latest.deb into $SAContainer container is SUCCESS"
LogMsg "*********************************** LINUX-NEXT DEB PACKAGE AVAILABLE LINKS ***********************************`n`n $remoteDebPath/$debPackageName`n`n $remoteDebPath/linuxnext-latest.deb`n`n******************************************************************##************************************##**********************************"
$testResult = "PASS"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "LINUX-NEXT DEB PACK UPLOAD" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
LogMsg "$debPackageName upload is FAILED"
$testResult = "FAIL"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "LINUX-NEXT DEB PACK UPLOAD" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
}
else
{
LogMsg "$debPackageName installation is FAILED"
$testResult = "FAIL"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "LINUX-NEXT DEB CREATION" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
}
else
{
LogMsg "Restart VM is FAILED"
$testResult = "FAIL"
}
}
}
else
{
LogMsg "Linux Next build deb package generation is FAILED.."
$testResult = "FAIL"
}
LogMsg "Test result : $testResult"
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = ""
if (!$testResult)
{
$testResult = "Aborted"
}
$resultArr += $testResult
#$resultSummary += CreateResultSummary -testResult $testResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName # if you want to publish all result then give here all test status possibilites. if you want just failed results, then give here just "FAIL". You can use any combination of PASS FAIL ABORTED and corresponding test results will be published!
}
}
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

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

@ -31,36 +31,13 @@ else
}
foreach($size in $SupportSizes)
{
if($size -match 'DS' -or $size -match 'GS')
if($size -match 'DS' -or $size -match 'GS' -or ($size.Trim().EndsWith("s")) )
{
$XioSizes += $size.Replace('Standard','').Replace('_','')
$XioSizes += $size.Trim()
}
else
{
if($size -eq 'ExtraSmall')
{
$StandardSizes += 'A0'
}
elseif($size -eq 'Small')
{
$StandardSizes += 'A1'
}
elseif($size -eq 'Medium')
{
$StandardSizes += 'A2'
}
elseif($size -eq 'Large')
{
$StandardSizes += 'A3'
}
elseif($size -eq 'ExtraLarge')
{
$StandardSizes += 'A4'
}
else
{
$StandardSizes += $size.Replace('Standard','').Replace('_','')
}
$StandardSizes += $size.Trim()
}
}
if($AccountType -match 'Premium')
@ -74,7 +51,8 @@ else
}
LogMsg "test VM sizes: $VMSizes"
$NumberOfSizes = $VMSizes.Count
$DeploymentCount = $currentTestData.DeploymentCount
$DeploymentCount = $NumberOfSizes*5
#Test Starts Here..
try
{
@ -107,7 +85,8 @@ $DeploymentCount = $currentTestData.DeploymentCount
$DeploymentStatistics = CreateDeploymentResultObject
#Create A VM here and Wait for the VM to come up.
LogMsg "ATTEMPT : $count/$DeploymentCount : Deploying $($VMSizes[$VMSizeNumber]) VM.."
$isDeployed = DeployVMS -setupType $($VMSizes[$VMSizeNumber]) -Distro $Distro -xmlConfig $xmlConfig -GetDeploymentStatistics $True
Set-Variable -Name OverrideVMSize -Value $($VMSizes[$VMSizeNumber]) -Scope Global -Force
$isDeployed = DeployVMS -setupType "SingleVM" -Distro $Distro -xmlConfig $xmlConfig -GetDeploymentStatistics $True
$DeploymentStatistics.VMSize = $($VMSizes[$VMSizeNumber])
$DeploymentStatistics.attempt = $count
if ( !$UseAzureResourceManager )
@ -264,4 +243,4 @@ $result = GetFinalResultHeader -resultarr $resultArr
#DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed
#Return the result and summery to the test suite script..
return $result, $resultSummary
return $result, $resultSummary

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

@ -0,0 +1,345 @@
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 " Location : $($clientVMData.Location)"
LogMsg "SERVER VM details :"
LogMsg " RoleName : $($serverVMData.RoleName)"
LogMsg " Public IP : $($serverVMData.PublicIP)"
LogMsg " SSH Port : $($serverVMData.SSHPort)"
LogMsg " Location : $($serverVMData.Location)"
#
# 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"
#region Check if VMs share same Public IP
Set-Content -Value "#Generated by Azure Automation." -Path $constantsFile
if ( $clientVMData.PublicIP -eq $serverVMData.PublicIP )
{
Add-Content -Value "server=$($serverVMData.InternalIP)" -Path $constantsFile
Add-Content -Value "client=$($clientVMData.InternalIP)" -Path $constantsFile
}
else
{
Add-Content -Value "server=$($serverVMData.PublicIP)" -Path $constantsFile
Add-Content -Value "client=$($clientVMData.PublicIP)" -Path $constantsFile
}
#endregion
foreach ( $param in $currentTestData.TestParameters.param)
{
Add-Content -Value "$param" -Path $constantsFile
if ($param -imatch "bufferLenghs=")
{
$testBuffers= $param.Replace("bufferLenghs=(","").Replace(")","").Split(" ")
}
if ($param -imatch "connections=" )
{
$testConnections = $param.Replace("connections=(","").Replace(")","").Split(" ")
}
if ( $param -imatch "IPversion" )
{
if ( $param -imatch "IPversion=6" )
{
$IPVersion = "IPv6"
Add-Content -Value "serverIpv6=$($serverVMData.PublicIPv6)" -Path $constantsFile
Add-Content -Value "clientIpv6=$($clientVMData.PublicIPv6)" -Path $constantsFile
}
else
{
$IPVersion = "IPv4"
}
}
}
LogMsg "constanst.sh created successfully..."
LogMsg (Get-Content -Path $constantsFile)
#endregion
#region EXECUTE TEST
$myString = @"
cd /root/
./perf_iperf3.sh &> iperf3tcpConsoleLogs.txt
. azuremodules.sh
collect_VM_properties
"@
Set-Content "$LogDir\Startiperf3tcpTest.sh" $myString
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files ".\$constantsFile,.\remote-scripts\azuremodules.sh,.\remote-scripts\perf_iperf3.sh,.\SetupScripts\ConfigureUbuntu1604IPv6.sh,.\$LogDir\Startiperf3tcpTest.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/Startiperf3tcpTest.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 iperf3tcpConsoleLogs.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 "/root/iperf3tcpConsoleLogs.txt"
$iperf3LogDir = "$LogDir\iperf3Data"
New-Item -itemtype directory -path $iperf3LogDir -Force -ErrorAction SilentlyContinue | Out-Null
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $iperf3LogDir -files "iperf-client-tcp*"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $iperf3LogDir -files "iperf-server-tcp*"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "VM_properties.csv"
$testSummary = $null
$iperf3LogDir = "$LogDir\iperf3Data"
#region START tcp ANALYSIS
$clientfolder = $iperf3LogDir
$serverfolder = $iperf3LogDir
#clientData
$files = Get-ChildItem -Path $clientfolder
$FinalClientThroughputArr=@()
$FinalServerThroughputArr=@()
$FinalServerClientTCPResultObjArr = @()
function GetTCPDataObject()
{
$objNode = New-Object -TypeName PSObject
Add-Member -InputObject $objNode -MemberType NoteProperty -Name BufferSize -Value $null -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name Connections -Value $null -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name ClientTxGbps -Value $null -Force
return $objNode
}
foreach ( $Buffer in $testBuffers )
{
foreach ( $connection in $testConnections )
{
$currentResultObj = GetTCPDataObject
$currentConnectionClientTxGbps = 0
$currentConnectionClientTxGbpsArr = @()
$currentConnectionserverTxGbps = 0
$currentConnectionserverTxGbpsArr = @()
foreach ( $file in $files )
{
if ( $file.Name -imatch "iperf-client-tcp-$IPVersion-buffer-$($Buffer)K-conn-$connection-instance-*" )
{
$currentInstanceclientJsonText = $null
$currentInstanceclientJsonObj = $null
$currentInstanceClientPacketLoss = @()
$currentInstanceClientThroughput = $null
$fileName = $file.Name
try
{
$currentInstanceclientJsonText = ([string]( Get-Content "$clientfolder\$fileName")).Replace("-nan","0")
$currentInstanceclientJsonObj = ConvertFrom-Json -InputObject $currentInstanceclientJsonText
}
catch
{
LogErr " $fileName : RETURNED NULL"
}
if ( $currentInstanceclientJsonObj.end.sum_sent )
{
$currentInstanceClientThroughput = $currentInstanceclientJsonObj.end.sum_sent.bits_per_second/1000000000
}
else
{
if ($currentInstanceclientJsonObj.error)
{
LogErr " $fileName : Error Found : $($currentInstanceclientJsonObj.error)"
}
$totalStreams = 0
$totalBitsPerSecond = 0
foreach ( $interval in $currentInstanceclientJsonObj.intervals)
{
$totalBitsPerSecond += $interval.sum.bits_per_second
$totalStreams+=1
}
if ($totalStreams -ge 1)
{
LogMsg " $fileName : Analysed $totalStreams intervals."
$currentInstanceClientThroughput = ($totalBitsPerSecond/$totalStreams)/1000000000
}
else
{
LogErr " $fileName : Error : No connection intervals found."
}
#Write-Host " $($currentJsonObj.error) $currentFileClientThroughput"
}
if($currentInstanceClientThroughput)
{
LogMsg " $fileName : Data collected successfully."
$currentConnectionClientTxGbpsArr += $currentInstanceClientThroughput
}
}
}
$currentConnectionClientTxGbps = [math]::Round((($currentConnectionClientTxGbpsArr | Measure-Object -Average).Average),2)
Write-Host "Client: $Buffer . $connection . $currentConnectionClientTxGbps"
$FinalClientThroughputArr += $currentConnectionClientTxGbps
$FinalClientTCPLossArr += $currentConnectionClientTCPLoss
$currentResultObj.BufferSize = $Buffer
$currentResultObj.Connections = $connection
$currentResultObj.ClientTxGbps = $currentConnectionClientTxGbps
$FinalServerClientTCPResultObjArr += $currentResultObj
Write-Host "-------------------------------"
}
}
#endregion
foreach ( $tcpResultObject in $FinalServerClientTCPResultObjArr )
{
$connResult="ClientTxGbps=$($tcpResultObject.ClientTxGbps)"
$metaData = "Buffer=$($tcpResultObject.BufferSize)K Connections=$($tcpResultObject.Connections)"
$resultSummary += CreateResultSummary -testResult $connResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
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,",""}
$ProtocolType = "TCP"
$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,NumberOfConnections,Throughput_Gbps,Latency_ms) VALUES "
foreach ($tcpResult in $FinalServerClientTCPResultObjArr)
{
$SQLQuery += "('$TestCaseName','$(Get-Date -Format yyyy-MM-dd)','$HostType','$HostBy','$HostOS','$GuestOSType','$GuestDistro','$GuestSize','$KernelVersion','$IPVersion','$ProtocolType','$($tcpResult.Connections)','$($tcpResult.ClientTxGbps)','0'),"
}
$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 = "iperf3tcp 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

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

@ -11,95 +11,180 @@ $testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$hs1VIP = $allVMData[0].PublicIP
$hs1ServiceUrl = $allVMData[0].URL
$hs1vm1IP = $allVMData[0].InternalIP
$hs1vm1Hostname = $allVMData[0].RoleName
$hs1vm1sshport = $allVMData[0].SSHPort
$hs1vm1tcpport = $allVMData[0].TCPtestPort
$hs1vm1udpport = $allVMData[0].UDPtestPort
$hs1vm2IP = $allVMData[1].InternalIP
$hs1vm2Hostname = $allVMData[1].RoleName
$hs1vm2sshport = $allVMData[1].SSHPort
$hs1vm2tcpport = $allVMData[1].TCPtestPort
$hs1vm2udpport = $allVMData[1].UDPtestPort
RemoteCopy -uploadTo $hs1VIP -port $hs1vm1sshport -files $currentTestData.files -username $user -password $password -upload
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "mkdir code" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "mv *.sh code/" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "chmod +x code/*" -runAsSudo
RemoteCopy -uploadTo $hs1VIP -port $hs1vm2sshport -files $currentTestData.files -username $user -password $password -upload
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm2sshport -command "mkdir code" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm2sshport -command "mv *.sh code/" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm2sshport -command "chmod +x code/*" -runAsSudo
$KernelVersionVM1 = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "uname -a" -runAsSudo
$KernelVersionVM2 = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm2sshport -command "uname -a" -runAsSudo
$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 NET PERF TEST
LogMsg "CLIENT VM details :"
LogMsg " RoleName : $($clientVMData.RoleName)"
LogMsg " Public IP : $($clientVMData.PublicIP)"
LogMsg " Internal IP : $($clientVMData.InternalIP)"
LogMsg " SSH Port : $($clientVMData.SSHPort)"
LogMsg "SERVER VM details :"
LogMsg " RoleName : $($serverVMData.RoleName)"
LogMsg " Public IP : $($serverVMData.PublicIP)"
LogMsg " Internal IP : $($serverVMData.InternalIP)"
LogMsg " SSH Port : $($serverVMData.SSHPort)"
RemoteCopy -uploadTo $clientVMData.PublicIP -port $serverVMData.SSHPort -files $currentTestData.files -username $user -password $password -upload
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "mkdir -p code" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "mv *.sh code/" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "chmod +x code/*" -runAsSudo
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files $currentTestData.files -username $user -password $password -upload
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "mkdir -p code" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "mv *.sh code/" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "chmod +x code/*" -runAsSudo
$KernelVersionVM1 = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "uname -a" -runAsSudo
$KernelVersionVM2 = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "uname -a" -runAsSudo
LogMsg "VM is ready for netperf test"
LogMsg "VM1 kernel version:- $KernelVersionVM1"
LogMsg "VM2 kernel version:- $KernelVersionVM2"
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "bash /home/$user/code/$($currentTestData.testScript) server $user $hs1vm1IP" -runAsSudo
$out = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm2sshport -command "bash /home/$user/code/$($currentTestData.testScript) client $user $hs1vm1IP" -runAsSudo
$restartvmstatus = RestartAllDeployments -allVMData $allVMData
if ($restartvmstatus -eq "True")
$BufferLengthArray = $($currentTestData.BufferLength) -split ","
#Test run number of iteration with given udp buffer lengths
foreach ($BufferLength in $BufferLengthArray)
{
$testDuration=0
LogMsg "VMs Restarted Successfully"
for($testDuration -le 11000)
if( $($currentTestData.TestType) -eq "UDP" )
{
WaitFor -seconds 600
LogMsg "testDuration :- $testDuration "
$NetStatStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm2sshport -command "netstat -natp | grep iperf | grep ESTA | wc -l" -runAsSudo
LogMsg "NetStatStatus :- $NetStatStatus "
if ($NetStatStatus -eq 0)
$UDPtestParams = "UDP $BufferLength"
$metaData = "$BufferLength"
}
else
{
$UDPtestParams = ""
}
$out = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "bash /home/$user/code/$($currentTestData.testScript) server $user $($serverVMData.InternalIP) " -runAsSudo
$out = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "bash /home/$user/code/$($currentTestData.testScript) client $user $($serverVMData.InternalIP) $UDPtestParams" -runAsSudo
$restartvmstatus = RestartAllDeployments -allVMData $allVMData
if ($restartvmstatus -eq "True")
{
$testDuration=0
LogMsg "VMs Restarted Successfully"
for($testDuration -le 4100)
{
WaitFor -seconds 30
$NetStatStatus = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm2sshport -command "netstat -natp | grep iperf | grep ESTA | wc -l" -runAsSudo
WaitFor -seconds 600
LogMsg "$UDPtestParams testDuration :- $testDuration "
$NetStatStatus = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "netstat -natp | grep iperf | grep ESTA | wc -l" -runAsSudo
LogMsg "$UDPtestParams NetStatStatus :- $NetStatStatus "
if ($NetStatStatus -eq 0)
{
if($testDuration -lt 9600)
WaitFor -seconds 30
$NetStatStatus = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "netstat -natp | grep iperf | grep ESTA | wc -l" -runAsSudo
if ($NetStatStatus -eq 0)
{
LogMsg "NetStatStatus after 30 sec :- $NetStatStatus "
LogMsg "NetPerf test is ABORTED.."
$testResult = "ABORTED"
break
if($testDuration -lt 3000)
{
LogMsg "$UDPtestParams NetStatStatus after 30 sec :- $NetStatStatus "
LogMsg "$UDPtestParams NetPerf test is ABORTED.."
$testResult = "ABORTED"
$resultSummary += CreateResultSummary -testResult $testResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
break
}
else{
LogMsg "$UDPtestParams NetPerf test is COMPLETED."
$testResult = "PASS"
WaitFor -seconds 200
$out = RemoteCopy -download -downloadFrom $clientVMData.PublicIP -files "/home/$user/code/*.tar" -downloadTo $LogDir -port $serverVMData.SSHPort -username $user -password $password 2>&1 | Out-Null
$out = RemoteCopy -download -downloadFrom $clientVMData.PublicIP -files "/home/$user/code/*.tar" -downloadTo $LogDir -port $clientVMData.SSHPort -username $user -password $password 2>&1 | Out-Null
$out = RemoteCopy -download -downloadFrom $clientVMData.PublicIP -files "/home/$user/code/*.csv" -downloadTo $LogDir -port $serverVMData.SSHPort -username $user -password $password 2>&1 | Out-Null
$out = RemoteCopy -download -downloadFrom $clientVMData.PublicIP -files "/home/$user/code/*.csv" -downloadTo $LogDir -port $clientVMData.SSHPort -username $user -password $password 2>&1 | Out-Null
$hostname_server = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "hostname"
$hostname_client = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "hostname"
$server_summary_file = "$LogDir\summary_file_$hostname_server.csv"
$client_summary_file = "$LogDir\summary_file_$hostname_client.csv"
$server_data = Import-Csv $server_summary_file
$client_data = Import-Csv $client_summary_file
$UDPresult = @()
$i = 0
foreach($item in $server_data)
{
$client_throughput = [double]($client_data[$i].AvgThroughput)
$server_throughput = [double]($server_data[$i].AvgThroughput)
if($client_throughput)
{
$ThroughputDrop = (( $client_throughput - $server_throughput ) * 100)/($client_throughput)
}else{
$ThroughputDrop = 0
}
$client_packets= [double]($client_data[$i].TotalPackets)
$server_packets = [double]($server_data[$i].TotalPackets)
if($client_packets)
{
$PacketDrop = (( $client_packets - $server_packets ) * 100)/($client_packets)
}else{
$PacketDrop = 0
}
$ThroughputDrop = [int]$ThroughputDrop
$PacketDrop = [int]$PacketDrop
$Connections = $client_data.GetValue($i).Connections
$UDPresult +=New-Object PSObject |
Add-Member -Name Connections -Value $Connections -MemberType NoteProperty -PassThru |
Add-Member -Name ThroughputDrop -Value $ThroughputDrop -MemberType NoteProperty -PassThru |
Add-Member -Name PacketDrop -Value $PacketDrop -MemberType NoteProperty -PassThru
$i++
}
$UDPresult
#$resultArr += $testResult
$resultSummary += CreateResultSummary -testResult $UDPresult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
break
}
}
else{
LogMsg "NetPerf test is COMPLETED."
$testResult = "PASS"
$out = RemoteCopy -download -downloadFrom $hs1VIP -files "/home/$user/code/*.tar" -downloadTo $LogDir -port $hs1vm1sshport -username $user -password $password 2>&1 | Out-Null
break
}
LogMsg "$UDPtestParams NetPerf test is RUNNING.. with $NetStatStatus"
}
}
else{
LogMsg "NetPerf test is RUNNING.. with $NetStatStatus"
}
LogMsg "$UDPtestParams NetPerf test is RUNNING.. with $NetStatStatus"
}
$testDuration=$testDuration+600
}
else{
LogMsg "NetPerf test is RUNNING.. with $NetStatStatus"
}
$testDuration=$testDuration+600
}
else{
LogMsg "VMs Restarts Failed.."
$testResult = "Aborted"
}
LogMsg "Test result : $testResult"
}
else{
LogMsg "VMs Restarts Failed.."
$testResult = "Aborted"
}
LogMsg "Test result : $testResult"
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
@ -110,7 +195,7 @@ if ($isDeployed)
}
$resultArr += $testResult
#$resultSummary += CreateResultSummary -testResult $testResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName# if you want to publish all result then give here all test status possibilites. if you want just failed results, then give here just "FAIL". You can use any combination of PASS FAIL ABORTED and corresponding test results will be published!
}
}
}
else
{
@ -121,7 +206,7 @@ else
$result = GetFinalResultHeader -resultarr $resultArr
#Clean up the setup
#DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
#Return the result and summery to the test suite script..
return $result
return $result,$resultSummary

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

@ -0,0 +1,141 @@
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$clientVMData = $allVMData
#region Get the info about the disks
$fdiskOutput = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "$fdisk -l" -runAsSudo
$allDetectedDisks = GetNewPhysicalDiskNames -FdiskOutputBeforeAddingDisk "Disk /dev/sda`nDisk /dev/sdb" -FdiskOutputAfterAddingDisk $fdiskOutput
#/dev/sda is OS disk and and /dev/sdb is the resource disk. So we will count the disks from /dev/sdc.
$detectedTestDisks = ""
foreach ( $disk in $allDetectedDisks.split("^"))
{
if (( $disk -eq "/dev/sda") -or ($disk -eq "/dev/sdb"))
{
#SKIP adding the disk to detected test disk list.
}
else
{
if ( $detectedTestDisks )
{
$detectedTestDisks += "^" + $disk
}
else
{
$detectedTestDisks = $disk
}
}
}
#endregion
LogMsg "Generating constansts.sh ..."
$constantsFile = ".\$LogDir\constants.sh"
foreach ( $disk in $detectedTestDisks.split("^"))
{
Add-Content -Value "testdisk=$disk" -Path $constantsFile
}
foreach ($testParam in $currentTestData.TestParameters.param )
{
Add-Content -Value "$testParam" -Path $constantsFile
LogMsg "$testParam added to constansts.sh"
}
LogMsg "constanst.sh created successfully..."
LogMsg (Get-Content -Path $constantsFile)
#endregion
#region EXECUTE TEST
Set-Content -Value "/root/performance_middleware_fio.sh &> FioConsoleLogs.txt" -Path "$LogDir\StartFioTest.sh"
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files ".\$constantsFile,.\remote-scripts\performance_middleware_fio.sh,.\$LogDir\StartFioTest.sh" -username "root" -password $password -upload
$out = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh" #-runAsSudo
$testJob = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "/root/StartFioTest.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 -n 1 /root/FioConsoleLogs.txt"
$currentfioStatus = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "tail -n 1 /root/FIOLog/fio-test.log.txt" -ignoreLinuxExitCode
LogMsg "Current Test Staus : $currentStatus `n$currentfioStatus"
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 "FioConsoleLogs.txt,state.txt,summary.log"
## add here code for display results
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"
$fioLogDir = "$LogDir\FIOLog"
mkdir $fioLogDir -Force | Out-Null
mkdir $fioLogDir\jsonLog -Force | Out-Null
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $fioLogDir\jsonLog -files "FIOLog/jsonLog/*"
mkdir $fioLogDir\iostatLog -Force | Out-Null
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $fioLogDir\iostatLog -files "FIOLog/iostatLog/*"
mkdir $fioLogDir\vmstatLog -Force | Out-Null
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $fioLogDir\vmstatLog -files "FIOLog/vmstatLog/*"
mkdir $fioLogDir\sarLog -Force | Out-Null
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $fioLogDir\sarLog -files "FIOLog/sarLog/*"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $fioLogDir -files "FIOLog/fio-test.log.txt"
}
elseif ( $finalStatus -imatch "TestRunning")
{
$testResult = "PASS"
}
LogMsg "Test result : $testResult"
LogMsg "Test Completed"
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = ""
if (!$testResult)
{
$testResult = "Aborted"
}
$resultArr += $testResult
$resultSummary += CreateResultSummary -testResult $testResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
}
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,248 @@
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$testVMData = $allVMData
ProvisionVMsForLisa -allVMData $allVMData -installPackagesOnRoleNames "none"
LogMsg "Generating constansts.sh ..."
$constantsFile = "$LogDir\constants.sh"
Set-Content -Value "#Generated by Azure Automation." -Path $constantsFile
foreach ( $param in $currentTestData.TestParameters.param)
{
Add-Content -Value "$param" -Path $constantsFile
LogMsg "$param added to constants.sh"
if ( $param -imatch "startThread" )
{
$startThread = [int]($param.Replace("startThread=",""))
}
if ( $param -imatch "maxThread" )
{
$maxThread = [int]($param.Replace("maxThread=",""))
}
}
LogMsg "constanst.sh created successfully..."
#endregion
#region EXECUTE TEST
$myString = @"
chmod +x perf_fio.sh
./perf_fio.sh &> fioConsoleLogs.txt
. azuremodules.sh
collect_VM_properties
"@
$myString2 = @"
wget https://konkaciwestus1.blob.core.windows.net/scriptfiles/JSON.awk
wget https://konkaciwestus1.blob.core.windows.net/scriptfiles/gawk
wget https://konkaciwestus1.blob.core.windows.net/scriptfiles/fio_jason_parser.sh
chmod +x *.sh
cp fio_jason_parser.sh gawk JSON.awk /root/FIOLog/jsonLog/
cd /root/FIOLog/jsonLog/
./fio_jason_parser.sh
cp perf_fio.csv /root
chmod 666 /root/perf_fio.csv
"@
Set-Content "$LogDir\StartFioTest.sh" $myString
Set-Content "$LogDir\ParseFioTestLogs.sh" $myString2
RemoteCopy -uploadTo $testVMData.PublicIP -port $testVMData.SSHPort -files ".\$constantsFile,.\remote-scripts\azuremodules.sh,.\remote-scripts\perf_fio.sh,.\$LogDir\StartFioTest.sh,.\$LogDir\ParseFioTestLogs.sh" -username "root" -password $password -upload
RemoteCopy -uploadTo $testVMData.PublicIP -port $testVMData.SSHPort -files $currentTestData.files -username "root" -password $password -upload
$out = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh" -runAsSudo
$testJob = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "./StartFioTest.sh" -RunInBackground -runAsSudo
#endregion
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
{
$currentStatus = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "tail -1 runlog.txt"-runAsSudo
LogMsg "Current Test Staus : $currentStatus"
WaitFor -seconds 20
}
$finalStatus = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "cat state.txt"
RemoteCopy -downloadFrom $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "FIOTest-*.tar.gz"
RemoteCopy -downloadFrom $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "VM_properties.csv"
$testSummary = $null
#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")
{
$out = RunLinuxCmd -ip $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -command "/root/ParseFioTestLogs.sh"
RemoteCopy -downloadFrom $testVMData.PublicIP -port $testVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "perf_fio.csv"
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"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
try
{
foreach($line in (Get-Content "$LogDir\perf_fio.csv"))
{
if ( $line -imatch "Max IOPS of each mode" )
{
$maxIOPSforMode = $true
$maxIOPSforBlockSize = $false
$fioData = $false
}
if ( $line -imatch "Max IOPS of each BlockSize" )
{
$maxIOPSforMode = $false
$maxIOPSforBlockSize = $true
$fioData = $false
}
if ( $line -imatch "Iteration,TestType,BlockSize" )
{
$maxIOPSforMode = $false
$maxIOPSforBlockSize = $false
$fioData = $true
}
if ( $maxIOPSforMode )
{
Add-Content -Value $line -Path $LogDir\maxIOPSforMode.csv
}
if ( $maxIOPSforBlockSize )
{
Add-Content -Value $line -Path $LogDir\maxIOPSforBlockSize.csv
}
if ( $fioData )
{
Add-Content -Value $line -Path $LogDir\fioData.csv
}
}
$maxIOPSforModeCsv = Import-Csv -Path $LogDir\maxIOPSforMode.csv
$maxIOPSforBlockSizeCsv = Import-Csv -Path $LogDir\maxIOPSforBlockSize.csv
$fioDataCsv = Import-Csv -Path $LogDir\fioData.csv
LogMsg "Uploading the test results.."
$dataSource = $xmlConfig.config.Azure.database.server
$DBuser = $xmlConfig.config.Azure.database.user
$DBpassword = $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 $DBuser -And $DBpassword -And $database -And $dataTableName)
{
$GuestDistro = cat "$LogDir\VM_properties.csv" | Select-String "OS type"| %{$_ -replace ",OS type,",""}
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 = $testVMData.InstanceSize
$KernelVersion = cat "$LogDir\VM_properties.csv" | Select-String "Kernel version"| %{$_ -replace ",Kernel version,",""}
$connectionString = "Server=$dataSource;uid=$DBuser; pwd=$DBpassword;Database=$database;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;"
$SQLQuery = "INSERT INTO $dataTableName (TestCaseName,TestDate,HostType,HostBy,HostOS,GuestOSType,GuestDistro,GuestSize,KernelVersion,BlockSize_KB,QDepth,seq_read_iops,seq_read_lat_usec,rand_read_iops,rand_read_lat_usec,seq_write_iops,seq_write_lat_usec,rand_write_iops,rand_write_lat_usec) VALUES "
for ( $QDepth = $startThread; $QDepth -le $maxThread; $QDepth *= 2 )
{
$seq_read_iops = ($fioDataCsv | where { $_.TestType -eq "read" -and $_.Threads -eq "$QDepth"} | Select ReadIOPS).ReadIOPS
$seq_read_lat_usec = ($fioDataCsv | where { $_.TestType -eq "read" -and $_.Threads -eq "$QDepth"} | Select MaxOfReadMeanLatency).MaxOfReadMeanLatency
$rand_read_iops = ($fioDataCsv | where { $_.TestType -eq "randread" -and $_.Threads -eq "$QDepth"} | Select ReadIOPS).ReadIOPS
$rand_read_lat_usec = ($fioDataCsv | where { $_.TestType -eq "randread" -and $_.Threads -eq "$QDepth"} | Select MaxOfReadMeanLatency).MaxOfReadMeanLatency
$seq_write_iops = ($fioDataCsv | where { $_.TestType -eq "write" -and $_.Threads -eq "$QDepth"} | Select WriteIOPS).WriteIOPS
$seq_write_lat_usec = ($fioDataCsv | where { $_.TestType -eq "write" -and $_.Threads -eq "$QDepth"} | Select MaxOfWriteMeanLatency).MaxOfWriteMeanLatency
$rand_write_iops = ($fioDataCsv | where { $_.TestType -eq "randwrite" -and $_.Threads -eq "$QDepth"} | Select WriteIOPS).WriteIOPS
$rand_write_lat_usec= ($fioDataCsv | where { $_.TestType -eq "randwrite" -and $_.Threads -eq "$QDepth"} | Select MaxOfWriteMeanLatency).MaxOfWriteMeanLatency
$BlockSize_KB= (($fioDataCsv | where { $_.Threads -eq "$QDepth"} | Select BlockSize)[0].BlockSize).Replace("K","")
$SQLQuery += "('$TestCaseName','$(Get-Date -Format yyyy-MM-dd)','$HostType','$HostBy','$HostOS','$GuestOSType','$GuestDistro','$GuestSize','$KernelVersion','$BlockSize_KB','$QDepth','$seq_read_iops','$seq_read_lat_usec','$rand_read_iops','$rand_read_lat_usec','$seq_write_iops','$seq_write_lat_usec','$rand_write_iops','$rand_write_lat_usec'),"
LogMsg "Collected performace data for $QDepth QDepth."
}
$SQLQuery = $SQLQuery.TrimEnd(',')
Write-Host $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
LogErr "EXCEPTION : $ErrorMessage"
}
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = "NTTTCP 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,208 @@
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
$threads=$currentTestData.TestParameters.param
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$noServer = $true
$noClient = $true
foreach ( $vmData in $allVMData )
{
if ( $vmData.RoleName -imatch "Server" )
{
$serverVMData = $vmData
$noServer = $false
}
elseif ( $vmData.RoleName -imatch "Client" )
{
$clientVMData = $vmData
$noClient = $fase
}
}
if ( $noServer )
{
Throw "No any server VM defined. Be sure that, server VM role name matches with the pattern `"*server*`". Aborting Test."
}
if ( $noSlave )
{
Throw "No any client VM defined. Be sure that, client machine role names matches with pattern `"*client*`" Aborting Test."
}
#region CONFIGURE VMs for 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
#endregion
$mdXMLData = [xml](Get-Content -Path ".\XML\Perf_Middleware_MangoDB_2VM.xml")
LogMsg "Generating constansts.sh ..."
$constantsFile = "$LogDir\constants.sh"
Set-Content -Value "#Generated by Azure Automation." -Path $constantsFile
foreach ($mdParam in $mdXMLData.config.testCases.test.testParams.param )
{
if ($mdParam -imatch "MD_SERVER")
{
Add-Content -Value "MD_SERVER=$($serverVMData.InternalIP)" -Path $constantsFile
LogMsg "MD_SERVER=$($serverVMData.InternalIP) added to constansts.sh"
}
else
{
Add-Content -Value "$mdParam" -Path $constantsFile
LogMsg "$mdParam added to constansts.sh"
}
}
foreach ($testParam in $currentTestData.TestParameters.param )
{
Add-Content -Value "$testParam" -Path $constantsFile
LogMsg "$testParam added to constansts.sh"
}
LogMsg "constanst.sh created successfully..."
LogMsg "Generating MongoDB workload file ..."
$workloadFile = "$LogDir\workloadAzure"
Set-Content -Value "#Generated by Azure Automation." -Path $workloadFile
foreach ($mdParam in $mdXMLData.config.testCases.test.testParams.mdparam )
{
Add-Content -Value "$mdParam" -Path $workloadFile
LogMsg "$mdParam added to workloadAzure"
}
LogMsg "workloadAzure file created successfully..."
#endregion
#region EXECUTE TEST
Set-Content -Value "/root/performance_middleware_mongod.sh &> mongodClientConsoleLogs.txt" -Path "$LogDir\StartMONGODTest.sh"
$out = RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files ".\$constantsFile,.\remote-scripts\performance_middleware_mongod.sh,.\remote-scripts\run-ycsb.sh,.\$LogDir\StartMONGODTest.sh,.\$LogDir\workloadAzure" -username "root" -password $password -upload 2>&1 | Out-Null
$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/StartMONGODTest.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 -n 1 /root/mongodClientConsoleLogs.txt"
$testEndStatus = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "cat /root/mongodClientConsoleLogs.txt | grep 'TEST END' | tail -1"
if($testEndStatus -imatch "TEST END")
{
$testStartStatus = "TEST START WITH NEXT THREAD"
}
$testStartStatus = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "cat /root/mongodClientConsoleLogs.txt | grep 'TEST RUNNING' | tail -1"
LogMsg "Current Test Staus : $testEndStatus $testStartStatus `n $currentStatus"
WaitFor -seconds 10
}
$out = RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/mongodClientConsoleLogs.txt" 2>&1 | Out-Null
$out = RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/summary.log,/root/state.txt" 2>&1 | Out-Null
$finalStatus = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "cat /root/state.txt"
$mdSummary = Get-Content -Path "$LogDir\summary.log" -ErrorAction SilentlyContinue
if ($finalStatus -imatch "TestCompleted")
{
$threads = $currentTestData.TestParameters.param
$threads = $threads.Replace("test_threads_collection=",'').Replace("(","").Replace(")","").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" ",",")
foreach ($thread in $threads.Split(","))
{
$threadStatus = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -command "cat /root/benchmark/mongodb/logs/$thread/$thread-mongodb.ycsb.run.log | grep 'OVERALL], Throughput'" -ignoreLinuxExitCode
if (($threadStatus -imatch 'OVERALL') -and ($threadStatus -imatch 'Throughput'))
{
$overallThroghput = $threadStatus.Trim().Split()[2].Trim()
$metaData = "$thread threads: overallThroghput"
$resultSummary += CreateResultSummary -testResult $overallThroghput -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
}
}
else
{
$overallThroghput = ""
}
#endregion
if (!$mdSummary)
{
LogMsg "summary.log file is empty."
$mdSummary = $finalStatus
}
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. Result : $finalStatus."
foreach ($thread in $threads.Split(","))
{
mkdir $LogDir\$($clientVMData.RoleName)\$($thread) -Force| out-null
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir\$($clientVMData.RoleName)\$($thread) -files "/root/benchmark/mongodb/logs/$($thread)/$($thread)-mongodb-client*" 2>&1 | Out-Null
mkdir $LogDir\$($serverVMData.RoleName)\$($thread) -Force| out-null
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir\$($serverVMData.RoleName)\$($thread) -files "/root/benchmark/mongodb/logs/$($thread)/$($thread)-mongodb-server*" 2>&1 | Out-Null
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/benchmark/mongodb/logs/$($thread)/$($thread)-mongodb.ycsb.run.log" 2>&1 | Out-Null
}
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/mongodServerConsole.txt" 2>&1 | Out-Null
$testResult = "PASS"
}
elseif ( $finalStatus -imatch "TestRunning")
{
$testResult = "PASS"
}
LogMsg "Test result : $testResult"
LogMsg "Test Completed"
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = ""
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,329 @@
# This script deploys the VMs for the network performance test and trigger test.
# Author: Sivakanth Rebba
# Email : v-sirebb@microsoft.com
#
#####
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$allVMData = GetAllDeployementData -DeployedServices $isDeployed
Set-Variable -Name AllVMData -Value $allVMData
$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 NET PERF TEST
LogMsg "CLIENT VM details :"
LogMsg " RoleName : $($clientVMData.RoleName)"
LogMsg " Public IP : $($clientVMData.PublicIP)"
LogMsg " Internal IP : $($clientVMData.InternalIP)"
LogMsg " SSH Port : $($clientVMData.SSHPort)"
LogMsg "SERVER VM details :"
LogMsg " RoleName : $($serverVMData.RoleName)"
LogMsg " Public IP : $($serverVMData.PublicIP)"
LogMsg " Internal IP : $($serverVMData.InternalIP)"
LogMsg " SSH Port : $($serverVMData.SSHPort)"
RemoteCopy -uploadTo $clientVMData.PublicIP -port $serverVMData.SSHPort -files $currentTestData.files -username $user -password $password -upload
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "mkdir -p code" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "mv *.sh code/" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "chmod +x code/*" -runAsSudo
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files $currentTestData.files -username $user -password $password -upload
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "mkdir -p code" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "mv *.sh code/" -runAsSudo
RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "chmod +x code/*" -runAsSudo
$KernelVersionVM1 = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "uname -r" -runAsSudo
$KernelVersionVM2 = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "uname -r" -runAsSudo
LogMsg "VM1 kernel version:- $KernelVersionVM1"
LogMsg "VM2 kernel version:- $KernelVersionVM2"
if($Distro -imatch "UBUNTU")
{
$packages = 'wget dos2unix tar at bc gcc git iperf psmisc fio bind9 xfsprogs libaio1 mdadm lvm2 sysstat sshpass iperf3 python-argparse python-paramiko sysbench iozone3'
$packInstall = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "apt-get -y update" -runAsSudo -runmaxallowedtime 900
$packInstall = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "apt-get -y install $packages" -runAsSudo -runmaxallowedtime 900
$packInstall1 = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "apt-get -y update " -runAsSudo -runmaxallowedtime 900
$packInstall1 = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "apt-get -y install $packages" -runAsSudo -runmaxallowedtime 900
}
LogMsg "VM is ready for netperf test"
#Test run number of iteration with given udp buffer lengths
$BufferLengthArray = $($currentTestData.BufferLength) -split ","
foreach ($BufferLength in $BufferLengthArray)
{
if( $($currentTestData.TestType) -eq "UDP" )
{
$UDPtestParams = "UDP $BufferLength"
$metaData = "$($currentTestData.TestType) $BufferLength"
}
else
{
$UDPtestParams = "TCP Default"
$metaData = "$($currentTestData.TestType) Default"
}
$out = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "bash /home/$user/code/$($currentTestData.testScript) server $user $($serverVMData.InternalIP) $UDPtestParams" -runAsSudo
$out = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "bash /home/$user/code/$($currentTestData.testScript) client $user $($serverVMData.InternalIP) $UDPtestParams" -runAsSudo
$restartvmstatus = RestartAllDeployments -allVMData $allVMData
if ($restartvmstatus -eq "True")
{
$testDuration=0
LogMsg "VMs Restarted Successfully"
$KernelVersionVM1 = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "uname -r" -runAsSudo
$KernelVersionVM2 = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "uname -r" -runAsSudo
LogMsg "VM1 kernel version:- $KernelVersionVM1"
LogMsg "VM2 kernel version:- $KernelVersionVM2"
LogMsg "$UDPtestParams testDuration :- $testDuration .. waiting 300s for client connections"
WaitFor -seconds 300
while($testDuration -le 4100)
{
LogMsg "$UDPtestParams testDuration :- $testDuration "
$testStatus = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "cat /home/$user/code/state.txt" -runAsSudo
LogMsg "$UDPtestParams testStatus :- $testStatus "
if ($testStatus -eq "TestRunning")
{
$infoDuration = 0
while($infoDuration -le 600)
{
$testStatusInfo = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "tail -1 /home/$user/code/client.log" -runAsSudo
if($testStatusInfo -imatch "Updating test case state to completed")
{
LogMsg "$UDPtestParams $testDuration-testStatusInfo-$infoDuration :- COMPLETED"
break
}
else
{
LogMsg "$UDPtestParams $testDuration-testStatusInfo-$infoDuration :- $testStatusInfo "
WaitFor -seconds 60
}
$infoDuration=$infoDuration+60
}
}
elseif($testStatus -eq "TestCompleted")
{
LogMsg "$UDPtestParams NetPerf test is COMPLETED."
$testResult = "PASS"
WaitFor -seconds 200
$out = RemoteCopy -download -downloadFrom $clientVMData.PublicIP -files "/home/$user/code/logs-$($clientVMData.RoleName)-UDP-$($BufferLength)/*.csv" -downloadTo $LogDir -port $clientVMData.SSHPort -username $user -password $password 2>&1 | Out-Null
$out = RemoteCopy -download -downloadFrom $clientVMData.PublicIP -files "/home/$user/code/*.tar.gz, /home/$user/code/*.log, /home/$user/code/*.txt" -downloadTo $LogDir -port $clientVMData.SSHPort -username $user -password $password 2>&1 | Out-Null
$out = RemoteCopy -download -downloadFrom $clientVMData.PublicIP -files "/home/$user/code/*.tar.gz, /home/$user/code/*.log" -downloadTo $LogDir -port $serverVMData.SSHPort -username $user -password $password 2>&1 | Out-Null
$out = RemoteCopy -download -downloadFrom $clientVMData.PublicIP -files "/home/$user/code/logs-$($serverVMData.RoleName)-UDP-$($BufferLength)/*.csv" -downloadTo $LogDir -port $serverVMData.SSHPort -username $user -password $password 2>&1 | Out-Null
$resultSummary += CreateResultSummary -testResult $testResult -metaData "UDP $BufferLength" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
break
}
elseif($testStatus -eq "TestFailed")
{
LogMsg "$UDPtestParams NetPerf test is FAILED.."
$testResult = "FAIL"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "UDP $BufferLength" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
break
}
else
{
LogMsg "$UDPtestParams NetPerf test is ABORTED.."
$testResult = "ABORTED"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "UDP $BufferLength" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
break
}
$testDuration=$testDuration+600
}
LogMsg "Resetting the /etc/rc.local"
$out = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $serverVMData.SSHPort -command "sed -i '/$user / d' /etc/rc.local" -runAsSudo
$out = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "sed -i '/$user / d' /etc/rc.local" -runAsSudo
}
else{
LogMsg "VMs Restarts Failed.."
$testResult = "Aborted"
}
LogMsg "Test result : $testResult"
}
if ($testResult -imatch "PASS")
{
foreach ($BufferLength in $BufferLengthArray)
{
try
{
LogMsg "UDP $BufferLength results parsing STARTED.."
$server_summary_file = "$LogDir\summary_file_$($serverVMData.RoleName)_UDP_$($BufferLength).csv"
$client_summary_file = "$LogDir\summary_file_$($clientVMData.RoleName)_UDP_$($BufferLength).csv"
$server_data = Import-Csv $server_summary_file
$client_data = Import-Csv $client_summary_file
$UDPresult = @()
$i = 0
foreach($item in $server_data)
{
$client_throughput = [double]($client_data[$i].'Avg Throughput')
$server_throughput = [double]($server_data[$i].'Avg Throughput')
if($client_throughput)
{
$ThroughputDrop = (( $client_throughput - $server_throughput ) * 100)/($client_throughput)
}else{
$ThroughputDrop = 0
}
$client_packets= [double]($client_data[$i].'Total packets')
$server_packets = [double]($server_data[$i].'Total packets')
if($client_packets)
{
$PacketDrop = (( $client_packets - $server_packets ) * 100)/($client_packets)
}else{
$PacketDrop = 0
}
$ThroughputDrop = [math]::abs([math]::Round($ThroughputDrop,2))
$PacketDrop = [math]::abs([math]::Round($PacketDrop,2))
$Connections = $client_data.GetValue($i).Connections
$TxThroughput_Gbps = $client_data.GetValue($i).'Avg Throughput'
$RxThroughput_Gbps = $server_data.GetValue($i).'Avg Throughput'
$UDPresult +=New-Object PSObject |
Add-Member -Name Connections -Value $Connections -MemberType NoteProperty -PassThru |
Add-Member -Name TxThroughput_Gbps -Value $TxThroughput_Gbps -MemberType NoteProperty -PassThru |
Add-Member -Name RxThroughput_Gbps -Value $RxThroughput_Gbps -MemberType NoteProperty -PassThru |
Add-Member -Name ThroughputDrop -Value $ThroughputDrop -MemberType NoteProperty -PassThru |
Add-Member -Name DatagramLoss -Value $PacketDrop -MemberType NoteProperty -PassThru
$i++
}
$UDPresult
LogMsg "UDP $BufferLength results parsing DONE!!"
Write-Output $UDPresult | Format-Table
#$resultSummary += CreateResultSummary -testResult $testResult -metaData "UDP $BufferLength" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
LogMsg "Uploading the test results to DB STARTED.."
$dataSource = $xmlConfig.config.Azure.database.server
$dbuser = $xmlConfig.config.Azure.database.user
$dbpassword = $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 $dbuser -And $dbpassword -And $database -And $dataTableName)
{
$GuestDistro = cat "$LogDir\VM_properties.csv" | Select-String "OS type"| %{$_ -replace ",OS type,",""}
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 = $($currentTestData.TestType)
$connectionString = "Server=$dataSource;uid=$dbuser; pwd=$dbpassword;Database=$database;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;"
$SQLQuery = "INSERT INTO $dataTableName (TestCaseName,TestDate,HostType,HostBy,HostOS,GuestOSType,GuestDistro,GuestSize,KernelVersion,IPVersion,ProtocolType,SendBufSize_KBytes,NumberOfConnections,TxThroughput_Gbps,RxThroughput_Gbps,DatagramLoss) VALUES "
for($i = 0; $i -lt $($UDPresult.Count); $i++)
{
$SQLQuery += "('$TestCaseName','$(Get-Date -Format yyyy-MM-dd)','$HostType','$HostBy','$HostOS','$GuestOSType','$GuestDistro','$GuestSize','$KernelVersion','$IPVersion','$ProtocolType','$($BufferLength[0])','$($UDPresult[$i].Connections)','$($UDPresult[$i].TxThroughput_Gbps)','$($UDPresult[$i].RxThroughput_Gbps)','$($UDPresult[$i].DatagramLoss)'),"
}
$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 to DB DONE!!"
}
else
{
LogMsg "Invalid database details. Failed to upload result to database!"
$testResult = "FAIL"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "UDP $BufferLength UPLOAD RESULTS TO DB" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
$testResult = "ABORTED"
}
Finally
{
$resultSummary += CreateResultSummary -testResult $testResult -metaData "UDP $BufferLength UPLOAD RESULTS TO DB" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
}
}
else
{
LogMsg "Skipping upload results to database!"
$testResult = "ABORTED"
$resultSummary += CreateResultSummary -testResult $testResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
$testResult = "ABORTED"
$resultSummary += CreateResultSummary -testResult $testResult -metaData "" -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
Finally
{
if (!$testResult)
{
$testResult = "Aborted"
}
$resultArr += $testResult
}
}
else
{
$metaData = ""
$testResult = "Aborted"
$resultArr += $testResult
$resultSummary += CreateResultSummary -testResult $testResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName# if you want to publish all result then give here all test status possibilites. if you want just failed results, then give here just "FAIL". You can use any combination of PASS FAIL ABORTED and corresponding test results will be published!
}
$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,225 @@
<#-------------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)
{
Add-Content -Value "$param" -Path $constantsFile
}
LogMsg "constanst.sh created successfully..."
LogMsg (Get-Content -Path $constantsFile)
#endregion
#region EXECUTE TEST
$myString = @"
cd /root/
./perf_ntttcp.sh &> ntttcpConsoleLogs.txt
. azuremodules.sh
collect_VM_properties
"@
Set-Content "$LogDir\StartNtttcpTest.sh" $myString
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files ".\$constantsFile,.\remote-scripts\azuremodules.sh,.\remote-scripts\perf_ntttcp.sh,.\$LogDir\StartNtttcpTest.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/StartNtttcpTest.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 -6 ntttcpConsoleLogs.txt | head -1"
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 "/root/ntttcpConsoleLogs.txt"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "lagscope-ntttcp-*"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "ntttcp-p*"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "report.log"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "VM_properties.csv"
$testSummary = $null
$ntttcpReportLog = Get-Content -Path "$LogDir\report.log"
foreach ( $line in $ntttcpReportLog )
{
if ( $line -imatch "test_connections" )
{
continue;
}
try
{
$test_connections = $line.Trim().Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Split(" ")[0]
$throughput_gbps = $line.Trim().Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Split(" ")[1]
$average_tcp_latency = $line.Trim().Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Replace(" "," ").Split(" ")[2]
$metadata = "Connections=$test_connections"
$connResult = "throughput=$throughput_gbps`Gbps Avg_TCP_lat=$average_tcp_latency"
$resultSummary += CreateResultSummary -testResult $connResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
catch
{
$resultSummary += CreateResultSummary -testResult "Error in parsing logs." -metaData "NTTTCP" -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"
$connectionString = "Server=$dataSource;uid=$user; pwd=$password;Database=$database;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;"
$LogContents = Get-Content -Path "$LogDir\report.log"
$SQLQuery = "INSERT INTO $dataTableName (TestCaseName,TestDate,HostType,HostBy,HostOS,GuestOSType,GuestDistro,GuestSize,KernelVersion,IPVersion,ProtocolType,NumberOfConnections,Throughput_Gbps,Latency_ms) VALUES "
for($i = 1; $i -lt $LogContents.Count; $i++)
{
$Line = $LogContents[$i].Trim() -split '\s+'
$SQLQuery += "('$TestCaseName','$(Get-Date -Format yyyy-MM-dd)','$HostType','$HostBy','$HostOS','$GuestOSType','$GuestDistro','$GuestSize','$KernelVersion','$IPVersion','$ProtocolType',$($Line[0]),$($Line[1]),$($Line[2])),"
}
$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 = "NTTTCP 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,463 @@
<#-------------Create Deployment Start------------------#>
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$clientVMData = $allVMData
#region Get the info about the disks
$fdiskOutput = RunLinuxCmd -username $user -password $password -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -command "$fdisk -l" -runAsSudo
$allDetectedDisks = GetNewPhysicalDiskNames -FdiskOutputBeforeAddingDisk "Disk /dev/sda`nDisk /dev/sdb" -FdiskOutputAfterAddingDisk $fdiskOutput
#/dev/sda is OS disk and and /dev/sdb is the resource disk. So we will count the disks from /dev/sdc.
$detectedTestDisks = ""
foreach ( $disk in $allDetectedDisks.split("^"))
{
if (( $disk -eq "/dev/sda") -or ($disk -eq "/dev/sdb"))
{
#SKIP adding the disk to detected test disk list.
}
else
{
if ( $detectedTestDisks )
{
$detectedTestDisks += "^" + $disk
}
else
{
$detectedTestDisks = $disk
}
}
}
#endregion
LogMsg "Generating constansts.sh ..."
$constantsFile = ".\$LogDir\constants.sh"
foreach ($testParam in $currentTestData.TestParameters.param )
{
Add-Content -Value "$testParam" -Path $constantsFile
LogMsg "$testParam added to constansts.sh"
}
LogMsg "Generating orion.lun..."
$orionLunFile = "orion.lun"
$orionLunFilePath = "$LogDir\$orionLunFile"
foreach ( $disk in $detectedTestDisks.split("^"))
{
Add-Content -Value $disk -Path $orionLunFilePath
}
#region EXECUTE TEST
Set-Content -Value "./perf_orion.sh &> orionConsoleLogs.txt" -Path "$LogDir\StartOrionTest.sh"
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files "$constantsFile,.\$orionLunFilePath,.\remote-scripts\perf_orion.sh,.\$LogDir\StartOrionTest.sh" -username $user -password $password -upload
$out = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username $user -password $password -command "chmod +x *.sh" -runAsSudo
$testJob = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username $user -password $password -command "./StartOrionTest.sh" -RunInBackground -runAsSudo
#endregion
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
{
$currentStatus = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username $user -password $password -command "tail -n 1 orionTest.log"
LogMsg "Current Test Staus : $currentStatus"
WaitFor -seconds 20
}
$finalStatus = RunLinuxCmd -ip $clientVMData.PublicIP -port $clientVMData.SSHPort -username $user -password $password -command "cat state.txt"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username $user -password $password -download -downloadTo $LogDir -files "orionTest.log"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username $user -password $password -download -downloadTo $LogDir -files "orionConsoleLogs.txt"
#region Analyse results..
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username $user -password $password -download -downloadTo $LogDir -files "orion-*"
$resultSummary = $null
#
#THIS FUNCTION WILL CREATE A NEW FOLDER FOR EACH TEST TYPE AND IT WILL PLACE RELATED LOG FILES IN THAT FOLDER.
#
Function SortOrionLogs($testType)
{
mkdir -Path "$LogDir\$testType" -Force | Out-Null
foreach ( $file in (Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "orion-") -and ( $_.Name -imatch "-$testType-")} ) )
{
Move-Item -Path "$LogDir\$($file.Name)" -Destination "$LogDir\$testType" -Force | Out-Null
LogMsg "$($file.Name) downloaded and moved to folder $testType"
}
}
$testType = "oltp"
LogMsg "Analysing '$testType' log files.."
$oltpResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$oltpResult = ($oltpResultContents | where { $_ -imatch "Maximum Small IOPS" })
if ( $oltpResult )
{
$resultSummary += CreateResultSummary -testResult $oltpResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$oltpResult = ($oltpResultContents | where { $_ -imatch "Minimum Small Latency"})
$resultSummary += CreateResultSummary -testResult $oltpResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "dss"
LogMsg "Analysing '$testType' log files.."
$dssResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$dssResult = ($dssResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $dssResult )
{
$resultSummary += CreateResultSummary -testResult $dssResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "simple"
LogMsg "Analysing '$testType' log files.."
$simpleResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$simpleResult = ($simpleResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $simpleResult )
{
$resultSummary += CreateResultSummary -testResult $simpleResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$simpleResult = ($simpleResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $simpleResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$simpleResult = ($simpleResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $simpleResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "normal#1"
LogMsg "Analysing '$testType' log files.."
$normal1ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$normal1Result = ($normal1ResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $normal1Result )
{
$resultSummary += CreateResultSummary -testResult $normal1Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$normal1Result = ($normal1ResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $normal1Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$normal1Result = ($normal1ResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $normal1Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "normal#2"
LogMsg "Analysing '$testType' log files.."
$normal2ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$normal2Result = ($normal2ResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $normal2Result )
{
$resultSummary += CreateResultSummary -testResult $normal2Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$normal2Result = ($normal2ResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $normal2Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$normal2Result = ($normal2ResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $normal2Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "normal#3"
LogMsg "Analysing '$testType' log files.."
$normal3ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$normal3Result = ($normal3ResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $normal3Result )
{
$resultSummary += CreateResultSummary -testResult $normal3Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$normal3Result = ($normal3ResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $normal3Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$normal3Result = ($normal3ResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $normal3Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "oltpWrite100"
LogMsg "Analysing '$testType' log files.."
$oltpWrite100ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$oltpWrite100Result = ($oltpWrite100ResultContents | where { $_ -imatch "Maximum Small IOPS" })
if ( $oltpWrite100Result )
{
$resultSummary += CreateResultSummary -testResult $oltpWrite100Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$oltpWrite100Result = ($oltpWrite100ResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $oltpWrite100Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "dssWrite100"
LogMsg "Analysing '$testType' log files.."
$dssWrite100ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$dssWrite100Result = ($dssWrite100ResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $dssWrite100Result )
{
$resultSummary += CreateResultSummary -testResult $dssWrite100Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "advancedWrite100Basic"
LogMsg "Analysing '$testType' log files.."
$advancedWrite100BasicResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$advancedWrite100BasicResult = ($advancedWrite100BasicResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $advancedWrite100BasicResult )
{
$resultSummary += CreateResultSummary -testResult $advancedWrite100BasicResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite100BasicResult = ($advancedWrite100BasicResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $advancedWrite100BasicResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite100BasicResult = ($advancedWrite100BasicResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $advancedWrite100BasicResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "advancedWrite100Detailed#1"
LogMsg "Analysing '$testType' log files.."
$advancedWrite100Detailed1ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$advancedWrite100Detailed1Result = ($advancedWrite100Detailed1ResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $advancedWrite100Detailed1Result )
{
$resultSummary += CreateResultSummary -testResult $advancedWrite100Detailed1Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite100Detailed1Result = ($advancedWrite100Detailed1ResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $advancedWrite100Detailed1Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite100Detailed1Result = ($advancedWrite100Detailed1ResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $advancedWrite100Detailed1Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "advancedWrite100Detailed#2"
LogMsg "Analysing '$testType' log files.."
$advancedWrite100Detailed2ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$advancedWrite100Detailed2Result = ($advancedWrite100Detailed2ResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $advancedWrite100Detailed2Result )
{
$resultSummary += CreateResultSummary -testResult $advancedWrite100Detailed2Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite100Detailed2Result = ($advancedWrite100Detailed2ResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $advancedWrite100Detailed2Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite100Detailed2Result = ($advancedWrite100Detailed2ResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $advancedWrite100Detailed2Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "advancedWrite100Detailed#3"
LogMsg "Analysing '$testType' log files.."
$advancedWrite100Detailed3ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$advancedWrite100Detailed3Result = ($advancedWrite100Detailed3ResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $advancedWrite100Detailed3Result )
{
$resultSummary += CreateResultSummary -testResult $advancedWrite100Detailed3Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite100Detailed3Result = ($advancedWrite100Detailed3ResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $advancedWrite100Detailed3Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite100Detailed3Result = ($advancedWrite100Detailed3ResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $advancedWrite100Detailed3Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "oltpWrite50"
LogMsg "Analysing '$testType' log files.."
$oltpWrite50ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$oltpWrite50Result = ($oltpWrite50ResultContents | where { $_ -imatch "Maximum Small IOPS" })
if ( $oltpWrite50Result )
{
$resultSummary += CreateResultSummary -testResult $oltpWrite50Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$oltpWrite50Result = ($oltpWrite50ResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $oltpWrite50Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "dssWrite50"
LogMsg "Analysing '$testType' log files.."
$dssWrite50ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$dssWrite50Result = ($dssWrite50ResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $dssWrite50Result )
{
$resultSummary += CreateResultSummary -testResult $dssWrite50Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "advancedWrite50Basic"
LogMsg "Analysing '$testType' log files.."
$advancedWrite50BasicResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$advancedWrite50BasicResult = ($advancedWrite50BasicResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $advancedWrite50BasicResult )
{
$resultSummary += CreateResultSummary -testResult $advancedWrite50BasicResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite50BasicResult = ($advancedWrite50BasicResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $advancedWrite50BasicResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite50BasicResult = ($advancedWrite50BasicResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $advancedWrite50BasicResult -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "advancedWrite50Detailed#1"
LogMsg "Analysing '$testType' log files.."
$advancedWrite50Detailed1ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$advancedWrite50Detailed1Result = ($advancedWrite50Detailed1ResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $advancedWrite50Detailed1Result )
{
$resultSummary += CreateResultSummary -testResult $advancedWrite50Detailed1Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite50Detailed1Result = ($advancedWrite50Detailed1ResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $advancedWrite50Detailed1Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite50Detailed1Result = ($advancedWrite50Detailed1ResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $advancedWrite50Detailed1Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "advancedWrite50Detailed#2"
LogMsg "Analysing '$testType' log files.."
$advancedWrite50Detailed2ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$advancedWrite50Detailed2Result = ($advancedWrite50Detailed2ResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $advancedWrite50Detailed2Result )
{
$resultSummary += CreateResultSummary -testResult $advancedWrite50Detailed2Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite50Detailed2Result = ($advancedWrite50Detailed2ResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $advancedWrite50Detailed2Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite50Detailed2Result = ($advancedWrite50Detailed2ResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $advancedWrite50Detailed2Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
$testType = "advancedWrite50Detailed#3"
LogMsg "Analysing '$testType' log files.."
$advancedWrite50Detailed3ResultContents = Get-Content -Path "$LogDir\$((Get-ChildItem -Path $LogDir | where { ( $_.Name -imatch "-summary.txt") -and ( $_.Name -imatch "-$testType-") }).Name )"
$advancedWrite50Detailed3Result = ($advancedWrite50Detailed3ResultContents | where { $_ -imatch "Maximum Large MBPS" })
if ( $advancedWrite50Detailed3Result )
{
$resultSummary += CreateResultSummary -testResult $advancedWrite50Detailed3Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite50Detailed3Result = ($advancedWrite50Detailed3ResultContents | where { $_ -imatch "Maximum Small IOPS" })
$resultSummary += CreateResultSummary -testResult $advancedWrite50Detailed3Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
$advancedWrite50Detailed3Result = ($advancedWrite50Detailed3ResultContents | where { $_ -imatch "Minimum Small Latency" })
$resultSummary += CreateResultSummary -testResult $advancedWrite50Detailed3Result -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: Result Strings not found. Possible test error." -metaData $testType -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
SortOrionLogs -testType $testType
LogMsg "Analysis complete!"
#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. Result : $mcResult."
$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\orionConsoleLogs.txt"
LogMsg "Contests of summary.log : $mcSummary"
$testResult = "PASS"
}
LogMsg "Test result : $testResult"
LogMsg "Test Completed"
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = ""
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,216 @@
<#-------------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)
{
Add-Content -Value "$param" -Path $constantsFile
}
LogMsg "constanst.sh created successfully..."
LogMsg (Get-Content -Path $constantsFile)
#endregion
#region EXECUTE TEST
Set-Content -Value "/root/perf_redis.sh &> redisConsoleLogs.txt" -Path "$LogDir\StartRedisTest.sh"
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files ".\$constantsFile,.\remote-scripts\perf_redis.sh,.\$LogDir\StartRedisTest.sh" -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/StartRedisTest.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 -n 1 /root/redisTest.log"
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"
$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 "/root/redisConsoleLogs.txt"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/redisTest.log"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "redis-server-pipelines-*"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "redis-client-pipelines-*"
$testSummary = $null
$redisClientLogFiles = Get-ChildItem -Path $LogDir | Select Name | where {($_ -imatch "redis-client-pipelines") -and ( $_ -imatch "set.get.log")}
$resultSummary = $null
foreach ( $file in $redisClientLogFiles )
{
$connResult = $null
$testType = $null
$testTypeResult = $null
$clientTxt = Get-Content -Path "$LogDir\$($file.Name)"
$fileName = $file.Name
foreach ( $line in $clientTxt )
{
if ( $line -imatch "SET:")
{
$testType = "SET"
}
if ( $line -imatch "GET:")
{
$testType = "GET"
}
if ( $line -imatch "requests per second" )
{
$testTypeResult = $line
}
if ( $testTypeResult -and $testType)
{
if ( $connResult )
{
$connResult += "," + $testType + " " + $line
}
else
{
$connResult = $testType + " " + $line
}
$testType = $null
$testTypeResult = $null
}
}
$metadata = $($file.Name).Replace("redis-client-","").Replace(".set.get.log","").Replace("-","=")
if ( $connResult )
{
$resultSummary += CreateResultSummary -testResult $connResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
else
{
$resultSummary += CreateResultSummary -testResult "ERROR: No result matching strings found. Possible Test Error." -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
LogMsg "Downloaded and Analysed $($file.Name) for number of requests."
}
$redisLogFiles = Get-ChildItem -Path $LogDir | Select Name | where { ( $_ -imatch "redis-server-pipelines") -or ( $_ -imatch "redis-client-pipelines") }
foreach ( $file in $redisLogFiles )
{
$fileName = $file.Name
if ( ( ( $fileName -imatch ".sar.netio.log" ) -and ( $fileName -imatch "-server-" ) ) -or ( ( $fileName -imatch ".iostat.diskio.log" ) -and ( $fileName -imatch "-server-" ) ) -or ( ( $fileName -imatch ".vmstat.memory.cpu.log" ) -and ( $fileName -imatch "-server-" ) ) )
{
$connFolder = $fileName.Split("-")[$fileName.Split("-").Count-1].Split(".")[0]
mkdir "$LogDir\$($serverVMData.RoleName)" -Force | Out-Null
mkdir "$LogDir\$($serverVMData.RoleName)\$connFolder" -Force | Out-Null
Move-Item "$LogDir\$fileName" -Destination "$LogDir\$($serverVMData.RoleName)\$connFolder" -Force
LogMsg "$($file.Name) downloaded and moved to '$($serverVMData.RoleName)\$connFolder'"
}
if ( ( ( $fileName -imatch ".sar.netio.log" ) -and ( $fileName -imatch "-client-" ) ) -or ( ( $fileName -imatch ".iostat.diskio.log" ) -and ( $fileName -imatch "-client-" ) ) -or ( ( $fileName -imatch ".vmstat.memory.cpu.log" ) -and ( $fileName -imatch "-client-" ) ) )
{
$connFolder = $fileName.Split("-")[$fileName.Split("-").Count-1].Split(".")[0]
mkdir "$LogDir\$($clientVMData.RoleName)" -Force | Out-Null
mkdir "$LogDir\$($clientVMData.RoleName)\$connFolder" -Force | Out-Null
Move-Item "$LogDir\$fileName" -Destination "$LogDir\$($clientVMData.RoleName)\$connFolder" -Force
LogMsg "$($file.Name) downloaded and moved to '$($clientVMData.RoleName)\$connFolder'"
}
}
#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\redisConsoleLogs.txt"
LogMsg "Contests of state.txt : $finalStatus"
$testResult = "PASS"
}
LogMsg "Test result : $testResult"
LogMsg "Test Completed"
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = "REDIS 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,306 @@
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
#$isDeployed = "ICA-RG-S1C1LBIPv6-SSU1604P-11-9-16-13-12^ICA-RG-S1C1LBIPv6-SSU1604P-11-9-16-9-28"
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if ($isDeployed)
{
try
{
$allVMData = GetAllDeployementData -ResourceGroups $isDeployed
Set-Variable -Name allVMData -Value $allVMData -Scope Global
$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.InternalIP)"
LogMsg " SSH Port : $($clientVMData.SSHPort)"
LogMsg "SERVER VM details :"
LogMsg " RoleName : $($serverVMData.RoleName)"
LogMsg " Public IP : $($serverVMData.InternalIP)"
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.PublicIP)" -Path $constantsFile
Add-Content -Value "client=$($clientVMData.PublicIP)" -Path $constantsFile
Add-Content -Value "serverIpv6=$($serverVMData.PublicIPv6)" -Path $constantsFile
Add-Content -Value "clientIpv6=$($clientVMData.PublicIPv6)" -Path $constantsFile
foreach ( $param in $currentTestData.TestParameters.param)
{
Add-Content -Value "$param" -Path $constantsFile
if ($param -imatch "bufferLenghs=")
{
$testBuffers= $param.Replace("bufferLenghs=(","").Replace(")","").Split(" ")
}
if ($param -imatch "connections=" )
{
$testConnections = $param.Replace("connections=(","").Replace(")","").Split(" ")
}
}
LogMsg "constanst.sh created successfully..."
LogMsg (Get-Content -Path $constantsFile)
#endregion
#region EXECUTE TEST
$myString = @"
cd /root/
./perf_iperf3.sh &> iperf3tcpConsoleLogs.txt
. azuremodules.sh
collect_VM_properties
"@
Set-Content "$LogDir\Startiperf3tcpTest.sh" $myString
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files ".\$constantsFile,.\remote-scripts\azuremodules.sh,.\remote-scripts\perf_iperf3.sh,.\SetupScripts\ConfigureUbuntu1604IPv6.sh,.\$LogDir\Startiperf3tcpTest.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/Startiperf3tcpTest.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 iperf3tcpConsoleLogs.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 "/root/iperf3tcpConsoleLogs.txt"
$iperf3LogDir = "$LogDir\iperf3Data"
New-Item -itemtype directory -path $iperf3LogDir -Force -ErrorAction SilentlyContinue | Out-Null
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $iperf3LogDir -files "iperf-client-tcp*"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $iperf3LogDir -files "iperf-server-tcp*"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "VM_properties.csv"
$testSummary = $null
#region START tcp ANALYSIS
$clientfolder = $iperf3LogDir
$serverfolder = $iperf3LogDir
#clientData
$files = Get-ChildItem -Path $clientfolder
$FinalClientThroughputArr=@()
$FinalServerThroughputArr=@()
$FinalServerClientTCPResultObjArr = @()
function GetTCPDataObject()
{
$objNode = New-Object -TypeName PSObject
Add-Member -InputObject $objNode -MemberType NoteProperty -Name BufferSize -Value $null -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name Connections -Value $null -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name ClientTxGbps -Value $null -Force
return $objNode
}
foreach ( $Buffer in $testBuffers )
{
foreach ( $connection in $testConnections )
{
$currentResultObj = GetTCPDataObject
$currentConnectionClientTxGbps = 0
$currentConnectionClientTxGbpsArr = @()
$currentConnectionserverTxGbps = 0
$currentConnectionserverTxGbpsArr = @()
foreach ( $file in $files )
{
if ( $file.Name -imatch "iperf-client-tcp-IPv6-buffer-$($Buffer)K-conn-$connection-instance-*" )
{
$currentInstanceclientJsonText = $null
$currentInstanceclientJsonObj = $null
$currentInstanceClientPacketLoss = @()
$currentInstanceClientThroughput = $null
$fileName = $file.Name
try
{
$currentInstanceclientJsonText = ([string]( Get-Content "$clientfolder\$fileName")).Replace("-nan","0")
$currentInstanceclientJsonObj = ConvertFrom-Json -InputObject $currentInstanceclientJsonText
}
catch
{
LogErr " $fileName : RETURNED NULL"
}
if ( $currentInstanceclientJsonObj.end.sum_sent )
{
$currentInstanceClientThroughput = $currentInstanceclientJsonObj.end.sum_sent.bits_per_second/1000000000
LogMsg " $fileName : Data collected successfully."
}
else
{
$currentInstanceClientThroughput = $null
#Write-Host " $($currentJsonObj.error) $currentFileClientThroughput "
}
if($currentInstanceClientThroughput)
{
$currentConnectionClientTxGbpsArr += $currentInstanceClientThroughput
}
}
}
$currentConnectionClientTxGbps = [math]::Round((($currentConnectionClientTxGbpsArr | Measure-Object -Average).Average),2)
Write-Host "Client: $Buffer . $connection . $currentConnectionClientTxGbps"
$FinalClientThroughputArr += $currentConnectionClientTxGbps
$FinalClientTCPLossArr += $currentConnectionClientTCPLoss
$currentResultObj.BufferSize = $Buffer
$currentResultObj.Connections = $connection
$currentResultObj.ClientTxGbps = $currentConnectionClientTxGbps
$FinalServerClientTCPResultObjArr += $currentResultObj
Write-Host "-------------------------------"
}
}
#endregion
foreach ( $tcpResultObject in $FinalServerClientTCPResultObjArr )
{
$connResult="ClientTxGbps=$($tcpResultObject.ClientTxGbps)"
$metaData = "Buffer=$($tcpResultObject.BufferSize)K Connections=$($tcpResultObject.Connections)"
$resultSummary += CreateResultSummary -testResult $connResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
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 = "IPv6"
$ProtocolType = "TCP"
$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,NumberOfConnections,Throughput_Gbps,Latency_ms) VALUES "
foreach ($tcpResult in $FinalServerClientTCPResultObjArr)
{
$SQLQuery += "('$TestCaseName','$(Get-Date -Format yyyy-MM-dd)','$HostType','$HostBy','$HostOS','$GuestOSType','$GuestDistro','$GuestSize','$KernelVersion','$IPVersion','$ProtocolType','$($tcpResult.Connections)','$($tcpResult.ClientTxGbps)','0'),"
}
$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 = "iperf3tcp 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,392 @@
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.InternalIP)"
LogMsg " SSH Port : $($clientVMData.SSHPort)"
LogMsg "SERVER VM details :"
LogMsg " RoleName : $($serverVMData.RoleName)"
LogMsg " Public IP : $($serverVMData.InternalIP)"
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)
{
Add-Content -Value "$param" -Path $constantsFile
if ($param -imatch "bufferLenghs=")
{
$testBuffers= $param.Replace("bufferLenghs=(","").Replace(")","").Split(" ")
}
if ($param -imatch "connections=" )
{
$testConnections = $param.Replace("connections=(","").Replace(")","").Split(" ")
}
}
LogMsg "constanst.sh created successfully..."
LogMsg (Get-Content -Path $constantsFile)
#endregion
#region EXECUTE TEST
$myString = @"
cd /root/
./perf_iperf3.sh &> iperf3udpConsoleLogs.txt
. azuremodules.sh
collect_VM_properties
"@
Set-Content "$LogDir\Startiperf3udpTest.sh" $myString
RemoteCopy -uploadTo $clientVMData.PublicIP -port $clientVMData.SSHPort -files ".\$constantsFile,.\remote-scripts\azuremodules.sh,.\remote-scripts\perf_iperf3.sh,.\$LogDir\Startiperf3udpTest.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/Startiperf3udpTest.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 iperf3udpConsoleLogs.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 "/root/iperf3udpConsoleLogs.txt"
$iperf3LogDir = "$LogDir\iperf3Data"
New-Item -itemtype directory -path $iperf3LogDir -Force -ErrorAction SilentlyContinue | Out-Null
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $iperf3LogDir -files "iperf-client-udp*"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $iperf3LogDir -files "iperf-server-udp*"
RemoteCopy -downloadFrom $clientVMData.PublicIP -port $clientVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "VM_properties.csv"
$testSummary = $null
#region START UDP ANALYSIS
$clientfolder = $iperf3LogDir
$serverfolder = $iperf3LogDir
#clientData
$files = Get-ChildItem -Path $clientfolder
$FinalClientThroughputArr=@()
$FinalServerThroughputArr=@()
$FinalClientUDPLossArr=@()
$FinalServerUDPLossArr=@()
$FinalServerClientUDPResultObjArr = @()
function GetUDPDataObject()
{
$objNode = New-Object -TypeName PSObject
Add-Member -InputObject $objNode -MemberType NoteProperty -Name BufferSize -Value $null -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name Connections -Value $null -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name ClientTxGbps -Value $null -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name ServerRxGbps -Value $null -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name ThroughputDropPercent -Value $null -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name ClientUDPLoss -Value $null -Force
Add-Member -InputObject $objNode -MemberType NoteProperty -Name ServerUDPLoss -Value $null -Force
return $objNode
}
foreach ( $Buffer in $testBuffers )
{
foreach ( $connection in $testConnections )
{
$currentResultObj = GetUDPDataObject
$currentConnectionClientTxGbps = 0
$currentConnectionClientTxGbpsArr = @()
$currentConnectionClientUDPLoss = 0
$currentConnectionClientUDPLossArr = @()
$currentConnectionserverTxGbps = 0
$currentConnectionserverTxGbpsArr = @()
$currentConnectionserverUDPLoss = 0
$currentConnectionserverUDPLossArr = @()
foreach ( $file in $files )
{
#region Get Client data...
if ( $file.Name -imatch "iperf-client-udp-IPv4-buffer-$($Buffer)K-conn-$connection-instance-*" )
{
$currentInstanceclientJsonText = $null
$currentInstanceclientJsonObj = $null
$currentInstanceClientPacketLoss = @()
$currentInstanceClientThroughput = $null
$fileName = $file.Name
try
{
$currentInstanceclientJsonText = ([string]( Get-Content "$clientfolder\$fileName")).Replace("-nan","0")
$currentInstanceclientJsonObj = ConvertFrom-Json -InputObject $currentInstanceclientJsonText
}
catch
{
LogErr " $fileName : RETURNED NULL"
}
if ( $currentInstanceclientJsonObj.end.sum.lost_percent )
{
$currentConnectionClientUDPLossArr += $currentInstanceclientJsonObj.end.sum.lost_percent
$currentConnCurrentInstanceAllIntervalThroughputArr = @()
foreach ( $interval in $currentInstanceclientJsonObj.intervals )
{
$currentConnCurrentInstanceAllIntervalThroughputArr += $interval.sum.bits_per_second
}
$currentInstanceClientThroughput = (((($currentConnCurrentInstanceAllIntervalThroughputArr | Measure-Object -Average).Average))/1000000000)
$outOfOrderPackats = ([regex]::Matches($currentInstanceclientJsonText, "OUT OF ORDER" )).count
if ( $outOfOrderPackats -gt 0 )
{
LogErr " $fileName : ERROR: $outOfOrderPackats PACKETS ARRIVED OUT OF ORDER"
}
LogMsg " $fileName : Data collected successfully."
}
else
{
$currentInstanceClientThroughput = $null
#Write-Host " $($currentJsonObj.error) $currentFileClientThroughput "
}
if($currentInstanceClientThroughput)
{
$currentConnectionClientTxGbpsArr += $currentInstanceClientThroughput
}
}
#endregion
#region Get Server data...
if ( $file.Name -imatch "iperf-server-udp-IPv4-buffer-$($Buffer)K-conn-$connection-instance-*" )
{
$currentInstanceserverJsonText = $null
$currentInstanceserverJsonObj = $null
$currentInstanceserverPacketLoss = @()
$currentInstanceserverThroughput = $null
$fileName = $file.Name
try
{
$currentInstanceserverJsonText = ([string]( Get-Content "$serverfolder\$fileName")).Replace("-nan","0")
$currentInstanceserverJsonObj = ConvertFrom-Json -InputObject $currentInstanceserverJsonText
}
catch
{
LogErr " $fileName : RETURNED NULL"
}
if ( $currentInstanceserverJsonObj.end.sum.lost_percent )
{
$currentConnectionserverUDPLossArr += $currentInstanceserverJsonObj.end.sum.lost_percent
$currentConnCurrentInstanceAllIntervalThroughputArr = @()
foreach ( $interval in $currentInstanceserverJsonObj.intervals )
{
$currentConnCurrentInstanceAllIntervalThroughputArr += $interval.sum.bits_per_second
}
$currentInstanceserverThroughput = (((($currentConnCurrentInstanceAllIntervalThroughputArr | Measure-Object -Average).Average))/1000000000)
$outOfOrderPackats = ([regex]::Matches($currentInstanceserverJsonText, "OUT OF ORDER" )).count
if ( $outOfOrderPackats -gt 0 )
{
LogErr " $fileName : ERROR: $outOfOrderPackats PACKETS ARRIVED OUT OF ORDER"
}
LogMsg " $fileName : Data collected successfully."
}
else
{
$currentInstanceserverThroughput = $null
LogErr " $fileName : $($currentInstanceserverJsonObj.error)"
}
if($currentInstanceserverThroughput)
{
$currentConnectionserverTxGbpsArr += $currentInstanceserverThroughput
}
}
#endregion
}
$currentConnectionClientTxGbps = [math]::Round((($currentConnectionClientTxGbpsArr | Measure-Object -Average).Average),2)
$currentConnectionClientUDPLoss = [math]::Round((($currentConnectionClientUDPLossArr | Measure-Object -Average).Average),2)
Write-Host "Client: $Buffer . $connection . $currentConnectionClientTxGbps .$currentConnectionClientUDPLoss"
$FinalClientThroughputArr += $currentConnectionClientTxGbps
$FinalClientUDPLossArr += $currentConnectionClientUDPLoss
$currentConnectionserverTxGbps = [math]::Round((($currentConnectionserverTxGbpsArr | Measure-Object -Average).Average),2)
$currentConnectionserverUDPLoss = [math]::Round((($currentConnectionserverUDPLossArr | Measure-Object -Average).Average),2)
Write-Host "Server: $Buffer . $connection . $currentConnectionserverTxGbps .$currentConnectionserverUDPLoss"
$FinalServerThroughputArr += $currentConnectionserverTxGbps
$FinalServerUDPLossArr += $currentConnectionserverUDPLoss
$currentResultObj.BufferSize = $Buffer
$currentResultObj.Connections = $connection
$currentResultObj.ClientTxGbps = $currentConnectionClientTxGbps
$currentResultObj.ClientUDPLoss = $currentConnectionClientUDPLoss
if ( $currentConnectionClientTxGbps -ne 0 )
{
if ( $currentConnectionClientTxGbps -ge $currentConnectionserverTxGbps )
{
$currentResultObj.ThroughputDropPercent = [math]::Round(((($currentConnectionClientTxGbps-$currentConnectionserverTxGbps)*100)/$currentConnectionClientTxGbps),2)
}
else
{
$currentResultObj.ThroughputDropPercent = 0
}
}
else
{
$currentResultObj.ThroughputDropPercent = 0
}
$currentResultObj.ServerRxGbps = $currentConnectionserverTxGbps
$currentResultObj.ServerUDPLoss = $currentConnectionserverUDPLoss
$FinalServerClientUDPResultObjArr += $currentResultObj
Write-Host "-------------------------------"
}
}
#endregion
foreach ( $udpResultObject in $FinalServerClientUDPResultObjArr )
{
$connResult="ClientTxGbps=$($udpResultObject.ClientTxGbps) ServerRxGbps=$($udpResultObject.ServerRxGbps) UDPLoss=$($udpResultObject.ClientUDPLoss)%"
$metaData = "Buffer=$($udpResultObject.BufferSize)K Connections=$($udpResultObject.Connections)"
$resultSummary += CreateResultSummary -testResult $connResult -metaData $metaData -checkValues "PASS,FAIL,ABORTED" -testName $currentTestData.testName
}
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 to DB STARTED.."
$dataSource = $xmlConfig.config.Azure.database.server
$dbuser = $xmlConfig.config.Azure.database.user
$dbpassword = $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 $dbuser -And $dbpassword -And $database -And $dataTableName)
{
$GuestDistro = cat "$LogDir\VM_properties.csv" | Select-String "OS type"| %{$_ -replace ",OS type,",""}
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 = $($currentTestData.TestType)
$connectionString = "Server=$dataSource;uid=$dbuser; pwd=$dbpassword;Database=$database;Encrypt=yes;TrustServerCertificate=no;Connection Timeout=30;"
$SQLQuery = "INSERT INTO $dataTableName (TestCaseName,TestDate,HostType,HostBy,HostOS,GuestOSType,GuestDistro,GuestSize,KernelVersion,IPVersion,ProtocolType,SendBufSize_KBytes,NumberOfConnections,TxThroughput_Gbps,RxThroughput_Gbps,DatagramLoss) VALUES "
foreach ( $udpResultObject in $FinalServerClientUDPResultObjArr )
{
$SQLQuery += "('$TestCaseName','$(Get-Date -Format yyyy-MM-dd)','$HostType','$HostBy','$HostOS','$GuestOSType','$GuestDistro','$GuestSize','$KernelVersion','$IPVersion','UDP','$($udpResultObject.BufferSize)','$($udpResultObject.Connections)','$($udpResultObject.ClientTxGbps)','$($udpResultObject.ServerRxGbps)','$($udpResultObject.ClientUDPLoss)'),"
}
$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 to DB DONE!!"
}
else
{
LogMsg "Invalid database details. Failed to upload result to database!"
}
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = "iperf3udp 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

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

@ -1,4 +1,4 @@
#author - vhisav@microsoft.com
#author - vhisav@microsoft.com
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
@ -23,7 +23,7 @@ if ($isDeployed)
}
elseif (( $vmData.RoleName -imatch "Client" ) -or ( $vmData.RoleName -imatch "slave" ))
{
$clientMachines = $vmData
$clientMachines += $vmData
$noSlave = $fase
if ( $slaveHostnames )
{
@ -56,7 +56,8 @@ if ($isDeployed)
LogMsg "CLIENT VM #$i details :"
LogMsg " RoleName : $($clientVMData.RoleName)"
LogMsg " Public IP : $($clientVMData.PublicIP)"
LogMsg " SSH Port : $($clientVMData.SSHPort)"
LogMsg " SSH Port : $($clientVMData.SSHPort)"
$i += 1
}
#
# PROVISION VMS FOR LISA WILL ENABLE ROOT USER AND WILL MAKE ENABLE PASSWORDLESS AUTHENTICATION ACROSS ALL VMS IN SAME HOSTED SERVICE.
@ -66,32 +67,10 @@ if ($isDeployed)
#endregion
#region Verfiy
#region Provision VMs for RDMA tests
#region Generate constants.sh
LogMsg "Generating constansts.sh ..."
$constantsFile = ".\$LogDir\constants.sh"
Set-Content -Value "master=`"$($serverVMData.RoleName)`"" -Path $constantsFile
LogMsg "master=$($serverVMData.RoleName) added to constansts.sh"
Add-Content -Value "slaves=`"$slaveHostnames`"" -Path $constantsFile
LogMsg "slaves=$slaveHostnames added to constansts.sh"
Add-Content -Value "rdmaPrepare=`"yes`"" -Path $constantsFile
LogMsg "rdmaPrepare=yes added to constansts.sh"
Add-Content -Value "rdmaRun=`"no`"" -Path $constantsFile
LogMsg "rdmaRun=no added to constansts.sh"
Add-Content -Value "installLocal=`"yes`"" -Path $constantsFile
LogMsg "installLocal=yes added to constansts.sh"
LogMsg "constanst.sh created successfully..."
#endregion
#region Generate etc-hosts.txt file
$hostsFile = ".\$LogDir\etc-hosts.txt"
foreach ( $vmDetails in $allVMData )
@ -111,202 +90,245 @@ if ($isDeployed)
#region Install LIS-RDMA drivers..
$osRelease = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "cat /etc/*release*"
if ( $osRelease -imatch "CentOS Linux release 7.1.")
$modinfo_hv_vmbus = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "modinfo hv_vmbus"
if (!( $modinfo_hv_vmbus -imatch "microsoft-hyper-v-rdma" ))
{
$LIS4folder = "RHEL71"
}
if ( $osRelease -imatch "CentOS Linux release 7.0.")
{
$LIS4folder = "RHEL70"
}
if ( $osRelease -imatch "CentOS Linux release 6.5")
{
$LIS4folder = "RHEL65"
}
$lisRDMAFileUrl = "https://ciwestus.blob.core.windows.net/linuxbinaries/lis-4.0.11-RDMA.tar"
Set-Content -Value "tar -xf lis-4.0.11-RDMA.tar" -Path "$LogDir\InstallLIS.sh"
Add-Content -Value "chmod +x $LIS4folder/install.sh" -Path "$LogDir\InstallLIS.sh"
Add-Content -Value "cd $LIS4folder" -Path "$LogDir\InstallLIS.sh"
Add-Content -Value "./install.sh > /root/LIS4InstallStatus.txt 2>&1" -Path "$LogDir\InstallLIS.sh"
$LIS4IntallCommand = "./InstallLIS.sh"
$LIS4InstallJobs = @()
foreach ( $vm in $allVMData )
{
#Install LIS4 RDMA drivers...
LogMsg "Setting contents of /etc/security/limits.conf..."
$out = .\tools\dos2unix.exe ".\$LogDir\limits.conf" 2>&1
LogMsg $out
RemoteCopy -uploadTo $vm.PublicIP -port $vm.SSHPort -files ".\$LogDir\limits.conf,.\$LogDir\InstallLIS.sh" -username "root" -password $password -upload
$out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "cat limits.conf >> /etc/security/limits.conf"
#region Generate constants.sh
LogMsg "Downlaoding LIS-RDMA drivers in $($vm.RoleName)..."
$out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "wget $lisRDMAFileUrl"
$out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "chmod +x InstallLIS.sh"
LogMsg "Executing $LIS4IntallCommand ..."
$jobID = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "$LIS4IntallCommand" -RunInBackground
$LIS4InstallObj = New-Object PSObject
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name ID -Value $jobID
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name RoleName -Value $vm.RoleName
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name PublicIP -Value $vm.PublicIP
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name SSHPort -Value $vm.SSHPort
$LIS4InstallJobs += $LIS4InstallObj
}
LogMsg "Generating constansts.sh ..."
$constantsFile = ".\$LogDir\constants.sh"
#Monitor LIS installation...
$LIS4InstallJobsRunning = $true
$lisInstallErrorCount = 0
while ($LIS4InstallJobsRunning)
{
$LIS4InstallJobsRunning = $false
foreach ( $job in $LIS4InstallJobs )
Set-Content -Value "master=`"$($serverVMData.RoleName)`"" -Path $constantsFile
LogMsg "master=$($serverVMData.RoleName) added to constansts.sh"
Add-Content -Value "slaves=`"$slaveHostnames`"" -Path $constantsFile
LogMsg "slaves=$slaveHostnames added to constansts.sh"
Add-Content -Value "rdmaPrepare=`"yes`"" -Path $constantsFile
LogMsg "rdmaPrepare=yes added to constansts.sh"
Add-Content -Value "rdmaRun=`"no`"" -Path $constantsFile
LogMsg "rdmaRun=no added to constansts.sh"
Add-Content -Value "installLocal=`"yes`"" -Path $constantsFile
LogMsg "installLocal=yes added to constansts.sh"
LogMsg "constanst.sh created successfully..."
#endregion
if ( $osRelease -imatch "CentOS Linux release 7.1.")
{
if ( (Get-Job -Id $($job.ID)).State -eq "Running" )
$LIS4folder = "RHEL71"
}
if ( $osRelease -imatch "CentOS Linux release 7.0.")
{
$LIS4folder = "RHEL70"
}
if ( $osRelease -imatch "CentOS Linux release 6.5")
{
$LIS4folder = "RHEL65"
}
$lisRDMAFileUrl = "https://ciwestus.blob.core.windows.net/linuxbinaries/lis-4.0.11-RDMA.tar"
Set-Content -Value "tar -xf lis-4.0.11-RDMA.tar" -Path "$LogDir\InstallLIS.sh"
Add-Content -Value "chmod +x $LIS4folder/install.sh" -Path "$LogDir\InstallLIS.sh"
Add-Content -Value "cd $LIS4folder" -Path "$LogDir\InstallLIS.sh"
Add-Content -Value "./install.sh > /root/LIS4InstallStatus.txt 2>&1" -Path "$LogDir\InstallLIS.sh"
$LIS4IntallCommand = "./InstallLIS.sh"
$LIS4InstallJobs = @()
foreach ( $vm in $allVMData )
{
#Install LIS4 RDMA drivers...
LogMsg "Setting contents of /etc/security/limits.conf..."
$out = .\tools\dos2unix.exe ".\$LogDir\limits.conf" 2>&1
LogMsg $out
RemoteCopy -uploadTo $vm.PublicIP -port $vm.SSHPort -files ".\$LogDir\limits.conf,.\$LogDir\InstallLIS.sh" -username "root" -password $password -upload
$out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "cat limits.conf >> /etc/security/limits.conf"
LogMsg "Downlaoding LIS-RDMA drivers in $($vm.RoleName)..."
$out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "wget $lisRDMAFileUrl"
$out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "chmod +x InstallLIS.sh"
LogMsg "Executing $LIS4IntallCommand ..."
$jobID = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "$LIS4IntallCommand" -RunInBackground
$LIS4InstallObj = New-Object PSObject
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name ID -Value $jobID
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name RoleName -Value $vm.RoleName
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name PublicIP -Value $vm.PublicIP
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name SSHPort -Value $vm.SSHPort
$LIS4InstallJobs += $LIS4InstallObj
}
#Monitor LIS installation...
$LIS4InstallJobsRunning = $true
$lisInstallErrorCount = 0
while ($LIS4InstallJobsRunning)
{
$LIS4InstallJobsRunning = $false
foreach ( $job in $LIS4InstallJobs )
{
LogMsg "lis-4.0.11-RDMA Installation Status for $($job.RoleName) : Running"
$LIS4InstallJobsRunning = $true
}
else
{
$jobOut = Receive-Job -ID $($job.ID)
$LIS4out = RunLinuxCmd -ip $job.PublicIP -port $job.SSHPort -username "root" -password $password -command "cat LIS4InstallStatus.txt"
if ( $LIS4out -imatch "Please reboot your system")
if ( (Get-Job -Id $($job.ID)).State -eq "Running" )
{
LogMsg "lis-4.0.11-RDMA installed successfully for $($job.RoleName)"
LogMsg "lis-4.0.11-RDMA Installation Status for $($job.RoleName) : Running"
$LIS4InstallJobsRunning = $true
}
else
{
#LogErr "LIS-rdma installation failed $($job.RoleName)"
#$lisInstallErrorCount += 1
$jobOut = Receive-Job -ID $($job.ID)
$LIS4out = RunLinuxCmd -ip $job.PublicIP -port $job.SSHPort -username "root" -password $password -command "cat LIS4InstallStatus.txt"
if ( $LIS4out -imatch "Please reboot your system")
{
LogMsg "lis-4.0.11-RDMA installed successfully for $($job.RoleName)"
}
else
{
#LogErr "LIS-rdma installation failed $($job.RoleName)"
#$lisInstallErrorCount += 1
}
}
}
}
if ( $LIS4InstallJobsRunning )
{
WaitFor -seconds 10
}
#else
#{
# if ( $lisInstallErrorCount -ne 0 )
# {
# Throw "LIS-rdma installation failed for some VMs.Aborting Test."
# }
#}
}
if ( $LIS4InstallJobsRunning )
{
WaitFor -seconds 10
}
#else
#{
# if ( $lisInstallErrorCount -ne 0 )
# {
# Throw "LIS-rdma installation failed for some VMs.Aborting Test."
# }
#}
}
$isRestarted = RestartAllDeployments -allVMData $allVMData
if ( ! $isRestarted )
{
Throw "Failed to restart deployments in $isDeployed. Aborting Test."
}
#endregion
#region Prepare VMs for test
$packageInstallJobs = @()
Set-Content -Value "/root/TestRDMA.sh &> prepareForRDMAConsole.txt" -Path "$LogDir\PrepareForRDMA.sh"
$packageIntallCommand = "/root/PrepareForRDMA.sh"
foreach ( $vm in $allVMData )
{
#Install Intel and IBM MPI libraries...
RemoteCopy -uploadTo $vm.PublicIP -port $vm.SSHPort -files "$constantsFile,$hostsFile,.\remote-scripts\TestRDMA.sh,.\$LogDir\PrepareForRDMA.sh" -username "root" -password $password -upload
$jobID = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "chmod +x PrepareForRDMA.sh"
LogMsg "Executing $packageIntallCommand ..."
$jobID = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "$packageIntallCommand" -RunInBackground
$packageInstallObj = New-Object PSObject
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name ID -Value $jobID
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name RoleName -Value $vm.RoleName
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name PublicIP -Value $vm.PublicIP
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name SSHPort -Value $vm.SSHPort
$packageInstallJobs += $packageInstallObj
}
$packageInstallJobsRunning = $true
$packageInstallErrorCount = 0
while ($packageInstallJobsRunning)
{
$packageInstallJobsRunning = $false
foreach ( $job in $packageInstallJobs )
$isRestarted = RestartAllDeployments -allVMData $allVMData
if ( ! $isRestarted )
{
if ( (Get-Job -Id $($job.ID)).State -eq "Running" )
Throw "Failed to restart deployments in $isDeployed. Aborting Test."
}
#region Prepare VMs for test
$packageInstallJobs = @()
Set-Content -Value "/root/TestRDMA.sh &> prepareForRDMAConsole.txt" -Path "$LogDir\PrepareForRDMA.sh"
$packageIntallCommand = "/root/PrepareForRDMA.sh"
foreach ( $vm in $allVMData )
{
#Install Intel and IBM MPI libraries...
RemoteCopy -uploadTo $vm.PublicIP -port $vm.SSHPort -files "$constantsFile,$hostsFile,.\remote-scripts\TestRDMA.sh,.\$LogDir\PrepareForRDMA.sh" -username "root" -password $password -upload
$jobID = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "chmod +x PrepareForRDMA.sh"
LogMsg "Executing $packageIntallCommand ..."
$jobID = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "$packageIntallCommand" -RunInBackground
$packageInstallObj = New-Object PSObject
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name ID -Value $jobID
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name RoleName -Value $vm.RoleName
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name PublicIP -Value $vm.PublicIP
Add-member -InputObject $packageInstallObj -MemberType NoteProperty -Name SSHPort -Value $vm.SSHPort
$packageInstallJobs += $packageInstallObj
}
$packageInstallJobsRunning = $true
$packageInstallErrorCount = 0
while ($packageInstallJobsRunning)
{
$packageInstallJobsRunning = $false
foreach ( $job in $packageInstallJobs )
{
LogMsg "RDMA preparation Status for $($job.RoleName) : Running"
$packageInstallJobsRunning = $true
}
else
{
$jobOut = Receive-Job -ID $($job.ID)
if ( $jobOut -imatch "Please reboot your system")
if ( (Get-Job -Id $($job.ID)).State -eq "Running" )
{
LogMsg "RDMA preparation completed for $($job.RoleName)"
LogMsg "RDMA preparation Status for $($job.RoleName) : Running"
$packageInstallJobsRunning = $true
}
else
{
#LogErr "RDMA preparation failed $($job.RoleName)"
#$packageInstallErrorCount += 1
$jobOut = Receive-Job -ID $($job.ID)
if ( $jobOut -imatch "Please reboot your system")
{
LogMsg "RDMA preparation completed for $($job.RoleName)"
}
else
{
#LogErr "RDMA preparation failed $($job.RoleName)"
#$packageInstallErrorCount += 1
}
}
}
if ( $packageInstallJobsRunning )
{
WaitFor -seconds 10
}
#else
#{
# if ( $packageInstallErrorCount -ne 0 )
# {
# Throw "RDMA preparation failed for some VMs.Aborting Test."
# }
#}
}
if ( $packageInstallJobsRunning )
{
WaitFor -seconds 10
}
#else
#{
# if ( $packageInstallErrorCount -ne 0 )
# {
# Throw "RDMA preparation failed for some VMs.Aborting Test."
# }
#}
}
#endregion
}
else
{
LogMsg "RDMA LIS Drivers are already installed."
LogMsg $modinfo_hv_vmbus
LogMsg "Generating constansts.sh ..."
$constantsFile = ".\$LogDir\constants.sh"
Set-Content -Value "master=`"$($serverVMData.RoleName)`"" -Path $constantsFile
LogMsg "master=$($serverVMData.RoleName) added to constansts.sh"
Add-Content -Value "slaves=`"$slaveHostnames`"" -Path $constantsFile
LogMsg "slaves=$slaveHostnames added to constansts.sh"
Add-Content -Value "rdmaPrepare=`"no`"" -Path $constantsFile
LogMsg "rdmaPrepare=no added to constansts.sh"
Add-Content -Value "rdmaRun=`"yes`"" -Path $constantsFile
LogMsg "rdmaRun=yes added to constansts.sh"
LogMsg "constanst.sh created successfully..."
}
#endregion
Set-Content -Value "master=`"$($serverVMData.RoleName)`"" -Path $constantsFile
LogMsg "master=$($serverVMData.RoleName) added to constansts.sh"
Add-Content -Value "slaves=`"$slaveHostnames`"" -Path $constantsFile
LogMsg "slaves=$slaveHostnames added to constansts.sh"
Add-Content -Value "rdmaPrepare=`"no`"" -Path $constantsFile
LogMsg "rdmaPrepare=no added to constansts.sh"
Add-Content -Value "rdmaRun=`"yes`"" -Path $constantsFile
LogMsg "rdmaRun=yes added to constansts.sh"
Add-Content -Value "installLocal=`"no`"" -Path $constantsFile
LogMsg "installLocal=no added to constansts.sh"
LogMsg "constanst.sh created successfully..."
Set-Content -Value "/root/TestRDMA.sh &> rdmaConsole.txt" -Path "$LogDir\StartRDMA.sh"
#region EXECUTE TEST
RemoteCopy -uploadTo $serverVMData.PublicIP -port $serverVMData.SSHPort -files "$constantsFile,$LogDir\StartRDMA.sh" -username "root" -password $password -upload
$out = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh"
$testJob = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "/root/StartRDMA.sh" -RunInBackground
#endregion
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
if ( $modinfo_hv_vmbus -imatch "microsoft-hyper-v-rdma" )
{
$currentStatus = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "tail -n 1 /root/rdmaConsole.txt"
LogMsg "Current Test Staus : $currentStatus"
WaitFor -seconds 10
$testOut = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "/root/StartRDMA.sh"
}
else
{
#region EXECUTE TEST
$testJob = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "/root/StartRDMA.sh" -RunInBackground
#endregion
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
{
$currentStatus = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "tail -n 1 /root/rdmaConsole.txt"
LogMsg "Current Test Staus : $currentStatus"
WaitFor -seconds 10
}
}
RemoteCopy -downloadFrom $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/rdmaConsole.txt"
RemoteCopy -downloadFrom $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/summary.log"
RemoteCopy -downloadFrom $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/pingPongTestInterNodeTestOut.txt"
$finalStatus = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "cat /root/state.txt"
$rdmaSummary = Get-Content -Path "$LogDir\summary.log" -ErrorAction SilentlyContinue
if ($finalStatus -imatch "TestCompleted")
{
LogMsg "Test finished successfully. Please check $LogDir\rdmaConsole.txt for detailed results."
LogMsg "Test finished successfully."
$pingPongInterNodeTestOut = ( Get-Content -Path "$LogDir\pingPongTestInterNodeTestOut.txt" | Out-String )
LogMsg $pingPongInterNodeTestOut
}
else
{
LogErr "Test did not finished successfully. Please check $LogDir\rdmaConsole.txt for detailed results."
@ -345,7 +367,7 @@ if ($isDeployed)
}
Finally
{
$metaData = "Status"
$metaData = "PingPong"
if (!$testResult)
{
$testResult = "Aborted"
@ -367,4 +389,4 @@ $result = GetFinalResultHeader -resultarr $resultArr
DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
#Return the result and summery to the test suite script..
return $result, $resultSummary
return $result, $resultSummary

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

@ -1,25 +1,23 @@
#author - vhisav@microsoft.com
#author - vhisav@microsoft.com
Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
#$isDeployed = "ICA-HS-M1S1-sscent71p-4-7-19-21-28"
if ($isDeployed)
{
try
{
$allVMData = GetAllDeployementData -DeployedServices $isDeployed
$noServer = $true
$noServer = $true
$noClient = $true
$clientMachines = @()
$slaveHostnames = ""
$clientMachines = @()
$slaveHostnames = ""
foreach ( $vmData in $allVMData )
{
if ( $vmData.RoleName -imatch "Server" )
{
$serverVMData = $vmData
$serverVMData = $vmData
$noServer = $false
}
@ -27,14 +25,14 @@ if ($isDeployed)
{
$clientMachines = $vmData
$noClient = $fase
if ( $slaveHostnames )
{
$slaveHostnames += "," + $vmData.RoleName
}
else
{
$slaveHostnames = $vmData.RoleName
}
if ( $slaveHostnames )
{
$slaveHostnames += "," + $vmData.RoleName
}
else
{
$slaveHostnames = $vmData.RoleName
}
}
}
if ( $noServer )
@ -52,28 +50,28 @@ if ($isDeployed)
LogMsg " RoleName : $($serverVMData.RoleName)"
LogMsg " Public IP : $($serverVMData.PublicIP)"
LogMsg " SSH Port : $($serverVMData.SSHPort)"
$i = 1
foreach ( $clientVMData in $clientMachines )
{
LogMsg "CLIENT VM #$i details :"
LogMsg " RoleName : $($clientVMData.RoleName)"
LogMsg " Public IP : $($clientVMData.PublicIP)"
LogMsg " SSH Port : $($clientVMData.SSHPort)"
}
$i = 1
foreach ( $clientVMData in $clientMachines )
{
LogMsg "CLIENT VM #$i details :"
LogMsg " RoleName : $($clientVMData.RoleName)"
LogMsg " Public IP : $($clientVMData.PublicIP)"
LogMsg " SSH Port : $($clientVMData.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
#region Provision VMs for RDMA tests
#region Provision VMs for RDMA tests
#region Generate constants.sh
#region Generate constants.sh
LogMsg "Generating constansts.sh ..."
$constantsFile = ".\$LogDir\constants.sh"
$constantsFile = ".\$LogDir\constants.sh"
#foreach ($testParam in $currentTestData.params )
#{
# Add-Content -Value "$testParam" -Path $constantsFile
@ -81,150 +79,184 @@ if ($isDeployed)
#}
Add-Content -Value "master=`"$($serverVMData.RoleName)`"" -Path $constantsFile
LogMsg "master=$($serverVMData.RoleName) added to constansts.sh"
LogMsg "master=$($serverVMData.RoleName) added to constansts.sh"
Add-Content -Value "slaves=`"$slaveHostnames`"" -Path $constantsFile
LogMsg "slaves=$slaveHostnames added to constansts.sh"
Add-Content -Value "rdmaPrepare=`"yes`"" -Path $constantsFile
LogMsg "rdmaPrepare=yes added to constansts.sh"
Add-Content -Value "slaves=`"$slaveHostnames`"" -Path $constantsFile
LogMsg "slaves=$slaveHostnames added to constansts.sh"
Add-Content -Value "rdmaRun=`"yes`"" -Path $constantsFile
LogMsg "rdmaRun=yes added to constansts.sh"
LogMsg "constanst.sh created successfully..."
#endregion
#endregion
#region Generate etc-hosts.txt file
$hostsFile = ".\$LogDir\etc-hosts.txt"
foreach ( $vmDetails in $allVMData )
{
Add-Content -Value "$($vmDetails.InternalIP)`t$($vmDetails.RoleName)" -Path "$hostsFile"
LogMsg "$($vmDetails.InternalIP)`t$($vmDetails.RoleName) added to etc-hosts.txt"
}
#endregion
#region Upload files to master VM...
Set-Content -Value "/root/TestRDMA.sh &> rdmaConsole.txt" -Path "$LogDir\StartRDMA.sh"
Set-Content -Value "* hard memlock unlimited" -Path "$LogDir\limits.conf"
Add-Content -Value "* soft memlock unlimited" -Path "$LogDir\limits.conf"
RemoteCopy -uploadTo $serverVMData.PublicIP -port $serverVMData.SSHPort -files "$constantsFile,$hostsFile,.\remote-scripts\TestRDMA.sh,.\$LogDir\StartRDMA.sh,.\$LogDir\limits.conf" -username "root" -password $password -upload
#endregion
#region Install LIS-RDMA drivers..
$osRelease = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "cat /etc/*release*"
if ( $osRelease -imatch "CentOS Linux release 7.1.")
{
$LIS4folder = "RHEL71"
}
if ( $osRelease -imatch "CentOS Linux release 7.0.")
{
$LIS4folder = "RHEL70"
}
if ( $osRelease -imatch "CentOS Linux release 6.5")
{
$LIS4folder = "RHEL65"
}
$LIS4IntallCommand = "tar -xf lis-4.0.11-RDMA.tar && chmod +x $LIS4folder/install.sh && cd $LIS4folder && ./install.sh"
$LIS4InstallJobs = @()
foreach ( $vm in $allVMData )
{
#Install LIS4 RDMA drivers...
LogMsg "Setting contents of /etc/security/limits.conf..."
$out = .\tools\dos2unix.exe ".\$LogDir\limits.conf" 2>&1
LogMsg $out
RemoteCopy -uploadTo $vm.PublicIP -port $vm.SSHPort -files ".\$LogDir\limits.conf" -username "root" -password $password -upload
$out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "cat limits.conf >> /etc/security/limits.conf"
LogMsg "Downlaoding LIS-RDMA drivers ..."
$out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "wget https://ciwestus.blob.core.windows.net/linuxbinaries/lis-4.0.11-RDMA.tar"
LogMsg "Executing $LIS4IntallCommand ..."
$jobID = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "$LIS4IntallCommand" -RunInBackground
$LIS4InstallObj = New-Object PSObject
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name ID -Value $jobID
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name RoleName -Value $vm.RoleName
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name PublicIP -Value $vm.PublicIP
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name SSHPort -Value $vm.SSHPort
$LIS4InstallJobs += $LIS4InstallObj
}
$LIS4InstallJobsRunning = $true
$lisInstallErrorCount = 0
while ($LIS4InstallJobsRunning)
{
$LIS4InstallJobsRunning = $false
foreach ( $job in $LIS4InstallJobs )
{
if ( (Get-Job -Id $($job.ID)).State -eq "Running" )
{
LogMsg "LIS4-rdma Installation Status for $($job.RoleName) : Running"
$LIS4InstallJobsRunning = $true
}
else
{
$jobOut = Receive-Job -ID $($job.ID)
if ( $jobOut -imatch "Please reboot your system")
{
LogMsg "LIS-rdma installed successfully for $($job.RoleName)"
}
else
{
#LogErr "LIS-rdma installation failed $($job.RoleName)"
#$lisInstallErrorCount += 1
}
}
}
if ( $LIS4InstallJobsRunning )
{
WaitFor -seconds 10
}
#else
#{
# if ( $lisInstallErrorCount -ne 0 )
# {
# Throw "LIS-rdma installation failed for some VMs.Aborting Test."
# }
#}
}
$isRestarted = RestartAllDeployments -allVMData $allVMData
if ( ! $isRestarted )
{
Throw "Failed to restart deployments in $isDeployed. Aborting Test."
}
#endregion
#region EXECUTE TEST
$out = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh"
$testJob = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "/root/StartRDMA.sh" -RunInBackground
#endregion
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
#region Generate etc-hosts.txt file
$hostsFile = ".\$LogDir\etc-hosts.txt"
foreach ( $vmDetails in $allVMData )
{
$currentStatus = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "tail -n 1 /root/rdmaConsole.txt"
LogMsg "Current Test Staus : $currentStatus"
WaitFor -seconds 10
Add-Content -Value "$($vmDetails.InternalIP)`t$($vmDetails.RoleName)" -Path "$hostsFile"
LogMsg "$($vmDetails.InternalIP)`t$($vmDetails.RoleName) added to etc-hosts.txt"
}
#endregion
#region Upload files to master VM...
Set-Content -Value "/root/TestRDMA.sh &> rdmaConsole.txt" -Path "$LogDir\StartRDMA.sh"
Set-Content -Value "* hard memlock unlimited" -Path "$LogDir\limits.conf"
Add-Content -Value "* soft memlock unlimited" -Path "$LogDir\limits.conf"
$out = .\tools\dos2unix.exe "$LogDir\limits.conf" 2>&1
LogMsg $out
RemoteCopy -uploadTo $serverVMData.PublicIP -port $serverVMData.SSHPort -files "$constantsFile,$hostsFile,.\remote-scripts\TestRDMA.sh,.\$LogDir\StartRDMA.sh,.\$LogDir\limits.conf" -username "root" -password $password -upload
#endregion
#region Install LIS-RDMA drivers..
$osRelease = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "cat /etc/*release*" -ignoreLinuxExitCode
$modinfo_hv_vmbus = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "lsmod | grep hv_network_direct"
if (!( $modinfo_hv_vmbus -imatch "hv_network_direct" ))
{
LogMsg "RDMA LIS Drivers not installed. RDMA drivers will be installed now..."
LogMsg $modinfo_hv_vmbus
Add-Content -Value "rdmaPrepare=`"yes`"" -Path $constantsFile
LogMsg "rdmaPrepare=yes added to constansts.sh"
if ( $osRelease -imatch "CentOS Linux release 7.1.")
{
$LIS4folder = "RHEL71"
}
if ( $osRelease -imatch "CentOS Linux release 7.0.")
{
$LIS4folder = "RHEL70"
}
if ( $osRelease -imatch "CentOS Linux release 6.5")
{
$LIS4folder = "RHEL65"
}
$LIS4IntallCommand = "tar -xf lis-4.0.11-RDMA.tar && chmod +x $LIS4folder/install.sh && cd $LIS4folder && ./install.sh"
$LIS4InstallJobs = @()
foreach ( $vm in $allVMData )
{
#Install LIS4 RDMA drivers...
LogMsg "Setting contents of /etc/security/limits.conf..."
$out = .\tools\dos2unix.exe ".\$LogDir\limits.conf" 2>&1
LogMsg $out
RemoteCopy -uploadTo $vm.PublicIP -port $vm.SSHPort -files ".\$LogDir\limits.conf" -username "root" -password $password -upload
$out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "cat limits.conf >> /etc/security/limits.conf"
LogMsg "Downlaoding LIS-RDMA drivers ..."
$out = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "wget https://ciwestus.blob.core.windows.net/linuxbinaries/lis-4.0.11-RDMA.tar"
LogMsg "Executing $LIS4IntallCommand ..."
$jobID = RunLinuxCmd -ip $vm.PublicIP -port $vm.SSHPort -username "root" -password $password -command "$LIS4IntallCommand" -RunInBackground
$LIS4InstallObj = New-Object PSObject
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name ID -Value $jobID
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name RoleName -Value $vm.RoleName
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name PublicIP -Value $vm.PublicIP
Add-member -InputObject $LIS4InstallObj -MemberType NoteProperty -Name SSHPort -Value $vm.SSHPort
$LIS4InstallJobs += $LIS4InstallObj
}
$LIS4InstallJobsRunning = $true
$lisInstallErrorCount = 0
while ($LIS4InstallJobsRunning)
{
$LIS4InstallJobsRunning = $false
foreach ( $job in $LIS4InstallJobs )
{
if ( (Get-Job -Id $($job.ID)).State -eq "Running" )
{
LogMsg "LIS4-rdma Installation Status for $($job.RoleName) : Running"
$LIS4InstallJobsRunning = $true
}
else
{
$jobOut = Receive-Job -ID $($job.ID)
if ( $jobOut -imatch "Please reboot your system")
{
LogMsg "LIS-rdma installed successfully for $($job.RoleName)"
}
else
{
#LogErr "LIS-rdma installation failed $($job.RoleName)"
#$lisInstallErrorCount += 1
}
}
}
if ( $LIS4InstallJobsRunning )
{
WaitFor -seconds 10
}
#else
#{
# if ( $lisInstallErrorCount -ne 0 )
# {
# Throw "LIS-rdma installation failed for some VMs.Aborting Test."
# }
#}
}
$isRestarted = RestartAllDeployments -allVMData $allVMData
if ( ! $isRestarted )
{
Throw "Failed to restart deployments in $isDeployed. Aborting Test."
}
}
else
{
LogMsg "RDMA LIS Drivers are already installed."
LogMsg $modinfo_hv_vmbus
Add-Content -Value "rdmaPrepare=`"no`"" -Path $constantsFile
LogMsg "rdmaPrepare=no added to constansts.sh"
}
#endregion
RemoteCopy -uploadTo $serverVMData.PublicIP -port $serverVMData.SSHPort -files "$constantsFile" -username "root" -password $password -upload
$out = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "chmod +x *.sh"
if ( $modinfo_hv_vmbus -imatch "microsoft-hyper-v-rdma" )
{
$testOut = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "/root/StartRDMA.sh"
}
else
{
#region EXECUTE TEST
$testJob = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "/root/StartRDMA.sh" -RunInBackground
#endregion
#region MONITOR TEST
while ( (Get-Job -Id $testJob).State -eq "Running" )
{
$currentStatus = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "tail -n 1 /root/rdmaConsole.txt"
LogMsg "Current Test Staus : $currentStatus"
WaitFor -seconds 10
}
}
RemoteCopy -downloadFrom $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/rdmaConsole.txt"
RemoteCopy -downloadFrom $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/summary.log"
RemoteCopy -downloadFrom $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/pingPongTestIntraNodeTestOut.txt"
RemoteCopy -downloadFrom $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/root/pingPongTestInterNodeTestOut.txt"
RemoteCopy -downloadFrom $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/var/log/waagent.log"
$out= RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "dmesg > /var/log/dmesg.txt"
RemoteCopy -downloadFrom $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -download -downloadTo $LogDir -files "/var/log/dmesg.txt"
$finalStatus = RunLinuxCmd -ip $serverVMData.PublicIP -port $serverVMData.SSHPort -username "root" -password $password -command "cat /root/state.txt"
$rdmaSummary = Get-Content -Path "$LogDir\summary.log" -ErrorAction SilentlyContinue
if ($finalStatus -imatch "TestCompleted")
{
LogMsg "Test finished successfully. Please check $LogDir\rdmaConsole.txt for detailed results."
LogMsg "Test finished successfully."
LogMsg "PINGPONG INTRA NODE TEST OUTPUT-"
$pingPongTestIntraNodeTestOut = ( Get-Content -Path "$LogDir\pingPongTestIntraNodeTestOut.txt" | Out-String )
LogMsg $pingPongTestIntraNodeTestOut
LogMsg "PINGPONG INTER NODE TEST OUTPUT-"
$pingPongTestInterNodeTestOut = ( Get-Content -Path "$LogDir\pingPongTestInterNodeTestOut.txt" | Out-String )
LogMsg $pingPongTestInterNodeTestOut
}
else
{
LogErr "Test did not finished successfully. Please check $LogDir\rdmaConsole.txt for detailed results."
}
else
{
LogErr "Test did not finished successfully. Please check $LogDir\rdmaConsole.txt for detailed results."
}
#endregion
@ -259,7 +291,7 @@ if ($isDeployed)
}
Finally
{
$metaData = "Status"
$metaData = "PingPong"
if (!$testResult)
{
$testResult = "Aborted"
@ -281,4 +313,4 @@ $result = GetFinalResultHeader -resultarr $resultArr
DoTestCleanUp -result $result -testName $currentTestData.testName -deployedServices $isDeployed -ResourceGroups $isDeployed
#Return the result and summery to the test suite script..
return $result, $resultSummary
return $result, $resultSummary

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

@ -9,6 +9,8 @@
vm_type=$1
username=$2
server_ip=$3
testtype=$4
buffersize=$5
code_path="/home/$username/code"
error_file="$code_path/error_file.log"
@ -16,13 +18,13 @@ testcommand=""
if [ "$vm_type" = "server" ]
then
testcommand="bash $code_path/server_start.sh $username >> $code_path/server.log&"
testcommand="bash $code_path/server_start.sh $username $testtype $buffersize >> $code_path/server.log&"
elif [ "$vm_type" = "client" ]
then
if [ "$#" -ne 3 ]; then
if [ "$#" -ne 5 ]; then
echo "Illegal number of parameters passed exiting..." >> $error_file
fi
testcommand="bash $code_path/client_start.sh $server_ip $username >> $code_path/client.log&"
testcommand="bash $code_path/client_start.sh $server_ip $username $testtype $buffersize >> $code_path/client.log&"
else
echo "Invalid arguments passed" >> $error_file
fi

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

@ -218,7 +218,7 @@ else
exit 10
fi
if [ ${installLocal} != "yes" ]; then
if [ "${installLocal}" != "yes" ]; then
if [ ! ${master} ]; then
errMsg="Please add/provide value for master in constants.sh. master=<Master VM hostname>"
LogMsg "${errMsg}"
@ -294,8 +294,29 @@ fi
if [ "${rdmaRun}" == "yes" ]
then
LogMsg "Executing test command : /opt/intel/impi/5.1.3.181/bin64/mpirun -hosts ${master},${slaves} -ppn 1 -n 2 -env I_MPI_FABRICS dapl -env I_MPI_DAPL_PROVIDER=ofa-v2-ib0 /opt/intel/impi/5.1.3.181/bin64/IMB-MPI1 pingpong > pingPongTestOut.txt 2>&1"
/opt/intel/impi/5.1.3.181/bin64/mpirun -hosts ${master},${slaves} -ppn 1 -n 2 -env I_MPI_FABRICS dapl -env I_MPI_DAPL_PROVIDER=ofa-v2-ib0 /opt/intel/impi/5.1.3.181/bin64/IMB-MPI1 pingpong > pingPongTestOut.txt 2>&1
mpirunPath=`find / -name mpirun | grep intel64`
imb_mpi1Path=`find / -name IMB-MPI1 | grep intel64`
service NetworkManager status
if [ $? -eq 0 ]; then
LogMsg "Info: NetworkManager is running. Stopping it."
service NetworkManager stop
sleep 5
service waagent restart
sleep 5
ssh root@${slaves} "service NetworkManager stop"
sleep 5
service waagent restart
ssh root@${slaves} "service waagent restart"
sleep 5
fi
LogMsg "Executing test command : ${mpirunPath} -hosts ${master},${slaves} -ppn 2 -n 2 -env I_MPI_FABRICS dapl -env I_MPI_DAPL_PROVIDER=ofa-v2-ib0 ${imb_mpi1Path} pingpong > pingPongTestIntraNodeTestOut.txt 2>&1"
#MPI-pingpong intra node
$mpirunPath -hosts ${master} -ppn 2 -n 2 -env I_MPI_FABRICS dapl -env I_MPI_DAPL_PROVIDER=ofa-v2-ib0 $imb_mpi1Path pingpong > pingPongTestIntraNodeTestOut.txt 2>&1
sleep 10
#MPI-pingpong inter node
LogMsg "Executing test command : $mpirunPath -hosts ${master},${slaves} -ppn 1 -n 2 -env I_MPI_FABRICS dapl -env I_MPI_DAPL_PROVIDER=ofa-v2-ib0 $imb_mpi1Path pingpong > pingPongTestInterNodeTestOut.txt 2>&1"
$mpirunPath -hosts ${master},${slaves} -ppn 1 -n 2 -env I_MPI_FABRICS dapl -env I_MPI_DAPL_PROVIDER=ofa-v2-ib0 $imb_mpi1Path pingpong > pingPongTestInterNodeTestOut.txt 2>&1
testExitCode=$?
if [ $testExitCode -ne 0 ]
then
@ -307,5 +328,4 @@ then
else
UpdateTestState $ICA_TESTCOMPLETED
fi
fi

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

@ -39,7 +39,16 @@ function check_exit_status ()
function detect_linux_ditribution_version()
{
local distro_version=`cat /etc/*release*|sed 's/"//g'|grep "VERSION_ID="| sed 's/VERSION_ID=//'| sed 's/\r//'`
local distro_version="Unknown"
if [ -f /etc/os-release ] ; then
distro_version=`cat /etc/os-release|sed 's/"//g'|grep "VERSION_ID="| sed 's/VERSION_ID=//'| sed 's/\r//'`
elif [ -f /etc/centos-release ] ; then
distro_version=`cat /etc/centos-release | sed s/.*release\ // | sed s/\ .*//`
elif [ -f /etc/oracle-release ] ; then
distro_version=`cat /etc/oracle-release | sed s/.*release\ // | sed s/\ .*//`
elif [ -f /etc/redhat-release ] ; then
distro_version=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
fi
echo $distro_version
}
@ -50,39 +59,38 @@ function detect_linux_ditribution()
if [ "$linux_ditribution" == "" ]
then
if echo "$temp_text" | grep -qi "ol"; then
linux_ditribution='oracle'
linux_ditribution='Oracle'
elif echo "$temp_text" | grep -qi "Ubuntu"; then
linux_ditribution='ubuntu'
linux_ditribution='Ubuntu'
elif echo "$temp_text" | grep -qi "SUSE Linux"; then
linux_ditribution='suse'
linux_ditribution='SUSE'
elif echo "$temp_text" | grep -qi "openSUSE"; then
linux_ditribution='opensuse'
linux_ditribution='OpenSUSE'
elif echo "$temp_text" | grep -qi "centos"; then
linux_ditribution='centos'
linux_ditribution='CentOS'
elif echo "$temp_text" | grep -qi "Oracle"; then
linux_ditribution='oracle'
linux_ditribution='Oracle'
elif echo "$temp_text" | grep -qi "Red Hat"; then
linux_ditribution='rhel'
linux_ditribution='RHEL'
else
linux_ditribution='unknown'
fi
fi
echo $linux_ditribution
echo "$(echo "$linux_ditribution" | sed 's/.*/\u&/')"
}
function updaterepos()
{
ditribution=$(detect_linux_ditribution)
case "$ditribution" in
oracle|rhel|centos)
Oracle|RHEL|CentOS)
yum makecache
;;
ubuntu)
Ubuntu)
apt-get update
;;
suse|opensuse|sles)
SUSE|openSUSE|sles)
zypper refresh
;;
@ -130,25 +138,28 @@ function zypper_install ()
function install_package ()
{
local package_name=$1
local package_name=$@
ditribution=$(detect_linux_ditribution)
case "$ditribution" in
oracle|rhel|centos)
yum_install $package_name
;;
for i in "${package_name[@]}"
do
case "$ditribution" in
Oracle|RHEL|CentOS)
yum_install "$package_name"
;;
ubuntu)
apt_get_install $package_name
;;
Ubuntu)
apt_get_install "$package_name"
;;
suse|opensuse|sles)
zypper_install $package_name
;;
SUSE|OpenSUSE|sles)
zypper_install "$package_name"
;;
*)
echo "Unknown ditribution"
return 1
esac
*)
echo "Unknown ditribution"
return 1
esac
done
}
function creat_partitions ()
@ -233,7 +244,7 @@ function remote_copy ()
if [ "x$host" == "x" ] || [ "x$user" == "x" ] || [ "x$passwd" == "x" ] || [ "x$filename" == "x" ] ; then
echo "Usage: remote_copy -user <username> -passwd <user password> -host <host ipaddress> -filename <filename> -remote_path <location of the file on remote vm> -cmd <put/get>"
exit -1
return
fi
if [ "$cmd" == "get" ] || [ "x$cmd" == "x" ]; then
@ -264,7 +275,7 @@ function remote_exec ()
if [ "x$host" == "x" ] || [ "x$user" == "x" ] || [ "x$passwd" == "x" ] || [ "x$cmd" == "x" ] ; then
echo "Usage: remote_exec -user <username> -passwd <user password> -host <host ipaddress> <onlycommand>"
exit -1
return
fi
status=`sshpass -p $passwd ssh -t -o StrictHostKeyChecking=no $user@$host $cmd 2>&1`
@ -290,7 +301,7 @@ function set_user_password {
if [ "x$string" == "x" ]
then
echo "$user not found in /etc/shadow"
return -1
return -1
fi
IFS=':' read -r -a array <<< "$string"
@ -320,11 +331,65 @@ function collect_VM_properties ()
fi
echo "" > $output_file
echo ",OS type,"`detect_linux_ditribution`-`detect_linux_ditribution_version` >> $output_file
echo ",OS type,"`detect_linux_ditribution` `detect_linux_ditribution_version` >> $output_file
echo ",Kernel version,"`uname -r` >> $output_file
echo ",Total CPU cores,"`nproc` >> $output_file
echo ",Memory,"`free -h| grep Mem| awk '{print $2}'` >> $output_file
echo ",LIS Version,"`get_lis_version` >> $output_file
echo ",Host Version,"`get_host_version` >> $output_file
echo ",Total CPU cores,"`nproc` >> $output_file
echo ",Total Memory,"`free -h|grep Mem|awk '{print $2}'` >> $output_file
echo ",Resource disks size,"`lsblk|grep "^sdb"| awk '{print $4}'` >> $output_file
echo ",Data disks attached,"`lsblk | grep "^sd" | awk '{print $1}' | sort | grep -v "sd[ab]$" | wc -l` >> $output_file
echo ",eth0 MTU,"`ifconfig eth0|grep MTU|sed "s/.*MTU:\(.*\) .*/\1/"` >> $output_file
echo ",eth1 MTU,"`ifconfig eth1|grep MTU|sed "s/.*MTU:\(.*\) .*/\1/"` >> $output_file
}
function keep_cmd_in_startup ()
{
testcommand=$*
startup_files="/etc/rc.d/rc.local /etc/rc.local /etc/SuSE-release"
count=0
for file in $startup_files
do
if [[ -f $file ]]
then
if ! grep -q "${testcommand}" $file
then
sed "/^\s*exit 0/i ${testcommand}" $file -i
if ! grep -q "${testcommand}" $file
then
echo $testcommand >> $file
fi
echo "Added $testcommand >> $file"
((count++))
fi
fi
done
if [ $count == 0 ]
then
echo "Cannot find $startup_files files"
fi
}
function remove_cmd_from_startup ()
{
testcommand=$*
startup_files="/etc/rc.d/rc.local /etc/rc.local /etc/SuSE-release"
count=0
for file in $startup_files
do
if [[ -f $file ]]
then
if grep -q "${testcommand}" $file
then
sed "s/${testcommand}//" $file -i
((count++))
echo "Removed $testcommand from $file"
fi
fi
done
if [ $count == 0 ]
then
echo "Cannot find $testcommand in $startup_files files"
fi
}

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

@ -0,0 +1,109 @@
#!/bin/bash
#
# This script build linuxnext .deb file.
# Author: Sivakanth Rebba
# Email : v-sirebb@microsoft.com
#
ICA_TESTRUNNING="TestRunning" # The test is running
ICA_TESTCOMPLETED="TestCompleted" # The test completed successfully
ICA_TESTABORTED="TestAborted" # Error during setup of test
ICA_TESTFAILED="TestFailed" # Error during running of test
CONSTANTS_FILE="constants.sh"
#username=`cat /var/log/cloud-init.log | grep Adding| sed "s/.*user //"`
username=$1
current_kernel=`uname -r`
code_path="/home/$username/code"
. $code_path/azuremodules.sh
LogMsg()
{
echo `date "+%a %b %d %T %Y"` : ${1} # To add the timestamp to the log file
}
UpdateTestState()
{
echo $1 > $code_path/state.txt
}
#
# Create the state.txt file so ICA knows we are running
#
LogMsg "Updating test case state to running"
UpdateTestState $ICA_TESTRUNNING
if [ -e $code_path/summary.log ]; then
LogMsg "Cleaning up previous copies of summary.log"
rm -f $code_path/summary.log
fi
echo "build not is started.. " > $code_path/build.log
cd $code_path
updaterepos
install_package git-core sysstat gcc make libssl-dev kernel-package
LogMsg "linux next git clone is RUNNING.."
git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
if [ $? -ne 0 ]; then
LogMsg "Error in linux next git clone"
echo "linux next git clone: Failed" >> $code_path/summary.log
UpdateTestState $ICA_TESTFAILED
exit 80
fi
cd linux-next
touch Documentation/Changes
## Make config file
LogMsg "Make .config file is RUNNING.."
cp /boot/config-$current_kernel .config
CONFIG_FILE=.config
yes "" | make oldconfig
if [ $? -ne 0 ]; then
LogMsg "Error in mkaing .config file"
echo "make .config: Failed" >> $code_path/summary.log
UpdateTestState $ICA_TESTFAILED
exit 80
fi
sed --in-place=.orig -e s:"# CONFIG_HYPERVISOR_GUEST is not set":"CONFIG_HYPERVISOR_GUEST=y\nCONFIG_HYPERV=y\nCONFIG_HYPERV_UTILS=y\nCONFIG_HYPERV_BALLOON=y\nCONFIG_HYPERV_STORAGE=y\nCONFIG_HYPERV_NET=y\nCONFIG_HYPERV_KEYBOARD=y\nCONFIG_FB_HYPERV=y\nCONFIG_HID_HYPERV_MOUSE=y": ${CONFIG_FILE}
sed --in-place -e s:"CONFIG_PREEMPT_VOLUNTARY=y":"# CONFIG_PREEMPT_VOLUNTARY is not set": ${CONFIG_FILE}
sed --in-place -e s:"# CONFIG_EXT4_FS is not set":"CONFIG_EXT4_FS=y\nCONFIG_EXT4_FS_XATTR=y\nCONFIG_EXT4_FS_POSIX_ACL=y\nCONFIG_EXT4_FS_SECURITY=y": ${CONFIG_FILE}
sed --in-place -e s:"# CONFIG_REISERFS_FS is not set":"CONFIG_REISERFS_FS=y\nCONFIG_REISERFS_PROC_INFO=y\nCONFIG_REISERFS_FS_XATTR=y\nCONFIG_REISERFS_FS_POSIX_ACL=y\nCONFIG_REISERFS_FS_SECURITY=y": ${CONFIG_FILE}
sed --in-place -e s:"# CONFIG_TULIP is not set":"CONFIG_TULIP=y\nCONFIG_TULIP_MMIO=y": ${CONFIG_FILE}
sed --in-place -e s:"CONFIG_STAGING=y":"# CONFIG_STAGING is not set": ${CONFIG_FILE} #becuase of a recent linux-next build error
yes "" | make oldconfig
if [ $? -ne 0 ]; then
LogMsg "Error in mkaing .config file"
echo "make .config: Failed" >> $code_path/summary.log
UpdateTestState $ICA_TESTFAILED
exit 80
fi
export CONCURRENCY_LEVEL=`nproc`
# Build and Install
LogMsg "build STARTED.."
echo "build STARTED.." >> $code_path/build.log
#make-kpkg --append-to-version=.0001 kernel-image --initrd > $code_path/build.log
make-kpkg kernel-image --initrd >> $code_path/build.log
if [ $? -ne 0 ]; then
LogMsg "Error in making kernel image linux next deb"
echo "making linux next deb package: Failed" >> $code_path/summary.log
UpdateTestState $ICA_TESTFAILED
exit 80
fi
#copy linux-next.deb to home directory
cp $code_path/linux-image*.deb /home/$username
LogMsg "Compressing log files.. "
cd $code_path; tar -cvf logs.tar *.*
#
# Let ICA know we completed successfully
#
LogMsg "Updating test case state to completed"
UpdateTestState $ICA_TESTCOMPLETED

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

@ -5,10 +5,19 @@
# Email : v-srm@microsoft.com
#
if [[ $# == 2 ]]
if [[ $# == 4 ]]
then
server_ip=$1
username=$2
testtype=$3
buffersize=$4
if [[ $testtype == "UDP" ]]
then
testtypeOption=" -u -b 0"
buffersizeOption=" -l $buffersize"
else
testtype=""
fi
else
echo "Usage: bash $0 <server_ip> <vm_loginuser>"
exit -1
@ -17,30 +26,70 @@ fi
code_path="/home/$username/code/"
. $code_path/azuremodules.sh
ICA_TESTRUNNING="TestRunning" # The test is running
ICA_TESTCOMPLETED="TestCompleted" # The test completed successfully
ICA_TESTABORTED="TestAborted" # Error during setup of test
ICA_TESTFAILED="TestFailed" # Error during running of test
LogMsg()
{
echo `date "+%a %b %d %T %Y"` : ${1} # To add the timestamp to the log file
}
UpdateTestState()
{
echo $1 > $code_path/state.txt
}
#
# Create the state.txt file so ICA knows we are running
#
LogMsg "Updating test case state to running"
UpdateTestState $ICA_TESTRUNNING
if [[ `which iperf3` == "" ]]
then
echo "iperf3 not installed\n Installing now..."
install_package "iperf3"
echo "iperf3 not installed\n Installing now..."
install_package "iperf3"
fi
echo "Sleeping 5 mins to get the server ready.."
sleep 300
port_number=8001
duration=600
code_path="/home/$username/code/"
for number_of_connections in 1 2 4 8 16 32 64 128 256 512 1024 2000 3000 4000 5000 6000
do
bash $code_path/sar-top.sh $duration $number_of_connections $username&
duration=300
code_path="/home/$username/code"
for number_of_connections in 1 2 4 8 16 32 64 128 256 512 1024
do
bash $code_path/sar-top.sh $duration $number_of_connections $username $testtype $buffersize&
if [ $? -ne 0 ]; then
LogMsg "sar-top failed to execute"
echo "sar-top failed to execute"
UpdateTestState $ICA_TESTFAILED
exit 80
fi
echo "Starting client with $number_of_connections connections"
while [ $number_of_connections -gt 64 ]; do
number_of_connections=$(($number_of_connections-64))
iperf3 -c $server_ip -p $port_number -P 64 -t $duration > /dev/null &
iperf3 -c $server_ip -p $port_number -P 64 -t $duration $testtypeOption $buffersizeOption > /dev/null &
if [ $? -ne 0 ]; then
LogMsg "iperf3 failed to connect server"
echo "iperf3 failed to connect server"
UpdateTestState $ICA_TESTFAILED
exit 80
fi
port_number=$((port_number+1))
done
if [ $number_of_connections -ne 0 ]
if [ $number_of_connections -ne 0 ]
then
iperf3 -c $server_ip -p $port_number -P $number_of_connections -t $duration > /dev/null &
iperf3 -c $server_ip -p $port_number -P $number_of_connections -t $duration $testtypeOption $buffersizeOption > /dev/null &
if [ $? -ne 0 ]; then
LogMsg "iperf3 failed to connect server"
echo "iperf3 failed to connect server"
UpdateTestState $ICA_TESTFAILED
exit 80
fi
fi
connections_count=`netstat -natp | grep iperf | grep ESTA | wc -l`
@ -48,8 +97,23 @@ do
sleep $(($duration+10))
done
logs_dir=logs-`hostname`-`uname -r`-`get_lis_version`/
logs_dir=logs-`hostname`-$testtype-$buffersize
collect_VM_properties $code_path/$logs_dir/VM_properties.csv
bash $code_path/generate_csvs.sh $code_path/$logs_dir
bash $code_path/generate_csvs.sh $code_path/$logs_dir $testtype $buffersize
if [ $? -ne 0 ]; then
LogMsg "Failed to generate test results .csv file"
echo "Failed to generate test results .csv file"
UpdateTestState $ICA_TESTFAILED
exit 80
fi
mv /etc/rc.d/after.local.bkp /etc/rc.d/after.local
mv /etc/rc.local.bkp /etc/rc.local
mv /etc/rc.d/rc.local.bkp /etc/rc.d/rc.local
echo "$testtype $buffersize test is Completed at Client"
#
# Let ICA know we completed successfully
#
LogMsg "Updating test case state to completed"
UpdateTestState $ICA_TESTCOMPLETED

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

@ -0,0 +1,164 @@
#!/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.
#
#######################################################################
#######################################################################
#
#
#
# Description:
#######################################################################
#HOW TO PARSE THE ARGUMENTS.. SOURCE - http://stackoverflow.com/questions/4882349/parsing-shell-script-arguments
while echo $1 | grep ^- > /dev/null; do
eval $( echo $1 | sed 's/-//g' | tr -d '\012')=$2
shift
shift
done
#
# Constants/Globals
#
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
#######################################################################
#
# LogMsg()
#
#######################################################################
if [ -z "$customKernel" ]; then
echo "Please mention -customKernel next"
exit 1
fi
if [ -z "$logFolder" ]; then
logFolder="~/"
echo "-logFolder is not mentioned. Using ~/"
else
echo "Using Log Folder $logFolder"
fi
LogMsg()
{
echo `date "+%b %d %Y %T"` : "${1}" # Add the time stamp to the log message
echo "${1}" >> /$logFolder/build-customKernel.txt
}
UpdateTestState()
{
echo "${1}" > /$logFolder/state.txt
}
touch /$logFolder/build-customKernel.txt
if [ "${customKernel}" == "linuxnext" ]; then
kernelSource="https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git"
sourceDir="linux-next"
elif [ "${customKernel}" == "netnext" ]; then
kernelSource="https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git"
sourceDir="net-next"
elif [[ $customKernel == *.deb ]]; then
LogMsg "Custom Kernel:$customKernel"
apt-get update
apt-get install wget
LogMsg "Debian package web link detected. Downloading $customKernel"
wget $customKernel
LogMsg "Installing ${customKernel##*/}"
dpkg -i "${customKernel##*/}"
kernelInstallStatus=$?
UpdateTestState $ICA_TESTCOMPLETED
if [ $kernelInstallStatus -ne 0 ]; then
LogMsg "CUSTOM_KERNEL_FAIL"
UpdateTestState $ICA_TESTFAILED
else
LogMsg "CUSTOM_KERNEL_SUCCESS"
UpdateTestState $ICA_TESTCOMPLETED
fi
exit 0
elif [[ $customKernel == *.rpm ]]; then
LogMsg "Custom Kernel:$customKernel"
yum -y install wget
LogMsg "RPM package web link detected. Downloading $customKernel"
wget $customKernel
LogMsg "Installing ${customKernel##*/}"
rpm -ivh "${customKernel##*/}"
kernelInstallStatus=$?
UpdateTestState $ICA_TESTCOMPLETED
if [ $kernelInstallStatus -ne 0 ]; then
LogMsg "CUSTOM_KERNEL_FAIL"
UpdateTestState $ICA_TESTFAILED
else
LogMsg "CUSTOM_KERNEL_SUCCESS"
UpdateTestState $ICA_TESTCOMPLETED
fi
exit 0
fi
LogMsg "Custom Kernel:$customKernel"
chmod +x /$logFolder/DetectLinuxDistro.sh
LinuxDistro=`/$logFolder/DetectLinuxDistro.sh`
if [ $LinuxDistro == "SLES" -o $LinuxDistro == "SUSE" ]; then
#zypper update
zypper --non-interactive install git-core make tar gcc bc patch dos2unix wget xz
#TBD
elif [ $LinuxDistro == "CENTOS" -o $LinuxDistro == "REDHAT" -o $LinuxDistro == "FEDORA" -o $LinuxDistro == "ORACLELINUX" ]; then
#yum update
yum install -y git make tar gcc bc patch dos2unix wget xz
#TBD
elif [ $LinuxDistro == "UBUNTU" ]; then
unset UCF_FORCE_CONFFOLD
export UCF_FORCE_CONFFNEW=YES
export DEBIAN_FRONTEND=noninteractive
ucf --purge /etc/kernel-img.conf
export DEBIAN_FRONTEND=noninteractive
LogMsg "Updating distro..."
apt-get update
LogMsg "Installing packages git make tar gcc bc patch dos2unix wget ..."
apt-get install -y git make tar gcc bc patch dos2unix wget >> /$logFolder/build-customKernel.txt 2>&1
LogMsg "Installing kernel-package ..."
apt-get -o Dpkg::Options::="--force-confnew" -y install kernel-package >> /$logFolder/build-customKernel.txt 2>&1
rm -rf linux-next
LogMsg "Downloading kernel source..."
git clone ${kernelSource} >> /$logFolder/build-customKernel.txt 2>&1
cd ${sourceDir}
#Download kernel build shell script...
wget https://raw.githubusercontent.com/simonxiaoss/linux_performance_test/master/git_bisect/build-ubuntu.sh
chmod +x build-ubuntu.sh
#Start installing kernel
LogMsg "Building and Installing kernel..."
./build-ubuntu.sh >> /$logFolder/build-customKernel.txt 2>&1
if [ $? -ne 0 ]; then
LogMsg "CUSTOM_KERNEL_FAIL"
UpdateTestState $ICA_TESTFAILED
exit 0
fi
fi
UpdateTestState $ICA_TESTCOMPLETED
sleep 10
LogMsg "CUSTOM_KERNEL_SUCCESS"
sleep 10
exit 0

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

@ -0,0 +1,166 @@
#!/bin/bash
#######################################################################
#
# Description: It install the LIS using given LIS source file (.tar.gz or lis-next)
# Usage: ./customLISInstall.sh -customLIS lisnext or tar file link -LISbranch a specific branch or default is master
# Author: Sivakanth Rebba
# Email : v-sirebb@microsoft.com
#
#######################################################################
#HOW TO PARSE THE ARGUMENTS.. SOURCE - http://stackoverflow.com/questions/4882349/parsing-shell-script-arguments
while echo $1 | grep ^- > /dev/null; do
eval $( echo $1 | sed 's/-//g' | tr -d '\012')=$2
shift
shift
done
#
# Constants/Globals
#
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
#######################################################################
#
# LogMsg()
#
#######################################################################
LogMsg()
{
echo `date "+%b %d %Y %T"` : "${1}" # Add the time stamp to the log message
echo "${1}" >> ~/build-customLIS.txt
}
UpdateTestState()
{
echo "${1}" > ~/state.txt
}
if [ -z "$customLIS" ]; then
echo "Please mention -customLIS next"
exit 1
fi
if [ -z "$LISbranch" ]; then
echo "Not mentioned LIS branch, Use Master branch"
LISbranch="master"
fi
touch ~/build-customLIS.txt
#Detect Distro and it's version
DistroName="Unknown"
DistroVersion="Unknown"
if [ -f /etc/redhat-release ] ; then
DistroName='REDHAT'
DistroVersion=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//`
elif [ -f /etc/centos-release ] ; then
DistroName==`cat /etc/centos-release | sed s/^\ // |sed s/\ .*//`
DistroName='CENTOS'
DistroVersion=`cat /etc/centos-release | sed s/.*release\ // | sed s/\ .*//`
elif [ -f /etc/SuSE-release ] ; then
DistroName=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//`
DistroVersion=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //`
elif [ -f /etc/debian_version ] ; then
DistroName="Debian `cat /etc/debian_version`"
DistroVersion=""
fi
if [ -f /etc/UnitedLinux-release ] ; then
DistroName="${DistroName}[`cat /etc/UnitedLinux-release | tr "\n" ' ' | sed s/VERSION.*//`]"
fi
LogMsg "*****OS Info*****"
cat /etc/*-release >> ~/build-customLIS.txt 2>&1
LogMsg "*****Kernen Info*****"
uname -r >> ~/build-customLIS.txt 2>&1
LogMsg "*****LIS Info*****"
modinfo hv_vmbus >> ~/build-customLIS.txt 2>&1
kernel=`uname -r`
if [ "${customLIS}" == "lisnext" ]; then
LISSource="https://github.com/LIS/lis-next.git"
sourceDir="lis-next"
elif [ "${customLIS}" == "netnext" ]; then
LISSource="https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git"
sourceDir="net-next"
elif [[ $customLIS == *.rpm ]]; then
LogMsg "Custom LIS:$customLIS"
sed -i '/^exclude/c\#exclude' /etc/yum.conf
yum install -y wget tar
LogMsg "Debian package web link detected. Downloading $customLIS"
wget $customLIS
LogMsg "Installing ${customLIS##*/}"
rpm -ivh "${customLIS##*/}" >> ~/build-customLIS.txt 2>&1
LISInstallStatus=$?
UpdateTestState $ICA_TESTCOMPLETED
if [ $LISInstallStatus -ne 0 ]; then
LogMsg "CUSTOM_LIS_FAIL"
UpdateTestState $ICA_TESTFAILED
else
LogMsg "CUSTOM_LIS_SUCCESS"
UpdateTestState $ICA_TESTCOMPLETED
fi
exit 0
elif [[ $customLIS == *.tar.gz ]]; then
LogMsg "Custom LIS:$customLIS"
sed -i '/^exclude/c\#exclude' /etc/yum.conf
yum install -y git make tar gcc bc patch dos2unix wget xz >> ~/build-customLIS.txt 2>&1
LogMsg "LIS tar file web link detected. Downloading $customLIS"
wget $customLIS
LogMsg "Extracting ${customLIS##*/}"
tar -xvzf "${customLIS##*/}"
LogMsg "Installing ${customLIS##*/}"
cd LISISO
./install.sh >> ~/build-customLIS.txt 2>&1
LISInstallStatus=$?
UpdateTestState $ICA_TESTCOMPLETED
modinfo hv_vmbus >> ~/build-customLIS.txt 2>&1
if [ $LISInstallStatus -ne 0 ]; then
LogMsg "CUSTOM_LIS_FAIL"
UpdateTestState $ICA_TESTFAILED
else
LogMsg "CUSTOM_LIS_SUCCESS"
UpdateTestState $ICA_TESTCOMPLETED
fi
exit 0
fi
LogMsg "Custom LIS:$customLIS"
if [ $DistroName == "SLES" -o $DistroName == "SUSE" ]; then
zypper --non-interactive install git-core make tar gcc bc patch dos2unix wget xz
LogMsg "LIS doesn't support for $DistroName distro..."
elif [ $DistroName == "CENTOS" -o $DistroName == "REDHAT" -o $DistroName == "FEDORA" -o $DistroName == "ORACLELINUX" ]; then
LogMsg "Installing packages git make tar gcc bc patch dos2unix wget ..."
sed -i '/^exclude/c\#exclude' /etc/yum.conf
yum install -y git make tar gcc bc patch dos2unix wget xz >> ~/build-customLIS.txt 2>&1
LogMsg "Downloading LIS source from ${LISSource}..."
git clone ${LISSource} >> ~/build-customLIS.txt 2>&1
cd ${sourceDir}
git checkout ${LISbranch}
LogMsg "Downloaded LIS from this ${LISbranch} branch..."
if [[ $DistroVersion == *"5."* ]]; then
LISsourceDir=hv-rhel5.x/hv
elif [[ $DistroVersion == *"6."* ]]; then
LISsourceDir=hv-rhel6.x/hv
elif [[ $DistroVersion == *"7."* ]]; then
LISsourceDir=hv-rhel7.x/hv
fi
cd $LISsourceDir
LISDir=`pwd`
LogMsg "Installing kernel-devel-${kernel} for LIS..."
yum install -y "https://konkasoftpackages.blob.core.windows.net/linuxbinaries/kernel-devel-${kernel}.rpm" ~/build-customLIS.txt 2>&1
LogMsg "LIS is installing from this ${LISDir} branch..."
./*-hv-driver-install >> ~/build-customLIS.txt 2>&1
if [ $? -ne 0 ]; then
LogMsg "CUSTOM_LIS_FAIL"
UpdateTestState $ICA_TESTFAILED
exit 0
fi
elif [ $DistroName == "UBUNTU" ]; then
LogMsg "LIS doesn't support for $DistroName distro..."
fi
UpdateTestState $ICA_TESTCOMPLETED
sleep 10
LogMsg "CUSTOM_LIS_SUCCESS"
sleep 10
exit 0

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

@ -0,0 +1,25 @@
#!/bin/bash
#AUTHOR : SHITAL SAVEKAR <v-shisav@microsoft.com>
#Description : Enables passwordless authentication for root user.
#How to use : ./enablePasswordLessRoot.sh
#In multi VM cluster. Execute this script in one VM. It will create a sshFix.tar
#Copy this sshFix.tar to other VMs (/root) in your cluster and execute same script. It will extract previously created keys.
#This way, all VMs will have same public and private keys in .ssh folder.
rm -rf /root/.ssh
cd /root
keyTarFile=sshFix.tar
if [ -e ${keyTarFile} ]; then
echo | ssh-keygen -N ''
rm -rf .ssh/*
tar -xvf ${keyTarFile}
echo "KEY_COPIED_SUCCESSFULLY"
else
echo | ssh-keygen -N ''
cat /root/.ssh/id_rsa.pub > /root/.ssh/authorized_keys
echo "Host *" > /root/.ssh/config
echo "StrictHostKeyChecking no" >> /root/.ssh/config
rm -rf /root/.ssh/known_hosts
cd /root/ && tar -cvf sshFix.tar .ssh/*
echo "KEY_GENERATED_SUCCESSFULLY"
fi

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

@ -14,12 +14,16 @@ sshd_configFilePath="/etc/ssh/sshd_config"
sshdServiceName="sshd"
usermod --password $(echo $password | openssl passwd -1 -stdin) root
if [ $? == 0 ]; then
sed -i 's/PermitRootLogin/#PermitRootLogin/g' $sshd_configFilePath
sed -i 's/.*PermitRootLogin.*/PermitRootLogin yes/g' $sshd_configFilePath
if [ $? == 0 ]; then
echo "$sshd_configFilePath verifed for root login."
echo "ROOT_PASSWRD_SET"
service $sshdServiceName restart
service $sshdServiceName restart || systemctl restart sshd.service
sshdServiceStatus=$?
if [ $sshdServiceStatus != 0 ]; then
service ssh restart
sshdServiceStatus=$?
fi
else
echo "$sshd_configFilePath verification failed for root login."
echo "ROOT_PASSWORD_SET_SSHD_CONFIG_FAIL"

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

@ -15,20 +15,27 @@ format_bites(){
gen_csv(){
input_file=$1
number_of_connections=$2
summary_file=$3
output_file=`echo $input_file |sed s/\.log$/\.csv/`
top_array_file=`echo $output_file |sed s/sar/top/`
conn_array_file=`echo $output_file |sed s/sar/connections/`
cpu_vmstat_file=`echo $input_file |sed s/sar/vmstat/`
rx_pcks_array_file=$input_file-rxpcks.log
tx_pcks_array_file=$input_file-txpcks.log
rx_array_file=$input_file-rxkBps.log
tx_array_file=$input_file-txkBps.log
cpu_vmstat_array_file=$input_file-cpu-vmstat.log
cat $cpu_vmstat_file | grep -v [a-z]| awk '{print 100 - $15}' > $cpu_vmstat_array_file
cat $cpu_vmstat_file | grep -v [a-z]| awk '{print 100 - $15}' > $cpu_vmstat_array_file
cat $input_file | grep eth0 | awk '{print $4}' > $rx_pcks_array_file
cat $input_file | grep eth0 | awk '{print $5}' > $tx_pcks_array_file
cat $input_file | grep eth0 | awk '{print $6}' > $rx_array_file
cat $input_file | grep eth0 | awk '{print $7}' > $tx_array_file
rx_pcks_array=(`cat $rx_pcks_array_file`)
tx_pcks_array=(`cat $tx_pcks_array_file`)
rx_array=(`cat $rx_array_file`)
tx_array=(`cat $tx_array_file`)
top_array=(`cat $top_array_file`)
@ -38,10 +45,13 @@ gen_csv(){
length=$((${#rx_array[@]}-1))
count=0
sum=0
rx_pcks_sum=0
tx_pcks_sum=0
rx_sum=0
tx_sum=0
cpu_sum=0
echo Rx Throughput,Units,TxThroughput,Units,Total,Units,,Time,ActiveConnection,,Time,CPU Usage >> $output_file
echo Rx Throughput,Units,TxThroughput,Units,Total,Units,,Time,ActiveConnection,Rx packets,Tx packets,,Time,CPU Usage >> $output_file
for i in `seq 1 $length`;
do
@ -59,31 +69,46 @@ gen_csv(){
conn_info=","
fi
echo $Rx_data,$Tx_data,$Total_data,,$conn_info,,$count,${cpu_array[count]}>> $output_file
echo $Rx_data,$Tx_data,$Total_data,,$conn_info,${rx_pcks_array[count]},${tx_pcks_array[count]},,$count,${cpu_array[count]}>> $output_file
rx_pcks_sum=`echo $rx_pcks_sum ${rx_pcks_array[count]}| awk '{printf "%.3f \n", $1+$2}'`
tx_pcks_sum=`echo $tx_pcks_sum ${tx_pcks_array[count]}| awk '{printf "%.3f \n", $1+$2}'`
rx_sum=`echo $rx_sum ${rx_array[count]}| awk '{printf "%.3f \n", $1+$2}'`
tx_sum=`echo $tx_sum ${tx_array[count]}| awk '{printf "%.3f \n", $1+$2}'`
cpu_sum=`echo $cpu_sum ${cpu_array[count]}| awk '{printf "%.3f \n", $1+$2}'`
((count++))
done
sum=`echo $tx_sum $rx_sum| awk '{printf "%.3f \n", $1+$2}'`
avg=`python -c "print $sum*8/($length*1000*1000)"`
echo $number_of_connections - $avg
pcks_sum=`python -c "print '%d' % ($tx_pcks_sum+$rx_pcks_sum)"`
avg_thrpt=`python -c "print '%.2f' % ($sum*8/($length*1000*1000))"`
avg_cpu=`python -c "print '%d' % ($cpu_sum/$length)"`
echo $number_of_connections,$avg_thrpt,$pcks_sum,$avg_cpu >> $summary_file
rm -rf $rx_array_file $tx_array_file $cpu_vmstat_array_file.log
}
logs_folder=$1
for number_of_connections in 1 2 4 8 16 32 64 128 256 512 1024 2000 3000 4000 5000 6000
testtype=$2
buffersize=$3
#summary_file=$logs_folder/summary_file_`hostname`.csv
summary_file=$logs_folder/summary_file_`hostname`_${testtype}_${buffersize}.csv
echo "" > $summary_file
echo "Connections,Avg Throughput,Total packets,Avg CPU" > $summary_file
for number_of_connections in 1 2 4 8 16 32 64 128 256 512 1024
do
echo "Converting $number_of_connections logs.."
gen_csv $logs_folder/$number_of_connections/$number_of_connections-sar.log $number_of_connections&
gen_csv $logs_folder/$number_of_connections/$number_of_connections-sar.log $number_of_connections $summary_file&
done
wait
mkdir -p $logs_folder/csv_files/
for number_of_connections in 1 2 4 8 16 32 64 128 256 512 1024 2000 3000 4000 5000 6000
for number_of_connections in 1 2 4 8 16 32 64 128 256 512 1024
do
mv $logs_folder/$number_of_connections/$number_of_connections-sar.csv $logs_folder/csv_files/
done
cat $summary_file | sort -n > $summary_file.tmp
mv $summary_file.tmp $summary_file
logs_folder=`echo $logs_folder| sed 's/\/$//'`
tar -czf $logs_folder.tar.gz $logs_folder/
echo "Completed!"

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

@ -15,7 +15,9 @@ then
sed "/^\s*exit 0/i ${testcommand}" /etc/rc.d/rc.local -i
if ! grep -q "${testcommand}" /etc/rc.d/rc.local
then
cp /etc/rc.d/rc.local /etc/rc.d/rc.local.bkp
echo $testcommand >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
fi
fi
fi
@ -27,7 +29,9 @@ then
sed "/^\s*exit 0/i ${testcommand}" /etc/rc.local -i
if ! grep -q "${testcommand}" /etc/rc.local
then
cp /etc/rc.local /etc/rc.local.bkp
echo $testcommand >> /etc/rc.local
chmod +x /etc/rc.local
fi
fi
fi
@ -36,7 +40,9 @@ if [[ -f /etc/SuSE-release ]]
then
if ! grep -q "${testcommand}" after.local
then
cp /etc/rc.d/after.local /etc/rc.d/after.local.bkp
echo $testcommand >> /etc/rc.d/after.local
chmod +x /etc/rc.d/after.local
fi
fi
# ===

386
remote-scripts/perf_fio.sh Normal file
Просмотреть файл

@ -0,0 +1,386 @@
#!/bin/bash
#
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
#
# Sample script to run sysbench.
# In this script, we want to bench-mark device IO performance on a mounted folder.
# You can adapt this script to other situations easily like for stripe disks as RAID0.
# The only thing to keep in mind is that each different configuration you're testing
# must log its output to a different directory.
#
HOMEDIR="/root"
LogMsg()
{
echo "[$(date +"%x %r %Z")] ${1}"
echo "[$(date +"%x %r %Z")] ${1}" >> "${HOMEDIR}/runlog.txt"
}
LogMsg "Sleeping 10 seconds.."
sleep 10
#export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/share/oem/bin:/usr/share/oem/python/bin:/opt/bin
CONSTANTS_FILE="$HOMEDIR/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 ./fioTest.log
if [ -e ${CONSTANTS_FILE} ]; then
. ${CONSTANTS_FILE}
else
errMsg="Error: missing ${CONSTANTS_FILE} file"
LogMsg "${errMsg}"
UpdateTestState $ICA_TESTABORTED
exit 10
fi
UpdateTestState()
{
echo "${1}" > $HOMEDIR/state.txt
}
RunFIO()
{
UpdateTestState ICA_TESTRUNNING
FILEIO="--size=${fileSize} --direct=1 --ioengine=libaio --filename=fiodata --overwrite=1 "
####################################
#All run config set here
#
#Log Config
mkdir $HOMEDIR/FIOLog/jsonLog
mkdir $HOMEDIR/FIOLog/iostatLog
mkdir $HOMEDIR/FIOLog/blktraceLog
#LOGDIR="${HOMEDIR}/FIOLog"
JSONFILELOG="${LOGDIR}/jsonLog"
IOSTATLOGDIR="${LOGDIR}/iostatLog"
BLKTRACELOGDIR="${LOGDIR}/blktraceLog"
LOGFILE="${LOGDIR}/fio-test.log.txt"
#redirect blktrace files directory
Resource_mount=$(mount -l | grep /sdb1 | awk '{print$3}')
blk_base="${Resource_mount}/blk-$(date +"%m%d%Y-%H%M%S")"
mkdir $blk_base
#
#
#Test config
#
#
#All possible values for file-test-mode are randread randwrite read write
#modes='randread randwrite read write'
iteration=0
#startThread=1
#startIO=8
#numjobs=1
#Max run config
#ioruntime=300
#maxThread=1024
#maxIO=8
io_increment=128
####################################
echo "Test log created at: ${LOGFILE}"
echo "===================================== Starting Run $(date +"%x %r %Z") ================================"
echo "===================================== Starting Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE
chmod 666 $LOGFILE
echo "Preparing Files: $FILEIO"
echo "Preparing Files: $FILEIO" >> $LOGFILE
LogMsg "Preparing Files: $FILEIO"
# Remove any old files from prior runs (to be safe), then prepare a set of new files.
rm fiodata
echo "--- Kernel Version Information ---" >> $LOGFILE
uname -a >> $LOGFILE
cat /proc/version >> $LOGFILE
cat /etc/*-release >> $LOGFILE
echo "--- PCI Bus Information ---" >> $LOGFILE
lspci >> $LOGFILE
echo "--- Drive Mounting Information ---" >> $LOGFILE
mount >> $LOGFILE
echo "--- Disk Usage Before Generating New Files ---" >> $LOGFILE
df -h >> $LOGFILE
fio --cpuclock-test >> $LOGFILE
fio $FILEIO --readwrite=read --bs=1M --runtime=1 --iodepth=128 --numjobs=8 --name=prepare
echo "--- Disk Usage After Generating New Files ---" >> $LOGFILE
df -h >> $LOGFILE
echo "=== End Preparation $(date +"%x %r %Z") ===" >> $LOGFILE
LogMsg "Preparing Files: $FILEIO: Finished."
####################################
#Trigger run from here
for testmode in $modes; do
io=$startIO
while [ $io -le $maxIO ]
do
Thread=$startThread
while [ $Thread -le $maxThread ]
do
if [ $Thread -ge 8 ]
then
numjobs=8
else
numjobs=$Thread
fi
iostatfilename="${IOSTATLOGDIR}/iostat-fio-${testmode}-${io}K-${Thread}td.txt"
nohup iostat -x 5 -t -y > $iostatfilename &
#capture blktrace output during test
#LogMsg "INFO: start blktrace for 40 sec on device sdd and sdf"
#blk_operation="${blk_base}/blktrace-fio-${testmode}-${io}K-${Thread}td/"
#mkdir $blk_operation
#blktrace -w 40 -d /dev/sdf -D $blk_operation &
#blktrace -w 40 -d /dev/sdm -D $blk_operation &
echo "-- iteration ${iteration} ----------------------------- ${testmode} test, ${io}K bs, ${Thread} threads, ${numjobs} jobs, 5 minutes ------------------ $(date +"%x %r %Z") ---" >> $LOGFILE
LogMsg "Running ${testmode} test, ${io}K bs, ${Thread} threads ..."
jsonfilename="${JSONFILELOG}/fio-result-${testmode}-${io}K-${Thread}td.json"
fio $FILEIO --readwrite=$testmode --bs=${io}K --runtime=$ioruntime --iodepth=$Thread --numjobs=$numjobs --output-format=json --output=$jsonfilename --name="iteration"${iteration} >> $LOGFILE
#fio $FILEIO --readwrite=$testmode --bs=${io}K --runtime=$ioruntime --iodepth=$Thread --numjobs=$numjobs --name="iteration"${iteration} --group_reporting >> $LOGFILE
iostatPID=`ps -ef | awk '/iostat/ && !/awk/ { print $2 }'`
kill -9 $iostatPID
Thread=$(( Thread*2 ))
iteration=$(( iteration+1 ))
done
io=$(( io * io_increment ))
done
done
####################################
echo "===================================== Completed Run $(date +"%x %r %Z") script generated 2/9/2015 4:24:44 PM ================================" >> $LOGFILE
rm fiodata
compressedFileName="${HOMEDIR}/FIOTest-$(date +"%m%d%Y-%H%M%S").tar.gz"
LogMsg "INFO: Please wait...Compressing all results to ${compressedFileName}..."
tar -cvzf $compressedFileName $LOGDIR/
echo "Test logs are located at ${LOGDIR}"
UpdateTestState ICA_TESTCOMPLETED
}
ConfigCentOS7()
{
fioCentOS7pkg="fio-2.2.8-2.el7.x86_64.rpm"
LogMsg "INFO: CentOS7: installing required packages"
yum install -y wget sysstat mdadm blktrace libaio
mount -t debugfs none /sys/kernel/debug
installed=`which fio`
if [ ! $installed ]; then
LogMsg "INFO: Installing fio"
fiolPkg=$(ls | grep ${fioCentOS7pkg})
if [ -z "$fiolPkg" ]; then
wget "https://konkasoftpackages.blob.core.windows.net/linuxbinaries/${fioCentOS7pkg}"
fi
yum install -y ${fioCentOS7pkg}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install fio"
exit 1
fi
fi
}
ConfigCentOS6()
{
fioCentOS6pkg="fio-2.1.10-1.el6.rf.x86_64.rpm"
LogMsg "INFO: CentOS6: installing required packages"
yum install -y wget sysstat mdadm blktrace libaio
mount -t debugfs none /sys/kernel/debug
installed=`which fio`
if [ ! $installed ]; then
LogMsg "INFO: Installing fio"
fiolPkg=$(ls | grep ${fioCentOS6pkg})
if [ -z "$fiolPkg" ]; then
wget "https://konkasoftpackages.blob.core.windows.net/linuxbinaries/${fioCentOS6pkg}"
fi
yum install -y libibverbs.x86_64
yum install -y ${fioCentOS6pkg}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install fio"
exit 1
fi
fi
}
ConfigUbuntu()
{
LogMsg "INFO: Ubuntu installing required packages"
apt-get update
apt-get install -y wget sysstat blktrace bc
mount -t debugfs none /sys/kernel/debug
installed=`which fio`
if [ ! $installed ]; then
LogMsg "INFO: Installing fio"
apt-get install -y fio ;
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install fio"
exit 1
fi
fi
}
ConfigSLES()
{
fioCentOS6pkg="fio-2.1.2-2.1.3.x86_64.rpm"
LogMsg "INFO: SLES: installing required packages"
zypper --non-interactive install wget sysstat mdadm blktrace
mount -t debugfs none /sys/kernel/debug
installed=`which fio`
if [ ! $installed ]; then
LogMsg "INFO: Installing fio"
fiolPkg=$(ls | grep ${fioCentOS6pkg})
if [ -z "$fiolPkg" ]; then
wget "ftp://195.220.108.108/linux/opensuse/distribution/13.1/repo/oss/suse/x86_64/${fioCentOS6pkg}"
fi
(echo i;) | zypper --non-interactive install ${fioCentOS6pkg}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install fio"
exit 1
fi
fi
}
CreateRAID0()
{
disks=$(ls -l /dev | grep sd[c-z]$ | awk '{print $10}')
#disks=(`fdisk -l | grep 'Disk.*/dev/sd[a-z]' |awk '{print $2}' | sed s/://| sort| grep -v "/dev/sd[ab]$" `)
LogMsg "INFO: Check and remove RAID first"
mdvol=$(cat /proc/mdstat | grep "active raid" | awk {'print $1'})
if [ -n "$mdvol" ]; then
echo "/dev/${mdvol} already exist...removing first"
umount /dev/${mdvol}
mdadm --stop /dev/${mdvol}
mdadm --remove /dev/${mdvol}
mdadm --zero-superblock /dev/sd[c-z][1-5]
fi
LogMsg "INFO: Creating Partition"
count=0
for disk in ${disks}
do
echo "formatting disk /dev/${disk}"
(echo d; echo n; echo p; echo 1; echo; echo; echo t; echo fd; echo w;) | fdisk /dev/${disk}
count=$(( $count + 1 ))
done
LogMsg "INFO: Creating RAID"
mdadm --create ${mdVolume} --level 0 --raid-devices ${count} /dev/sd[c-z][1-5]
time mkfs -t $1 -F ${mdVolume}
mkdir ${mountDir}
mount -o nobarrier ${mdVolume} ${mountDir}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to create raid"
exit 1
else
LogMsg "${mdVolume} mounted to ${mountDir} successfully."
fi
#LogMsg "INFO: adding fstab entry"
#echo "${mdVolume} ${mountDir} ext4 defaults 1 1" >> /etc/fstab
}
CreateLVM()
{
disks=$(ls -l /dev | grep sd[c-z]$ | awk '{print $10}')
#disks=(`fdisk -l | grep 'Disk.*/dev/sd[a-z]' |awk '{print $2}' | sed s/://| sort| grep -v "/dev/sd[ab]$" `)
#LogMsg "INFO: Check and remove LVM first"
vgExist=$(vgdisplay)
if [ -n "$vgExist" ]; then
umount ${mountDir}
lvremove -A n -f /dev/${vggroup}/lv1
vgremove ${vggroup} -f
fi
LogMsg "INFO: Creating Partition"
count=0
for disk in ${disks}
do
echo "formatting disk /dev/${disk}"
(echo d; echo n; echo p; echo 1; echo; echo; echo t; echo fd; echo w;) | fdisk /dev/${disk}
count=$(( $count + 1 ))
done
LogMsg "INFO: Creating LVM with all data disks"
pvcreate /dev/sd[c-z][1-5]
vgcreate ${vggroup} /dev/sd[c-z][1-5]
lvcreate -l 100%FREE -i 12 -I 64 ${vggroup} -n lv1
time mkfs -t $1 -F /dev/${vggroup}/lv1
mkdir ${mountDir}
mount -o nobarrier /dev/${vggroup}/lv1 ${mountDir}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to create LVM "
exit 1
fi
#LogMsg "INFO: adding fstab entry"
#echo "${mdVolume} ${mountDir} ext4 defaults 1 1" >> /etc/fstab
}
############################################################
# Main body
############################################################
HOMEDIR=$HOME
mv $HOMEDIR/FIOLog/ $HOMEDIR/FIOLog-$(date +"%m%d%Y-%H%M%S")/
mkdir $HOMEDIR/FIOLog
LOGDIR="${HOMEDIR}/FIOLog"
mdVolume="/dev/md0"
vggroup="vg1"
mountDir="/data"
cd ${HOMEDIR}
#DISTRO=`grep -ihs "Ubuntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux" /etc/{issue,*release,*version} | grep DISTRIB_ID= | sed s/DISTRIB_ID=//`
DISTRO=`grep -ihs "Ubuntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux" /etc/{issue,*release,*version}`
#DISTRO="Ubuntu"
echo "###############$DISTRO########################"
case $DISTRO in
Ubuntu*)
echo "UBUNTU"
ConfigUbuntu
;;
Fedora*)
echo "FEDORA";;
*release*7.*)
echo "CENTOS 7.*"
ConfigCentOS7
;;
*release*6.*)
echo "CENTOS 6.*"
ConfigCentOS6
;;
*SUSE*)
echo "SLES"
ConfigSLES
;;
Red*Hat*)
echo "RHEL";;
Debian*)
echo "DEBIAN";;
esac
#Creating RAID before triggering test
CreateRAID0 ext4
#CreateLVM ext4
#Run test from here
LogMsg "*********INFO: Starting test execution*********"
cd ${mountDir}
mkdir sampleDIR
RunFIO
LogMsg "*********INFO: Script execution reach END. Completed !!!*********"

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

@ -0,0 +1,254 @@
#!/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_IPERF3.sh
# Author : SHITAL SAVEKAR <v-shisav@microsoft.com>
#
# Description:
# Download and run IPERF3 network performance 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 ./IPERF3Test.log
ConfigureIperf3Ubuntu()
{
LogMsg "Configuring ${1} for IPERF3 test..."
ssh ${1} "apt-get update"
ssh ${1} "apt-get -y install iperf3 sysstat bc "
if [ $IPversion -eq 6 ]; then
scp ConfigureUbuntu1604IPv6.sh ${1}:
ssh ${1} "chmod +x ConfigureUbuntu1604IPv6.sh"
ssh ${1} "./ConfigureUbuntu1604IPv6.sh"
fi
}
LogMsg()
{
echo `date "+%b %d %Y %T"` : "${1}" # Add the time stamp to the log message
echo "${1}" >> ./IPERF3Test.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 [ ! ${testDuration} ]; then
errMsg="Please add/provide value for testDuration in constants.sh. testDuration=60"
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
if [ ! ${testType} ]; then
errMsg="Please add/provide value for testType in constants.sh. testType=tcp/udp"
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
if [ ! ${max_parallel_connections_per_instance} ]; then
errMsg="Please add/provide value for max_parallel_connections_per_instance in constants.sh. max_parallel_connections_per_instance=60"
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
if [ ! ${connections} ]; then
errMsg="Please add/provide value for connections in constants.sh. connections=(1 2 4 8 ....)"
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
if [ ! ${bufferLenghs} ]; then
errMsg="Please add/provide value for bufferLenghs in constants.sh. bufferLenghs=(1 8). Note buffer lenghs are in KB"
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
if [ ! ${IPversion} ]; then
errMsg="Please add/provide value for IPversion in constants.sh. IPversion=4/6."
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
if [ $IPversion -eq 6 ]; then
if [ ! ${serverIpv6} ]; then
errMsg="Please add/provide value for serverIpv6 in constants.sh"
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
if [ ! ${clientIpv6} ]; then
errMsg="Please add/provide value for clientIpv6 in constants.sh."
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
fi
#connections=(64 128)
#BufferLenghts are in K
#max_parallel_connections_per_instance=64
#Make & build IPERF3 on client and server Machine
LogMsg "Configuring client ${client}..."
ConfigureIperf3Ubuntu ${client}
LogMsg "Configuring server ${server}..."
ConfigureIperf3Ubuntu ${server}
ssh ${server} "rm -rf iperf-server-*"
ssh ${client} "rm -rf iperf-client-*"
ssh ${client} "rm -rf iperf-server-*"
#connections=(1 2 4 8 16 32 64 128 256 512 1024)
#BufferLenghts are in K
#bufferLenghs=(1 8)
for current_buffer in "${bufferLenghs[@]}"
do
for current_test_connections in "${connections[@]}"
do
if [ $current_test_connections -lt $max_parallel_connections_per_instance ]
then
num_threads_P=$current_test_connections
num_threads_n=1
else
num_threads_P=$max_parallel_connections_per_instance
num_threads_n=$(($current_test_connections / $num_threads_P))
fi
ssh ${server} "killall iperf3"
ssh ${client} "killall iperf3"
LogMsg "Starting $num_threads_n iperf3 server instances on $server.."
startPort=750
currentPort=$startPort
currentIperfInstanses=0
while [ $currentIperfInstanses -lt $num_threads_n ]
do
currentIperfInstanses=$(($currentIperfInstanses+1))
serverCommand="iperf3 -s -1 -J -i10 -f g -p ${currentPort} > iperf-server-${testType}-IPv${IPversion}-buffer-${current_buffer}K-conn-$current_test_connections-instance-${currentIperfInstanses}.txt 2>&1"
ssh ${server} $serverCommand &
LogMsg "Executed: $serverCommand"
currentPort=$(($currentPort+1))
sleep 0.1
done
LogMsg "$num_threads_n iperf server instances started on $server.."
sleep 5
LogMsg "Starting client.."
startPort=750
currentPort=$startPort
currentIperfInstanses=0
if [ $IPversion -eq 4 ]; then
testServer=$server
else
testServer=$serverIpv6
fi
#ssh ${client} "./sar-top.sh ${testDuration} $current_test_connections root" &
#ssh ${server} "./sar-top.sh ${testDuration} $current_test_connections root" &
while [ $currentIperfInstanses -lt $num_threads_n ]
do
currentIperfInstanses=$(($currentIperfInstanses+1))
if [[ "$testType" == "udp" ]];
then
clientCommand="iperf3 -c $testServer -u -b 0 -J -f g -i10 -l ${current_buffer}K -t ${testDuration} -p ${currentPort} -P $num_threads_P -${IPversion} > iperf-client-${testType}-IPv${IPversion}-buffer-${current_buffer}K-conn-$current_test_connections-instance-${currentIperfInstanses}.txt 2>&1"
fi
if [[ "$testType" == "tcp" ]];
then
clientCommand="iperf3 -c $testServer -b 0 -J -f g -i10 -w ${current_buffer}K -t ${testDuration} -p ${currentPort} -P $num_threads_P -${IPversion} > iperf-client-${testType}-IPv${IPversion}-buffer-${current_buffer}K-conn-$current_test_connections-instance-${currentIperfInstanses}.txt 2>&1"
fi
ssh ${client} $clientCommand &
LogMsg "Executed: $clientCommand"
currentPort=$(($currentPort+1))
sleep 0.1
done
LogMsg "Iperf3 running buffer ${current_buffer}K $num_threads_P X $num_threads_n ..."
sleep ${testDuration}
sleep 5
var=`ps -C "iperf3 -c" --no-headers | wc -l`
while [ $var -gt 0 ]
do
sleep 1
var=`ps -C "iperf3 -c" --no-headers | wc -l`
LogMsg "Iperf3 running buffer ${current_buffer}K $num_threads_P X $num_threads_n. Waiting to finish $var instances."
done
#Sleep extra 5 seconds.
sleep 1
LogMsg "Iperf3 Finished buffer ${current_buffer}K $num_threads_P X $num_threads_n ..."
done
done
scp ${server}:iperf-server-* ./
UpdateTestState ICA_TESTCOMPLETED

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

@ -0,0 +1,126 @@
#!/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_ntttcp.sh
# Author : SHITAL SAVEKAR <v-shisav@microsoft.com>
#
# Description:
# Download and run ntttcp network performance 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 ./ntttcpTest.log
ConfigureNtttcpUbuntu()
{
LogMsg "Configuring ${1} for ntttcp test..."
ssh ${1} "apt-get update"
ssh ${1} "apt-get -y install libaio1 sysstat git bc make gcc"
ssh ${1} "git clone https://github.com/Microsoft/ntttcp-for-linux.git"
ssh ${1} "cd ntttcp-for-linux/src/ && make && make install"
ssh ${1} "cp ntttcp-for-linux/src/ntttcp ."
ssh ${1} "rm -rf lagscope"
ssh ${1} "git clone https://github.com/Microsoft/lagscope"
ssh ${1} "cd lagscope/src && make && make install"
}
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
}
ConfigUbuntu1604()
{
LogMsg "Running ConfigUbuntu..."
apt-get update
apt-get -y install libaio1 sysstat git
}
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 [ ! ${testDuration} ]; then
errMsg="Please add/provide value for testDuration in constants.sh. testDuration=60"
LogMsg "${errMsg}"
echo "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
#Make & build ntttcp on client and server Machine
LogMsg "Configuring client ${client}..."
ConfigureNtttcpUbuntu ${client}
LogMsg "Configuring server ${server}..."
ConfigureNtttcpUbuntu ${server}
#Now, start the ntttcp client on client VM.
ssh root@${client} "wget https://raw.githubusercontent.com/iamshital/linux_performance_test/master/run_ntttcp-for-linux/run-ntttcp-and-tcping.sh"
ssh root@${client} "wget https://raw.githubusercontent.com/iamshital/linux_performance_test/master/run_ntttcp-for-linux/report-ntttcp-and-tcping.sh"
ssh root@${client} "chmod +x run-ntttcp-and-tcping.sh && chmod +x report-ntttcp-and-tcping.sh"
LogMsg "Now running NTTTCP test"
ssh root@${client} "rm -rf ntttcp-test-logs"
ssh root@${client} "./run-ntttcp-and-tcping.sh ntttcp-test-logs ${server} root ${testDuration}"
ssh root@${client} "./report-ntttcp-and-tcping.sh ntttcp-test-logs"
ssh root@${client} "cp ntttcp-test-logs/* ."
UpdateTestState ICA_TESTCOMPLETED

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

@ -0,0 +1,362 @@
#!/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_orion.sh
# Author : SHITAL SAVEKAR <v-shisav@microsoft.com>
#
# Description:
# Download and run orion disk performance tests.
# This script needs to be run on single VM with one data disk attached.
# This script requires orion.lun file to be present in pwd. It contains the disk names on which we need to perform the test.
# orion.lun:
# /dev/sdc
#
# 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 ./orionTest.log
LogMsg()
{
echo `date "+%b %d %Y %T"` : "${1}" # Add the time stamp to the log message
echo "${1}" >> ./orionTest.log
}
UpdateTestState()
{
echo "${1}" > ./state.txt
}
ConfigUbuntu1604()
{
LogMsg "Running ConfigUbuntu..."
apt-get update
apt-get -y install libaio1 sysstat
}
if [ -e ${CONSTANTS_FILE} ]; then
source ${CONSTANTS_FILE}
else
errMsg="Error: missing ${CONSTANTS_FILE} file"
LogMsg "${errMsg}"
UpdateTestState $ICA_TESTABORTED
exit 10
fi
ConfigUbuntu1604
if [ -e orion_x86_64 ]; then
LogMsg "orion binary already exists."
else
wget ${orionBinaryURL}
fi
chmod +x ./orion_x86_64
UpdateTestState "TestRunning"
#all read
testType="oltp"
LogMsg "Running $testType test.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run oltp -testname orion
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="dss"
LogMsg "Running $testType test.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run dss -testname orion
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="simple"
LogMsg "Running $testType test.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run simple -testname orion
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="normal#1"
LogMsg "Running $testType test iteration #1.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run normal -testname orion
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
#redo the "normal" test
testType="normal#2"
LogMsg "Running $testType test iteration #2.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run normal -testname orion
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="normal#3"
LogMsg "Running $testType test iteration #3.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run normal -testname orion
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
#all write
testType="oltpWrite100"
LogMsg "Running $testType test.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run oltp -testname orion -write 100
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="dssWrite100"
LogMsg "Running $testType test.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run dss -testname orion -write 100
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="advancedWrite100Basic"
LogMsg "Running $testType test.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run advanced -size_small 8 -size_large 1024 -type rand -simulate concat -write 100 -duration 60 -matrix basic
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="advancedWrite100Detailed#1"
LogMsg "Running $testType test iteration #1.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run advanced -size_small 8 -size_large 1024 -type rand -simulate concat -write 100 -duration 60 -matrix detailed
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
#redo the "normal" test
testType="advancedWrite100Detailed#2"
LogMsg "Running $testType test iteration #2.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run advanced -size_small 8 -size_large 1024 -type rand -simulate concat -write 100 -duration 60 -matrix detailed
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="advancedWrite100Detailed#3"
LogMsg "Running $testType test iteration #3.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run advanced -size_small 8 -size_large 1024 -type rand -simulate concat -write 100 -duration 60 -matrix detailed
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
#read50% and write 50%
testType="oltpWrite50"
LogMsg "Running $testType test.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run oltp -testname orion -write 50
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="dssWrite50"
LogMsg "Running $testType test.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run dss -testname orion -write 50
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="advancedWrite50Basic"
LogMsg "Running $testType test.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run advanced -size_small 8 -size_large 1024 -type rand -simulate concat -write 50 -duration 60 -matrix basic
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="advancedWrite50Detailed#1"
LogMsg "Running $testType test iteration #1.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run advanced -size_small 8 -size_large 1024 -type rand -simulate concat -write 50 -duration 60 -matrix detailed
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
#redo the "normal" test
testType="advancedWrite50Detailed#2"
LogMsg "Running $testType test iteration #2.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run advanced -size_small 8 -size_large 1024 -type rand -simulate concat -write 50 -duration 60 -matrix detailed
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
testType="advancedWrite50Detailed#3"
LogMsg "Running $testType test iteration #3.."
dateTime="$(date +"%m-%d-%Y-%H-%M-%S")"
iostat -x -d 1 4000 2>&1 > "orion-${testType}-${dateTime}.iostat.diskio.log" &
vmstat 1 4000 2>&1 > "orion-${testType}-${dateTime}.vmstat.memory.cpu.log" &
./orion_x86_64 -run advanced -size_small 8 -size_large 1024 -type rand -simulate concat -write 50 -duration 60 -matrix detailed
pkill -f iostat
pkill -f vmstat
mv *_iops.csv "orion-${testType}-${dateTime}-iops.csv"
mv *_lat.csv "orion-${testType}-${dateTime}-lat.csv"
mv *_mbps.csv "orion-${testType}-${dateTime}-mbps.csv"
mv *_summary.txt "orion-${testType}-${dateTime}-summary.txt"
mv *_trace.txt "orion-${testType}-${dateTime}-trace.txt"
LogMsg "$testType test finished."
UpdateTestState "TestCompleted"

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

@ -0,0 +1,173 @@
#!/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_redis.sh
# Author : SHITAL SAVEKAR <v-shisav@microsoft.com>
#
# Description:
# Download and run redis benchmark 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 ./redisTest.log
ConfigureRedisUbuntu()
{
LogMsg "Configuring ${1} for redis test..."
ssh ${1} "apt-get update"
ssh ${1} "apt-get -y install libaio1 sysstat gcc"
ssh ${1} "wget http://download.redis.io/releases/redis-${redisVersion}.tar.gz"
ssh ${1} "tar -xvf redis-${redisVersion}.tar.gz && cd redis-${redisVersion}/ && make && make install"
ssh ${1} "cp -ar redis-${redisVersion}/src/* ."
LogMsg "${1} configured for Redis."
}
LogMsg()
{
echo `date "+%b %d %Y %T"` : "${1}" # Add the time stamp to the log message
echo `date "+%b %d %Y %T"` : "${1}" >> ./redisTest.log
}
UpdateTestState()
{
LogMsg "${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}"
LogMsg "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
LogMsg "Server=${server}"
if [ ! ${client} ]; then
errMsg="Please add/provide value for client in constants.sh. client=<client ip>"
LogMsg "${errMsg}"
LogMsg "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
LogMsg "Client=${client}"
if [ ! ${test_pipeline_collection} ]; then
errMsg="Please add/provide value for test_pipeline_collection in constants.sh. test_pipeline_collection=(1 2 4 8 16)"
LogMsg "${errMsg}"
LogMsg "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
LogMsg "test_pipeline_collection=${test_pipeline_collection}"
if [ ! ${redisVersion} ]; then
errMsg="Please add/provide value for redisVersion in constants.sh. redisVersion=2.8.17"
LogMsg "${errMsg}"
LogMsg "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
LogMsg "redisVersion=${redisVersion}"
if [ ! ${redis_test_suites} ]; then
errMsg="Please add/provide value for redis_test_suites in constants.sh. redis_test_suites=get,set"
LogMsg "${errMsg}"
LogMsg "${errMsg}" >> ./summary.log
UpdateTestState $ICA_TESTABORTED
exit 1
fi
#Make & build Redis on client and server Machine
LogMsg "Configuring client ${client}..."
ConfigureRedisUbuntu ${client}
LogMsg "Configuring server ${server}..."
ConfigureRedisUbuntu ${server}
pkill -f redis-benchmark
ssh root@${server} pkill -f redis-server > /dev/null
t=0
while [ "x${test_pipeline_collection[$t]}" != "x" ]
do
pipelines=${test_pipeline_collection[$t]}
LogMsg "NEXT TEST: $pipelines pipelines"
# prepare running redis-server
LogMsg "Starting redis-server..."
ssh root@${server} "sar -n DEV 1 900" 2>&1 > redis-server-pipelines-${pipelines}.sar.netio.log &
ssh root@${server} "iostat -x -d 1 900" 2>&1 > redis-server-pipelines-${pipelines}.iostat.diskio.log &
ssh root@${server} "vmstat 1 900" 2>&1 > redis-server-pipelines-${pipelines}.vmstat.memory.cpu.log &
#start running the redis-server on server
ssh root@${server} "./redis-server > /dev/null &"
LogMsg "Server started successfully. Sleeping 10 Secondss.."
sleep 10
# prepare running redis-benchmark
sar -n DEV 1 900 2>&1 > redis-client-pipelines-${pipelines}.sar.netio.log &
iostat -x -d 1 900 2>&1 > redis-client-pipelines-${pipelines}.iostat.diskio.log &
vmstat 1 900 2>&1 > redis-client-pipelines-${pipelines}.vmstat.memory.cpu.log &
#start running the redis-benchmark on client
LogMsg "Starting redis-benchmark on client..."
LogMsg "-> Test running with ${pipelines} pipelines."
./redis-benchmark -h $server -c 1000 -P $pipelines -t $redis_test_suites -d 4000 -n 10000000 > redis-client-pipelines-${pipelines}.set.get.log
LogMsg "-> done"
#cleanup redis-server
LogMsg "Cleaning Server..."
ssh root@${server} pkill -f sar 2>&1 > /dev/null
ssh root@${server} pkill -f iostat 2>&1 > /dev/null
ssh root@${server} pkill -f vmstat 2>&1 > /dev/null
ssh root@${server} pkill -f redis-server 2>&1 > /dev/null
#cleanup redis-benchmark
LogMsg "Cleaning Client..."
pkill -f sar 2>&1 > /dev/null
pkill -f iostat 2>&1 > /dev/null
pkill -f vmstat 2>&1 > /dev/null
pkill -f redis-benchmark 2>&1 > /dev/null
t=$(($t + 1))
LogMsg "Sleeping 30 Seconds..."
sleep 30
done
UpdateTestState ICA_TESTCOMPLETED

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

@ -0,0 +1,513 @@
#!/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.
#
#######################################################################
#######################################################################
#
# performance_middleware_fio.sh
#
# Description:
# Install fio so the fio benchmark can
# be run. This script needs to be run on single VM.
#
# steps:
#
# 1. Install a fio
# 2. Start fio benchmark test on given disk
#
# Author: Sivakanth
# Email: v-sirebb@microsoft.com
#######################################################################
#
# Constants/Globals
#
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
CONSTANTS_FILE="constants.sh"
SUMMARY_LOG=~/summary.log
#######################################################################
#
# LogMsg()
#
#######################################################################
LogMsg()
{
echo `date "+%b %d %Y %T"` : "${1}" # Add the time stamp to the log message
echo "${1}" >> ~/Fio.log
}
#######################################################################
#
# UpdateTestState()
#
#######################################################################
UpdateTestState()
{
echo "${1}" > ~/state.txt
}
#######################################################################
#
# UpdateSummary()
#
#######################################################################
UpdateSummary()
{
echo "${1}" >> ~/summary.log
}
#######################################################################
#
# TimeToSeconds()
#
#######################################################################
TimeToSeconds()
{
read -r h m s <<< $(echo $1 | tr ':' ' ')
#echo $(((h*60*60)+(m*60)+s))
echo `echo "${h}*60*60+${m}*60+${s}" | bc`
}
#######################################################################
#
# LinuxRelease()
#
#######################################################################
LinuxRelease()
{
DISTRO=`grep -ihs "buntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux" /etc/{issue,*release,*version}`
case $DISTRO in
*buntu*)
echo "UBUNTU";;
Fedora*)
echo "FEDORA";;
CentOS*)
echo "CENTOS";;
*SUSE*)
echo "SLES";;
Red*Hat*)
echo "RHEL";;
Debian*)
echo "DEBIAN";;
esac
}
set -u
set -x
RunFIO()
{
testfilesize=${testfilesize}
FILEIO="--size=$testfilesize --direct=1 --ioengine=libaio --filename=fiodata --overwrite=1 "
####################################
#All run config set here
#
#Log Config
mkdir -p $HOMEDIR/FIOLog/jsonLog
mkdir -p $HOMEDIR/FIOLog/iostatLog
mkdir -p $HOMEDIR/FIOLog/sarLog
mkdir -p $HOMEDIR/FIOLog/vmstatLog
mkdir -p $HOMEDIR/FIOLog/blktraceLog
#LOGDIR="${HOMEDIR}/FIOLog"
JSONFILELOG="${LOGDIR}/jsonLog"
IOSTATLOGDIR="${LOGDIR}/iostatLog"
VMSTATLOGDIR="${LOGDIR}/vmstatLog"
SAROGDIR="${LOGDIR}/sarLog"
BLKTRACELOGDIR="${LOGDIR}/blktraceLog"
LOGFILE="${LOGDIR}/fio-test.log.txt"
#redirect blktrace files directory
Resource_mount=$(mount -l | grep /sdb1 | awk '{print$3}')
blk_base="${Resource_mount}/blk-$(date +"%m%d%Y-%H%M%S")"
mkdir $blk_base
#
#
#Test config
#
#
#All possible values for file-test-mode are randread randwrite read write
iteration=0
numjobs=1
testmodes=${testmodes}
ioSize=${ioSizes}
ioDepth=${ioDepths}
ioruntime=${ioruntime}
####################################
echo "Test log created at: ${LOGFILE}"
LogMsg "===================================== Starting Run $(date +"%x %r %Z") ================================"
echo "===================================== Starting Run $(date +"%x %r %Z") ================================" >> $LOGFILE
chmod 666 $LOGFILE
LogMsg "Preparing Files: $FILEIO"
echo "Preparing Files: $FILEIO" >> $LOGFILE
# Remove any old files from prior runs (to be safe), then prepare a set of new files.
rm fiodata
LogMsg "--- Kernel Version Information ---"
echo "--- Kernel Version Information ---" >> $LOGFILE
uname -a >> $LOGFILE
cat /proc/version >> $LOGFILE
cat /etc/*-release >> $LOGFILE
echo "--- PCI Bus Information ---" >> $LOGFILE
lspci >> $LOGFILE
echo "--- Drive Mounting Information ---" >> $LOGFILE
mount >> $LOGFILE
echo "--- Disk Usage Before Generating New Files ---" >> $LOGFILE
df -h >> $LOGFILE
fio --cpuclock-test >> $LOGFILE
fio $FILEIO --readwrite=read --bs=1M --runtime=1 --iodepth=128 --numjobs=8 --name=prepare >> $LOGFILE
echo "--- Disk Usage After Generating New Files ---" >> $LOGFILE
df -h >> $LOGFILE
echo "=== End Preparation $(date +"%x %r %Z") ===" >> $LOGFILE
####################################
#Trigger run from here
for testmode in $testmodes; do
for ioSize in $ioSizes; do
for ioDepth in $ioDepths; do
if [ $ioDepth -ge 8 ]
then
numjobs=8
else
numjobs=$ioDepth
fi
iostatfilename="${IOSTATLOGDIR}/iostat-fio-${testmode}-${ioSize}K-${ioDepth}td.txt"
nohup iostat -x $ioruntime -t -y > $iostatfilename &
iostatPID=$!
sarfilename="${SAROGDIR}/sar-fio-${testmode}-${ioSize}K-${ioDepth}td.txt"
nohup sar -n DEV 1 $ioruntime 2>&1 > $sarfilename &
sarPID=$!
vmstatfilename="${VMSTATLOGDIR}/vmstat-fio-${testmode}-${ioSize}K-${ioDepth}td.txt"
nohup vmstat 1 $ioruntime 2>&1 > $vmstatfilename &
vmstatPID=$!
echo "-- iteration ${iteration} ----------------------------- ${testmode} test, ${ioSize}K bs, ${ioDepth} threads, ${numjobs} jobs, $ioruntime seconds ------------------ $(date +"%x %r %Z") ---" >> $LOGFILE
jsonfilename="${JSONFILELOG}/fio-result-${testmode}-${ioSize}K-${ioDepth}td.json"
fio $FILEIO --readwrite=$testmode --bs=${ioSize}K --runtime=$ioruntime --iodepth=$ioDepth --numjobs=$numjobs --output-format=json --output=$jsonfilename --name="iteration"${iteration} >> $LOGFILE
kill -9 $iostatPID $sarPID $vmstatPID
iteration=$(( iteration+1 ))
done
done
done
####################################
echo "===================================== Completed Run $(date +"%x %r %Z") ================================" >> $LOGFILE
rm fiodata
echo "Test logs are located at ${LOGDIR}"
}
ConfigCentOS7()
{
fioCentOS7pkg="fio-2.1.10-1.el7.rf.x86_64.rpm"
LogMsg "INFO: CentOS7: installing required packages"
yum install -y wget sysstat mdadm blktrace
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install wget tar sysstat mdadm blktrace"
UpdateTestState $ICA_TESTABORTED
exit 1
fi
mount -t debugfs none /sys/kernel/debug
installed=`which fio`
if [ ! $installed ]; then
LogMsg "INFO: Installing fio"
fiolPkg=$(ls | grep ${fioCentOS7pkg})
if [ -z "$fiolPkg" ]; then
wget "http://pkgs.repoforge.org/fio/${fioCentOS7pkg}"
fi
yum install -y ${fioCentOS7pkg}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install fio"
UpdateTestState $ICA_TESTABORTED
exit 1
fi
fi
}
ConfigCentOS6()
{
fioCentOS6pkg="fio-2.1.10-1.el6.rf.x86_64.rpm"
LogMsg "INFO: CentOS6: installing required packages"
yum install -y wget sysstat mdadm blktrace
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install wget tar sysstat mdadm blktrace"
UpdateTestState $ICA_TESTABORTED
exit 1
fi
mount -t debugfs none /sys/kernel/debug
installed=`which fio`
if [ ! $installed ]; then
LogMsg "INFO: Installing fio"
fiolPkg=$(ls | grep ${fioCentOS6pkg})
if [ -z "$fiolPkg" ]; then
wget "http://pkgs.repoforge.org/fio/${fioCentOS6pkg}"
fi
yum install -y libibverbs.x86_64
yum install -y ${fioCentOS6pkg}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install fio"
UpdateTestState $ICA_TESTABORTED
exit 1
fi
fi
}
ConfigUbuntu()
{
LogMsg "INFO: Ubuntu installing required packages"
apt-get update -y
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to apt-get update"
UpdateTestState $ICA_TESTABORTED
exit 1
fi
apt-get install -y wget tar sysstat blktrace
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install wget tar sysstat mdadm blktrace"
UpdateTestState $ICA_TESTABORTED
exit 1
fi
mount -t debugfs none /sys/kernel/debug
installed=`which fio`
if [ ! $installed ]; then
LogMsg "INFO: Installing fio"
apt-get install -y fio ;
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install fio"
UpdateTestState $ICA_TESTABORTED
exit 1
fi
fi
}
ConfigSLES()
{
fioCentOS6pkg="fio-2.1.2-2.1.3.x86_64.rpm"
LogMsg "INFO: SLES: installing required packages"
zypper --non-interactive install wget sysstat mdadm blktrace
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install wget tar sysstat mdadm blktrace"
UpdateTestState $ICA_TESTABORTED
exit 1
fi
mount -t debugfs none /sys/kernel/debug
installed=`which fio`
if [ ! $installed ]; then
LogMsg "INFO: Installing fio"
fiolPkg=$(ls | grep ${fioCentOS6pkg})
if [ -z "$fiolPkg" ]; then
wget "ftp://195.220.108.108/linux/opensuse/distribution/13.1/repo/oss/suse/x86_64/${fioCentOS6pkg}"
fi
(echo i;) | zypper --non-interactive install ${fioCentOS6pkg}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install fio"
UpdateTestState $ICA_TESTABORTED
exit 1
fi
fi
}
CreateRAID0()
{
disks=$(ls -l /dev | grep sd[c-z]$ | awk '{print $10}')
#disks=(`fdisk -l | grep 'Disk.*/dev/sd[a-z]' |awk '{print $2}' | sed s/://| sort| grep -v "/dev/sd[ab]$" `)
LogMsg "INFO: Check and remove RAID first"
mdvol=$(cat /proc/mdstat | grep "active raid" | awk {'print $1'})
if [ -n "$mdvol" ]; then
echo "/dev/${mdvol} already exist...removing first"
umount /dev/${mdvol}
mdadm --stop /dev/${mdvol}
mdadm --remove /dev/${mdvol}
mdadm --zero-superblock /dev/sd[c-z][1-5]
fi
LogMsg "INFO: Creating Partition"
count=0
for disk in ${disks}
do
echo "formatting disk /dev/${disk}"
(echo d; echo n; echo p; echo 1; echo; echo; echo t; echo fd; echo w;) | fdisk /dev/${disk}
count=$(( $count + 1 ))
done
LogMsg "INFO: Creating RAID"
mdadm --create ${mdVolume} --level 0 --raid-devices ${count} /dev/sd[c-z][1-5]
time mkfs -y $1 -F ${mdVolume}
mkdir ${mountDir}
mount -o nobarrier ${mdVolume} ${mountDir}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to create raid"
UpdateTestState $ICA_TESTABORTED
exit 1
fi
#LogMsg "INFO: adding fstab entry"
#echo "${mdVolume} ${mountDir} ext4 defaults 1 1" >> /etc/fstab
}
CreateLVM()
{
disks=$(ls -l /dev | grep sd[c-z]$ | awk '{print $10}')
#disks=(`fdisk -l | grep 'Disk.*/dev/sd[a-z]' |awk '{print $2}' | sed s/://| sort| grep -v "/dev/sd[ab]$" `)
#LogMsg "INFO: Check and remove LVM first"
vgExist=$(vgdisplay)
if [ -n "$vgExist" ]; then
umount ${mountDir}
lvremove -A n -f /dev/${vggroup}/lv1
vgremove ${vggroup} -f
fi
LogMsg "INFO: Creating Partition"
count=0
for disk in ${disks}
do
echo "formatting disk /dev/${disk}"
(echo d; echo n; echo p; echo 1; echo; echo; echo t; echo fd; echo w;) | fdisk /dev/${disk}
count=$(( $count + 1 ))
done
LogMsg "INFO: Creating LVM with all data disks"
pvcreate /dev/sd[c-z][1-5]
vgcreate ${vggroup} /dev/sd[c-z][1-5]
lvcreate -l 100%FREE -i 12 -I 64 ${vggroup} -n lv1
time mkfs -t $1 -F /dev/${vggroup}/lv1
mkdir ${mountDir}
mount -o nobarrier /dev/${vggroup}/lv1 ${mountDir}
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to create LVM "
UpdateTestState $ICA_TESTABORTED
exit 1
fi
#LogMsg "INFO: adding fstab entry"
#echo "${mdVolume} ${mountDir} ext4 defaults 1 1" >> /etc/fstab
}
############################################################
# Main body
############################################################
#cd ~
UpdateTestState $ICA_TESTRUNNING
LogMsg "Updated test case state to running"
rm -f ~/summary.log
touch ~/summary.log
if [ -e ${CONSTANTS_FILE} ]; then
source ${CONSTANTS_FILE}
else
errMsg="Error: missing ${CONSTANTS_FILE} file"
LogMsg "${errMsg}"
echo "${errMsg}" >> ~/summary.log
UpdateTestState $ICA_TESTABORTED
exit 10
fi
HOMEDIR=$HOME
mv $HOMEDIR/FIOLog/ $HOMEDIR/FIOLog-$(date +"%m%d%Y-%H%M%S")/
mkdir -p $HOMEDIR/FIOLog
LOGDIR="${HOMEDIR}/FIOLog"
touch ${LOGDIR}/fio-test.log.txt
#mdVolume="/dev/md1"
#vggroup="vg1"
mountDir="/sdc1mnt/fio"
testdisk=${testdisk}
echo "Disk for FIO benchmark test $testdisk" && (echo n; echo p; echo 1; echo; echo; echo t; echo 83; echo w;) | fdisk $testdisk && time mkfs.ext4 ${testdisk}1 && echo "${testdisk}1 disk format: Success" && mkdir -p $mountDir && mount -o nobarrier ${testdisk}1 $mountDir && echo "${testdisk}1 disk mount: Success on $mountDir"
if [ $? -ne 0 ]; then
LogMsg "Error: Disk for FIO benchmark test $testdisk: FAILED"
UpdateTestState $ICA_TESTABORTED
exit 1
fi
LogMsg "Disk for FIO benchmark test $testdisk is mounted on $mountDir: Success"
cd ${HOMEDIR}
DISTRO=`grep -ihs "buntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux" /etc/{issue,*release,*version}`
case $DISTRO in
Ubuntu*)
echo "UBUNTU"
ConfigUbuntu
;;
Fedora*)
echo "FEDORA";;
*release*7.*)
echo "CENTOS 7.*"
ConfigCentOS7
;;
*release*6.*)
echo "CENTOS 6.*"
ConfigCentOS6
;;
*SUSE*)
echo "SLES"
ConfigSLES
;;
Red*Hat*)
echo "RHEL";;
Debian*)
echo "DEBIAN";;
esac
#Creating RAID before triggering test
#CreateRAID0 ext4
#CreateLVM ext4
#Run test from here
LogMsg "*********INFO: Starting test execution*********"
cd ${mountDir}
mkdir sampleDIR
RunFIO
if [ $? -ne 0 ]; then
LogMsg "Error: FIO run: FAILED"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "*********INFO: Script execution reach END. Completed !!!*********"
UpdateTestState $ICA_TESTCOMPLETED
exit 0

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

@ -0,0 +1,473 @@
#!/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.
#
#######################################################################
#######################################################################
#
# performance_mongodb.sh
#
# Description:
# Install and configure mongodb so the ycsb benchmark can
# be run. This script needs to be run on single VM.
#
# mongo perf needs Java runtime is also installed.
#
# Installing and configuring Hadoop consists of the following
# steps:
#
# 1. Install a Java JDK
# 2. Download the MongoDB tar.gz archive
# 3. Unpackage the Mongo archive
# 4. Move the mongo directory to /usr/bin/
# 5. Update the ~/.bashrc file with mongodb specific exports
# 8. Start ycsb test
#######################################################################
#
# Constants/Globals
#
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
CONSTANTS_FILE="/root/constants.sh"
SUMMARY_LOG=~/summary.log
MONGODB_VERSION="2.4.0"
MONGODB_ARCHIVE="mongodb-linux-x86_64-${MONGODB_VERSION}.tgz"
MONGODB_URL="http://fastdl.mongodb.org/linux/${MONGODB_ARCHIVE}"
#######################################################################
#
# LogMsg()
#
#######################################################################
LogMsg()
{
echo `date "+%b %d %Y %T"` : "${1}" # Add the time stamp to the log message
echo "${1}" >> ~/mongodb.log
}
#######################################################################
#
# UpdateTestState()
#
#######################################################################
UpdateTestState()
{
echo "${1}" > ~/state.txt
}
#######################################################################
#
# UpdateSummary()
#
#######################################################################
UpdateSummary()
{
echo "${1}" >> ~/summary.log
}
#######################################################################
#
# TimeToSeconds()
#
#######################################################################
TimeToSeconds()
{
read -r h m s <<< $(echo $1 | tr ':' ' ')
#echo $(((h*60*60)+(m*60)+s))
echo `echo "${h}*60*60+${m}*60+${s}" | bc`
}
#######################################################################
#
# LinuxRelease()
#
#######################################################################
LinuxRelease()
{
DISTRO=`grep -ihs "buntu\|Suse\|Fedora\|Debian\|CentOS\|Red Hat Enterprise Linux" /etc/{issue,*release,*version}`
case $DISTRO in
*buntu*)
echo "UBUNTU";;
Fedora*)
echo "FEDORA";;
CentOS*)
echo "CENTOS";;
*SUSE*)
echo "SLES";;
Red*Hat*)
echo "RHEL";;
Debian*)
echo "DEBIAN";;
esac
}
#######################################################################
#
# ConfigRhel()
#
#######################################################################
ConfigRhel()
{
LogMsg "ConfigRhel"
#
# Install Java
#
LogMsg "Check if Java is installed"
javaInstalled=`which java`
if [ ! $javaInstalled ]; then
LogMsg "Installing Java"
yum -y install java-1.7.0-openjdk
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install Java"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
fi
ssh root@${MD_SERVER} "yum -y install java-1.7.0-openjdk"
#
# Figure out where Java is installed so we can configure a JAVA_HOME variable
#
LogMsg "Create JAVA_HOME variable"
javaConfig=`echo "" | update-alternatives --config java | grep "*"`
tokens=( $javaConfig )
javaPath=${tokens[2]}
if [ ! -e $javaPath ]; then
LogMsg "Error: Unable to find the Java install path"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
temp=`dirname $javaPath`
JAVA_HOME=`dirname $temp`
if [ ! -e $JAVA_HOME ]; then
LogMsg "Error: Invalid JAVA_HOME computed: ${JAVA_HOME}"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
#
# This is a hack so we can use the same mongodb config on all Linux
# distros. With RHEL, localhost fails. By setting the hostname
# to localhost, then the default config works in RHEL.
# Need to revisit this to find a better solution.
#
#hostname localhost
}
#######################################################################
#
# ConfigSles()
#
#######################################################################
ConfigSles()
{
LogMsg "ConfigSles"
#
# Install Java
#
LogMsg "Check if Java is installed"
javaInstalled=`which java`
if [ ! $javaInstalled ]; then
LogMsg "Installing Java"
zypper --non-interactive install jre-1.7.0
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install java"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
fi
ssh root@${MD_SERVER} "zypper --non-interactive install jre-1.7.0"
#
# Figure out where Java is installed so we can configure a JAVA_HOME variable
#
javaConfig=`update-alternatives --config java`
tempHome=`echo $javaConfig | cut -f 2 -d ':' | cut -f 2 -d ' '`
if [ ! -e $tempHome ]; then
LogMsg "Error: The Java directory '${tempHome}' does not exist"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
temp1=`dirname $tempHome`
JAVA_HOME=`dirname $temp1`
if [ ! -e $JAVA_HOME ]; then
LogMsg "Error: Invalid JAVA_HOME computed: ${JAVA_HOME}"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
#
# Depending on how the user configs the SLES system, we may or may not
# need the following workaround to allow mongodb to use localhost
#
#hostname localhost
}
#######################################################################
#
# ConfigUbuntu()
#
#######################################################################
ConfigUbuntu()
{
LogMsg "ConfigUbuntu"
#
# Install Java
#
LogMsg "Check if Java is installed"
javaInstalled=`which java`
if [ ! $javaInstalled ]; then
LogMsg "Installing Java"
apt-get update
apt-get -y install default-jdk
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to install java"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
fi
ssh root@${MD_SERVER} "apt-get update"
ssh root@${MD_SERVER} "apt-get -y install default-jdk sysstat"
apt-get -y install default-jdk sysstat
#
# Figure out where Java is installed so we can configure a JAVA_HOME variable
#
javaConfig=`update-alternatives --config java`
tempHome=`echo $javaConfig | cut -f 2 -d ':' | cut -f 2 -d ' '`
if [ ! -e $tempHome ]; then
LogMsg "Error: The Java directory '${tempHome}' does not exist"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
temp1=`dirname $tempHome`
temp2=`dirname $temp1`
JAVA_HOME=`dirname $temp2`
if [ ! -e $JAVA_HOME ]; then
LogMsg "Error: Invalid JAVA_HOME computed: ${JAVA_HOME}"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
}
#######################################################################
#
# Main script body
#
#######################################################################
cd ~
UpdateTestState $ICA_TESTRUNNING
LogMsg "Updated test case state to running"
rm -f ~/summary.log
touch ~/summary.log
if [ -e ${CONSTANTS_FILE} ]; then
source ${CONSTANTS_FILE}
else
errMsg="Error: missing ${CONSTANTS_FILE} file"
LogMsg "${errMsg}"
echo "${errMsg}" >> ~/summary.log
UpdateTestState $ICA_TESTABORTED
exit 10
fi
if [ ! ${MONGODB_VERSION} ]; then
errMsg="The MONGODB_VERSION test parameter is not defined. Setting as ${MONGODB_VERSION} "
LogMsg "${errMsg}"
echo "${errMsg}" >> ~/summary.log
fi
if [ ! ${MD_SERVER} ]; then
nThreads=16
#nThreads=8
LogMsg "Info : nThreads not defined in constants.sh. Setting as ${nThreads}"
fi
#
# Install Java
#
distro=`LinuxRelease`
case $distro in
"CENTOS" | "RHEL")
ConfigRhel
;;
"UBUNTU")
ConfigUbuntu
;;
"DEBIAN")
LogMsg "Debian is not supported"
UpdateTestState "TestAborted"
UpdateSummary " Distro '${distro}' is not currently supported"
exit 1
;;
"SLES")
ConfigSles
;;
*)
LogMsg "Distro '${distro}' not supported"
UpdateTestState "TestAborted"
UpdateSummary " Distro '${distro}' not supported"
exit 1
;;
esac
#
# Download MongoDB to server and start mongodb server.
#
LogMsg "Downloading MangoDB if we do not have a local copy"
if [ ! -e "/root/${MONGODB_ARCHIVE}" ]; then
LogMsg "Downloading Hadoop from ${MONGODB_URL}"
ssh root@${MD_SERVER} "wget ${MONGODB_URL}"
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to download mongodb from ${MONGODB_URL}"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "MangoDB successfully downloaded"
fi
#
# Untar and install Hadoop
#
LogMsg "Extracting the mongodb archive"
ssh root@${MD_SERVER} "tar xfvz mongodb-linux-x86_64-${MONGODB_VERSION}.tgz"
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to extract mongodb from its archive"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "Download YCSB on client VM"
curl -O --location https://github.com/brianfrankcooper/YCSB/releases/download/0.5.0/ycsb-0.5.0.tar.gz
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to download YCSB"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "Extract YCSB on client VM"
tar xfvz ycsb-0.5.0.tar.gz
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to download YCSB"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "Check if MangoDB specific exports are in the .bashrc file"
grep -q "mangodb exports start" ~/.bashrc
if [ $? -ne 0 ]; then
LogMsg "MongoDB exports not found in ~/.bashrc, adding them"
echo "" >> ~/.bashrc
echo "# mango exports start" >> ~/.bashrc
echo "export JAVA_HOME=${JAVA_HOME}" >> ~/.bashrc
echo "# MangoDB exports end" >> ~/.bashrc
fi
#
# Sourcing the update .bashrc
#
source ~/.bashrc
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to source .bashrc"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "Starting MongoDB on ${MD_SERVER}"
#Preparing the mounted disk for mongodb test
diskName=`ssh root@server-vm fdisk -l | grep 'Disk.*/dev/sd[a-z]' |awk '{print $2}' | sed s/://| sort| grep -v "/dev/sd[ab]$"`
if [ $? -ne 0 ]; then
LogMsg "Error: Disk for mongodb benchmark test $diskName: FAILED"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
mountdir="/sdc1mnt/mongodb"
ssh root@server-vm "echo "Disk for mongodb benchmark test $diskName" && (echo n; echo p; echo 1; echo; echo; echo t; echo 83; echo w;) | fdisk $diskName && time mkfs.ext4 ${diskName}1 && echo "${diskName}1 disk format: Success" && mkdir -p $mountdir && mount -o nobarrier ${diskName}1 $mountdir && echo "${diskName}1 disk mount: Success on $mountdir" "
if [ $? -ne 0 ]; then
LogMsg "Error: Disk for mongodb benchmark test $diskName: FAILED"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "Disk for mongodb benchmark test $diskName is mounted: Success"
ssh root@${MD_SERVER} "killall mongod"
ssh root@${MD_SERVER} "/root/mongodb-linux-x86_64-${MONGODB_VERSION}/bin/mongod --dbpath $mountdir --fork --logpath mongodServerConsole.txt"
if [ $? -ne 0 ]; then
LogMsg "Error: Unable to start mongod server"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "Using the asynchronous driver to load the test data"
echo "CMD: /root/ycsb-0.5.0/bin/ycsb load mongodb-async -s -P workloadAzure -p mongodb.url=mongodb://${MD_SERVER}:27017/ycsb?w=0"
/root/ycsb-0.5.0/bin/ycsb load mongodb-async -s -P workloadAzure -p mongodb.url=mongodb://${MD_SERVER}:27017/ycsb?w=0
if [ $? -ne 0 ]; then
LogMsg "Error: Unable load the test data"
UpdateTestState $ICA_TESTFAILED
exit 1
fi
LogMsg "Using the asynchronous driver to load the test data: Success"
LogMsg "Using the asynchronous driver to run the test on /root/run-ycsb.sh ${MD_SERVER}"
LogMsg "ycsb benchmark test run: Success"
chmod +x /root/run-ycsb.sh
/root/run-ycsb.sh
#
# If we made it here, everything worked.
#
UpdateTestState $ICA_TESTCOMPLETED
exit 0

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

@ -0,0 +1,64 @@
#!/bin/bash
#
# It runs the ycsb bechmark test on given server
# ./run-ycsb.sh
#######
CONSTANTS_FILE="/root/constants.sh"
if [ -e ${CONSTANTS_FILE} ]; then
source ${CONSTANTS_FILE}
else
errMsg="Error: missing ${CONSTANTS_FILE} file"
LogMsg "${errMsg}"
echo "${errMsg}" >> ~/summary.log
UpdateTestState $ICA_TESTABORTED
exit 10
fi
log_folder="/root/benchmark/mongodb/logs"
echo "Running ycsb benchmark test on server $MD_SERVER"
ssh root@${MD_SERVER} mkdir -p $log_folder
t=0
while [ "x${test_threads_collection[$t]}" != "x" ]
do
threads=${test_threads_collection[$t]}
echo "TEST RUNNING WITH: $threads threads"
# prepare running mongodb-server
echo "prepare running mongodb-server"
ssh root@${MD_SERVER} "mkdir -p $log_folder/$threads"
ssh root@${MD_SERVER} "sar -n DEV 1 ${maxexecutiontime} 2>&1 > $log_folder/$threads/$threads-mongodb-server.sar.netio.log " &
ssh root@${MD_SERVER} "iostat -x -d 1 ${maxexecutiontime} 2>&1 > $log_folder/$threads/$threads-mongodb-server.iostat.diskio.log " &
ssh root@${MD_SERVER} "vmstat 1 ${maxexecutiontime} 2>&1 > $log_folder/$threads/$threads-mongodb-server.vmstat.memory.cpu.log " &
# prepare running mongodb-benchmark(ycsb)
echo "prepare running mongodb-benchmark(ycsb)"
mkdir -p $log_folder/$threads
sar -n DEV 1 ${maxexecutiontime} 2>&1 > $log_folder/$threads/$threads-mongodb-client.sar.netio.log &
iostat -x -d 1 ${maxexecutiontime} 2>&1 > $log_folder/$threads/$threads-mongodb-client.iostat.diskio.log &
vmstat 1 ${maxexecutiontime} 2>&1 > $log_folder/$threads/$threads-mongodb-client.vmstat.memory.cpu.log &
#start running the mongodb(ycsb)-benchmark on client
echo "-> TEST RUNNING with threads $threads .."
echo "CMD: ./ycsb-0.5.0/bin/ycsb run mongodb-async -s -P workloadAzure -p mongodb.url=mongodb://${MD_SERVER}:27017/ycsb?w=0 -threads $threads > $log_folder/$threads/$threads.ycsb.run.log"
./ycsb-0.5.0/bin/ycsb run mongodb-async -s -P workloadAzure -p mongodb.url=mongodb://${MD_SERVER}:27017/ycsb?w=0 -threads $threads > $log_folder/$threads/$threads-mongodb.ycsb.run.log
echo "-> TEST END with threads $threads"
#cleanup mongodb-server
echo "cleanup mongodb-server"
ssh root@${MD_SERVER} pkill -f sar
ssh root@${MD_SERVER} pkill -f iostat
ssh root@${MD_SERVER} pkill -f vmstat
#cleanup mongodb-benchmark(ycsb)
echo "cleanup mongodb-benchmark(ycsb)"
pkill -f sar
pkill -f iostat
pkill -f vmstat
echo "sleep 60 seconds"
sleep 60
t=$(($t + 1))
echo "$t"
done

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

@ -10,6 +10,15 @@ then
duration=$1
filename=$2
username=$3
logFolder="logs-`hostname`"
elif [[ $# == 5 ]]
then
duration=$1
filename=$2
username=$3
testtype=$4
buffersize=$5
logFolder="logs-`hostname`-$testtype-$buffersize"
else
echo "Usage: bash $0 <duration> <filename> <username>"
exit -1
@ -52,7 +61,8 @@ fi
vm_bus_ver=`modinfo hv_vmbus| grep ^version| awk '{print $2}'`
logs_dir=$code_path/logs-`hostname`-`uname -r`-`get_lis_version`/$filename
#logs_dir=$code_path/logs-`hostname`-`uname -r`-`get_lis_version`/$filename
logs_dir=$code_path/$logFolder/$filename
filename=$logs_dir/$filename
mkdir -p $logs_dir

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

@ -8,18 +8,44 @@
if [[ $# == 1 ]]
then
username=$1
elif [[ $# == 3 ]]
then
username=$1
testtype=$2
buffersize=$3
else
echo "Usage: bash $0 <vm_loginuser>"
exit -1
fi
code_path="/home/$username/code/"
ICA_TESTRUNNING="TestRunning" # The test is running
ICA_TESTCOMPLETED="TestCompleted" # The test completed successfully
ICA_TESTABORTED="TestAborted" # Error during setup of test
ICA_TESTFAILED="TestFailed" # Error during running of test
LogMsg()
{
echo `date "+%a %b %d %T %Y"` : ${1} # To add the timestamp to the log file
}
UpdateTestState()
{
echo $1 > $code_path/state.txt
}
#
# Create the state.txt file so ICA knows we are running
#
LogMsg "Updating test case state to running"
UpdateTestState $ICA_TESTRUNNING
code_path="/home/$username/code"
. $code_path/azuremodules.sh
if [[ `which iperf3` == "" ]]
then
echo "iperf3 not installed\n Installing now..."
install_package "iperf3"
echo "iperf3 not installed\n Installing now..."
install_package "iperf3"
fi
for port_number in `seq 8001 8101`
@ -33,19 +59,47 @@ do
echo "waiting..."
done
duration=600
for number_of_connections in 1 2 4 8 16 32 64 128 256 512 1024 2000 3000 4000 5000 6000
duration=300
for number_of_connections in 1 2 4 8 16 32 64 128 256 512 1024
do
for port_number in `seq 8001 8501`
do
iperf3 -s -D -p $port_number
if [ $? -ne 0 ]; then
LogMsg "iperf3 failed to connect server"
echo "iperf3 failed to connect server"
UpdateTestState $ICA_TESTFAILED
exit 80
fi
done
bash $code_path/sar-top.sh $duration $number_of_connections $username&
bash $code_path/sar-top.sh $duration $number_of_connections $username $testtype $buffersize&
if [ $? -ne 0 ]; then
LogMsg "sar-top failed to execute"
echo "sar-top failed to execute"
UpdateTestState $ICA_TESTFAILED
exit 80
fi
sleep $(($duration+10))
done
logs_dir=logs-`hostname`-`uname -r`-`get_lis_version`/
logs_dir=logs-`hostname`-$testtype-$buffersize
collect_VM_properties $code_path/$logs_dir/VM_properties.csv
bash $code_path/generate_csvs.sh $code_path/$logs_dir
bash $code_path/generate_csvs.sh $code_path/$logs_dir $testtype $buffersize
if [ $? -ne 0 ]; then
LogMsg "Failed to generate test results .csv file"
echo "Failed to generate test results .csv file"
UpdateTestState $ICA_TESTFAILED
exit 80
fi
mv /etc/rc.d/after.local.bkp /etc/rc.d/after.local
mv /etc/rc.local.bkp /etc/rc.local
mv /etc/rc.d/rc.local.bkp /etc/rc.d/rc.local
echo "$testtype $buffersize test is Completed at Server"
#
# Let ICA know we completed successfully
#
LogMsg "Updating test case state to completed"
UpdateTestState $ICA_TESTCOMPLETED