This commit is contained in:
Dan Cuomo 2020-12-11 22:38:27 -08:00
Родитель 35d7f4ee93
Коммит 5e4353f541
5 изменённых файлов: 1640 добавлений и 203 удалений

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

@ -1,5 +1,6 @@
using module .\internal\helpers.psm1
using module .\internal\datatypes.psm1
using module .\internal\WttLog.psm1
function Test-NICProperties {
<#
@ -13,9 +14,12 @@ function Test-NICProperties {
[CmdletBinding(DefaultParameterSetName = 'Default')]
param (
[Parameter(Mandatory=$false)]
[string[]] $DUT = '*',
[Parameter(Mandatory=$false,
HelpMessage="Enter one or more Network Adapter names as returned by Get-NetAdapter 'Name' Property")]
[ValidateScript({Get-NetAdapter -Name $_})]
[string[]] $InterfaceName = '*',
<#
[Parameter(Mandatory=$false)]
[ValidateSet('Base', '10GbE', 'Standard', 'Premium')]
[string[]] $TestScope = 'Premium',
@ -23,6 +27,7 @@ function Test-NICProperties {
[Parameter(Mandatory=$false)]
[ValidateSet('2019', '2022', 'HCIv1', 'HCIv2')]
[string[]] $OSVersion = '2022',
#>
[Parameter(Mandatory=$false)]
[string] $ReportPath,
@ -33,50 +38,660 @@ function Test-NICProperties {
Clear-Host
$global:pass = '+'
$global:fail = 'X'
$global:pass = 'PASS'
$global:fail = 'FAIL'
$global:testsFailed = 0
if ($Credential -eq $Null) { $Credential = . ..\wolfpack.ps1 }
$PSSession = New-PSSession -Credential $Credential -ComputerName 'TK5-3WP07R0511'
# Once in the Program Files path, use this:
# $here = Split-Path -Parent (Get-Module -Name Test-NICProperties -ListAvailable | Select-Object -First 1).Path
$here = Split-Path -Parent (Get-Module -Name Test-NICProperties | Select-Object -First 1).Path
$here = Split-Path -Parent (Get-Module -Name Test-NICProperties | Select-Object -First 1).Path
# Keep a separate log for easier diagnostics
$global:Log = New-Item -Name 'Results.txt' -Path "$here\Results" -ItemType File -Force
Start-WTTLog "$here\Results\Results.wtl"
Start-WTTTest "$here\Results\Results.wtl"
if (-not($PSSession)) {
"[Fatal Error] Could not establish a remote session to the target node" | Out-File -FilePath $Log -Append
throw '"[Fatal Error] Could not establish a remote session to the target node"'
}
# Get the details from the remote adapter
#TODO: Check that the adapter exists
$Adapters, $AdapterAdvancedProperties, $NodeOS = Invoke-Command -Session $PSSession -ScriptBlock {
$Adapters = Get-NetAdapter -Name $using:DUT -Physical | Where-Object MediaType -eq '802.3'
$AdapterAdvancedProperties = Get-NetAdapterAdvancedProperty -Name $using:DUT -AllProperties
$NodeOS = Get-CimInstance -ClassName 'Win32_OperatingSystem'
Return $Adapters, $AdapterAdvancedProperties, $NodeOS
}
$Adapters = Get-NetAdapter -Name $InterfaceName -Physical | Where-Object MediaType -eq '802.3'
$AdapterAdvancedProperties = Get-NetAdapterAdvancedProperty -Name $InterfaceName -AllProperties
$NodeOS = Get-CimInstance -ClassName 'Win32_OperatingSystem'
### Verify the TestHost is sufficient version
$caption = ($NodeOS.Caption -like '*Windows Server 2022*') -or
($NodeOS.Caption -like '*Azure Stack HCI*')
if (($NodeOS.Caption -like '*Windows Server 2019*') -or
($NodeOS.Caption -like '*Windows Server 2022*') -or
($NodeOS.Caption -like '*Azure Stack HCI*')) {
$caption | Should be $true
if ($edition.Edition -eq 'ServerAzureStackHCICor' -or $edition.Edition -like '*Server*') { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
$testFile = . "$here\tests\unit\unit.tests.ps1"
if ($testsFailed -eq 0) {
Write-Host 'Successfully passed all tests' -ForegroundColor Green
if ($edition.Edition -eq 'ServerAzureStackHCICor' -or $edition.Edition -like '*Server*') { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
}
else { Write-Host "Failed $testsFailed tests. Please review the output before continuing" -ForegroundColor Red }
#$testFile = . "$here\tests\unit\unit.tests.ps1"
<# Tests:
- Existance of required keys per documented requirements
- Tests the keys are the correct type
- Tests the keys have the correct default values
- Tests that enums contains all the right values
- Tests that enums do not contain extra (unauthorized values)
- Tests that ints have the correct Base
- Tests that ints have the correct Max
- Tests that ints have the correct Min
- Tests that ints have the correct Step
#>
# This is the MSFT definition
$AdapterDefinition = [AdapterDefinition]::new()
$Requirements = ([Requirements]::new())
if (($OSVersion -eq '2019') -or ($OSVersion -eq 'HCIv1')) { $Requirements = ([Requirements]::new()).WS2019_HCIv1 }
elseif (($OSVersion -eq '2022') -or ($OSVersion -eq 'HCIv2')) { $Requirements = ([Requirements]::new()).WS2022_HCIv2 }
$Adapters | ForEach-Object {
$thisAdapter = $_
$thisAdapterAdvancedProperties = $AdapterAdvancedProperties | Where-Object Name -eq $thisAdapter.Name
# This is the configuration from the remote pNIC
$AdapterConfiguration = Get-AdvancedRegistryKeyInfo -InterfaceName $thisAdapter.Name -AdapterAdvancedProperties $thisAdapterAdvancedProperties
$NicSwitchConfiguration = Get-NicSwitchInfo -InterfaceName $thisAdapter.Name
<#
# Device.Network.LAN.Base.100MbOrGreater Windows Server Ethernet devices must be able to link at 1Gbps or higher speeds
if ($thisAdapter.Speed -ge 1000000000) {
Write-WTTLogMessage "[$Pass] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) RegistryDefaultValue is $($AdapterDefinition.RegistryDefaultValue)"
"[$Pass] $($thisAdapter.Name) is 1Gbps or higher" | Out-File -FilePath $Log -Append
}
else {
Write-WTTLogError "[$Fail] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) RegistryDefaultValue is $($AdapterDefinition.RegistryDefaultValue)"
"[$Fail] $($thisAdapter.Name) is 1Gbps or higher" | Out-File -FilePath $Log -Append
$testsFailed ++
}
#>
$RequirementsTested = @()
Switch -Wildcard ($AdapterConfiguration) {
{ $_.RegistryKeyword -eq '*EncapOverhead' } {
# *EncapOverhead: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead
# *EncapOverhead: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead
# *EncapOverhead: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead
# *EncapOverhead: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead
# *EncapOverhead: NumericParameterMaxValue
Test-NumericParameterMaxValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead -OrGreater
# *EncapOverhead: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead -OrLess
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*EncapsulatedPacketTaskOffloadNvgre' } {
# *EncapsulatedPacketTaskOffloadNvgre: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadNvgre
# *EncapsulatedPacketTaskOffloadNvgre: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadNvgre
# *EncapsulatedPacketTaskOffloadNvgre: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadNvgre
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadNvgre
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*EncapsulatedPacketTaskOffloadVxlan' } {
# *EncapsulatedPacketTaskOffloadVxlan: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadVxlan
# *EncapsulatedPacketTaskOffloadVxlan: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadVxlan
# *EncapsulatedPacketTaskOffloadVxlan: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadVxlan
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadVxlan
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*FlowControl' } {
# *FlowControl: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.FlowControl
# *FlowControl: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.FlowControl
# *FlowControl: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.FlowControl
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.FlowControl
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*InterruptModeration' } {
# *InterruptModeration: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.InterruptModeration
# *InterruptModeration: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.InterruptModeration
# *InterruptModeration: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.InterruptModeration
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.InterruptModeration
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*JumboPacket' } {
# *JumboPacket: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.JumboPacket
# *JumboPacket: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.JumboPacket
# *JumboPacket: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.JumboPacket
# *JumboPacket: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.JumboPacket
# *JumboPacket: NumericParameterMaxValue
Test-NumericParameterMaxValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.JumboPacket -OrGreater
# *JumboPacket: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.JumboPacket -OrLess
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*LsoV2IPv4' } {
# *LsoV2IPv4: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv4
# *LsoV2IPv4: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv4
# *LsoV2IPv4: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv4
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv4
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*LsoV2IPv6' } {
# *LsoV2IPv6: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv6
# *LsoV2IPv6: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv6
# *LsoV2IPv6: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv6
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv6
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*NetworkDirect' } {
# *NetworkDirect: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.NDKPI.NetworkDirect
# *NetworkDirect: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.NDKPI.NetworkDirect
# *NetworkDirect: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.NDKPI.NetworkDirect
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.NDKPI.NetworkDirect
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*NetworkDirectTechnology' } {
# *NetworkDirectTechnology: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.NDKPI.NetworkDirectTechnology
# *NetworkDirectTechnology: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.NDKPI.NetworkDirectTechnology
# *NetworkDirectTechnology: ValidRegistryValues
# As the adapter can choose to support one or more of these types, we will only check that the contained values are within the MSFT defined range
# We will not test to ensure that all defined values are found unlike other enums (because an adapter may support both RoCE and RoCEv2 but not iWARP and visa versa)
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.NDKPI.NetworkDirectTechnology
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*NumaNodeId' } {
# *NumaNodeId: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.NumaNodeId
# *NumaNodeId: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.NumaNodeId
# *NumaNodeId: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.NumaNodeId
# *NumaNodeId: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.NumaNodeId
# *NumaNodeId: NumericParameterMaxValue
Test-NumericParameterMaxValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.NumaNodeId
# *NumaNodeId: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.NumaNodeId
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*PriorityVLANTag' } {
# *PriorityVLANTag: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.PriorityVLANTag
# *PriorityVLANTag: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.PriorityVLANTag
# *PriorityVLANTag: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.PriorityVLANTag
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.PriorityVLANTag
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*QOS' } {
# *QOS: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.QOS
# *QOS: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.QOS
# *QOS: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.QOS
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.QOS
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*ReceiveBuffers' } {
# *ReceiveBuffers: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.Buffers.ReceiveBuffers
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RSCIPv4' } {
# *RSCIPv4: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSC.RSCIPv4
# *RSCIPv4: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSC.RSCIPv4
# *RSCIPv4: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSC.RSCIPv4
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSC.RSCIPv4
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RSCIPv6' } {
# *RSCIPv6: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSC.RSCIPv6
# *RSCIPv6: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSC.RSCIPv6
# *RSCIPv6: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSC.RSCIPv6
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSC.RSCIPv6
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RSS' } {
# *RSS: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSS
# *RSS: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSS
# *RSS: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSS
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSS
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RSSBaseProcGroup' } {
# *RSSBaseProcGroup: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcGroup
# *RSSBaseProcGroup: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcGroup
# *RSSBaseProcGroup: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcGroup
# *RSSBaseProcGroup: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcGroup
# *RSSBaseProcGroup: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcGroup
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RSSBaseProcNumber' } {
# *RSSBaseProcNumber: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcNumber
# *RSSBaseProcNumber: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcNumber -MaxValue 4
# *RSSBaseProcNumber: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcNumber
# *RSSBaseProcNumber: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcNumber
# *RSSBaseProcNumber: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcNumber
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RssMaxProcNumber' } {
# *RssMaxProcNumber: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
# *RssMaxProcNumber: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
# *RssMaxProcNumber: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
# *RssMaxProcNumber: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
# *RssMaxProcNumber: NumericParameterMaxValue
Test-NumericParameterMaxValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
# *RssMaxProcNumber: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RSSMaxProcGroup' } {
# *RSSMaxProcGroup: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSMaxProcGroup
# *RSSMaxProcGroup: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSMaxProcGroup
# *RSSMaxProcGroup: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSMaxProcGroup
# *RSSMaxProcGroup: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSMaxProcGroup
# *RSSMaxProcGroup: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSMaxProcGroup
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RSSOnHostVPorts' } {
# *RSSOnHostVPorts: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSOnHostVPorts
# *RSSOnHostVPorts: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSOnHostVPorts
# *RSSOnHostVPorts: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSOnHostVPorts
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSOnHostVPorts
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RssOrVmqPreference' } {
# *RssOrVmqPreference: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.RssOrVmqPreference
# *RssOrVmqPreference: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.RssOrVmqPreference
# *RssOrVmqPreference: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.RssOrVmqPreference
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.RssOrVmqPreference
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RSSProfile' } {
# *RSSProfile: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSProfile
# *RSSProfile: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSProfile
# *RSSProfile: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSProfile
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSProfile
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*SRIOV' } {
# *SRIOV: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.SRIOV
# *SRIOV: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.SRIOV
# *SRIOV: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.SRIOV
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.SRIOV
# Test NICSwitch Defaults
Test-NicSwitch -AdvancedRegistryKey $NicSwitchConfiguration -DefinitionPath $AdapterDefinition.NicSwitch
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*TransmitBuffers' } {
# *TransmitBuffers: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.Buffers.TransmitBuffers
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*UsoIPv4' } {
# *UsoIPv4: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.USO.UsoIPv4
# *UsoIPv4: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.USO.UsoIPv4
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*UsoIPv6' } {
# *UsoIPv6: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.USO.UsoIPv6
# *UsoIPv6: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.USO.UsoIPv6
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq 'VLANID' } {
# Device.Network.LAN.Base.PriorityVLAN - Since all WS devices must be -ge 1Gbps, they must implement
# Ethernet devices that implement link speeds of gigabit or greater must implement Priority & VLAN tagging according to the IEEE 802.1q specification.
# VLANID: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VLANID
# VLANID: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VLANID
# VLANID: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VLANID
# VLANID: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VLANID
# VLANID: NumericParameterMaxValue
Test-NumericParameterMaxValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VLANID
# VLANID: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VLANID
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*VMQ' } {
# *VMQ: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQ
# *VMQ: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQ
# *VMQ: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQ
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQ
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*VMQVlanFiltering' } {
# *VMQVlanFiltering: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQVlanFiltering
# *VMQVlanFiltering: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQVlanFiltering
# *VMQVlanFiltering: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQVlanFiltering
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQVlanFiltering
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*VxlanUDPPortNumber' } {
# *VxlanUDPPortNumber: RegistryDefaultValue
Test-DefaultRegistryValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber
# *VxlanUDPPortNumber: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber
# *VxlanUDPPortNumber: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber
# *VxlanUDPPortNumber: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber
# *VxlanUDPPortNumber: NumericParameterMaxValue
Test-NumericParameterMaxValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber -OrGreater
# *VxlanUDPPortNumber: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber -OrLess
$RequirementsTested += $_.RegistryKeyword
}
}
$RequirementsTested | ForEach-Object {
$ThisTestedRequirement = $_.TrimStart('*')
$Requirements.Base = $Requirements.Base | Where-Object { $_ -ne $ThisTestedRequirement }
$Requirements.TenGbEOrGreater = $Requirements.TenGbEOrGreater | Where-Object { $_ -ne $ThisTestedRequirement }
$Requirements.Standard = $Requirements.Standard | Where-Object { $_ -ne $ThisTestedRequirement }
$Requirements.Premium = $Requirements.Premium | Where-Object { $_ -ne $ThisTestedRequirement }
}
$Certification = 'Fail'
If ($Requirements.Premium -eq $Null -and $Requirements.Standard -and
$Requirements.TenGbEOrGreater -and $Requirements.Base) { $Certification = 'Premium' }
ElseIf ($Requirements.Standard -and $Requirements.TenGbEOrGreater -and $Requirements.Base) { $Certification = 'Standard' }
ElseIf ($Requirements.TenGbEOrGreater -and $Requirements.Base) { $Certification = 'TenGbEOrGreater' }
ElseIf ($Requirements.Base) { $Certification = 'Base' }
}
Stop-WTTTest
Stop-WTTLog
}
#TODO: Calculate which capabilities are there and whether they have enough for Standard/Premium
#TODO: Calculate which capabilities are there and whether they have enough for Standard/Premium
#TODO: Add MSIX RSS Stuff

447
internal/WttLog.psm1 Normal file
Просмотреть файл

@ -0,0 +1,447 @@
<#
.SYNOPSIS
WttLog wrappers for PowerShell tests
.DESCRIPTION
Provides both thin wrappers around typical low level WTTLog commands, such as:
* Start-WttLog, Stop-WttLog
* Start-WttTest, Stop-WttTest
* Write-WttLogMessage, Write-WttLogError
Also provides a few higher level abstractions designed to simplify test code:
* Run-CommandAsWttTest
* Run-WttTest
Requires that the wttlog.dll assembly be loadable (if WTT client and/or studio are installed, it is)
.EXAMPLE
Import-Module WttLog
Start-WttLog "MyCmdTests.wtl"
Invoke-CommandAsWttTest { mytest.exe -scenario 1 }
Invoke-CommandAsWttTest { mytest.exe -scenario 2 }
Stop-WttLog
.EXAMPLE
Import-Module WttLog
Start-WttLog "MyResilientTests.wtl"
Invoke-WttTest "scenario 1" -Setup {
set-up
} -Test {
set-something -value invalid -erroraction stop
} -Cleanup {
tear-down
}
Stop-WttLog
.EXAMPLE
Import-Module WttLog
Start-WttLog "MyLessResilientTests.wtl"
Start-WttTest "Test 1"
Write-WttLogMessage "Just a message"
Write-WttLogError "Causes the test to fail"
Stop-WttTest
Start-WttTest "Test 2"
Stop-WttTest "Blocked"
Stop-WttLog
#>
Set-StrictMode -Version Latest
$ErrorActionPreference = "Stop"
$null = [Reflection.Assembly]::LoadWithPartialName("Microsoft.Wtt.Log")
$WttLogger = $null
$WttTestStatus = ""
$WttTestName = $null
$WttTestGuid = $null
$WttWriteHostColors = @{
"Pass" = "DarkGreen";
"Fail" = "DarkRed";
"Blocked" = "DarkCyan";
"Warn" = "Yellow";
"Message" = "Black";
}
function Start-WttLog
{
Param (
[string]$FileName,
[ValidateSet("overwrite","append")]
[string]$WriteMode="overwrite",
[switch]$PassThru
)
if ($script:WttLogger -ne $null) {
throw "Already started WttLog"
}
try
{
# The TestLogger constructor requires an absolute path to use a quoted log file location
# Since a user might input a FileName with spaces, we want to make sure we can always quote it
# Thus, we always convert to an absolute path
$AbsoluteFileName = $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath($FileName)
$script:WttLogger = New-Object Microsoft.DistributedAutomation.Logger.TestLogger "`$LocalPub(`$LogFile:file=`"$AbsoluteFileName`",WriteMode=$WriteMode)"
$script:WttLogger.add_TestStarted({
Write-Verbose ("Test Started: $($_ | Out-String)")
})
$script:WttLogger.add_TestEnded({
Write-Verbose ("Test Ended: $($_ | Out-String)")
})
if ($PassThru) {
$script:WttLogger
}
Write-WttLogMessage "Logging with WttLog.psm1 to $AbsoluteFileName"
$script:WttLogger.TraceMachineInfo()
}
catch
{
Write-Host -BackgroundColor $WttWriteHostColors["Blocked"] "Failed to load WTTLogger"
Write-Host -BackgroundColor $WttWriteHostColors["Blocked"] ($_ | Out-String)
}
}
function Stop-WttLog()
{
if ($script:WttLogger -eq $null) {
throw "No WttLog is started"
}
Write-Host -BackgroundColor $WttWriteHostColors["Message"] "Ending Test Log"
#auto-generated passed, warned, failed, blocked, and skipped counts
#$rollup = New-Object Microsoft.DistributedAutomation.Logger.LevelRollup 0, 0, 0, 0, 0
#$script:WttLogger.Trace($rollup) | Out-Null
$script:WttLogger.Dispose() | Out-Null
$script:WttLogger = $null
}
function Start-WttTest($name)
{
if ($script:WttLogger -eq $null) {
throw "No WttLog is started"
}
if ($script:WttTestName -ne $null) {
throw "Already in WTTTest $script:WttTestName - cannot nest test cases"
}
Write-Host -BackgroundColor $WttWriteHostColors["Message"] "++++++++++++ Starting Test Case $name ++++++++++++`n"
$script:WttTestStatus = "Pass"
$script:WttTestGuid = ([GUID]::NewGUID().ToString())
$script:WttTestName = $name
if ($script:WttLogger)
{
$script:wttLogger.StartTest($script:wttTestName, $script:wttTestGuid, "") | Out-Null
}
}
function Stop-WttTest($result = $script:wttTestStatus)
{
if ($script:WttLogger -eq $null) {
throw "No WttLog is started"
}
if ($script:WttTestName -eq $null) {
throw "No WttTest is started"
}
Write-Host -BackgroundColor $WttWriteHostColors[$Result] "------------ Ending Test Case $script:wttTestName : $result ------------`n"
$script:WttLogger.EndTest($script:WttTestName, $script:WttTestGuid, [Microsoft.DistributedAutomation.Logger.TestResult]$Result, $null)
$script:WttTestName = $null
$script:WttTestGuid = $null
}
function Write-WttLogError($Exception, [switch]$Fatal)
{
if ($script:WttLogger -eq $null) {
throw "No WttLog is started"
}
$ExceptionString = $Exception | Out-String
Write-Host -BackgroundColor $WttWriteHostColors["Fail"] "****** ERROR: $ExceptionString"
$script:WttTestStatus = "Fail"
$TraceMessage = New-Object Microsoft.DistributedAutomation.Logger.LevelError $ExceptionString
$script:WttLogger.Trace($TraceMessage) | Out-Null
if ($Fatal) {
throw $Exception
}
}
function Write-WttLogMessage($Message)
{
if ($script:WttLogger -eq $null) {
throw "No WttLog is started"
}
$MessageString = $Message | Out-String
Write-Host -BackgroundColor $WttWriteHostColors["Message"] $MessageString
$TraceMessage = New-Object Microsoft.DistributedAutomation.Logger.LevelMessage $MessageString
$script:WttLogger.Trace($TraceMessage) | Out-Null
}
function Write-WttLogWarning($Message)
{
if ($script:WttLogger -eq $null) {
throw "No WttLog is started"
}
$MessageString = $Message | Out-String
Write-Host -BackgroundColor $WttWriteHostColors["Warn"] $MessageString
$TraceMessage = New-Object Microsoft.DistributedAutomation.Logger.LevelWarning $MessageString
$script:WttLogger.Trace($TraceMessage) | Out-Null
}
<#
.SYNOPSIS
Runs the command in the given script block as a WTT test, logging its output and succeeding based on its exit code
.EXAMPLE
Invoke-CommandAsWttTest { netsh wlan connect APEX-NETStress }
.EXAMPLE
Invoke-CommandAsWttTest -Name "netsh expecting failure" -SuccessExitCode 1 -Command { netsh wlan connect BADSSID }
#>
function Invoke-CommandAsWttTest {
[CmdletBinding(DefaultParameterSetName="SuccessCode")]
Param (
[Parameter(Mandatory=$true)]
[ScriptBlock]
$Command,
[Parameter(Mandatory=$false)]
[string]
$Name = "",
[Parameter(Mandatory=$false, ParameterSetName="SuccessCode")]
[int[]]
$SuccessExitCode = @(0),
[Parameter(Mandatory=$false, ParameterSetName="FailureCode")]
[int[]]
$FailureExitCode = @(),
[switch]
$ExitOnFailure
)
if ($Name -eq "") {
$Name = "$Command"
}
Start-WttTest $Name
try {
Write-WttLogMessage "Executing command: `"$Command`""
$Output = & $Command
$ExitCode = $LastExitCode
Write-WttLogMessage $Output
Write-WttLogMessage "Command completed with exit code $ExitCode"
if ($PsCmdlet.ParameterSetName -eq "SuccessCode" -and $ExitCode -notin $SuccessExitCode) {
Write-WttLogError "Exit code $ExitCode does not match expected success code(s): $SuccessExitCode"
} elseif ($ExitCode -in $FailureExitCode) {
Write-WttLogError "Exit code $ExitCode matches one of the expected failure code(s): $FailureExitCode"
}
} catch {
Write-WttLogError "A powershell error occured while executing the command"
Write-WttLogError $_
}
if ($ExitOnFailure -and $script:WttTestStatus -ne "Pass") {
Stop-WttTest
Stop-WttLog
exit 3
}
Stop-WttTest
}
<#
.SYNOPSIS
Runs a WTTLogger test whose contents are the given script block, with reasonable exception handling
.DESCRIPTION
Runs a test case which can include user-defined setup logic and cleanup logic, handling any exceptions in either
the test code or the setup/cleanup code reasonably by ensuring that Stop-WttTest will always get called even in
terminating errors and that any errors (terminating or not) cause the test to be marked as "Fail" (or if in a setup/
cleanup block, "Blocked").
Using Run-Test absolves you of the need to call Start-WttTest and Stop-WttTest. You are still required to call
Start-WttLog and Stop-WttLog.
Within test or cleanup code, it is recommended that you use Write-WttLogError to indicate continuable test failures
and throw an exception to indicate a non-continuable test failure.
.EXAMPLE
Invoke-Test { Set-Something -Value "OughtToBeValid" }
.EXAMPLE
Invoke-Test "Validate Rename-NetAdapter" -Setup {
if ((Get-TestAdapter) -eq $null) { throw "Could not find test adapter" }
} -Test {
Get-TestAdapter | Rename-NetAdapter "Foolish name"
if ((Get-TestAdapter).Name -ne "Foolish name") { Write-WttLogError "Couldn't rename adapter" }
} -Cleanup {
Reset-TestAdapter
} -ExitOnFailure
#>
function Invoke-WttTest {
[CmdletBinding()]
Param (
[Parameter(Mandatory=$false)]
[string]
$Name = "",
[Parameter(Mandatory=$false)]
[ScriptBlock]
$Setup = $null,
[Parameter(Mandatory=$true)]
[ScriptBlock]
$Test,
[Parameter(Mandatory=$false)]
[ScriptBlock]
$Cleanup = $null,
[switch]
$ExitOnFailure,
[switch]
$ContinueOnCleanupFailure
)
if ($Name -eq "") {
$Name = "$Test"
}
$ExitAfterCleanup = $false
Start-WttTest $Name
if ($Setup -ne $null) {
Write-WttLogMessage "--- Entering test setup"
$Error.Clear()
$SetupFailed = $false
try {
& $Setup
} catch {
Write-WttLogError "Test setup threw a terminating error"
Write-WttLogError $_
$SetupFailed = $true
}
if ($Error.Count -gt 0) {
Write-WttLogError "Test setup generated $($Error.Count) non-terminating error(s)"
$SetupFailed = $true
}
if ($SetupFailed) {
Stop-WttTest "Blocked"
return
}
Write-WttLogMessage "--- Completed test setup successfully"
}
$Error.Clear()
$TestFailed = $false
try {
$Output = & $Test
if ($Output -ne $null) {
Write-WttLogMessage "Test completed with output: $Output"
}
} catch {
Write-WttLogError "Test threw a terminating error"
Write-WttLogError $_
$TestFailed = $true
}
if ($Error.Count -gt 0) {
Write-WttLogError "Test generated $($Error.Count) non-terminating error(s)"
$TestFailed = $true
}
if ($TestFailed -and $ExitOnFailure) {
if ($Cleanup -ne $null) {
Write-WttLogMessage "Will exit test script after finishing test cleanup"
}
$ExitAfterCleanup = $true
}
$CleanupFailed = $false
if ($Cleanup -ne $null) {
Write-WttLogMessage "--- Entering test cleanup"
$Error.Clear()
try {
& $Cleanup
} catch {
Write-WttLogError "Test cleanup threw a terminating error"
Write-WttLogError $_
$CleanupFailed = $true
}
if ($Error.Count -gt 0) {
Write-WttLogError "Test cleanup generated $($Error.Count) non-terminating error(s)"
$CleanupFailed = $true
}
if ($CleanupFailed) {
Write-WttLogError "Future results may be invalid"
if ($ContinueOnCleanupError) {
Write-WttLogMessage "Continuing testing past cleanup failure"
$script:WttTestStatus = "Blocked"
} else {
Write-WttLogMessage "Invoking fail-fast for entire test script"
Stop-WttTest "Blocked"
Stop-WttLog
exit 2
}
} else {
Write-WttLogMessage "--- Completed test cleanup successfully"
}
}
Stop-WttTest
if ($ExitAfterCleanup) {
Write-WttLogMessage "Exiting test script due to fatal test error"
Stop-WttLog
exit 1
}
}
Export-ModuleMember -Function @(
"Start-WttLog",
"Stop-WttLog",
"Start-WttTest",
"Stop-WttTest",
"Write-WttLogMessage",
"Write-WttLogError",
"Write-WttLogWarning",
"Invoke-WttTest",
"Invoke-CommandAsWttTest"
)

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

@ -44,12 +44,12 @@ Class Buffers {
#region EncapOverhead
Class EncapOverhead {
[string] $RegistryKeyword = '*EncapOverhead'
[int] $DisplayParameterType = '1' # 4 byte unsigned integer
[int] $RegistryDefaultValue = 0
[int] $DisplayParameterType = '1' # 1 byte unsigned integer
[int] $DefaultRegistryValue = 0
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 480 # Must be <= 480 and >= 160
[int] $NumericParameterMinValue = 0 # Must be this value
[int] $NumericParameterMaxValue = 480 # Must be <= 480 and >= 160
[int] $NumericParameterMinValue = 0 # Must be this value
[int] $NumericParameterStepValue = 32 # Must be this value
EncapOverhead () {}
@ -64,7 +64,7 @@ Class EncapsulatedPacketTaskOffloadNvgre {
[string] $RegistryKeyword = '*EncapsulatedPacketTaskOffloadNvgre'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [enum]::GetValues([EnableDisable])
@ -77,7 +77,7 @@ Class EncapsulatedPacketTaskOffloadVxlan {
[string] $RegistryKeyword = '*EncapsulatedPacketTaskOffloadVxlan'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -98,7 +98,7 @@ Class FlowControl {
[string] $RegistryKeyword = '*FlowControl'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [FlowControlVal]::TxRxDisabled.Value__
[string] $DefaultRegistryValue = [FlowControlVal]::TxRxDisabled.Value__
[string] $DisplayDefaultValue = [FlowControlVal]::TxRxDisabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('FlowControlVal').Value__
@ -111,7 +111,7 @@ Class InterruptModeration {
[string] $RegistryKeyword = '*InterruptModeration'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -123,7 +123,7 @@ Class InterruptModeration {
Class JumboPacket {
[string] $RegistryKeyword = '*JumboPacket'
[int] $DisplayParameterType = '4' # 4 byte unsigned integer
[int] $RegistryDefaultValue = 1514
[int] $DefaultRegistryValue = 1514
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 9174 # Must be >= this value 9014 + EncapOverhead (160)
@ -139,7 +139,7 @@ Class LSOIPv4 {
[string] $RegistryKeyword = '*LSOIPv4'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -150,7 +150,7 @@ Class LSOIPv6 {
[string] $RegistryKeyword = '*LSOIPv6'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -177,7 +177,7 @@ Class NetworkDirect {
[string] $RegistryKeyword = '*NetworkDirect'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -189,7 +189,7 @@ Class NetworkDirectTechnology {
[int] $DisplayParameterType = 5
# Vendors will only support what they support; defaults not necessary to test
#[string] $RegistryDefaultValue = [NetworkDirectTechnologyVal]::iWARP
#[string] $DefaultRegistryValue = [NetworkDirectTechnologyVal]::iWARP
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('NetworkDirectTechnologyVal').Value__
@ -226,7 +226,7 @@ Class PriorityVLANTag {
[string] $RegistryKeyword = '*PriorityVLANTag'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [PriorityVLANTagVal]::PriorityVLANEnabled.Value__
[string] $DefaultRegistryValue = [PriorityVLANTagVal]::PriorityVLANEnabled.Value__
[string] $DisplayDefaultValue = [PriorityVLANTagVal]::PriorityVLANEnabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('PriorityVLANTagVal').Value__
@ -239,7 +239,7 @@ Class PtpHardwareTimestamp {
[string] $RegistryKeyword = '*PtpHardwareTimestamp'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -252,7 +252,7 @@ Class QOS {
[string] $RegistryKeyword = '*QOS'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -265,7 +265,7 @@ Class RSCIPv4 {
[string] $RegistryKeyword = '*RSCIPv4'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -276,7 +276,7 @@ Class RSCIPv6 {
[string] $RegistryKeyword = '*RSCIPv6'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -304,7 +304,7 @@ Class RSS {
[string] $RegistryKeyword = '*RSS'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -315,7 +315,7 @@ Class MaxRSSProcessors_MSIXSupport_1Gb {
[string] $RegistryKeyword = '*MaxRssProcessors'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 4
[int] $DefaultRegistryValue = 4
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 4 # Must be >= than this value
@ -329,7 +329,7 @@ Class MaxRSSProcessors_MSIXSupport_10GbOrGreater {
[string] $RegistryKeyword = '*MaxRssProcessors'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 16
[int] $DefaultRegistryValue = 16
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 16 # Must be >= than this value
@ -343,7 +343,7 @@ Class MaxRSSProcessors_No_MSIXSupport_1Gb {
[string] $RegistryKeyword = '*MaxRssProcessors'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 2
[int] $DefaultRegistryValue = 2
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 2 # Must be >= than this value
@ -357,7 +357,7 @@ Class MaxRSSProcessors_No_MSIXSupport_10GbOrGreater {
[string] $RegistryKeyword = '*MaxRssProcessors'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 4
[int] $DefaultRegistryValue = 4
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 4 # Must be >= than this value
@ -380,7 +380,7 @@ Class NumRSSQueues_MSIXSupport_1Gb {
[string] $RegistryKeyword = '*NumRSSQueues'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 4
[int] $DefaultRegistryValue = 4
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 4 # Must be >= than this value
@ -394,7 +394,7 @@ Class NumRSSQueues_MSIXSupport_10GbOrGreater {
[string] $RegistryKeyword = '*NumRSSQueues'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 16
[int] $DefaultRegistryValue = 16
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 16 # Must be >= than this value
@ -408,7 +408,7 @@ Class NumRSSQueues_No_MSIXSupport_1Gb {
[string] $RegistryKeyword = '*NumRSSQueues'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 2
[int] $DefaultRegistryValue = 2
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 2 # Must be >= than this value
@ -422,7 +422,7 @@ Class NumRSSQueues_No_MSIXSupport_10GbOrGreater {
[string] $RegistryKeyword = '*NumRSSQueues'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 4
[int] $DefaultRegistryValue = 4
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 4 # Must be >= than this value
@ -446,7 +446,7 @@ Class RSSProfile {
[string] $RegistryKeyword = '*RSSProfile'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [RSSProfileVal]::NUMAScalingStatic.Value__
[string] $DefaultRegistryValue = [RSSProfileVal]::NUMAScalingStatic.Value__
[string] $DisplayDefaultValue = [RSSProfileVal]::NUMAScalingStatic
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('RSSProfileVal').Value__
@ -457,7 +457,7 @@ Class NumaNodeId {
[string] $RegistryKeyword = '*NumaNodeId'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 65535
[int] $DefaultRegistryValue = 65535
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 65535 # Must be this value
@ -471,7 +471,7 @@ Class RssBaseProcGroup {
[string] $RegistryKeyword = '*RssBaseProcGroup'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 0
[int] $DefaultRegistryValue = 0
[int] $NumericParameterBaseValue = 10 # Must be this value
#[int] $NumericParameterMaxValue = # System specific
@ -485,7 +485,7 @@ Class RSSMaxProcGroup {
[string] $RegistryKeyword = '*RSSMaxProcGroup'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 0
[int] $DefaultRegistryValue = 0
[int] $NumericParameterBaseValue = 10 # Must be this value
#[int] $NumericParameterMaxValue = # System specific
@ -499,7 +499,7 @@ Class RssBaseProcNumber {
[string] $RegistryKeyword = '*RssBaseProcNumber'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 0
[int] $DefaultRegistryValue = 0
[int] $NumericParameterBaseValue = 10 # Must be this value
#[int] $NumericParameterMaxValue = # System specific
@ -513,7 +513,7 @@ Class RssMaxProcNumber {
[string] $RegistryKeyword = '*RssMaxProcNumber'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[int] $RegistryDefaultValue = 0
[int] $DefaultRegistryValue = 0
[int] $NumericParameterBaseValue = 10 # Must be this value
#[int] $NumericParameterMaxValue = # System specific
@ -547,7 +547,7 @@ Class RSSOnHostVPorts {
[string] $RegistryKeyword = '*RSSOnHostVPorts'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -560,7 +560,7 @@ Class SRIOV {
[string] $RegistryKeyword = '*SRIOV'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -573,7 +573,7 @@ Class SRIOV {
[string] $RegistryKeyword = '*USOIPv4'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -584,7 +584,7 @@ Class SRIOV {
[string] $RegistryKeyword = '*USOIPv6'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -604,7 +604,7 @@ Class VLANID {
[string] $RegistryKeyword = 'VLANID'
[int] $DisplayParameterType = 4 # 4 byte unsigned integer
[string] $RegistryDefaultValue = 0
[string] $DefaultRegistryValue = 0
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 4095 # Must be >= this value 9014 + EncapOverhead (160)
[int] $NumericParameterMinValue = 0 # Must be < than this value
@ -619,7 +619,7 @@ Class VMQVlanFiltering {
[string] $RegistryKeyword = '*VMQVlanFiltering'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -630,7 +630,7 @@ Class RssOrVmqPreference {
[string] $RegistryKeyword = '*RssOrVmqPreference'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Disabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Disabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Disabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -641,7 +641,7 @@ Class VMQ {
[string] $RegistryKeyword = '*VMQ'
[int] $DisplayParameterType = 5
[string] $RegistryDefaultValue = [EnableDisable]::Enabled.Value__
[string] $DefaultRegistryValue = [EnableDisable]::Enabled.Value__
[string] $DisplayDefaultValue = [EnableDisable]::Enabled
[string[]] $ValidRegistryValues = [System.Enum]::GetValues('EnableDisable').Value__
@ -664,7 +664,7 @@ Class VMQClass {
Class VxlanUDPPortNumber {
[string] $RegistryKeyword = '*VxlanUDPPortNumber'
[int] $DisplayParameterType = '2' # 4 byte unsigned integer
[int] $RegistryDefaultValue = 4789
[int] $DefaultRegistryValue = 4789
[int] $NumericParameterBaseValue = 10 # Must be this value
[int] $NumericParameterMaxValue = 65535 # Must be < this value
@ -680,7 +680,7 @@ Class AdapterDefinition {
# $ChecksumOffload - Not yet implemented
$EncapOverhead = [EncapOverhead]::new()
# $EncapsulatedPacketTaskOffload = [EncapsulatedPacketTaskOffload]::new() - Is this needed
# $EncapsulatedPacketTaskOffload = [EncapsulatedPacketTaskOffload]::new() - Is this needed?
$EncapsulatedPacketTaskOffloadNVGRE = [EncapsulatedPacketTaskOffloadNVGRE]::new()
$EncapsulatedPacketTaskOffloadVxlan = [EncapsulatedPacketTaskOffloadVxlan]::new()

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

@ -1,3 +1,5 @@
using module .\wttlog.psm1
Function Get-AdvancedRegistryKeyInfo {
param (
[parameter(Mandatory = $true)]
@ -53,7 +55,7 @@ Function Get-AdvancedRegistryKeyInfo {
}
$NetAdapter = Get-NetAdapter -Name $interfaceName -ErrorAction SilentlyContinue
If (-not ($NetAdapter)) { return 'Error: Adapter Does Not Exist' }
If (-not ($NetAdapter)) { Write-Error 'Error: Adapter Does Not Exist' }
$ReturnKeyInfo = @()
Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}' -Recurse -ErrorAction SilentlyContinue | ForEach-Object {
@ -121,7 +123,7 @@ Function Get-NicSwitchInfo {
}
$NetAdapter = Get-NetAdapter -Name $interfaceName -ErrorAction SilentlyContinue
If (-not ($NetAdapter)) { return 'Error: Adapter Does Not Exist' }
If (-not ($NetAdapter)) { Write-Error 'Error: Adapter Does Not Exist' }
$ReturnKeyInfo = @()
Get-ChildItem 'HKLM:\SYSTEM\CurrentControlSet\Control\Class\{4d36e972-e325-11ce-bfc1-08002be10318}' -Recurse -ErrorAction SilentlyContinue | ForEach-Object {
@ -148,100 +150,6 @@ Function Get-NicSwitchInfo {
}
}
Function Test-RegistryDefaultValue {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath # This is what is defined in the datatypes.ps1
)
# *NetworkDirect: RegistryDefaultValue
if ($AdvancedRegistryKey.RegistryDefaultValue -eq $DefinitionPath.RegistryDefaultValue) { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
"[$PassFail] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) RegistryDefaultValue is $($DefinitionPath.RegistryDefaultValue)" | Out-File -FilePath $Log -Append
}
Function Test-DisplayParameterType {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath, # This is what is defined in the datatypes.ps1
$MaxValue # The numerical maximum value. This may not be specified but allows for ints of different sizes
)
if ($MaxValue) {
if ($AdvancedRegistryKey.DisplayParameterType -le $DefinitionPath.DisplayParameterType) { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
}
else {
if ($AdvancedRegistryKey.DisplayParameterType -eq $DefinitionPath.DisplayParameterType) { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
}
"[$PassFail] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DisplayParameterType is $($DefinitionPath.DisplayParameterType)" | Out-File -FilePath $Log -Append
}
Function Test-NumericParameterBaseValue {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath # This is what is defined in the datatypes.ps1
)
if ($AdvancedRegistryKey.NumericParameterBaseValue -eq $DefinitionPath.NumericParameterBaseValue) { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
"[$PassFail] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterBaseValue is $($DefinitionPath.NumericParameterBaseValue)" | Out-File -FilePath $Log -Append
}
Function Test-NumericParameterStepValue {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath # This is what is defined in the datatypes.ps1
)
if ($AdvancedRegistryKey.NumericParameterStepValue -eq $DefinitionPath.NumericParameterStepValue) { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
"[$PassFail] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterStepValue is $($DefinitionPath.NumericParameterStepValue)" | Out-File -FilePath $Log -Append
}
Function Test-NumericParameterMaxValue {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath, # This is what is defined in the datatypes.ps1
[Switch] $OrGreater # Greater or Equal too the defined value
)
if ($OrGreater) {
if ($AdvancedRegistryKey.NumericParameterMaxValue -ge $DefinitionPath.NumericParameterMaxValue) { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
}
else {
if ($AdvancedRegistryKey.NumericParameterMaxValue -eq $DefinitionPath.NumericParameterMaxValue) { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
}
"[$PassFail] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMaxValue is $($DefinitionPath.NumericParameterMaxValue)" | Out-File -FilePath $Log -Append
}
Function Test-NumericParameterMinValue {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath, # This is what is defined in the datatypes.ps1
[Switch] $OrLess # Less than or Equal too the defined value
)
if ($OrLess) {
if ($AdvancedRegistryKey.NumericParameterMinValue -le $DefinitionPath.NumericParameterMinValue) { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
}
else {
if ($AdvancedRegistryKey.NumericParameterMinValue -eq $DefinitionPath.NumericParameterMinValue) { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
}
"[$PassFail] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMinValue is $($DefinitionPath.NumericParameterMinValue)" | Out-File -FilePath $Log -Append
}
Function Test-ContainsAllMSFTRequiredValidRegistryValues {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
@ -253,11 +161,16 @@ Function Test-ContainsAllMSFTRequiredValidRegistryValues {
$($DefinitionPath.ValidRegistryValues) | ForEach-Object {
$thisValidRegistryValue = $_
if ($thisValidRegistryValue -in $AdvancedRegistryKey.ValidRegistryValues) { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
if ($thisValidRegistryValue -in $AdvancedRegistryKey.ValidRegistryValues) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) contains the required ValidRegistryValue of $thisValidRegistryValue"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) contains the required ValidRegistryValue of $thisValidRegistryValue" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogMessage "[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) contains the required ValidRegistryValue of $thisValidRegistryValue"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) contains the required ValidRegistryValue of $thisValidRegistryValue" | Out-File -FilePath $Log -Append
"[$PassFail] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) contains the required ValidRegistryValue of $thisValidRegistryValue" | Out-File -FilePath $Log -Append
Remove-Variable PassFail -ErrorAction SilentlyContinue
$testsFailed ++
}
}
}
@ -272,10 +185,244 @@ Function Test-ContainsOnlyMSFTRequiredValidRegistryValues {
$($AdvancedRegistryKey.ValidRegistryValues) | ForEach-Object {
$thisValidRegistryValue = $_
if ($thisValidRegistryValue -in $DefinitionPath.ValidRegistryValues) { $PassFail = $pass }
Else { $PassFail = $fail; $testsFailed ++ }
if ($thisValidRegistryValue -in $DefinitionPath.ValidRegistryValues) {
Write-WTTLogMessage "[$PASS] $thisAdapter defines the ValidRegistryValue of $thisValidRegistryValue allowed for $($AdvancedRegistryKey.RegistryKeyword)"
"[$PASS] $thisAdapter defines the ValidRegistryValue of $thisValidRegistryValue allowed for $($AdvancedRegistryKey.RegistryKeyword)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogMessage "[$FAIL] $thisAdapter defines the ValidRegistryValue of $thisValidRegistryValue allowed for $($AdvancedRegistryKey.RegistryKeyword)"
"[$FAIL] $thisAdapter defines the ValidRegistryValue of $thisValidRegistryValue allowed for $($AdvancedRegistryKey.RegistryKeyword)" | Out-File -FilePath $Log -Append
"[$PassFail] $thisAdapter defines the ValidRegistryValue of $thisValidRegistryValue allowed for $($AdvancedRegistryKey.RegistryKeyword)" | Out-File -FilePath $Log -Append
Remove-Variable PassFail -ErrorAction SilentlyContinue
$testsFailed ++
}
}
if ($thisValidRegistryValue -in $AdvancedRegistryKey.ValidRegistryValues) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) contains the required ValidRegistryValue of $thisValidRegistryValue"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) contains the required ValidRegistryValue of $thisValidRegistryValue" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogMessage "[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) contains the required ValidRegistryValue of $thisValidRegistryValue"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) contains the required ValidRegistryValue of $thisValidRegistryValue" | Out-File -FilePath $Log -Append
$testsFailed ++
}
}
Function Test-DisplayParameterType {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath, # This is what is defined in the datatypes.ps1
$MaxValue # The numerical maximum value. This may not be specified but allows for ints of different sizes
)
if ($MaxValue) {
if ($AdvancedRegistryKey.DisplayParameterType -le $DefinitionPath.DisplayParameterType) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DisplayParameterType is -le $($DefinitionPath.DisplayParameterType)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DisplayParameterType is -le $($DefinitionPath.DisplayParameterType)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogError "[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DisplayParameterType is -le $($DefinitionPath.DisplayParameterType)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DisplayParameterType is -le $($DefinitionPath.DisplayParameterType)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
}
else {
if ($AdvancedRegistryKey.DisplayParameterType -eq $DefinitionPath.DisplayParameterType) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DisplayParameterType is $($DefinitionPath.DisplayParameterType)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DisplayParameterType is $($DefinitionPath.DisplayParameterType)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogError "[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DisplayParameterType is $($DefinitionPath.DisplayParameterType)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DisplayParameterType is $($DefinitionPath.DisplayParameterType)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
}
}
Function Test-NicSwitch {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath # This is what is defined in the datatypes.ps1
)
# For keys of an enum type (DisplayParameterType = 5); tests whether all values in the MSFT definition are available in the adapter
if ($AdvancedRegistryKey.SwitchName -eq 'Default Switch') {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.SwitchName) NicSwitch Name is $($DefinitionPath.SwitchName)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.SwitchName) NicSwitch Name is $($DefinitionPath.SwitchName)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogError "[$FAIL] $thisAdapter $($AdvancedRegistryKey.SwitchName) NicSwitch Name is $($DefinitionPath.SwitchName)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.SwitchName) NicSwitch Name is $($DefinitionPath.SwitchName)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
if ($AdvancedRegistryKey.Flags -eq 0) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.Flags) Flags is $($DefinitionPath.Flags)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.Flags) Flagse is $($DefinitionPath.Flags)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogError "[$FAIL] $thisAdapter $($AdvancedRegistryKey.Flags) Flags is $($DefinitionPath.Flags)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.Flags) Flags is $($DefinitionPath.Flags)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
if ($AdvancedRegistryKey.SwitchType -eq 1) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.SwitchType) SwitchType is $($DefinitionPath.SwitchType)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.SwitchType) SwitchType is $($DefinitionPath.SwitchType)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogError "[$FAIL] $thisAdapter $($AdvancedRegistryKey.SwitchType) SwitchType is $($DefinitionPath.SwitchType)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.SwitchType) SwitchType is $($DefinitionPath.SwitchType)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
if ($AdvancedRegistryKey.SwitchId -eq 0) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.SwitchId) SwitchId is $($DefinitionPath.SwitchId)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.SwitchId) SwitchId is $($DefinitionPath.SwitchId)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogError "[$FAIL] $thisAdapter $($AdvancedRegistryKey.SwitchId) SwitchId is $($DefinitionPath.SwitchId)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.SwitchId) SwitchId is $($DefinitionPath.SwitchId)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
if ($AdvancedRegistryKey.NumVFs -ge 32) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.NumVFs) NumVFs is -ge $($DefinitionPath.NumVFs)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.NumVFs) NumVFs is -ge $($DefinitionPath.NumVFs)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogError "[$FAIL] $thisAdapter $($AdvancedRegistryKey.NumVFs) NumVFs is -ge $($DefinitionPath.NumVFs)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.NumVFs) NumVFs is -ge $($DefinitionPath.NumVFs)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
}
Function Test-NumericParameterBaseValue {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath # This is what is defined in the datatypes.ps1
)
if ($AdvancedRegistryKey.NumericParameterBaseValue -eq $DefinitionPath.NumericParameterBaseValue) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterBaseValue is $($DefinitionPath.NumericParameterBaseValue)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterBaseValue is $($DefinitionPath.NumericParameterBaseValue)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogMessage "[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterBaseValue is $($DefinitionPath.NumericParameterBaseValue)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterBaseValue is $($DefinitionPath.NumericParameterBaseValue)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
}
Function Test-NumericParameterStepValue {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath # This is what is defined in the datatypes.ps1
)
if ($AdvancedRegistryKey.NumericParameterStepValue -eq $DefinitionPath.NumericParameterStepValue) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterStepValue is $($DefinitionPath.NumericParameterStepValue)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterStepValue is $($DefinitionPath.NumericParameterStepValue)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogMessage "[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterStepValue is $($DefinitionPath.NumericParameterStepValue)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterStepValue is $($DefinitionPath.NumericParameterStepValue)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
}
Function Test-NumericParameterMaxValue {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath, # This is what is defined in the datatypes.ps1
[Switch] $OrGreater # Greater or Equal too the defined value
)
if ($OrGreater) {
if ($AdvancedRegistryKey.NumericParameterMaxValue -ge $DefinitionPath.NumericParameterMaxValue) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMaxValue is -ge $($DefinitionPath.NumericParameterMaxValue)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMaxValue is -ge $($DefinitionPath.NumericParameterMaxValue)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogMessage "[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMaxValue is -ge $($DefinitionPath.NumericParameterMaxValue)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMaxValue is -ge $($DefinitionPath.NumericParameterMaxValue)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
}
else {
if ($AdvancedRegistryKey.NumericParameterMaxValue -eq $DefinitionPath.NumericParameterMaxValue) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMaxValue is $($DefinitionPath.NumericParameterMaxValue)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMaxValue is $($DefinitionPath.NumericParameterMaxValue)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogMessage "[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMaxValue is $($DefinitionPath.NumericParameterMaxValue)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMaxValue is $($DefinitionPath.NumericParameterMaxValue)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
}
}
Function Test-NumericParameterMinValue {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath, # This is what is defined in the datatypes.ps1
[Switch] $OrLess # Less than or Equal too the defined value
)
if ($OrLess) {
if ($AdvancedRegistryKey.NumericParameterMinValue -le $DefinitionPath.NumericParameterMinValue) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMinValue is -le $($DefinitionPath.NumericParameterMinValue)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMinValue is $($DefinitionPath.NumericParameterMinValue)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogMessage "[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMinValue is -le $($DefinitionPath.NumericParameterMinValue)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMinValue is $($DefinitionPath.NumericParameterMinValue)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
}
else {
if ($AdvancedRegistryKey.NumericParameterMinValue -eq $DefinitionPath.NumericParameterMinValue) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMinValue is -le $($DefinitionPath.NumericParameterMinValue)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMinValue is $($DefinitionPath.NumericParameterMinValue)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogMessage "[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMinValue is -le $($DefinitionPath.NumericParameterMinValue)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) NumericParameterMinValue is $($DefinitionPath.NumericParameterMinValue)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
}
}
Function Test-DefaultRegistryValue {
param (
$AdvancedRegistryKey , # This is what is configured on the adapter
$DefinitionPath # This is what is defined in the datatypes.ps1
)
if ($AdvancedRegistryKey.DefaultRegistryValue -eq $DefinitionPath.DefaultRegistryValue) {
Write-WTTLogMessage "[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DefaultRegistryValue is $($DefinitionPath.DefaultRegistryValue)"
"[$PASS] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DefaultRegistryValue is $($DefinitionPath.DefaultRegistryValue)" | Out-File -FilePath $Log -Append
}
Else {
Write-WTTLogMessage "[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DefaultRegistryValue is $($DefinitionPath.DefaultRegistryValue)"
"[$FAIL] $thisAdapter $($AdvancedRegistryKey.RegistryKeyword) DefaultRegistryValue is $($DefinitionPath.DefaultRegistryValue)" | Out-File -FilePath $Log -Append
$testsFailed ++
}
}

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

@ -1,3 +1,5 @@
# This file is deprecated because of WTT logging issues with the script:scope
<# Tests:
- Existance of required keys per documented requirements
- Tests the correct type
@ -22,8 +24,8 @@ $Adapters | ForEach-Object {
$thisAdapterAdvancedProperties = $AdapterAdvancedProperties | Where-Object Name -eq $thisAdapter.Name
# This is the configuration from the remote pNIC
$AdapterConfiguration = Invoke-Command ${function:Get-AdvancedRegistryKeyInfo} -Session $PSSession -ArgumentList $thisAdapter.Name, $thisAdapterAdvancedProperties
$NicSwitchConfiguration = Invoke-Command ${function:Get-NicSwitchInfo} -Session $PSSession -ArgumentList $thisAdapter.Name
$AdapterConfiguration = Get-AdvancedRegistryKeyInfo -InterfaceName $thisAdapter.Name -AdapterAdvancedProperties $thisAdapterAdvancedProperties
$NicSwitchConfiguration = Get-NicSwitchInfo -InterfaceName $thisAdapter.Name
# Device.Network.LAN.Base.100MbOrGreater Windows Server Ethernet devices must be able to link at 1Gbps or higher speeds
if ($thisAdapter.Speed -ge 1000000000) { $PassFail = $pass }
@ -35,6 +37,94 @@ $Adapters | ForEach-Object {
$RequirementsTested = @()
Switch -Wildcard ($AdapterConfiguration) {
{ $_.RegistryKeyword -eq '*EncapOverhead' } {
# *EncapOverhead: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead
# *EncapOverhead: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead
# *EncapOverhead: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead
# *EncapOverhead: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead
# *EncapOverhead: NumericParameterMaxValue
Test-NumericParameterMaxValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead -OrGreater
# *EncapOverhead: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapOverhead -OrLess
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*EncapsulatedPacketTaskOffloadNvgre' } {
# *LsoV2IPv4: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadNvgre
# *LsoV2IPv4: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadNvgre
# *LsoV2IPv4: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadNvgre
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.EncapsulatedPacketTaskOffloadNvgre
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*EncapsulatedPacketTaskOffloadVxlan' } {
# *LsoV2IPv4: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv4
# *LsoV2IPv4: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv4
# *LsoV2IPv4: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv4
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.LSO.LsoV2IPv4
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*FlowControl' } {
# *LsoV2IPv4: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.FlowControl
# *LsoV2IPv4: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.FlowControl
# *LsoV2IPv4: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.FlowControl
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.FlowControl
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*InterruptModeration' } {
# *LsoV2IPv4: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.InterruptModeration
# *LsoV2IPv4: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.InterruptModeration
# *LsoV2IPv4: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.InterruptModeration
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.InterruptModeration
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*JumboPacket' } {
# *JumboPacket: RegistryDefaultValue
@ -243,7 +333,7 @@ $Adapters | ForEach-Object {
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcGroup
# *RSSBaseProcGroup: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcGroup -MaxValue 4
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcGroup
# *RSSBaseProcGroup: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSBaseProcGroup
@ -279,6 +369,99 @@ $Adapters | ForEach-Object {
}
{ $_.RegistryKeyword -eq '*RssMaxProcNumber' } {
# *RssMaxProcNumber: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
# *RssMaxProcNumber: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
# *RssMaxProcNumber: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
# *RssMaxProcNumber: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
# *RssMaxProcNumber: NumericParameterMaxValue
Test-NumericParameterMaxValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
# *RssMaxProcNumber: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RssMaxProcNumber
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RSSMaxProcGroup' } {
# *RSSMaxProcGroup: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSMaxProcGroup
# *RSSMaxProcGroup: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSMaxProcGroup
# *RSSMaxProcGroup: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSMaxProcGroup
# *RSSMaxProcGroup: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSMaxProcGroup
# *RSSMaxProcGroup: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSMaxProcGroup
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RSSOnHostVPorts' } {
# *RSS: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSOnHostVPorts
# *RSS: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSOnHostVPorts
# *RSS: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSOnHostVPorts
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSOnHostVPorts
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RssOrVmqPreference' } {
# *VMQVlanFiltering: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.RssOrVmqPreference
# *VMQVlanFiltering: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.RssOrVmqPreference
# *VMQVlanFiltering: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.RssOrVmqPreference
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.RssOrVmqPreference
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*RSSProfile' } {
# *RSSProfile: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSProfile
# *RSSProfile: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSProfile
# *RSSProfile: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSProfile
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.RSSClass.RSSProfile
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*SRIOV' } {
# *SRIOV: RegistryDefaultValue
@ -331,18 +514,6 @@ $Adapters | ForEach-Object {
}
{ $_.RegistryKeyword -eq '*VMQ' } {
# *VMQ: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQ
# *VMQ: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQ
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq 'VLANID' } {
# Device.Network.LAN.Base.PriorityVLAN - Since all WS devices must be -ge 1Gbps, they must implement
# Ethernet devices that implement link speeds of gigabit or greater must implement Priority & VLAN tagging according to the IEEE 802.1q specification.
@ -368,13 +539,66 @@ $Adapters | ForEach-Object {
$RequirementsTested += $_.RegistryKeyword
}
}
Write-Host ''
{ $_.RegistryKeyword -eq '*VMQ' } {
# *VMQ: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQ
# *VMQ: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQ
# *VMQ: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQ
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQ
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*VMQVlanFiltering' } {
# *VMQVlanFiltering: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQVlanFiltering
# *VMQVlanFiltering: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQVlanFiltering
# *VMQVlanFiltering: ValidRegistryValues
Test-ContainsAllMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQVlanFiltering
Test-ContainsOnlyMSFTRequiredValidRegistryValues -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VMQClass.VMQVlanFiltering
$RequirementsTested += $_.RegistryKeyword
}
{ $_.RegistryKeyword -eq '*VxlanUDPPortNumber' } {
# *VxlanUDPPortNumber: RegistryDefaultValue
Test-RegistryDefaultValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber
# *VxlanUDPPortNumber: DisplayParameterType
Test-DisplayParameterType -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber
# *VxlanUDPPortNumber: NumericParameterBaseValue
Test-NumericParameterBaseValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber
# *VxlanUDPPortNumber: NumericParameterStepValue
Test-NumericParameterStepValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber
# *VxlanUDPPortNumber: NumericParameterMaxValue
Test-NumericParameterMaxValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber -OrGreater
# *VxlanUDPPortNumber: NumericParameterMinValue
Test-NumericParameterMinValue -AdvancedRegistryKey $_ -DefinitionPath $AdapterDefinition.VxlanUDPPortNumber -OrLess
$RequirementsTested += $_.RegistryKeyword
}
}
$RequirementsTested | ForEach-Object {
$ThisTestedRequirement = $_.TrimStart('*')
Write-Host $ThisTestedRequirement
$Requirements.Base = $Requirements.Base | Where-Object { $_ -ne $ThisTestedRequirement }
$Requirements.TenGbEOrGreater = $Requirements.TenGbEOrGreater | Where-Object { $_ -ne $ThisTestedRequirement }
@ -382,7 +606,11 @@ $Adapters | ForEach-Object {
$Requirements.Premium = $Requirements.Premium | Where-Object { $_ -ne $ThisTestedRequirement }
}
Write-Host ''
$Certification = 'Fail'
#[System.Collections.ArrayList] $RemainingRequirements = $Requirements[0..$Requirements.count].ForEach({ $_.foreach({ $_ }) })
}
If ($Requirements.Premium -eq $Null -and $Requirements.Standard -and
$Requirements.TenGbEOrGreater -and $Requirements.Base) { $Certification = 'Premium' }
ElseIf ($Requirements.Standard -and $Requirements.TenGbEOrGreater -and $Requirements.Base) { $Certification = 'Standard' }
ElseIf ($Requirements.TenGbEOrGreater -and $Requirements.Base) { $Certification = 'TenGbEOrGreater' }
ElseIf ($Requirements.Base) { $Certification = 'Base' }
}