python-ttp-templates
Port variant py310
Summary Template Text Parser Templates collections (3.10)
Package version 0.3.5
Homepage https://github.com/dmulyalin/ttp_templates
Keywords python
Maintainer Python Automaton
License Not yet specified
Other variants v11
Ravenports Buildsheet | History
Ravensource Port Directory | History
Last modified 15 APR 2023, 05:23:33 UTC
Port created 07 JAN 2023, 04:18:24 UTC
Subpackage Descriptions
single [Downloads] [PyPI versions] # Template Text Parser Templates This repository contains a collection of [TTP] templates. If you solved a problem using TTP and feel that your work can be useful to other people, feel free to raise an issue or submit pull request to include your template(s) in this repository. Refer to [Contribute Guide] for details. Documentation: [https://dmulyalin.github.io/ttp_templates/] Repository: [https://github.com/dmulyalin/ttp_templates] TTP: [https://ttp.readthedocs.io/] ## Installation From PyPi: `pip install ttp-templates` or latest from GitHub master branch (need Git installed on the system): `pip install git+https://github.com/dmulyalin/ttp_templates.git` ## Sample usage This example demonstrates how to parse `Test Platform` output for `show run | sec interface` command using `platform/test_platform_show_run_pipe_sec_interface.txt` template.
Code ```python from ttp_templates import parse_output import pprint data = """ interface GigabitEthernet1/3.251 description Customer #32148 encapsulation dot1q 251 ip address 172.16.33.10 255.255.255.128 shutdown ! interface GigabitEthernet1/3.251 description Customer #32148 encapsulation dot1q 251 ip address 172.16.33.10 255.255.255.128 shutdown """ result = parse_output( data=data, platform="Test Platform", command="show run | sec interface" ) pprint.pprint(result) # prints: # [[[{'description': 'Customer #32148', # 'disabled': True, # 'dot1q': '251', # 'interface': 'GigabitEthernet1/3.251', # 'ip': '172.16.33.10', # 'mask': '255.255.255.128'}, # {'description': 'Customer #32148', # 'disabled': True, # 'dot1q': '251', # 'interface': 'GigabitEthernet1/3.251', # 'ip': '172.16.33.10', # 'mask': '255.255.255.128'}]]] ```
Sample code to parse `Cisco IOS` output in a structure compatible with `ietf-interfaces` YANG module.
Code ```python from ttp_templates import get_template from ttp import ttp import pprint data1 = """ interface GigabitEthernet1/3.251 description Customer #32148 encapsulation dot1q 251 ip address 172.16.33.10 255.255.255.128 shutdown ! interface GigabitEthernet1/4 description vCPEs access control ip address 172.16.33.10 255.255.255.128 ! """ data2 = """
Configuration Switches (platform-specific settings discarded)
PY310 ON Build using Python 3.10 PY311 OFF Build using Python 3.11
Package Dependencies by Type
Build (only) python-pip:single:py310
autoselect-python:single:standard
Build and Runtime python310:single:standard
Runtime (only) python-ttp:single:py310
Download groups
main mirror://PYPIWHL/7a/53/0aec6fd778278a960ca85e78ba60c1ade8c96aec2eb977c5c1e758d62bb3
Distribution File Information
4985a68640468127a0e31021672039cd88a8b9c3dd9289cad67839209cddaf30 72094 ttp_templates-0.3.5-py3-none-any.whl
Ports that require python-ttp-templates:py310
python-napalm:py310 Vendor-agnostic router interaction libary (3.10)