Skip to content

update FabricDetails to use class object for consistency#526

Merged
arudell merged 9 commits intomainfrom
make-fabricdetails-required
Jan 26, 2026
Merged

update FabricDetails to use class object for consistency#526
arudell merged 9 commits intomainfrom
make-fabricdetails-required

Conversation

@arudell
Copy link
Copy Markdown
Member

@arudell arudell commented Dec 31, 2025

This pull request introduces a new shared SdnFabricInfrastructure class for representing SDN fabric details and updates all relevant modules and functions to use this strongly-typed class instead of System.Object. Additionally, it improves certificate management by ensuring generated certificates are distributed to the entire SDN fabric when appropriate, and refactors admin/environment checks for clarity and consistency. Below are the most important changes:

Shared Infrastructure Type and Refactoring:

  • Introduced a new SdnFabricInfrastructure class in src/classes/Common.psm1 to standardize SDN fabric details across modules. All functions that previously accepted a generic System.Object for fabric details now require this strongly-typed class.
  • Removed the duplicate SdnFabricInfrastructure class definition from SdnDiag.NetworkController.psm1 in favor of the shared version. All modules now import the shared class using using module statements. [1] [2] [3] [4] [5] [6]

Certificate Management Improvements:

  • Updated certificate creation functions (New-SdnNetworkControllerNodeCertificate, New-SdnMuxCertificate, New-SdnServerCertificate) to distribute newly generated certificates to all relevant nodes in the SDN fabric if FabricDetails is provided, using the new type. [1] [2] [3]
  • Updated parameter and help text in certificate management functions to reference the new SdnFabricInfrastructure type and clarify the expected input. [1] [2] [3] [4] [5] [6]

Admin and Environment Validation Refactoring:

  • Refactored environment and admin checks in certificate creation functions to use dedicated helper functions (Confirm-IsAdmin, Confirm-IsNetworkController, Confirm-IsLoadBalancerMux) for improved clarity and maintainability. [1] [2]

Certificate Rotation Functions:

  • Updated certificate rotation functions to use the new SdnFabricInfrastructure type for fabric details and improved logging and try/catch structure for better error handling and traceability. [1] [2] [3] [4] [5] [6] [7] [8]

Documentation and Parameter Updates:

  • Updated parameter documentation throughout the modules to clarify that FabricDetails now refers to the environment info derived from Get-SdnInfrastructureInfo and is of the new shared type. [1] [2] [3]

These changes improve code consistency, type safety, and reliability in SDN diagnostics and certificate management workflows.

Change type

  • Bug fix (non-breaking change)
  • Code style update (formatting, local variables)
  • New Feature (non-breaking change that adds new functionality without impacting existing)
  • Breaking change (fix or feature that may cause functionality impact)
  • Other

Checklist:

  • My code follows the style and contribution guidelines of this project.
  • I have tested and validated my code changes.

@arudell arudell requested a review from a team as a code owner December 31, 2025 15:53
Copy link
Copy Markdown
Contributor

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 pull request refactors SDN fabric infrastructure handling by introducing a centralized SdnFabricInfrastructure class and using it as a strongly-typed parameter across certificate management functions. The changes improve code maintainability, type safety, and consistency while automating certificate distribution across SDN fabric nodes.

Changes:

  • Centralized the SdnFabricInfrastructure class definition in the main module and updated all role modules to reference it via using module statements
  • Replaced generic [System.Object] parameter types with strongly-typed [SdnFabricInfrastructure] across certificate creation and rotation functions
  • Enhanced certificate functions to conditionally distribute generated certificates to all fabric nodes when FabricDetails is provided

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/SdnDiagnostics.psm1 Added centralized SdnFabricInfrastructure class definition and updated parameter type in certificate rotation scriptblock
src/modules/SdnDiag.NetworkController.psm1 Removed duplicate class definition, added using statement, updated parameter types, improved role validation, and added conditional certificate distribution
src/modules/SdnDiag.LoadBalancerMux.psm1 Added using statement, updated parameter types, replaced feature checks with Confirm-IsLoadBalancerMux, and added conditional certificate distribution
src/modules/SdnDiag.Server.psm1 Added using statement, updated parameter types and documentation, and added conditional certificate distribution
src/modules/SdnDiag.Common.psm1 Added using statement and updated parameter types for certificate distribution functions

Comment thread src/modules/SdnDiag.LoadBalancerMux.psm1 Outdated
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@arudell arudell enabled auto-merge (squash) January 20, 2026 17:45
Comment thread src/modules/SdnDiag.Common.psm1 Outdated
@arudell arudell merged commit aea7c90 into main Jan 26, 2026
8 checks passed
@arudell arudell deleted the make-fabricdetails-required branch January 26, 2026 21:46
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.

When using New-SdnMuxCertificate, it fails if FabricDetails not provided

3 participants