Getting started¶
How to install Pyontapi¶
Prerequisites¶
- Python
- Setuptools
Python¶
Pyontapi works with any version of Python beginning from 2.3 including Python 3.2 as of this writing.
We recommend you use your system’s default Python installation or follow the instructions provided here: http://python.org/download/
If you don’t know which version of Python you have installed you can find out with the following command:
$ python --version
Python 2.6.6
Installing setuptools¶
Download the latest release from http://pypi.python.org/pypi/setuptools and follow the installation instructions.
On Unix you may also use your system’s package for setuptools.
Pyontapi Installation¶
Download the latest release from our download page.
Untar the downloaded file (e.g. tar xzvf Pyontapi-NNN.tar.gz, where NNN is the version number of the latest release). If you’re using Windows, you can download the command-line tool bsdtar to do this, or you can use a GUI-based tool such as 7-zip.
Change into the directory created in step 2 (e.g. cd Pyontapi-NNN).
If you’re using Linux, Mac OS X or some other flavor of Unix, enter the command
sudo python setup.py install
at the shell prompt. If you’re using Windows, start up a command shell with administrator privileges and run the command:
setup.py install
Setting up Pyontapi¶
If you will use Pyontapi in an environment where you have multiple filers and all having the same authentication settings, you may want to use the schtob.pyontapi.Filers interface to control all of them in an easy way. You will learn about this interface later.
Therefore, all you have to do is to edit the settings.py file which is inside the pyontapi folder in your site-packages directory and adjust the NA_CONFIG dictionary.
Parameters:
- user: Login user name (only required for LOGIN authentication style)
- password: Login password (only required for LOGIN authentication style)
- style: Login style. Valid values are LOGIN and HOSTS
- vfiler: The name of the vfiler if desired
- transport_type: Valid values are HTTP and HTTPS
- server_type: Desired server type (Default: Filer). Valid values are Filer, NetCache, DFM, Agent)
See also
Multi-Filer configuration for more details on role based authentication settings.
Setting up the filer¶
Pyontapi uses the ONTAPI interface and in order to use this interface you need to specify a role on your filer having the capability for api-*.
How does Pyontapi create Python methods for all API commands?¶
Pyontapi makes use of the following API commands to generate Python methods that you later can use to invoke API commands on the filer on a very simple and pythonic way:
- system-get-ontapi-version
- system-api-get-elements
- system-api-list
- system-api-list-types
The cool thing is that on initiating a schtob.pyontapi.NaFiler object, Pyontapi looks for all API commands which are available on your storage system and dynamically generates python methods that you can later use to invoke API calls on your storage system.
Listing available API Commands¶
Note
You need to setup Pyontapi’s authentication settings first.
Pyontapi comes with a command line tool that lists all API Commands available on a single filer. Due to NetApp’s security roles, this may differ from filer to filer although both filers have the same ONTAPI version. Open a Terminal and run
pyontapi_list_commands.py
and follow the instructions there. This is just for giving you an overview of what API calls you later can run with Pyontapi.