ttp_templates 0.3.2__tar.gz → 0.3.4__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/PKG-INFO +11 -10
  2. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/README.md +10 -10
  3. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/pyproject.toml +1 -1
  4. ttp_templates-0.3.4/setup.py +48 -0
  5. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_l2_data/cisco_xr.txt +0 -1
  6. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netbox/parse_arista_eos_config.txt +13 -0
  7. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netbox/parse_cisco_xr_config.txt +15 -2
  8. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netbox/parse_juniper_junos_config.txt +7 -0
  9. ttp_templates-0.3.4/ttp_templates/platform/cisco_ios_show_isdn_status.txt +19 -0
  10. ttp_templates-0.3.2/setup.py +0 -48
  11. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/LICENSE +0 -0
  12. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/__init__.py +0 -0
  13. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ip_data/a10.txt +0 -0
  14. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ip_data/arista_eos.txt +0 -0
  15. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ip_data/cisco_ios.txt +0 -0
  16. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ip_data/cisco_nxos.txt +0 -0
  17. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ip_data/cisco_xr.txt +0 -0
  18. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ip_data/fortinet.txt +0 -0
  19. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ip_data/huawei.txt +0 -0
  20. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ip_data/readme.md +0 -0
  21. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_isis_data/cisco_xr.txt +0 -0
  22. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_isis_data/juniper.txt +0 -0
  23. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_isis_data/readme.md +0 -0
  24. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_l2_data/cisco_ios.txt +0 -0
  25. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_l2_data/cisco_nxos.txt +0 -0
  26. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_l2_data/huawei.txt +0 -0
  27. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_l2_data/juniper.txt +0 -0
  28. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_l2_data/readme.md +0 -0
  29. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ospf_data/cisco_ios.txt +0 -0
  30. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ospf_data/cisco_xr.txt +0 -0
  31. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ospf_data/huawei.txt +0 -0
  32. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/N2G/cli_ospf_data/readme.md +0 -0
  33. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netmiko/cisco.ios.arp.txt +0 -0
  34. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netmiko/cisco.ios.cfg.bgp.txt +0 -0
  35. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netmiko/cisco.ios.cfg.interface.txt +0 -0
  36. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netmiko/cisco.ios.cfg.ip.txt +0 -0
  37. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netmiko/cisco.ios.cfg.nat.static.txt +0 -0
  38. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netmiko/cisco.iosxr.arp.txt +0 -0
  39. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netmiko/cisco.iosxr.cfg.interface.txt +0 -0
  40. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netmiko/cisco.iosxr.cfg.ip.txt +0 -0
  41. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netmiko/huawei.vrp.cfg.interface.txt +0 -0
  42. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/Netmiko/huawei.vrp.cfg.ip.txt +0 -0
  43. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/ttp_templates_tests/cisco_ios_interfaces_cfg_per_ip.txt +0 -0
  44. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/misc/ttp_templates_tests/netmiko_cisco_ios_interfaces.txt +0 -0
  45. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/arista_eos_show_hostname.txt +0 -0
  46. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_ios_show_ip_arp.txt +0 -0
  47. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_ios_show_ip_ospf_database_external.txt +0 -0
  48. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_ios_show_ip_ospf_database_router.txt +0 -0
  49. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_ios_show_ip_ospf_database_summary.txt +0 -0
  50. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_ios_show_running_config_pipe_include_source_static.txt +0 -0
  51. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_ios_show_running_config_pipe_section_interface.txt +0 -0
  52. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_ios_show_running_configuration_pipe_section_bgp.txt +0 -0
  53. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_xr_show_arp_vrf_all.txt +0 -0
  54. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_xr_show_isis_database_verbose.txt +0 -0
  55. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_xr_show_ospf_database_external.txt +0 -0
  56. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_xr_show_ospf_database_router.txt +0 -0
  57. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_xr_show_ospf_database_summary.txt +0 -0
  58. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/cisco_xr_show_running_config_interface.txt +0 -0
  59. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/huawei_display_current_configuration_interface.txt +0 -0
  60. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/huawei_display_ospf_lsdb_router.txt +0 -0
  61. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/juniper_show_isis_database_verbose_pipe_no_more.txt +0 -0
  62. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/platform/test_platform_show_run_pipe_sec_interface.txt +0 -0
  63. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/ttp_templates.py +0 -0
  64. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/ttp_vars.py +0 -0
  65. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/yang/ietf-interfaces_cisco_ios.txt +0 -0
  66. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/yang/openconfig-lldp_cisco_ios.txt +0 -0
  67. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/yang/openconfig-lldp_cisco_nxos.txt +0 -0
  68. {ttp_templates-0.3.2 → ttp_templates-0.3.4}/ttp_templates/yang/openconfig-lldp_cisco_xr.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: ttp-templates
