Skip to content

Cluster diagram: migrate Edge to Add-DiaNodeEdge + add per-broadcast-domain Data Network detail#80

Merged
rebelinux merged 6 commits intodevfrom
copilot/improve-cluster-diagram
Mar 2, 2026
Merged

Cluster diagram: migrate Edge to Add-DiaNodeEdge + add per-broadcast-domain Data Network detail#80
rebelinux merged 6 commits intodevfrom
copilot/improve-cluster-diagram

Conversation

Copy link
Contributor

Copilot AI commented Mar 2, 2026

Two enhancements to the ONTAP cluster diagram:

Edge cmdlet migration

Replaces all raw Edge -From … @{…} PSGraph calls across four diagram files with the Add-DiaNodeEdge wrapper introduced in Diagrammer.Core 0.2.39. Module minimum version bumped accordingly.

Old New
color / style / penwidth (int) -EdgeColor / -EdgeStyle / -EdgeThickness
penwidth (float) / style='filled' -GraphvizAttributes @{penwidth=1.5} / @{style='filled'}
label / fontcolor / fontsize -EdgeLabel / -EdgeLabelFontColor / -EdgeLabelFontSize
minlen / tailport / headport -EdgeLength / -TailPort / -HeadPort

Float penwidth and style='filled' pass through -GraphvizAttributes since they fall outside EdgeThickness [int] and the EdgeStyle ValidateSet respectively.

Files changed: Get-AbrOntapClusterDiagram.ps1, Get-AbrOntapNodeNetworkDiagram.ps1, Get-AbrOntapVserverDiagram.ps1, Get-AbrOntapClusterReplicationDiagram.ps1

Per-broadcast-domain Data Network detail

The cluster diagram previously showed a single generic Data Network switch with no topology context. Now, each non-Cluster broadcast domain is rendered as its own subgraph node below the switch, listing its port members.

# For each non-Cluster broadcast domain fetched via Get-NcNetPortBroadcastDomain:
Add-DiaHtmlSubGraph -Name "${BDomainSafeName}BroadcastDomain" `
    -TableArray $PortTextItems `   # one Add-DiaNodeText per node:port member
    -Label "$($BDomain.BroadcastDomain) | IPSpace: $($BDomain.Ipspace) | MTU: $($BDomain.Mtu)" `
    -LabelPos 'top' -TableBorderColor '#70AD47' -NodeObject …

Add-DiaNodeEdge -From 'DataNetwork' -To "${BDomainSafeName}BroadcastDomain" `
    -EdgeColor '#70AD47' -EdgeStyle 'dashed' -Arrowhead 'none' -Arrowtail 'none'

Domains with no ports render a "No Ports Assigned" placeholder. The section is isolated in its own try/catch so failures don't affect the rest of the diagram.

Original prompt

This section details on the original issue you should resolve

<issue_title>Improve Cluster Diagram diagram</issue_title>
<issue_description>### Description

Improve Cluster Diagram in file Get-AbrOntapClusterDiagram.ps1 with more information an capabilities

Additional Context

Use as a reference this diagram:

Image

Before submitting

  • I have read the documentation, and referred to the known issues before submitting this change request.
  • I have checked for previously opened & closed issues before submitting this change request.</issue_description>

Comments on the Issue (you are @copilot in this section)


🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.

…, Management, Data networks)

Co-authored-by: rebelinux <1002783+rebelinux@users.noreply.github.com>
Copilot AI changed the title [WIP] Improve Cluster Diagram with additional information and capabilities Improve Cluster Diagram with Cluster, Management, and Data Network topology Mar 2, 2026
Co-authored-by: rebelinux <1002783+rebelinux@users.noreply.github.com>
Copilot AI changed the title Improve Cluster Diagram with Cluster, Management, and Data Network topology Improve Cluster Diagram: add network topology context and migrate to Add-DiaNodeEdge Mar 2, 2026
…able and adjusting label positions for management and data network subgraphs
Co-authored-by: rebelinux <1002783+rebelinux@users.noreply.github.com>
Copilot AI changed the title Improve Cluster Diagram: add network topology context and migrate to Add-DiaNodeEdge Cluster diagram: migrate Edge to Add-DiaNodeEdge + add per-broadcast-domain Data Network detail Mar 2, 2026
…, adjusting label positions, and increasing edge thickness for better visibility
@rebelinux rebelinux marked this pull request as ready for review March 2, 2026 16:18
Copilot AI review requested due to automatic review settings March 2, 2026 16:18
@rebelinux rebelinux merged commit 00e237a into dev Mar 2, 2026
2 of 3 checks passed
@rebelinux rebelinux deleted the copilot/improve-cluster-diagram branch March 2, 2026 16:18
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR enhances the ONTAP diagram generation by migrating edge rendering to the Add-DiaNodeEdge wrapper (Diagrammer.Core 0.2.39+) and expanding the cluster diagram’s “Data Network” section to include per-broadcast-domain topology details.

