Conversation
There was a problem hiding this comment.
Hey - I've found 1 issue
Prompt for AI Agents
Please address the comments from this code review:
## Individual Comments
### Comment 1
<location path="tests/unit/tasks/conductor/sonic/test_config_generator_bgp_vlan_vrf.py" line_range="758-772" />
<code_context>
+# ---------------------------------------------------------------------------
+
+
+@pytest.fixture
+def vrf_config():
+ return {
+ "VRF": {},
+ "VLAN": {},
+ "VLAN_INTERFACE": {},
+ "BGP_GLOBALS_AF": {},
+ "BGP_GLOBALS_ROUTE_ADVERTISE": {},
+ "BGP_GLOBALS": {},
+ "VXLAN_TUNNEL": {},
+ "VXLAN_EVPN_NVO": {},
+ "VXLAN_TUNNEL_MAP": {},
+ "INTERFACE": {},
+ "PORTCHANNEL_INTERFACE": {},
+ }
+
</code_context>
<issue_to_address>
**suggestion (testing):** Initialize ROUTE_REDISTRIBUTE in vrf_config fixture to make the intent explicit
`TestAddVrfConfiguration.test_vrf_with_vni_full_config` asserts that `"vrfStorage|connected|bgp|ipv4" in vrf_config["ROUTE_REDISTRIBUTE"]`, but the fixture doesn’t define `"ROUTE_REDISTRIBUTE"`. The test currently depends on `_add_vrf_configuration` to create this key. Initializing `"ROUTE_REDISTRIBUTE": {}` in the `vrf_config` fixture would make the test more explicit and its failures less dependent on implementation side effects.
```suggestion
@pytest.fixture
def vrf_config():
return {
"VRF": {},
"VLAN": {},
"VLAN_INTERFACE": {},
"BGP_GLOBALS_AF": {},
"BGP_GLOBALS_ROUTE_ADVERTISE": {},
"BGP_GLOBALS": {},
"VXLAN_TUNNEL": {},
"VXLAN_EVPN_NVO": {},
"VXLAN_TUNNEL_MAP": {},
"INTERFACE": {},
"PORTCHANNEL_INTERFACE": {},
"ROUTE_REDISTRIBUTE": {},
}
```
</issue_to_address>Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.
e4ca3a2 to
8aa1b24
Compare
Cover the BGP, VLAN, Loopback and VRF helpers in osism/tasks/conductor/sonic/config_generator.py: - _add_bgp_configurations: BGP_NEIGHBOR_AF and BGP_NEIGHBOR for connected interfaces and port channels, plus VLAN-SVI BGP (untagged-member, transfer-role, switch-to-switch / l2vpn_evpn, non-default VRF and dedup branches) - _get_connected_device_for_interface delegation - _determine_peer_type AS comparison and error handling - _add_vlan_configuration members / VLAN_MEMBER / SVI - _add_loopback_configuration including Loopback0 BGP_GLOBALS_AF_NETWORK - _get_vrf_info naming conventions and error paths - _add_vrf_configuration VNI/table_id/VXLAN/interface assignment Closes #2223 AI-assisted: Claude Code Signed-off-by: Christian Berendt <berendt@osism.tech>
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.
Closes #2223.
Adds
tests/unit/tasks/conductor/sonic/test_config_generator_bgp_vlan_vrf.pycovering the BGP, VLAN, Loopback and VRF helpers inosism/tasks/conductor/sonic/config_generator.py.Coverage
_add_bgp_configurations—BGP_NEIGHBOR_AF/BGP_NEIGHBORfor connected interfaces and port channels, plus VLAN-SVI BGP: untagged-member exclusion, direct vs. transfer-role IPv4, switch-to-switch /l2vpn_evpntag handling, non-default VRF, peer-IP local-addr resolution and peer-IP dedup_get_connected_device_for_interface— delegation_determine_peer_type— AS-mapping vs. computed ASN, missingprimary_ip4, and exception handling_add_vlan_configuration— members /VLAN_MEMBER/ SVI, unmapped-member warning_add_loopback_configuration—Loopback0BGP_GLOBALS_AF_NETWORK(v4/v6), invalid-IP path_get_vrf_info— both naming conventions, per-interface and top-level error paths_add_vrf_configuration— VNI/table_id/neither,BGP_GLOBALSdeep copy, VXLAN sections, interface/port-channel VRF assignmentNotes
_add_vlan_configurationdoes not actually sortmembersby SONiC name (the issue text says it does); tests assert the real behaviour via an order-independent comparison.loguru_logsfixture.Checks
flake8,python-blackgreen locallymypyruns as a separate Zuul job; the file follows the annotation-freeSimpleNamespacestyle of the existing, CI-green SONiC test filespytestleft to thepython-osism-unit-testsZuul job🤖 Generated with Claude Code