Skip to content

Commit 22cb4f6

Browse files
committed
bump to 0.4.0
1 parent c83ff40 commit 22cb4f6

File tree

53 files changed

+2961
-1208
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+2961
-1208
lines changed

docs/contribute.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,12 +35,11 @@ Before you start, make sure to think of for each template:
3535
* `misc` category - miscellaneous templates for various use cases organized in folders, naming
3636
rule is - `{{ usecase folder }}/{{ template name }}.txt` - upper or lower case
3737

38-
To prepare your working environment might need to install required packages using requirements
39-
files located in TTP Templates repository e.g.:
38+
To prepare your working environment you will need to install the required packages. The project
39+
uses [Poetry](https://python-poetry.org/) for dependency management:
4040

4141
```bash
42-
python3 -m pip install -r requirements-dev.txt
43-
python3 -m pip install -r requirements-docs.txt
42+
poetry install
4443
```
4544

4645
To add new template or multiple templates follow these steps:
@@ -122,8 +121,9 @@ interface Loopback0
122121
assert res == expected_output
123122
```
124123

125-
That test can be placed inside `test_platform_cisco_ios.py` file and run using command:
124+
That test can be placed inside `test_platform_cisco_ios.py` file and run using the command:
126125

127126
```bash
128-
pytest -vv test_platform_cisco_ios::test_cisco_ios_show_run_pipe_section_interface
127+
cd test
128+
poetry run pytest -vv test_platform_cisco_ios.py::test_cisco_ios_show_run_pipe_section_interface
129129
```

docs/index.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
---
33

4-
**Templates count: 61**
4+
**Templates count: 66**
55

66
---
77

docs/release_notes.md

Lines changed: 68 additions & 171 deletions
Original file line numberDiff line numberDiff line change
@@ -1,215 +1,112 @@
11
# Release Notes
22

3-
## v0.1.2
4-
5-
### Minor Features
6-
7-
- Added support for `get_template` method to source template by path like `ttp://path/to/template.txt`
8-
- Added `ttp_vars.py` to repository to store common TTP variables
9-
- Added `short_interface_names` dictionary in `ttp_vars.py` for `resuball` to normalize interface names to shorter version
10-
11-
### New Templates
12-
13-
- `misc/Netmiko/cisco.ios.arp.txt`
14-
- `misc/Netmiko/cisco.ios.cfg.ip.txt`
15-
- `misc/Netmiko/cisco.iosxr.arp.txt`
16-
- `misc/Netmiko/huawei.vrp.cfg.ip.txt`
17-
- `yang/openconfig-lldp_cisco_ios.txt`
18-
- `yang/openconfig-lldp_cisco_nxos.txt`
19-
- `yang/openconfig-lldp_cisco_xr.txt`
20-
- `misc/netmiko/cisco.iosxr.cfg.ip.txt`
21-
- `mis/platform/arista_eos_show_hostname.txt`
22-
23-
### Changes
3+
## v0.4.0
244

255
### Bugs
266

27-
## v0.1.3
28-
29-
### Bugs
30-
31-
- Fixed TTP Templates docs example path formation, should be not `ttp://misc.Netmiko.cisco.ios.arp.txt` but `ttp://misc/Netmiko/cisco.ios.arp.txt`
32-
33-
### New Templates
34-
35-
- Added N2G templates
36-
37-
## v0.2.0
7+
- **Bug 1**`parse_output` now raises `ValueError` with a descriptive message
8+
when called without any valid template-locating argument (previously the
9+
`None` returned by `get_template` was silently forwarded to the TTP
10+
constructor, causing confusing downstream errors).
11+
- **Bug 2** – Fixed path-traversal vulnerability (OWASP A01) in `get_template`.
12+
The resolved template filename is now verified with `os.path.realpath` to
13+
confirm it falls inside the package directory before the file is opened;
14+
crafted paths such as `path="../../etc/passwd"` now raise `ValueError`.
15+
- **Bug 3** – Fixed `list_templates` crashing with `AttributeError` when a
16+
template file is placed directly inside the `misc/` root directory (rather
17+
than in a subdirectory). The leaf-assignment logic now checks whether the
18+
target key already holds a dict; if it does, the files are stored under the
19+
empty-string sub-key instead of overwriting the dict with a list.
20+
- **Bug 4**`list_templates` now returns file lists in sorted alphabetical
21+
order. Previously `os.walk` / `os.listdir` produced non-deterministic
22+
ordering across operating systems and filesystems, making the output
23+
unreliable for callers and difficult to test reliably.
24+
- **Bug 5** – Fixed prefix-ambiguity in `short_interface_names` (`ttp_vars.py`).
25+
The `2GE` patterns `'^Tw'` and `'^Two'` were broad enough to also match
26+
`TwoHundredGigabitEthernet*` (200GE) names because `2GE` appeared before
27+
`200GE` in the dict. Negative look-ahead anchors
28+
(`r'^Tw(?!entyFive|oHundred)'` and `r'^Two(?!Hundred)'`) were added so
29+
only genuine 2GE interface names are matched.
3830

3931
### Changes
4032

41-
- Moved to Poetry for dependency management
33+
- Python minimum version bumped to 3.10.
34+
- Improved logging throughout all public API functions.
35+
- Improved type hint annotations and converted docstrings to Google format.
36+
- Improved inline comments for clarity.
37+
38+
## v0.3.2
4239

4340
### Templates
4441

45-
Added templates:
42+
- Added `misc/Netbox` folder with templates for Junos, IOS-XR, and Arista devices configuration.
4643

47-
- `ttp://platform/juniper_show_isis_database_verbose_pipe_no_more.txt`
48-
- `ttp://misc/N2G/cli_l2_data/juniper.txt`
49-
- `ttp://misc/N2G/cli_isis_data/juniper.txt`
50-
- `ttp://platform/arista_eos_show_hostname.txt`
44+
## v0.3.1
5145

52-
Modified templates:
46+
### Templates
5347

54-
- `ttp://platform/cisco_xr_show_isis_database_verbose.txt` updated produced data structure to key LSPs by hostnames
48+
- Added `ttp://misc/N2G/cli_ip_data/arista_eos.txt` template to parse Arista EOS IP details for N2G L3 diagrams.
5549

5650
## v0.3.0
5751

5852
### Features
5953

60-
- Added `list_templates` method to list available templates
54+
- Added `list_templates` method to list available templates.
6155

6256
### Bugs
6357

64-
- Fixed Cisco IOS `show running-configuration` to correct command: `show running-config`
65-
- Updated N2G IOS-XR `cli_ip_data` template to match `ipv4 address 1.1.1.1/32` like config
58+
- Fixed Cisco IOS `show running-configuration` to correct command: `show running-config`.
59+
- Updated N2G IOS-XR `cli_ip_data` template to match `ipv4 address 1.1.1.1/32` style config.
6660

6761
### Templates
6862

69-
- Updated all N2G templates to have default input with required commands and platform attributes
70-
71-
## v0.3.1
63+
- Updated all N2G templates to have default input with required commands and platform attributes.
7264

73-
### Templates
65+
## v0.2.0
7466

75-
- Added `ttp://misc/N2G/cli_ip_data/arista_eos.txt` template to parse Arista EOS IP details for N2G L3 diagrams
67+
### Changes
7668

77-
## v0.3.2
69+
- Moved to Poetry for dependency management.
7870

7971
### Templates
8072

81-
- Added `misc/Netbox` folder with templates for Junos, IOS-XR, and Arista devices configuration
82-
83-
# v0.1.2
84-
85-
# Minor FEATURES
86-
87-
1. Added support for "get_template" method to source template by path like "ttp://path/to/template.txt"
88-
2. Added "ttp_vars.py" to repository to store common TTP variables
89-
3. Added "short_interface_names" dictionary in "ttp_vars.py" for "resuball" to normalize interface names to shorter version
90-
91-
# NEW TEMPLATES
92-
93-
1. misc/Netmiko/cisco.ios.arp.txt
94-
2. misc/Netmiko/cisco.ios.cfg.ip.txt
95-
3. misc/Netmiko/cisco.iosxr.arp.txt
96-
4. misc/Netmiko/huawei.vrp.cfg.ip.txt
97-
5. yang/openconfig-lldp_cisco_ios.txt
98-
6. yang/openconfig-lldp_cisco_nxos.txt
99-
7. yang/openconfig-lldp_cisco_xr.txt
100-
9. misc/netmiko/cisco.iosxr.cfg.ip.txt
101-
10. mis/platform/arista_eos_show_hostname.txt
102-
103-
# CHANGES
104-
105-
1.
106-
107-
# BUGS
108-
109-
1.
110-
111-
---
112-
113-
# v0.1.3
114-
115-
116-
# BUGS
117-
118-
1. Fixed TTP Templates docs example path formation, should be not "ttp://misc.Netmiko.cisco.ios.arp.txt" but ttp://misc/Netmiko/cisco.ios.arp.txt
119-
120-
# NEW TEMPLATES
121-
122-
1. Added N2G templates
123-
124-
---
125-
126-
# v0.2.0
127-
128-
129-
# CHANGES
130-
131-
1. Moved to Poetry for dependency management
132-
133-
# TEMPLATES
134-
135-
1. Added templates:
136-
137-
- ttp://platform/juniper_show_isis_database_verbose_pipe_no_more.txt
138-
- ttp://misc/N2G/cli_l2_data/juniper.txt
139-
- ttp://misc/N2G/cli_isis_data/juniper.txt
140-
- ttp://platform/arista_eos_show_hostname.txt
141-
142-
2. Modified templates:
143-
144-
- ttp://platform/cisco_xr_show_isis_database_verbose.txt - updated produced data structure to key LSPs by hostnames
145-
146-
---
147-
148-
# v0.3.0
149-
150-
151-
# FEATURES
152-
153-
1. Added "list_templates" method to list available templates
154-
155-
# BUGS
156-
157-
1. Fixed Cisco IOS "show running-configuration" to correct command - "show running-config"
158-
2. Updated N2G ios-xr cli_ip_data template to match "ipv4 address 1.1.1.1/32" like config
159-
160-
# TEMPLATES
161-
162-
1. Updated all N2G Templates to have default input with required commands and platform attributes
163-
164-
---
165-
166-
# v0.3.1
167-
73+
Added templates:
16874

169-
# TEMPLATES
75+
- `ttp://platform/juniper_junos_show_isis_database_verbose_pipe_no_more.txt`
76+
- `ttp://misc/N2G/cli_l2_data/juniper.txt`
77+
- `ttp://misc/N2G/cli_isis_data/juniper.txt`
78+
- `ttp://platform/arista_eos_show_hostname.txt`
17079

171-
1. Added ttp://misc/N2G/cli_ip_data/arista_eos.txt template to parse Arista EOS IP details for N2G L3 diagrams
80+
Modified templates:
17281

173-
---
82+
- `ttp://platform/cisco_xr_show_isis_database_verbose.txt` – updated produced data structure to key LSPs by hostname.
17483

175-
# v0.3.2
84+
## v0.1.3
17685

86+
### Bugs
17787

178-
# TEMPLATES
88+
- Fixed TTP Templates docs example path formation: the correct path is `ttp://misc/Netmiko/cisco.ios.arp.txt`, not `ttp://misc.Netmiko.cisco.ios.arp.txt`.
17989

180-
1. Added misc/Netbox folder with templates for Junos, IOS-XR and Arista devices configuration
90+
### New Templates
18191

182-
---
92+
- Added N2G templates.
18393

184-
# v0.4.0
94+
## v0.1.2
18595

186-
## BUGS
96+
### Minor Features
18797

188-
- **Bug 1**`parse_output` now raises `ValueError` with a descriptive message
189-
when called without any valid template-locating argument (previously the
190-
`None` returned by `get_template` was silently forwarded to the TTP
191-
constructor, causing confusing downstream errors).
192-
- **Bug 2** – Fixed path-traversal vulnerability (OWASP A01) in `get_template`.
193-
The resolved template filename is now checked with `os.path.realpath` to
194-
confirm it falls inside the package directory before the file is opened;
195-
crafted paths such as `path="../../etc/passwd"` now raise `ValueError`.
196-
- **Bug 3** – Fixed `list_templates` crashing with `AttributeError` when a
197-
template file is placed directly inside the `misc/` root directory (rather
198-
than in a subdirectory). The leaf-assignment logic now checks whether the
199-
target key already holds a dict; if it does, files are stored under the
200-
empty-string sub-key instead of overwriting the dict with a list.
201-
- **Bug 4**`list_templates` now returns file lists in sorted alphabetical
202-
order. Previously `os.walk` / `os.listdir` produced non-deterministic
203-
ordering across operating systems and filesystems, making the output
204-
unreliable for callers and difficult to test.
205-
- **Bug 5** – Fixed prefix-ambiguity in `short_interface_names` (`ttp_vars.py`).
206-
The `2GE` patterns ``'^Tw'`` and ``'^Two'`` were broad enough to also match
207-
`TwoHundredGigabitEthernet*` (200GE) names because `2GE` appeared before
208-
`200GE` in the dict. Negative look-ahead anchors
209-
(``r'^Tw(?!entyFive|oHundred)'`` and ``r'^Two(?!Hundred)'``) were added so
210-
only genuine 2GE interface names are matched.
98+
- Added support for `get_template` to source a template by path using the `ttp://` URI scheme.
99+
- Added `ttp_vars.py` to repository to store common TTP variables.
100+
- Added `short_interface_names` dictionary in `ttp_vars.py` for use with `resuball` to normalize interface names to shorter abbreviations.
211101

212-
## CHANGES
102+
### New Templates
213103

214-
1. Python minimum version bumped to 3.10
215-
2. Improving logging, type hints, commetns and converted docstrings to Google format
104+
- `misc/Netmiko/cisco.ios.arp.txt`
105+
- `misc/Netmiko/cisco.ios.cfg.ip.txt`
106+
- `misc/Netmiko/cisco.iosxr.arp.txt`
107+
- `misc/Netmiko/huawei.vrp.cfg.ip.txt`
108+
- `yang/openconfig-lldp_cisco_ios.txt`
109+
- `yang/openconfig-lldp_cisco_nxos.txt`
110+
- `yang/openconfig-lldp_cisco_xr.txt`
111+
- `misc/Netmiko/cisco.iosxr.cfg.ip.txt`
112+
- `platform/arista_eos_show_hostname.txt`

0 commit comments

Comments
 (0)