Skip to content

Commit

Permalink
updated Netbox templates to add bridge type to the interfaces
Browse files Browse the repository at this point in the history
  • Loading branch information
dmulyalin committed Mar 27, 2023
1 parent 4d81e8c commit 7b4f847
Show file tree
Hide file tree
Showing 12 changed files with 401 additions and 248 deletions.
22 changes: 11 additions & 11 deletions docs/index.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

---

**Templates count: 58**
**Templates count: 59**

---

Expand All @@ -12,9 +12,9 @@

This repository contains a collection of [TTP](https://github.com/dmulyalin/ttp) templates.

If you solved a problem using TTP and feel that your work can be useful to other people, feel
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](contribute.md) for details.
Refer to [Contribute Guide](https://dmulyalin.github.io/ttp_templates/contribute/) for details.

Documentation: [https://dmulyalin.github.io/ttp_templates/](https://dmulyalin.github.io/ttp_templates/)

Expand All @@ -31,7 +31,7 @@ From PyPi:
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.
Expand Down Expand Up @@ -107,7 +107,7 @@ interface GigabitEthernet1/5
interface GigabitEthernet1/7
description Works data v6
ipv6 address 2001::1/64
ipv6 address 2001:1::1/64
ipv6 address 2001:1::1/64
"""

template = get_template(yang="ietf-interfaces", platform="cisco_ios")
Expand Down Expand Up @@ -192,16 +192,16 @@ This repository contains three collections of templates corresponding to folder

### Platform collection templates files naming rule

`{{ vendor_os }}_{{ command_with_underscores }}.txt` - lower case only.
`{{ vendor_os }}_{{ command_with_underscores }}.txt` - lower case only.

Naming rules details:

* All space symbols `' '` replaced with underscores.
* Pipe symbol `|` replaced with `pipe` in template name. For example,
template to parse Cisco IOS `show run | section interface` command output
* Pipe symbol `|` replaced with `pipe` in template name. For example,
template to parse Cisco IOS `show run | section interface` command output
must be named `cisco_ios_show_running_config_pipe_section_interface.txt`
* Dash symbols `-` replaced with underscores. For example, template to parse
Huawei `display current-configuration interface` command output must be
* Dash symbols `-` replaced with underscores. For example, template to parse
Huawei `display current-configuration interface` command output must be
named `huawei_display_current_configuration_interface.txt`

### YANG collection templates files naming rule
Expand Down Expand Up @@ -229,4 +229,4 @@ List of resources with TTP templates:

- TTP SrosParser - https://pypi.org/project/ttp-sros-parser/ by [h4ndzdatm0ld](https://github.com/h4ndzdatm0ld)
- Template for parsing "show run" for Cisco IOS - https://github.com/tbotnz/ios-show-run-ttp by [tbotnz](https://github.com/tbotnz)
- Template for Cisco ASA configuration - https://gist.github.com/consentfactory/85872fc83453d1735b15aed3e47a9763 by [consentfactory](https://gist.github.com/consentfactory)
- Template for Cisco ASA configuration - https://gist.github.com/consentfactory/85872fc83453d1735b15aed3e47a9763 by [consentfactory](https://gist.github.com/consentfactory)
1 change: 0 additions & 1 deletion docs/ttp_templates/misc.N2G.cli_l2_data.cisco_xr.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ Commands parsed:

<details><summary>Template Content</summary>
```
bash-4.4# cat /usr/local/lib/python3.9/site-packages/ttp_templates/misc/N2G/cli_l2_data/cisco_xr.txt
<template name="cisco_xr" results="per_template">
<doc>
Expand Down
22 changes: 21 additions & 1 deletion docs/ttp_templates/misc.Netbox.parse_arista_eos_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,27 @@ ttp://misc/Netbox/parse_arista_eos_config.txt

---

No `<doc>` tags found


Template to parse Arista EOS configuration and produce data structure
that is easy to work with to import data into the Netbox.

This template requires output of `show running-config` command.



---

<details><summary>Template Content</summary>
```
<template name="netbox_data" results="per_template">
<doc>
Template to parse Arista EOS configuration and produce data structure
that is easy to work with to import data into the Netbox.
This template requires output of 'show running-config' command.
</doc>
<input>
commands = [
"show running-config"
Expand All @@ -27,6 +41,12 @@ def add_interface_type(data):
]
):
data["interface_type"] = "virtual"
elif any(
i in data["name"].lower() for i in [
"vlan", "vxlan"
]
):
data["interface_type"] = "bridge"
elif "bundle" in data["name"].lower():
data["interface_type"] = "lag"
return data
Expand Down
24 changes: 22 additions & 2 deletions docs/ttp_templates/misc.Netbox.parse_cisco_xr_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,27 @@ ttp://misc/Netbox/parse_cisco_xr_config.txt

---

No `<doc>` tags found


Template to parse Arista EOS configuration and produce data structure
that is easy to work with to import data into the Netbox.

This template requires output of `show running-config` command.



---

<details><summary>Template Content</summary>
```
<template name="netbox_data" results="per_template">
<doc>
Template to parse Arista EOS configuration and produce data structure
that is easy to work with to import data into the Netbox.
This template requires output of 'show running-config' command.
</doc>
<input>
commands = [
"show running-config"
Expand All @@ -23,10 +37,16 @@ def add_interface_type(data):
data["interface_type"] = "other"
if any(
i in data["name"].lower() for i in [
"bvi", ".", "loopback", "tunnel"
".", "loopback", "tunnel"
]
):
data["interface_type"] = "virtual"
elif any(
i in data["name"].lower() for i in [
"bvi"
]
):
data["interface_type"] = "bridge"
elif "bundle" in data["name"].lower():
data["interface_type"] = "lag"
return data
Expand Down
16 changes: 15 additions & 1 deletion docs/ttp_templates/misc.Netbox.parse_juniper_junos_config.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,27 @@ ttp://misc/Netbox/parse_juniper_junos_config.txt

---

No `<doc>` tags found


Template to parse Juniper Junos configuration and produce data structure
that is easy to work with to import data into the Netbox.

This template requires output of `show configuration | display set` command.



---

<details><summary>Template Content</summary>
```
<template name="netbox_data" results="per_template">
<doc>
Template to parse Juniper Junos configuration and produce data structure
that is easy to work with to import data into the Netbox.
This template requires output of 'show configuration | display set' command.
</doc>
<input>
commands = [
"show configuration | display set"
Expand Down
39 changes: 39 additions & 0 deletions docs/ttp_templates/platform.cisco_ios_show_isdn_status.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Reference path:
```
ttp://platform/cisco_ios_show_isdn_status.txt
```

---



This Template allows to parse show isdn status on a cisco ios xe



---

<details><summary>Template Content</summary>
```
<doc>
This Template allows to parse show isdn status on a cisco ios xe
</doc>
Global ISDN Switchtype = basic-net3
<group name = "interface">
ISDN {{INTERFACE}} interface
dsl 2, interface ISDN Switchtype = {{ISDN_SWITCHTYPE}}
Layer 1 Status:
{{L1_STATUS}}
Layer 2 Status:
TEI = {{TEI_CODE}}, Ces = {{CES}}, SAPI = {{SAPI}}, State = {{TEI_STATE}}
Layer 3 Status:
0 Active Layer 3 Call(s)
Active dsl 2 CCBs = 0
The Free Channel Mask: {{FREE_CHANNEL_MASK}}
Number of L2 Discards = {{L2_DISCARDS}}, L2 Session ID = {{L2_SESSION_ID}}
Total Allocated ISDN CCBs = 1
</group>
```
</details>
1 change: 1 addition & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ nav:
- cisco_ios_show_ip_ospf_database_external: ttp_templates/platform.cisco_ios_show_ip_ospf_database_external.md
- cisco_ios_show_ip_ospf_database_router: ttp_templates/platform.cisco_ios_show_ip_ospf_database_router.md
- cisco_ios_show_ip_ospf_database_summary: ttp_templates/platform.cisco_ios_show_ip_ospf_database_summary.md
- cisco_ios_show_isdn_status: ttp_templates/platform.cisco_ios_show_isdn_status.md
- cisco_ios_show_running_configuration_pipe_section_bgp: ttp_templates/platform.cisco_ios_show_running_configuration_pipe_section_bgp.md
- cisco_ios_show_running_config_pipe_include_source_static: ttp_templates/platform.cisco_ios_show_running_config_pipe_include_source_static.md
- cisco_ios_show_running_config_pipe_section_interface: ttp_templates/platform.cisco_ios_show_running_config_pipe_section_interface.md
Expand Down
Loading

0 comments on commit 7b4f847

Please sign in to comment.