Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1.12.0 Release #606

Merged
merged 12 commits into from
Jan 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 22 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ env:

jobs:
black:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-24.04"
env:
INVOKE_LOCAL: "True"
steps:
Expand All @@ -18,11 +18,11 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
with:
python-version: "3.12"
python-version: "3.13"
- name: "Linting: black"
run: "poetry run invoke black"
bandit:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-24.04"
env:
INVOKE_LOCAL: "True"
steps:
Expand All @@ -31,13 +31,13 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
with:
python-version: "3.12"
python-version: "3.13"
- name: "Linting: bandit"
run: "poetry run invoke bandit"
needs:
- "black"
mypy:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-24.04"
env:
INVOKE_LOCAL: "True"
steps:
Expand All @@ -46,13 +46,13 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
with:
python-version: "3.12"
python-version: "3.13"
- name: "Type-Hints: mypy"
run: "poetry run invoke mypy"
needs:
- "black"
pydocstyle:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-24.04"
env:
INVOKE_LOCAL: "True"
steps:
Expand All @@ -61,13 +61,13 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
with:
python-version: "3.12"
python-version: "3.13"
- name: "Linting: pydocstyle"
run: "poetry run invoke pydocstyle"
needs:
- "black"
flake8:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-24.04"
env:
INVOKE_LOCAL: "True"
steps:
Expand All @@ -76,13 +76,13 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
with:
python-version: "3.12"
python-version: "3.13"
- name: "Linting: flake8"
run: "poetry run invoke flake8"
needs:
- "black"
yamllint:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-24.04"
env:
INVOKE_LOCAL: "True"
steps:
Expand All @@ -91,7 +91,7 @@ jobs:
- name: "Setup environment"
uses: "networktocode/gh-action-setup-poetry-environment@v2"
with:
python-version: "3.12"
python-version: "3.13"
- name: "Linting: yamllint"
run: "poetry run invoke yamllint"
needs:
Expand All @@ -100,8 +100,8 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: "ubuntu-20.04"
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: "ubuntu-24.04"
env:
PYTHON_VER: "${{ matrix.python-version }}"
steps:
Expand Down Expand Up @@ -133,11 +133,11 @@ jobs:
- "flake8"
- "yamllint"
pylint:
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-24.04"
strategy:
fail-fast: true
matrix:
python-version: ["3.12"]
python-version: ["3.13"]
env:
PYTHON_VER: "${{ matrix.python-version }}"
steps:
Expand Down Expand Up @@ -173,8 +173,8 @@ jobs:
strategy:
fail-fast: true
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
runs-on: "ubuntu-20.04"
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13"]
runs-on: "ubuntu-24.04"
env:
PYTHON_VER: "${{ matrix.python-version }}"
steps:
Expand Down Expand Up @@ -212,15 +212,15 @@ jobs:
- "pylint"
publish_gh:
name: "Publish to GitHub"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-24.04"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.12"
python-version: "3.13"
- name: "Install Python Packages"
run: "pip install poetry"
- name: "Set env"
Expand All @@ -241,15 +241,15 @@ jobs:
- "pytest"
publish_pypi:
name: "Push Package to PyPI"
runs-on: "ubuntu-20.04"
runs-on: "ubuntu-24.04"
if: "startsWith(github.ref, 'refs/tags/v')"
steps:
- name: "Check out repository code"
uses: "actions/checkout@v2"
- name: "Set up Python"
uses: "actions/setup-python@v2"
with:
python-version: "3.12"
python-version: "3.13"
- name: "Install Python Packages"
run: "pip install poetry"
- name: "Set env"
Expand Down
7 changes: 7 additions & 0 deletions docs/admin/release_notes/version_1.11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# v1.11 Release Notes

## Release Overview

- Release is the same as v1.10.1

## [v1.11.0] 2024-12
19 changes: 19 additions & 0 deletions docs/admin/release_notes/version_1.12.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# v1.12 Release Notes

## Release Overview

- Added Python 3.13 support.
- Removed Python 3.8 support.

## [v1.12.0] 2025-01

