Redistribute static + IPv6 routes#2279
Open
fzakfeld wants to merge 1 commit into
Open
Conversation
2d7241e to
60565e6
Compare
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- The
_evpn_system_macand_sag_gwmacvalues are only checked for truthiness/type; consider validating them against a proper MAC address format so bad config_context data fails fast and predictably. - In
_add_vlan_configuration,SAG_GLOBAL['IP']enables both IPv4 and IPv6 unconditionally; if a device only has anycast addresses for a single address family, you might want to derive which families to enable from the collectedipv4_anycast/ipv6_anycastlists instead of always enabling both.
Prompt for AI Agents
Please address the comments from this code review:
## Overall Comments
- The `_evpn_system_mac` and `_sag_gwmac` values are only checked for truthiness/type; consider validating them against a proper MAC address format so bad config_context data fails fast and predictably.
- In `_add_vlan_configuration`, `SAG_GLOBAL['IP']` enables both IPv4 and IPv6 unconditionally; if a device only has anycast addresses for a single address family, you might want to derive which families to enable from the collected `ipv4_anycast` / `ipv6_anycast` lists instead of always enabling both.
## Individual Comments
### Comment 1
<location path="osism/tasks/conductor/sonic/config_generator.py" line_range="2154" />
<code_context>
"min_links": pc_data["min_links"],
"mtu": pc_data["mtu"],
}
+ if pc_data.get("evpn_lag") and evpn_system_mac:
+ pc_config["system_mac"] = evpn_system_mac
+ config["PORTCHANNEL"][pc_name] = pc_config
</code_context>
<issue_to_address>
**suggestion:** EVPN LAG tag without evpn_system_mac is silently ignored, which may be hard to debug.
Here we only set `system_mac` when `evpn_lag` is true *and* `evpn_system_mac` is valid. If a port channel is tagged as EVPN LAG but `evpn_system_mac` is missing or invalid, the tag has no effect and the `system_mac` is silently omitted. Consider logging or warning when `pc_data.get("evpn_lag")` is true but `evpn_system_mac` is falsy to surface misconfigurations.
Suggested implementation:
```python
if pc_data.get("evpn_lag") and evpn_system_mac:
pc_config["system_mac"] = evpn_system_mac
elif pc_data.get("evpn_lag") and not evpn_system_mac:
logger.warning(
"Port-channel '%s' is tagged as EVPN LAG but no valid evpn_system_mac is set; "
"EVPN LAG configuration will be ignored for this port-channel.",
pc_name,
)
config["PORTCHANNEL"][pc_name] = pc_config
```
1. Ensure that a `logger` object is available in this module. If it is not already defined, add at the top of `config_generator.py`:
- `import logging`
- `logger = logging.getLogger(__name__)`
2. If the project convention uses a different logger name (e.g. `LOG` or `log`), or a shared logger utility, adjust the `logger.warning(...)` call accordingly to match existing patterns.
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
Signed-off-by: Freerk-Ole Zakfeld <fzakfeld@scaleuptech.com>
60565e6 to
bd1d549
Compare
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.
No description provided.