netloom-tool 1.6.1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- netloom_tool-1.6.1/CHANGELOG.md +178 -0
- netloom_tool-1.6.1/LICENSE +18 -0
- netloom_tool-1.6.1/MANIFEST.in +9 -0
- netloom_tool-1.6.1/PKG-INFO +419 -0
- netloom_tool-1.6.1/README.md +385 -0
- netloom_tool-1.6.1/arapy/__init__.py +29 -0
- netloom_tool-1.6.1/arapy/__main__.py +4 -0
- netloom_tool-1.6.1/arapy/cli/__init__.py +0 -0
- netloom_tool-1.6.1/arapy/cli/commands.py +249 -0
- netloom_tool-1.6.1/arapy/cli/completion.py +64 -0
- netloom_tool-1.6.1/arapy/cli/copy.py +586 -0
- netloom_tool-1.6.1/arapy/cli/help.py +269 -0
- netloom_tool-1.6.1/arapy/cli/main.py +180 -0
- netloom_tool-1.6.1/arapy/cli/parser.py +67 -0
- netloom_tool-1.6.1/arapy/cli/server.py +61 -0
- netloom_tool-1.6.1/arapy/core/__init__.py +0 -0
- netloom_tool-1.6.1/arapy/core/catalog.py +988 -0
- netloom_tool-1.6.1/arapy/core/client.py +317 -0
- netloom_tool-1.6.1/arapy/core/config.py +500 -0
- netloom_tool-1.6.1/arapy/core/pagination.py +116 -0
- netloom_tool-1.6.1/arapy/core/resolver.py +252 -0
- netloom_tool-1.6.1/arapy/data/man/arapy.1 +425 -0
- netloom_tool-1.6.1/arapy/install_manpage.py +62 -0
- netloom_tool-1.6.1/arapy/io/__init__.py +0 -0
- netloom_tool-1.6.1/arapy/io/files.py +80 -0
- netloom_tool-1.6.1/arapy/io/output.py +224 -0
- netloom_tool-1.6.1/arapy/logging/__init__.py +0 -0
- netloom_tool-1.6.1/arapy/logging/setup.py +117 -0
- netloom_tool-1.6.1/credentials.env.example +22 -0
- netloom_tool-1.6.1/man/arapy.1 +376 -0
- netloom_tool-1.6.1/netloom_tool.egg-info/PKG-INFO +419 -0
- netloom_tool-1.6.1/netloom_tool.egg-info/SOURCES.txt +52 -0
- netloom_tool-1.6.1/netloom_tool.egg-info/dependency_links.txt +1 -0
- netloom_tool-1.6.1/netloom_tool.egg-info/entry_points.txt +5 -0
- netloom_tool-1.6.1/netloom_tool.egg-info/requires.txt +8 -0
- netloom_tool-1.6.1/netloom_tool.egg-info/top_level.txt +1 -0
- netloom_tool-1.6.1/profiles.env.example +65 -0
- netloom_tool-1.6.1/pyproject.toml +77 -0
- netloom_tool-1.6.1/scripts/arapy-completion.bash +19 -0
- netloom_tool-1.6.1/setup.cfg +4 -0
- netloom_tool-1.6.1/tests/conftest.py +79 -0
- netloom_tool-1.6.1/tests/test_catalog.py +123 -0
- netloom_tool-1.6.1/tests/test_clearpass.py +179 -0
- netloom_tool-1.6.1/tests/test_commands.py +612 -0
- netloom_tool-1.6.1/tests/test_copy.py +620 -0
- netloom_tool-1.6.1/tests/test_fuzz.py +190 -0
- netloom_tool-1.6.1/tests/test_help.py +118 -0
- netloom_tool-1.6.1/tests/test_integration_cli.py +289 -0
- netloom_tool-1.6.1/tests/test_io_utils.py +172 -0
- netloom_tool-1.6.1/tests/test_list_endpoints.py +114 -0
- netloom_tool-1.6.1/tests/test_logger.py +42 -0
- netloom_tool-1.6.1/tests/test_main.py +122 -0
- netloom_tool-1.6.1/tests/test_manpage.py +23 -0
- netloom_tool-1.6.1/tests/test_profiles.py +181 -0
|
@@ -0,0 +1,178 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.6.1 - 2026-03-14
|
|
4
|
+
|
|
5
|
+
### Changed
|
|
6
|
+
- added the `netloom-install-manpage` helper command alongside the existing `arapy-install-manpage` compatibility alias
|
|
7
|
+
- GitHub packaging workflow now smoke-tests both `netloom` and `netloom-install-manpage` before tagged releases
|
|
8
|
+
- package metadata now uses modern `license` and `license-files` fields for cleaner PyPI builds
|
|
9
|
+
- added `RELEASING.md` with a Trusted Publishing setup and release checklist for `netloom-tool`
|
|
10
|
+
|
|
11
|
+
## 1.6.0 - 2026-03-14
|
|
12
|
+
|
|
13
|
+
### Changed
|
|
14
|
+
- project branding now uses `netloom` as the primary name, with `netloom-tool` as the Python package distribution name
|
|
15
|
+
- added the `netloom` CLI entrypoint while keeping `arapy` available as a compatibility alias during the transition
|
|
16
|
+
- documentation and project metadata now point to `https://netloom.se` and `https://github.com/mathias-granlund/netloom`
|
|
17
|
+
- automatic collection paging now respects explicit `--limit` values for `list`, `get --all`, and `copy` instead of overriding them
|
|
18
|
+
- the bundled Bash completion script now supports both `netloom` and `arapy`
|
|
19
|
+
|
|
20
|
+
## 1.5.3 - 2026-03-13
|
|
21
|
+
|
|
22
|
+
### Changed
|
|
23
|
+
- `list`, `get --all`, and `copy` source reads now iterate through paged ClearPass collection responses until all matching entries are fetched instead of stopping after the first page
|
|
24
|
+
- `--filter` now applies across the full paged result set, and `--limit` acts as the per-request page size for paged collection reads
|
|
25
|
+
- built-in help and README guidance now explain the filtered paging behavior explicitly
|
|
26
|
+
|
|
27
|
+
## 1.5.2 - 2026-03-13
|
|
28
|
+
|
|
29
|
+
### Fixed
|
|
30
|
+
- `arapy copy` now omits blank `radius_secret` and `tacacs_secret` values from generated payloads so hidden source credentials are not replayed as empty strings on target updates or replacements
|
|
31
|
+
- `policyelements network-device` copy creates now fail before the API call with a clearer message when the source response does not include usable RADIUS, TACACS+, or SNMP credentials
|
|
32
|
+
- copy summaries now print item-level failure reasons directly in terminal output to make validation issues easier to diagnose without debug logging
|
|
33
|
+
|
|
34
|
+
## 1.5.1 - 2026-03-13
|
|
35
|
+
|
|
36
|
+
### Fixed
|
|
37
|
+
- `arapy copy` now uses the normal cached API catalog path for both source and target profiles instead of forcing a fresh `/api-docs` discovery on every run
|
|
38
|
+
- added regression coverage to keep the copy workflow aligned with the cache behavior used by the rest of the CLI
|
|
39
|
+
|
|
40
|
+
## 1.5.0 - 2026-03-13
|
|
41
|
+
|
|
42
|
+
### Added
|
|
43
|
+
- built-in `arapy copy <module> <service> --from=SOURCE --to=TARGET` workflow for copying resources between ClearPass profiles without shell-chaining separate export and import commands
|
|
44
|
+
- copy workflow support for `--dry-run`, `--match-by=auto|name|id`, `--on-conflict=fail|skip|update|replace`, and optional report artifacts via `--save-source`, `--save-payload`, and `--save-plan`
|
|
45
|
+
- parser, help text, completion, and integration coverage for the new `copy` built-in command
|
|
46
|
+
|
|
47
|
+
### Changed
|
|
48
|
+
- copy execution now fetches source objects, normalizes them against the destination write schema, strips response-only metadata, and reuses destination profile settings within a single command run
|
|
49
|
+
|
|
50
|
+
## 1.4.11 - 2026-03-13
|
|
51
|
+
|
|
52
|
+
### Fixed
|
|
53
|
+
- path override settings such as `ARAPY_OUT_DIR`, `ARAPY_STATE_DIR`, `ARAPY_CACHE_DIR`, and `ARAPY_APP_LOG_DIR` now resolve through the same config/profile loading path as the rest of the runtime settings
|
|
54
|
+
- profile-scoped path overrides such as `ARAPY_OUT_DIR_PROD` are now respected
|
|
55
|
+
- `~` is now expanded in configured path overrides so values like `ARAPY_OUT_DIR=~/responses` resolve to the user home directory as expected
|
|
56
|
+
|
|
57
|
+
## 1.4.10 - 2026-03-13
|
|
58
|
+
|
|
59
|
+
### Fixed
|
|
60
|
+
- saved ClearPass `list` responses can now be reused as `--file` input for write actions by unwrapping `_embedded.items` and dropping response `_links`
|
|
61
|
+
- file-backed `add`, `update`, and `replace` requests now filter response-only fields such as `id` out of the JSON body while still allowing path fields to resolve update/replace URLs
|
|
62
|
+
- empty optional container values from exported responses, such as `attributes: {}`, are now omitted from replayed write payloads when ClearPass expects the field to be absent instead of empty
|
|
63
|
+
- `--decrypt` now also disables secret masking in HTTP request debug logs so troubleshooting output matches the requested secret visibility
|
|
64
|
+
- client construction remains compatible with older test doubles and call sites that do not accept the new secret-masking parameter
|
|
65
|
+
|
|
66
|
+
## 1.4.9 - 2026-03-12
|
|
67
|
+
|
|
68
|
+
### Fixed
|
|
69
|
+
- `/api-docs` help notes now strip embedded HTML more cleanly instead of dumping raw tags into `--help` output
|
|
70
|
+
- list-action help notes now preserve multiline structure for filter documentation and similar table-style notes
|
|
71
|
+
|
|
72
|
+
## 1.4.8 - 2026-03-12
|
|
73
|
+
|
|
74
|
+
### Added
|
|
75
|
+
- `arapy server list`, `arapy server show`, and `arapy server use <profile>` built-in commands for switching between named ClearPass environments
|
|
76
|
+
- profile-aware configuration loading from `~/.config/arapy/profiles.env` and `~/.config/arapy/credentials.env`
|
|
77
|
+
- packaged `profiles.env.example` and `credentials.env.example` templates for per-user profile setup
|
|
78
|
+
|
|
79
|
+
### Changed
|
|
80
|
+
- environment loading now resolves profile-scoped keys such as `ARAPY_SERVER_PROD` and `ARAPY_CLIENT_SECRET_DEV` based on `ARAPY_ACTIVE_PROFILE`
|
|
81
|
+
- shell completion and built-in help now include the `server` command surface and discovered profile names
|
|
82
|
+
- README now documents the profile-based configuration model and the replacement example files
|
|
83
|
+
|
|
84
|
+
## 1.4.7 - 2026-03-11
|
|
85
|
+
|
|
86
|
+
### Added
|
|
87
|
+
- `arapy-install-manpage` helper command to install the bundled `arapy(1)` page into a local `man1` directory after package installation
|
|
88
|
+
- packaged copy of the man page under `arapy/data/man/arapy.1` so the helper works from installed wheels and editable installs
|
|
89
|
+
- package metadata for classifiers, project URLs, and explicit license handling
|
|
90
|
+
- `LICENSE` file and `MANIFEST.in` for cleaner source and binary distributions
|
|
91
|
+
- GitHub Actions workflow to run tests and validate built distributions
|
|
92
|
+
- `build` and `twine` in the `.[dev]` extra for local release validation
|
|
93
|
+
|
|
94
|
+
### Changed
|
|
95
|
+
- README now documents the helper-based `man arapy` setup path
|
|
96
|
+
- README now documents local build and package validation commands
|
|
97
|
+
|
|
98
|
+
## 1.4.6 - 2026-03-11
|
|
99
|
+
|
|
100
|
+
### Added
|
|
101
|
+
- static `arapy(1)` man page at `man/arapy.1` for users who prefer standard Unix CLI documentation
|
|
102
|
+
|
|
103
|
+
### Changed
|
|
104
|
+
- README now points to the bundled man page and shows how to view it locally with `man -l`
|
|
105
|
+
|
|
106
|
+
## 1.4.5 - 2026-03-11
|
|
107
|
+
|
|
108
|
+
### Added
|
|
109
|
+
- property-based fuzz coverage with `hypothesis` for CLI parsing, recursive secret masking, and `calculate_count` query serialization
|
|
110
|
+
|
|
111
|
+
### Changed
|
|
112
|
+
- `hypothesis` is now included in the `.[dev]` extra
|
|
113
|
+
- local `.hypothesis/` state is ignored by git
|
|
114
|
+
|
|
115
|
+
## 1.4.4 - 2026-03-11
|
|
116
|
+
|
|
117
|
+
### Changed
|
|
118
|
+
- `--help` output now suppresses redundant `params:` sections for actions that already expose richer `body fields:` metadata
|
|
119
|
+
- query/path-oriented actions such as `list` and `get` still show `params:` when no body metadata is available
|
|
120
|
+
|
|
121
|
+
## 1.4.3 - 2026-03-11
|
|
122
|
+
|
|
123
|
+
### Fixed
|
|
124
|
+
- raw byte output now treats control-heavy byte streams as binary for console display instead of echoing unreadable control characters
|
|
125
|
+
- `calculate_count` query values are now serialized as lowercase `true` / `false` strings for ClearPass compatibility
|
|
126
|
+
- Swagger GET routes with unresolved placeholder-style base paths are no longer overclassified as `list` actions
|
|
127
|
+
- list endpoint smoke coverage now uses safer default query parameters and skips placeholder-dependent list routes
|
|
128
|
+
|
|
129
|
+
## 1.4.2 - 2026-03-11
|
|
130
|
+
|
|
131
|
+
### Added
|
|
132
|
+
- richer dynamic help metadata from ClearPass docs, including summaries, response codes, response content types, body field lists, and generated body examples when the API docs expose models
|
|
133
|
+
- direct token authentication via `ARAPY_API_TOKEN` / `--api-token=...`
|
|
134
|
+
- token-file authentication via `ARAPY_API_TOKEN_FILE` / `--token-file=...`
|
|
135
|
+
- binary response awareness for dynamically discovered download/export endpoints, including raw output auto-selection and filename inference from response headers
|
|
136
|
+
|
|
137
|
+
### Changed
|
|
138
|
+
- `list` is once again exposed in completion/help output alongside `get`
|
|
139
|
+
- raw output now writes binary payloads as bytes instead of forcing text decoding
|
|
140
|
+
- API catalog cache format bumped to v3 while keeping v2 cache loading compatibility
|
|
141
|
+
|
|
142
|
+
## 1.4.1 - 2026-03-09
|
|
143
|
+
|
|
144
|
+
### Changed
|
|
145
|
+
- removed transitional top-level compatibility wrapper modules
|
|
146
|
+
- moved command handlers into `arapy.cli.commands` so the package layout is now fully aligned with the `cli/core/io/logging` split
|
|
147
|
+
- cleaned the source release to exclude `.git`, `.env`, cache directories, Python bytecode, and `*.egg-info` artifacts
|
|
148
|
+
- updated tests and documentation to target only the v1.4.x module layout
|
|
149
|
+
|
|
150
|
+
## 1.4.0 - 2026-03-09
|
|
151
|
+
|
|
152
|
+
### Added
|
|
153
|
+
- environment-driven settings loader with XDG-style cache/state/output directories
|
|
154
|
+
- new package structure under `cli`, `core`, `io`, and `logging`
|
|
155
|
+
- `.env.example` for local configuration
|
|
156
|
+
- Ruff linting and formatting baseline in `pyproject.toml`
|
|
157
|
+
|
|
158
|
+
### Changed
|
|
159
|
+
- entrypoint now lives in `arapy.cli.main`
|
|
160
|
+
- help rendering moved to `arapy.cli.help`
|
|
161
|
+
- completion logic moved to `arapy.cli.completion`
|
|
162
|
+
- resolver and request/payload building moved into `arapy.core.resolver`
|
|
163
|
+
- response output and file loading split into `arapy.io.output` and `arapy.io.files`
|
|
164
|
+
- logger setup is deterministic and no longer depends on singleton initialization order
|
|
165
|
+
- cache and response output defaults moved out of the repository tree
|
|
166
|
+
- tests now target the action-aware v1.3.1+ API catalog structure
|
|
167
|
+
|
|
168
|
+
### Removed
|
|
169
|
+
- hardcoded ClearPass server and credential values from source control
|
|
170
|
+
- in-tree cache/log directory assumptions as the default runtime behavior
|
|
171
|
+
|
|
172
|
+
## 1.3.1
|
|
173
|
+
|
|
174
|
+
- action-aware API catalog cache
|
|
175
|
+
- parameterized Swagger endpoints preserved in cache
|
|
176
|
+
- normalized single `*_id` placeholders to `{id}`
|
|
177
|
+
- dynamic help and `list` alias for `get --all`
|
|
178
|
+
- configurable secret masking in output
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
Aranya AB Proprietary License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mathias Granlund
|
|
4
|
+
|
|
5
|
+
All rights reserved.
|
|
6
|
+
|
|
7
|
+
This software and its associated documentation are proprietary and
|
|
8
|
+
confidential. No permission is granted to use, copy, modify, merge,
|
|
9
|
+
publish, distribute, sublicense, or sell this software except with prior
|
|
10
|
+
written authorization from the copyright holder.
|
|
11
|
+
|
|
12
|
+
This software is provided "as is", without warranty of any kind, express
|
|
13
|
+
or implied, including but not limited to the warranties of
|
|
14
|
+
merchantability, fitness for a particular purpose, and noninfringement.
|
|
15
|
+
In no event shall the authors or copyright holders be liable for any
|
|
16
|
+
claim, damages, or other liability, whether in an action of contract,
|
|
17
|
+
tort, or otherwise, arising from, out of, or in connection with the
|
|
18
|
+
software or the use or other dealings in the software.
|
|
@@ -0,0 +1,419 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netloom-tool
|
|
3
|
+
Version: 1.6.1
|
|
4
|
+
Summary: Spec-driven network API CLI for operators, with first-class ClearPass support
|
|
5
|
+
Author-email: Mathias Granlund <mathias.granlund@aranya.se>, Mathias Granlund <contact@netloom.se>
|
|
6
|
+
License-Expression: LicenseRef-Proprietary
|
|
7
|
+
Project-URL: Homepage, https://netloom.se
|
|
8
|
+
Project-URL: Repository, https://github.com/mathias-granlund/netloom
|
|
9
|
+
Project-URL: Issues, https://github.com/mathias-granlund/netloom/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/mathias-granlund/netloom/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: clearpass,aruba,cli,rest-api
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: System Administrators
|
|
15
|
+
Classifier: Operating System :: MacOS
|
|
16
|
+
Classifier: Operating System :: POSIX :: Linux
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
22
|
+
Classifier: Topic :: System :: Systems Administration
|
|
23
|
+
Requires-Python: >=3.10
|
|
24
|
+
Description-Content-Type: text/markdown
|
|
25
|
+
License-File: LICENSE
|
|
26
|
+
Requires-Dist: requests>=2.31
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
29
|
+
Requires-Dist: hypothesis>=6.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest>=9.0; extra == "dev"
|
|
31
|
+
Requires-Dist: ruff>=0.15; extra == "dev"
|
|
32
|
+
Requires-Dist: twine>=6.0; extra == "dev"
|
|
33
|
+
Dynamic: license-file
|
|
34
|
+
|
|
35
|
+
# netloom
|
|
36
|
+
|
|
37
|
+
[]()
|
|
38
|
+
[]()
|
|
39
|
+
[]()
|
|
40
|
+
|
|
41
|
+
Weave your network APIs into one CLI.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## About netloom
|
|
46
|
+
|
|
47
|
+
**netloom** is a spec-driven network API CLI for operators and automation engineers. It discovers available API actions from vendor documentation, turns them into a practical command-line interface, and keeps the workflow centered around real operational tasks like listing objects, exporting data, replaying payloads, and copying configuration between environments.
|
|
48
|
+
|
|
49
|
+
Today, netloom is built first and foremost for **HPE Aruba ClearPass Policy Manager**, with strong support for dynamic API discovery, context-aware help, structured output, profile-based server switching, and cross-environment copy workflows. The longer-term direction is broader: a reusable, spec-driven network API CLI that can grow beyond a single vendor without losing the operator-friendly UX that makes it useful day to day.
|
|
50
|
+
|
|
51
|
+
## Highlights
|
|
52
|
+
|
|
53
|
+
- dynamic API discovery through ClearPass `/api-docs`
|
|
54
|
+
- a script-friendly CLI for `get`, `list`, `add`, `delete`, `update`, and `replace`
|
|
55
|
+
- built-in cross-profile `copy` workflows for migration and dry-run planning
|
|
56
|
+
- structured file output for JSON, CSV, or raw responses
|
|
57
|
+
- safe handling of secrets in output and logs
|
|
58
|
+
- shell completion and context-aware help
|
|
59
|
+
- profile-based switching between environments like `dev` and `prod`
|
|
60
|
+
|
|
61
|
+
Version: **1.6.1**
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Recent changes
|
|
66
|
+
|
|
67
|
+
- `netloom-tool` packaging is now ready for Trusted Publishing to PyPI, including a tagged GitHub Actions publish workflow and an in-repo release checklist
|
|
68
|
+
- added the `netloom-install-manpage` helper command while keeping `arapy-install-manpage` available during the transition
|
|
69
|
+
- package metadata now uses the modern Python packaging license fields for cleaner builds and PyPI validation
|
|
70
|
+
- the project is now branded as `netloom`, with `netloom-tool` as the PyPI package name and `netloom` as the primary CLI command
|
|
71
|
+
- the legacy `arapy` command remains available as a compatibility alias during the transition
|
|
72
|
+
- the repository and project links now point to `netloom.se` and `github.com/mathias-granlund/netloom`
|
|
73
|
+
- explicit `--limit` values on `list`, `get --all`, and `copy` are now honored as requested instead of being overridden by automatic paging
|
|
74
|
+
- the bundled Bash completion script now registers completion for both `netloom` and `arapy`
|
|
75
|
+
|
|
76
|
+
Full release history is kept in [CHANGELOG.md](CHANGELOG.md).
|
|
77
|
+
|
|
78
|
+
---
|
|
79
|
+
|
|
80
|
+
## Installation
|
|
81
|
+
|
|
82
|
+
### Development install
|
|
83
|
+
|
|
84
|
+
```bash
|
|
85
|
+
pip install -e .[dev]
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
If `pip` performs a user install on Linux or macOS, the `netloom` and
|
|
89
|
+
`netloom-install-manpage` commands are typically written to `~/.local/bin`.
|
|
90
|
+
Make sure that directory is on your `PATH`:
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
export PATH="$HOME/.local/bin:$PATH"
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
### Standard install
|
|
97
|
+
|
|
98
|
+
```bash
|
|
99
|
+
pip install netloom-tool
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
Or install directly from GitHub:
|
|
103
|
+
|
|
104
|
+
```bash
|
|
105
|
+
pip install git+https://github.com/mathias-granlund/netloom
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
To build release artifacts locally:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
python -m build
|
|
112
|
+
python -m twine check dist/*
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Required environment variables
|
|
118
|
+
|
|
119
|
+
Use per-user profile files under `~/.config/arapy/`, or export environment
|
|
120
|
+
variables directly in your shell.
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
export ARAPY_SERVER="clearpass.example.com:443"
|
|
124
|
+
export ARAPY_CLIENT_ID="your-client-id"
|
|
125
|
+
export ARAPY_CLIENT_SECRET="your-client-secret"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Optional settings:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
export ARAPY_VERIFY_SSL="true"
|
|
132
|
+
export ARAPY_TIMEOUT="30"
|
|
133
|
+
export ARAPY_LOG_LEVEL="INFO"
|
|
134
|
+
export ARAPY_ENCRYPT_SECRETS="true"
|
|
135
|
+
export ARAPY_API_TOKEN="optional-access-token"
|
|
136
|
+
export ARAPY_API_TOKEN_FILE="/path/to/token.json"
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
Example files are included as `profiles.env.example` and
|
|
140
|
+
`credentials.env.example`.
|
|
141
|
+
|
|
142
|
+
Per-user profile files under `~/.config/arapy/` are the recommended way to
|
|
143
|
+
switch between environments like `prod` and `dev` without re-exporting shell
|
|
144
|
+
variables on each run.
|
|
145
|
+
|
|
146
|
+
For this first rename stage, the internal Python package, config directory, and
|
|
147
|
+
environment variable names still use the existing `arapy` / `ARAPY_*`
|
|
148
|
+
conventions for compatibility.
|
|
149
|
+
|
|
150
|
+
Example `~/.config/arapy/profiles.env`:
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
ARAPY_ACTIVE_PROFILE=prod
|
|
154
|
+
ARAPY_SERVER_PROD="clearpass-prod.example.com:443"
|
|
155
|
+
ARAPY_SERVER_DEV="clearpass-dev.example.com:443"
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Example `~/.config/arapy/credentials.env`:
|
|
159
|
+
|
|
160
|
+
```bash
|
|
161
|
+
ARAPY_CLIENT_ID_PROD="prod-client-id"
|
|
162
|
+
ARAPY_CLIENT_SECRET_PROD="prod-client-secret"
|
|
163
|
+
ARAPY_CLIENT_ID_DEV="dev-client-id"
|
|
164
|
+
ARAPY_CLIENT_SECRET_DEV="dev-client-secret"
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Direct environment variables such as `ARAPY_SERVER` and `ARAPY_CLIENT_ID` still
|
|
168
|
+
override the profile files when they are set in the current shell.
|
|
169
|
+
|
|
170
|
+
---
|
|
171
|
+
|
|
172
|
+
## CLI syntax
|
|
173
|
+
|
|
174
|
+
```bash
|
|
175
|
+
netloom <module> <service> list [--key=value] [options]
|
|
176
|
+
netloom <module> <service> get [--all] [--key=value] [options]
|
|
177
|
+
netloom <module> <service> add|delete|update|replace [--key=value] [options]
|
|
178
|
+
netloom copy <module> <service> --from=<profile> --to=<profile> [options]
|
|
179
|
+
netloom cache clear|update
|
|
180
|
+
netloom server list|show
|
|
181
|
+
netloom server use <profile>
|
|
182
|
+
```
|
|
183
|
+
|
|
184
|
+
Examples:
|
|
185
|
+
|
|
186
|
+
```bash
|
|
187
|
+
netloom identities endpoint list --limit=10
|
|
188
|
+
netloom policyelements network-device get --all --limit=25
|
|
189
|
+
netloom policyelements network-device get --id=1001
|
|
190
|
+
netloom policyelements network-device delete --name=switch-01
|
|
191
|
+
netloom policyelements network-device update --id=1001 --description="Core switch"
|
|
192
|
+
netloom copy policyelements network-device --from=dev --to=prod --all --dry-run
|
|
193
|
+
netloom server use prod
|
|
194
|
+
netloom server show
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
Both `--log-level` and the legacy `--log_level` style are accepted. The same applies to flags like `--csv-fieldnames` / `--csv_fieldnames`.
|
|
198
|
+
|
|
199
|
+
Authentication can also be provided per command with:
|
|
200
|
+
|
|
201
|
+
```bash
|
|
202
|
+
netloom identities endpoint list --api-token=your-token
|
|
203
|
+
netloom identities endpoint list --token-file=./token.json
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
The legacy `arapy` command still works during the transition, but new examples
|
|
207
|
+
and docs use `netloom`.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Global options
|
|
212
|
+
|
|
213
|
+
| Option | Description |
|
|
214
|
+
|---|---|
|
|
215
|
+
| `--log-level=LEVEL` | Set logging level |
|
|
216
|
+
| `--console` | Print API response to terminal |
|
|
217
|
+
| `--limit=N` | Page size for list/get --all requests (1-1000 per request) |
|
|
218
|
+
| `--offset=N` | Pagination offset |
|
|
219
|
+
| `--sort=+field` | Sort results |
|
|
220
|
+
| `--filter=JSON` | Server-side filter applied across all fetched pages |
|
|
221
|
+
| `--calculate-count=true/false` | Request total count |
|
|
222
|
+
| `--csv-fieldnames=a,b,c` | Fields and order for CSV output |
|
|
223
|
+
| `--file=FILE` | Bulk import JSON/CSV |
|
|
224
|
+
| `--out=FILE` | Override output file |
|
|
225
|
+
| `--api-token=TOKEN` | Use an existing bearer token instead of logging in |
|
|
226
|
+
| `--token-file=FILE` | Load a bearer token from JSON or plain text |
|
|
227
|
+
| `--help` | Context-aware help |
|
|
228
|
+
| `--version` | Show version |
|
|
229
|
+
| `--encrypt=enable/disable` | Mask or show secret fields |
|
|
230
|
+
| `--decrypt` | Shortcut for showing secrets |
|
|
231
|
+
|
|
232
|
+
---
|
|
233
|
+
|
|
234
|
+
## Dynamic API discovery
|
|
235
|
+
|
|
236
|
+
netloom discovers available ClearPass modules and services at runtime using:
|
|
237
|
+
|
|
238
|
+
- `/api-docs`
|
|
239
|
+
- `/api/apigility/documentation/<Module-v1>`
|
|
240
|
+
|
|
241
|
+
The generated cache stores actions as:
|
|
242
|
+
|
|
243
|
+
```text
|
|
244
|
+
module -> service -> action -> {method, paths, params, response metadata, body hints}
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
When the ClearPass docs include Swagger model details, `netloom --help` now renders:
|
|
248
|
+
|
|
249
|
+
- operation summaries and notes
|
|
250
|
+
- response-code lists
|
|
251
|
+
- response content types
|
|
252
|
+
- generated request body examples and top-level body field descriptions
|
|
253
|
+
|
|
254
|
+
Download-style endpoints that advertise binary response types are written as raw files automatically, and `netloom` will use the server-provided filename when one is supplied.
|
|
255
|
+
|
|
256
|
+
To refresh the cache:
|
|
257
|
+
|
|
258
|
+
```bash
|
|
259
|
+
netloom cache clear
|
|
260
|
+
netloom cache update
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
---
|
|
264
|
+
|
|
265
|
+
## Default cache and output locations
|
|
266
|
+
|
|
267
|
+
v1.4.0 no longer writes cache and response files into the project tree by default.
|
|
268
|
+
|
|
269
|
+
On Linux/macOS the defaults are:
|
|
270
|
+
|
|
271
|
+
```text
|
|
272
|
+
cache: ~/.cache/arapy/
|
|
273
|
+
state: ~/.local/state/arapy/
|
|
274
|
+
responses: ~/.local/state/arapy/responses/
|
|
275
|
+
app logs: ~/.local/state/arapy/logs/
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
These can be overridden with environment variables such as `ARAPY_CACHE_DIR`, `ARAPY_STATE_DIR`, `ARAPY_OUT_DIR`, and `ARAPY_APP_LOG_DIR`.
|
|
279
|
+
|
|
280
|
+
---
|
|
281
|
+
|
|
282
|
+
## Enable tab completion (Bash)
|
|
283
|
+
|
|
284
|
+
Run once per session:
|
|
285
|
+
|
|
286
|
+
```bash
|
|
287
|
+
source /path/to/your/repo/scripts/arapy-completion.bash
|
|
288
|
+
```
|
|
289
|
+
|
|
290
|
+
The bundled completion script currently supports both `netloom` and `arapy`.
|
|
291
|
+
|
|
292
|
+
Or to enable permanently, add to `~/.bashrc` then reload terminal:
|
|
293
|
+
|
|
294
|
+
```bash
|
|
295
|
+
for f in ~/.bash_completion.d/*; do
|
|
296
|
+
[ -r "$f" ] && source "$f"
|
|
297
|
+
done
|
|
298
|
+
|
|
299
|
+
```
|
|
300
|
+
|
|
301
|
+
For zsh:
|
|
302
|
+
|
|
303
|
+
```zsh
|
|
304
|
+
autoload -Uz bashcompinit
|
|
305
|
+
bashcompinit
|
|
306
|
+
source /path/to/your/repo/scripts/arapy-completion.bash
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
---
|
|
310
|
+
|
|
311
|
+
## Architecture
|
|
312
|
+
|
|
313
|
+
```text
|
|
314
|
+
arapy/
|
|
315
|
+
|-- __init__.py
|
|
316
|
+
|-- __main__.py
|
|
317
|
+
|-- cli/
|
|
318
|
+
| |-- commands.py
|
|
319
|
+
| |-- completion.py
|
|
320
|
+
| |-- help.py
|
|
321
|
+
| |-- main.py
|
|
322
|
+
| `-- parser.py
|
|
323
|
+
|-- core/
|
|
324
|
+
| |-- catalog.py
|
|
325
|
+
| |-- client.py
|
|
326
|
+
| |-- config.py
|
|
327
|
+
| `-- resolver.py
|
|
328
|
+
|-- io/
|
|
329
|
+
| |-- files.py
|
|
330
|
+
| `-- output.py
|
|
331
|
+
|-- logging/
|
|
332
|
+
| `-- setup.py
|
|
333
|
+
|-- scripts/
|
|
334
|
+
| `-- arapy-completion.bash
|
|
335
|
+
`-- tests/
|
|
336
|
+
```
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
## Development
|
|
341
|
+
|
|
342
|
+
Run tests:
|
|
343
|
+
|
|
344
|
+
```bash
|
|
345
|
+
pytest -q
|
|
346
|
+
```
|
|
347
|
+
|
|
348
|
+
Property-based fuzz tests are included in the pytest suite via `hypothesis`,
|
|
349
|
+
which is installed as part of:
|
|
350
|
+
|
|
351
|
+
```bash
|
|
352
|
+
pip install -e '.[dev]'
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
Static operator documentation is also available as a bundled man page:
|
|
356
|
+
|
|
357
|
+
```bash
|
|
358
|
+
man -l man/arapy.1
|
|
359
|
+
```
|
|
360
|
+
|
|
361
|
+
To install the bundled man page for normal `man arapy` usage:
|
|
362
|
+
|
|
363
|
+
```bash
|
|
364
|
+
netloom-install-manpage
|
|
365
|
+
man arapy
|
|
366
|
+
```
|
|
367
|
+
|
|
368
|
+
The legacy `arapy-install-manpage` helper still works, and the bundled manpage
|
|
369
|
+
name remains `arapy` during this first transition stage.
|
|
370
|
+
|
|
371
|
+
If your system does not already search `~/.local/share/man`, add it to `MANPATH`.
|
|
372
|
+
|
|
373
|
+
## Server profiles
|
|
374
|
+
|
|
375
|
+
Use the built-in server profile commands to inspect and switch the active
|
|
376
|
+
ClearPass target:
|
|
377
|
+
|
|
378
|
+
```bash
|
|
379
|
+
netloom server list
|
|
380
|
+
netloom server show
|
|
381
|
+
netloom server use prod
|
|
382
|
+
netloom server use dev
|
|
383
|
+
```
|
|
384
|
+
|
|
385
|
+
`netloom server use <profile>` updates `ARAPY_ACTIVE_PROFILE` in
|
|
386
|
+
`~/.config/arapy/profiles.env`. The next `netloom` command resolves
|
|
387
|
+
profile-scoped values such as `ARAPY_SERVER_PROD` and
|
|
388
|
+
`ARAPY_CLIENT_SECRET_PROD` automatically.
|
|
389
|
+
|
|
390
|
+
---
|
|
391
|
+
|
|
392
|
+
## Packaging
|
|
393
|
+
|
|
394
|
+
`netloom` now includes the baseline pieces expected from a releasable Python package:
|
|
395
|
+
|
|
396
|
+
- explicit project metadata, classifiers, and project URLs in `pyproject.toml`
|
|
397
|
+
- a packaged license file
|
|
398
|
+
- wheel and sdist support for the bundled man page
|
|
399
|
+
- a `MANIFEST.in` for predictable source distributions
|
|
400
|
+
- build validation via `python -m build` and `python -m twine check`
|
|
401
|
+
- CI coverage for tests and distribution validation on supported Python versions
|
|
402
|
+
- Trusted Publishing-ready GitHub Actions for tagged PyPI releases
|
|
403
|
+
|
|
404
|
+
Run lint and formatting:
|
|
405
|
+
|
|
406
|
+
```bash
|
|
407
|
+
ruff check .
|
|
408
|
+
ruff format .
|
|
409
|
+
```
|
|
410
|
+
|
|
411
|
+
For the release checklist and Trusted Publishing setup steps, see
|
|
412
|
+
[RELEASING.md](RELEASING.md).
|
|
413
|
+
|
|
414
|
+
---
|
|
415
|
+
|
|
416
|
+
## License
|
|
417
|
+
|
|
418
|
+
Proprietary / Internal Use
|
|
419
|
+
See `LICENSE`.
|