{"id":6736,"library":"netapp-ontap","title":"NetApp ONTAP Python Client Library","description":"The netapp-ontap Python client library simplifies interaction with NetApp ONTAP's REST APIs. It provides services for connection management, asynchronous request processing, and exception handling, enabling Python developers to quickly automate ONTAP deployments. The library's version aligns with the ONTAP major and minor versions it's generated from, with feature releases typically twice a year (Q2 and Q4) and service updates every 4-12 weeks.","status":"active","version":"9.18.1.0","language":"en","source_language":"en","source_url":"https://docs.netapp.com/us-en/ontap-automation/python/learn-about-pcl.html","tags":["NetApp","ONTAP","REST API","storage management","automation"],"install":[{"cmd":"pip install netapp-ontap","lang":"bash","label":"Install netapp-ontap"}],"dependencies":[{"reason":"Required runtime environment.","package":"python","version":">=3.10"},{"reason":"HTTP client for API communication.","package":"requests","version":">=2.32.4,<3.0.0"},{"reason":"Utilities for requests library.","package":"requests-toolbelt","version":">=1.0.0,<2.0.0"},{"reason":"Object serialization/deserialization.","package":"marshmallow","version":">=3.21.3,<4.0.0"},{"reason":"Manages package imports.","package":"apipkg","version":">=3.0.2"},{"reason":"Strongly suggested for security fixes.","package":"urllib3","version":">=2.2.3","optional":true},{"reason":"Recommended for updated root certificates.","package":"certifi","version":">=2024.8.30","optional":true}],"imports":[{"note":"Used to establish a connection to an ONTAP cluster.","symbol":"HostConnection","correct":"from netapp_ontap import HostConnection"},{"note":"Resource objects like 'Cluster' are typically found in the 'resources' submodule.","wrong":"from netapp_ontap import Cluster","symbol":"Cluster","correct":"from netapp_ontap.resources import Cluster"},{"note":"Resource objects like 'Volume' are typically found in the 'resources' submodule.","symbol":"Volume","correct":"from netapp_ontap.resources import Volume"}],"quickstart":{"code":"import os\nfrom netapp_ontap import HostConnection\nfrom netapp_ontap.resources import Cluster\n\n# Set connection details via environment variables for security\nONTAP_HOST = os.environ.get('ONTAP_HOST', 'your_ontap_cluster_ip_or_hostname')\nONTAP_USER = os.environ.get('ONTAP_USER', 'admin')\nONTAP_PASS = os.environ.get('ONTAP_PASS', 'password')\n\nif ONTAP_HOST == 'your_ontap_cluster_ip_or_hostname':\n    print(\"Please set ONTAP_HOST, ONTAP_USER, and ONTAP_PASS environment variables.\")\n    exit(1)\n\ntry:\n    # Establish a connection\n    HostConnection(ONTAP_HOST, username=ONTAP_USER, password=ONTAP_PASS, verify=False)\n\n    # Get cluster details\n    cluster = Cluster.get_collection(fields='uuid,name')[0]\n\n    print(f\"Successfully connected to ONTAP cluster: {cluster.name} (UUID: {cluster.uuid})\")\nexcept Exception as e:\n    print(f\"Error connecting to ONTAP or retrieving cluster details: {e}\")","lang":"python","description":"This quickstart demonstrates how to establish a connection to an ONTAP cluster using environment variables for credentials and retrieve basic cluster information (name and UUID). It sets `verify=False` for simplicity in the example, but `verify=True` and proper certificate handling are recommended for production environments."},"warnings":[{"fix":"Always refer to the official documentation or use introspection to discover the correct Python property/method name for conflicting ONTAP API fields.","message":"Property names in ONTAP REST API that conflict with Python reserved keywords (e.g., 'class') are transposed by the library (e.g., to 'class_'). Similarly, if an action method name conflicts with a resource field, the action method might be renamed (e.g., 'sign()' to 'sign_action()').","severity":"breaking","affected_versions":"All versions where such conflicts exist."},{"fix":"Ensure your `netapp-ontap` library version's major and minor components (e.g., 9.X.Y) align with or are newer than the target ONTAP cluster's version (e.g., ONTAP 9.X). Always upgrade the library to match or exceed your ONTAP cluster's version for full compatibility.","message":"Client library versions are designed for specific ONTAP releases. A client library with a major version less than the target ONTAP release might not be fully compatible and unable to access newer REST APIs or correctly interpret new fields. The library may ignore unknown fields, return errors, or raise runtime exceptions.","severity":"gotcha","affected_versions":"All versions. Particularly when using an older client library with a newer ONTAP version."},{"fix":"Migrate any automation using `netapp-lib` (ZAPI) to use the `netapp-ontap` client library with ONTAP REST APIs. Consult NetApp's End-of-Availability announcements for ONTAPI.","message":"The `netapp-lib` library, which supported the legacy ONTAP API (ONTAPI/ZAPI), is no longer maintained. While this `netapp-ontap` library focuses on REST APIs, users transitioning from older automation might encounter references to `netapp-lib`.","severity":"deprecated","affected_versions":"N/A (refers to a different library, but relevant for migration)."},{"fix":"Ensure your Python environment and client scripts support modern TLS versions (1.2 or 1.3). If necessary, configure ONTAP to re-enable older TLS protocols (with caution for security implications) or update client systems.","message":"Newer ONTAP versions (e.g., 9.8 and later for TLS 1.0, 9.12.0 and later for TLS 1.1) disable older TLS protocols by default for new installations. For upgraded systems, TLS 1.0/1.1 might be automatically disabled if FIPS is enabled. This can impact connections from older clients or scripts.","severity":"gotcha","affected_versions":"ONTAP 9.8+, 9.11.1+, 9.12.0+"}],"env_vars":null,"last_verified":"2026-04-15T00:00:00.000Z","next_check":"2026-07-14T00:00:00.000Z","problems":[]}