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!
Metadata
Release files for netman 1.5.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| netman-1.5.1.tar.gz | 184.3 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| netman-1.5.1-py2-none-any.whl | Python 2 | none | any | Details |
Total release size: 305.7 kB
Release files / netman-1.5.1.tar.gz
| Download URL | netman-1.5.1.tar.gz |
|---|---|
| Size | 184.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
6aca8c9bb99f80dd2da4b5deb791a693439d8ce549e7a518572894fd2fda5589
|
|
BLAKE2b-256 checksum How to use checksums |
1988fd5138d3efb573d49287245c24b6ef603a3197725de1be40731f44e22fa3
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Release files / netman-1.5.1-py2-none-any.whl
| Download URL | netman-1.5.1-py2-none-any.whl |
|---|---|
| Size | 121.4 kB |
| Tags | Python 2 |
|
SHA-256 checksum How to use checksums |
5e00b6417aec5b4710aec5e89a1686f128bcff980fbb9b2450676623c3eb4352
|
|
BLAKE2b-256 checksum How to use checksums |
20db9cd5a49bb2411eab56fa0417f7ea0d6f1a0474f6c04ecd759cadbc210199
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.9.13
|
Security for netman 1.5.1
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.