Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
594812a
Integrate RestSend framework into new nd_v2.py
allenrobel Feb 7, 2026
a1dfab9
Appease ansible sanity tests
allenrobel Feb 7, 2026
8b79252
Python 3.8 type hint compatibility
allenrobel Feb 7, 2026
69776b1
Add pylint directive to remove false positives
allenrobel Feb 7, 2026
0837800
Add logging.
allenrobel Feb 7, 2026
4cf53bc
Add minimal support for state (query)
allenrobel Feb 8, 2026
6ac0cb7
Update copyright to match ND Collection
allenrobel Feb 8, 2026
f8da65f
Update f-strings, fix copyright, etc
allenrobel Feb 8, 2026
eb92531
Remove unnessary mypy directives
allenrobel Feb 8, 2026
959538a
Update Pydantic compatibility layer
allenrobel Feb 8, 2026
a59d1c4
Add BooleanStringEnum
allenrobel Feb 8, 2026
d62c0e4
Smart Endpoints initial commit
allenrobel Feb 8, 2026
a2e82fa
Refactor base paths to main schema divisions
allenrobel Feb 9, 2026
44b102e
Simplify demo module
allenrobel Feb 9, 2026
4218fb1
Integrate Results
allenrobel Feb 9, 2026
e718c17
Run though linters
allenrobel Feb 9, 2026
f404c69
add pylint suppression directive
allenrobel Feb 10, 2026
0d4e02f
Address pylint too-many-return-statements
allenrobel Feb 10, 2026
848c971
Update with fallback objects from old file
allenrobel Feb 10, 2026
66186c2
More intuitive property names in NDErrorData
allenrobel Feb 10, 2026
a67d846
Add sender_file.py for unit tests
allenrobel Feb 10, 2026
f8bf430
Add unit test infrastructure
allenrobel Feb 10, 2026
f89983a
Remove redundant checks
allenrobel Feb 11, 2026
2903a57
Leverage ResponseHandler
allenrobel Feb 11, 2026
6bc4839
Expose rest_send as a public property
allenrobel Feb 11, 2026
618edd0
Run through linters
allenrobel Feb 11, 2026
c4d53b5
Run thru linters
allenrobel Feb 11, 2026
2445fa6
Run thru linters
allenrobel Feb 11, 2026
ddc6b1c
Use composition for query+lucene params
allenrobel Feb 11, 2026
bdcf749
Align copyright with repository standard
allenrobel Feb 11, 2026
7cb67a8
Add BasePath class for /api/v1/manage
allenrobel Feb 11, 2026
c835acf
Fix circular import, fix sender_file protocol alignment
allenrobel Feb 11, 2026
f2c4b01
Finish type hints for method signatures
allenrobel Feb 11, 2026
ad9c82d
Update docstrings to standard Markdown
allenrobel Feb 11, 2026
8fc84ab
Standardize docstrings to Markdown format
allenrobel Feb 11, 2026
02d56fd
Cleanup
allenrobel Feb 11, 2026
e735a50
Remove unneeded mypy suppression directives
allenrobel Feb 12, 2026
925a9f4
Move sender_file.py to tests/module_utils
allenrobel Feb 12, 2026
34bb707
Results.register_task_result: fix docstring and msg
allenrobel Feb 12, 2026
58bed3b
UT: tests for module_utils/ep/base_path.py
allenrobel Feb 12, 2026
2cbef2d
UT: Unit tests for Smart Endpoints
allenrobel Feb 13, 2026
d689269
UT: Unit tests for RestSend (and RestSend fix)
allenrobel Feb 13, 2026
2b85cb0
UT: Unit tests for ResponseHandler and Sender
allenrobel Feb 13, 2026
02c61a6
Add PR description for RestSend framework branch
allenrobel Feb 13, 2026
4c0f5e3
Suppress Pylance/mypy errors
allenrobel Feb 13, 2026
0963422
Move module docstring to top of files
allenrobel Feb 13, 2026
62b37e6
Appease ansible-test
allenrobel Feb 14, 2026
e18344f
Appease black
allenrobel Feb 14, 2026
183a256
Appease black
allenrobel Feb 14, 2026
201567b
Appease black, pylint
allenrobel Feb 14, 2026
b9239b4
Appease Ansible sanity (Fix __metaclass__ errors)
allenrobel Feb 14, 2026
6313d43
Wrap __metaclass__ in disable/enable directives
allenrobel Feb 14, 2026
401336c
Optimize Results.did_anything_change
allenrobel Feb 15, 2026
df5faac
Results.did_anything_change: further optimization
allenrobel Feb 15, 2026
157493c
Results.did_anything_change further optimizationi
allenrobel Feb 15, 2026
c5e8076
Result: Idempotent property getters
allenrobel Feb 15, 2026
e16d33a
Results.add_to_failed: remove redundant method
allenrobel Feb 15, 2026
3e208b1
Results: add_*() methods should not mutate their input parameters
allenrobel Feb 15, 2026
cd747e7
Results.register_task_result: Fix boolean comparison anti-patterns
allenrobel Feb 15, 2026
a570eac
Results.build_final_result: Simplify logic
allenrobel Feb 15, 2026
df04820
Results.__init__: remove unused class attributes
allenrobel Feb 15, 2026
61efe2e
Results: consistent backward-compatible type hints
allenrobel Feb 15, 2026
96d311c
Results: Final optimizations
allenrobel Feb 15, 2026
32896f6
Results: Refactor to use Pydantic models
allenrobel Feb 16, 2026
62f2b45
MockAnsibleModule: Resolve Pylance error
allenrobel Feb 16, 2026
e762eb7
disable/enable pylint invalid-name for __metaclass__
allenrobel Feb 16, 2026
e42adc7
Relocate module docstrings to appease pylint
allenrobel Feb 16, 2026
a58b35f
Remove AI generated PR description.
allenrobel Feb 16, 2026
b66e989
Alphabetize Mixin classes by class name
allenrobel Feb 16, 2026
0c1b539
Appease Pylint
allenrobel Feb 16, 2026
ef8e389
Type hint Python 3..8 compatibility
allenrobel Feb 16, 2026
caad345
Use annotations from __future__ for type hinting
allenrobel Feb 16, 2026
9cf13dc
Log: Add missing type hints and appease mypy
allenrobel Feb 16, 2026
11fd9fb
Fix logging class substring
allenrobel Feb 17, 2026
a50a0b3
Claude.md: provides context to Claude
allenrobel Feb 17, 2026
6c8bae6
Add pyproject.toml
allenrobel Feb 17, 2026
5e99413
Update references to component versions
allenrobel Feb 17, 2026
51c6c42
enums.pu: Appease black linter
allenrobel Feb 17, 2026
f71d608
Address issue 1: AnsibleConnectionError uncaught
allenrobel Feb 18, 2026
15e32e5
Fix issue 2 in Claude code review
allenrobel Feb 18, 2026
477867f
Fix for Claude code review issue 3
allenrobel Feb 18, 2026
ca9228f
Fix Claude code review issue 4.
allenrobel Feb 18, 2026
a138eb2
UT: Update test_rest_send_00010 assert
allenrobel Feb 18, 2026
6aa8222
Address samiib review comment
allenrobel Feb 20, 2026
e3f762e
Appease black
allenrobel Feb 20, 2026
f8e66ea
Update with special __metaclass__ handling
allenrobel Feb 20, 2026
1b3254f
SwitchesEndpointParams: Fix input validation
allenrobel Feb 25, 2026
6a3019c
Add ANALYSIS files for code review discussions
allenrobel Feb 26, 2026
8a275ab
Update ResponseHandler to handle additional HTTP status codes
allenrobel Feb 26, 2026
dea9a06
Add dependency lock (uv.lock)
allenrobel Feb 26, 2026
ad5fdaa
Fix timeout logic in rest_send.py
allenrobel Feb 27, 2026
ecba6ca
Analysis: Endpoint parameter usage patterns
allenrobel Feb 27, 2026
ac0d1f4
Refactor: Remove version redundancy from endpoint class names
allenrobel Feb 27, 2026
4b335cb
Implement version-specific response strategies
allenrobel Feb 27, 2026
c057892
Replace inspect.stack() with static method names for performance
allenrobel Feb 28, 2026
51f2c74
Add TODO_ENDPOINT_VERSIONING.md
allenrobel Feb 28, 2026
95faf54
Refactor: Convert base API paths to type-safe Enum
allenrobel Feb 28, 2026
df7da0e
Update with reference to new enum usage
allenrobel Feb 28, 2026
de85d6a
Refactor: Move response validation strategy files to module_utils root
allenrobel Mar 2, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
306 changes: 306 additions & 0 deletions ANALYSIS_ENDPOINT_PARAMETERS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,306 @@
# API Endpoint Parameters Analysis

## Overview

This document analyzes multiple OpenAPI schema files (`schema/manage.json` and `schema/infra.json`) to identify parameter usage patterns across all API endpoints in the Cisco ND collection and assess the appropriateness of the endpoint mixin structure defined in `plugins/module_utils/ep/endpoint_mixins.py`.

## Key Findings

### Manage API (manage.json)

#### Maximum Query Parameters: 7

Two endpoints have the maximum of 7 query parameters:

1. **GET /anomalyRules/systemTelemetryRules**
- Query parameters: `max`, `offset`, `pathAnomalyCategory`, `pathApplicablePlatforms`, `sort`, `status`, `title`

2. **GET /inventory/switches**
- Query parameters: `fabricName`, `filter`, `hostname`, `max`, `offset`, `sort`, `switchId`

#### Maximum Path Parameters in Manage: 1

All endpoints use at most 1 path parameter. Examples:

- `DELETE /fabrics/{fabricName}/switches/{switchId}`
- `GET /fabrics/{fabricName}/policies/{policyId}`
- `PUT /fabrics/{fabricName}/resourceGroups/{groupId}`

#### Endpoints with Parameters

- Total manage.json endpoints: 146
- Endpoints with parameters: 18 (12%)
- Total unique parameters: 18
- Zero overlap with infra.json parameters

