Skip to content

Commit bfe9778

Browse files
authored
Merge pull request #1592 from napalm-automation/develop
NAPALM Release 4.0.0
2 parents fe35c90 + dde6a59 commit bfe9778

File tree

82 files changed

+3442
-1509
lines changed

Some content is hidden

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

82 files changed

+3442
-1509
lines changed

.github/workflows/commit.yaml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,16 @@
1-
---
1+
---
22
name: build
33
on: [push, pull_request]
4+
permissions:
5+
contents: read
6+
47
jobs:
58
std_tests:
69
runs-on: ubuntu-latest
710
strategy:
811
max-parallel: 4
912
matrix:
10-
python-version: [3.6, 3.7, 3.8, 3.9]
13+
python-version: [3.7, 3.8, 3.9, 3.10.0]
1114

1215
steps:
1316
- name: Checkout repository
@@ -33,10 +36,14 @@ jobs:
3336
run: |
3437
pylama .
3538
39+
- name: Run type checker
40+
run: |
41+
mypy -p napalm --config-file mypy.ini
42+
3643
- name: Run Tests
3744
run: |
3845
py.test --cov=napalm --cov-report term-missing -vs --pylama
39-
46+
4047
build_docs:
4148
needs: std_tests
4249
runs-on: ubuntu-latest

.github/workflows/pythonpublish.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ on:
55
tags:
66
- '*'
77

8+
permissions:
9+
contents: read
10+
811
jobs:
912
deploy:
1013
runs-on: ubuntu-latest

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,9 @@ Install
3131
pip install napalm
3232
```
3333

34+
*Note*: Beginning with release 4.0.0 and later, NAPALM offers support for
35+
Python 3.7+ only.
36+
3437
*Note*: Beginning with release 3.0.0 and later, NAPALM offers support for
3538
Python 3.6+ only.
3639

docs/installation/index.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,11 @@ You can install napalm with pip:
1212
1313
That will install all the core drivers currently available.
1414

15+
.. note::
16+
17+
Beginning with release 4.0.0 and later, NAPALM offers support for Python
18+
3.7+ only.
19+
1520
.. note::
1621

1722
Beginning with release 3.0.0 and later, NAPALM offers support for Python

docs/support/eos.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ Minimum Version
66

77
To be able to support the ``compare_config``, ``load_merge_candidate`` or ``load_replace_candidate`` methods you will require to run at least EOS version `4.15.0F`.
88

9+
The ssh driver for the config session timers requires you to run at least EOS 4.18.0F.
10+
911
Multi-line/HEREDOC
1012
~~~~~~~~~~~~~~~~~~
1113
EOS configuration is loaded via ``pyeapi.eapilib.Node.run_commands()``, which by itself cannot handle multi-line commands

docs/support/index.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ ____________________________________
138138
* :code:`use_keys` (ios, iosxr, nxos_ssh) - Paramiko argument, enable searching for discoverable private key files in ``~/.ssh/`` (default: ``False``).
139139
* :code:`eos_autoComplete` (eos) - Allows to set `autoComplete` when running commands. (default: ``None`` equivalent to ``False``)
140140
* :code:`config_encoding` (iosxr_netconf) - Set encoding to either ``"xml"`` or ``"cli"`` for configuration load methods. (default: ``"cli"``)
141-
* :code:`eos_fn0039_config` (eos) - Transform old style configuration to the new style, available beginning with EOS release 4.23.0, as per FN 0039. Beware
141+
* :code:`eos_fn0039_config` (eos) - Transform old style configuration to the new style, available beginning with EOS release 4.23.0, as per FN 0039. Beware
142142
that enabling this option will change the configuration you're loading through NAPALM. Default: ``False`` (won't change your configuration commands).
143143
.. versionadded:: 3.0.1
144144

@@ -147,9 +147,9 @@ ______________________
147147

148148
Certain drivers support providing an alternate transport in the :code:`optional_args`, overriding the default protocol to connect with. Allowed transports are therefore device/library dependant:
149149

150-
=============== ==================== ==================== ===================
151-
_ EOS NXOS IOS
152-
=============== ==================== ==================== ===================
153-
**Default** ``https`` ``https`` ``ssh``
154-
**Supported** ``http``, ``https`` ``http``, ``https`` ``telnet``, ``ssh``
155-
=============== ==================== ==================== ===================
150+
=============== ============================ ==================== ===================
151+
_ EOS NXOS IOS
152+
=============== ============================ ==================== ===================
153+
**Default** ``https`` ``https`` ``ssh``
154+
**Supported** ``http``, ``https``, ``ssh`` ``http``, ``https`` ``telnet``, ``ssh``
155+
=============== ============================ ==================== ===================

docs/support/nxos.rst

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,4 +66,29 @@ As a result, merges are **not atomic**.
6666
Diffs
6767
_____
6868

69-
Diffs for merges are simply the lines in the merge candidate config.
69+
Diffs for merges are simply the lines in the merge candidate config. `Netutils <https://netutils.readthedocs.io/en/latest/>`__ is used for creating the merge diff between the candidate and running configurations.
70+
One caveat of using netutils diff of configurations is that the diff is performed offline and not online in the device.
71+
72+
Example assuming that the device config contains:
73+
74+
.. code-block::
75+
76+
interface loopback0
77+
ip address 10.1.4.4/32
78+
ip router ospf 100 area 0.0.0.1
79+
80+
Then what you will get with the diff:
81+
82+
.. code-block:: python
83+
84+
candidate_cfg = """
85+
interface loopback0
86+
ip address 10.1.4.5/32
87+
ip router ospf 100 area 0.0.0.1
88+
"""
89+
90+
nxos1.load_merge_candidate(config=candidate_cfg)
91+
92+
print(nxos1.compare_config())
93+
interface loopback0
94+
ip address 10.1.4.5/32

