NSX: configure segment discovery and security profiles - #13791
Conversation
dc7d4bc to
d94fafd
Compare
Codecov Report✅ All modified and coverable lines are covered by tests.
Additional details and impacted files@@ Coverage Diff @@
## main #13791 +/- ##
=============================================
- Coverage 19.65% 3.41% -16.24%
=============================================
Files 6368 487 -5881
Lines 574881 41882 -532999
Branches 70351 7918 -62433
=============================================
- Hits 112970 1429 -111541
+ Misses 449639 40253 -409386
+ Partials 12272 200 -12072
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Warning
Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.
This PR adds support for configuring NSX segment discovery/security profiles via network offering details, validates these settings server-side, passes the selected profile IDs through the agent command path, and updates UI/i18n and unit tests accordingly.
Changes:
- Expose NSX profile ID fields (IP discovery, MAC discovery, segment security) in Add/Clone Network Offering UI and persist them via offering details.
- Validate NSX profile detail constraints (NSX-only, non-blank, no surrounding whitespace, max length) and prevent offering upgrades when profile bindings differ.
- Extend NSX segment creation to resolve/validate profile paths and bind profiles in the same hierarchical Infra request; add targeted unit tests.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| ui/src/views/offering/CloneNetworkOffering.vue | Adds NSX profile input fields and submits them as offering details during clone. |
| ui/src/views/offering/AddNetworkOffering.vue | Adds NSX profile input fields and includes them in the details key set for submission. |
| ui/public/locales/en.json | Adds labels/tooltips for the new NSX profile fields. |
| server/src/test/java/com/cloud/network/NetworkServiceImplTest.java | Adds tests for offering-upgrade behavior based on NSX profile bindings. |
| server/src/test/java/com/cloud/configuration/ConfigurationManagerImplTest.java | Adds tests for NSX profile detail validation rules. |
| server/src/main/java/com/cloud/network/NetworkServiceImpl.java | Rejects offering upgrades when NSX segment profile bindings differ. |
| server/src/main/java/com/cloud/configuration/ConfigurationManagerImpl.java | Validates NSX segment profile details (NSX-only + formatting/length rules). |
| plugins/network-elements/nsx/src/test/java/org/apache/cloudstack/service/NsxGuestNetworkGuruTest.java | Verifies profile IDs from offering details are passed into CreateNsxSegmentCommand. |
| plugins/network-elements/nsx/src/test/java/org/apache/cloudstack/service/NsxApiClientTest.java | Adds tests for binding behavior, validation failures, and “no profiles” behavior. |
| plugins/network-elements/nsx/src/test/java/org/apache/cloudstack/resource/NsxResourceTest.java | Verifies CreateNsxSegmentCommand profile IDs are forwarded to NsxApiClient. |
| plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/utils/NsxHelper.java | Adds overload to build CreateNsxSegmentCommand with optional profile IDs. |
| plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxGuestNetworkGuru.java | Reads offering details and passes profile IDs into segment creation command. |
| plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/service/NsxApiClient.java | Resolves/validates profile paths and issues Infra.patch to create segment + bindings atomically. |
| plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/resource/NsxResource.java | Calls NsxApiClient.createSegment with the profile ID arguments. |
| plugins/network-elements/nsx/src/main/java/org/apache/cloudstack/agent/api/CreateNsxSegmentCommand.java | Adds profile ID fields and constructor overload for segment creation. |
| api/src/main/java/org/apache/cloudstack/api/command/admin/network/NetworkOfferingBaseCmd.java | Documents the new NSX offering detail keys in the API parameter description. |
| api/src/main/java/com/cloud/offering/NetworkOffering.java | Adds new Detail enum values for the NSX profile ID keys. |
| PendingReleaseNotes | Adds release note entry describing NSX offering profile binding behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Summary
This PR adds optional VMware NSX IP Discovery, MAC Discovery, and Segment Security profile bindings to CloudStack network offerings.
The selected profile IDs are stored as network-offering details, exposed through the Add and Clone Network Offering interfaces, propagated through the NSX segment creation command path, and applied when CloudStack creates the corresponding NSX segment.
Behaviour
NsxIpDiscoveryProfileId,NsxMacDiscoveryProfileId, andNsxSegmentSecurityProfileIdnetwork-offering details;Segments.patch(...)behaviour when no profiles are configured;Infra.patch(...)request when profiles are configured;Compatibility and scope
Validation
The branch includes focused unit coverage for:
NotFoundpath for a missing profile;Segments.patch(...)norInfra.patch(...)is called after profile resolution fails;NsxGuestNetworkGuru,CreateNsxSegmentCommand,NsxResource, andNsxApiClient;The current Apache GitHub Actions runs for the fork head are awaiting maintainer approval. No current-head CI pass is claimed until those workflows execute.
Types of changes
How did you try to break this feature?
The negative coverage verifies that CloudStack fails before any NSX segment mutation when:
The compatibility coverage also verifies that omitting every profile preserves the existing segment creation request and that an active network cannot be silently moved to different profile bindings through a network-offering upgrade.