### Infrastructure API (infra.json)

#### Maximum Query Parameters: 4

The endpoint `GET /cluster/nodes` has the maximum of 4 query parameters:

- Query parameters: `nodeName`, `nodeBootstrapState`, `nodeOperationalState`, `nodeRole`

#### Maximum Path Parameters in Infra: 1

All endpoints use at most 1 path parameter. Examples:

- `/backups/schedules/{name}`
- `/aaa/localUsers/{pathLoginId}`
- `/cluster/nodes/{pathNodeName}`

#### Endpoints with Parameters

- Total infra.json endpoints: 195
- Endpoints with parameters: 75 (38%)
- Total unique parameters: 31
- Zero overlap with manage.json parameters

### Cross-API Comparison

| Metric | manage.json | infra.json | Difference |
| ------ | -------- | -------- | -------- |
| Total endpoints | 146 | 195 | +49 (34%) |
| Unique parameters | 18 | 31 | +13 (72%) |
| Avg query params/endpoint | 0.06 | 0.13 | 2.2x higher |
| Avg path params/endpoint | 0.07 | 0.11 | 1.6x higher |
| Max query parameters | 7 | 4 | — |
| Max path parameters | 1 | 1 | — |
| Parameter sparsity | 88% endpoints have zero parameters | 62% endpoints have zero parameters | — |

## Parameter Distribution Statistics

### Manage API Statistics

| Metric | Value |
| ------ | -------- |
| Total endpoints | 146 |
| Endpoints with parameters | 18 (12%) |
| Query param minimum | 0 |
| Query param maximum | 7 |
| Query param average | 0.06 per endpoint |
| Path param minimum | 0 |
| Path param maximum | 1 |
| Path param average | 0.07 per endpoint |

### Infrastructure API Statistics

| Metric | Value |
| ------ | -------- |
| Total endpoints | 195 |
| Endpoints with parameters | 75 (38%) |
| Query param minimum | 0 |
| Query param maximum | 4 |
| Query param average | 0.13 per endpoint |
| Path param minimum | 0 |
| Path param maximum | 1 |
| Path param average | 0.11 per endpoint |

## Analysis

**Manage API** is highly focused:

- Only 12% of endpoints use parameters
- When parameters are used, they are specialized (filtering, pagination, sorting)
- Clear separation between resource identification (path) and query/filtering (query)

**Infrastructure API** has broader parameter usage:

- 38% of endpoints use parameters (3x more than manage)
- Parameters span multiple domains: AAA/authentication, cluster management, external integrations
- Path parameters dominate over query parameters (11% vs 13% average usage)
- Greater parameter diversity reflects complex multi-tenant and integration scenarios

## Parameter Sharing Analysis

To assess the granularity of the endpoint mixins, we analyzed how parameters are shared across endpoints in both schemas and compared them with the current mixin definitions.

### Top Parameters by Reuse Across All APIs

