Skip to content

Feature/fabric family gathered - #514

Draft
deekpand-cisco wants to merge 11 commits into
CiscoDevNet:developfrom
deekpand-cisco:feature/fabric-family-gathered
Draft

Feature/fabric family gathered#514
deekpand-cisco wants to merge 11 commits into
CiscoDevNet:developfrom
deekpand-cisco:feature/fabric-family-gathered

Conversation

@deekpand-cisco

@deekpand-cisco deekpand-cisco commented Aug 18, 2026

Copy link
Copy Markdown
Collaborator

Related Issue(s)

Related to #340.

This PR builds on the foundational framework established in
#312
including the state machine, base model infrastructure, orchestrator pattern,
and secrets handling.

Proposed Changes

Enable state: gathered with server-side and local filtering for all five fabric modules:

  • nd_manage_fabric_ebgp_vxlan
  • nd_manage_fabric_ibgp_vxlan
  • nd_manage_fabric_external
  • nd_manage_fabric_ai_ebgp_vxlan
  • nd_manage_fabric_ai_ibgp_vxlan

Stacked PR

This PR is stacked on two prior PRs and should be reviewed/merged in order:

  1. feature/pr312-gathered-module-filtering — gathered framework + loopback/local_user support
  2. feature/gathered-ethernet-fabric-update-group — ethernet access/trunk-host + fabric update group
  3. feature/fabric-family-gathered (this PR) — all five fabric modules

Orchestrators (5 files)

  • Add _fetch_fabrics_paginated() with bounded pagination and meta.counts.remaining support (aligned with base_interface._query_interfaces_with_lucene)
  • Add _query_one_by_name() for exact-name lookups via GET /fabrics/{name}, bypassing Lucene quoting issues with hyphens and special characters
  • Fallback (>3 expressions or quoted values) uses type-only paginated query instead of unfiltered scan
  • _query_all_for_gathered() splits filters: fabric_name-only → exact endpoint, compound → Lucene

Module runners (5 files)

  • Reject config_actions.save/deploy with state=gathered (fail-fast, aligned with nd_manage_vpc_pair)
  • Update config_actions docstring to reflect rejection behavior

Model

  • Add gathered_filter_properties and supports_gathered_filtering to fabric base model

Test Notes

Unit Tests

  • 4119 unit tests passing (0 failures)
  • 17 new tests in test_manage_fabric_gathered.py — pagination, exact-name, wrong-type rejection, mixed filters, non-existent name, parametrized across all 5 fabric types

Integration Tests

  • Gathered test blocks added to all 5 fabric integration task files (fabric_ebgp, fabric_ibgp, fabric_external, fabric_ai_ebgp, fabric_ai_ibgp)

Cisco Nexus Dashboard Version

4.2.1.10

Related ND API Resource Category

  • analyze
  • infa
  • manage
  • onemanage
  • other

Checklist

  • Latest commit is rebased from develop with merge conflicts resolved
  • New or updates to documentation has been made accordingly
  • Assigned the proper reviewers

@deekpand-cisco deekpand-cisco self-assigned this Aug 18, 2026
@deekpand-cisco
deekpand-cisco force-pushed the feature/fabric-family-gathered branch from db65916 to f1702c2 Compare August 18, 2026 17:00
Add gathered_all state to the state machine for modules that retrieve
all instances, mask_secrets helper for sensitive field redaction,
and associated unit tests.

Note: gathered-all framework cherry-picked from PR CiscoDevNet#312
Add server-side Lucene candidate filtering for gathered loopback interfaces with pagination, deduplication, and final local matching. Support gather-all and login-ID filtering for local users while rejecting unsupported gathered criteria. Add unit and integration coverage for filtering, validation, secrecy, and reusable output.
- Remove early return in filter_gathered_response() so deduplication
  runs unconditionally regardless of whether filters are provided
- Add validate_gathered_filters() pre-flight check called before
  query_all() to reject invalid filters without wasted API calls
- Add gathered_filter_properties ClassVar to NDBaseModel for declarative
  filter whitelisting per module
- Add pre-flight property validation (_extract_active_leaf_paths,
  _reject_unsupported_filter_properties) that rejects unsupported filter
  fields before any API call
- Replace local_user custom normalize_gathered_filter validation with
  shared gathered_filter_properties tuple (login_id, email, first_name,
  last_name)
- Add gathered_filter_properties to loopback model (switch_ip,
  interface_name, admin_state, ip, ipv6, vrf)
- Pass supported_properties from model to validate_gathered_filters in
  state machine
- Add gathered_transform support in NDOutput for modules with
  input/output shape differences
- Fix loopback pagination: add max_pages safety cap, handle missing or
  invalid remaining metadata gracefully
- Update nd_local_user DOCUMENTATION with supported filter properties
- Update local_user unit tests to use shared validation path
- Apply black formatting to all gathered filtering module and test files
- Add gathered state as no-op pass in manage_state() so modules
  can call manage_state unconditionally without raising InvalidState
- Address review formatting feedback (trailing whitespace, blank lines)
- Extract gathered query logic into _query_existing() private helper
- Move user-input validation outside try block for clean error messages
- Build proposed before querying ND (fail-fast on bad config)
- Declare get_argument_spec on NDBaseModel and gathered_transform on
  NDBaseOrchestrator; remove getattr probes for discoverability
- Rename supports_gathered_lucene_filtering to
  supports_gathered_server_filtering (mechanism-neutral)
- Normalize filters once in state machine; pass normalize_filter=None
  downstream to eliminate triple normalization
- Return models from filter_gathered_response to avoid double Pydantic
  validation; use pre-built models for NDConfigCollection construction
- Cap Lucene query fan-out at 3 expressions per switch; collapse to
  base expression beyond threshold
- Raise ValueError for unknown switch_ip in gathered filters instead
  of silently returning empty results
- Raise RuntimeError on pagination limit exhaustion instead of
  silently truncating gathered results
- Update unit tests for new return types, renamed flags, and
  pre-normalized filter inputs
… group modules

Enable gathered state and Lucene filtering for:
- nd_interface_ethernet_access
- nd_interface_ethernet_trunk_host
- nd_fabric_update_group

Includes:
- Model gathered_spec and gathered_transform definitions
- Orchestrator gathered workflow with pagination
- Integration test tasks for gathered state
- Unit tests for gathered filtering round-trip
- Add TODO(4.2.1) interface-lucene-or-silently-empty workaround markers
- Remove unreachable _switches_to_query override from ethernet_base
- Update query_all docstring to cover gathered path
- Consolidate loopback duplicated pagination/query-plan into base class
  via _configure_lucene_endpoint hook
- Remove gathered early-return in trunk-host so _is_unconfigured_default
  filters on all states
- Use modern annotations (set[str], dict[str, Any]) in new code
- Remove Python 2 boilerplate from new test file
- Fix trailing whitespace
- Add gathered state support to eBGP, iBGP, External, AI eBGP, AI iBGP
- Add bounded pagination with meta.counts.remaining
- Add exact-name endpoint optimization for fabric_name-only filters
- Fallback uses type-only paginated query instead of unfiltered scan
- Reject config_actions.save/deploy with state=gathered
- Update config_actions docstring to reflect rejection behavior
- Add unit and integration tests for all fabric gathered paths
@deekpand-cisco
deekpand-cisco force-pushed the feature/fabric-family-gathered branch from f1702c2 to a53112d Compare August 19, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant