Skip to content

improvement(offering): make network mode mandatory when creating vpc …#13622

Open
Chinmay048 wants to merge 1 commit into
apache:mainfrom
Chinmay048:fix/13607-validate-network-mode-offerings
Open

improvement(offering): make network mode mandatory when creating vpc …#13622
Chinmay048 wants to merge 1 commit into
apache:mainfrom
Chinmay048:fix/13607-validate-network-mode-offerings

Conversation

@Chinmay048

Copy link
Copy Markdown

Description

This PR resolves an issue where the networkmode parameter (ROUTED vs NATTED) was treated as optional during the creation of VPC and Network Offerings, leading to ambiguous network configurations.

Full-Stack Boundary Enforcement:

  • Frontend (Vue.js / Ant Design): Added reactive validation rules (required: true) in AddVpcOffering.vue and AddNetworkOffering.vue to give administrators immediate visual feedback and prevent form submission if a network mode is not selected.
  • Backend (Java API): Hardened the serialization contract by adding required = true to the @Parameter annotation in CreateVPCOfferingCmd.java and NetworkOfferingBaseCmd.java (which governs creation and cloning operations without impacting updates).

Types of changes

  • Improvement (non-breaking change which enhances UX and API stability)
  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)

Checklist:

  • My code follows the code style of this project.
  • I have read the CONTRIBUTING document.
  • My changes generate no new warnings or checkstyle errors.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

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 aims to eliminate ambiguous VPC/Network Offering configurations by making networkmode (ROUTED vs NATTED) mandatory at both the UI form-validation layer and the Java API parameter layer.

Changes:

  • Added Ant Design Vue form rules to require networkmode selection in the VPC Offering and Network Offering creation UIs.
  • Marked networkmode as required = true in the Java API command parameter annotations for VPC and Network offering creation flows.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
ui/src/views/offering/AddVpcOffering.vue Adds a required validation rule for networkmode in the VPC offering creation form.
ui/src/views/offering/AddNetworkOffering.vue Adds a required validation rule for networkmode in the network offering creation form.
api/src/main/java/org/apache/cloudstack/api/command/admin/vpc/CreateVPCOfferingCmd.java Sets networkmode as required in the API command parameter definition for VPC offering creation (currently impacts clone as well via inheritance).
api/src/main/java/org/apache/cloudstack/api/command/admin/network/NetworkOfferingBaseCmd.java Sets networkmode as required in the shared base command for network offering create/clone (currently impacts clone as well via inheritance).

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

Comment on lines +369 to +370
// ADD THIS LINE:
networkmode: [{ required: true, message: this.$t('message.error.select') }],
Comment on lines +714 to +715
// ADD THIS LINE:
networkmode: [{ required: true, message: this.$t('message.error.select') }],
Comment on lines +147 to 148
@Parameter(name = ApiConstants.NETWORK_MODE, type = CommandType.STRING, required = true, description = "the network mode for the VPC offering")
private String networkMode;
Comment on lines +156 to +157
@Parameter(name = ApiConstants.NETWORK_MODE, type = CommandType.STRING, required = true, description = "the network mode for the network offering")
private String networkMode;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants