-
Notifications
You must be signed in to change notification settings - Fork 39
Feature: add proxmox_node_network and proxmox_node_network_info modules #153
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
base: main
Are you sure you want to change the base?
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #153 +/- ##
==========================================
+ Coverage 64.42% 68.19% +3.76%
==========================================
Files 64 68 +4
Lines 6530 7870 +1340
Branches 1257 1639 +382
==========================================
+ Hits 4207 5367 +1160
- Misses 2147 2271 +124
- Partials 176 232 +56 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
e566edd
to
5260015
Compare
@gyptazy Would you have time to review this? I'm not well-versed enough in Python to review this :-( |
Will do but can't promise to do it this weekend. Probably on Monday. |
"""Validate IPv4 CIDR format.""" | ||
if not cidr: | ||
return False | ||
pattern = r"^(\d{1,3}\.){3}\d{1,3}/\d{1,2}$" |
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.
Kudos for validating! But in that case we should probably to a more strict validating like:
_cidr_re = re.compile(
r'^(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.'
r'(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.'
r'(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)\.'
r'(25[0-5]|2[0-4]\d|1\d{2}|[1-9]?\d)'
r'/(3[0-2]|[12]?\d)$'
)
Maybe this is the point, where we should simply use libs like ipaddress
instead of reinventing the wheel.
"""Validate IPv6 CIDR format.""" | ||
if not cidr: | ||
return False | ||
pattern = r"^[0-9a-fA-F:]+/\d{1,3}$" |
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.
That might not be strict enough. Maybe this fits better:
r'^([0-9A-Fa-f:]+::?[0-9A-Fa-f:]*)/(12[0-8]|1[01][0-9]|[0-9]{1,2})$'
Also here, maybe better to use an external lib like ipaddress
; even I'd like to avoid it.
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.
And since ipaddress
is part of the standard library, using it would outsource complexity and not include major (installation) overhead. :)
Out of curiosity: Why would you like avoid including this library otherwise?
Hey @aleskxyz, that's well written and structured - appreciate your work! There're just some smaller things that're not yet important (but might need some changes in future releases) but it doesn't make sense or brings any huge benefits to adjust this right now. I didn't give OVS a try but apart from that it looks good to me. Just the regex might fail. I mean, it would be a user error but when we already have a validate function, we should do a proper validation (I added a quick idea, could probably also be improved). So far, well done! cc: @Thulium-Drake Cheers, |
e2613f7
to
5260015
Compare
- proxmox_node_network: Manage network interfaces (bridge, bond, eth, vlan, OVS) - proxmox_node_network_info: Retrieve network interface information - Support for staged configuration changes with apply/revert functionality - Full validation for interface-specific parameters - Comprehensive test coverage - Update runtime.yml to include new modules in proxmox action group - Support for parameter deletion
5260015
to
162921a
Compare
Hi @gyptazy |
@aleskxyz Thanks for your work! @gyptazy @IamLunchbox Are you happy with the results? :-) |
Also from me, thanks again for your work and sorry for the delay!
I’m currently abroad and will have a look at it asap. |
SUMMARY
Add comprehensive network interface management capabilities to the Proxmox collection with two new modules:
proxmox_node_network
for managing network interfaces andproxmox_node_network_info
for retrieving network interface information. These modules support all major Proxmox network interface types including bridges, bonds, VLANs, and Open vSwitch interfaces with staged configuration management to prevent accidental network disruption.ISSUE TYPE
COMPONENT NAME
proxmox_node_network, proxmox_node_network_info
ADDITIONAL INFORMATION
New Modules Added:
proxmox_node_network
: Manage network interfaces (bridge, bond, eth, vlan, OVS)proxmox_node_network_info
: Retrieve network interface informationKey Features: