feat(device-discovery): vrf discovery for huawei_vrp, hp_comware, cumulus_linux, dell_sonic#454
Merged
Merged
Conversation
…ulus_linux, dell_sonic Second custom-driver batch implementing get_network_instances(): - huawei_vrp: names and member interfaces from "display ip vpn-instance interface" (ntc-template); route distinguishers from a driver-local scan of the summary — the summary ntc-template requires an RD on every row and error-exits on instances without one. - hp_comware: instances from "display ip vpn-instance" (ntc-template, tolerates RD-less rows); RD and member interfaces from one "display ip vpn-instance instance-name <name>" per instance, parsed driver-locally — the detail ntc-template error-exits on routine output lines it doesn't enumerate. - cumulus_linux: VRF devices from "ip vrf show" (linux ntc-template); members from one "ip link show master <vrf>" per VRF with kernel @parent decorations stripped to match get_interfaces() naming. Linux VRFs carry no kernel-level RD. - dell_sonic: driver-local parse of "show vrf" (continuation rows and comma-separated member cells tolerated); the mgmt VRF is kept as a real VRF. SONiC's show vrf carries no RD. All four emit the NAPALM OpenConfig shape, seed a DEFAULT_INSTANCE with empty membership, honor the name filter, and guard rows named "default" from overwriting the seeded entry. Eight fixture scenarios plus the driver-pin matrix extended to thirteen drivers. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…driver guide Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Coverage Report
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
Contributor
There was a problem hiding this comment.
Pull request overview
Implements VRF discovery for four additional custom NAPALM drivers by adding get_network_instances() implementations that return the OpenConfig network-instances shape consumed by options.discover_vrfs, along with fixtures, dispatch-matrix pinning, and contributor documentation updates.
Changes:
- Add
get_network_instances()tohuawei_vrp,hp_comware,cumulus_linux, anddell_soniccustom drivers with platform-specific parsing/guarding. - Extend VRF-dispatch ownership pin matrix to include the four new drivers.
- Add/extend
test_get_network_instancesfixture scenarios for the four drivers and document the expected getter shape + conventions incustom_napalm/CLAUDE.md.
Reviewed changes
Copilot reviewed 31 out of 31 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| device-discovery/tests/test_runner_vrf_dispatch.py | Pins VRF discovery support matrix to include the four added custom drivers. |
| device-discovery/custom_napalm/huawei_vrp.py | Adds VRP VPN-instance → OC network-instances VRF discovery (summary RD regex + interface membership via ntc-template). |
| device-discovery/custom_napalm/hp_comware.py | Adds Comware VPN-instance → OC network-instances VRF discovery (detail parsed driver-locally for RD + interfaces). |
| device-discovery/custom_napalm/cumulus_linux.py | Adds Linux VRF device → OC network-instances discovery via ip vrf show + ip link show master. |
| device-discovery/custom_napalm/dell_sonic.py | Adds SONiC VRF discovery via show vrf, including CLI error-banner guarding and continuation-row parsing. |
| device-discovery/custom_napalm/CLAUDE.md | Documents get_network_instances() output shape, conventions, and validation checklist updates. |
| device-discovery/tests/custom_drivers/huawei_vrp/mock_data/test_get_network_instances/normal/expected_result.json | Adds VRP normal-case expected get_network_instances() payload. |
| device-discovery/tests/custom_drivers/huawei_vrp/mock_data/test_get_network_instances/normal/display_ip_vpn-instance.txt | Adds VRP summary command fixture (normal scenario). |
| device-discovery/tests/custom_drivers/huawei_vrp/mock_data/test_get_network_instances/normal/display_ip_vpn-instance_interface.txt | Adds VRP interface-membership command fixture (normal scenario). |
| device-discovery/tests/custom_drivers/huawei_vrp/mock_data/test_get_network_instances/no_instances/expected_result.json | Adds VRP empty/no-instances expected payload. |
| device-discovery/tests/custom_drivers/huawei_vrp/mock_data/test_get_network_instances/af_column_variant/expected_result.json | Adds VRP AF-column variant expected payload. |
| device-discovery/tests/custom_drivers/huawei_vrp/mock_data/test_get_network_instances/af_column_variant/display_ip_vpn-instance.txt | Adds VRP AF-column variant summary fixture. |
| device-discovery/tests/custom_drivers/huawei_vrp/mock_data/test_get_network_instances/af_column_variant/display_ip_vpn-instance_interface.txt | Adds VRP AF-column variant interface-membership fixture. |
| device-discovery/tests/custom_drivers/hp_comware/mock_data/test_get_network_instances/normal/expected_result.json | Adds Comware normal-case expected payload. |
| device-discovery/tests/custom_drivers/hp_comware/mock_data/test_get_network_instances/normal/display_ip_vpn-instance.txt | Adds Comware summary fixture (normal scenario). |
| device-discovery/tests/custom_drivers/hp_comware/mock_data/test_get_network_instances/normal/display_ip_vpn-instance_instance-name_cust-a.txt | Adds Comware per-instance detail fixture (cust-a). |
| device-discovery/tests/custom_drivers/hp_comware/mock_data/test_get_network_instances/normal/display_ip_vpn-instance_instance-name_mgmt-vpn.txt | Adds Comware per-instance detail fixture (mgmt-vpn). |
| device-discovery/tests/custom_drivers/hp_comware/mock_data/test_get_network_instances/no_instances/expected_result.json | Adds Comware empty/no-instances expected payload. |
| device-discovery/tests/custom_drivers/hp_comware/mock_data/test_get_network_instances/multi_member_wrap/expected_result.json | Adds Comware wrapped multi-member list expected payload. |
| device-discovery/tests/custom_drivers/hp_comware/mock_data/test_get_network_instances/multi_member_wrap/display_ip_vpn-instance.txt | Adds Comware summary fixture (wrap scenario). |
| device-discovery/tests/custom_drivers/hp_comware/mock_data/test_get_network_instances/multi_member_wrap/display_ip_vpn-instance_instance-name_wrap-vpn.txt | Adds Comware per-instance wrapped interface-list detail fixture. |
| device-discovery/tests/custom_drivers/cumulus_linux/mock_data/test_get_network_instances/normal/expected_result.json | Adds Cumulus normal-case expected payload. |
| device-discovery/tests/custom_drivers/cumulus_linux/mock_data/test_get_network_instances/normal/ip_vrf_show.txt | Adds ip vrf show fixture. |
| device-discovery/tests/custom_drivers/cumulus_linux/mock_data/test_get_network_instances/normal/ip_link_show_master_red.txt | Adds ip link show master red fixture. |
| device-discovery/tests/custom_drivers/cumulus_linux/mock_data/test_get_network_instances/normal/ip_link_show_master_mgmt.txt | Adds ip link show master mgmt fixture. |
| device-discovery/tests/custom_drivers/cumulus_linux/mock_data/test_get_network_instances/no_vrfs/expected_result.json | Adds Cumulus empty/no-VRFs expected payload. |
| device-discovery/tests/custom_drivers/dell_sonic/mock_data/test_get_network_instances/normal/expected_result.json | Adds SONiC normal-case expected payload. |
| device-discovery/tests/custom_drivers/dell_sonic/mock_data/test_get_network_instances/normal/show_vrf.txt | Adds SONiC show vrf fixture (normal scenario). |
| device-discovery/tests/custom_drivers/dell_sonic/mock_data/test_get_network_instances/no_vrfs/expected_result.json | Adds SONiC empty/no-VRFs expected payload. |
| device-discovery/tests/custom_drivers/dell_sonic/mock_data/test_get_network_instances/unsupported_command/expected_result.json | Adds SONiC unsupported-command expected payload (guard behavior). |
| device-discovery/tests/custom_drivers/dell_sonic/mock_data/test_get_network_instances/unsupported_command/show_vrf.txt | Adds SONiC unsupported show vrf error-banner fixture. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
mfiedorowicz
approved these changes
Jun 11, 2026
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.
Summary
Second custom-driver batch implementing
get_network_instances()for VRF discovery (follows #452 / #453). All four return the NAPALM OpenConfig network-instances shape consumed byoptions.discover_vrfs.Per driver
huawei_vrpdisplay ip vpn-instance interface(ntc-template) + summaryipv4-familyon some releases and plainIPv4/IPv6on others (the ntc real-device fixture uses the latter); both anchor the row, and per-AF rows merge keeping the first non-empty RD.hp_comwaredisplay ip vpn-instance(ntc-template) + per-instance detailcumulus_linuxip vrf show(linux ntc-template) + per-VRFip link show master@parentdecorations stripped to matchget_interfaces()naming. Linux VRFs carry no kernel-level RD (it lives in FRR BGP) — always emitted absent.dell_sonicshow vrf, driver-local parseVrfall handled.mgmtis kept as a real VRF.Common semantics (matching batches 1): seeded DEFAULT_INSTANCE with empty membership, rows named
defaultcan never overwrite the seed, NAPALMnamefilter honored on every path, member names match each driver's ownget_interfaces()/get_interfaces_ip()naming so VRF→IP attachment joins correctly.Also documents
get_network_instancesin the custom-driver guide (custom_napalm/CLAUDE.md): output shape, the six batch conventions, and a validation-checklist entry.Tests
IPv4AF column, SONiC error banner, comware multi-member wrap)Review trail
Two adversarial Claude review rounds: round 1 found two verified majors (huawei RD regex missing the plain-
IPv4AF column form seen in ntc-templates' own real-device fixture; SONiC error banner ingested as a VRF named%) plus two minors — all fixed with pinning fixtures; round 2: APPROVED.🤖 Generated with Claude Code