Skip to main content

Utility to parse a full SROS Configuration.

Project description

codecov

TTP SrosParser

A library to parse a Nokia SROS 7750 full hierarchical configuration text file into structured data. Show commands are also able to be parsed, if included in the file alongside the configuration. This library is still under development, but a lot of parsers are readily available (see below for supported features). Configurations used for testing have all been on release version higher than TiMOS 16. At the moment, there is no capability to specify release version to accommodate different parsing templates.

What TTP SrosParser is not

A library that connects and extracts information from a remote device. You, as the end-user must obtain a text file of the configuration. This file will be passed into the SrosParser class and you are able to convert a flat text configuration file into structure data using the built-in TTP parser templates. At this point, it's recommended to use a new instance of the srosparser with an individual show command as the text to parse to get the best results when parsing a show commands.

Example

"""SrosParser - Example."""
from ttp_sros_parser.srosparser import SrosParser

EXAMPLE_CONFIG = "some/dir/path/to/7750-config.txt"

# Instantiate class
router = SrosParser(EXAMPLE_CONFIG)

# Call `get_system_cards` method
router.get_system_cards()

Results:

[
   {
      "configure":{
         "card":{
            "card-type":{
               "card-type":"iom-1",
               "subscription-level":"cr"
            },
            "fail-on-error":true,
            "mda":{
               "admin-state":true,
               "egress-xpl":{
                  "window":"10"
               },
               "fail-on-error":true,
               "ingress-xpl":{
                  "window":"10"
               },
               "mda-slot":"1",
               "mda-type":"me6-100gb-qsfp28"
            },
            "slot-number":"1"
         }
      }
   }
]

Available Methods (Parsers)

Current methods available (Automatically updated at build):

Methods

Full Config

SrosParser allows you to parse the full configuration with a single method call, get_full_config() and receive the full JSON output of the device.

Custom Templates

SrosParser allows you to simply specify a custom template after you initialize a new class object.

router = SrosParser("path/to/config.txt")

cool_ttp_template = router.get_custom_template("path/to/template")

print(cool_ttp_template)

Contributing

Any contribution to the project must include unit tests and pass all linting.

Simply run:

  • docker-compose build
  • docker-compose run test

Project details


Download files

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

Source Distribution

ttp_sros_parser-0.1.5.tar.gz (19.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ttp_sros_parser-0.1.5-py3-none-any.whl (28.9 kB view details)

Uploaded Python 3

File details

Details for the file ttp_sros_parser-0.1.5.tar.gz.

File metadata

  • Download URL: ttp_sros_parser-0.1.5.tar.gz
  • Upload date:
  • Size: 19.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.10 Linux/5.11.0-7620-generic

File hashes

Hashes for ttp_sros_parser-0.1.5.tar.gz
Algorithm Hash digest
SHA256 0a514b899efd1d0152f36aaf91fff44cbb271ab12a7b518d50cf6cb472408733
MD5 1d0c2fe33289642886e322162aff45b6
BLAKE2b-256 1ff36cced57026ef92bb7109b2bfc6497683d9ea38c0bb17529147110951459c

See more details on using hashes here.

File details

Details for the file ttp_sros_parser-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: ttp_sros_parser-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 28.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.4 CPython/3.8.10 Linux/5.11.0-7620-generic

File hashes

Hashes for ttp_sros_parser-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 92534ed00946dc366eae055827b51f0361830f35e010044b594b1e0689b894c6
MD5 8d18bcb2a99284328cadb3ace2daa0e9
BLAKE2b-256 ed856e4fa9c1800784e5b9bc7ed924dc1974af0886662583b0e3f0acf77a1249

See more details on using hashes here.

Supported by

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