diff --git a/scripts/automation/trex_control_plane/interactive/trex/astf/topo.py b/scripts/automation/trex_control_plane/interactive/trex/astf/topo.py index bb09fdd426..67bb0167e8 100755 --- a/scripts/automation/trex_control_plane/interactive/trex/astf/topo.py +++ b/scripts/automation/trex_control_plane/interactive/trex/astf/topo.py @@ -1,4 +1,4 @@ -import imp +import importlib import json import yaml import os @@ -365,7 +365,7 @@ def load_py(python_file, **kw): try: file = os.path.basename(python_file).split('.')[0] module = __import__(file, globals(), locals(), [], 0) - imp.reload(module) # reload the update + importlib.reload(module) # reload the update topo = module.get_topo(**kw) if not isinstance(topo, ASTFTopology): diff --git a/scripts/automation/trex_control_plane/interactive/trex/astf/trex_astf_profile.py b/scripts/automation/trex_control_plane/interactive/trex/astf/trex_astf_profile.py index 1969003b80..8f1cb87a6f 100644 --- a/scripts/automation/trex_control_plane/interactive/trex/astf/trex_astf_profile.py +++ b/scripts/automation/trex_control_plane/interactive/trex/astf/trex_astf_profile.py @@ -12,7 +12,7 @@ from ..common.trex_exceptions import * from ..common.trex_types import listify from ..utils.common import ip2int -import imp +import importlib import collections def pretty_exceptions(func): @@ -2221,7 +2221,7 @@ def load_py (cls, python_file, **kwargs): try: file = os.path.basename(python_file).split('.')[0] module = __import__(file, globals(), locals(), [], 0) - imp.reload(module) # reload the update + importlib.reload(module) # reload the update t = cls.get_module_tunables(module) diff --git a/scripts/automation/trex_control_plane/interactive/trex/astf/tunnels_topo.py b/scripts/automation/trex_control_plane/interactive/trex/astf/tunnels_topo.py index cac69390d8..3d265fb578 100644 --- a/scripts/automation/trex_control_plane/interactive/trex/astf/tunnels_topo.py +++ b/scripts/automation/trex_control_plane/interactive/trex/astf/tunnels_topo.py @@ -1,4 +1,4 @@ -import imp +import importlib import json import yaml import os @@ -220,7 +220,7 @@ def load_py(python_file, **kw): try: file = os.path.basename(python_file).split('.')[0] module = __import__(file, globals(), locals(), [], 0) - imp.reload(module) # reload the update + importlib.reload(module) # reload the update topo = module.get_topo(**kw) if not isinstance(topo, TunnelsTopo): @@ -350,4 +350,4 @@ def get_data(self): def to_json(self): topo = self.get_data() - return json.dumps(topo, sort_keys = True) \ No newline at end of file + return json.dumps(topo, sort_keys = True) diff --git a/scripts/automation/trex_control_plane/interactive/trex/emu/trex_emu_profile.py b/scripts/automation/trex_control_plane/interactive/trex/emu/trex_emu_profile.py index b989777bd2..0aff895b11 100644 --- a/scripts/automation/trex_control_plane/interactive/trex/emu/trex_emu_profile.py +++ b/scripts/automation/trex_control_plane/interactive/trex/emu/trex_emu_profile.py @@ -4,7 +4,7 @@ from trex.common.trex_types import listify from .trex_emu_validator import EMUValidator -import imp +import importlib import os import sys import traceback @@ -561,7 +561,7 @@ def load_py(cls, filename, tunables): try: file = os.path.basename(filename).split('.')[0] module = __import__(file, globals(), locals(), [], 0) - imp.reload(module) # reload the update + importlib.reload(module) # reload the update try: profile = module.register().get_profile(tunables) diff --git a/scripts/automation/trex_control_plane/interactive/trex/examples/astf/ndr_bench.py b/scripts/automation/trex_control_plane/interactive/trex/examples/astf/ndr_bench.py index 5205be88a9..524e813a4f 100644 --- a/scripts/automation/trex_control_plane/interactive/trex/examples/astf/ndr_bench.py +++ b/scripts/automation/trex_control_plane/interactive/trex/examples/astf/ndr_bench.py @@ -7,7 +7,7 @@ import sys import time import math -import imp +import importlib from copy import deepcopy class MultiplierDomain: @@ -145,7 +145,7 @@ def load_plugin(cls, plugin_file): try: file = os.path.basename(plugin_file).split('.')[0] module = __import__(file, globals(), locals(), [], 0) - imp.reload(module) # reload the update + importlib.reload(module) # reload the update plugin = module.register() diff --git a/scripts/automation/trex_control_plane/interactive/trex/examples/stl/ndr_bench.py b/scripts/automation/trex_control_plane/interactive/trex/examples/stl/ndr_bench.py index 3196b3ccd8..1fa4ab6882 100755 --- a/scripts/automation/trex_control_plane/interactive/trex/examples/stl/ndr_bench.py +++ b/scripts/automation/trex_control_plane/interactive/trex/examples/stl/ndr_bench.py @@ -7,7 +7,7 @@ import sys import time import math -import imp +import importlib from copy import deepcopy @@ -218,7 +218,7 @@ def load_plugin(cls, plugin_file): try: file = os.path.basename(plugin_file).split('.')[0] module = __import__(file, globals(), locals(), [], 0) - imp.reload(module) # reload the update + importlib.reload(module) # reload the update plugin = module.register() diff --git a/scripts/automation/trex_control_plane/interactive/trex/stl/trex_stl_streams.py b/scripts/automation/trex_control_plane/interactive/trex/stl/trex_stl_streams.py index 999bdfd4da..8cec6dcb21 100644 --- a/scripts/automation/trex_control_plane/interactive/trex/stl/trex_stl_streams.py +++ b/scripts/automation/trex_control_plane/interactive/trex/stl/trex_stl_streams.py @@ -9,7 +9,7 @@ import string import traceback import copy -import imp +import importlib from ..common.trex_exceptions import * @@ -426,7 +426,7 @@ def load_py(tpg_conf_path, **kwargs): filename = os.path.basename(tpg_conf_path).split('.')[0] # remove the file extension sys.dont_write_bytecode = True module = __import__(filename, globals(), locals(), [], 0) # import the file - imp.reload(module) # reload the update + importlib.reload(module) # reload the update try: tpg_conf = module.register().get_tpg_conf(**kwargs) @@ -1163,7 +1163,7 @@ def load_py (python_file, direction = 0, port_id = 0, **kwargs): file = os.path.basename(python_file).split('.')[0] sys.dont_write_bytecode = True module = __import__(file, globals(), locals(), [], 0) - imp.reload(module) # reload the update + importlib.reload(module) # reload the update t = STLProfile.get_module_tunables(module) #for arg in kwargs: