Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Network Controller test to check for Network Adapter that matches RestInterface property #391

Merged
merged 3 commits into from
Mar 13, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/SdnDiagnostics.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,7 @@
'Test-SdnMuxConnectionStateToRouter',
'Test-SdnMuxConnectionStateToSlbManager',
'Test-SdnNetworkControllerApiNameResolution',
'Test-SdnNetworkControllerNodeRestInterface',
'Test-SdnResourceConfigurationState',
'Test-SdnResourceProvisioningState',
'Test-SdnServiceFabricApplicationHealth',
Expand Down
5 changes: 5 additions & 0 deletions src/modules/SdnDiag.Health.Config.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,11 @@

# NETWORK CONTROLLER TESTS

'Test-SdnNetworkControllerNodeRestInterface' = @{
Description = "Network Controller node(s) are missing the Network Adapter that is required for the REST interface."
Impact = "Failover of the NB API will not occur if the Network Controller node(s) are missing the Network Adapter that is required for the REST interface."
PublicDocUrl = "https://learn.microsoft.com/en-us/powershell/module/networkcontroller/set-networkcontrollernode"
}
'Test-SdnServiceFabricApplicationHealth' = @{
Description = "Network Controller application with Service Fabric is not healthy."
Impact = "Network Controller services and functionality may be impacted."
Expand Down
32 changes: 32 additions & 0 deletions src/modules/SdnDiag.Health.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -1530,6 +1530,7 @@ function Debug-SdnNetworkController {
[string[]]$services_sf = $config_sf.properties.services.Keys
$healthReport.HealthTest += @(
Test-SdnDiagnosticsCleanupTaskEnabled -TaskName 'SDN Diagnostics Task'
Test-SdnNetworkControllerNodeRestInterface
Test-SdnServiceState -ServiceName $services_sf
Test-SdnServiceFabricApplicationHealth
Test-SdnServiceFabricClusterHealth
Expand Down Expand Up @@ -2760,6 +2761,37 @@ function Test-SdnConfigurationState {
}
}

function Test-SdnNetworkControllerNodeRestInterface {
<#
.SYNOPSIS
Validates that a Network Adapter on the Network Controller node exists that matches the RestInterface name.
#>

[CmdletBinding()]
param()

Confirm-IsNetworkController
if ($Global:SdnDiagnostics.EnvironmentInfo.ClusterConfigType -ieq 'FailoverCluster') {
throw New-Object System.NotSupportedException("This function is not applicable to Failover Cluster Network Controller.")
}

$sdnHealthTest = New-SdnHealthTest
try {
$node = Get-SdnNetworkControllerNode -Name $env:COMPUTERNAME -ErrorAction Stop
$netAdapter = Get-NetAdapter -Name $node.RestInterface -ErrorAction Ignore
if ($null -eq $netAdapter) {
$sdnHealthTest.Result = 'FAIL'
$sdnHealthTest.Remediation += "Ensure that the Network Adapter $($node.RestInterface) exists. Leverage 'Set-NetworkControllerNode to update the -RestInterface if original adapter is not available."
}
}
catch {
$_ | Trace-Exception
$sdnHealthTest.Result = 'FAIL'
}

return $sdnHealthTest
}

###################################
##### MUX HEALTH VALIDATIONS ######
###################################
Expand Down
Loading