Changes:

  • Replaced multiple raw PSGraph Edge calls with Add-DiaNodeEdge across several diagram scripts.
  • Enhanced cluster diagram to render each non-Cluster broadcast domain as its own subgraph with member ports.
  • Bumped the required Diagrammer.Core minimum version to 0.2.39.

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Src/Private/Get-AbrOntapClusterDiagram.ps1 Adds infrastructure switches + per-broadcast-domain Data Network detail; migrates HA edges to Add-DiaNodeEdge.
Src/Private/Get-AbrOntapNodeNetworkDiagram.ps1 Migrates cluster/port/HA edges to Add-DiaNodeEdge.
Src/Private/Get-AbrOntapVserverDiagram.ps1 Migrates some edges to Add-DiaNodeEdge (Volumes/LIFs).
Src/Private/Get-AbrOntapClusterReplicationDiagram.ps1 Migrates replication edges to Add-DiaNodeEdge.
AsBuiltReport.NetApp.ONTAP.psd1 Updates required module version for Diagrammer.Core to support the new edge wrapper.
Comments suppressed due to low confidence (3)

Src/Private/Get-AbrOntapClusterDiagram.ps1:76

  • Get-NcNetInterface -Controller $Array is called twice per node (for node_mgmt and intercluster), which can be expensive on large clusters and increases API load. Fetch interfaces once outside the node loop (e.g., cache the result in a variable) and then filter that cached collection per node/role.
                            $ClusterHa = try { Get-NcClusterHa -Node $Node.Node -Controller $Array } catch { Write-PScriboMessage -IsWarning $_.Exception.Message }

                            $NodeMgmtAddress = Get-NcNetInterface -Controller $Array | Where-Object { $_.Role -eq 'node_mgmt' -and $_.HomeNode -eq $Node.Node } | Select-Object -ExpandProperty Address
                            $NodeInterClusterAddress = Get-NcNetInterface -Controller $Array | Where-Object { $_.Role -eq 'intercluster' -and $_.HomeNode -eq $Node.Node } | Select-Object -ExpandProperty Address

Src/Private/Get-AbrOntapClusterDiagram.ps1:184

  • The PR description says each broadcast-domain label should include IPSpace (e.g., BroadcastDomain | IPSpace: ... | MTU: ...), but the label currently only includes MTU. Either update the label to include $BDomain.Ipspace or adjust the PR description so they match.
                                        -TableBorder 1 `
                                        -Label "$($BDomain.BroadcastDomain) | MTU: $($BDomain.Mtu)" `
                                        -LabelPos 'top' `

Src/Private/Get-AbrOntapVserverDiagram.ps1:201

  • Edge-cmdlet migration looks incomplete in this file: there is still a raw Edge call in the Aggregates section (Edge -To "$($VserverNodeName)Aggrs" -From $VserverNodeName ...). If the intent is to replace all PSGraph Edge usages with Add-DiaNodeEdge (as stated in the PR description), migrate the remaining call(s) as well to avoid mixed APIs and keep the Diagrammer.Core minimum-version bump justified.
                        if ($VolSubGraphObj) {
                            Node "$($VserverNodeName)Vols" @{Label = $VolSubGraphObj; shape = 'plain'; fillColor = 'transparent'; fontsize = 14 }
                            Add-DiaNodeEdge -From $VserverNodeName -To "$($VserverNodeName)Vols" -EdgeColor $Edgecolor -Arrowhead 'box' -Arrowtail 'box' -EdgeLength 2 -GraphvizAttributes @{style = 'filled'}
                        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 193 to +197
Add-DiaHtmlSubGraph -Name "$($Port.NodeName)ClusterPorts" -TableArray $ClusterPortObj -ImagesObj $Images -IconDebug $IconDebug -TableBorder 1 -IconType 'Ontap_Network_Port' -Label 'Cluster Network Ports' -LabelPos top -TableStyle 'rounded,dashed' -TableBorderColor '#71797E' -FontName 'Segoe Ui Bold' -ColumnSize $ClusterPortObjColumnSize -NodeObject

Edge -From 'ClusterNetwork' -To "$($Port.NodeName)ClusterPorts" @{color = $Edgecolor; fontcolor = $Fontcolor; fontsize = 12; style = 'dashed'; penwidth = 1; arrowhead = 'box'; arrowtail = 'box' }
Add-DiaNodeEdge -From 'ClusterNetwork' -To "$($Port.NodeName)ClusterPorts" -EdgeColor $Edgecolor -EdgeStyle 'dashed' -EdgeThickness 1 -Arrowhead 'box' -Arrowtail 'box' -EdgeLabelFontColor $Fontcolor -EdgeLabelFontSize 12

Edge -From "$($Port.NodeName)ClusterPorts" -To $Node.NodeName @{minlen = 1; color = $Edgecolor; fontcolor = $Fontcolor; fontsize = 12; style = 'dashed'; penwidth = 1; arrowhead = 'box'; arrowtail = 'box' }
Add-DiaNodeEdge -From "$($Port.NodeName)ClusterPorts" -To $Node.NodeName -EdgeColor $Edgecolor -EdgeStyle 'dashed' -EdgeThickness 1 -Arrowhead 'box' -Arrowtail 'box' -EdgeLabelFontColor $Fontcolor -EdgeLabelFontSize 12 -EdgeLength 1
Copy link

Copilot AI Mar 2, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

$Port.NodeName is referenced when naming/connecting the per-node ClusterPorts subgraph and edges, but $Port comes from the prior foreach ($Port in ...) loop. If a node has zero cluster ports, $Port will be $null or a stale value from a previous node, causing incorrect node names/edges (or runtime errors). Use $Node.NodeName (or an explicitly constructed per-node name variable) instead of relying on $Port outside its loop, and only create the subgraph/edges when there are cluster ports for that node.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Improve Cluster Diagram diagram

3 participants