mypy.ini

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,24 @@ allow_redefinition = True
55
[mypy-napalm.base.*]
66
disallow_untyped_defs = True
77

8+
[mypy-napalm.nxos.*]
9+
disallow_untyped_defs = True
10+
11+
[mypy-napalm.eos.*]
12+
ignore_errors = True
13+
14+
[mypy-napalm.ios.*]
15+
ignore_errors = True
16+
17+
[mypy-napalm.iosxr_netconf.*]
18+
ignore_errors = True
19+
20+
[mypy-napalm.nxapi_plumbing.*]
21+
disallow_untyped_defs = True
22+
23+
[mypy-napalm.base.clitools.*]
24+
ignore_errors = True
25+
826
[mypy-napalm.base.test.*]
927
ignore_errors = True
1028

@@ -23,11 +41,14 @@ ignore_missing_imports = True
2341
[mypy-lxml.*]
2442
ignore_missing_imports = True
2543

26-
[mypy-ciscoconfparse]
44+
[mypy-netutils.*]
2745
ignore_missing_imports = True
2846

2947
[mypy-textfsm]
3048
ignore_missing_imports = True
3149

50+
[mypy-ttp]
51+
ignore_missing_imports = True
52+
3253
[mypy-pytest]
3354
ignore_missing_imports = True

napalm/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717

1818
# Verify Python Version that is running
1919
try:
20-
if not (sys.version_info.major == 3 and sys.version_info.minor >= 6):
21-
raise RuntimeError("NAPALM requires Python 3.6 or greater")
20+
if not (sys.version_info.major == 3 and sys.version_info.minor >= 7):
21+
raise RuntimeError("NAPALM requires Python 3.7 or greater")
2222
except AttributeError:
23-
raise RuntimeError("NAPALM requires Python 3.6 or greater")
23+
raise RuntimeError("NAPALM requires Python 3.7 or greater")
2424

2525
try:
2626
__version__ = pkg_resources.get_distribution("napalm").version

napalm/base/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
import importlib
2020

2121
# NAPALM base
22+
from typing import Type
23+
2224
from napalm.base.base import NetworkDriver
2325
from napalm.base.exceptions import ModuleImportError
2426
from napalm.base.mock import MockDriver
@@ -29,7 +31,7 @@
2931
]
3032

3133

32-
def get_network_driver(name, prepend=True):
34+
def get_network_driver(name: str, prepend: bool = True) -> Type[NetworkDriver]:
3335
"""
3436
Searches for a class derived form the base NAPALM class NetworkDriver in a specific library.
3537
The library name must repect the following pattern: napalm_[DEVICE_OS].

0 commit comments

Comments
 (0)