Skip to content

Redistribute static + IPv6 routes#2279

Open
fzakfeld wants to merge 1 commit into
mainfrom
distribute-static-routes
Open

Redistribute static + IPv6 routes#2279
fzakfeld wants to merge 1 commit into
mainfrom
distribute-static-routes

Conversation

@fzakfeld
Copy link
Copy Markdown
Contributor

No description provided.

@fzakfeld fzakfeld requested a review from osfrickler May 18, 2026 16:35
@berendt berendt requested a review from ideaship May 18, 2026 16:36
@fzakfeld fzakfeld force-pushed the distribute-static-routes branch from 2d7241e to 60565e6 Compare May 18, 2026 16:36
Copy link
Copy Markdown

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 1 issue, and left some high level feedback:

  • 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.
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>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment thread osism/tasks/conductor/sonic/config_generator.py Outdated
Signed-off-by: Freerk-Ole Zakfeld <fzakfeld@scaleuptech.com>
@fzakfeld fzakfeld force-pushed the distribute-static-routes branch from 60565e6 to bd1d549 Compare May 18, 2026 16:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Ready

Development

Successfully merging this pull request may close these issues.

2 participants