Getting Started
===============

Installation
------------

In order to use the NETLAB+ VE Python SDK, familiarity with Python is required. You can install Python from
the `python website <https://www.python.org/>`_ or using your favorite package manager. We support
versions of python `supported by the python organization <https://www.python.org/downloads/>`_.

We recommend that you use a `virtual environment <https://docs.python.org/3/tutorial/venv.html>`_
but this is not required.

The NETLAB+ VE Python SDK can be installed using::

    pip install https://ndg.tech/netlab-py-latest

Configuration
-------------

Before starting, you must configure a NETLAB+ VE system. You can run ``netlab config add``, which will walk you
through the process of configuring this tool to connect to a NETLAB+ VE system.

For additional configuration, see `netlab.config`.

First NETLAB+ VE Command
------------------------

Create a file named 'main.py' with the following content:

.. literalinclude:: quickstart_1.py

Remember to make sure you are in the python environment, then run `python main.py`.
You should see output that looks like::

    {'cpu_n': '2',
     'hostname': 'ndg-ve-*********.*********.com',
     'sys_lic_exp_date': None,
     'sys_lic_op_state': 'ACTIVE',
     'sys_logins_enabled': True,
     'sys_maint_ends': None,
     'sys_mode': 'NORMAL',
     'sys_name': '',
     'sys_product_id': 'VE',
     'sys_sdn_release_date': datetime.date(2016, 4, 1),
     'sys_sdn_release_type': 'beta',
     'sys_sdn_version': '21.1.2',
     'sys_serial': 'NDG-VE-****-****-****-****',
     'uptime_sec': Decimal('1720907.59')}

You can check your program before running it by using the `mypy` tool. Run `mypy main.py` check the
file we just created. You can use `mypy` to find errors before you ever need to run your program.

See `netlab.api` for a complete list of API methods. See `netlab.async_client.NetlabClient` for
additional info on working with the NETLAB+ VE Python SDK.