3
- Version: 0.3.2
3
+ Version: 0.3.4
4
4
  Summary: Template Text Parser Templates collections
5
5
  Home-page: https://github.com/dmulyalin/ttp_templates
6
6
  License: MIT
@@ -39,9 +39,9 @@ Description-Content-Type: text/markdown
39
39
 
40
40
  This repository contains a collection of [TTP](https://github.com/dmulyalin/ttp) templates.
41
41
 
42
- If you solved a problem using TTP and feel that your work can be useful to other people, feel
42
+ If you solved a problem using TTP and feel that your work can be useful to other people, feel
43
43
  free to raise an issue or submit pull request to include your template(s) in this repository.
44
- Refer to [Contribute Guide](contribute.md) for details.
44
+ Refer to [Contribute Guide](https://dmulyalin.github.io/ttp_templates/contribute/) for details.
45
45
 
46
46
  Documentation: [https://dmulyalin.github.io/ttp_templates/](https://dmulyalin.github.io/ttp_templates/)
47
47
 
@@ -58,7 +58,7 @@ From PyPi:
58
58
  or latest from GitHub master branch (need Git installed on the system):
59
59
 
60
60
  `pip install git+https://github.com/dmulyalin/ttp_templates.git`
61
-
61
+
62
62
  ## Sample usage
63
63
 
64
64
  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.
@@ -134,7 +134,7 @@ interface GigabitEthernet1/5
134
134
  interface GigabitEthernet1/7
135
135
  description Works data v6
136
136
  ipv6 address 2001::1/64
137
- ipv6 address 2001:1::1/64
137
+ ipv6 address 2001:1::1/64
138
138
  """
139
139
 
140
140
  template = get_template(yang="ietf-interfaces", platform="cisco_ios")
@@ -219,16 +219,16 @@ This repository contains three collections of templates corresponding to folder
219
219
 
220
220
  ### Platform collection templates files naming rule
221
221
 
222
- `{{ vendor_os }}_{{ command_with_underscores }}.txt` - lower case only.
222
+ `{{ vendor_os }}_{{ command_with_underscores }}.txt` - lower case only.
223
223
 
224
224
  Naming rules details:
225
225
 
226
226
  * All space symbols `' '` replaced with underscores.
227
- * Pipe symbol `|` replaced with `pipe` in template name. For example,
228
- template to parse Cisco IOS `show run | section interface` command output
227
+ * Pipe symbol `|` replaced with `pipe` in template name. For example,
228
+ template to parse Cisco IOS `show run | section interface` command output
229
229
  must be named `cisco_ios_show_running_config_pipe_section_interface.txt`
230
- * Dash symbols `-` replaced with underscores. For example, template to parse
231
- Huawei `display current-configuration interface` command output must be
230
+ * Dash symbols `-` replaced with underscores. For example, template to parse
231
+ Huawei `display current-configuration interface` command output must be
232
232
  named `huawei_display_current_configuration_interface.txt`
233
233
 
234
234
  ### YANG collection templates files naming rule
@@ -257,3 +257,4 @@ List of resources with TTP templates:
257
257
  - TTP SrosParser - https://pypi.org/project/ttp-sros-parser/ by [h4ndzdatm0ld](https://github.com/h4ndzdatm0ld)
258
258
  - Template for parsing "show run" for Cisco IOS - https://github.com/tbotnz/ios-show-run-ttp by [tbotnz](https://github.com/tbotnz)
259
259
  - Template for Cisco ASA configuration - https://gist.github.com/consentfactory/85872fc83453d1735b15aed3e47a9763 by [consentfactory](https://gist.github.com/consentfactory)
260
+
@@ -5,9 +5,9 @@
5
5
 
6
6
  This repository contains a collection of [TTP](https://github.com/dmulyalin/ttp) templates.
7
7
 
8
- If you solved a problem using TTP and feel that your work can be useful to other people, feel
8
+ If you solved a problem using TTP and feel that your work can be useful to other people, feel
9
9
  free to raise an issue or submit pull request to include your template(s) in this repository.
10
- Refer to [Contribute Guide](contribute.md) for details.
10
+ Refer to [Contribute Guide](https://dmulyalin.github.io/ttp_templates/contribute/) for details.
11
11
 
12
12
  Documentation: [https://dmulyalin.github.io/ttp_templates/](https://dmulyalin.github.io/ttp_templates/)
13
13
 
@@ -24,7 +24,7 @@ From PyPi:
24
24
  or latest from GitHub master branch (need Git installed on the system):
25
25
 
26
26
  `pip install git+https://github.com/dmulyalin/ttp_templates.git`
27
-
27
+
28
28
  ## Sample usage
29
29
 
30
30
  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.
@@ -100,7 +100,7 @@ interface GigabitEthernet1/5
100
100
  interface GigabitEthernet1/7
101
101
  description Works data v6
102
102
  ipv6 address 2001::1/64
103
- ipv6 address 2001:1::1/64
103
+ ipv6 address 2001:1::1/64
104
104
  """
105
105
 
106
106
  template = get_template(yang="ietf-interfaces", platform="cisco_ios")
@@ -185,16 +185,16 @@ This repository contains three collections of templates corresponding to folder
185
185
 
186
186
  ### Platform collection templates files naming rule
187
187
 
188
- `{{ vendor_os }}_{{ command_with_underscores }}.txt` - lower case only.
188
+ `{{ vendor_os }}_{{ command_with_underscores }}.txt` - lower case only.
189
189
 
190
190
  Naming rules details:
191
191
 
192
192
  * All space symbols `' '` replaced with underscores.
193
- * Pipe symbol `|` replaced with `pipe` in template name. For example,
194
- template to parse Cisco IOS `show run | section interface` command output
193
+ * Pipe symbol `|` replaced with `pipe` in template name. For example,
194
+ template to parse Cisco IOS `show run | section interface` command output
195
195
  must be named `cisco_ios_show_running_config_pipe_section_interface.txt`
196
- * Dash symbols `-` replaced with underscores. For example, template to parse
197
- Huawei `display current-configuration interface` command output must be
196
+ * Dash symbols `-` replaced with underscores. For example, template to parse
197
+ Huawei `display current-configuration interface` command output must be
198
198
  named `huawei_display_current_configuration_interface.txt`
199
199
 
200
200
  ### YANG collection templates files naming rule
@@ -222,4 +222,4 @@ List of resources with TTP templates:
222
222
 
223
223
  - TTP SrosParser - https://pypi.org/project/ttp-sros-parser/ by [h4ndzdatm0ld](https://github.com/h4ndzdatm0ld)
224
224
  - Template for parsing "show run" for Cisco IOS - https://github.com/tbotnz/ios-show-run-ttp by [tbotnz](https://github.com/tbotnz)
225
- - Template for Cisco ASA configuration - https://gist.github.com/consentfactory/85872fc83453d1735b15aed3e47a9763 by [consentfactory](https://gist.github.com/consentfactory)
225
+ - Template for Cisco ASA configuration - https://gist.github.com/consentfactory/85872fc83453d1735b15aed3e47a9763 by [consentfactory](https://gist.github.com/consentfactory)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "ttp_templates"
3
- version = "0.3.2"
3
+ version = "0.3.4"
4
4
  description = "Template Text Parser Templates collections"
5
5
  license = "MIT"
6
6
  include = [
@@ -0,0 +1,48 @@
1
+ # -*- coding: utf-8 -*-
2
+ from setuptools import setup
3
+
4
+ packages = \
5
+ ['ttp_templates']
6
+
7
+ package_data = \
8
+ {'': ['*'],
9
+ 'ttp_templates': ['misc/N2G/cli_ip_data/*',
10
+ 'misc/N2G/cli_isis_data/*',
11
+ 'misc/N2G/cli_l2_data/*',
12
+ 'misc/N2G/cli_ospf_data/*',
13
+ 'misc/Netbox/*',
14
+ 'misc/Netmiko/*',
15
+ 'misc/ttp_templates_tests/*',
16
+ 'platform/*',
17
+ 'yang/*']}
18
+
19
+ install_requires = \
20
+ ['ttp>=0.6.0']
21
+
22
+ extras_require = \
23
+ {'docs:python_version >= "3.7"': ['mkdocs==1.2.4',
24
+ 'mkdocs-material==7.2.2',
25
+ 'mkdocs-material-extensions==1.0.1',
26
+ 'mkdocstrings[python]>=0.18.0,<0.19.0',
27
+ 'pygments==2.11',
28
+ 'pymdown-extensions==9.3']}
29
+
30
+ setup_kwargs = {
31
+ 'name': 'ttp-templates',
32
+ 'version': '0.3.4',
33
+ 'description': 'Template Text Parser Templates collections',
34
+ 'long_description': '[![Downloads](https://pepy.tech/badge/ttp_templates)](https://pepy.tech/project/ttp_templates)\n[![PyPI versions](https://img.shields.io/pypi/pyversions/ttp.svg)](https://pypi.python.org/pypi/ttp_templates/)\n\n# Template Text Parser Templates\n\nThis repository contains a collection of [TTP](https://github.com/dmulyalin/ttp) templates.\n\nIf you solved a problem using TTP and feel that your work can be useful to other people, feel\nfree to raise an issue or submit pull request to include your template(s) in this repository.\nRefer to [Contribute Guide](https://dmulyalin.github.io/ttp_templates/contribute/) for details.\n\nDocumentation: [https://dmulyalin.github.io/ttp_templates/](https://dmulyalin.github.io/ttp_templates/)\n\nRepository: [https://github.com/dmulyalin/ttp_templates](https://github.com/dmulyalin/ttp_templates)\n\nTTP: [https://ttp.readthedocs.io/](https://ttp.readthedocs.io/)\n\n## Installation\n\nFrom PyPi:\n\n`pip install ttp-templates`\n\nor latest from GitHub master branch (need Git installed on the system):\n\n`pip install git+https://github.com/dmulyalin/ttp_templates.git`\n\n## Sample usage\n\nThis 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.\n<details><summary>Code</summary>\n\n```python\nfrom ttp_templates import parse_output\nimport pprint\n\ndata = """\ninterface GigabitEthernet1/3.251\n description Customer #32148\n encapsulation dot1q 251\n ip address 172.16.33.10 255.255.255.128\n shutdown\n!\ninterface GigabitEthernet1/3.251\n description Customer #32148\n encapsulation dot1q 251\n ip address 172.16.33.10 255.255.255.128\n shutdown\n"""\n\nresult = parse_output(\n data=data,\n platform="Test Platform",\n command="show run | sec interface"\n)\n\npprint.pprint(result)\n\n# prints:\n# [[[{\'description\': \'Customer #32148\',\n# \'disabled\': True,\n# \'dot1q\': \'251\',\n# \'interface\': \'GigabitEthernet1/3.251\',\n# \'ip\': \'172.16.33.10\',\n# \'mask\': \'255.255.255.128\'},\n# {\'description\': \'Customer #32148\',\n# \'disabled\': True,\n# \'dot1q\': \'251\',\n# \'interface\': \'GigabitEthernet1/3.251\',\n# \'ip\': \'172.16.33.10\',\n# \'mask\': \'255.255.255.128\'}]]]\n```\n</details>\n\nSample code to parse `Cisco IOS` output in a structure compatible with `ietf-interfaces` YANG module.\n<details><summary>Code</summary>\n\n```python\nfrom ttp_templates import get_template\nfrom ttp import ttp\nimport pprint\n\ndata1 = """\ninterface GigabitEthernet1/3.251\n description Customer #32148\n encapsulation dot1q 251\n ip address 172.16.33.10 255.255.255.128\n shutdown\n!\ninterface GigabitEthernet1/4\n description vCPEs access control\n ip address 172.16.33.10 255.255.255.128\n!\n"""\ndata2 = """\ninterface GigabitEthernet1/5\n description Works data\n ip mtu 9000\n!\ninterface GigabitEthernet1/7\n description Works data v6\n ipv6 address 2001::1/64\n ipv6 address 2001:1::1/64\n"""\n\ntemplate = get_template(yang="ietf-interfaces", platform="cisco_ios")\nparser = ttp(template=template)\n\nparser.add_input(data1)\nparser.add_input(data2)\n\nparser.parse()\nres = parser.result()\npprint.pprint(res)\n\n# prints:\n# [{\'comment\': \'\',\n# \'exception\': {},\n# \'result\': [{\'ietf-interfaces:interfaces\': {\'interface\': [{\'admin-status\': \'down\',\n# \'description\': \'Customer \'\n# \'#32148\',\n# \'enabled\': False,\n# \'ietf-ip:ipv4\': {\'address\': [{\'ip\': \'172.16.33.10\',\n# \'netmask\': \'255.255.255.128\',\n# \'origin\': \'static\'}]},\n# \'if-index\': 1,\n# \'link-up-down-trap-enable\': \'enabled\',\n# \'name\': \'GigabitEthernet1/3.251\',\n# \'oper-status\': \'unknown\',\n# \'statistics\': {\'discontinuity-time\': \'1970-01-01T00:00:00+00:00\'},\n# \'type\': \'iana-if-type:ethernetCsmacd\'},\n# {\'admin-status\': \'up\',\n# \'description\': \'vCPEs \'\n# \'access \'\n# \'control\',\n# \'enabled\': True,\n# \'ietf-ip:ipv4\': {\'address\': [{\'ip\': \'172.16.33.10\',\n# \'netmask\': \'255.255.255.128\',\n# \'origin\': \'static\'}]},\n# \'if-index\': 1,\n# \'link-up-down-trap-enable\': \'enabled\',\n# \'name\': \'GigabitEthernet1/4\',\n# \'oper-status\': \'unknown\',\n# \'statistics\': {\'discontinuity-time\': \'1970-01-01T00:00:00+00:00\'},\n# \'type\': \'iana-if-type:ethernetCsmacd\'}]}},\n# {\'ietf-interfaces:interfaces\': {\'interface\': [{\'admin-status\': \'up\',\n# \'description\': \'Works \'\n# \'data\',\n# \'enabled\': True,\n# \'ietf-ip:ipv4\': {\'mtu\': 9000},\n# \'if-index\': 1,\n# \'link-up-down-trap-enable\': \'enabled\',\n# \'name\': \'GigabitEthernet1/5\',\n# \'oper-status\': \'unknown\',\n# \'statistics\': {\'discontinuity-time\': \'1970-01-01T00:00:00+00:00\'},\n# \'type\': \'iana-if-type:ethernetCsmacd\'},\n# {\'admin-status\': \'up\',\n# \'description\': \'Works \'\n# \'data \'\n# \'v6\',\n# \'enabled\': True,\n# \'ietf-ip:ipv6\': {\'address\': [{\'ip\': \'2001::1\',\n# \'origin\': \'static\',\n# \'prefix-length\': 64},\n# {\'ip\': \'2001:1::1\',\n# \'origin\': \'static\',\n# \'prefix-length\': 64}]},\n# \'if-index\': 1,\n# \'link-up-down-trap-enable\': \'enabled\',\n# \'name\': \'GigabitEthernet1/7\',\n# \'oper-status\': \'unknown\',\n# \'statistics\': {\'discontinuity-time\': \'1970-01-01T00:00:00+00:00\'},\n# \'type\': \'iana-if-type:ethernetCsmacd\'}]}}],\n# \'valid\': {0: True, 1: True}}]\n```\n</details>\n\n## How templates collections structured\n\nThis repository contains three collections of templates corresponding to folder names:\n\n* `platform` collection - mimics [ntc-templates](https://github.com/networktocode/ntc-templates) API and follows same naming rule\n* `yang` collection - contains templates capable of producing YANG compatible structures out of text data\n* `misc` collection - miscellaneous templates for various use cases organized in folders\n\n### Platform collection templates files naming rule\n\n`{{ vendor_os }}_{{ command_with_underscores }}.txt` - lower case only.\n\nNaming rules details:\n\n* All space symbols `\' \'` replaced with underscores.\n* Pipe symbol `|` replaced with `pipe` in template name. For example,\n template to parse Cisco IOS `show run | section interface` command output\n must be named `cisco_ios_show_running_config_pipe_section_interface.txt`\n* Dash symbols `-` replaced with underscores. For example, template to parse\n Huawei `display current-configuration interface` command output must be\n named `huawei_display_current_configuration_interface.txt`\n\n### YANG collection templates files naming rule\n\n`{{ YANG module name }}_{{ platform_name }}.txt` - lower case only\n\nNaming rules details:\n\n* All space symbols `\' \'` replaced with underscore.\n* Dash symbol `-` **does not** replaced with underscore. For example, template\n to produce output compatible with openconfig-lldp YANG model for Cisco IOS\n must be named `openconfig-lldp_cisco_xr.txt`\n\n### Misc collection templates files naming rule\n\n`{{ usecase folder }}/{{ template name }}.txt` - upper or lower case\n\nNaming rules details:\n\n* Nothing replaced with anything, provided template name used as is.\n\n## Additional Templates Resources\n\nList of resources with TTP templates:\n\n- TTP SrosParser - https://pypi.org/project/ttp-sros-parser/ by [h4ndzdatm0ld](https://github.com/h4ndzdatm0ld)\n- Template for parsing "show run" for Cisco IOS - https://github.com/tbotnz/ios-show-run-ttp by [tbotnz](https://github.com/tbotnz)\n- Template for Cisco ASA configuration - https://gist.github.com/consentfactory/85872fc83453d1735b15aed3e47a9763 by [consentfactory](https://gist.github.com/consentfactory)\n',
35
+ 'author': 'Denis Mulyalin',
36
+ 'author_email': 'd.mulyalin@gmail.com',
37
+ 'maintainer': 'Denis Mulyalin',
38
+ 'maintainer_email': 'd.mulyalin@gmail.com',
39
+ 'url': 'https://github.com/dmulyalin/ttp_templates',
40
+ 'packages': packages,
41
+ 'package_data': package_data,
42
+ 'install_requires': install_requires,
43
+ 'extras_require': extras_require,
44
+ 'python_requires': '>=3.6,<4.0',
45
+ }
46
+
47
+
48
+ setup(**setup_kwargs)
@@ -1,4 +1,3 @@
1
- bash-4.4# cat /usr/local/lib/python3.9/site-packages/ttp_templates/misc/N2G/cli_l2_data/cisco_xr.txt
2
1
  <template name="cisco_xr" results="per_template">
3
2
 
4
3
  <doc>
@@ -1,4 +1,11 @@
1
1
  <template name="netbox_data" results="per_template">
2
+ <doc>
3
+ Template to parse Arista EOS configuration and produce data structure
4
+ that is easy to work with to import data into the Netbox.
5
+
6
+ This template requires output of `show running-config` command.
7
+ </doc>
8
+
2
9
  <input>
3
10
  commands = [
4
11
  "show running-config"
@@ -14,6 +21,12 @@ def add_interface_type(data):
14
21
  ]
15
22
  ):
16
23
  data["interface_type"] = "virtual"
24
+ elif any(
25
+ i in data["name"].lower() for i in [
26
+ "vlan", "vxlan"
27
+ ]
28
+ ):
29
+ data["interface_type"] = "bridge"
17
30
  elif "bundle" in data["name"].lower():
18
31
  data["interface_type"] = "lag"
19
32
  return data
@@ -1,4 +1,11 @@
1
1
  <template name="netbox_data" results="per_template">
2
+ <doc>
3
+ Template to parse Arista EOS configuration and produce data structure
4
+ that is easy to work with to import data into the Netbox.
5
+
6
+ This template requires output of `show running-config` command.
7
+ </doc>
8
+
2
9
  <input>
3
10
  commands = [
4
11
  "show running-config"
@@ -10,10 +17,16 @@ def add_interface_type(data):
10
17
  data["interface_type"] = "other"
11
18
  if any(
12
19
  i in data["name"].lower() for i in [
13
- "bvi", ".", "loopback", "tunnel"
20
+ ".", "loopback", "tunnel"
14
21
  ]
15
22
  ):
16
23
  data["interface_type"] = "virtual"
24
+ elif any(
25
+ i in data["name"].lower() for i in [
26
+ "bvi"
27
+ ]
28
+ ):
29
+ data["interface_type"] = "bridge"
17
30
  elif "bundle" in data["name"].lower():
18
31
  data["interface_type"] = "lag"
19
32
  return data
@@ -23,7 +36,7 @@ def add_parent_interface(data):
23
36
  data["parent"] = "Bundle-Ether{}".format(data["lag_id"])
24
37
  elif "." in data["name"]:
25
38
  data["parent"] = data["name"].split(".")[0]
26
- return data
39
+ return data
27
40
  </macro>
28
41
 
29
42
  ## ------------------------------------------------------------------------------------------
@@ -1,4 +1,11 @@
1
1
  <template name="netbox_data" results="per_template">
2
+ <doc>
3
+ Template to parse Juniper Junos configuration and produce data structure
4
+ that is easy to work with to import data into the Netbox.
5
+
6
+ This template requires output of `show configuration | display set` command.
7
+ </doc>
8
+
2
9
  <input>
3
10
  commands = [
4
11
  "show configuration | display set"
@@ -0,0 +1,19 @@
1
+ <doc>
2
+ This Template allows to parse show isdn status on a cisco ios xe
3
+ </doc>
4
+ Global ISDN Switchtype = basic-net3
5
+ <group name = "interface">
6
+ ISDN {{INTERFACE}} interface
7
+ dsl 2, interface ISDN Switchtype = {{ISDN_SWITCHTYPE}}
8
+ Layer 1 Status:
9
+ {{L1_STATUS}}
10
+ Layer 2 Status:
11
+ TEI = {{TEI_CODE}}, Ces = {{CES}}, SAPI = {{SAPI}}, State = {{TEI_STATE}}
12
+ Layer 3 Status:
13
+ 0 Active Layer 3 Call(s)
14
+ Active dsl 2 CCBs = 0
15
+ The Free Channel Mask: {{FREE_CHANNEL_MASK}}
16
+ Number of L2 Discards = {{L2_DISCARDS}}, L2 Session ID = {{L2_SESSION_ID}}
17
+ Total Allocated ISDN CCBs = 1
18
+ </group>
19
+
@@ -1,48 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- from setuptools import setup
3
-
4
- packages = \
5
- ['ttp_templates']
6
-
7
- package_data = \
8
- {'': ['*'],
9
- 'ttp_templates': ['misc/N2G/cli_ip_data/*',
10
- 'misc/N2G/cli_isis_data/*',
11
- 'misc/N2G/cli_l2_data/*',
12
- 'misc/N2G/cli_ospf_data/*',
13
- 'misc/Netbox/*',
14
- 'misc/Netmiko/*',
15
- 'misc/ttp_templates_tests/*',
16
- 'platform/*',
17
- 'yang/*']}
18
-
19
- install_requires = \
20
- ['ttp>=0.6.0']
21
-
22
- extras_require = \
23
- {'docs:python_version >= "3.7"': ['mkdocs==1.2.4',
24
- 'mkdocs-material==7.2.2',
25
- 'mkdocs-material-extensions==1.0.1',
26
- 'mkdocstrings[python]>=0.18.0,<0.19.0',
27
- 'pygments==2.11',
28
- 'pymdown-extensions==9.3']}
29
-
30
- setup_kwargs = {
31
- 'name': 'ttp-templates',
32
- 'version': '0.3.2',
33
- 'description': 'Template Text Parser Templates collections',
34
- 'long_description': '[![Downloads](https://pepy.tech/badge/ttp_templates)](https://pepy.tech/project/ttp_templates)\n[![PyPI versions](https://img.shields.io/pypi/pyversions/ttp.svg)](https://pypi.python.org/pypi/ttp_templates/)\n\n# Template Text Parser Templates\n\nThis repository contains a collection of [TTP](https://github.com/dmulyalin/ttp) templates.\n\nIf you solved a problem using TTP and feel that your work can be useful to other people, feel \nfree to raise an issue or submit pull request to include your template(s) in this repository.\nRefer to [Contribute Guide](contribute.md) for details.\n\nDocumentation: [https://dmulyalin.github.io/ttp_templates/](https://dmulyalin.github.io/ttp_templates/)\n\nRepository: [https://github.com/dmulyalin/ttp_templates](https://github.com/dmulyalin/ttp_templates)\n\nTTP: [https://ttp.readthedocs.io/](https://ttp.readthedocs.io/)\n\n## Installation\n\nFrom PyPi:\n\n`pip install ttp-templates`\n\nor latest from GitHub master branch (need Git installed on the system):\n\n`pip install git+https://github.com/dmulyalin/ttp_templates.git`\n \n## Sample usage\n\nThis 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.\n<details><summary>Code</summary>\n\n```python\nfrom ttp_templates import parse_output\nimport pprint\n\ndata = """\ninterface GigabitEthernet1/3.251\n description Customer #32148\n encapsulation dot1q 251\n ip address 172.16.33.10 255.255.255.128\n shutdown\n!\ninterface GigabitEthernet1/3.251\n description Customer #32148\n encapsulation dot1q 251\n ip address 172.16.33.10 255.255.255.128\n shutdown\n"""\n\nresult = parse_output(\n data=data,\n platform="Test Platform",\n command="show run | sec interface"\n)\n\npprint.pprint(result)\n\n# prints:\n# [[[{\'description\': \'Customer #32148\',\n# \'disabled\': True,\n# \'dot1q\': \'251\',\n# \'interface\': \'GigabitEthernet1/3.251\',\n# \'ip\': \'172.16.33.10\',\n# \'mask\': \'255.255.255.128\'},\n# {\'description\': \'Customer #32148\',\n# \'disabled\': True,\n# \'dot1q\': \'251\',\n# \'interface\': \'GigabitEthernet1/3.251\',\n# \'ip\': \'172.16.33.10\',\n# \'mask\': \'255.255.255.128\'}]]]\n```\n</details>\n\nSample code to parse `Cisco IOS` output in a structure compatible with `ietf-interfaces` YANG module.\n<details><summary>Code</summary>\n\n```python\nfrom ttp_templates import get_template\nfrom ttp import ttp\nimport pprint\n\ndata1 = """\ninterface GigabitEthernet1/3.251\n description Customer #32148\n encapsulation dot1q 251\n ip address 172.16.33.10 255.255.255.128\n shutdown\n!\ninterface GigabitEthernet1/4\n description vCPEs access control\n ip address 172.16.33.10 255.255.255.128\n!\n"""\ndata2 = """\ninterface GigabitEthernet1/5\n description Works data\n ip mtu 9000\n!\ninterface GigabitEthernet1/7\n description Works data v6\n ipv6 address 2001::1/64\n ipv6 address 2001:1::1/64 \n"""\n\ntemplate = get_template(yang="ietf-interfaces", platform="cisco_ios")\nparser = ttp(template=template)\n\nparser.add_input(data1)\nparser.add_input(data2)\n\nparser.parse()\nres = parser.result()\npprint.pprint(res)\n\n# prints:\n# [{\'comment\': \'\',\n# \'exception\': {},\n# \'result\': [{\'ietf-interfaces:interfaces\': {\'interface\': [{\'admin-status\': \'down\',\n# \'description\': \'Customer \'\n# \'#32148\',\n# \'enabled\': False,\n# \'ietf-ip:ipv4\': {\'address\': [{\'ip\': \'172.16.33.10\',\n# \'netmask\': \'255.255.255.128\',\n# \'origin\': \'static\'}]},\n# \'if-index\': 1,\n# \'link-up-down-trap-enable\': \'enabled\',\n# \'name\': \'GigabitEthernet1/3.251\',\n# \'oper-status\': \'unknown\',\n# \'statistics\': {\'discontinuity-time\': \'1970-01-01T00:00:00+00:00\'},\n# \'type\': \'iana-if-type:ethernetCsmacd\'},\n# {\'admin-status\': \'up\',\n# \'description\': \'vCPEs \'\n# \'access \'\n# \'control\',\n# \'enabled\': True,\n# \'ietf-ip:ipv4\': {\'address\': [{\'ip\': \'172.16.33.10\',\n# \'netmask\': \'255.255.255.128\',\n# \'origin\': \'static\'}]},\n# \'if-index\': 1,\n# \'link-up-down-trap-enable\': \'enabled\',\n# \'name\': \'GigabitEthernet1/4\',\n# \'oper-status\': \'unknown\',\n# \'statistics\': {\'discontinuity-time\': \'1970-01-01T00:00:00+00:00\'},\n# \'type\': \'iana-if-type:ethernetCsmacd\'}]}},\n# {\'ietf-interfaces:interfaces\': {\'interface\': [{\'admin-status\': \'up\',\n# \'description\': \'Works \'\n# \'data\',\n# \'enabled\': True,\n# \'ietf-ip:ipv4\': {\'mtu\': 9000},\n# \'if-index\': 1,\n# \'link-up-down-trap-enable\': \'enabled\',\n# \'name\': \'GigabitEthernet1/5\',\n# \'oper-status\': \'unknown\',\n# \'statistics\': {\'discontinuity-time\': \'1970-01-01T00:00:00+00:00\'},\n# \'type\': \'iana-if-type:ethernetCsmacd\'},\n# {\'admin-status\': \'up\',\n# \'description\': \'Works \'\n# \'data \'\n# \'v6\',\n# \'enabled\': True,\n# \'ietf-ip:ipv6\': {\'address\': [{\'ip\': \'2001::1\',\n# \'origin\': \'static\',\n# \'prefix-length\': 64},\n# {\'ip\': \'2001:1::1\',\n# \'origin\': \'static\',\n# \'prefix-length\': 64}]},\n# \'if-index\': 1,\n# \'link-up-down-trap-enable\': \'enabled\',\n# \'name\': \'GigabitEthernet1/7\',\n# \'oper-status\': \'unknown\',\n# \'statistics\': {\'discontinuity-time\': \'1970-01-01T00:00:00+00:00\'},\n# \'type\': \'iana-if-type:ethernetCsmacd\'}]}}],\n# \'valid\': {0: True, 1: True}}]\n```\n</details>\n\n## How templates collections structured\n\nThis repository contains three collections of templates corresponding to folder names:\n\n* `platform` collection - mimics [ntc-templates](https://github.com/networktocode/ntc-templates) API and follows same naming rule\n* `yang` collection - contains templates capable of producing YANG compatible structures out of text data\n* `misc` collection - miscellaneous templates for various use cases organized in folders\n\n### Platform collection templates files naming rule\n\n`{{ vendor_os }}_{{ command_with_underscores }}.txt` - lower case only. \n\nNaming rules details:\n\n* All space symbols `\' \'` replaced with underscores.\n* Pipe symbol `|` replaced with `pipe` in template name. For example, \n template to parse Cisco IOS `show run | section interface` command output \n must be named `cisco_ios_show_running_config_pipe_section_interface.txt`\n* Dash symbols `-` replaced with underscores. For example, template to parse \n Huawei `display current-configuration interface` command output must be \n named `huawei_display_current_configuration_interface.txt`\n\n### YANG collection templates files naming rule\n\n`{{ YANG module name }}_{{ platform_name }}.txt` - lower case only\n\nNaming rules details:\n\n* All space symbols `\' \'` replaced with underscore.\n* Dash symbol `-` **does not** replaced with underscore. For example, template\n to produce output compatible with openconfig-lldp YANG model for Cisco IOS\n must be named `openconfig-lldp_cisco_xr.txt`\n\n### Misc collection templates files naming rule\n\n`{{ usecase folder }}/{{ template name }}.txt` - upper or lower case\n\nNaming rules details:\n\n* Nothing replaced with anything, provided template name used as is.\n\n## Additional Templates Resources\n\nList of resources with TTP templates:\n\n- TTP SrosParser - https://pypi.org/project/ttp-sros-parser/ by [h4ndzdatm0ld](https://github.com/h4ndzdatm0ld)\n- Template for parsing "show run" for Cisco IOS - https://github.com/tbotnz/ios-show-run-ttp by [tbotnz](https://github.com/tbotnz)\n- Template for Cisco ASA configuration - https://gist.github.com/consentfactory/85872fc83453d1735b15aed3e47a9763 by [consentfactory](https://gist.github.com/consentfactory)',
35
- 'author': 'Denis Mulyalin',
36
- 'author_email': 'd.mulyalin@gmail.com',
37
- 'maintainer': 'Denis Mulyalin',
38
- 'maintainer_email': 'd.mulyalin@gmail.com',
39
- 'url': 'https://github.com/dmulyalin/ttp_templates',
40
- 'packages': packages,
41
- 'package_data': package_data,
42
- 'install_requires': install_requires,
43
- 'extras_require': extras_require,
44
- 'python_requires': '>=3.6,<4.0',
45
- }
46
-
47
-
48
- setup(**setup_kwargs)
File without changes