Repository: napalm-automation/napalm

Issue:
Deprecation warning on python3.8 - collections import
### Description of Issue/Question

*Note*: Please check https://guides.github.com/features/mastering-markdown/
to see how to properly format your request.

### Did you follow the steps from https://github.com/napalm-automation/napalm#faq
(Place an ``x`` between the square brackets where applicable)

- [x] Yes
- [] No


### Setup

### napalm version
(Paste verbatim output from `pip freeze | grep napalm` between quotes below)

```
# cd /tmp
# pip install --editable git+https://github.com/napalm-automation/napalm.git#egg=napalm

# pip freeze | grep napalm
-e git+https://github.com/napalm-automation/napalm.git@b44332f88336b6fd42fdb967958a2661bcf2c958#egg=napalm
```

### Network operating system version
(Paste verbatim output from `show version` - or equivalent - between quotes below)

```
no output - not regarding any network operations
```

### Steps to Reproduce the Issue

### Error Traceback
(Paste the complete traceback of the exception between quotes below)

```
# cd /tmp/src/napalm
# pip install -r requirements.txt -r requirements-dev.txt

# python3 -V
Python 3.8.5

#  pytest 
======================================== test session starts =========================================
platform linux -- Python 3.8.5, pytest-5.4.3, py-1.9.0, pluggy-0.13.1
rootdir: /tmp/src/napalm, inifile: setup.cfg
plugins: pythonpath-0.7.3, json-0.4.0, cov-2.10.1, pylama-7.7.1, forked-1.3.0, xdist-2.1.0
collected 524 items                                                                                  

test/base/test_get_network_driver.py ............                                              [  2%]
test/base/test_helpers.py ............                                                         [  4%]
test/base/test_mock_driver.py .........                                                        [  6%]
test/base/test_napalm_test_framework.py sssssssssssssssssssssssssssssss                        [ 12%]
test/base/validate/test_unit.py ............................                                   [ 17%]
test/base/validate/test_validate.py ............                                               [ 19%]
test/eos/test_cli_syntax.py ....                                                               [ 20%]
test/eos/test_getters.py ...........................ss.........ss.................s.           [ 31%]
test/eos/test_heredoc.py ...                                                                   [ 32%]
test/eos/test_versions.py ..                                                                   [ 32%]
test/ios/test_getters.py ...................................................................s. [ 45%]
.s...............s..                                                                           [ 49%]
test/iosxr/test_getters.py ..............ss......s...s..s...sss                                [ 56%]
test/junos/test_getters.py ..........................s..........s.............ss               [ 66%]
test/nxapi_plumbing/test_build_payload.py .....                                                [ 67%]
test/nxapi_plumbing/test_config.py ....                                                        [ 68%]
test/nxapi_plumbing/test_import.py .                                                           [ 68%]
test/nxapi_plumbing/test_show_jsonrpc.py ......                                                [ 69%]
test/nxapi_plumbing/test_show_xml.py .....                                                     [ 70%]
test/nxos/test_getters.py .....s.......ss...ss........ss.ss.....s....s.....                    [ 80%]
test/nxos_ssh/test_getters.py .................ss....s...s.........s.ss........ss.........     [ 91%]
test/pyiosxr/test_iosxr.py ............................................                        [100%]

========================================== warnings summary ==========================================
napalm/base/helpers.py:8
  /tmp/src/napalm/napalm/base/helpers.py:8: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
    from collections import Iterable

/usr/local/lib/python3.8/dist-packages/jnpr/junos/factcache.py:10
  /usr/local/lib/python3.8/dist-packages/jnpr/junos/factcache.py:10: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
    class _FactCache(collections.MutableMapping):

test/junos/test_getters.py::TestGetter::test_get_bgp_config[normal]
  /tmp/src/napalm/napalm/junos/junos.py:1038: DeprecationWarning: Using or importing the ABCs from 'collections' instead of from 'collections.abc' is deprecated since Python 3.3, and in 3.9 it will stop working
    if isinstance(d, collections.Mapping):

-- Docs: https://docs.pytest.org/en/latest/warnings.html
------------------------- generated json report: /tmp/src/napalm/report.json -------------------------
============================ 453 passed, 71 skipped, 3 warnings in 5.87s =============================
root@napalm-s350:/tmp/src/napalm# 

```

Deprecation warning on python3.8 




Discussion:

Resolving patch:
diff --git a/napalm/base/helpers.py b/napalm/base/helpers.py
--- a/napalm/base/helpers.py
+++ b/napalm/base/helpers.py
@@ -5,7 +5,7 @@
 import sys
 import itertools
 import logging
-from collections import Iterable
+from collections.abc import Iterable
 
 # third party libs
 import jinja2
diff --git a/napalm/junos/junos.py b/napalm/junos/junos.py
--- a/napalm/junos/junos.py
+++ b/napalm/junos/junos.py
@@ -1035,8 +1035,8 @@ def _check_nhs(policies, nhs_policies):
 
         def update_dict(d, u):  # for deep dictionary update
             for k, v in u.items():
-                if isinstance(d, collections.Mapping):
-                    if isinstance(v, collections.Mapping):
+                if isinstance(d, collections.abc.Mapping):
+                    if isinstance(v, collections.abc.Mapping):
                         r = update_dict(d.get(k, {}), v)
                         d[k] = r
                     else:


Test patch: