azure-linux-automation/remote-scripts/NETWORK-IE-TCP-SINGLE-HS.ps1

82 строки
3.4 KiB
PowerShell

Import-Module .\TestLibs\RDFELibs.psm1 -Force
$result = ""
$testResult = ""
$resultArr = @()
$isDeployed = DeployVMS -setupType $currentTestData.setupType -Distro $Distro -xmlConfig $xmlConfig
if($isDeployed)
{
$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
$server = CreateIperfNode -nodeIp $hs1VIP -nodeSshPort $hs1vm1sshport -nodeTcpPort $hs1vm1tcpport -nodeIperfCmd $cmd1 -user $user -password $password -files $currentTestData.files -logDir $LogDir
$client = CreateIperfNode -nodeIp $hs1VIP -nodeSshPort $hs1vm2sshport -nodeTcpPort $hs1vm2tcpport -nodeIperfCmd $cmd2 -user $user -password $password -files $currentTestData.files -logDir $LogDir
$iperfTimeoutSeconds = $currentTestData.iperfTimeoutSeconds
$server.cmd = "$python_cmd start-server.py -i1 -p $hs1vm1tcpport && mv Runtime.log start-server.py.log -f"
foreach ($mode in $currentTestData.TestMode.Split(","))
{
try
{
$testResult = $null
RemoteCopy -uploadTo $hs1VIP -port $hs1vm1sshport -files $currentTestData.files -username $user -password $password -upload
RemoteCopy -uploadTo $hs1VIP -port $hs1vm2sshport -files $currentTestData.files -username $user -password $password -upload
$suppressedOut = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm1sshport -command "chmod +x *" -runAsSudo
$suppressedOut = RunLinuxCmd -username $user -password $password -ip $hs1VIP -port $hs1vm2sshport -command "chmod +x *" -runAsSudo
if(($mode -eq "IP") -or ($mode -eq "VIP") -or ($mode -eq "DIP"))
{
$client.cmd = "$python_cmd start-client.py -c $hs1vm1IP -i1 -p $hs1vm1tcpport -t$iperfTimeoutSeconds"
}
if(($mode -eq "URL") -or ($mode -eq "Hostname"))
{
$client.cmd = "$python_cmd start-client.py -c $hs1vm1Hostname -i1 -p $hs1vm1tcpport -t$iperfTimeoutSeconds"
}
mkdir $LogDir\$mode -ErrorAction SilentlyContinue | out-null
$server.logDir = $LogDir + "\$mode"
$client.logDir = $LogDir + "\$mode"
$testResult=IperfClientServerTestParallel $server $client
LogMsg "$($currentTestData.testName) : $mode : $testResult"
}
catch
{
$ErrorMessage = $_.Exception.Message
LogMsg "EXCEPTION : $ErrorMessage"
}
Finally
{
$metaData = "$mode"
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