ONTAP administration library and CLI tools
Project description
pynetappfoundry
ONTAP administration library and CLI tools.
Installation
pip install pynetappfoundry
For development:
pip install -e ".[dev]"
CLI Usage
pynetappfoundry provides a single CLI entry point nf with subcommand groups:
# License management
nf licenses check --filter '{"bu":"Business"}'
nf licenses get --config-dir /path/to/config
nf licenses savings --output-dir ./output
# Reports
nf reports space-usage --filter '{"env":"Prod"}'
nf reports locks
nf reports html
# Events
nf events get --filter '{"name":"cluster1"}'
nf events save-azure
# Metrics
nf metrics dump-dii
# Utilities
nf utils validate
nf utils run-cmd "vol show"
nf utils sqlite-to-excel metrics.db
Common Options
All commands support these global options:
--config-dir, -c: Configuration directory path (default:config)--output-dir, -o: Output directory path--debug/--no-debug: Enable debug logging--filter, -f: JSON filter for cluster selection
Filter Syntax
The filter option accepts JSON with AND/OR logic:
# Match all criteria
-f '{"bu":"Business", "env":"Prod", "tags":"active"}'
# AND operator for tags
-f '{"tags":"active && workload"}'
# OR operator
-f '{"app": "app1 || app2"}'
# Multiple clusters by name
-f '{"name":"cluster1 || cluster2"}'
Library Usage
pynetappfoundry can also be used as a library in your own scripts:
from pynetappfoundry import Config, ONTAPAPIClient, ONTAPCLI
from pynetappfoundry.db import MetricDB
from pynetappfoundry.utils import approximate_size
# Load configuration
config = Config("/path/to/config")
clusters = config.get_clusters({"env": "Prod", "bu": "Business"})
# Query clusters
for name, details in clusters.items():
# Using the ONTAP Python SDK (via HostConnection)
user, password = config.get_user("clusters", name)
# Or use the CLI wrapper for SSH commands
cli = ONTAPCLI(name, details["ip"], user, password)
output = cli.run_command("vol show")
cli.disconnect()
# Work with metrics database
db = MetricDB(config)
db.create_table("cluster_metrics")
db.upsert_data("cluster_metrics", {"timestamp": "2024-01-01", "read_ops": 100})
Configuration
Create a config directory with TOML files:
settings.toml
[settings]
[settings.clusters]
searchable_keys = ["name", "bu", "env", "app", "tags"]
[settings.SMTP]
server = "smtp.example.com"
port = 25
user = ""
password = ""
auth = "False"
[settings.licensing]
mailfrom = "netapp-alerts@example.com"
mailto = "admin@example.com"
users.toml
[users.clusters]
user = "admin"
enc = "password"
clusters.toml
[settings]
type = "data"
[clusters.cluster1]
name = "cluster1"
ip = "10.0.0.1"
bu = "Business"
env = "Prod"
tags = ["active", "production"]
[clusters.cluster2]
name = "cluster2"
ip = "10.0.0.2"
bu = "Business"
env = "Dev"
tags = ["active", "development"]
Development
# Clone the repository
git clone https://github.com/endavis/pynetappfoundry.git
cd pynetappfoundry
# Create virtual environment
python -m venv .venv
source .venv/bin/activate # or .venv\Scripts\activate on Windows
# Install in development mode
pip install -e ".[dev]"
# Run tests
pytest
# Run linting
ruff check src/
# Run type checking
mypy src/
License
MIT License - see LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pynetappfoundry-0.1.0.tar.gz.
File metadata
- Download URL: pynetappfoundry-0.1.0.tar.gz
- Upload date:
- Size: 4.5 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
69a9e47b7ebd88c52e0dd6803652a9abf12ac25edd36c2c65f8971bdde227411
|
|
| MD5 |
8520807a1c6ba537821b3440b001511d
|
|
| BLAKE2b-256 |
b990a4d11643b1e0b75b54bebf3228f2a984324916f8a638ca1060695acb1a84
|
Provenance
The following attestation bundles were made for pynetappfoundry-0.1.0.tar.gz:
Publisher:
release.yml on endavis/pynetappfoundry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynetappfoundry-0.1.0.tar.gz -
Subject digest:
69a9e47b7ebd88c52e0dd6803652a9abf12ac25edd36c2c65f8971bdde227411 - Sigstore transparency entry: 1345186143
- Sigstore integration time:
-
Permalink:
endavis/pynetappfoundry@24c86cc8323a86b1cc37b401ada0413f0862dbc1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/endavis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@24c86cc8323a86b1cc37b401ada0413f0862dbc1 -
Trigger Event:
push
-
Statement type:
File details
Details for the file pynetappfoundry-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pynetappfoundry-0.1.0-py3-none-any.whl
- Upload date:
- Size: 1.6 MB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
989de53e60b599307dfeadf7fcf477b2dbc42d5f331ea595d473a5c4bd1dc71a
|
|
| MD5 |
56a3974a6f7f853d1a6ed71cae811219
|
|
| BLAKE2b-256 |
316608da3da5ccf7bfeebab4766998858b6d18f78d1803f520df584681eca490
|
Provenance
The following attestation bundles were made for pynetappfoundry-0.1.0-py3-none-any.whl:
Publisher:
release.yml on endavis/pynetappfoundry
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
pynetappfoundry-0.1.0-py3-none-any.whl -
Subject digest:
989de53e60b599307dfeadf7fcf477b2dbc42d5f331ea595d473a5c4bd1dc71a - Sigstore transparency entry: 1345186206
- Sigstore integration time:
-
Permalink:
endavis/pynetappfoundry@24c86cc8323a86b1cc37b401ada0413f0862dbc1 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/endavis
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@24c86cc8323a86b1cc37b401ada0413f0862dbc1 -
Trigger Event:
push
-
Statement type: