Skip to content

Commit 445f6ae

Browse files
Update spelling
1 parent 137ffbe commit 445f6ae

5 files changed

Lines changed: 15 additions & 12 deletions

File tree

docs/user/lib_use_cases.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,25 @@ As the Python library is intended to be a low-level implementation, the primary
66

77
Functions are grouped with like functions, such as IP or MAC address based functions. Included to date are groupings of:
88

9+
- ASN - Provides the ability to convert BGP ASN from integer to dot notation and back.
910
- Bandwidth - Provides the ability to convert between various bandwidth values.
1011
- Banner - Provides the ability to normalize the various banner delimiters.
11-
- BGP ASN - Provides the ability to convert BGP ASN from integer to dot notation.
1212
- Configuration
1313
- Cleaning - Provides the ability to remove or replace lines based on regex matches.
1414
- Compliance - Provides the ability to compare two configurations to sanely understand the differences.
15+
- Conversion - Provides the ability to convert between different syntax's within the same OS.
1516
- Parsing - Provides the ability to parse configuration for the minor differences that are there.
1617
- DNS - Provides the ability to work with DNS, such as validating that a FQDN is resolvable.
1718
- Interface - Provides the ability to work with interface names, expanding, abbreviating, and splitting the names.
1819
- IP Address - Provides the ability to work with IP addresses, primarily exposing Python `ipaddress` functionality.
1920
- Library Helpers - Provides helpers to pull useful information, e.g. NAPALM getters.
2021
- Library Mapper - Provides mappings in expected vendor names between Netmiko, NAPALM, pyntc, ntc-templates, pyats, and scrapli.
2122
- MAC Address - Provides the ability to work with MAC addresses such as validating or converting to integer.
23+
- OS Version - Provides the ability to work with OS version, such as defining an upgrade path.
2224
- Password - Provides the ability to compare and encrypt common password schemas such as type5 and type7 Cisco passwords.
2325
- Ping - Provides the ability to ping, currently only tcp ping.
2426
- Protocol Mapper - Provides a mapping for protocol names to numbers and vice versa.
27+
- Regex - Provide convenience methods for regex to be used in Jinja2.
2528
- Route - Provides the ability to provide a list of routes and an IP Address and return the longest prefix matched route.
2629
- Time -Provides the ability to convert between integer time and string times.
2730
- VLANs - Provide the ability to convert configuration into lists or lists into configuration.

docs/user/lib_use_cases_protocol_mappers.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,11 +79,11 @@ Take the below example.
7979
|compressnet| 3| tcp| Compression Process |
8080
|compressnet| 3| udp| Compression Process |
8181

82-
As you can see, the service name and port comboniation is not unique. As such, on the second one, a `-secondary` is appended to the name to accomdate. The resulting structure looks something like:
82+
As you can see, the service name and port combination is not unique. As such, on the second one, a `-secondary` is appended to the name to accommodate. The resulting structure looks something like:
8383

8484
```python
8585
"compressnet": {"port_number": 2, "protocols": ["tcp", "udp"]},
8686
"compressnet-secondary": {"port_number": 3, "protocols": ["tcp", "udp"]},
8787
```
8888

89-
This behaviour is to be expected.
89+
This behavior is to be expected.

