-
Notifications
You must be signed in to change notification settings - Fork 1.2k
UI: Add validator for CIDR being passed #11465
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #11465 +/- ##
============================================
+ Coverage 17.35% 18.06% +0.70%
- Complexity 15230 16883 +1653
============================================
Files 5886 5900 +14
Lines 525685 563597 +37912
Branches 64159 79424 +15265
============================================
+ Hits 91247 101791 +10544
- Misses 424138 450712 +26574
- Partials 10300 11094 +794
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
|
@Pearl1594 , can you have a look? |
|
|
@shwstppr a Jenkins job has been kicked to build UI QA env. I'll keep you posted as I make progress. |
|
UI build: ✔️ |
shwstppr
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Tested on QA server
|
@blueorangutan package |
|
@rosi-shapeblue a [SL] Jenkins job has been kicked to build packages. It will be bundled with KVM, XenServer and VMware SystemVM templates. I'll keep you posted as I make progress. |
|
Packaging result [SF]: ✔️ el8 ✔️ el9 ✔️ el10 ✔️ debian ✔️ suse15. SL-JID 15421 |
There was a problem hiding this 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 adds CIDR format validation for the VPC creation form to prevent invalid CIDR values from being submitted. The validation ensures proper IPv4 CIDR format and valid octet ranges (0-255).
Key Changes:
- Added a new
isValidIPv4Cidrvalidator function that validates CIDR format and IP octet ranges - Integrated the validator into the VPC creation form's validation rules
Reviewed Changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| ui/src/utils/util.js | Implements the isValidIPv4Cidr validator function with regex pattern matching and octet validation |
| ui/src/views/network/CreateVpc.vue | Imports and applies the CIDR validator to the form's validation rules |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
vishesh92
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm. did some testing with different inputs and it seems to be working as expected.
rosi-shapeblue
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. The CIDR validator works as expected
UI Test Results:
Screencast.from.2025-10-13.09-48-11.webm
API Test Results:
(localcloud) 🐱 > list vpcs
{
"count": 2,
"vpc": [
{
"account": "admin",
"cidr": "10.10.10.10/24",
"created": "2025-10-13T07:01:44+0000",
"displaytext": "TestVPC",
"distributedvpcrouter": false,
"domain": "ROOT",
"domainid": "797d5086-a795-11f0-8a1f-1e0082000199",
"domainpath": "ROOT",
"fordisplay": true,
"hasannotations": false,
"id": "55231568-6c61-4f36-8977-c4c56d7af900",
"name": "TestVPC",
"network": [],
"networkdomain": "cs2cloud.internal",
"publicmtu": 1500,
"redundantvpcrouter": false,
"regionlevelvpc": false,
"restartrequired": false,
"service": [
{
"name": "Vpn",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "Lb",
"provider": [
{
"name": "VpcVirtualRouter"
},
{
"name": "InternalLbVm"
}
]
},
{
"name": "UserData",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "Dhcp",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "PortForwarding",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "NetworkACL",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "StaticNat",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "Dns",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "SourceNat",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
}
],
"state": "Enabled",
"tags": [],
"vpcofferingid": "7bb6732a-8e44-4576-8815-dcdd350bcbad",
"vpcofferingname": "Default VPC offering",
"zoneid": "fb812556-cf86-4a36-899f-0611e17ae8e7",
"zonename": "ref-trl-9661-k-Mol8-rositsa-kyuchukova"
},
{
"account": "admin",
"cidr": "10.0.0.0/16",
"created": "2025-10-13T06:48:31+0000",
"displaytext": "test",
"distributedvpcrouter": false,
"domain": "ROOT",
"domainid": "797d5086-a795-11f0-8a1f-1e0082000199",
"domainpath": "ROOT",
"fordisplay": true,
"hasannotations": false,
"id": "a537d7f3-1b6a-4880-825e-8db4d8a94d66",
"name": "Test",
"network": [],
"networkdomain": "cs2cloud.internal",
"publicmtu": 1500,
"redundantvpcrouter": false,
"regionlevelvpc": false,
"restartrequired": false,
"service": [
{
"name": "Vpn",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "Lb",
"provider": [
{
"name": "VpcVirtualRouter"
},
{
"name": "InternalLbVm"
}
]
},
{
"name": "UserData",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "Dhcp",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "PortForwarding",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "NetworkACL",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "StaticNat",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "Dns",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
},
{
"name": "SourceNat",
"provider": [
{
"name": "VpcVirtualRouter"
}
]
}
],
"state": "Enabled",
"tags": [],
"vpcofferingid": "7bb6732a-8e44-4576-8815-dcdd350bcbad",
"vpcofferingname": "Default VPC offering",
"zoneid": "fb812556-cf86-4a36-899f-0611e17ae8e7",
"zonename": "ref-trl-9661-k-Mol8-rositsa-kyuchukova"
}
]
}



Description
This PR fixes: #11405
Types of changes
Feature/Enhancement Scale or Bug Severity
Feature/Enhancement Scale
Screenshots (if appropriate):
How Has This Been Tested?
How did you try to break this feature and the system with this change?