Skip to content

v4: Split ConfigViewInterfaceBase into minimal core and optional mixins #227

@jtdub

Description

@jtdub

Description

ConfigViewInterfaceBase has 31 abstract properties that every platform must implement. Most platforms only implement a fraction — Cisco XR (29%), NXOS (23%), and Arista EOS (13%) raise NotImplementedError for the majority. This forces boilerplate stubs and misleads users into thinking a feature is available when it's not.

Proposed Change

Split into a minimal core interface and optional protocol-based mixins:

Core (required by all platforms):

  • name, description, enabled, ipv4_interfaces, is_loopback, is_svi, is_subinterface, number, port_number

Optional mixins (implement only if the platform supports them):

  • BundleViewMixin: bundle_id, bundle_name, bundle_member_interfaces, is_bundle, _bundle_prefix
  • VlanViewMixin: native_vlan, tagged_vlans, tagged_all, dot1q_mode
  • NACViewMixin: has_nac, nac_host_mode, nac_mab_first, nac_control_direction_in, nac_max_dot1x_clients, nac_max_mab_clients
  • PhysicalViewMixin: duplex, speed, poe, module_number

Users can check capability via isinstance(view, VlanViewMixin) rather than catching NotImplementedError.

Current Property Availability

Platform Implemented Total Coverage
HP ProCurve 28 31 90%
Cisco IOS 26 31 84%
Cisco XR 9 31 29%
Cisco NXOS 7 31 23%
Arista EOS 4 31 13%

Breaking Change

Yes — ConfigViewInterfaceBase changes its interface. Code using isinstance checks or accessing properties that move to mixins would need updating.

Metadata

Metadata

Assignees

No one assigned

    Labels

    v4-enhancementEnhancement planned for hier_config v4.0.0

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions