2014-08-27 03:47:08 +04:00
Import-Module . \ TestLibs \ RDFELibs . psm1 -Force
2014-06-25 03:35:28 +04:00
$Subtests = $currentTestData . SubtestValues
$SubtestValues = $Subtests . Split ( " , " )
$testResult = " "
$result = " "
$resultArr = @ ( )
$filesUploaded = $false
$isDeployed = DeployVMS -setupType $currentTestData . setupType -Distro $Distro -xmlConfig $xmlConfig
if ( $isDeployed )
{
2015-08-11 14:04:33 +03:00
foreach ( $VMdata in $allVMData )
{
if ( $VMdata . RoleName -imatch " PublicEndpoint " )
{
$hs1VIP = $VMdata . PublicIP
$hs1vm1sshport = $VMdata . SSHPort
$hs1vm1tcpport = $VMdata . TCPtestPort
$hs1vm1udpport = $VMdata . UDPtestPort
$hs1ServiceUrl = $VMdata . URL
}
elseif ( $VMdata . RoleName -imatch " DTAP " )
{
$dtapServerIp = $VMdata . PublicIP
$dtapServerSshport = $VMdata . SSHPort
$dtapServerTcpport = $VMdata . TCPtestPort
$dtapServerUdpport = $VMdata . UDPtestPort
}
}
2014-10-24 14:01:45 +04:00
LogMsg " Test Machine : $hs1VIP : $hs1vm1sshport "
LogMsg " DTAP Machine : $dtapServerIp : $hs1vm1sshport "
2014-12-31 15:47:24 +03:00
$iperfTimeoutSeconds = $currentTestData . iperfTimeoutSeconds
2014-08-27 03:47:08 +04:00
2015-03-01 21:47:50 +03:00
$cmd1 = " $python_cmd start-server.py -i1 -p $dtapServerTcpport && mv Runtime.log start-server.py.log -f "
$cmd2 = " $python_cmd start-client.py -c $dtapServerIp -p $dtapServerTcpport -t $iperfTimeoutSeconds -P $Value "
2014-06-25 03:35:28 +04:00
$server = CreateIperfNode -nodeIp $dtapServerIp -nodeSshPort $dtapServerSshport -nodeTcpPort $dtapServerTcpport -nodeIperfCmd $cmd1 -user $user -password $password -files $currentTestData . files -logDir $LogDir
2014-10-24 14:01:45 +04:00
LogMsg " $dtapServerIp set as iperf server "
2014-06-25 03:35:28 +04:00
$client = CreateIperfNode -nodeIp $hs1VIP -nodeSshPort $hs1vm1sshport -nodeTcpPort $hs1vm1tcpport -nodeIperfCmd $cmd2 -user $user -password $password -files $currentTestData . files -logDir $LogDir
2014-10-24 14:01:45 +04:00
LogMsg " $hs1VIP set as iperf client "
2014-06-25 03:35:28 +04:00
foreach ( $Value in $SubtestValues )
{
try
{
2014-10-24 14:01:45 +04:00
$testResult = $null
2014-06-25 03:35:28 +04:00
LogMsg " Test Started for Parallel Connections $Value "
2015-03-01 21:47:50 +03:00
$client . cmd = " $python_cmd start-client.py -c $dtapServerIp -p $dtapServerTcpport -t20 -P $Value "
2014-06-25 03:35:28 +04:00
mkdir $LogDir \ $Value -ErrorAction SilentlyContinue | out-null
$client . logDir = $LogDir + " \ $Value "
$server . logDir = $LogDir + " \ $Value "
2014-10-24 14:01:45 +04:00
function UploadFiles ( )
{
RemoteCopy -uploadTo $server . ip -port $server . sshPort -files $server . files -username $server . user -password $server . password -upload
RemoteCopy -uploadTo $client . Ip -port $client . sshPort -files $client . files -username $client . user -password $client . password -upload
$suppressedOut = RunLinuxCmd -username $client . user -password $client . password -ip $client . ip -port $client . sshPort -command " chmod +x *.py " -runAsSudo
$suppressedOut = RunLinuxCmd -username $server . user -password $server . password -ip $server . ip -port $server . sshPort -command " chmod +x *.py " -runAsSudo
return $true
}
if ( ! $filesUploaded )
{
$filesUploaded = UploadFiles
}
$suppressedOut = RunLinuxCmd -username $client . user -password $client . password -ip $client . ip -port $client . sshPort -command " rm -rf *.txt *.log " -runAsSudo
$suppressedOut = RunLinuxCmd -username $server . user -password $server . password -ip $server . ip -port $server . sshPort -command " rm -rf *.txt *.log " -runAsSudo
2014-06-25 03:35:28 +04:00
$testResult = IperfClientServerTestParallel -server $server -client $client
2014-08-27 03:47:08 +04:00
LogMsg " $( $currentTestData . testName ) : $Value : $testResult "
2014-06-25 03:35:28 +04:00
}
catch
{
$ErrorMessage = $_ . Exception . Message
LogMsg " EXCEPTION : $ErrorMessage "
}
Finally
{
$metaData = $Value
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
2015-08-06 21:51:47 +03:00
DoTestCleanUp -result $result -testName $currentTestData . testName -deployedServices $isDeployed -ResourceGroups $isDeployed
2014-06-25 03:35:28 +04:00
#Return the result and summery to the test suite script..
return $result , $resultSummary