### Added
- [593](https://github.com/networktocode/netutils/pull/593) Add nokia_srl to the mappers.

### Changed

- [603](https://github.com/networktocode/netutils/pull/603) Add support for Python 3.8 and add Python 3.13.

### Fixed

- [602](https://github.com/networktocode/netutils/pull/602) Fix ASA banner config parsing.
2 changes: 1 addition & 1 deletion docs/dev/contributing.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Pull requests are welcomed and automatically built and tested against multiple versions of Python through GitHub Actions.

Except for unit tests, testing is only supported on Python 3.9.
Except for unit tests, testing is only supported on Python 3.13.

The project is packaged with a light development environment based on `Docker` to help with the local development of the project and to run tests within GitHub Actions.

Expand Down
1 change: 1 addition & 0 deletions docs/user/lib_mapper/ansible.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,6 @@
| f5networks.f5_bigip.bigip | → | bigip_f5 |
| fortinet.fortios.fortios | → | fortinet |
| junipernetworks.junos.junos | → | juniper_junos |
| nokia.srl | → | nokia_srl |
| paloaltonetworks.panos.panos | → | paloalto_panos |
| vyos.vyos.vyos | → | vyos |
1 change: 1 addition & 0 deletions docs/user/lib_mapper/ansible_reverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
| lenovo_cnos | → | community.network.cnos |
| lenovo_enos | → | community.network.enos |
| mikrotik_routeros | → | community.network.routeros |
| nokia_srl | → | nokia.srl |
| nokia_sros | → | community.network.sros |
| paloalto_panos | → | paloaltonetworks.panos.panos |
| pluribus | → | community.network.netvisor |
Expand Down
1 change: 1 addition & 0 deletions docs/user/lib_mapper/napalm.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@
| nxos_ssh | → | cisco_nxos |
| panos | → | paloalto_panos |
| ros | → | mikrotik_routeros |
| srl | → | nokia_srl |
| sros | → | nokia_sros |
| vyos | → | vyos |
1 change: 1 addition & 0 deletions docs/user/lib_mapper/napalm_reverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
| huawei | → | huawei_vrp |
| juniper_junos | → | junos |
| mikrotik_routeros | → | ros |
| nokia_srl | → | srl |
| nokia_sros | → | sros |
| paloalto_panos | → | panos |
| vyos | → | vyos |
1 change: 1 addition & 0 deletions docs/user/lib_mapper/netmiko.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@
| netapp_cdot | → | netapp_cdot |
| netgear_prosafe | → | netgear_prosafe |
| netscaler | → | netscaler |
| nokia_srl | → | nokia_srl |
| nokia_sros | → | nokia_sros |
| oneaccess_oneos | → | oneaccess_oneos |
| ovs_linux | → | ovs_linux |
Expand Down
1 change: 1 addition & 0 deletions docs/user/lib_mapper/netmiko_reverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@
| netapp_cdot | → | netapp_cdot |
| netgear_prosafe | → | netgear_prosafe |
| netscaler | → | netscaler |
| nokia_srl | → | nokia_srl |
| nokia_sros | → | nokia_sros |
| oneaccess_oneos | → | oneaccess_oneos |
| ovs_linux | → | ovs_linux |
Expand Down
1 change: 1 addition & 0 deletions docs/user/lib_mapper/ntctemplates.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@
| netapp_cdot | → | netapp_cdot |
| netgear_prosafe | → | netgear_prosafe |
| netscaler | → | netscaler |
| nokia_srl | → | nokia_srl |
| nokia_sros | → | nokia_sros |
| oneaccess_oneos | → | oneaccess_oneos |
| ovs_linux | → | ovs_linux |
Expand Down
1 change: 1 addition & 0 deletions docs/user/lib_mapper/ntctemplates_reverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
| netapp_cdot | → | netapp_cdot |
| netgear_prosafe | → | netgear_prosafe |
| netscaler | → | netscaler |
| nokia_srl | → | nokia_srl |
| nokia_sros | → | nokia_sros |
| oneaccess_oneos | → | oneaccess_oneos |
| ovs_linux | → | ovs_linux |
Expand Down
3 changes: 2 additions & 1 deletion docs/user/lib_mapper/scrapli.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,5 @@
| cisco_iosxe | → | cisco_ios |
| cisco_iosxr | → | cisco_xr |
| cisco_nxos | → | cisco_nxos |
| juniper_junos | → | juniper_junos |
| juniper_junos | → | juniper_junos |
| nokia_srlinux | → | nokia_srl |
3 changes: 2 additions & 1 deletion docs/user/lib_mapper/scrapli_reverse.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
| cisco_nxos | → | cisco_nxos |
| cisco_xe | → | cisco_iosxe |
| cisco_xr | → | cisco_iosxr |
| juniper_junos | → | juniper_junos |
| juniper_junos | → | juniper_junos |
| nokia_srl | → | nokia_srlinux |
3 changes: 3 additions & 0 deletions mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,9 @@ nav:
- Uninstall: "admin/uninstall.md"
- Release Notes:
- "admin/release_notes/index.md"
- v1.12: "admin/release_notes/version_1.12.md"
- v1.11: "admin/release_notes/version_1.11.md"
- v1.10: "admin/release_notes/version_1.10.md"
- v1.9: "admin/release_notes/version_1.9.md"
- v1.8: "admin/release_notes/version_1.8.md"
- v1.7: "admin/release_notes/version_1.7.md"
Expand Down
19 changes: 18 additions & 1 deletion netutils/config/parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,7 +417,7 @@ def find_children_w_parents(
]
for cfg_line in self.build_config_relationship():
parents = cfg_line.parents[0] if cfg_line.parents else None
if parents in potential_parents and self._match_type_check(parents, parent_pattern, match_type):
if parents in potential_parents and self._match_type_check(parents, parent_pattern, match_type): # type: ignore[arg-type]
config.append(cfg_line.config_line)
return config

Expand Down Expand Up @@ -913,6 +913,7 @@ def banner_end(self) -> str:
class ASAConfigParser(CiscoConfigParser):
"""Cisco ASA implementation of ConfigParser Class."""

banner_start: t.List[str] = ["banner"]
comment_chars: t.List[str] = ["!", ":"]

def __init__(self, config: str):
Expand All @@ -925,6 +926,22 @@ def __init__(self, config: str):
self.same_line_children: t.Set[ConfigLine] = set()
super(ASAConfigParser, self).__init__(config)

def is_banner_start(self, line: str) -> bool:
"""Determine if the line starts a banner config.

Args:
line: The current config line in iteration.

Returns:
True if line starts banner, else False.
"""
for banner_start in self.banner_start:
if not line:
return False
if line.startswith(banner_start):
return True
return False

def _update_config_lines(self, config_line: str) -> None:
"""Add a ``ConfigLine`` object to ``self.config_lines``.

Expand Down
Loading
Loading