Skip to main content

No project description provided

Project description

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 and powersupplies. Fans and Powersupplies have an airflow direction. Linecards have ports, in a port a transceiver can be connected. 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 5572UP 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 5572UP 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 5572UP 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 5572UP 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

Roadmap

Selected Roadmap items:
  • add support for more devices

  • add support for cables

  • add class documentation

For documentation please refer to https://simplenetlink.readthedocs.io/en/latest/

License

This project is licensed under the Apache License Version 2.0

Project details


Download files

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

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

ddom-0.1-py3-none-any.whl (21.2 kB view details)

Uploaded Python 3

File details

Details for the file ddom-0.1-py3-none-any.whl.

File metadata

  • Download URL: ddom-0.1-py3-none-any.whl
  • Upload date:
  • Size: 21.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.4.2 requests/2.25.1 setuptools/54.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.5

File hashes

Hashes for ddom-0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d17f362061d3522d7ce80fd3d450b2c892122da8011b5ceb94e1924410b6029f
MD5 700b2edbe6f7678520ee9e1b0fe8f62a
BLAKE2b-256 70ab9724f6aa66c589a2a3344a577fbc24a9b2b48e2edeb22455c4f72520a88a

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