Skip to content

Commit

Permalink
Merge pull request #308 from PowerShell/dev
Browse files Browse the repository at this point in the history
Release of version 5.5.0.0 of xNetworking
  • Loading branch information
kwirkykat authored Feb 8, 2018
2 parents 1b9422b + c266ebd commit c57f1f0
Show file tree
Hide file tree
Showing 58 changed files with 3,919 additions and 1,280 deletions.
31 changes: 31 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,37 @@

## Unreleased

## 5.5.0.0

- MSFT_xNetAdapterAdvancedProperty:
- Created new resource configuring AdvancedProperties for NetAdapter
- MSFT_xNetAdapterLso:
- Corrected style and formatting to meet HQRM guidelines.
- Updated tests to meet Pester v4 guidelines.
- MSFT_xNetAdapterName:
- Corrected style and formatting to meet HQRM guidelines.
- Updated tests to meet Pester v4 guidelines.
- MSFT_xNetAdapterRDMA:
- Corrected style and formatting to meet HQRM guidelines.
- Updated tests to meet Pester v4 guidelines.
- Converted exceptions to use ResourceHelper functions.
- Improved integration tests to preserve system status and run in more
scenarios.
- MSFT_xNetBIOS:
- Corrected style and formatting to meet HQRM guidelines.
- Updated tests to meet Pester v4 guidelines.
- Converted exceptions to use ResourceHelper functions.
- Improved integration tests to preserve system status, run in more
scenarios and more effectively test the resource.
- Changed to report back error if unable to set NetBIOS setting.
- MSFT_xWinsSetting:
- Created new resource for enabling/disabling LMHOSTS lookup and
enabling/disabling WINS name resoluton using DNS.
- MSFT_xNetworkTeam:
- Corrected style and formatting to meet HQRM guidelines.
- Updated tests to meet Pester v4 guidelines.
- Converted exceptions to use ResourceHelper functions.

## 5.4.0.0

- MSFT_xIPAddressOption:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,217 @@
$modulePath = Join-Path -Path (Split-Path -Path (Split-Path -Path $PSScriptRoot -Parent) -Parent) -ChildPath 'Modules'

# Import the Networking Common Modules
Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'NetworkingDsc.Common' `
-ChildPath 'NetworkingDsc.Common.psm1'))

# Import the Networking Resource Helper Module
Import-Module -Name (Join-Path -Path $modulePath `
-ChildPath (Join-Path -Path 'NetworkingDsc.ResourceHelper' `
-ChildPath 'NetworkingDsc.ResourceHelper.psm1'))

# Import Localization Strings
$localizedData = Get-LocalizedData `
-ResourceName 'MSFT_xNetAdapterAdvancedProperty' `
-ResourcePath (Split-Path -Parent $Script:MyInvocation.MyCommand.Path)

<#
.SYNOPSIS
Gets the current value of an advanced property.
.PARAMETER NetworkAdapterName
Specifies the Name of the network adapter to get the advanced property for.
.PARAMETER RegistryKeyword
Specifies the settings registrykeyword that should be in desired state.
.PARAMETER RegistryValue
Specifies the value of the settings.
#>
function Get-TargetResource
{
[CmdletBinding()]
[OutputType([System.Collections.Hashtable])]
param
(
[Parameter(Mandatory = $true)]
[System.String]
$NetworkAdapterName,

[Parameter(Mandatory = $true)]
[ValidateSet("*FlowControl","*InterruptModeration","*IPChecksumOffloadIPv4","*JumboPacket","*LsoV2IPv4","*LsoV2IPv6","*MaxRssProcessors","*NumaNodeId","*NumRssQueues","*PriorityVLANTag","*ReceiveBuffers","*RSS","*RssBaseProcNumber","*RssMaxProcNumber","*RSSProfile","*SpeedDuplex","*TCPChecksumOffloadIPv4","*TCPChecksumOffloadIPv6","*TransmitBuffers","*UDPChecksumOffloadIPv4","*UDPChecksumOffloadIPv6","AdaptiveIFS","ITR","LogLinkStateEvent","MasterSlave","NetworkAddress","WaitAutoNegComplete")]
[System.String]
$RegistryKeyword,

[Parameter(Mandatory = $true)]
[System.String]
$RegistryValue
)

Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$localizedData.CheckingNetAdapterMessage
) -join '')

try
{
$netAdapterAdvancedProperty = Get-NetAdapterAdvancedProperty -Name $networkAdapterName -RegistryKeyword $RegistryKeyword -ErrorAction Stop
}
catch
{
New-InvalidOperationException `
-Message ($LocalizedData.NetAdapterNotFoundMessage)
}

