Getting Started — NETLAB+ VE Python SDK 24.2.0 documentation

# 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 or using your favorite package manager. We support versions of python supported by the python organization.

We recommend that you use a virtual environment 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:

    import asyncio
    from pprint import pprint

    from netlab.async_client import NetlabClient

    async def main():
        async with NetlabClient() as connection:
            info = await connection.system_status_get()
            pprint(info)

    if __name__ == "__main__":
        asyncio.run(main())

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.