fix(agent): widen basic agent config types from Ipv4Addr to IpAddr#360
Open
chet wants to merge 1 commit intoNVIDIA:mainfrom
Open
fix(agent): widen basic agent config types from Ipv4Addr to IpAddr#360chet wants to merge 1 commit intoNVIDIA:mainfrom
chet wants to merge 1 commit intoNVIDIA:mainfrom
Conversation
Still chipping away at [IPv6 support](NVIDIA#84). Work thus far has included: - Moving to `IpNetwork` and `IpAddress` throughout ([NVIDIA#192](NVIDIA#192)). - Accepting IPv6 site prefixes and network segments. ([NVIDIA#204](NVIDIA#204)). - Making the IP allocator family-aware ([NVIDIA#217](NVIDIA#217)). - Making the prefix allocator family-aware ([NVIDIA#237](NVIDIA#237)). - Removing some more API guards and enhancing the `IdentifyAddressFamily` trait ([NVIDIA#324](NVIDIA#324)). - Adding `AAAA` record support to DNS ([NVIDIA#332](NVIDIA#332)). - Backend DHCP plumbing updates ([NVIDIA#335](NVIDIA#335)). - Adding a new `ResourcePoolType::Ipv6` type ([NVIDIA#344](NVIDIA#344)). - Adding a new `ResourcePoolType::Ipv6Prefix` type ([NVIDIA#345](NVIDIA#345)). All of that work has been on the "core" side -- the API, database, allocator, DNS, resource pools, etc. *This* PR is the first in a new series of changes focused on the agent side. The goal is, of course, to have IPv6 support plumbed through the agent, so it can make its way to HBN (via `nvue`) for configuring addresses, routes, ACLs, BGP, etc. Similar to "core" efforts, I'm taking a simple starting point by widening from `Ipv4Addr` to `IpAddr` across some of the more low-hanging agent config structs, CLI argument types, and service address types. Just like previous changes being a noop, this is no different, and the test-verified rendered template output remains the same. Changes included: - `InterfacesConfig.loopback_ip` going from `Ipv4Addr` to `IpAddr`. This only gets used as `conf.loopback_ip.to_string()` to feed templates. - `FrrConfig.loopback_ip` going from `Ipv4Addr` to `IpAddr`. Same thing as above -- only used as `conf.loopback_ip.to_string()` to feed templates. - `loopback_ip` going from `Ipv4Addr` to `IpAddr` in `NvueOptions`, `FrrOptions`, and `InterfacesOptions`. Since these are all parsed via `IpAddr::from_str`, they continued to work as-is. - `ServiceAddresses.pxe_ip` going from `Ipv4Addr` to `IpAddr`. Despite the field name, this is the UEFI HTTP boot server address, which would carry over to DHCPv6 just fine. - `ServiceAddresses.ntpservers` going from `Vec<Ipv4Addr>` to `Vec<IpAddr>`. NTP servers are still a DHCPv6 "feature". - At the `dhcp::build_server_config()` call site, added IPv4 filtering for `pxe_ip`, `ntpservers`, and `nameservers` (which was already filtered) before passing to the DHCPv4 config builder. `ServiceAddresses` now holds both families, but DHCPv4 options can only carry IPv4 addresses. - Left comments on things that are intentionally staying IPv4 for now -- the `DhcpOptions` CLI struct (DHCPv4-specific), and the internal HBN bridge prefix parsing (`169.254.x.x` link-local plumbing, though an IPv6 equivalent may be needed in the future). The existing tests (including `test_write_frr`) continue to pass, rendering templates as expected. IPv6 templates are NOT being introduced here yet -- for now, the important bit is widening types to `IpAddr` and making sure it continues to work as a drop-in with IPv4 Signed-off-by: Chet Nichols III <chetn@nvidia.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Still chipping away at IPv6 support.
Work thus far has included:
IpNetworkandIpAddressthroughout (#192).IdentifyAddressFamilytrait (#324).AAAArecord support to DNS (#332).ResourcePoolType::Ipv6type (#344).ResourcePoolType::Ipv6Prefixtype (#345).All of that work has been on the "core" side -- the API, database, allocator, DNS, resource pools, etc. This PR is the first in a new series of changes focused on the agent side. The goal is, of course, to have IPv6 support plumbed through the agent, so it can make its way to HBN (via
nvue) for configuring addresses, routes, ACLs, BGP, etc.Similar to "core" efforts, I'm taking a simple starting point by widening from
Ipv4AddrtoIpAddracross some of the more low-hanging agent config structs, CLI argument types, and service address types. Just like previous changes being a noop, this is no different, and the test-verified rendered template output remains the same.Changes included:
InterfacesConfig.loopback_ipgoing fromIpv4AddrtoIpAddr. This only gets used asconf.loopback_ip.to_string()to feed templates.FrrConfig.loopback_ipgoing fromIpv4AddrtoIpAddr. Same thing as above -- only used asconf.loopback_ip.to_string()to feed templates.loopback_ipgoing fromIpv4AddrtoIpAddrinNvueOptions,FrrOptions, andInterfacesOptions. Since these are all parsed viaIpAddr::from_str, they continued to work as-is.ServiceAddresses.pxe_ipgoing fromIpv4AddrtoIpAddr. Despite the field name, this is the UEFI HTTP boot server address, which would carry over to DHCPv6 just fine.ServiceAddresses.ntpserversgoing fromVec<Ipv4Addr>toVec<IpAddr>. NTP servers are still a DHCPv6 "feature".dhcp::build_server_config()call site, added IPv4 filtering forpxe_ip,ntpservers, andnameservers(which was already filtered) before passing to the DHCPv4 config builder.ServiceAddressesnow holds both families, but DHCPv4 options can only carry IPv4 addresses.DhcpOptionsCLI struct (DHCPv4-specific), and the internal HBN bridge prefix parsing (169.254.x.xlink-local plumbing, though an IPv6 equivalent may be needed in the future).The existing tests (including
test_write_frr) continue to pass, rendering templates as expected. IPv6 templates are NOT being introduced here yet -- for now, the important bit is widening types toIpAddrand making sure it continues to work as a drop-in with IPv4.Signed-off-by: Chet Nichols III chetn@nvidia.com
Type of Change
Related Issues (Optional)
Breaking Changes
Testing
Additional Notes