if ($netAdapterAdvancedProperty)
{
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$($LocalizedData.NetAdapterTestingStateMessage -f $NetworkAdapterName, $RegistryKeyword)
) -join '')

$result = @{
Name = $NetworkAdapterName
RegistryKeyword = $RegistryKeyword
DisplayValue = $netAdapterAdvancedProperty.DisplayValue
RegistryValue = $netAdapterAdvancedProperty.RegistryValue
}

return $result
}
}

<#
.SYNOPSIS
Gets the current value of an advanced property.
.PARAMETER NetworkAdapterName
Specifies the Name of the network adapter to get the advanced property for.
.PARAMETER RegistryKeyword
Specifies the settings registrykeyword that should be in desired state.
.PARAMETER RegistryValue
Specifies the value of the settings.
#>
function Set-TargetResource
{
[CmdletBinding()]
param
(
[Parameter(Mandatory = $true)]
[System.String]
$NetworkAdapterName,

[Parameter(Mandatory = $true)]
[ValidateSet("*FlowControl","*InterruptModeration","*IPChecksumOffloadIPv4","*JumboPacket","*LsoV2IPv4","*LsoV2IPv6","*MaxRssProcessors","*NumaNodeId","*NumRssQueues","*PriorityVLANTag","*ReceiveBuffers","*RSS","*RssBaseProcNumber","*RssMaxProcNumber","*RSSProfile","*SpeedDuplex","*TCPChecksumOffloadIPv4","*TCPChecksumOffloadIPv6","*TransmitBuffers","*UDPChecksumOffloadIPv4","*UDPChecksumOffloadIPv6","AdaptiveIFS","ITR","LogLinkStateEvent","MasterSlave","NetworkAddress","WaitAutoNegComplete")]
[System.String]
$RegistryKeyword,

[Parameter(Mandatory = $true)]
[System.String]
$RegistryValue
)

Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$localizedData.CheckingNetAdapterMessage
) -join '')

try
{
$netAdapterAdvancedProperty = Get-NetAdapterAdvancedProperty -Name $networkAdapterName -RegistryKeyword $RegistryKeyword -ErrorAction Stop
}
catch
{
New-InvalidOperationException `
-Message ($LocalizedData.NetAdapterNotFoundMessage)
}

if ($netAdapterAdvancedProperty)
{
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$($LocalizedData.NetAdapterTestingStateMessage -f $NetworkAdapterName, $RegistryKeyword)
) -join '')

if ($RegistryValue -ne $netAdapterAdvancedProperty.RegistryValue)
{
$netadapterRegistryValue = $netAdapterAdvancedProperty.RegistryValue
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$($LocalizedData.NetAdapterApplyingChangesMessage -f `
$NetworkAdapterName, $RegistryKeyword, "$netadapterRegistryValue", $RegistryValue )
) -join '')

Set-NetAdapterAdvancedProperty -RegistryValue $RegistryValue -Name $networkAdapterName -RegistryKeyword $RegistryKeyword
}
}
}

<#
.SYNOPSIS
Sets the current value of an advanced property.
.PARAMETER NetworkAdapterName
Specifies the Name of the network adapter to get the advanced property for.
.PARAMETER RegistryKeyword
Specifies the settings registrykeyword that should be in desired state.
.PARAMETER RegistryValue
Specifies the value of the settings.
#>
function Test-TargetResource
{
[CmdletBinding()]
[OutputType([System.Boolean])]
param
(
[Parameter(Mandatory = $true)]
[System.String]
$NetworkAdapterName,

[Parameter(Mandatory = $true)]
[ValidateSet("*FlowControl","*InterruptModeration","*IPChecksumOffloadIPv4","*JumboPacket","*LsoV2IPv4","*LsoV2IPv6","*MaxRssProcessors","*NumaNodeId","*NumRssQueues","*PriorityVLANTag","*ReceiveBuffers","*RSS","*RssBaseProcNumber","*RssMaxProcNumber","*RSSProfile","*SpeedDuplex","*TCPChecksumOffloadIPv4","*TCPChecksumOffloadIPv6","*TransmitBuffers","*UDPChecksumOffloadIPv4","*UDPChecksumOffloadIPv6","AdaptiveIFS","ITR","LogLinkStateEvent","MasterSlave","NetworkAddress","WaitAutoNegComplete")]
[System.String]
$RegistryKeyword,

[Parameter(Mandatory = $true)]
[System.String]
$RegistryValue
)

Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$localizedData.CheckingNetAdapterMessage
) -join '')

try
{
$netAdapterAdvancedProperty = Get-NetAdapterAdvancedProperty -Name $networkAdapterName -RegistryKeyword $RegistryKeyword -ErrorAction Stop
}
catch
{
New-InvalidOperationException `
-Message ($LocalizedData.NetAdapterNotFoundMessage)
}

if ($netAdapterAdvancedProperty)
{
Write-Verbose -Message ( @(
"$($MyInvocation.MyCommand): "
$localizedData.NetAdapterTestingStateMessage -f `
$NetworkAdapterName, $RegistryKeyword
) -join '')

if ($RegistryValue -eq $netAdapterAdvancedProperty.RegistryValue)
{
return $true
}
else
{
return $false
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[ClassVersion("1.0.0.0"), FriendlyName("xNetAdapterAdvancedProperty")]
class MSFT_xNetAdapterAdvancedProperty : OMI_BaseResource
{
[Key,ValueMap{"*FlowControl","*InterruptModeration","*IPChecksumOffloadIPv4","*JumboPacket","*LsoV2IPv4","*LsoV2IPv6","*MaxRssProcessors","*NumaNodeId","*NumRssQueues","*PriorityVLANTag","*ReceiveBuffers","*RSS","*RssBaseProcNumber","*RssMaxProcNumber","*RSSProfile","*SpeedDuplex","*TCPChecksumOffloadIPv4","*TCPChecksumOffloadIPv6","*TransmitBuffers","*UDPChecksumOffloadIPv4","*UDPChecksumOffloadIPv6","AdaptiveIFS","ITR","LogLinkStateEvent","MasterSlave","NetworkAddress","WaitAutoNegComplete"},Values{"*FlowControl","*InterruptModeration","*IPChecksumOffloadIPv4","*JumboPacket","*LsoV2IPv4","*LsoV2IPv6","*MaxRssProcessors","*NumaNodeId","*NumRssQueues","*PriorityVLANTag","*ReceiveBuffers","*RSS","*RssBaseProcNumber","*RssMaxProcNumber","*RSSProfile","*SpeedDuplex","*TCPChecksumOffloadIPv4","*TCPChecksumOffloadIPv6","*TransmitBuffers","*UDPChecksumOffloadIPv4","*UDPChecksumOffloadIPv6","AdaptiveIFS","ITR","LogLinkStateEvent","MasterSlave","NetworkAddress","WaitAutoNegComplete"},Description("Specifies the registrykeyword of the property that should be in desired state.")] String RegistryKeyword;
[Required, Description("Specifies the network adapter name.")] String NetworkAdapterName;
[Required, Description("Specifies the registryvalue.")] String RegistryValue;
[Read, Description("Output Display value of selected RegistryKeyword.")] String DisplayValue;
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Description

This resource is used to change advanced properties on a network adapter.
Please check the supported registry values before creating a configuration.

Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Localized resources for MSFT_xNetAdapterAdvancedProperty

ConvertFrom-StringData @'
CheckingNetAdapterMessage = Checking if network adapter exists or not.
NetAdapterNotFoundMessage = Network adapter not found.
NetAdapterTestingStateMessage = Checking if adapter {0} '{1}' is in desired state.
NetAdapterIsInDesiredStateMessage = Network adapter {0} '{1}' is in desired state '{2}'.
NetAdapterApplyingChangesMessage = Network adapter {0} '{1}' was '{2}', should be '{3}', applying changes.
'@
Loading

0 comments on commit c57f1f0

Please sign in to comment.