Skip to main content

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

Metadata

Release files for ttp-sros-parser 0.1.6

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

Source distribution (sdist)

Source distribution for ttp-sros-parser 0.1.6
File Size Uploaded
ttp_sros_parser-0.1.6.tar.gz 19.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ttp-sros-parser 0.1.6
File Interpreter ABI Platform
ttp_sros_parser-0.1.6-py3-none-any.whl Python 3 none any Details

Total release size: 48.5 kB

Release files / ttp_sros_parser-0.1.6.tar.gz

Download URL ttp_sros_parser-0.1.6.tar.gz
Size 19.2 kB
Tags Source
SHA-256 checksum
How to use checksums
d8d1facc7073a25cbdfb343204d56b0106ae14d7f2f0be7e7a85d74d009ded2b
BLAKE2b-256 checksum
How to use checksums
16dbe7635d559c151f594022eab096634bd9fb234a9be3d240e31ce095ea9491
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.13

Release files / ttp_sros_parser-0.1.6-py3-none-any.whl

Download URL ttp_sros_parser-0.1.6-py3-none-any.whl
Size 29.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4cccb34db774f7d5c6d492bf2a6a488294b4ffb9ba6902ffc6e786af5c1f30ec
BLAKE2b-256 checksum
How to use checksums
2716c6619f217395af63c0f3ccf51f8c11c5b731ff5fea7312b0d03b9164929f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.0 CPython/3.9.13

Release history Release notifications | RSS feed

This release

0.1.6 This release

2 release files

0.1.5

2 release files

0.1.4

2 release files

0.1.3

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

0.0.1

2 release files

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