netutils/interface.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -147,8 +147,8 @@ def canonical_interface_name_list(
147147
"""Function to return a list of interface's canonical name (fully expanded name).
148148
149149
Use of explicit matches used to indicate a clear understanding on any potential
150-
match. Regex and other looser matching methods were not implmented to avoid false
151-
positive matches. As an example, it would make sense to do "[P|p][O|o]" which would
150+
match. Regex and other looser matching methods were not implemented to avoid false
151+
positive matches. As an example, it would make sense to do `[P|p][O|o]` which would
152152
incorrectly match PO = POS and Po = Port-channel, leading to a false positive, not
153153
easily troubleshot, found, or known.
154154
@@ -420,7 +420,7 @@ def _iter_tree(node: t.Dict[CharacterClass, t.Any], parents: t.List[CharacterCla
420420
"""Walk a tree of interface name parts.
421421
422422
Weights are assigned based on domain logic to produce a
423-
'cannonical' ordering of names.
423+
'canonical' ordering of names.
424424
"""
425425
for _, items in itertools.groupby(sorted(node.keys()), lambda t: t.weight):
426426
for item in sorted(items):
@@ -446,8 +446,8 @@ def sort_interface_list(interfaces: t.List[str]) -> t.List[str]:
446446
Examples:
447447
>>> sort_interface_list(["Gi1/0/1", "Gi1/0/3", "Gi1/0/3.100", "Gi1/0/2", "Gi1/0/2.50", "Gi2/0/2", "Po40", "Po160", "Lo10"])
448448
['Gi1/0/1', 'Gi1/0/2', 'Gi1/0/2.50', 'Gi1/0/3', 'Gi1/0/3.100', 'Gi2/0/2', 'Lo10', 'Po40', 'Po160']
449-
>>> sort_interface_list(['GigabitEthernet1/0/1', 'GigabitEthernet1/0/3', 'GigabitEthernet1/0/2', "GigabitEthernett3/0/5", 'GigabitEthernet3/0/7', 'GigabitEthernet2/0/8.5', 'Port-channel40', 'Vlan20', 'Loopback10'])
450-
['GigabitEthernet1/0/1', 'GigabitEthernet1/0/2', 'GigabitEthernet1/0/3', 'GigabitEthernet2/0/8.5', 'GigabitEthernet3/0/7', 'GigabitEthernett3/0/5', 'Loopback10', 'Port-channel40', 'Vlan20']
449+
>>> sort_interface_list(['GigabitEthernet1/0/1', 'GigabitEthernet1/0/3', 'GigabitEthernet1/0/2', "GigabitEthernet3/0/5", 'GigabitEthernet3/0/7', 'GigabitEthernet2/0/8.5', 'Port-channel40', 'Vlan20', 'Loopback10'])
450+
['GigabitEthernet1/0/1', 'GigabitEthernet1/0/2', 'GigabitEthernet1/0/3', 'GigabitEthernet2/0/8.5', 'GigabitEthernet3/0/5', 'GigabitEthernet3/0/7', 'Loopback10', 'Port-channel40', 'Vlan20']
451451
"""
452452
root: t.Dict[CharacterClass, t.Any] = {}
453453
for ifname in interfaces:

netutils/password.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -250,12 +250,12 @@ def encrypt_cisco_type5(unencrypted_password: str, salt: t.Optional[str] = None,
250250
if not salt:
251251
salt = "".join(secrets.choice(ALPHABET) for _ in range(salt_len))
252252
elif not set(salt) <= set(ALPHABET):
253-
raise ValueError(f"type5_pw salt used inproper characters, must be one of {ALPHABET}")
253+
raise ValueError(f"type5_pw salt used improper characters, must be one of {ALPHABET}")
254254
return crypt.crypt(unencrypted_password, f"$1${salt}$")
255255

256256

257257
def encrypt_cisco_type7(unencrypted_password: str, salt: t.Optional[int] = None) -> str:
258-
"""Given an unencrypted password of Cisco Type 7 password, encypt it.
258+
"""Given an unencrypted password of Cisco Type 7 password, encrypt it.
259259
260260
Args:
261261
unencrypted_password: A password that has not been encrypted, and will be compared against.
@@ -397,7 +397,7 @@ def decrypt_juniper_type9(encrypted_password: str) -> str:
397397
nibble = stripped_password_characters[0 : len(decode)] # noqa: E203
398398
stripped_password_characters = stripped_password_characters[len(decode) :] # noqa: E203
399399

400-
# Decode value for nibble and convert to character, append to decryped password
400+
# Decode value for nibble and convert to character, append to decrypted password
401401
value = 0
402402
for index, char in enumerate(nibble):
403403
gap = (

netutils/regex.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def regex_search(pattern: str, string: str) -> t.Union[t.List[str], str, None]:
109109

110110

111111
def regex_split(pattern: str, string: str, maxsplit: int = 0) -> t.List[str]:
112-
"""Given a regex pattern and string, return the split the object based on the patern a single element or single element of original value if there is no match.
112+
"""Given a regex pattern and string, return the split the object based on the pattern a single element or single element of original value if there is no match.
113113
114114
The main purpose of this function is provide a Jinja2 filter as this is simply a wrapper around `re.split`.
115115

0 commit comments

Comments
 (0)