From d1ae0e4b647e2c14e00f77952c30b8158f2d9ff4 Mon Sep 17 00:00:00 2001 From: Nick Banks Date: Thu, 7 Oct 2021 16:44:40 -0400 Subject: [PATCH] Run WAN Perf on WS2022 (#2061) --- .azure/azure-pipelines.ci.yml | 3 ++ .azure/azure-pipelines.periodic.yml | 5 +++ .azure/azure-pipelines.wanperf.yml | 1 + .azure/templates/run-wanperf.yml | 11 ++++--- scripts/prepare-machine.ps1 | 48 ++++++++++++++++++++++++++++- 5 files changed, 63 insertions(+), 5 deletions(-) diff --git a/.azure/azure-pipelines.ci.yml b/.azure/azure-pipelines.ci.yml index 3cd29ff78e..531ecf8816 100644 --- a/.azure/azure-pipelines.ci.yml +++ b/.azure/azure-pipelines.ci.yml @@ -481,6 +481,7 @@ stages: jobs: - template: ./templates/run-wanperf.yml parameters: + image: windows-2022 jobName: wanperf_5Mbps displayName: 5 Mbps iterations: 3 @@ -491,6 +492,7 @@ stages: logProfile: Datapath.Light - template: ./templates/run-wanperf.yml parameters: + image: windows-2022 jobName: wanperf_30Mbps displayName: 30 Mbps iterations: 3 @@ -501,6 +503,7 @@ stages: logProfile: Datapath.Light - template: ./templates/run-wanperf.yml parameters: + image: windows-2022 jobName: wanperf_100Mbps displayName: 100 Mbps iterations: 3 diff --git a/.azure/azure-pipelines.periodic.yml b/.azure/azure-pipelines.periodic.yml index e45a540e8a..5f934ff4b3 100644 --- a/.azure/azure-pipelines.periodic.yml +++ b/.azure/azure-pipelines.periodic.yml @@ -69,6 +69,7 @@ stages: jobs: - template: ./templates/run-wanperf.yml parameters: + image: windows-2022 jobName: wanperf_general_1 displayName: General Networks (5 Mbps) iterations: 3 @@ -83,6 +84,7 @@ stages: extraArgs: -Periodic - template: ./templates/run-wanperf.yml parameters: + image: windows-2022 jobName: wanperf_general_2 displayName: General Networks (10 Mbps) iterations: 3 @@ -97,6 +99,7 @@ stages: extraArgs: -Periodic - template: ./templates/run-wanperf.yml parameters: + image: windows-2022 jobName: wanperf_general_3 displayName: General Networks (50 Mbps) iterations: 3 @@ -111,6 +114,7 @@ stages: extraArgs: -Periodic - template: ./templates/run-wanperf.yml parameters: + image: windows-2022 jobName: wanperf_general_4 displayName: General Networks (100 Mbps) iterations: 3 @@ -125,6 +129,7 @@ stages: extraArgs: -Periodic - template: ./templates/run-wanperf.yml parameters: + image: windows-2022 jobName: wanperf_general_5 displayName: General Networks (200 Mbps) iterations: 3 diff --git a/.azure/azure-pipelines.wanperf.yml b/.azure/azure-pipelines.wanperf.yml index f49b80968a..b55801e74f 100644 --- a/.azure/azure-pipelines.wanperf.yml +++ b/.azure/azure-pipelines.wanperf.yml @@ -108,6 +108,7 @@ stages: jobs: - template: ./templates/run-wanperf.yml parameters: + image: windows-2022 jobName: wanperf_custom displayName: Custom protocol: ${{ parameters.protocol }} diff --git a/.azure/templates/run-wanperf.yml b/.azure/templates/run-wanperf.yml index 5a7e55cbf9..7700faa2ac 100644 --- a/.azure/templates/run-wanperf.yml +++ b/.azure/templates/run-wanperf.yml @@ -3,7 +3,7 @@ parameters: jobName: displayName: - pool: 'MsQuic-Win-Latest' + pool: '' image: '' platform: 'windows' config: 'Release' @@ -25,8 +25,8 @@ parameters: timeout: 15 jobs: -- job: ${{ parameters.jobName }} - displayName: ${{ parameters.displayName }} +- job: ${{ parameters.jobName }}_${{ replace(parameters.pool, '-', '_') }}${{ replace(replace(parameters.image, '-', '_'), '.', '_') }} + displayName: ${{ parameters.displayName }} (${{ parameters.pool }}${{ parameters.image }}) timeoutInMinutes: 0 ${{ if ne(parameters.pool, '') }}: pool: ${{ parameters.pool }} @@ -55,7 +55,10 @@ jobs: inputs: pwsh: true filePath: scripts/prepare-machine.ps1 - arguments: -Configuration Test + ${{ if ne(parameters.image, '') }}: + arguments: -Configuration Test -DuoNic + ${{ if eq(parameters.image, '') }}: + arguments: -Configuration Test - task: PowerShell@2 displayName: Run WAN Performance Test diff --git a/scripts/prepare-machine.ps1 b/scripts/prepare-machine.ps1 index cc97c5722f..3a83f81138 100644 --- a/scripts/prepare-machine.ps1 +++ b/scripts/prepare-machine.ps1 @@ -57,7 +57,10 @@ param ( [switch]$TestCertificates, [Parameter(Mandatory = $false)] - [switch]$SignCode + [switch]$SignCode, + + [Parameter(Mandatory = $false)] + [switch]$DuoNic ) #Requires -RunAsAdministrator @@ -133,6 +136,46 @@ function Install-ClogTool { } } +$ArtifactsPath = Join-Path $RootDir "artifacts" +$CoreNetCiPath = Join-Path $ArtifactsPath "corenet-ci-main" +$SetupPath = Join-Path $CoreNetCiPath "vm-setup" + +function Download-CoreNet-Deps { + # Download and extract https://github.com/microsoft/corenet-ci. + if (!(Test-Path $ArtifactsPath)) { mkdir $ArtifactsPath } + if (!(Test-Path $CoreNetCiPath)) { + $ZipPath = Join-Path $ArtifactsPath "corenet-ci.zip" + Invoke-WebRequest -Uri "https://github.com/microsoft/corenet-ci/archive/refs/heads/main.zip" -OutFile $ZipPath + Expand-Archive -Path $ZipPath -DestinationPath $ArtifactsPath -Force + Remove-Item -Path $ZipPath + } +} + +# Installs DuoNic from the CoreNet-CI repo. +function Install-DuoNic { + # Check to see if test signing is enabled. + $HasTestSigning = $false + try { $HasTestSigning = ("$(bcdedit)" | Select-String -Pattern "testsigning\s+Yes").Matches.Success } catch { } + if (!$HasTestSigning) { Write-Error "Test Signing Not Enabled!" } + + # Download the CI repo that contains DuoNic. + Write-Host "Downloading CoreNet-CI" + Download-CoreNet-Deps + + # Install the test root certificate. + Write-Host "Installing test root certificate" + $RootCertPath = Join-Path $SetupPath "testroot-sha2.cer" + if (!(Test-Path $RootCertPath)) { Write-Error "Missing file: $RootCertPath" } + certutil.exe -addstore -f "Root" $RootCertPath + + # Install the DuoNic driver. + Write-Host "Installing DuoNic driver" + $DuoNicPath = Join-Path $SetupPath duonic + $DuoNicScript = (Join-Path $DuoNicPath duonic.ps1) + if (!(Test-Path $DuoNicScript)) { Write-Error "Missing file: $DuoNicScript" } + Invoke-Expression "cmd /c `"pushd $DuoNicPath && pwsh duonic.ps1 -Install`"" +} + if (($Configuration -eq "Dev")) { Install-ClogTool "Microsoft.Logging.CLOG" } @@ -301,6 +344,9 @@ if ($IsWindows) { # Delete the installer. Remove-Item -Path $ExeFile } + if ($DuoNic) { + Install-DuoNic + } } } elseif ($IsLinux) {