Src/Private/Get-AbrOntapNetworkMGMT.ps1
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
function Get-AbrOntapNetworkMgmt { <# .SYNOPSIS Used by As Built Report to retrieve NetApp ONTAP network management interfaces information from the Cluster Management Network .DESCRIPTION .NOTES Version: 0.6.6 Author: Jonathan Colon Twitter: @jcolonfzenpr Github: rebelinux .EXAMPLE .LINK #> [CmdletBinding()] param ( ) begin { Write-PscriboMessage "Collecting ONTAP network management interface information." } process { try { if (Get-NcNetInterface -Controller $Array | Where-Object {$_.Role -eq 'cluster'}) { try { Section -ExcludeFromTOC -Style Heading6 'Cluster Network Interfaces' { $ClusterData = Get-NcNetInterface -Controller $Array | Where-Object {$_.Role -eq 'cluster'} $ClusterObj = @() if ($ClusterData) { foreach ($Item in $ClusterData) { try { $inObj = [ordered] @{ 'Cluster Interface' = $Item.InterfaceName 'Status' = Switch ($Item.OpStatus) { "" {"Unknown"} $Null {"Unknown"} default {$Item.OpStatus.ToString().ToUpper()} } 'Data Protocols' = $Item.DataProtocols 'Address' = $Item.Address 'Vserver' = $Item.Vserver } $ClusterObj += [pscustomobject]$inobj } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Network.Interface) { $ClusterObj | Where-Object { $_.'Status' -notlike 'UP' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ Name = "Cluster Network - $($ClusterInfo.ClusterName)" List = $false ColumnWidths = 35, 8, 21, 18, 18 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $ClusterObj | Table @TableParams } } } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } try { Section -ExcludeFromTOC -Style Heading6 'Management Network Interfaces' { $ClusterData = Get-NcNetInterface -Controller $Array | Where-Object {$_.Role -eq 'cluster_mgmt' -or $_.Role -eq 'node_mgmt'} $ClusterObj = @() if ($ClusterData) { foreach ($Item in $ClusterData) { try { $inObj = [ordered] @{ 'MGMT Interface' = $Item.InterfaceName 'Status' = Switch ($Item.OpStatus) { "" {"Unknown"} $Null {"Unknown"} default {$Item.OpStatus.ToString().ToUpper()} } 'Data Protocols' = $Item.DataProtocols 'Address' = $Item.Address 'Vserver' = $Item.Vserver } $ClusterObj += [pscustomobject]$inobj } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Network.Interface) { $ClusterObj | Where-Object { $_.'Status' -notlike 'UP' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ Name = "Management Network - $($ClusterInfo.ClusterName)" List = $false ColumnWidths = 35, 8, 21, 18, 18 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $ClusterObj | Table @TableParams } } } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } try { if (Get-NcNetInterface -Controller $Array | Where-Object {$_.Role -eq 'intercluster'}) { Section -ExcludeFromTOC -Style Heading6 'Intercluster Network Interfaces' { $ClusterData = Get-NcNetInterface -Controller $Array | Where-Object {$_.Role -eq 'intercluster'} $ClusterObj = @() if ($ClusterData) { foreach ($Item in $ClusterData) { try { $inObj = [ordered] @{ 'Intercluster Interface' = $Item.InterfaceName 'Status' = Switch ($Item.OpStatus) { "" {"Unknown"} $Null {"Unknown"} default {$Item.OpStatus.ToString().ToUpper()} } 'Data Protocols' = $Item.DataProtocols 'Address' = $Item.Address 'Vserver' = $Item.Vserver } $ClusterObj += [pscustomobject]$inobj } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Network.Interface) { $ClusterObj | Where-Object { $_.'Status' -notlike 'UP' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ Name = "Intercluster Network - $($ClusterInfo.ClusterName)" List = $false ColumnWidths = 35, 8, 21, 18, 18 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $ClusterObj | Table @TableParams } } } } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } try { Section -ExcludeFromTOC -Style Heading6 'Data Network Interfaces' { $ClusterData = Get-NcNetInterface -Controller $Array | Where-Object {$_.Role -eq 'data' -and $_.DataProtocols -ne 'fcp' -and $_.Vserver -notin $options.Exclude.Vserver} $ClusterObj = @() if ($ClusterData) { foreach ($Item in $ClusterData) { try { $inObj = [ordered] @{ 'Data Interface' = $Item.InterfaceName 'Status' = Switch ($Item.OpStatus) { "" {"Unknown"} $Null {"Unknown"} default {$Item.OpStatus.ToString().ToUpper()} } 'Data Protocols' = [string]$Item.DataProtocols 'Address' = $Item.Address 'Vserver' = $Item.Vserver } $ClusterObj += [pscustomobject]$inobj } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Network.Interface) { $ClusterObj | Where-Object { $_.'Status' -notlike 'UP' } | Set-Style -Style Warning -Property 'Status' } $TableParams = @{ Name = "Data Network - $($ClusterInfo.ClusterName)" List = $false ColumnWidths = 33, 10, 21, 18, 18 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $ClusterObj | Table @TableParams } } } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } try { if ((Get-NcNetInterface -Controller $Array | Where-Object { $_.DataProtocols -ne 'fcp' -and $_.IsHome -like "False"}) -and $Healthcheck.Network.Interface) { Section -ExcludeFromTOC -Style Heading6 'HealthCheck - Check If Network Interface is Home' { Paragraph "The following section provides the LIF Home Status Information on $($ClusterInfo.ClusterName)." BlankLine $ClusterData = Get-NcNetInterface -Controller $Array | Where-Object { $_.DataProtocols -ne 'fcp' -and $_.IsHome -like "False"} $ClusterObj = @() if ($ClusterData) { foreach ($Item in $ClusterData) { try { $inObj = [ordered] @{ 'Network Interface' = $Item.InterfaceName 'Home Port' = $Item.HomeNode + ":" + $Item.HomePort 'Current Port' = $Item.CurrentNode + ":" + $Item.CurrentPort 'IsHome' = Switch ($Item.IsHome) { "True" { 'Yes' } "False" { "No" } default {$Item.IsHome} } 'Vserver' = $Item.Vserver } $ClusterObj += [pscustomobject]$inobj } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } if ($Healthcheck.Network.Interface) { $ClusterObj | Where-Object { $_.'IsHome' -ne 'Yes' } | Set-Style -Style Warning -Property 'Network Interface','IsHome','Home Port','Current Port','Vserver' } $TableParams = @{ Name = "Network Interface Home Status - $($ClusterInfo.ClusterName)" List = $false ColumnWidths = 20, 25, 25, 10, 20 } if ($Report.ShowTableCaptions) { $TableParams['Caption'] = "- $($TableParams.Name)" } $ClusterObj | Table @TableParams } } } } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } catch { Write-PscriboMessage -IsWarning $_.Exception.Message } } end {} } |