Skip to main content

A unified REST API to provide vendor-agnostic network automation

Project description

Build Status Documentation Status PyPI version

Netman

Netman is a unified REST API that provides vendor-agnostic network automation. It abstracts the vendor-specific bits and leaves you with a clean and simplified API.

Python code usage

switch_factory = SwitchFactory(MemoryStorage(), ThreadingLockFactory())
switch = switch_factory.get_anonymous_switch(
    model="cisco", 
    hostname="hostname_or_ip", 
    username="username", 
    password="password", 
)

switch.add_vlan(1000, name="myvlan")

REST API usage

First, start the service

tox
.tox/py27/bin/python netman/main.py
 * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

Then you can access it by http

curl -X POST http://127.0.0.1:5000/switches/hostname_or_ip/vlans -d '{"number": 1000, "name": "myvlan"}' 
    -H "Content-Type: application/json" 
    -H "Netman-model: cisco" 
    -H "Netman-username: username" 
    -H "Netman-password: password"

Disaggregated mode

Netman supports a disaggregated mode. This is a special mode of operation where netman will use a remote netman server to access the network equipment. This mode is particularly useful in the case where your network equipment is not available to your main netman server. You can start a server somewhere, let's say at 192.168.1.1, running netman as described above. And use the proxy like this for direct code usage :

switch_factory = SwitchFactory(MemoryStorage(), ThreadingLockFactory())
switch = switch_factory.get_anonymous_switch(
    model="cisco", 
    hostname="hostname_or_ip", 
    username="username", 
    password="password", 
    netman_server="http://192.168.1.1")

switch.add_vlan(1000, name="myvlan")

Or when invoked using the REST API, you can call the main server and provide the proxy netman server to be used.

curl -X POST http://127.0.0.1:5000/switches/hostname_or_ip/vlans -d '{"number": 1000, "name": "myvlan"}' 
    -H "Content-Type: application/json" 
    -H "Netman-model: cisco" 
    -H "Netman-username: username" 
    -H "Netman-password: password"
    -H "Netman-Proxy-Server: http://192.168.1.1"

Docker usage

From your computer, start a Netman container and a fake-switch container in order to mock a switch Netman will configure.

$ docker-compose up -d

Create a Vlan

curl -X POST http://localhost:32771/switches/netman_tsr1.yul1.example.net_1/vlans -d '{"number": 1000, "name": "myvlan"}' 
    -H "Content-Type: application/json" 
    -H "Netman-model: cisco" 
    -H "Netman-username: root" 
    -H "Netman-password: root"

Get information of an existing Vlan

curl -X GET http://localhost:32771/switches/netman_tsr1.yul1.example.net_1/vlans/1000 
    -H "Content-Type: application/json" 
    -H "Netman-model: cisco" 
    -H "Netman-username: root" 
    -H "Netman-password: root"

Contributing

Feel free to raise issues and send some pull request, we'll be happy to look at them!

Project details


Release history Release notifications | RSS feed

Download files

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

Source Distribution

netman-1.4.12.tar.gz (182.7 kB view details)

Uploaded Source

Built Distribution

netman-1.4.12-py2-none-any.whl (121.1 kB view details)

Uploaded Python 2

File details

Details for the file netman-1.4.12.tar.gz.

File metadata

  • Download URL: netman-1.4.12.tar.gz
  • Upload date:
  • Size: 182.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.15.0 pkginfo/1.5.0.1 requests/2.9.1 setuptools/44.1.1 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/2.7.12

File hashes

Hashes for netman-1.4.12.tar.gz
Algorithm Hash digest
SHA256 4c94a6e1537cc57be709904326c5e2a9d43007cad6e19dac70581d4170e1f3f9
MD5 84ce6a43132a0ae6b4d46e83c66a357a
BLAKE2b-256 c7cb697ca833111c682b481fc83a7d881bf1a81afb4b24d806d5fde9c2b9f8cf

See more details on using hashes here.

File details

Details for the file netman-1.4.12-py2-none-any.whl.

File metadata

  • Download URL: netman-1.4.12-py2-none-any.whl
  • Upload date:
  • Size: 121.1 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.9.12

File hashes

Hashes for netman-1.4.12-py2-none-any.whl
Algorithm Hash digest
SHA256 98e3712b67d7bc57f0570f7b2933909e3df9c354bd3e07c04ad1c43f93d9ddc0
MD5 b5ccb0b12230e37a21dd6d140c59266c
BLAKE2b-256 31d097a52b53389c072e669081f13a16e1aead834ce2939c3b74ed0e0149aaec

See more details on using hashes here.

Supported by

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