Convert built-in plugins to module names#3575
Open
ipspace wants to merge 1 commit into
Open
Conversation
The built-in plugins are now structured as Python modules (for example, bgp.session plugin is in netsim/extra/bgp/session directory). That change required: * Additional plugin loading code (if the "traditional" plugin cannot be found, we try to load a module). As the 'package:extra' element has been removed from the search path, this should not impact the correct operation. * The device configuration templates are no longer in 'a.b' directory under 'extra' directory but in 'a/b' one. Extra elements with the 'custom_slash_config' variable were added to custom template file names to cope with that * Removal of additional mypy checking of 'plugin.py' files (the were all renamed to '__init__.py') Breaking change: * The 'proxy-arp' plugin has been renamed to 'proxy_arp'.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR migrates built-in “extra” plugins from standalone plugin.py files into importable Python packages under netsim/extra/..., updates plugin loading to support module imports (including redirects), and adjusts custom template lookup so plugin-owned templates can live in nested module directories.
Changes:
- Extend plugin loader to fall back from filesystem plugin discovery to
import netsim.extra.<plugin>module loading, including support for module redirects and module-localdefaults.yml. - Add
custom_slash_configtemplate variable + additional custom template filename patterns to supporta.bplugin names mapping toa/bdirectories. - Rename/reshape multiple built-in plugins and add new templates/defaults files across
netsim/extra/**; remove redundant mypy checks forplugin.pyfiles in CI/scripts.
Reviewed changes
Copilot reviewed 8 out of 108 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/topology/input/ebgp.utils.yml | Update plugin list to use ebgp.utils (redirecting to bgp.session). |
| tests/run-typing.sh | Remove per-file mypy checks for netsim/extra/*.*/*.py. |
| tests/run-tests.sh | Remove mypy loop over netsim/extra/*/plugin.py and adjust shell structure. |
| netsim/utils/templates.py | Add custom_slash_config for dot-to-slash template lookups. |
| netsim/extra/vrrp/version/dellos10.j2 | Add VRRP version template for Dell OS10. |
| netsim/extra/vrrp/version/defaults.yml | Add vrrp.version attribute schema and feature flags. |
| netsim/extra/vrrp/version/cumulus_nvue.j2 | Add NVUE VRRP version rendering. |
| netsim/extra/vrrp/version/init.py | Implement vrrp.version plugin module. |
| netsim/extra/tunnel/gre/ios.j2 | Add IOS GRE tunnel template. |
| netsim/extra/tunnel/gre/frr.j2 | Add FRR/host GRE tunnel provisioning script template. |
| netsim/extra/tunnel/gre/defaults.yml | Add GRE tunnel attribute schema and provider kmods. |
| netsim/extra/tunnel/gre/init.py | Implement tunnel.gre plugin module. |
| netsim/extra/test/vrf_check/init.py | Add test helper plugin to drop VRF features/tests on unsupported devices. |
| netsim/extra/test/fixup/init.py | Add test helper plugin to apply device-specific fixups to topology data. |
| netsim/extra/proxy_arp/sros.j2 | Add proxy ARP/ND template for SR OS MD-CLI. |
| netsim/extra/proxy_arp/srlinux.j2 | Add proxy ARP/ND template for SR Linux. |
| netsim/extra/proxy_arp/init.py | Add proxy_arp plugin module (renamed from proxy-arp). |
| netsim/extra/ospf/areas/srlinux.j2 | Add SR Linux OSPF area parameters template. |
| netsim/extra/ospf/areas/junos.j2 | Add Junos OSPF area parameters template. |
| netsim/extra/ospf/areas/ios.j2 | Add IOS OSPF area parameters template. |
| netsim/extra/ospf/areas/frr.j2 | Add FRR OSPF area parameters template. |
| netsim/extra/ospf/areas/eos.j2 | Add EOS OSPF area parameters template. |
| netsim/extra/ospf/areas/dellos10.j2 | Add Dell OS10 OSPF area parameters template. |
| netsim/extra/ospf/areas/defaults.yml | Add ospf.areas attribute schema and defaults. |
| netsim/extra/ospf/areas/cumulus_nvue.j2 | Add NVUE OSPF area parameters template. |
| netsim/extra/ospf/areas/bird.j2 | Add placeholder for BIRD (handled elsewhere). |
| netsim/extra/ospf/areas/arubacx.j2 | Add ArubaCX OSPF area parameters template. |
| netsim/extra/ospf/areas/init.py | Implement ospf.areas plugin module (normalize/merge/prune/support checks). |
| netsim/extra/node/clone/defaults.yml | Add node.clone plugin defaults (name pattern). |
| netsim/extra/node/clone/init.py | Implement node.clone topology expansion plugin module. |
| netsim/extra/mlag/vtep/defaults.yml | Add mlag.vtep defaults and feature flags. |
| netsim/extra/mlag/vtep/init.py | Implement mlag.vtep plugin module (shared VTEP loopback). |
| netsim/extra/kind/init.py | Add kind plugin module for expanding “kind” nodes into cluster nodes/links. |
| netsim/extra/firewall/zonebased/vyos.j2 | Add VyOS zone-based firewall template. |
| netsim/extra/firewall/zonebased/vsrx.j2 | Add vSRX zone-based firewall template. |
| netsim/extra/firewall/zonebased/fortios.j2 | Add placeholder FortiOS zone-based firewall template. |
| netsim/extra/firewall/zonebased/deploy.fortios.yml | Add FortiOS deployment playbook for zone-based firewall. |
| netsim/extra/firewall/zonebased/defaults.yml | Add firewall zone-based schema and device feature flags. |
| netsim/extra/firewall/zonebased/init.py | Implement firewall.zonebased plugin module. |
| netsim/extra/files/init.py | Add files plugin module to normalize configlets/files and create outputs safely. |
| netsim/extra/fabric/init.py | Add fabric topology expansion plugin module. |
| netsim/extra/evpn/multihoming/vjunos-switch.j2 | Add vJunos-switch EVPN multihoming template. |
| netsim/extra/evpn/multihoming/frr.j2 | Add FRR EVPN multihoming script (marked WIP). |
| netsim/extra/evpn/multihoming/eos.j2 | Add EOS EVPN multihoming template. |
| netsim/extra/evpn/multihoming/defaults.yml | Add EVPN multihoming schema and device feature flags. |
| netsim/extra/evpn/multihoming/cumulus_nvue.j2 | Add NVUE EVPN multihoming template. |
| netsim/extra/evpn/multihoming/init.py | Implement evpn.multihoming plugin module (ESI generation/validation/warnings). |
| netsim/extra/ebgp/utils/init.py | Add redirect module ebgp.utils → bgp.session. |
| netsim/extra/ebgp/multihop/sros.j2 | Add SR OS EBGP multihop template. |
| netsim/extra/ebgp/multihop/srlinux.j2 | Add SR Linux EBGP multihop template. |
| netsim/extra/ebgp/multihop/junos.j2 | Add Junos EBGP multihop template. |
| netsim/extra/ebgp/multihop/iosxr.j2 | Add IOS XR EBGP multihop template. |
| netsim/extra/ebgp/multihop/ios.j2 | Add IOS EBGP multihop template. |
| netsim/extra/ebgp/multihop/frr.j2 | Add FRR EBGP multihop template. |
| netsim/extra/ebgp/multihop/eos.j2 | Add EOS EBGP multihop template. |
| netsim/extra/ebgp/multihop/ebgp-multihop-load-balancing.yml | Add sample topology for EBGP multihop load balancing. |
| netsim/extra/ebgp/multihop/dellos10.j2 | Add Dell OS10 EBGP multihop template. |
| netsim/extra/ebgp/multihop/defaults.yml | Add EBGP multihop schema defaults. |
| netsim/extra/ebgp/multihop/cumulus.j2 | Add Cumulus include wrapper for FRR template. |
| netsim/extra/ebgp/multihop/cumulus_nvue.j2 | Add NVUE EBGP multihop template. |
| netsim/extra/ebgp/multihop/arubacx.j2 | Add ArubaCX EBGP multihop template. |
| netsim/extra/ebgp/multihop/init.py | Implement ebgp.multihop plugin module (phantom links + AF activation + cleanup). |
| netsim/extra/check/config/init.py | Add check.config plugin module (warn on missing custom configs). |
| netsim/extra/bonding/init.py | Add bonding plugin module (bond interface synthesis + neighbor updates). |
| netsim/extra/bgp/session/vyos.j2 | Add VyOS BGP session attributes template. |
| netsim/extra/bgp/session/sros.j2 | Add SR OS BGP session attributes template. |
| netsim/extra/bgp/session/srlinux.j2 | Add SR Linux BGP session attributes template. |
| netsim/extra/bgp/session/routeros7.j2 | Add RouterOS v7 BGP session attributes template. |
| netsim/extra/bgp/session/openbsd.j2 | Add placeholder (handled in module templates). |
| netsim/extra/bgp/session/nxos.j2 | Add NX-OS BGP session attributes template. |
| netsim/extra/bgp/session/junos.j2 | Add Junos BGP session attributes template. |
| netsim/extra/bgp/session/iosxr.j2 | Add IOS XR BGP session attributes template. |
| netsim/extra/bgp/session/ios.j2 | Add IOS BGP session attributes template. |
| netsim/extra/bgp/session/frr.j2 | Add FRR BGP session attributes template. |
| netsim/extra/bgp/session/fortios.j2 | Add placeholder (rendered in module templates). |
| netsim/extra/bgp/session/eos.j2 | Add EOS BGP session attributes template. |
| netsim/extra/bgp/session/dellos10.j2 | Add Dell OS10 BGP session attributes template. |
| netsim/extra/bgp/session/defaults.yml | Add bgp.session schema defaults (types + propagation rules). |
| netsim/extra/bgp/session/cumulus.j2 | Add Cumulus FRR-based BGP session attributes template. |
| netsim/extra/bgp/session/cumulus_nvue.j2 | Add NVUE BGP session attributes template. |
| netsim/extra/bgp/session/bird.j2 | Add placeholder (handled elsewhere). |
| netsim/extra/bgp/session/arubacx.j2 | Add ArubaCX BGP session attributes template. |
| netsim/extra/bgp/session/_sample_bfd_template.j2 | Add sample snippet for BFD-with-BGP session attributes. |
| netsim/extra/bgp/session/init.py | Implement bgp.session plugin module (propagate session attrs, RS handling, defaults). |
| netsim/extra/bgp/policy/vyos.j2 | Add VyOS BGP policy template. |
| netsim/extra/bgp/policy/sros.j2 | Add SR OS BGP policy template. |
| netsim/extra/bgp/policy/srlinux.j2 | Add SR Linux BGP policy template. |
| netsim/extra/bgp/policy/simple-attributes.yml | Add sample topology for simple BGP policy attributes. |
| netsim/extra/bgp/policy/junos.j2 | Add placeholder (handled to avoid policy clashing). |
| netsim/extra/bgp/policy/iosxr.j2 | Add IOS XR BGP policy template. |
| netsim/extra/bgp/policy/ios.j2 | Add IOS BGP policy template. |
| netsim/extra/bgp/policy/frr.j2 | Add FRR BGP policy template. |
| netsim/extra/bgp/policy/eos.j2 | Add EOS BGP policy template. |
| netsim/extra/bgp/policy/dellos10.j2 | Add Dell OS10 BGP policy template. |
| netsim/extra/bgp/policy/defaults.yml | Add bgp.policy schema defaults (role/policy/bandwidth/aggregate). |
| netsim/extra/bgp/policy/cumulus.j2 | Add Cumulus FRR-based BGP policy template. |
| netsim/extra/bgp/policy/bird.j2 | Add placeholder (handled elsewhere). |
| netsim/extra/bgp/policy/arubacx.j2 | Add ArubaCX BGP policy template. |
| netsim/extra/bgp/policy/_route_map_ios.j2 | Add shared route-map helper macro. |
| netsim/extra/bgp/originate/init.py | Add compatibility shim plugin for obsolete bgp.originate. |
| netsim/extra/bgp/domain/defaults.yml | Add bgp.domain schema defaults. |
| netsim/extra/bgp/domain/init.py | Add bgp.domain plugin module (cross-domain IBGP pruning + RR validation). |
| netsim/defaults/paths.yml | Remove package:extra plugin search path and add slash-based custom template patterns. |
| netsim/augment/plugin.py | Add module loading fallback, defaults.yml loading for plugin dirs, and redirect handling. |
| .github/workflows/t-push.yml | Remove mypy loop over netsim/extra/*/plugin.py. |
| .github/workflows/t-pull.yml | Remove mypy loop over netsim/extra/*/plugin.py. |
Collaborator
Perhaps add a |
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.
The built-in plugins are now structured as Python modules (for example, bgp.session plugin is in netsim/extra/bgp/session directory). That change required:
Breaking change: