NetApp Library
raw JSON → 2021.6.25 verified Fri May 01 auth: no python
netapp-lib is a Python library required for Ansible deployments to interact with NetApp storage systems. It provides APIs for managing NetApp ONTAP and E-Series storage. Current version: 2021.6.25. Release cadence is sporadic.
pip install netapp-lib Common errors
error ModuleNotFoundError: No module named 'netapp' ↓
cause Trying to import 'netapp' instead of 'netapp_lib'.
fix
Use 'import netapp_lib' or 'from netapp_lib.api.zapi import NaServer'.
error AttributeError: module 'netapp_lib' has no attribute 'api' ↓
cause The netapp_lib package might be installed but incomplete, or the submodules are not imported automatically.
fix
Install the package correctly: 'pip install netapp-lib' and import explicitly: 'from netapp_lib.api.zapi import NaServer'.
error requests.exceptions.ConnectionError: HTTPSConnectionPool(host='...', port=443): Max retries exceeded ↓
cause NetApp cluster or simulator not reachable or SSL certificate issues.
fix
Verify connectivity, use correct hostname/IP and port. For testing, you can set server.set_transport_type('HTTP') and use port 80, but HTTP is insecure.
Warnings
breaking netapp-lib is shipped with Ansible, but manually installed versions may conflict. Always use the version bundled with your Ansible installation to avoid incompatibility. ↓
fix If using Ansible, do not install netapp-lib separately; use the version that comes with the ansible package.
deprecated This library is in maintenance mode and receives only critical updates. It is replaced by the NetApp Ansible collection's own modules; direct use of netapp-lib is discouraged for new projects. ↓
fix Consider using the NetApp ONTAP REST API directly or the na_ontap_* modules in Ansible.
gotcha The import path uses underscores (netapp_lib) not hyphens (netapp-lib). Many users mistakenly use the PyPI name directly. ↓
fix Use 'import netapp_lib' or 'from netapp_lib.api.zapi import ...'
Imports
- NaServer
from netapp_lib.api.zapi import NaServer - NaElement
from netapp_lib.api.zapi import NaElement
Quickstart
from netapp_lib.api.zapi import NaServer
# Connect to a NetApp ONTAP system
server = NaServer('10.0.0.1', 443)
server.set_transport_type('HTTPS')
server.set_server_type('ONTAP')
# Set admin credentials - in production use environment variables
server.set_admin_user('admin', 'password') # nosec
# Test connection
api = NaElement('system-get-version')
result = server.invoke_element(api)
print(result.to_string())