Skip to main content

umnet-scripts

A set of python modules/classes for interacting with UMnet tools.

This package is hosted on pypi - you can install it with pip install umnet-scripts and use it in your own code.

Database Helper Classes

As of Dec 2021 this repo defines db wrapper classes for Equipdb, Netinfo, and Netdisco. To use these classes you need to set specific environment variables with the credentials for each db respectively:

  • Netinfo: NETINFO_USERNAME, NETINFO_PASSSWORD
  • Netdisco: NETDISCO_DB_USER, NETDISCO_DB_PASSWORD
  • Equipdb: EQUIP_DB_USER, EQUIP_DB_PASSWORD

Queries for specific things are added as they're needed. As of Dec 2021 there are only a few methods defined for netdisco and equipdb. Each class inherits a super basic sql query builder method as well as an 'execute' method from a base class (see umnetdb.py).

Rancid Helper Class

The rancid helper class currently parses the router.db files in /home/rancid/ as well as the /home/rancid/Topology into a list of Device objects with rancid-related data as attributes, particularly the following:

  • rancid_name: The name of the device as rancid knows it (the name of the config file). IP address for AL, DNS name for everything else.
  • rancid_type: The rancid perl script that is used to back up the device (eg juniper or Cat3750)
  • rancid_role: This is the folder the device config lives in, eg accesslayer or core. Maps 1:1 to the equipdb device type.
  • model: Device model as populated in equipdb, eg 'EX2200-24T-4G'
  • cfg_file: Full path to the config file, eg /home/rancid/accesslayer/10.233.0.10
  • status: Up or down per the equipdb offline flag (offline is down).
  • neighbors: A dict of the device's neighbors as reported by TopologyWalker.

There are also two attributes that look like attributes but are actually 'property' functions: hostname and ip that return the device's hostname or IP respectively. If you call 'hostname' for a device whose rancid name is an IP, a dns reverse lookup is done. Similarly, if you call 'ip' on a device whose rancid name is a DNS name, a forward dns lookup is done.

Note that if you're only focusing on one rancid config folder (eg datacenter, accesslayer, etc), to speed your code up you can limit which folders are processed when you instantiate the Rancid class. Note that if you want to get devices by dl_zone you must include the distlayer folder at minimum.

Metadata

Release files for umnet-scripts 1.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for umnet-scripts 1.1.0
File Size Uploaded Provenance Actions
umnet_scripts-1.1.0.tar.gz 29.5 kB Without provenance Details for umnet_scripts-1.1.0.tar.gz

Release files / umnet_scripts-1.1.0.tar.gz

Download URL umnet_scripts-1.1.0.tar.gz
Size 29.5 kB
Tags Source
SHA-256 checksum
How to use checksums
ca33b51bc8de0ccb49091d3e4828426df43cdbc2e094d9b649b506e10fdea7a4
BLAKE2b-256 checksum
How to use checksums
6f51d2127e68ffc2db21926044cdb4ce857de38fb4a4386224565de93e80c8d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 colorama/0.4.4 importlib-metadata/8.5.0 keyring/25.6.0 pkginfo/1.12.0 readme-renderer/34.0 requests-toolbelt/1.0.0 requests/2.31.0 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.12

Security for umnet-scripts 1.1.0

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.

Release history Release notifications | RSS feed

This release

1.1.0 This release

1 release file No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page