Skip to main content

TCPWave's IPAM Client


Python client for communication with Tcpwave's IPAM.

Pre-requisites ############## Basic Authentication is not supported. Only certificates based authentication is supported. So client must have a proper certificate and these certificates must be added to IPAM.\

Certificate files required:

  • client certificate.
  • client key.

Supported Operations #################### Following operations are supported:

  • Create/list/detail/delete Network
  • Create/list/detail/delete Subnet
  • Fetches Next Available IP in the Subnet
  • Create/delete IP Object

Installing library ################## Run below command from python virtual environment::

pip install tcpwave-client

Sample Examples ###############

Create Network


Below is a complete program showing the use of this library.
This example shows how to create network in IPAM using this library::

from client.networks import NetworkManager
from client.exceptions import APICallFailedException
import json

def create_network():
    """
    Create test network
    :return:
    """
    try:
        nw_create_payload = {
            'network_address': '153.168.0.0/16',
            'name': 'Test Network 3',
            'organization_name': 'Tcpwave',
            'provider': provider
        }
        rsp = NetworkManager.create_network(network=json.dumps(nw_create_payload))
        print(str(rsp))
    except APICallFailedException as ex:
        print(ex.msg)

if __name__ == "__main__":
    provider = {
        'cert': '/path/to/cert/client.crt',
        'key': '/path/to/key/client.key',
        'host': '192.168.0.116'
    }
    create_network()

List Network


This snippet shows only the complete payload required for thr API call to work for listing all networks::

def networks_list():
    """
    List all networks
    :return:
    """
    try:
        list_payload = {
            'provider': {
                'cert': '/path/to/client.crt',
                'key': '/path/to/client.key',
                'host': '192.168.0.116'
            }
        }
        rsp = NetworkManager.list_all_networks(network=json.dumps(list_payload))
        print("Networks Count : " + str(len(rsp)))
        for i in range(0, len(rsp)):
            print(str(rsp[i]))
    except APICallFailedException as ex:
        print(ex.msg)

Delete Network


This example shows the deletion of a network::

def test_network_delete():
    """
    Deletes given network
    :return:
    """
    try:
        nw_create_payload = {
            'address': '153.168.0.0/16',
            'organization_name': 'Tcpwave',
            'provider': {
                'cert': '/path/to/client.crt',
                'key': '/path/to/client.key',
                'host': '192.168.0.116'
            }
        }
        rsp = NetworkManager.delete_network(network=json.dumps(nw_create_payload))
        print(str(rsp))
    except APICallFailedException as ex:
        print(ex.msg)

Create Subnet


This example shows creation of a subnet::

def subnet_create():
    """
    Creates test subnet
    :return:
    """
    try:
        subnet_payload = {
            'provider': {
                'cert': '/path/to/client.crt',
                'key': '/path/to/client.key',
                'host': '192.168.0.116'
            },
            'organization_name': 'Tcpwave',
            'name': 'Test Subnet 1',
            'router_address': '153.168.0.1',
            'network_address': '153.168.0.0/16',
            'primary_domain': 'test.tcpwave.com'
        }
        rsp = NetworkManager.create_subnet(subnet=json.dumps(subnet_payload))
        print(str(rsp))
    except APICallFailedException as ex:
        print(ex.msg)

Next Free IP


This fetch the next free IP::

def next_available_ip():
    """
    Fetches next available ip
    :return:
    """
    try:
        subnet_payload = {
            'provider': {
                'cert': '/path/to/client.crt',
                'key': '/path/to/client.key',
                'host': '192.168.0.116'
            },
            'organization_name': 'Tcpwave',
            'subnet_address': '153.168.0.0/16'
        }
        rsp = NetworkManager.get_next_available_ip(subnet=json.dumps(subnet_payload))
        print('Next available IP : ', str(rsp))
        return str(rsp)
    except APICallFailedException as ex:
        print(ex.msg)

Creates IP Object


This example shows creating an object.::

def create_object():
    """
    Creates IP Object
    :return:
    """
    try:
        ip_payload = {
            'provider': {
                'cert': '/path/to/client.crt',
                'key': '/path/to/client.key',
                'host': '192.168.0.116'
            },
            'organization_name': 'Tcpwave',
            'subnet_address': '153.168.0.0/16',
            'ip_address': '153.168.0.5',
            'name': 'tst obj  1',
            'domain_name': 'test.tcpwave.com'

        }
        rsp = NetworkManager.create_ip(ip_payload=json.dumps(ip_payload))
        print(str(rsp))
    except APICallFailedException as ex:
        print(ex.msg)

Deletes Object


This example shows deletion of an object::

def delete_object(ip):
    """
    Releases the ip
    :return:
    """
    try:
        ip_payload = {
            'provider': {
                'cert': '/path/to/client.crt',
                'key': '/path/to/client.key',
                'host': '192.168.0.116'
            },
            'organization_name': 'Tcpwave',
            'ip_address': ip
        }
        rsp = NetworkManager.release_ip(ip_payload=json.dumps(ip_payload))
        print(str(rsp))
    except APICallFailedException as ex:
        print(ex.msg)

1.0.2 (2020-04-15)

  • packaging restructure
  • imports reordering for bug fix

1.0.1 (2020-04-15)

  • Updated README.rst with usage examples

1.0.0 (2020-04-15)

  • code cleanup

0.0.1 (2020-04-15)

  • Added connector to send API requests to Tcpwave's IPAM
  • First release on PyPI.
  • Supports operation as follows:
    • Create/list/detail/delete Network
    • Create/list/detail/delete Subnet
    • Fetches Next Available IP in the Subnet
    • Create/delete IP Object

Metadata

Release files for tcpwave-client 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for tcpwave-client 1.0.2
File Size Uploaded Provenance Actions
tcpwave-client-1.0.2.tar.gz 13.1 kB Without provenance Details for tcpwave-client-1.0.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for tcpwave-client 1.0.2
File Interpreter ABI Platform Actions
tcpwave_client-1.0.2-py3.7.egg Legacy Egg format - - Details for tcpwave_client-1.0.2-py3.7.egg

Total release size: 27.1 kB

Release files / tcpwave-client-1.0.2.tar.gz

Download URL tcpwave-client-1.0.2.tar.gz
Size 13.1 kB
Tags Source
SHA-256 checksum
How to use checksums
017f6e76b65d0e5b70e39df0376d5e50ae31583d2d4ca26f6d84fdaadf1c3110
BLAKE2b-256 checksum
How to use checksums
6b542b77e29670c3b05316b31699684fdb96d734777cc5103e7ddd0185e6ae0c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

Release files / tcpwave_client-1.0.2-py3.7.egg

Download URL tcpwave_client-1.0.2-py3.7.egg
Size 14.0 kB
Tags Egg
SHA-256 checksum
How to use checksums
0a4c2ec04d85e0b0ee9922a5f857bcae9fd508a9c9c507a98efd1b9992661135
BLAKE2b-256 checksum
How to use checksums
a99d486de0dced31376a6ab0acbb2ebbabb664fd84e67a238c14ccfbd1f1ff0e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/39.0.1 requests-toolbelt/0.9.1 tqdm/4.45.0 CPython/3.7.5

Security for tcpwave-client 1.0.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page