Ddom (dynamic device object model) is a library which creates a object model of devices. Devices consist of child devices which can be plugged together. The idea is to model IT devices (switches, router, firewalls, server, cables) with all their modules, slots and ports and automatically verify compatibility between them.
Eg.: A Switch has slots, in these slots you can plug linecards, fans or powersupplies. Fans and powersupplies have an airflow direction. Linecards have ports. A transceiver can be inserted to a port. A cable can be connected to a transceiver,… and so on.
Features
- Ddom has following features:
automatically generate a object from yaml or python data structure
verify airflow direction within a Chassis
Find children by various properties
verify allowed children
verify allowed parents
Inheritance of properties
Installation
Install ddom by running:
pip3 install ddom
Examples
Create a Nexus 5672UP Chassis and print all port names of slot 1 using find_children and parent property
#!/usr/bin/env python3
from ddom import *
chassis = Chassis("n5k-c5672up", "cisco")
for port in chassis.find_children("port", {"parent.number": "1"}):
print(port.name)
Create a Nexus 5672UP Chassis and print all port names of slot 1 using find_children
#!/usr/bin/env python3
from ddom import *
chassis = Chassis("n5k-c5672up", "cisco")
for port in chassis.slot("SLOT-1").supervisor().find_children("port"):
print(port.name)
Create a Nexus 5672UP Chassis and verify airflow
#!/usr/bin/env python3
from ddom import *
chassis = Chassis("n5k-c5672up", "cisco")
psu_1 = PowerSupply("nxa-pac-1100w", "cisco")
psu_2 = PowerSupply("nxa-pac-1100w-b", "cisco")
chassis.slot("PSU-1").connect(psu_1)
chassis.slot("PSU-2").connect(psu_2) # this will raise an ddom.InvalidAirFlowError exception
Create a Nexus 5672UP Chassis and print the port name of a specific port
#!/usr/bin/env python3
from ddom import *
chassis = Chassis("n5k-c5672up", "cisco")
# by number
print(chassis.slot("SLOT-1").supervisor().port(1).name)
# by name
print(chassis.slot("SLOT-1").supervisor().port("eth1/1").name)
# by index
print(chassis.slot("SLOT-1").supervisor().port_index(0).name)
See the unit tests in the test directory for many more examples.
Contribute
Issue Tracker: https://github.com/jinjamator/ddom/issues
Source Code: https://github.com/jinjamator/ddom
Roadmap
- Selected Roadmap items:
add support for more devices
add support for cables
add class documentation
add device path
For documentation please refer to https://simplenetlink.readthedocs.io/en/latest/
License
This project is licensed under the Apache License Version 2.0
Metadata
Release files for ddom 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| ddom-0.3.1-py3-none-any.whl | Python 3 | none | any | Details for ddom-0.3.1-py3-none-any.whl |
Release files / ddom-0.3.1-py3-none-any.whl
| Download URL | ddom-0.3.1-py3-none-any.whl |
|---|---|
| Size | 30.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
6d8778c1d0533c6ed287f2e2485374ba2daf5bd50d646fc453420f13468fe7b4
|
|
BLAKE2b-256 checksum How to use checksums |
c47a4215d2a4c517e79a6021e9d7bcf8d16080d75cd4148e081f892985252cec
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.3.0 pkginfo/1.4.2 requests/2.26.0 setuptools/59.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.10
|
Security for ddom 0.3.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.
To learn more about protecting yourself from malicious actors, visit our package security documentation.