Skip to main content

Cohesive Networks SDK

Project description

Python Cohesive Networks SDK

contact

Cohesive Networks SDK is Python tool providing access to the VNS3 API from applications written in Python. It also includes common pipelines and macro functions for building network topologies.

VNS3 API version: 4.8

Installation

You can PIP install with

pip install cohesivenet

(you may need to run pip with root permission: sudo pip install cohesivenet)

or Install via Setuptools.

python setup.py install --user

(or sudo python setup.py install to install the package for all users)

Usage

Configuring a Client

import cohesivenet
from pprint import pprint

configuration = cohesivenet.Configuration(
    host='https://[vns3-host]:8000',
    username='api',         
    password='YOUR_PASSWORD',
    verify_ssl=False) # Local cert is used by default. Can add your own cert.
# Configure HTTP basic authorization: basicAuth
configuration.username = 'api'
configuration.password = 'YOUR_PASSWORD'
configuration.host = "https://[vns3-host]:8000"
# Create an instance of the API class
vns3_controller = cohesivenet.VNS3Client(configuration)

try:
    api_response = vns3_controller.config.get_config()
    pprint(api_response)
except cohesivenet.ApiException as e:
    print("Exception fetching VNS3 Configuration get_config(): %s\n" % e)

Methods

All endpoints are documented here. Each sub-api is available from the VNS3Client instance as follows:

vns3_client.config                # ConfigurationApi provides VNS3 config methods
vns3_client.bgp                   # BGPApi for Border Gateway Protocol methods
vns3_client.firewall              # FirewallApi for configuring VNS3 policies
vns3_client.high_availability     # HighAvailabilityApi for configuration HA for VNS3
vns3_client.ipsec                 # IPsecApi for IPsec tunnel methods
vns3_client.interfaces            # InterfacesApi for viewing VNS3 interfaces
vns3_client.monitoring            # MonitoringAlertingApi
vns3_client.network_edge_plugins  # NetworkEdgePluginsApi
vns3_client.overlay_network       # OverlayNetworkApi for managing the overlay network
vns3_client.peering               # PeeringApi for peering VNS3 controllers
vns3_client.routing               # RoutingApi for configuring routing
vns3_client.snapshots             # SnapshotsApi for managing backups
vns3_client.sys_admin             # SystemAdministrationApi for access and sys admin tasks
vns3_client.licensing             # LicensingApi for controller licensing 

Common API patterns: cohesivenet.macros

Many API calls are called together to configure a topology or update a network configuration. More macros will be added to increasingly simplify VNS3 topology creation and configuration. More documentation to come.

macros.admin             # Admin operations typically applied to multiple controllers at once
macros.config            # configuring multiple clients
macros.connect           # connecting to clients
macros.ipsec             # ipsec operations like creating a tunnel and then a route
macros.overlay_network   # overlay network functions like calculating network segments of the overlay
macros.peering           # topology peering operations like creating a peering mesh between controllers
macros.routing           # Operations for updating routing in your topology
macros.state             # Methods for fetching the state of your controller(s)

Logging

The SDK can be configured to emit logs for better visibility into what it's doing. The SDK supports INFO, DEBUG, and ERROR logging.

There are two ways to enable it:

  1. Set the environment variable COHESIVE_LOG_LEVEL to the value debug, info or error

    $ export COHESIVE_LOG_LEVEL=debug
    
  2. Enable it through Python's logging module:

    import logging
    logging.basicConfig()
    logging.getLogger('cohesivenet').setLevel(logging.DEBUG)
    

Author

solutions@cohesive.net

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cohesivenet-0.1.14.tar.gz (143.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

cohesivenet-0.1.14-py3-none-any.whl (384.2 kB view details)

Uploaded Python 3

File details

Details for the file cohesivenet-0.1.14.tar.gz.

File metadata

  • Download URL: cohesivenet-0.1.14.tar.gz
  • Upload date:
  • Size: 143.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.7

File hashes

Hashes for cohesivenet-0.1.14.tar.gz
Algorithm Hash digest
SHA256 f4da69a5102b894511e7ac044b5c9f09ded5e6b60b333a0576cc67ef01a70a97
MD5 81c554e72efc5ec9a6348b6411f3ce37
BLAKE2b-256 b5d42c87ae6f3ba1e8854e719d40ab4ffee44f5e2c268e5527a6fb822c64d030

See more details on using hashes here.

File details

Details for the file cohesivenet-0.1.14-py3-none-any.whl.

File metadata

  • Download URL: cohesivenet-0.1.14-py3-none-any.whl
  • Upload date:
  • Size: 384.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/28.8.0 requests-toolbelt/0.9.1 tqdm/4.36.1 CPython/3.5.7

File hashes

Hashes for cohesivenet-0.1.14-py3-none-any.whl
Algorithm Hash digest
SHA256 eb428d011ea1771c6ad2f6c0c94136561377ec5c1673e10436a099e260eb2169
MD5 f3a86e73249a85ba64b50ca68f92f523
BLAKE2b-256 78adf73bf13d780f6f65d450d027208353fdb0d3b1b37fa0dfb13ea22f9392e5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page