netpicker-cli 0.1.7__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.
Files changed (72) hide show
  1. netpicker_cli-0.1.7/CHANGELOG.md +6 -0
  2. netpicker_cli-0.1.7/CONTRIBUTING.md +6 -0
  3. netpicker_cli-0.1.7/LICENSE +21 -0
  4. netpicker_cli-0.1.7/MANIFEST.in +35 -0
  5. netpicker_cli-0.1.7/PKG-INFO +595 -0
  6. netpicker_cli-0.1.7/README.md +549 -0
  7. netpicker_cli-0.1.7/pyproject.toml +73 -0
  8. netpicker_cli-0.1.7/setup.cfg +4 -0
  9. netpicker_cli-0.1.7/src/netpicker_cli/HTTP_API.md +333 -0
  10. netpicker_cli-0.1.7/src/netpicker_cli/__init__.py +2 -0
  11. netpicker_cli-0.1.7/src/netpicker_cli/api/client.py +207 -0
  12. netpicker_cli-0.1.7/src/netpicker_cli/api/errors.py +20 -0
  13. netpicker_cli-0.1.7/src/netpicker_cli/cli.py +43 -0
  14. netpicker_cli-0.1.7/src/netpicker_cli/commands/auth.py +151 -0
  15. netpicker_cli-0.1.7/src/netpicker_cli/commands/automation.py +1361 -0
  16. netpicker_cli-0.1.7/src/netpicker_cli/commands/backups.py +535 -0
  17. netpicker_cli-0.1.7/src/netpicker_cli/commands/compliance.py +810 -0
  18. netpicker_cli-0.1.7/src/netpicker_cli/commands/compliance_policy.py +610 -0
  19. netpicker_cli-0.1.7/src/netpicker_cli/commands/devices.py +387 -0
  20. netpicker_cli-0.1.7/src/netpicker_cli/commands/health.py +50 -0
  21. netpicker_cli-0.1.7/src/netpicker_cli/commands/whoami.py +116 -0
  22. netpicker_cli-0.1.7/src/netpicker_cli/mcp/README.md +91 -0
  23. netpicker_cli-0.1.7/src/netpicker_cli/mcp/__init__.py +10 -0
  24. netpicker_cli-0.1.7/src/netpicker_cli/mcp/claude-desktop-config.json +12 -0
  25. netpicker_cli-0.1.7/src/netpicker_cli/mcp/server.py +510 -0
  26. netpicker_cli-0.1.7/src/netpicker_cli/utils/cache.py +173 -0
  27. netpicker_cli-0.1.7/src/netpicker_cli/utils/cli_helpers.py +48 -0
  28. netpicker_cli-0.1.7/src/netpicker_cli/utils/command_base.py +51 -0
  29. netpicker_cli-0.1.7/src/netpicker_cli/utils/config.py +164 -0
  30. netpicker_cli-0.1.7/src/netpicker_cli/utils/config_extraction.py +243 -0
  31. netpicker_cli-0.1.7/src/netpicker_cli/utils/files.py +20 -0
  32. netpicker_cli-0.1.7/src/netpicker_cli/utils/helpers.py +324 -0
  33. netpicker_cli-0.1.7/src/netpicker_cli/utils/logging.py +137 -0
  34. netpicker_cli-0.1.7/src/netpicker_cli/utils/output.py +198 -0
  35. netpicker_cli-0.1.7/src/netpicker_cli/utils/pagination.py +47 -0
  36. netpicker_cli-0.1.7/src/netpicker_cli/utils/validation.py +433 -0
  37. netpicker_cli-0.1.7/src/netpicker_cli.egg-info/PKG-INFO +595 -0
  38. netpicker_cli-0.1.7/src/netpicker_cli.egg-info/SOURCES.txt +70 -0
  39. netpicker_cli-0.1.7/src/netpicker_cli.egg-info/dependency_links.txt +1 -0
  40. netpicker_cli-0.1.7/src/netpicker_cli.egg-info/entry_points.txt +3 -0
  41. netpicker_cli-0.1.7/src/netpicker_cli.egg-info/requires.txt +21 -0
  42. netpicker_cli-0.1.7/src/netpicker_cli.egg-info/top_level.txt +1 -0
  43. netpicker_cli-0.1.7/tests/conftest.py +671 -0
  44. netpicker_cli-0.1.7/tests/integration/__init__.py +1 -0
  45. netpicker_cli-0.1.7/tests/integration/test_automation.py +527 -0
  46. netpicker_cli-0.1.7/tests/integration/test_backups.py +418 -0
  47. netpicker_cli-0.1.7/tests/integration/test_backups_diff.py +32 -0
  48. netpicker_cli-0.1.7/tests/integration/test_backups_diff_cli.py +56 -0
  49. netpicker_cli-0.1.7/tests/integration/test_backups_recent.py +17 -0
  50. netpicker_cli-0.1.7/tests/integration/test_cli_smoke.py +11 -0
  51. netpicker_cli-0.1.7/tests/integration/test_client_errors.py +29 -0
  52. netpicker_cli-0.1.7/tests/integration/test_devices.py +350 -0
  53. netpicker_cli-0.1.7/tests/integration/test_devices_delete.py +41 -0
  54. netpicker_cli-0.1.7/tests/integration/test_devices_list.py +17 -0
  55. netpicker_cli-0.1.7/tests/integration/test_devices_list_show.py +34 -0
  56. netpicker_cli-0.1.7/tests/integration/test_edge_cases.py +365 -0
  57. netpicker_cli-0.1.7/tests/integration/test_health.py +22 -0
  58. netpicker_cli-0.1.7/tests/integration/test_integration_workflow.py +303 -0
  59. netpicker_cli-0.1.7/tests/integration/test_mcp_server.py +183 -0
  60. netpicker_cli-0.1.7/tests/integration/test_mcp_tools_enhanced.py +395 -0
  61. netpicker_cli-0.1.7/tests/mocks/__init__.py +356 -0
  62. netpicker_cli-0.1.7/tests/mocks/test_mcp_tools.py +51 -0
  63. netpicker_cli-0.1.7/tests/unit/__init__.py +1 -0
  64. netpicker_cli-0.1.7/tests/unit/test_api_client_context.py +140 -0
  65. netpicker_cli-0.1.7/tests/unit/test_callbacks.py +366 -0
  66. netpicker_cli-0.1.7/tests/unit/test_config_load.py +16 -0
  67. netpicker_cli-0.1.7/tests/unit/test_extraction.py +582 -0
  68. netpicker_cli-0.1.7/tests/unit/test_parameter_extraction.py +229 -0
  69. netpicker_cli-0.1.7/tests/unit/test_properties_json.py +85 -0
  70. netpicker_cli-0.1.7/tests/unit/test_properties_network.py +41 -0
  71. netpicker_cli-0.1.7/tests/unit/test_properties_params.py +150 -0
  72. netpicker_cli-0.1.7/tests/unit/test_utils_files.py +8 -0
@@ -0,0 +1,6 @@
1
+ # Changelog
2
+
3
+ ## 0.1.0 — Initial public MVP
4
+ - `health`, `devices list|show`
5
+ - `backups recent|list|fetch|commands|search (fallback)`
6
+ - keyring-based auth, XDG config
@@ -0,0 +1,6 @@
1
+ # Contributing
2
+
3
+ ## Dev setup
4
+ ```bash
5
+ python -m venv venv && source venv/bin/activate
6
+ pip install -e ".[dev]"
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025-2026 Netpicker
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
@@ -0,0 +1,35 @@
1
+ # Include these files in the source distribution
2
+ include LICENSE
3
+ include README.md
4
+ include CHANGELOG.md
5
+ include CONTRIBUTING.md
6
+ include pyproject.toml
7
+
8
+ # Include source code
9
+ recursive-include src *.py
10
+ recursive-include src *.md
11
+ recursive-include src *.json
12
+
13
+ # Include tests (optional - remove if you don't want tests in sdist)
14
+ recursive-include tests *.py
15
+
16
+ # Exclude sensitive and development files
17
+ exclude hostname_search.json
18
+ exclude sample.json
19
+ exclude test_mistral_integration.py
20
+ exclude README.md.backup
21
+
22
+ # Exclude directories
23
+ prune backups
24
+ prune .git
25
+ prune .github
26
+ prune .hypothesis
27
+ prune .mypy_cache
28
+ prune .pytest_cache
29
+ prune .ruff_cache
30
+ prune __pycache__
31
+ prune dist
32
+ prune build
33
+ prune venv
34
+ prune examples
35
+ prune *.egg-info
@@ -0,0 +1,595 @@
1
+ Metadata-Version: 2.4
2
+ Name: netpicker-cli
3
+ Version: 0.1.7
4
+ Summary: Netpicker CLI for devices and backups
5
+ Author-email: Netpicker Team <support@netpicker.io>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://netpicker.io
8
+ Project-URL: Documentation, https://github.com/netpicker/netpicker-cli#readme
9
+ Project-URL: Repository, https://github.com/netpicker/netpicker-cli
10
+ Project-URL: Issues, https://github.com/netpicker/netpicker-cli/issues
11
+ Project-URL: Changelog, https://github.com/netpicker/netpicker-cli/blob/main/CHANGELOG.md
12
+ Keywords: netpicker,network,cli,automation,configuration,backup
13
+ Classifier: Development Status :: 4 - Beta
14
+ Classifier: Environment :: Console
15
+ Classifier: Intended Audience :: System Administrators
16
+ Classifier: Intended Audience :: Developers
17
+ Classifier: Operating System :: OS Independent
18
+ Classifier: Programming Language :: Python :: 3
19
+ Classifier: Programming Language :: Python :: 3.11
20
+ Classifier: Programming Language :: Python :: 3.12
21
+ Classifier: Topic :: System :: Networking
22
+ Classifier: Topic :: System :: Systems Administration
23
+ Requires-Python: >=3.11
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: typer>=0.12.5
27
+ Requires-Dist: mcp>=1.0.0
28
+ Requires-Dist: httpx>=0.27
29
+ Requires-Dist: pydantic>=2.8
30
+ Requires-Dist: keyring>=25.2.1
31
+ Requires-Dist: python-dotenv>=1.0.1
32
+ Requires-Dist: tabulate>=0.9.0
33
+ Requires-Dist: PyYAML>=6.0.1
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=8; extra == "dev"
36
+ Requires-Dist: respx>=0.21.1; extra == "dev"
37
+ Requires-Dist: pytest-cov>=5; extra == "dev"
38
+ Requires-Dist: hypothesis>=6; extra == "dev"
39
+ Requires-Dist: ruff>=0.6; extra == "dev"
40
+ Requires-Dist: black>=24; extra == "dev"
41
+ Requires-Dist: mypy>=1.11; extra == "dev"
42
+ Requires-Dist: types-tabulate>=0.9.0.20240106; extra == "dev"
43
+ Provides-Extra: mcp
44
+ Requires-Dist: mcp>=1.0.0; extra == "mcp"
45
+ Dynamic: license-file
46
+
47
+ # Netpicker CLI
48
+
49
+ A comprehensive command-line interface for Netpicker API — empowering network engineers with powerful automation, compliance management, and device operations through both traditional CLI and AI-assisted workflows.
50
+
51
+ ## ✨ Key Features
52
+
53
+ - **Device Management**: List, create, show, and delete network devices
54
+ - **Backup Operations**: Upload, fetch, search, and compare device configurations
55
+ - **Compliance Management**: Create policies, add rules, run compliance checks, and generate reports
56
+ - **Automation**: Execute jobs, manage queues, store and test automation scripts
57
+ - **MCP Server**: Integrate with AI assistants like Claude for natural language network management
58
+ - **Health Monitoring**: System status checks and user authentication verification
59
+
60
+ ---
61
+
62
+ ## 🚀 Installation & Setup
63
+
64
+ ### Production Install
65
+
66
+ ```bash
67
+ pip install netpicker-cli[mcp]
68
+ ```
69
+
70
+ ### Development Install
71
+
72
+ ```bash
73
+ git clone <repository-url>
74
+ cd netpicker-cli
75
+ python -m venv venv && source venv/bin/activate
76
+ pip install -e ".[dev,mcp]"
77
+ ```
78
+
79
+ > **Linux Keyring Note**: If you encounter keyring issues on Linux, install the alternative backend:
80
+ > ```bash
81
+ > pip install keyrings.alt
82
+ > export PYTHON_KEYRING_BACKEND=keyrings.alt.file.PlaintextKeyring
83
+ > ```
84
+
85
+ ### Configuration & Authentication
86
+
87
+ #### Recommended: Interactive Login
88
+
89
+ ```bash
90
+ netpicker auth login \
91
+ --base-url https://YOUR-NETPICKER-URL \
92
+ --tenant YOUR_TENANT \
93
+ --token YOUR_API_TOKEN
94
+ ```
95
+
96
+ This securely stores your token in the OS keyring and saves URL/tenant to `~/.config/netpicker/config.json`.
97
+
98
+ #### Alternative: Environment Variables
99
+
100
+ **Unix/macOS:**
101
+ ```bash
102
+ export NETPICKER_BASE_URL="https://YOUR-NETPICKER-URL"
103
+ export NETPICKER_TENANT="YOUR_TENANT"
104
+ export NETPICKER_TOKEN="YOUR_API_TOKEN"
105
+ ```
106
+
107
+ **Windows PowerShell:**
108
+ ```powershell
109
+ $env:NETPICKER_BASE_URL = "https://YOUR-NETPICKER-URL"
110
+ $env:NETPICKER_TENANT = "YOUR_TENANT"
111
+ $env:NETPICKER_TOKEN = "YOUR_API_TOKEN"
112
+ ```
113
+
114
+ #### Optional Settings
115
+
116
+ ```bash
117
+ export NETPICKER_TIMEOUT=30 # Request timeout in seconds
118
+ export NETPICKER_INSECURE=1 # Skip TLS verification (use with caution)
119
+ export NETPICKER_VERBOSE=1 # Enable verbose debug logging
120
+ export NETPICKER_QUIET=1 # Suppress informational output
121
+ ```
122
+
123
+ > Environment variables override config file values when set.
124
+
125
+ ### Logging & Output Control
126
+
127
+ Netpicker CLI provides flexible logging and output control:
128
+
129
+ ```bash
130
+ # Normal output (default)
131
+ netpicker devices list
132
+
133
+ # Verbose mode - shows debug information and API calls
134
+ netpicker --verbose devices list
135
+
136
+ # Quiet mode - suppresses informational messages, shows only errors
137
+ netpicker --quiet devices list
138
+
139
+ # Environment variables for persistent settings
140
+ export NETPICKER_VERBOSE=1 # Always enable verbose mode
141
+ export NETPICKER_QUIET=1 # Always enable quiet mode
142
+ ```
143
+
144
+ **Logging Levels:**
145
+ - **Normal**: Clean CLI output without log prefixes
146
+ - **Verbose**: Detailed debug information including API calls, response times, and full stack traces
147
+ - **Quiet**: Only error and critical messages are displayed
148
+
149
+ ### Quick Health Check
150
+
151
+ ```bash
152
+ netpicker health
153
+ netpicker whoami --json | jq .
154
+ ```
155
+
156
+ ---
157
+
158
+ ## 📋 Device Management
159
+
160
+ NetPicker CLI provides comprehensive device inventory management capabilities.
161
+
162
+ ### Commands
163
+
164
+ ```bash
165
+ netpicker devices list [--tag TAG] [--format FORMAT] [--limit N] [--offset M] [--all] [--parallel P]
166
+ netpicker devices show <IP/FQDN> [--format FORMAT]
167
+ netpicker devices create <IP> [--name HOSTNAME] [--platform PLATFORM] [--port PORT] [--vault VAULT] [--tags TAGS] [--format FORMAT]
168
+ netpicker devices delete <IP/FQDN> [--force]
169
+ ```
170
+
171
+ ### Examples
172
+
173
+ ```bash
174
+ # List first 10 devices in table format
175
+ netpicker devices list --limit 10
176
+
177
+ # List devices with JSON output
178
+ netpicker devices list --format json
179
+
180
+ # Show device details in JSON
181
+ netpicker devices show 192.168.1.1 --format json
182
+
183
+ # Create a new device with tags
184
+ netpicker devices create 10.0.0.1 --name router01 --platform cisco_ios --vault default --tags "production,core"
185
+
186
+ # Create a device with custom vault
187
+ netpicker devices create 10.0.0.2 --name switch01 --platform cisco_nxos --vault my-vault --port 22
188
+
189
+ # List devices filtered by tag
190
+ netpicker devices list --tag production
191
+
192
+ # List all devices with parallel fetching (faster for large datasets)
193
+ netpicker devices list --all --parallel 5
194
+
195
+ # Delete a device (with confirmation prompt)
196
+ netpicker devices delete 192.168.1.1
197
+
198
+ # Delete a device without confirmation
199
+ netpicker devices delete 192.168.1.1 --force
200
+
201
+ # Export device list to CSV
202
+ netpicker devices list --format csv --output devices.csv
203
+
204
+ # Export device list to YAML
205
+ netpicker devices list --format yaml > devices.yaml
206
+ ```
207
+
208
+ ---
209
+
210
+ ## 💾 Backup Operations
211
+
212
+ Manage device configuration backups, compare versions, and search through backup history.
213
+
214
+ ### Commands
215
+
216
+ ```bash
217
+ netpicker backups recent [--limit N] [--format FORMAT] # Recent backups across all devices
218
+ netpicker backups list <IP/FQDN> [--page N] [--size N] [--all] [--parallel P] [--format FORMAT] # List backups for device
219
+ netpicker backups history <IP/FQDN> [--limit N] [--format FORMAT] # Backup history for device
220
+ netpicker backups upload <IP/FQDN> --file <FILE> # Upload config backup
221
+ netpicker backups diff <IP/FQDN> [--id-a ID] [--id-b ID] [--context N] [--format FORMAT]
222
+ netpicker backups fetch <IP/FQDN> --id <CONFIG_ID> [--output DIR] # Download specific config
223
+ netpicker backups search [--q TEXT] [--device IP] [--since TS] [--limit N] [--format FORMAT]
224
+ netpicker backups commands [--platform <name>] [--format FORMAT] # Show backup commands for platform
225
+ ```
226
+
227
+ ### Examples
228
+
229
+ ```bash
230
+ # View recent backups across all devices
231
+ netpicker backups recent --limit 20
232
+
233
+ # List backups for a specific device
234
+ netpicker backups list 192.168.1.1
235
+
236
+ # List all backups for a device with parallel fetching
237
+ netpicker backups list 192.168.1.1 --all --parallel 5
238
+
239
+ # Compare latest two configs for a device
240
+ netpicker backups diff 192.168.1.1
241
+
242
+ # Compare specific config versions
243
+ netpicker backups diff 192.168.1.1 --id-a config-id-1 --id-b config-id-2
244
+
245
+ # Search for configs containing specific text
246
+ netpicker backups search --q "interface GigabitEthernet" --device 192.168.1.1
247
+
248
+ # Upload a configuration backup
249
+ netpicker backups upload 192.168.1.1 --file router-config.txt
250
+
251
+ # View backup history for a device
252
+ netpicker backups history 192.168.1.1 --limit 10
253
+
254
+ # Show backup command templates for a platform
255
+ netpicker backups commands --platform cisco_ios
256
+
257
+ # Export backup as JSON
258
+ netpicker backups recent --format json > recent_backups.json
259
+ ```
260
+
261
+ ---
262
+
263
+ ## 📜 Compliance Policy Management
264
+
265
+ Create and manage compliance policies with customizable rules for network security and configuration standards.
266
+
267
+ ### Commands
268
+
269
+ ```bash
270
+ netpicker policy list [--format FORMAT] # List compliance policies
271
+ netpicker policy show --name <NAME> [--format FORMAT] # Show policy details
272
+ netpicker policy create --name <NAME> [--description DESC] # Create new policy
273
+ netpicker policy update --name <NAME> [--description DESC] # Update policy
274
+ netpicker policy replace --name <NAME> --file <FILE> # Replace policy from file
275
+ netpicker policy add-rule <POLICY> --name <NAME> [options...] # Add rule to policy
276
+ netpicker policy remove-rule --name <POLICY> --rule-name <NAME> # Remove rule from policy
277
+ netpicker policy test-rule <POLICY> --name <NAME> --ip <IP> --config <CONFIG> [options...] # Test rule against config
278
+ netpicker policy execute-rules [--devices <DEVICES>] [--policies <POLICIES>] [--rules <RULES>] [--tags <TAGS>] # Execute all policy rules
279
+ ```
280
+
281
+ ### Examples
282
+
283
+ ```bash
284
+ # List all policies
285
+ netpicker policy list
286
+
287
+ # List policies in JSON format
288
+ netpicker policy list --format json
289
+
290
+ # Show policy details
291
+ netpicker policy show --name security-policy
292
+
293
+ # Create a security policy
294
+ netpicker policy create --name security-policy --description "Network security compliance"
295
+
296
+ # Add a compliance rule to check for telnet (must NOT be present)
297
+ netpicker policy add-rule security-policy --name rule_no_telnet \
298
+ --commands '{"show running-config": ["interface *", "line vty *"]}' \
299
+ --simplified-text "transport input telnet" --simplified-invert
300
+
301
+ # Add a rule requiring SSH on VTY lines
302
+ netpicker policy add-rule security-policy --name rule_ssh_required \
303
+ --commands '{"show running-config": ["line vty *"]}' \
304
+ --simplified-text "transport input ssh"
305
+
306
+ # Add a regex-based rule for password complexity
307
+ netpicker policy add-rule security-policy --name rule_password_complexity \
308
+ --commands '{"show running-config": ["enable secret"]}' \
309
+ --simplified-text "enable secret [0-9]" --simplified-regex
310
+
311
+ # Remove a rule from a policy
312
+ netpicker policy remove-rule --name security-policy --rule-name rule_no_telnet
313
+
314
+ # Test a rule against a configuration
315
+ netpicker policy test-rule security-policy --name rule_no_telnet \
316
+ --ip 192.168.1.1 --config "interface GigabitEthernet0/1
317
+ line vty 0 4
318
+ transport input ssh"
319
+
320
+ # Execute compliance rules against all devices
321
+ netpicker policy execute-rules
322
+
323
+ # Execute rules against specific devices
324
+ netpicker policy execute-rules --devices 192.168.1.1,192.168.1.2
325
+
326
+ # Execute rules against devices with specific tags
327
+ netpicker policy execute-rules --tags production,core
328
+
329
+ # Update a policy description
330
+ netpicker policy update --name security-policy --description "Updated security policy v2"
331
+ ```
332
+
333
+ ---
334
+
335
+ ## ✅ Compliance Testing
336
+
337
+ Run compliance checks against device configurations and generate detailed reports.
338
+
339
+ ### Commands
340
+
341
+ ```bash
342
+ netpicker compliance overview [--format FORMAT] # Compliance overview
343
+ netpicker compliance report-tenant [--policy POLICY] [--format FORMAT] # Tenant-wide compliance report
344
+ netpicker compliance devices [--ip IP] [--policy POLICY] [--format FORMAT] # Device compliance status
345
+ netpicker compliance export [--format FORMAT] [-o FILE] # Export compliance data
346
+ netpicker compliance status [--policy POLICY] [--format FORMAT] # Compliance status summary
347
+ netpicker compliance failures [--limit N] [--format FORMAT] # List compliance failures
348
+ netpicker compliance log [--policy POLICY] [--limit N] [--format FORMAT] # Compliance check logs
349
+ netpicker compliance report-config --config-id <ID> [--format FORMAT] # Config compliance report
350
+ ```
351
+
352
+ ### Examples
353
+
354
+ ```bash
355
+ # Check compliance overview
356
+ netpicker compliance overview
357
+
358
+ # Check compliance status for a specific device
359
+ netpicker compliance status 192.168.1.1
360
+
361
+ # Generate tenant-wide compliance report
362
+ netpicker compliance report-tenant --format json > compliance_report.json
363
+
364
+ # Generate report for a specific policy
365
+ netpicker compliance report-tenant --policy security-policy
366
+
367
+ # List devices with compliance information
368
+ netpicker compliance devices
369
+
370
+ # List devices with specific policy compliance
371
+ netpicker compliance devices --policy security-policy
372
+
373
+ # Check compliance for a specific device
374
+ netpicker compliance devices --ipaddress 192.168.1.1
375
+
376
+ # View compliance failures (most recent)
377
+ netpicker compliance failures --limit 20
378
+
379
+ # View compliance check logs
380
+ netpicker compliance log --limit 10
381
+
382
+ # View logs for a specific policy
383
+ netpicker compliance log --policy security-policy
384
+
385
+ # Export compliance data to file
386
+ netpicker compliance export --format json -o compliance_export.json
387
+
388
+ # Generate config-specific compliance report
389
+ netpicker compliance report-config --config-id config-123
390
+
391
+ # Export compliance status as JSON
392
+ netpicker compliance status 192.168.1.1 --format json
393
+ ```
394
+
395
+ ---
396
+
397
+ ## ⚙️ Automation
398
+
399
+ Execute automation jobs, manage job queues, and monitor automation execution.
400
+
401
+ ### Commands
402
+
403
+ ```bash
404
+ netpicker automation list-fixtures [--format FORMAT] # List available fixtures
405
+ netpicker automation list-jobs [--pattern PATTERN] [--format FORMAT] # List automation jobs
406
+ netpicker automation store-job --name <NAME> --job-config <JSON> # Store automation job
407
+ netpicker automation store-job-file --name <NAME> --file <FILE> # Store job from file
408
+ netpicker automation show-job --name <NAME> [--format FORMAT] # Show job details
409
+ netpicker automation delete-job --name <NAME> [--force] # Delete automation job
410
+ netpicker automation test-job --name <NAME> [--fixtures JSON] # Test automation job
411
+ netpicker automation execute-job --name <NAME> [options...] # Execute automation job
412
+ netpicker automation logs [--job JOB] [--limit N] [--format FORMAT] # View automation logs
413
+ netpicker automation show-log --id <LOG_ID> [--format FORMAT] # Show specific log entry
414
+ netpicker automation list-queue [--format FORMAT] # List job queues
415
+ netpicker automation store-queue --name <NAME> --queue-config <JSON> # Store job queue
416
+ netpicker automation show-queue --name <NAME> [--format FORMAT] # Show queue details
417
+ netpicker automation delete-queue --name <NAME> [--force] # Delete job queue
418
+ netpicker automation review-queue --name <NAME> [--format FORMAT] # Review queue status
419
+ ```
420
+
421
+ ### Examples
422
+
423
+ ```bash
424
+ # List available fixtures (predefined variables)
425
+ netpicker automation list-fixtures
426
+
427
+ # List available jobs
428
+ netpicker automation list-jobs
429
+
430
+ # List jobs matching a pattern
431
+ netpicker automation list-jobs --pattern health
432
+
433
+ # Show details of a specific job
434
+ netpicker automation show-job --name network-health-check
435
+
436
+ # Execute a health check job on all devices
437
+ netpicker automation execute-job --name network-health-check
438
+
439
+ # Execute a job on specific devices
440
+ netpicker automation execute-job --name backup-config --targets 192.168.1.1,192.168.1.2
441
+
442
+ # Execute a job on devices with specific tags
443
+ netpicker automation execute-job --name security-audit --tags production
444
+
445
+ # Execute a job with custom variables
446
+ netpicker automation execute-job --name custom-script --variables "timeout:30;retry:3"
447
+
448
+ # Test a job before execution
449
+ netpicker automation test-job --name network-health-check
450
+
451
+ # View automation logs (most recent)
452
+ netpicker automation logs --limit 10
453
+
454
+ # View logs for a specific job
455
+ netpicker automation logs --job network-health-check --limit 5
456
+
457
+ # Show details of a specific log entry
458
+ netpicker automation show-log --id log-123
459
+
460
+ # Store a new automation job from a file
461
+ netpicker automation store-job-file --name my-job --file job_config.py
462
+
463
+ # Delete an automation job
464
+ netpicker automation delete-job --name old-job
465
+
466
+ # List queued jobs
467
+ netpicker automation list-queue
468
+
469
+ # Review and approve a queued job
470
+ netpicker automation review-queue --name pending-job
471
+
472
+ # Export job list as JSON
473
+ netpicker automation list-jobs --format json > jobs.json
474
+ ```
475
+
476
+ ---
477
+
478
+ ## 🤖 Model Context Protocol (MCP) Server
479
+
480
+ NetPicker CLI includes a built-in MCP server that enables AI assistants like Claude to interact with your network infrastructure through natural language conversations.
481
+
482
+ #### Quick MCP Setup
483
+
484
+ ```bash
485
+ # Install with MCP support
486
+ pip install -e ".[mcp]"
487
+
488
+ # Configure for Claude Desktop
489
+ # Add to your claude_desktop_config.json:
490
+ {
491
+ "mcpServers": {
492
+ "netpicker": {
493
+ "command": "netpicker-mcp",
494
+ "env": {
495
+ "NETPICKER_BASE_URL": "https://your-netpicker-instance.com",
496
+ "NETPICKER_TENANT": "your-tenant",
497
+ "NETPICKER_TOKEN": "your-api-token"
498
+ }
499
+ }
500
+ }
501
+ }
502
+ ```
503
+
504
+ #### MCP Tools Available
505
+
506
+ **Device Management:**
507
+ - `devices_list` - List network devices with filtering options
508
+ - `devices_show` - Display detailed device information
509
+ - `devices_create` - Create new network devices
510
+ - `devices_delete` - Remove devices from inventory
511
+
512
+ **Backup Management:**
513
+ - `backups_upload` - Upload device configurations
514
+ - `backups_history` - View backup history for devices
515
+ - `backups_diff` - Compare configuration versions
516
+
517
+ **Compliance & Policy:**
518
+ - `policy_list` - List compliance policies
519
+ - `policy_create` - Create new compliance policies
520
+ - `policy_add_rule` - Add rules to policies
521
+ - `policy_test_rule` - Test rules against configurations
522
+
523
+ **Automation:**
524
+ - `automation_list_jobs` - List available automation jobs
525
+ - `automation_execute_job` - Execute automation jobs
526
+
527
+ #### AI Assistant Examples
528
+
529
+ Once configured, you can ask Claude things like:
530
+ - *"Show me the first 10 devices"*
531
+ - *"Create a backup of router 192.168.1.1"*
532
+ - *"Check if this config complies with our security policy"*
533
+ - *"Execute the network health check automation job"*
534
+ - *"List all devices that failed compliance in the last 24 hours"*
535
+
536
+ ---
537
+
538
+ ## 🐛 Troubleshooting
539
+
540
+ ### Common Issues
541
+
542
+ **"No token found"**
543
+ - Run `netpicker auth login` or set `NETPICKER_TOKEN` environment variable
544
+
545
+ **403 Forbidden**
546
+ - Verify tenant name matches your API token's scope
547
+ - Ensure token has `access:api` permissions
548
+
549
+ **Connection timeouts**
550
+ - Check `NETPICKER_BASE_URL` is correct
551
+ - Adjust `NETPICKER_TIMEOUT` if needed (default: 30s)
552
+
553
+ **Large result sets**
554
+ - API responses are paginated by default
555
+ - Use `--all` flag to fetch all results (may take time)
556
+ - Or use `--limit` and `--offset` for manual pagination
557
+
558
+ **Keyring issues on Linux**
559
+ - Install alternative keyring: `pip install keyrings.alt`
560
+ - Set: `export PYTHON_KEYRING_BACKEND=keyrings.alt.file.PlaintextKeyring`
561
+
562
+ ---
563
+
564
+ ## 🤝 Contributing
565
+
566
+ 1. Fork the repository
567
+ 2. Create a feature branch
568
+ 3. Make your changes
569
+ 4. Add tests for new functionality
570
+ 5. Run the test suite: `pytest`
571
+ 6. Submit a pull request
572
+
573
+ ### Development Setup
574
+
575
+ ```bash
576
+ git clone <repository-url>
577
+ cd netpicker-cli
578
+ python -m venv venv && source venv/bin/activate
579
+ pip install -e ".[dev,mcp]"
580
+ pytest # Run tests
581
+ ruff check . # Lint code
582
+ black . # Format code
583
+ ```
584
+
585
+ ---
586
+
587
+ ## 📄 License
588
+
589
+ MIT License - see LICENSE file for details.
590
+
591
+ ## 📞 Support
592
+
593
+ - Documentation: [GitHub Repository](https://github.com/netpicker/netpicker-cli)
594
+ - Issues: [GitHub Issues](https://github.com/netpicker/netpicker-cli/issues)
595
+ - Support: support@netpicker.io