diff --git a/plugins/cliconf/sonic.py b/plugins/cliconf/sonic.py index 37f1d872a..e5cc7630f 100644 --- a/plugins/cliconf/sonic.py +++ b/plugins/cliconf/sonic.py @@ -32,8 +32,6 @@ import json -from itertools import chain - from ansible.errors import AnsibleConnectionFailure from ansible.module_utils._text import to_bytes, to_text from ansible.module_utils.common._collections_compat import Mapping diff --git a/plugins/module_utils/network/sonic/config/bgp/bgp.py b/plugins/module_utils/network/sonic/config/bgp/bgp.py index fd4d5c57e..f56510e02 100644 --- a/plugins/module_utils/network/sonic/config/bgp/bgp.py +++ b/plugins/module_utils/network/sonic/config/bgp/bgp.py @@ -13,18 +13,11 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -try: - from urllib import quote -except ImportError: - from urllib.parse import quote - from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( to_list, - search_obj_in_list, - remove_empties ) from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.facts.facts import Facts from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.sonic import ( @@ -32,10 +25,8 @@ edit_config ) from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import ( - dict_to_set, update_states, get_diff, - remove_empties_from_list ) from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.sonic import to_request from ansible.module_utils.connection import ConnectionError diff --git a/plugins/module_utils/network/sonic/config/bgp_af/bgp_af.py b/plugins/module_utils/network/sonic/config/bgp_af/bgp_af.py index 957f71b02..b7d6c1b3a 100644 --- a/plugins/module_utils/network/sonic/config/bgp_af/bgp_af.py +++ b/plugins/module_utils/network/sonic/config/bgp_af/bgp_af.py @@ -23,7 +23,6 @@ ) from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( to_list, - search_obj_in_list ) from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.facts.facts import Facts from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.sonic import ( diff --git a/plugins/module_utils/network/sonic/config/bgp_neighbors_af/bgp_neighbors_af.py b/plugins/module_utils/network/sonic/config/bgp_neighbors_af/bgp_neighbors_af.py index 15f46f966..5481193e3 100644 --- a/plugins/module_utils/network/sonic/config/bgp_neighbors_af/bgp_neighbors_af.py +++ b/plugins/module_utils/network/sonic/config/bgp_neighbors_af/bgp_neighbors_af.py @@ -13,11 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -try: - from urllib import quote -except ImportError: - from urllib.parse import quote - from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) diff --git a/plugins/module_utils/network/sonic/config/ip_neighbor/ip_neighbor.py b/plugins/module_utils/network/sonic/config/ip_neighbor/ip_neighbor.py index cb4805032..f4bfca295 100644 --- a/plugins/module_utils/network/sonic/config/ip_neighbor/ip_neighbor.py +++ b/plugins/module_utils/network/sonic/config/ip_neighbor/ip_neighbor.py @@ -30,7 +30,6 @@ from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import ( get_diff, update_states, - remove_empties_from_list ) from ansible.module_utils.connection import ConnectionError diff --git a/plugins/module_utils/network/sonic/config/l3_interfaces/l3_interfaces.py b/plugins/module_utils/network/sonic/config/l3_interfaces/l3_interfaces.py index d1b735251..0aa498e88 100644 --- a/plugins/module_utils/network/sonic/config/l3_interfaces/l3_interfaces.py +++ b/plugins/module_utils/network/sonic/config/l3_interfaces/l3_interfaces.py @@ -30,7 +30,6 @@ to_request, edit_config ) -from ansible.module_utils._text import to_native from ansible.module_utils.connection import ConnectionError TEST_KEYS = [ diff --git a/plugins/module_utils/network/sonic/config/logging/logging.py b/plugins/module_utils/network/sonic/config/logging/logging.py index 37324fdf4..6657de19e 100644 --- a/plugins/module_utils/network/sonic/config/logging/logging.py +++ b/plugins/module_utils/network/sonic/config/logging/logging.py @@ -14,8 +14,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re - from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) @@ -32,8 +30,6 @@ update_states, send_requests, get_normalize_interface_name, - normalize_interface_name, - normalize_interface_name_list ) from ansible.module_utils.connection import ConnectionError diff --git a/plugins/module_utils/network/sonic/config/ntp/ntp.py b/plugins/module_utils/network/sonic/config/ntp/ntp.py index 57c47648a..a1c60484b 100644 --- a/plugins/module_utils/network/sonic/config/ntp/ntp.py +++ b/plugins/module_utils/network/sonic/config/ntp/ntp.py @@ -14,8 +14,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re - from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) @@ -32,7 +30,6 @@ get_replaced_config, send_requests, update_states, - normalize_interface_name, normalize_interface_name_list ) from ansible.module_utils.connection import ConnectionError diff --git a/plugins/module_utils/network/sonic/config/users/users.py b/plugins/module_utils/network/sonic/config/users/users.py index 73398cf74..54517f32d 100644 --- a/plugins/module_utils/network/sonic/config/users/users.py +++ b/plugins/module_utils/network/sonic/config/users/users.py @@ -26,7 +26,6 @@ edit_config ) from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import ( - dict_to_set, update_states, get_diff, ) diff --git a/plugins/module_utils/network/sonic/config/vlans/vlans.py b/plugins/module_utils/network/sonic/config/vlans/vlans.py index 404051074..9b442be37 100644 --- a/plugins/module_utils/network/sonic/config/vlans/vlans.py +++ b/plugins/module_utils/network/sonic/config/vlans/vlans.py @@ -14,8 +14,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import json - from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.cfg.base import ( ConfigBase, ) @@ -35,19 +33,8 @@ to_request, edit_config ) -from ansible.module_utils._text import to_native from ansible.module_utils.connection import ConnectionError -import traceback - -LIB_IMP_ERR = None -ERR_MSG = None -try: - import jinja2 - HAS_LIB = True -except Exception as e: - HAS_LIB = False - ERR_MSG = to_native(e) - LIB_IMP_ERR = traceback.format_exc() + TEST_KEYS = [ {'config': {'vlan_id': ''}}, diff --git a/plugins/module_utils/network/sonic/facts/aaa/aaa.py b/plugins/module_utils/network/sonic/facts/aaa/aaa.py index 5a7bd05c9..03bdf7dde 100644 --- a/plugins/module_utils/network/sonic/facts/aaa/aaa.py +++ b/plugins/module_utils/network/sonic/facts/aaa/aaa.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/bgp/bgp.py b/plugins/module_utils/network/sonic/facts/bgp/bgp.py index c86b53c2a..d28059758 100644 --- a/plugins/module_utils/network/sonic/facts/bgp/bgp.py +++ b/plugins/module_utils/network/sonic/facts/bgp/bgp.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/bgp_af/bgp_af.py b/plugins/module_utils/network/sonic/facts/bgp_af/bgp_af.py index f865c9a09..d8404def6 100644 --- a/plugins/module_utils/network/sonic/facts/bgp_af/bgp_af.py +++ b/plugins/module_utils/network/sonic/facts/bgp_af/bgp_af.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/bgp_as_paths/bgp_as_paths.py b/plugins/module_utils/network/sonic/facts/bgp_as_paths/bgp_as_paths.py index 822db22a4..600e5158c 100644 --- a/plugins/module_utils/network/sonic/facts/bgp_as_paths/bgp_as_paths.py +++ b/plugins/module_utils/network/sonic/facts/bgp_as_paths/bgp_as_paths.py @@ -11,7 +11,6 @@ """ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/bgp_communities/bgp_communities.py b/plugins/module_utils/network/sonic/facts/bgp_communities/bgp_communities.py index ffa294221..aa23e71b4 100644 --- a/plugins/module_utils/network/sonic/facts/bgp_communities/bgp_communities.py +++ b/plugins/module_utils/network/sonic/facts/bgp_communities/bgp_communities.py @@ -11,7 +11,6 @@ """ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/bgp_ext_communities/bgp_ext_communities.py b/plugins/module_utils/network/sonic/facts/bgp_ext_communities/bgp_ext_communities.py index b1d7c4ad0..6f9b104ac 100644 --- a/plugins/module_utils/network/sonic/facts/bgp_ext_communities/bgp_ext_communities.py +++ b/plugins/module_utils/network/sonic/facts/bgp_ext_communities/bgp_ext_communities.py @@ -11,7 +11,6 @@ """ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/bgp_neighbors/bgp_neighbors.py b/plugins/module_utils/network/sonic/facts/bgp_neighbors/bgp_neighbors.py index 903b93de1..69e31414d 100644 --- a/plugins/module_utils/network/sonic/facts/bgp_neighbors/bgp_neighbors.py +++ b/plugins/module_utils/network/sonic/facts/bgp_neighbors/bgp_neighbors.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/bgp_neighbors_af/bgp_neighbors_af.py b/plugins/module_utils/network/sonic/facts/bgp_neighbors_af/bgp_neighbors_af.py index 26119b61c..ba687f1b0 100644 --- a/plugins/module_utils/network/sonic/facts/bgp_neighbors_af/bgp_neighbors_af.py +++ b/plugins/module_utils/network/sonic/facts/bgp_neighbors_af/bgp_neighbors_af.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/interfaces/interfaces.py b/plugins/module_utils/network/sonic/facts/interfaces/interfaces.py index a2455d657..610405a50 100644 --- a/plugins/module_utils/network/sonic/facts/interfaces/interfaces.py +++ b/plugins/module_utils/network/sonic/facts/interfaces/interfaces.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/l2_interfaces/l2_interfaces.py b/plugins/module_utils/network/sonic/facts/l2_interfaces/l2_interfaces.py index 4a9cb996c..78d5b002e 100644 --- a/plugins/module_utils/network/sonic/facts/l2_interfaces/l2_interfaces.py +++ b/plugins/module_utils/network/sonic/facts/l2_interfaces/l2_interfaces.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/l3_interfaces/l3_interfaces.py b/plugins/module_utils/network/sonic/facts/l3_interfaces/l3_interfaces.py index 69a6dcd44..e91a2b033 100644 --- a/plugins/module_utils/network/sonic/facts/l3_interfaces/l3_interfaces.py +++ b/plugins/module_utils/network/sonic/facts/l3_interfaces/l3_interfaces.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/lag_interfaces/lag_interfaces.py b/plugins/module_utils/network/sonic/facts/lag_interfaces/lag_interfaces.py index 728196813..d83659d92 100644 --- a/plugins/module_utils/network/sonic/facts/lag_interfaces/lag_interfaces.py +++ b/plugins/module_utils/network/sonic/facts/lag_interfaces/lag_interfaces.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/logging/logging.py b/plugins/module_utils/network/sonic/facts/logging/logging.py index 9c1646788..be8eb3efa 100644 --- a/plugins/module_utils/network/sonic/facts/logging/logging.py +++ b/plugins/module_utils/network/sonic/facts/logging/logging.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/mclag/mclag.py b/plugins/module_utils/network/sonic/facts/mclag/mclag.py index 1bc18c05a..9afaae5c5 100644 --- a/plugins/module_utils/network/sonic/facts/mclag/mclag.py +++ b/plugins/module_utils/network/sonic/facts/mclag/mclag.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/ntp/ntp.py b/plugins/module_utils/network/sonic/facts/ntp/ntp.py index cfa29744b..d52516705 100644 --- a/plugins/module_utils/network/sonic/facts/ntp/ntp.py +++ b/plugins/module_utils/network/sonic/facts/ntp/ntp.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/port_breakout/port_breakout.py b/plugins/module_utils/network/sonic/facts/port_breakout/port_breakout.py index 938bd6423..6d7bd02fd 100644 --- a/plugins/module_utils/network/sonic/facts/port_breakout/port_breakout.py +++ b/plugins/module_utils/network/sonic/facts/port_breakout/port_breakout.py @@ -11,8 +11,6 @@ """ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re -import json from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/port_group/port_group.py b/plugins/module_utils/network/sonic/facts/port_group/port_group.py index 2d5669791..c6e4816c4 100644 --- a/plugins/module_utils/network/sonic/facts/port_group/port_group.py +++ b/plugins/module_utils/network/sonic/facts/port_group/port_group.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/radius_server/radius_server.py b/plugins/module_utils/network/sonic/facts/radius_server/radius_server.py index 72593b225..7ea4d2909 100644 --- a/plugins/module_utils/network/sonic/facts/radius_server/radius_server.py +++ b/plugins/module_utils/network/sonic/facts/radius_server/radius_server.py @@ -11,8 +11,6 @@ """ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re -import json from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/static_routes/static_routes.py b/plugins/module_utils/network/sonic/facts/static_routes/static_routes.py index f83566440..801c8e75f 100644 --- a/plugins/module_utils/network/sonic/facts/static_routes/static_routes.py +++ b/plugins/module_utils/network/sonic/facts/static_routes/static_routes.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/system/system.py b/plugins/module_utils/network/sonic/facts/system/system.py index 1d7a82d83..65c4491d3 100644 --- a/plugins/module_utils/network/sonic/facts/system/system.py +++ b/plugins/module_utils/network/sonic/facts/system/system.py @@ -11,7 +11,6 @@ """ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/tacacs_server/tacacs_server.py b/plugins/module_utils/network/sonic/facts/tacacs_server/tacacs_server.py index a1e79910f..b752b7a83 100644 --- a/plugins/module_utils/network/sonic/facts/tacacs_server/tacacs_server.py +++ b/plugins/module_utils/network/sonic/facts/tacacs_server/tacacs_server.py @@ -11,8 +11,6 @@ """ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re -import json from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/users/users.py b/plugins/module_utils/network/sonic/facts/users/users.py index 038e97f83..642e332d2 100644 --- a/plugins/module_utils/network/sonic/facts/users/users.py +++ b/plugins/module_utils/network/sonic/facts/users/users.py @@ -11,7 +11,6 @@ """ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/vlans/vlans.py b/plugins/module_utils/network/sonic/facts/vlans/vlans.py index 7c4af2ea8..3df200048 100644 --- a/plugins/module_utils/network/sonic/facts/vlans/vlans.py +++ b/plugins/module_utils/network/sonic/facts/vlans/vlans.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/vrfs/vrfs.py b/plugins/module_utils/network/sonic/facts/vrfs/vrfs.py index 797612bc4..375c453d5 100644 --- a/plugins/module_utils/network/sonic/facts/vrfs/vrfs.py +++ b/plugins/module_utils/network/sonic/facts/vrfs/vrfs.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/facts/vxlans/vxlans.py b/plugins/module_utils/network/sonic/facts/vxlans/vxlans.py index 6ce6498ba..e521313b8 100644 --- a/plugins/module_utils/network/sonic/facts/vxlans/vxlans.py +++ b/plugins/module_utils/network/sonic/facts/vxlans/vxlans.py @@ -13,7 +13,6 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re from copy import deepcopy from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( diff --git a/plugins/module_utils/network/sonic/sonic.py b/plugins/module_utils/network/sonic/sonic.py index 77a63d425..60bd3d491 100644 --- a/plugins/module_utils/network/sonic/sonic.py +++ b/plugins/module_utils/network/sonic/sonic.py @@ -33,7 +33,6 @@ import re from ansible.module_utils._text import to_text -from ansible.module_utils.basic import env_fallback from ansible_collections.ansible.netcommon.plugins.module_utils.network.common.utils import ( to_list, ComplexList diff --git a/plugins/module_utils/network/sonic/utils/bgp_utils.py b/plugins/module_utils/network/sonic/utils/bgp_utils.py index 7471bcb11..fefd3a46a 100644 --- a/plugins/module_utils/network/sonic/utils/bgp_utils.py +++ b/plugins/module_utils/network/sonic/utils/bgp_utils.py @@ -13,16 +13,10 @@ from __future__ import absolute_import, division, print_function __metaclass__ = type -import re -from copy import deepcopy -from ansible_collections.ansible.netcommon.plugins.module_utils.network.common import ( - utils, -) from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.utils.utils import ( normalize_interface_name, ) -from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.argspec.bgp.bgp import BgpArgs from ansible_collections.dellemc.enterprise_sonic.plugins.module_utils.network.sonic.sonic import ( to_request, edit_config