| Rank | Parameter | API | Count | Type | Has Mixin | Domain |
| ---- | ----------- | ------- | ------- | ------- | ----------- | ----------- |
| 1 | `name` | infra.json | 12 | path | ✗ MISSING | Generic resource identification |
| 2 | `pathLoginId` | infra.json | 6 | path | ✓ LoginIdMixin | AAA/user management |
| 3 | `fabricName` | manage.json | 19 | query | ✓ FabricNameMixin | Fabric management |
| 4 | `ruleName` | manage.json | 5 | query | ✗ MISSING | Anomaly rules |
| 5 | `forceShowRun` | manage.json | 4 | query | ✓ ForceShowRunMixin | Configuration |
| 6 | `pathDomain` | infra.json | 3 | path | ✗ MISSING | AAA/login domain |
| 6 | `pathSecurityDomain` | infra.json | 3 | path | ✗ MISSING | Security domain |
| 6 | `pathApiKeyID` | infra.json | 3 | path | ✗ MISSING | API key management |
| 6 | `pathKeyId` | infra.json | 3 | path | ✗ MISSING | Security key management |
| 6 | `networkView` | infra.json | 3 | query | ✗ MISSING | IPAM integration |
| 6 | `subnet` | infra.json | 3 | query | ✗ MISSING | IPAM filtering |
| 12+ | Various others | both | 1-2 | mixed | ✗ Mostly MISSING | Domain-specific |

### Key Observation: Mixin Coverage

**Actual mixin usage:**

- ✓ **LoginIdMixin**: ACTIVELY USED in `ep_api_v1_infra_aaa.py` (6 endpoints)
- Python field name: `login_id`
- Schema parameter: `pathLoginId`
- Confirmed usage for AAA user management

- ✓ **FabricNameMixin**: Designed for manage.json (19 endpoints)
- Expected usage in fabric management endpoints

- ✓ **ForceShowRunMixin**: Designed for manage.json (4 endpoints)
- Configuration operation flag

**Unused mixins (0 endpoints each):**

- ClusterNameMixin
- HealthCategoryMixin
- InclAllMsdSwitchesMixin
- LinkUuidMixin
- NetworkNameMixin
- NodeNameMixin
- SwitchSerialNumberMixin
- VrfNameMixin

These 8 unused mixins lack corresponding parameters in either manage.json or infra.json schemas.

### Missing Parameters and Future Mixin Candidates

**Infrastructure API (infra.json) - High Priority (3+ endpoints):**

- `name` (12 endpoints) - Generic resource identifier (backups, clusters, schedules)
- Candidate: **NameMixin**

- `pathLoginId` (6 endpoints) - User login identification
- Status: ✓ **LoginIdMixin already exists and is used**
- Location: `ep_api_v1_infra_aaa.py`

- `pathDomain` (3 endpoints) - AAA login domain
- Candidate: **PathDomainMixin**

- `pathSecurityDomain` (3 endpoints) - Security domain management
- Candidate: **PathSecurityDomainMixin**

- `pathApiKeyID` (3 endpoints) - API key identification
- Candidate: **PathApiKeyIdMixin**

- `pathKeyId` (3 endpoints) - Security key identification
- Candidate: **PathKeyIdMixin**

- `networkView` (3 endpoints) - IPAM network view
- Candidate: **NetworkViewMixin**

- `subnet` (3 endpoints) - IPAM subnet filtering
- Candidate: **SubnetMixin**

**Manage API (manage.json) - High Priority (3+ endpoints):**

- `ruleName` (5 endpoints) - Anomaly rule filtering
- Candidate: **RuleNameMixin**

- `ruleId` (3 endpoints) - Anomaly rule identification
- Candidate: **RuleIdMixin**

- `policyId` (3 endpoints) - Policy identification
- Candidate: **PolicyIdMixin**

- `policyGroupId` (3 endpoints) - Policy group identification
- Candidate: **PolicyGroupIdMixin**

- `switchId` (3 endpoints) - Switch identification
- Candidate: **SwitchIdMixin**

### Coverage Assessment - Combined APIs

| Metric | Value |
| ------ | -------- |
| Total endpoints (both APIs) | 341 |
| Total unique parameters (both APIs) | 49 |
| Parameters with existing mixins | 3 (6%) |
| Endpoints covered by existing mixins | 29 (8.5%) |
| Parameters without mixins | 46 (94%) |
| Gap to close with new mixins | 91.5% |

**Key Finding:** Only 3 of 11 defined mixins are actually used (LoginIdMixin, FabricNameMixin, ForceShowRunMixin). The 8 unused mixins (ClusterNameMixin, HealthCategoryMixin, InclAllMsdSwitchesMixin, LinkUuidMixin, NetworkNameMixin, NodeNameMixin, SwitchSerialNumberMixin, VrfNameMixin) have no corresponding parameters in either schema.

## Conclusion: Mixin Granularity Assessment

### Overall Assessment

**The current mixin structure is partially aligned with actual schema usage.** Three mixins are actively used (LoginIdMixin, FabricNameMixin, ForceShowRunMixin), but 8 mixins are unused and lack corresponding parameters in either schema.

### Detailed Findings

1. **LoginIdMixin is actively used** ✓
- Confirmed usage in `ep_api_v1_infra_aaa.py`
- 6 endpoints in infra.json
- Maps Python `login_id` to schema `pathLoginId`
- Well-justified for AAA/user management

2. **FabricNameMixin is well-justified** ✓
- 19 endpoints in manage.json (13% of manage API)
- High reuse across fabric management endpoints
- Cross-domain usage justifies a dedicated mixin

3. **ForceShowRunMixin is justified** ✓
- 4 endpoints in manage.json (2.7% of manage API)
- Specialized boolean flag pattern
- Benefits from consistent validation and documentation

4. **8 unused mixins need review** ⚠️
- ClusterNameMixin, HealthCategoryMixin, InclAllMsdSwitchesMixin, LinkUuidMixin, NetworkNameMixin, NodeNameMixin, SwitchSerialNumberMixin, VrfNameMixin
- No corresponding parameters found in manage.json or infra.json
- Possible reasons:
- Designed for future APIs (analyze.json, orchestration.json, one_manage.json)
- Legacy code from earlier API versions
- Placeholder definitions awaiting implementation

5. **Parameter naming convention discovered**
- Python mixins use snake_case: `login_id`, `fabric_name`
- Schema uses camelCase with path prefix: `pathLoginId`, `fabricName`
- This suggests an automated field serialization/aliasing mechanism exists

6. **Zero parameter overlap between APIs**
- manage.json and infra.json are separate API subsystems
- No shared parameters except by semantic similarity
- Suggests different architectural boundaries or evolution

### High-Priority Mixin Candidates

Based on parameter reuse patterns:

**Infrastructure API (3+ endpoints):**

- **NameMixin** (12 endpoints) - Generic resource identifier
- **PathDomainMixin** (3 endpoints) - AAA login domain
- **PathSecurityDomainMixin** (3 endpoints) - Security domain
- **PathApiKeyIdMixin** (3 endpoints) - API key management
- **PathKeyIdMixin** (3 endpoints) - Security key management
- **NetworkViewMixin** (3 endpoints) - IPAM integration
- **SubnetMixin** (3 endpoints) - IPAM filtering

**Manage API (3+ endpoints):**

- **RuleNameMixin** (5 endpoints) - Anomaly rule filtering
- **RuleIdMixin** (3 endpoints) - Anomaly rule identification
- **PolicyIdMixin** (3 endpoints) - Policy identification
- **PolicyGroupIdMixin** (3 endpoints) - Policy group identification
- **SwitchIdMixin** (3 endpoints) - Switch identification

### Recommendations

1. **Investigate the 8 unused mixins**: Determine if they are for planned APIs (analyze.json, orchestration.json, one_manage.json) or should be removed

2. **Verify naming convention**: Document the mapping between Python field names (snake_case) and schema parameter names (camelCase with path prefix)

3. **Prioritize new mixins for high-reuse parameters**: Focus on NameMixin (12 endpoints) and the path-based parameters in infra.json (3+ endpoints each)

4. **Consider parameter categorization**: Group new mixins by domain (AAA/Auth, IPAM, Anomaly Rules, etc.) for better code organization

5. **Document mixin scope**: Clarify which mixins are for which APIs (manage vs. infra vs. future APIs) to guide future development

## Dataset

- **Total endpoints analyzed**: 341
- manage.json: 146 endpoints
- infra.json: 195 endpoints
- **Total unique parameters**: 49
- **Schema files analyzed**: `schema/manage.json`, `schema/infra.json`
- **Mixin file analyzed**: `plugins/module_utils/ep/endpoint_mixins.py`
- **Active mixin usage verified in**: `plugins/module_utils/ep/ep_api_v1_infra_aaa.py`
Loading
Loading