From 8f6a3413a4880a697d708fb6c53bd77ccb2bcdb5 Mon Sep 17 00:00:00 2001 From: Gabriel Ferreira Date: Sun, 19 Nov 2023 20:07:19 -0300 Subject: [PATCH] style: apply black and isort --- bindings/python/ns__init__.py | 175 +- .../pip-wheel/auditwheel-exclude-list.py | 2 +- build-support/pip-wheel/ns/__init__.py | 3 +- .../pip-wheel/visualizer/__init__.py | 2 +- doc/contributing/pickle-to-xml.py | 48 +- doc/contributing/source/conf.py | 111 +- doc/installation/source/conf.py | 111 +- doc/manual/source/conf.py | 65 +- doc/models/source/conf.py | 67 +- doc/tutorial/pickle-to-xml.py | 48 +- doc/tutorial/source/conf.py | 62 +- examples/realtime/realtime-udp-echo.py | 149 +- examples/routing/simple-routing-ping6.py | 4 +- examples/tcp/examples-to-run.py | 24 +- examples/tutorial/first.py | 4 +- examples/tutorial/second.py | 12 +- examples/tutorial/third.py | 50 +- examples/wireless/examples-to-run.py | 246 +- examples/wireless/mixed-wired-wireless.py | 140 +- examples/wireless/wifi-ap.py | 42 +- ns3 | 1158 +++++--- setup.py | 15 +- src/antenna/doc/source/conf.py | 116 +- src/bridge/examples/csma-bridge.py | 35 +- src/brite/examples/brite-generic-example.py | 2 +- src/buildings/doc/source/conf.py | 117 +- src/click/examples/nsclick-simple-lan.py | 5 +- src/click/test/examples-to-run.py | 12 +- src/core/examples/sample-rng-plot.py | 20 +- src/core/examples/sample-simulator.py | 17 +- .../generic-battery-discharge-example.py | 21 +- .../examples/flowmon-parse-results.py | 149 +- .../examples/wifi-olsr-flowmon.py | 135 +- src/lte/doc/source/conf.py | 123 +- src/lte/test/examples-to-run.py | 102 +- src/mesh/doc/source/conf.py | 123 +- src/netanim/_required_netanim_version.py | 2 +- .../test/examples-to-run.py | 2 +- src/openflow/examples/openflow-switch.py | 13 +- src/spectrum/test/examples-to-run.py | 2 +- .../two-ray-to-three-gpp-ch-calibration.py | 424 +-- .../examples/tap-csma-virtual-machine.py | 25 +- .../examples/tap-wifi-virtual-machine.py | 37 +- src/tap-bridge/test/examples-to-run.py | 6 +- src/traffic-control/test/examples-to-run.py | 6 +- src/visualizer/visualizer/__init__.py | 31 +- src/visualizer/visualizer/base.py | 45 +- src/visualizer/visualizer/core.py | 614 ++-- src/visualizer/visualizer/hud.py | 99 +- src/visualizer/visualizer/ipython_view.py | 1254 ++++---- .../plugins/interface_statistics.py | 75 +- .../visualizer/plugins/ipv4_routing_table.py | 55 +- src/visualizer/visualizer/plugins/olsr.py | 52 +- .../visualizer/plugins/show_last_packets.py | 88 +- .../plugins/wifi_intrastructure_link.py | 54 +- src/visualizer/visualizer/svgitem.py | 110 +- src/wifi/doc/source/conf.py | 123 +- src/wifi/examples/reference/bianchi11ax.py | 164 +- src/wifi/test/examples-to-run.py | 2568 ++++++++++++++--- test.py | 734 +++-- utils.py | 41 +- utils/check-style-clang-format.py | 411 +-- utils/create-module.py | 187 +- utils/grid.py | 288 +- utils/python-unit-tests.py | 104 +- utils/tests/TestBase.py | 107 +- utils/tests/test-ns3.py | 813 ++++-- utils/tests/test-test.py | 98 +- 68 files changed, 7848 insertions(+), 4299 deletions(-) diff --git a/bindings/python/ns__init__.py b/bindings/python/ns__init__.py index 8ae803ca6..fbd8179af 100644 --- a/bindings/python/ns__init__.py +++ b/bindings/python/ns__init__.py @@ -1,10 +1,10 @@ import builtins -from functools import lru_cache import glob import os.path +import re import sys import sysconfig -import re +from functools import lru_cache DEFAULT_INCLUDE_DIR = sysconfig.get_config_var("INCLUDEDIR") DEFAULT_LIB_DIR = sysconfig.get_config_var("LIBDIR") @@ -14,7 +14,7 @@ def find_ns3_lock() -> str: # Get the absolute path to this file path_to_this_init_file = os.path.dirname(os.path.abspath(__file__)) path_to_lock = path_to_this_init_file - lock_file = (".lock-ns3_%s_build" % sys.platform) + lock_file = ".lock-ns3_%s_build" % sys.platform # Move upwards until we reach the directory with the ns3 script prev_path = None @@ -32,15 +32,17 @@ def find_ns3_lock() -> str: return path_to_lock -SYSTEM_LIBRARY_DIRECTORIES = (DEFAULT_LIB_DIR, - os.path.dirname(DEFAULT_LIB_DIR), - "/usr/lib64", - "/usr/lib", - ) -DYNAMIC_LIBRARY_EXTENSIONS = {"linux": "so", - "win32": "dll", - "darwin": "dylib", - } +SYSTEM_LIBRARY_DIRECTORIES = ( + DEFAULT_LIB_DIR, + os.path.dirname(DEFAULT_LIB_DIR), + "/usr/lib64", + "/usr/lib", +) +DYNAMIC_LIBRARY_EXTENSIONS = { + "linux": "so", + "win32": "dll", + "darwin": "dylib", +} LIBRARY_EXTENSION = DYNAMIC_LIBRARY_EXTENSIONS[sys.platform] @@ -76,8 +78,9 @@ def _search_libraries() -> dict: library_search_paths += [os.path.dirname(library_search_paths[-1])] # Filter unique search paths and those that are not part of system directories - library_search_paths = list(filter(lambda x: x not in SYSTEM_LIBRARY_DIRECTORIES, - set(library_search_paths))) + library_search_paths = list( + filter(lambda x: x not in SYSTEM_LIBRARY_DIRECTORIES, set(library_search_paths)) + ) # Search for the core library in the search paths libraries = [] @@ -88,7 +91,9 @@ def _search_libraries() -> dict: # Search system library directories (too slow for recursive search) for search_path in SYSTEM_LIBRARY_DIRECTORIES: if os.path.exists(search_path): - libraries += glob.glob("%s/**/*.%s*" % (search_path, LIBRARY_EXTENSION), recursive=False) + libraries += glob.glob( + "%s/**/*.%s*" % (search_path, LIBRARY_EXTENSION), recursive=False + ) libraries += glob.glob("%s/*.%s*" % (search_path, LIBRARY_EXTENSION), recursive=False) del search_path, library_search_paths @@ -106,7 +111,7 @@ def _search_libraries() -> dict: library_map[library_infix].add(library) # Replace sets with lists - for (key, values) in library_map.items(): + for key, values in library_map.items(): library_map[key] = list(values) return library_map @@ -128,7 +133,7 @@ LIBRARY_AND_DEFINES = { "libxml2": ["HAVE_LIBXML2"], "libsqlite3": ["HAVE_SQLITE3"], "openflow": ["NS3_OPENFLOW", "ENABLE_OPENFLOW"], - "click": ["NS3_CLICK"] + "click": ["NS3_CLICK"], } @@ -137,11 +142,11 @@ def add_library_defines(library_name: str): defines = "" if len(has_defines): for define in LIBRARY_AND_DEFINES[has_defines[0]]: - defines += (f""" + defines += f""" #ifndef {define} #define {define} 1 #endif - """) + """ return defines @@ -156,7 +161,9 @@ def extract_linked_libraries(library_name: str, prefix: str) -> tuple: # First discover which 3rd-party libraries are used by the current module try: with open(os.path.abspath(library_path), "rb") as f: - linked_libs = re.findall(b"\x00(lib.*?.%b)" % LIBRARY_EXTENSION.encode("utf-8"), f.read()) + linked_libs = re.findall( + b"\x00(lib.*?.%b)" % LIBRARY_EXTENSION.encode("utf-8"), f.read() + ) except Exception as e: print(f"Failed to extract libraries used by {library_path} with exception:{e}") exit(-1) @@ -181,7 +188,8 @@ def extract_library_include_dirs(library_name: str, prefix: str) -> tuple: # Raise error in case the library can't be found if len(linked_library_path) == 0: raise Exception( - f"Failed to find {linked_library}. Make sure its library directory is in LD_LIBRARY_PATH.") + f"Failed to find {linked_library}. Make sure its library directory is in LD_LIBRARY_PATH." + ) # Get path with the shortest length linked_library_path = sorted(linked_library_path, key=lambda x: len(x))[0] @@ -199,7 +207,9 @@ def extract_library_include_dirs(library_name: str, prefix: str) -> tuple: linked_libs_include_dirs.add(system_include_dir) # If system_include_dir/library_name exists, we add it too - linked_library_name = linked_library.replace("lib", "").replace("." + LIBRARY_EXTENSION, "") + linked_library_name = linked_library.replace("lib", "").replace( + "." + LIBRARY_EXTENSION, "" + ) if os.path.exists(os.path.join(system_include_dir, linked_library_name)): linked_libs_include_dirs.add(os.path.join(system_include_dir, linked_library_name)) @@ -230,19 +240,26 @@ def find_ns3_from_lock_file(lock_file: str) -> (str, list, str): suffix = "-" + values["BUILD_PROFILE"] if values["BUILD_PROFILE"] != "release" else "" modules = [module.replace("ns3-", "") for module in values["NS3_ENABLED_MODULES"]] prefix = values["out_dir"] - libraries = {os.path.splitext(os.path.basename(x))[0]: x for x in os.listdir(os.path.join(prefix, "lib"))} + libraries = { + os.path.splitext(os.path.basename(x))[0]: x for x in os.listdir(os.path.join(prefix, "lib")) + } version = values["VERSION"] # Filter out test libraries and incorrect versions - def filter_in_matching_ns3_libraries(libraries_to_filter: dict, - modules_to_filter: list, - version: str, - suffix: str,) -> dict: + def filter_in_matching_ns3_libraries( + libraries_to_filter: dict, + modules_to_filter: list, + version: str, + suffix: str, + ) -> dict: suffix = [suffix[1:]] if len(suffix) > 1 else [] filtered_in_modules = [] for module in modules_to_filter: - filtered_in_modules += list(filter(lambda x: "-".join([version, module, *suffix]) in x, - libraries_to_filter.keys())) + filtered_in_modules += list( + filter( + lambda x: "-".join([version, module, *suffix]) in x, libraries_to_filter.keys() + ) + ) for library in list(libraries_to_filter.keys()): if library not in filtered_in_modules: libraries_to_filter.pop(library) @@ -255,9 +272,9 @@ def find_ns3_from_lock_file(lock_file: str) -> (str, list, str): for module in modules: library_name = f"libns{version}-{module}{suffix}" if library_name not in libraries: - raise Exception(f"Missing library {library_name}\n", - "Build all modules with './ns3 build'" - ) + raise Exception( + f"Missing library {library_name}\n", "Build all modules with './ns3 build'" + ) libraries_to_load.append(libraries[library_name]) return prefix, libraries_to_load, version @@ -276,7 +293,14 @@ def filter_module_name(library: str) -> str: components.pop(0) # Drop build profile suffix and test libraries - if components[-1] in ["debug", "default", "optimized", "release", "relwithdebinfo", "minsizerel"]: + if components[-1] in [ + "debug", + "default", + "optimized", + "release", + "relwithdebinfo", + "minsizerel", + ]: components.pop(-1) return "-".join(components) @@ -331,10 +355,14 @@ def find_ns3_from_search() -> (str, list, str): # Filter out older ns-3 libraries for module in list(modules_to_filter): # Filter duplicates of modules, while excluding test libraries - conflicting_libraries = list(filter(lambda x: module == filter_module_name(x), libraries_to_filter)) + conflicting_libraries = list( + filter(lambda x: module == filter_module_name(x), libraries_to_filter) + ) # Extract versions from conflicting libraries - conflicting_libraries_versions = list(map(lambda x: extract_version(x, module), conflicting_libraries)) + conflicting_libraries_versions = list( + map(lambda x: extract_version(x, module), conflicting_libraries) + ) # Get the newest version found for that library newest_version = get_newest_version(conflicting_libraries_versions) @@ -345,7 +373,9 @@ def find_ns3_from_search() -> (str, list, str): else: newest_version_found = get_newest_version([newest_version, newest_version_found]) if newest_version != newest_version_found: - raise Exception(f"Incompatible versions of the ns-3 module '{module}' were found: {newest_version} != {newest_version_found}.") + raise Exception( + f"Incompatible versions of the ns-3 module '{module}' were found: {newest_version} != {newest_version_found}." + ) for conflicting_library in list(conflicting_libraries): if "-".join([newest_version, module]) not in conflicting_library: @@ -353,7 +383,9 @@ def find_ns3_from_search() -> (str, list, str): conflicting_libraries.remove(conflicting_library) if len(conflicting_libraries) > 1: - raise Exception(f"There are multiple build profiles for module '{module}'.\nDelete one to continue: {', '.join(conflicting_libraries)}") + raise Exception( + f"There are multiple build profiles for module '{module}'.\nDelete one to continue: {', '.join(conflicting_libraries)}" + ) return libraries_to_filter, newest_version_found @@ -379,7 +411,9 @@ def load_modules(): libraries = list(map(lambda x: os.path.basename(x), libraries)) for ns3_library in libraries: _, _, linked_libraries = extract_linked_libraries(ns3_library, prefix) - linked_libraries = list(filter(lambda x: "libns3" in x and ns3_library not in x, linked_libraries)) + linked_libraries = list( + filter(lambda x: "libns3" in x and ns3_library not in x, linked_libraries) + ) linked_libraries = list(map(lambda x: os.path.basename(x), linked_libraries)) module_dependencies[os.path.basename(ns3_library)] = linked_libraries @@ -396,19 +430,27 @@ def load_modules(): modules.append(pending_module) return modules - def dependency_order(module_dependencies, pending_modules, current_modules, step_number=0, steps={}): + def dependency_order( + module_dependencies, pending_modules, current_modules, step_number=0, steps={} + ): if len(pending_modules) == 0: return steps if step_number not in steps: steps[step_number] = [] - for module in modules_that_can_be_loaded(module_dependencies, pending_modules, current_modules): + for module in modules_that_can_be_loaded( + module_dependencies, pending_modules, current_modules + ): steps[step_number].append(module) pending_modules.remove(module) current_modules.append(module) - return dependency_order(module_dependencies, pending_modules, current_modules, step_number + 1, steps) + return dependency_order( + module_dependencies, pending_modules, current_modules, step_number + 1, steps + ) sorted_libraries = [] - for step in dependency_order(module_dependencies, list(module_dependencies.keys()), [], 0).values(): + for step in dependency_order( + module_dependencies, list(module_dependencies.keys()), [], 0 + ).values(): sorted_libraries.extend(step) return sorted_libraries @@ -433,7 +475,8 @@ def load_modules(): # Register Ptr<> as a smart pointer import libcppyy - libcppyy.AddSmartPtrType('Ptr') + + libcppyy.AddSmartPtrType("Ptr") # Import ns-3 libraries for variant in ["lib", "lib64"]: @@ -471,7 +514,8 @@ def load_modules(): setattr(cppyy.gbl.ns3, module.replace("-", "_"), cppyy.gbl.ns3) # Set up a few tricks - cppyy.cppdef(""" + cppyy.cppdef( + """ using namespace ns3; bool Time_ge(Time& a, Time& b){ return a >= b;} bool Time_eq(Time& a, Time& b){ return a == b;} @@ -479,7 +523,8 @@ def load_modules(): bool Time_le(Time& a, Time& b){ return a <= b;} bool Time_gt(Time& a, Time& b){ return a > b;} bool Time_lt(Time& a, Time& b){ return a < b;} - """) + """ + ) cppyy.gbl.ns3.Time.__ge__ = cppyy.gbl.Time_ge cppyy.gbl.ns3.Time.__eq__ = cppyy.gbl.Time_eq cppyy.gbl.ns3.Time.__ne__ = cppyy.gbl.Time_ne @@ -500,7 +545,8 @@ def load_modules(): cppyy.gbl.ns3.Node.__del__ = Node_del - cppyy.cppdef(""" + cppyy.cppdef( + """ using namespace ns3; std::tuple LookupByNameFailSafe(std::string name) { @@ -508,44 +554,49 @@ def load_modules(): bool ok = TypeId::LookupByNameFailSafe(name, &id); return std::make_tuple(ok, id); } - """) + """ + ) setattr(cppyy.gbl.ns3, "LookupByNameFailSafe", cppyy.gbl.LookupByNameFailSafe) def CreateObject(className): try: try: - func = "CreateObject%s" % re.sub('[<|>]', '_', className) + func = "CreateObject%s" % re.sub("[<|>]", "_", className) return getattr(cppyy.gbl, func)() except AttributeError: pass try: - func = "Create%s" % re.sub('[<|>]', '_', className) + func = "Create%s" % re.sub("[<|>]", "_", className) return getattr(cppyy.gbl, func)() except AttributeError: pass raise AttributeError except AttributeError: try: - func = "CreateObject%s" % re.sub('[<|>]', '_', className) - cppyy.cppdef(""" + func = "CreateObject%s" % re.sub("[<|>]", "_", className) + cppyy.cppdef( + """ using namespace ns3; Ptr<%s> %s(){ Ptr<%s> object = CreateObject<%s>(); return object; } - """ % (className, func, className, className) - ) + """ + % (className, func, className, className) + ) except Exception as e: try: - func = "Create%s" % re.sub('[<|>]', '_', className) - cppyy.cppdef(""" + func = "Create%s" % re.sub("[<|>]", "_", className) + cppyy.cppdef( + """ using namespace ns3; %s %s(){ %s object = %s(); return object; } - """ % (className, func, className, className) - ) + """ + % (className, func, className, className) + ) except Exception as e: exit(-1) return getattr(cppyy.gbl, func)() @@ -574,10 +625,12 @@ def load_modules(): { return parentPtr->GetObject<%s>(); } - """ % (aggregatedType, aggregatedType, aggregatedType, aggregatedType) + """ + % (aggregatedType, aggregatedType, aggregatedType, aggregatedType) + ) + return cppyy.gbl.getAggregatedObject( + parentObject, aggregatedObject if aggregatedIsClass else aggregatedObject.__class__ ) - return cppyy.gbl.getAggregatedObject(parentObject, - aggregatedObject if aggregatedIsClass else aggregatedObject.__class__) setattr(cppyy.gbl.ns3, "GetObject", GetObject) return cppyy.gbl.ns3 @@ -585,4 +638,4 @@ def load_modules(): # Load all modules and make them available via a built-in ns = load_modules() # can be imported via 'from ns import ns' -builtins.__dict__['ns'] = ns # or be made widely available with 'from ns import *' +builtins.__dict__["ns"] = ns # or be made widely available with 'from ns import *' diff --git a/build-support/pip-wheel/auditwheel-exclude-list.py b/build-support/pip-wheel/auditwheel-exclude-list.py index 02ea3d24c..5b2ed6abb 100644 --- a/build-support/pip-wheel/auditwheel-exclude-list.py +++ b/build-support/pip-wheel/auditwheel-exclude-list.py @@ -8,4 +8,4 @@ for variant in ["lib", "lib64"]: continue for lib in os.listdir(lib_dir): if "libns3" in lib: - print(f"--exclude {lib}", end=' ') + print(f"--exclude {lib}", end=" ") diff --git a/build-support/pip-wheel/ns/__init__.py b/build-support/pip-wheel/ns/__init__.py index 65ea85d7a..e23d451e5 100644 --- a/build-support/pip-wheel/ns/__init__.py +++ b/build-support/pip-wheel/ns/__init__.py @@ -4,7 +4,8 @@ import sys try: import ns3.ns - sys.modules['ns'] = ns3.ns + + sys.modules["ns"] = ns3.ns except ModuleNotFoundError as e: print("Install the ns3 package with pip install ns3.", file=sys.stderr) exit(-1) diff --git a/build-support/pip-wheel/visualizer/__init__.py b/build-support/pip-wheel/visualizer/__init__.py index f1f712403..d5238feac 100644 --- a/build-support/pip-wheel/visualizer/__init__.py +++ b/build-support/pip-wheel/visualizer/__init__.py @@ -8,4 +8,4 @@ except ModuleNotFoundError as e: print("Install the ns3 package with pip install ns3.", file=sys.stderr) exit(-1) -from ns3.visualizer import start, register_plugin, set_bounds, add_initialization_hook +from ns3.visualizer import add_initialization_hook, register_plugin, set_bounds, start diff --git a/doc/contributing/pickle-to-xml.py b/doc/contributing/pickle-to-xml.py index 6a4fcebb3..9ba8ac6b3 100755 --- a/doc/contributing/pickle-to-xml.py +++ b/doc/contributing/pickle-to-xml.py @@ -7,35 +7,41 @@ # ... # -import pickle -import os import codecs +import os +import pickle + def dump_pickles(out, dirname, filename, path): - with open(os.path.join(dirname, filename), 'r', encoding='utf-8') as f: + with open(os.path.join(dirname, filename), "r", encoding="utf-8") as f: data = pickle.load(f) - with codecs.open(data['current_page_name'] + '.frag', mode='w', encoding='utf-8') as fragment_file: - fragment_file.write(data['body']) + with codecs.open( + data["current_page_name"] + ".frag", mode="w", encoding="utf-8" + ) as fragment_file: + fragment_file.write(data["body"]) out.write(' \n' % path) - out.write(' %s.frag\n' % data['current_page_name']) - if data['prev'] is not None: - out.write(' %s\n' % - (os.path.normpath(os.path.join(path, data['prev']['link'])), - data['prev']['title'])) - if data['next'] is not None: - out.write(' %s\n' % - (os.path.normpath(os.path.join(path, data['next']['link'])), - data['next']['title'])) - out.write(' \n') + out.write(" %s.frag\n" % data["current_page_name"]) + if data["prev"] is not None: + out.write( + ' %s\n' + % (os.path.normpath(os.path.join(path, data["prev"]["link"])), data["prev"]["title"]) + ) + if data["next"] is not None: + out.write( + ' %s\n' + % (os.path.normpath(os.path.join(path, data["next"]["link"])), data["next"]["title"]) + ) + out.write(" \n") - if data['next'] is not None: - next_path = os.path.normpath(os.path.join(path, data['next']['link'])) - next_filename = os.path.basename(next_path) + '.fpickle' + if data["next"] is not None: + next_path = os.path.normpath(os.path.join(path, data["next"]["link"])) + next_filename = os.path.basename(next_path) + ".fpickle" dump_pickles(out, dirname, next_filename, next_path) + import sys -sys.stdout.write('\n') -dump_pickles(sys.stdout, os.path.dirname(sys.argv[1]), os.path.basename(sys.argv[1]), '/') -sys.stdout.write('') +sys.stdout.write("\n") +dump_pickles(sys.stdout, os.path.dirname(sys.argv[1]), os.path.basename(sys.argv[1]), "/") +sys.stdout.write("") diff --git a/doc/contributing/source/conf.py b/doc/contributing/source/conf.py index c5be02179..3e37fd6a4 100644 --- a/doc/contributing/source/conf.py +++ b/doc/contributing/source/conf.py @@ -11,206 +11,203 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.imgmath'] +extensions = ["sphinx.ext.imgmath"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'ns-3' -copyright = u'2015, ns-3 project' +project = "ns-3" +copyright = "2015, ns-3 project" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = 'ns-3-dev' +version = "ns-3-dev" # The full version, including alpha/beta/rc tags. -release = 'ns-3-dev' +release = "ns-3-dev" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'ns3_html_theme' +html_theme = "ns3_html_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -html_theme_path = ['../..'] +html_theme_path = ["../.."] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -html_title = 'Contributing' +html_title = "Contributing" # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -html_last_updated_fmt = '%b %d, %Y %H:%M' +html_last_updated_fmt = "%b %d, %Y %H:%M" # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'ns-3doc' +htmlhelp_basename = "ns-3doc" # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'ns-3-contributing.tex', u'Contributing to ns-3', - u'ns-3 project', 'manual'), + ("index", "ns-3-contributing.tex", "Contributing to ns-3", "ns-3 project", "manual"), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -latex_logo = '../../ns3_html_theme/static/ns-3.png' +latex_logo = "../../ns3_html_theme/static/ns-3.png" # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Additional stuff for the LaTeX preamble. -latex_preamble = '\\usepackage{amssymb}' +latex_preamble = "\\usepackage{amssymb}" # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'ns-3-contributing', u'Contributing to ns-3', - [u'ns-3 project'], 1) -] +man_pages = [("index", "ns-3-contributing", "Contributing to ns-3", ["ns-3 project"], 1)] diff --git a/doc/installation/source/conf.py b/doc/installation/source/conf.py index 9afab90d9..165ad8a12 100644 --- a/doc/installation/source/conf.py +++ b/doc/installation/source/conf.py @@ -11,206 +11,203 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.imgmath'] +extensions = ["sphinx.ext.imgmath"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'ns-3' -copyright = u'2018, ns-3 project' +project = "ns-3" +copyright = "2018, ns-3 project" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = 'ns-3-dev' +version = "ns-3-dev" # The full version, including alpha/beta/rc tags. -release = 'ns-3-dev' +release = "ns-3-dev" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'ns3_html_theme' +html_theme = "ns3_html_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -html_theme_path = ['../..'] +html_theme_path = ["../.."] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -html_title = 'Installation guide' +html_title = "Installation guide" # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -html_last_updated_fmt = '%b %d, %Y %H:%M' +html_last_updated_fmt = "%b %d, %Y %H:%M" # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -htmlhelp_basename = 'ns-3doc' +htmlhelp_basename = "ns-3doc" # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'ns-3-installation.tex', u'ns-3 Installation Guide', - u'ns-3 project', 'manual'), + ("index", "ns-3-installation.tex", "ns-3 Installation Guide", "ns-3 project", "manual"), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -latex_logo = '../../ns3_html_theme/static/ns-3.png' +latex_logo = "../../ns3_html_theme/static/ns-3.png" # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Additional stuff for the LaTeX preamble. -latex_preamble = '\\usepackage{amssymb}' +latex_preamble = "\\usepackage{amssymb}" # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'ns-3-installation', u'ns-3 Installation', - [u'ns-3 project'], 1) -] +man_pages = [("index", "ns-3-installation", "ns-3 Installation", ["ns-3 project"], 1)] diff --git a/doc/manual/source/conf.py b/doc/manual/source/conf.py index 2d67cb02a..d30b4d8c0 100644 --- a/doc/manual/source/conf.py +++ b/doc/manual/source/conf.py @@ -20,21 +20,22 @@ # import sys # sys.path.insert(0, os.path.abspath('.')) -import sys, os +import os +import sys # To change default code-block format in Latex to footnotesize (8pt) # Tip from https://stackoverflow.com/questions/9899283/how-do-you-change-the-code-example-font-size-in-latex-pdf-output-with-sphinx/9955928 # Note: sizes are \footnotesize (8pt), \small (9pt), and \normalsize (10pt). -#from sphinx.highlighting import PygmentsBridge -#from pygments.formatters.latex import LatexFormatter +# from sphinx.highlighting import PygmentsBridge +# from pygments.formatters.latex import LatexFormatter # -#class CustomLatexFormatter(LatexFormatter): +# class CustomLatexFormatter(LatexFormatter): # def __init__(self, **options): # super(CustomLatexFormatter, self).__init__(**options) # self.verboptions = r"formatcom=\footnotesize" # -#PygmentsBridge.latex_formatter = CustomLatexFormatter +# PygmentsBridge.latex_formatter = CustomLatexFormatter # -- General configuration ------------------------------------------------ @@ -45,37 +46,37 @@ import sys, os # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx.ext.imgmath'] +extensions = ["sphinx.ext.imgmath"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. # # source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'ns-3 project' -copyright = u'2006-2019, ns-3 project' -#author = u'test' +project = "ns-3 project" +copyright = "2006-2019, ns-3 project" +# author = u'test' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u'ns-3-dev' +version = "ns-3-dev" # The full version, including alpha/beta/rc tags. -release = u'ns-3-dev' +release = "ns-3-dev" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -96,7 +97,7 @@ language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # These patterns also affect html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The reST default role (used for this markup: `text`) to use for all # documents. @@ -118,7 +119,7 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -135,7 +136,7 @@ todo_include_todos = False # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'ns3_html_theme' +html_theme = "ns3_html_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -144,13 +145,13 @@ html_theme = 'ns3_html_theme' # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -html_theme_path = ['../..'] +html_theme_path = ["../.."] # The name for this set of Sphinx documents. # " v documentation" by default. # # html_title = 'est vtest' -html_title = 'Manual' +html_title = "Manual" # A shorter title for the navigation bar. Default is the same as html_title. # @@ -170,7 +171,7 @@ html_title = 'Manual' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied @@ -182,7 +183,7 @@ html_static_path = ['_static'] # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. # -html_last_updated_fmt = '%b %d, %Y %H:%M' +html_last_updated_fmt = "%b %d, %Y %H:%M" # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. @@ -250,7 +251,7 @@ html_last_updated_fmt = '%b %d, %Y %H:%M' # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'ns-3doc' +htmlhelp_basename = "ns-3doc" # -- Options for LaTeX output --------------------------------------------- @@ -258,11 +259,9 @@ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. # # VerbatimBorderColor: make the box around code samples blend into the background @@ -275,10 +274,10 @@ latex_elements = { # See above to change the font size of verbatim code blocks # # 'preamble': '', - 'preamble': u'''\\usepackage{amssymb} + "preamble": """\\usepackage{amssymb} \\definecolor{VerbatimBorderColor}{rgb}{1,1,1} \\renewcommand{\\sphinxcode}[1]{\\texttt{\\small{#1}}} -''' +""" # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -288,14 +287,13 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'ns-3-manual.tex', u'ns-3 Manual', - u'ns-3 project', 'manual'), + ("index", "ns-3-manual.tex", "ns-3 Manual", "ns-3 project", "manual"), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # -latex_logo = '../../ns3_html_theme/static/ns-3.png' +latex_logo = "../../ns3_html_theme/static/ns-3.png" # If true, show page references after internal links. # @@ -324,10 +322,7 @@ latex_logo = '../../ns3_html_theme/static/ns-3.png' # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'ns-3-manual', u'ns-3 Manual', - [u'ns-3 project'], 1) -] +man_pages = [("index", "ns-3-manual", "ns-3 Manual", ["ns-3 project"], 1)] # If true, show URL addresses after external links. # @@ -335,11 +330,11 @@ man_pages = [ # -- Options for texinfo output --------------------------------------- -#texinfo_documents = [ +# texinfo_documents = [ # (master_doc, 'test', u'test Documentation', # author, 'test', 'One line description of project.', # 'Miscellaneous'), -#] +# ] # Documents to append as an appendix to all manuals. # diff --git a/doc/models/source/conf.py b/doc/models/source/conf.py index 06ab3bb92..279f85e21 100644 --- a/doc/models/source/conf.py +++ b/doc/models/source/conf.py @@ -20,21 +20,22 @@ # import sys # sys.path.insert(0, os.path.abspath('.')) -import sys, os +import os +import sys # To change default code-block format in Latex to footnotesize (8pt) # Tip from https://stackoverflow.com/questions/9899283/how-do-you-change-the-code-example-font-size-in-latex-pdf-output-with-sphinx/9955928 # Note: sizes are \footnotesize (8pt), \small (9pt), and \normalsize (10pt). -#from sphinx.highlighting import PygmentsBridge -#from pygments.formatters.latex import LatexFormatter +# from sphinx.highlighting import PygmentsBridge +# from pygments.formatters.latex import LatexFormatter # -#class CustomLatexFormatter(LatexFormatter): +# class CustomLatexFormatter(LatexFormatter): # def __init__(self, **options): # super(CustomLatexFormatter, self).__init__(**options) # self.verboptions = r"formatcom=\footnotesize" # -#PygmentsBridge.latex_formatter = CustomLatexFormatter +# PygmentsBridge.latex_formatter = CustomLatexFormatter # -- General configuration ------------------------------------------------ @@ -45,37 +46,37 @@ import sys, os # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx.ext.imgmath'] +extensions = ["sphinx.ext.imgmath"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. # # source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'ns-3 project' -copyright = u'2006-2019, ns-3 project' -#author = u'test' +project = "ns-3 project" +copyright = "2006-2019, ns-3 project" +# author = u'test' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u'ns-3-dev' +version = "ns-3-dev" # The full version, including alpha/beta/rc tags. -release = u'ns-3-dev' +release = "ns-3-dev" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -96,7 +97,7 @@ language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # These patterns also affect html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The reST default role (used for this markup: `text`) to use for all # documents. @@ -118,7 +119,7 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -135,7 +136,7 @@ todo_include_todos = False # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'ns3_html_theme' +html_theme = "ns3_html_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -144,18 +145,18 @@ html_theme = 'ns3_html_theme' # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -html_theme_path = ['../..'] +html_theme_path = ["../.."] # The name for this set of Sphinx documents. # " v documentation" by default. # # html_title = 'est vtest' -html_title = 'Model Library' +html_title = "Model Library" # A shorter title for the navigation bar. Default is the same as html_title. # # html_short_title = None -html_short_title = 'Models' +html_short_title = "Models" # The name of an image file (relative to this directory) to place at the top # of the sidebar. @@ -171,7 +172,7 @@ html_short_title = 'Models' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied @@ -183,7 +184,7 @@ html_static_path = ['_static'] # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. # -html_last_updated_fmt = '%b %d, %Y %H:%M' +html_last_updated_fmt = "%b %d, %Y %H:%M" # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. @@ -251,7 +252,7 @@ html_last_updated_fmt = '%b %d, %Y %H:%M' # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'ns-3doc' +htmlhelp_basename = "ns-3doc" # -- Options for LaTeX output --------------------------------------------- @@ -259,11 +260,9 @@ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. # # VerbatimBorderColor: make the box around code samples blend into the background @@ -276,10 +275,10 @@ latex_elements = { # See above to change the font size of verbatim code blocks # # 'preamble': '', - 'preamble': u'''\\usepackage{amssymb} + "preamble": """\\usepackage{amssymb} \\definecolor{VerbatimBorderColor}{rgb}{1,1,1} \\renewcommand{\\sphinxcode}[1]{\\texttt{\\small{#1}}} -''' +""" # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -289,14 +288,13 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'ns-3-model-library.tex', u'ns-3 Model Library', - u'ns-3 project', 'manual'), + ("index", "ns-3-model-library.tex", "ns-3 Model Library", "ns-3 project", "manual"), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # -latex_logo = '../../ns3_html_theme/static/ns-3.png' +latex_logo = "../../ns3_html_theme/static/ns-3.png" # If true, show page references after internal links. # @@ -325,10 +323,7 @@ latex_logo = '../../ns3_html_theme/static/ns-3.png' # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'ns-3-model-library', u'ns-3 Model Library', - [u'ns-3 project'], 1) -] +man_pages = [("index", "ns-3-model-library", "ns-3 Model Library", ["ns-3 project"], 1)] # If true, show URL addresses after external links. # @@ -336,11 +331,11 @@ man_pages = [ # -- Options for texinfo output --------------------------------------- -#texinfo_documents = [ +# texinfo_documents = [ # (master_doc, 'test', u'test Documentation', # author, 'test', 'One line description of project.', # 'Miscellaneous'), -#] +# ] # Documents to append as an appendix to all manuals. # diff --git a/doc/tutorial/pickle-to-xml.py b/doc/tutorial/pickle-to-xml.py index 6a4fcebb3..9ba8ac6b3 100755 --- a/doc/tutorial/pickle-to-xml.py +++ b/doc/tutorial/pickle-to-xml.py @@ -7,35 +7,41 @@ # ... # -import pickle -import os import codecs +import os +import pickle + def dump_pickles(out, dirname, filename, path): - with open(os.path.join(dirname, filename), 'r', encoding='utf-8') as f: + with open(os.path.join(dirname, filename), "r", encoding="utf-8") as f: data = pickle.load(f) - with codecs.open(data['current_page_name'] + '.frag', mode='w', encoding='utf-8') as fragment_file: - fragment_file.write(data['body']) + with codecs.open( + data["current_page_name"] + ".frag", mode="w", encoding="utf-8" + ) as fragment_file: + fragment_file.write(data["body"]) out.write(' \n' % path) - out.write(' %s.frag\n' % data['current_page_name']) - if data['prev'] is not None: - out.write(' %s\n' % - (os.path.normpath(os.path.join(path, data['prev']['link'])), - data['prev']['title'])) - if data['next'] is not None: - out.write(' %s\n' % - (os.path.normpath(os.path.join(path, data['next']['link'])), - data['next']['title'])) - out.write(' \n') + out.write(" %s.frag\n" % data["current_page_name"]) + if data["prev"] is not None: + out.write( + ' %s\n' + % (os.path.normpath(os.path.join(path, data["prev"]["link"])), data["prev"]["title"]) + ) + if data["next"] is not None: + out.write( + ' %s\n' + % (os.path.normpath(os.path.join(path, data["next"]["link"])), data["next"]["title"]) + ) + out.write(" \n") - if data['next'] is not None: - next_path = os.path.normpath(os.path.join(path, data['next']['link'])) - next_filename = os.path.basename(next_path) + '.fpickle' + if data["next"] is not None: + next_path = os.path.normpath(os.path.join(path, data["next"]["link"])) + next_filename = os.path.basename(next_path) + ".fpickle" dump_pickles(out, dirname, next_filename, next_path) + import sys -sys.stdout.write('\n') -dump_pickles(sys.stdout, os.path.dirname(sys.argv[1]), os.path.basename(sys.argv[1]), '/') -sys.stdout.write('') +sys.stdout.write("\n") +dump_pickles(sys.stdout, os.path.dirname(sys.argv[1]), os.path.basename(sys.argv[1]), "/") +sys.stdout.write("") diff --git a/doc/tutorial/source/conf.py b/doc/tutorial/source/conf.py index 57e2cf89a..31eb02188 100644 --- a/doc/tutorial/source/conf.py +++ b/doc/tutorial/source/conf.py @@ -24,15 +24,15 @@ # Tip from https://stackoverflow.com/questions/9899283/how-do-you-change-the-code-example-font-size-in-latex-pdf-output-with-sphinx/9955928 # Note: sizes are \footnotesize (8pt), \small (9pt), and \normalsize (10pt). -#from sphinx.highlighting import PygmentsBridge -#from pygments.formatters.latex import LatexFormatter +# from sphinx.highlighting import PygmentsBridge +# from pygments.formatters.latex import LatexFormatter # -#class CustomLatexFormatter(LatexFormatter): +# class CustomLatexFormatter(LatexFormatter): # def __init__(self, **options): # super(CustomLatexFormatter, self).__init__(**options) # self.verboptions = r"formatcom=\footnotesize" # -#PygmentsBridge.latex_formatter = CustomLatexFormatter +# PygmentsBridge.latex_formatter = CustomLatexFormatter # -- General configuration ------------------------------------------------ @@ -43,37 +43,37 @@ # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. -extensions = ['sphinx.ext.imgmath'] +extensions = ["sphinx.ext.imgmath"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. # # source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'ns-3 project' -copyright = u'2006-2019, ns-3 project' -#author = u'test' +project = "ns-3 project" +copyright = "2006-2019, ns-3 project" +# author = u'test' # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = u'ns-3-dev' +version = "ns-3-dev" # The full version, including alpha/beta/rc tags. -release = u'ns-3-dev' +release = "ns-3-dev" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. @@ -94,7 +94,7 @@ language = None # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # These patterns also affect html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # The reST default role (used for this markup: `text`) to use for all # documents. @@ -116,7 +116,7 @@ exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -133,7 +133,7 @@ todo_include_todos = False # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'ns3_html_theme' +html_theme = "ns3_html_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the @@ -142,13 +142,13 @@ html_theme = 'ns3_html_theme' # html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -html_theme_path = ['../..'] +html_theme_path = ["../.."] # The name for this set of Sphinx documents. # " v documentation" by default. # # html_title = 'est vtest' -html_title = 'Tutorial' +html_title = "Tutorial" # A shorter title for the navigation bar. Default is the same as html_title. # @@ -168,7 +168,7 @@ html_title = 'Tutorial' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -html_static_path = ['_static'] +html_static_path = ["_static"] # Add any extra paths that contain custom files (such as robots.txt or # .htaccess) here, relative to this directory. These files are copied @@ -180,7 +180,7 @@ html_static_path = ['_static'] # bottom, using the given strftime format. # The empty string is equivalent to '%b %d, %Y'. # -html_last_updated_fmt = '%b %d, %Y %H:%M' +html_last_updated_fmt = "%b %d, %Y %H:%M" # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. @@ -248,7 +248,7 @@ html_last_updated_fmt = '%b %d, %Y %H:%M' # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'ns-3doc' +htmlhelp_basename = "ns-3doc" # -- Options for LaTeX output --------------------------------------------- @@ -256,11 +256,9 @@ latex_elements = { # The paper size ('letterpaper' or 'a4paper'). # # 'papersize': 'letterpaper', - # The font size ('10pt', '11pt' or '12pt'). # # 'pointsize': '10pt', - # Additional stuff for the LaTeX preamble. # # VerbatimBorderColor: make the box around code samples blend into the background @@ -273,10 +271,10 @@ latex_elements = { # See above to change the font size of verbatim code blocks # # 'preamble': '', - 'preamble': u'''\\usepackage{amssymb} + "preamble": """\\usepackage{amssymb} \\definecolor{VerbatimBorderColor}{rgb}{1,1,1} \\renewcommand{\\sphinxcode}[1]{\\texttt{\\small{#1}}} -''' +""" # Latex figure (float) alignment # # 'figure_align': 'htbp', @@ -286,14 +284,13 @@ latex_elements = { # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - ('index', 'ns-3-tutorial.tex', u'ns-3 Tutorial', - u'ns-3 project', 'manual'), + ("index", "ns-3-tutorial.tex", "ns-3 Tutorial", "ns-3 project", "manual"), ] # The name of an image file (relative to this directory) to place at the top of # the title page. # -latex_logo = '../../ns3_html_theme/static/ns-3.png' +latex_logo = "../../ns3_html_theme/static/ns-3.png" # If true, show page references after internal links. # @@ -322,10 +319,7 @@ latex_logo = '../../ns3_html_theme/static/ns-3.png' # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'ns-3-tutorial', u'ns-3 Tutorial', - [u'ns-3 project'], 1) -] +man_pages = [("index", "ns-3-tutorial", "ns-3 Tutorial", ["ns-3 project"], 1)] # If true, show URL addresses after external links. # @@ -333,11 +327,11 @@ man_pages = [ # -- Options for texinfo output --------------------------------------- -#texinfo_documents = [ +# texinfo_documents = [ # (master_doc, 'test', u'test Documentation', # author, 'test', 'One line description of project.', # 'Miscellaneous'), -#] +# ] # Documents to append as an appendix to all manuals. # diff --git a/examples/realtime/realtime-udp-echo.py b/examples/realtime/realtime-udp-echo.py index 9be8344d9..494d616ed 100644 --- a/examples/realtime/realtime-udp-echo.py +++ b/examples/realtime/realtime-udp-echo.py @@ -32,87 +32,92 @@ except ModuleNotFoundError: " or your PYTHONPATH might not be properly configured" ) + def main(argv): - # - # Allow the user to override any of the defaults and the above Bind() at - # run-time, via command-line arguments - # - cmd = ns.core.CommandLine() - cmd.Parse(argv) + # + # Allow the user to override any of the defaults and the above Bind() at + # run-time, via command-line arguments + # + cmd = ns.core.CommandLine() + cmd.Parse(argv) - # - # But since this is a realtime script, don't allow the user to mess with - # that. - # - ns.core.GlobalValue.Bind("SimulatorImplementationType", ns.core.StringValue("ns3::RealtimeSimulatorImpl")) + # + # But since this is a realtime script, don't allow the user to mess with + # that. + # + ns.core.GlobalValue.Bind( + "SimulatorImplementationType", ns.core.StringValue("ns3::RealtimeSimulatorImpl") + ) - # - # Explicitly create the nodes required by the topology (shown above). - # - print ("Create nodes.") - n = ns.network.NodeContainer() - n.Create(4) + # + # Explicitly create the nodes required by the topology (shown above). + # + print("Create nodes.") + n = ns.network.NodeContainer() + n.Create(4) - internet = ns.internet.InternetStackHelper() - internet.Install(n) + internet = ns.internet.InternetStackHelper() + internet.Install(n) - # - # Explicitly create the channels required by the topology (shown above). - # - print ("Create channels.") - csma = ns.csma.CsmaHelper() - csma.SetChannelAttribute("DataRate", ns.network.DataRateValue(ns.network.DataRate(5000000))) - csma.SetChannelAttribute("Delay", ns.core.TimeValue(ns.core.MilliSeconds(2))); - csma.SetDeviceAttribute("Mtu", ns.core.UintegerValue(1400)) - d = csma.Install(n) + # + # Explicitly create the channels required by the topology (shown above). + # + print("Create channels.") + csma = ns.csma.CsmaHelper() + csma.SetChannelAttribute("DataRate", ns.network.DataRateValue(ns.network.DataRate(5000000))) + csma.SetChannelAttribute("Delay", ns.core.TimeValue(ns.core.MilliSeconds(2))) + csma.SetDeviceAttribute("Mtu", ns.core.UintegerValue(1400)) + d = csma.Install(n) - # - # We've got the "hardware" in place. Now we need to add IP addresses. - # - print ("Assign IP Addresses.") - ipv4 = ns.internet.Ipv4AddressHelper() - ipv4.SetBase(ns.network.Ipv4Address("10.1.1.0"), ns.network.Ipv4Mask("255.255.255.0")) - i = ipv4.Assign(d) + # + # We've got the "hardware" in place. Now we need to add IP addresses. + # + print("Assign IP Addresses.") + ipv4 = ns.internet.Ipv4AddressHelper() + ipv4.SetBase(ns.network.Ipv4Address("10.1.1.0"), ns.network.Ipv4Mask("255.255.255.0")) + i = ipv4.Assign(d) - print ("Create Applications.") + print("Create Applications.") - # - # Create a UdpEchoServer application on node one. - # - port = 9 # well-known echo port number - server = ns.applications.UdpEchoServerHelper(port) - apps = server.Install(n.Get(1)) - apps.Start(ns.core.Seconds(1.0)) - apps.Stop(ns.core.Seconds(10.0)) + # + # Create a UdpEchoServer application on node one. + # + port = 9 # well-known echo port number + server = ns.applications.UdpEchoServerHelper(port) + apps = server.Install(n.Get(1)) + apps.Start(ns.core.Seconds(1.0)) + apps.Stop(ns.core.Seconds(10.0)) - # - # Create a UdpEchoClient application to send UDP datagrams from node zero to - # node one. - # - packetSize = 1024 - maxPacketCount = 500 - interPacketInterval = ns.core.Seconds(0.01) - client = ns.applications.UdpEchoClientHelper(i.GetAddress(1).ConvertTo(), port) - client.SetAttribute("MaxPackets", ns.core.UintegerValue(maxPacketCount)) - client.SetAttribute("Interval", ns.core.TimeValue(interPacketInterval)) - client.SetAttribute("PacketSize", ns.core.UintegerValue(packetSize)) - apps = client.Install(n.Get(0)) - apps.Start(ns.core.Seconds(2.0)) - apps.Stop(ns.core.Seconds(10.0)) + # + # Create a UdpEchoClient application to send UDP datagrams from node zero to + # node one. + # + packetSize = 1024 + maxPacketCount = 500 + interPacketInterval = ns.core.Seconds(0.01) + client = ns.applications.UdpEchoClientHelper(i.GetAddress(1).ConvertTo(), port) + client.SetAttribute("MaxPackets", ns.core.UintegerValue(maxPacketCount)) + client.SetAttribute("Interval", ns.core.TimeValue(interPacketInterval)) + client.SetAttribute("PacketSize", ns.core.UintegerValue(packetSize)) + apps = client.Install(n.Get(0)) + apps.Start(ns.core.Seconds(2.0)) + apps.Stop(ns.core.Seconds(10.0)) - ascii = ns.network.AsciiTraceHelper() - csma.EnableAsciiAll(ascii.CreateFileStream("realtime-udp-echo.tr")) - csma.EnablePcapAll("realtime-udp-echo", False) + ascii = ns.network.AsciiTraceHelper() + csma.EnableAsciiAll(ascii.CreateFileStream("realtime-udp-echo.tr")) + csma.EnablePcapAll("realtime-udp-echo", False) - # - # Now, do the actual simulation. - # - print ("Run Simulation.") - ns.core.Simulator.Stop(ns.Seconds(10)) - ns.core.Simulator.Run() - ns.core.Simulator.Destroy() - print ("Done.") + # + # Now, do the actual simulation. + # + print("Run Simulation.") + ns.core.Simulator.Stop(ns.Seconds(10)) + ns.core.Simulator.Run() + ns.core.Simulator.Destroy() + print("Done.") -if __name__ == '__main__': - import sys - main(sys.argv) + +if __name__ == "__main__": + import sys + + main(sys.argv) diff --git a/examples/routing/simple-routing-ping6.py b/examples/routing/simple-routing-ping6.py index ba7de57f3..501cfb13e 100644 --- a/examples/routing/simple-routing-ping6.py +++ b/examples/routing/simple-routing-ping6.py @@ -80,7 +80,7 @@ def main(argv): print("Application") packetSize = 1024 maxPacketCount = 5 - interPacketInterval = ns.Seconds(1.) + interPacketInterval = ns.Seconds(1.0) # ping = ns.PingHelper(i2.GetAddress(1, 1).ConvertTo()) ping = ns.PingHelper(i2.GetAddress(1, 1).ConvertTo()) @@ -105,7 +105,7 @@ def main(argv): ns.Simulator.Destroy() -if __name__ == '__main__': +if __name__ == "__main__": import sys main(sys.argv) diff --git a/examples/tcp/examples-to-run.py b/examples/tcp/examples-to-run.py index fd2b27824..9a4505850 100644 --- a/examples/tcp/examples-to-run.py +++ b/examples/tcp/examples-to-run.py @@ -11,10 +11,26 @@ cpp_examples = [ ("tcp-large-transfer", "True", "True"), ("tcp-star-server", "True", "True"), ("tcp-variants-comparison", "True", "True"), - ("tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=10ms --queueUseEcn=1 --stopTime=15s --validate=dctcp-10ms", "True", "True"), - ("tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=80ms --queueUseEcn=1 --stopTime=40s --validate=dctcp-80ms", "True", "True"), - ("tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=0 --stopTime=20s --validate=cubic-50ms-no-ecn", "True", "True"), - ("tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=1 --stopTime=20s --validate=cubic-50ms-ecn", "True", "True"), + ( + "tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=10ms --queueUseEcn=1 --stopTime=15s --validate=dctcp-10ms", + "True", + "True", + ), + ( + "tcp-validation --firstTcpType=dctcp --linkRate=50Mbps --baseRtt=80ms --queueUseEcn=1 --stopTime=40s --validate=dctcp-80ms", + "True", + "True", + ), + ( + "tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=0 --stopTime=20s --validate=cubic-50ms-no-ecn", + "True", + "True", + ), + ( + "tcp-validation --firstTcpType=cubic --linkRate=50Mbps --baseRtt=50ms --queueUseEcn=1 --stopTime=20s --validate=cubic-50ms-ecn", + "True", + "True", + ), ] # A list of Python examples to run in order to ensure that they remain diff --git a/examples/tutorial/first.py b/examples/tutorial/first.py index fafac4b3f..42311ad2f 100644 --- a/examples/tutorial/first.py +++ b/examples/tutorial/first.py @@ -45,8 +45,7 @@ stack = ns.internet.InternetStackHelper() stack.Install(nodes) address = ns.internet.Ipv4AddressHelper() -address.SetBase(ns.network.Ipv4Address("10.1.1.0"), - ns.network.Ipv4Mask("255.255.255.0")) +address.SetBase(ns.network.Ipv4Address("10.1.1.0"), ns.network.Ipv4Mask("255.255.255.0")) interfaces = address.Assign(devices) @@ -68,4 +67,3 @@ clientApps.Stop(ns.core.Seconds(10.0)) ns.core.Simulator.Run() ns.core.Simulator.Destroy() - diff --git a/examples/tutorial/second.py b/examples/tutorial/second.py index 4384db2a8..0d01b9367 100644 --- a/examples/tutorial/second.py +++ b/examples/tutorial/second.py @@ -24,6 +24,7 @@ except ModuleNotFoundError: " or your PYTHONPATH might not be properly configured" ) import sys +from ctypes import c_bool, c_int # // Default Network Topology # // @@ -33,7 +34,7 @@ import sys # // ================ # // LAN 10.1.2.0 -from ctypes import c_int, c_bool + nCsma = c_int(3) verbose = c_bool(True) cmd = ns.CommandLine(__file__) @@ -82,9 +83,11 @@ serverApps = echoServer.Install(csmaNodes.Get(nCsma.value)) serverApps.Start(ns.core.Seconds(1.0)) serverApps.Stop(ns.core.Seconds(10.0)) -echoClient = ns.applications.UdpEchoClientHelper(csmaInterfaces.GetAddress(nCsma.value).ConvertTo(), 9) +echoClient = ns.applications.UdpEchoClientHelper( + csmaInterfaces.GetAddress(nCsma.value).ConvertTo(), 9 +) echoClient.SetAttribute("MaxPackets", ns.core.UintegerValue(1)) -echoClient.SetAttribute("Interval", ns.core.TimeValue(ns.core.Seconds (1.0))) +echoClient.SetAttribute("Interval", ns.core.TimeValue(ns.core.Seconds(1.0))) echoClient.SetAttribute("PacketSize", ns.core.UintegerValue(1024)) clientApps = echoClient.Install(p2pNodes.Get(0)) @@ -94,8 +97,7 @@ clientApps.Stop(ns.core.Seconds(10.0)) ns.internet.Ipv4GlobalRoutingHelper.PopulateRoutingTables() pointToPoint.EnablePcapAll("second") -csma.EnablePcap ("second", csmaDevices.Get (1), True) +csma.EnablePcap("second", csmaDevices.Get(1), True) ns.core.Simulator.Run() ns.core.Simulator.Destroy() - diff --git a/examples/tutorial/third.py b/examples/tutorial/third.py index c7577ebc3..fdc6b2133 100644 --- a/examples/tutorial/third.py +++ b/examples/tutorial/third.py @@ -24,6 +24,7 @@ except ModuleNotFoundError: " or your PYTHONPATH might not be properly configured" ) import sys +from ctypes import c_bool, c_int # // Default Network Topology # // @@ -36,7 +37,7 @@ import sys # // ================ # // LAN 10.1.2.0 -from ctypes import c_bool, c_int + nCsma = c_int(3) verbose = c_bool(True) nWifi = c_int(3) @@ -89,22 +90,40 @@ phy = ns.wifi.YansWifiPhyHelper() phy.SetChannel(channel.Create()) mac = ns.wifi.WifiMacHelper() -ssid = ns.wifi.Ssid ("ns-3-ssid") +ssid = ns.wifi.Ssid("ns-3-ssid") wifi = ns.wifi.WifiHelper() -mac.SetType ("ns3::StaWifiMac", "Ssid", ns.wifi.SsidValue(ssid), "ActiveProbing", ns.core.BooleanValue(False)) +mac.SetType( + "ns3::StaWifiMac", "Ssid", ns.wifi.SsidValue(ssid), "ActiveProbing", ns.core.BooleanValue(False) +) staDevices = wifi.Install(phy, mac, wifiStaNodes) -mac.SetType("ns3::ApWifiMac","Ssid", ns.wifi.SsidValue (ssid)) +mac.SetType("ns3::ApWifiMac", "Ssid", ns.wifi.SsidValue(ssid)) apDevices = wifi.Install(phy, mac, wifiApNode) mobility = ns.mobility.MobilityHelper() -mobility.SetPositionAllocator("ns3::GridPositionAllocator", "MinX", ns.core.DoubleValue(0.0), - "MinY", ns.core.DoubleValue (0.0), "DeltaX", ns.core.DoubleValue(5.0), "DeltaY", ns.core.DoubleValue(10.0), - "GridWidth", ns.core.UintegerValue(3), "LayoutType", ns.core.StringValue("RowFirst")) +mobility.SetPositionAllocator( + "ns3::GridPositionAllocator", + "MinX", + ns.core.DoubleValue(0.0), + "MinY", + ns.core.DoubleValue(0.0), + "DeltaX", + ns.core.DoubleValue(5.0), + "DeltaY", + ns.core.DoubleValue(10.0), + "GridWidth", + ns.core.UintegerValue(3), + "LayoutType", + ns.core.StringValue("RowFirst"), +) -mobility.SetMobilityModel ("ns3::RandomWalk2dMobilityModel", "Bounds", ns.mobility.RectangleValue(ns.mobility.Rectangle (-50, 50, -50, 50))) +mobility.SetMobilityModel( + "ns3::RandomWalk2dMobilityModel", + "Bounds", + ns.mobility.RectangleValue(ns.mobility.Rectangle(-50, 50, -50, 50)), +) mobility.Install(wifiStaNodes) mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel") @@ -132,12 +151,14 @@ serverApps = echoServer.Install(csmaNodes.Get(nCsma.value)) serverApps.Start(ns.core.Seconds(1.0)) serverApps.Stop(ns.core.Seconds(10.0)) -echoClient = ns.applications.UdpEchoClientHelper(csmaInterfaces.GetAddress(nCsma.value).ConvertTo(), 9) +echoClient = ns.applications.UdpEchoClientHelper( + csmaInterfaces.GetAddress(nCsma.value).ConvertTo(), 9 +) echoClient.SetAttribute("MaxPackets", ns.core.UintegerValue(1)) -echoClient.SetAttribute("Interval", ns.core.TimeValue(ns.core.Seconds (1.0))) +echoClient.SetAttribute("Interval", ns.core.TimeValue(ns.core.Seconds(1.0))) echoClient.SetAttribute("PacketSize", ns.core.UintegerValue(1024)) -clientApps = echoClient.Install(wifiStaNodes.Get (nWifi.value - 1)) +clientApps = echoClient.Install(wifiStaNodes.Get(nWifi.value - 1)) clientApps.Start(ns.core.Seconds(2.0)) clientApps.Stop(ns.core.Seconds(10.0)) @@ -147,10 +168,9 @@ ns.core.Simulator.Stop(ns.core.Seconds(10.0)) if tracing.value: phy.SetPcapDataLinkType(phy.DLT_IEEE802_11_RADIO) - pointToPoint.EnablePcapAll ("third") - phy.EnablePcap ("third", apDevices.Get (0)) - csma.EnablePcap ("third", csmaDevices.Get (0), True) + pointToPoint.EnablePcapAll("third") + phy.EnablePcap("third", apDevices.Get(0)) + csma.EnablePcap("third", csmaDevices.Get(0), True) ns.core.Simulator.Run() ns.core.Simulator.Destroy() - diff --git a/examples/wireless/examples-to-run.py b/examples/wireless/examples-to-run.py index 3acd036ee..12d4bd652 100755 --- a/examples/wireless/examples-to-run.py +++ b/examples/wireless/examples-to-run.py @@ -15,9 +15,9 @@ cpp_examples = [ ("wifi-multirate --totalTime=0.3s --rateManager=ns3::MinstrelWifiManager", "True", "False"), ("wifi-multirate --totalTime=0.3s --rateManager=ns3::OnoeWifiManager", "True", "False"), ("wifi-multirate --totalTime=0.3s --rateManager=ns3::RraaWifiManager", "True", "False"), - ("wifi-adhoc", "False", "True"), # Takes too long to run - ("wifi-ap --verbose=0", "True", "True"), # Don't let it spew to stdout - ("wifi-clear-channel-cmu", "False", "True"), # Requires specific hardware + ("wifi-adhoc", "False", "True"), # Takes too long to run + ("wifi-ap --verbose=0", "True", "True"), # Don't let it spew to stdout + ("wifi-clear-channel-cmu", "False", "True"), # Requires specific hardware ("wifi-simple-adhoc", "True", "True"), ("wifi-simple-adhoc-grid", "True", "True"), ("wifi-simple-infra", "True", "True"), @@ -26,12 +26,36 @@ cpp_examples = [ ("wifi-sleep", "True", "True"), ("wifi-blockack", "True", "True"), ("wifi-timing-attributes --simulationTime=1", "True", "True"), - ("wifi-power-adaptation-distance --manager=ns3::ParfWifiManager --outputFileName=parf --steps=5 --stepsSize=10", "True", "True"), - ("wifi-power-adaptation-distance --manager=ns3::AparfWifiManager --outputFileName=aparf --steps=5 --stepsSize=10", "True", "False"), - ("wifi-power-adaptation-distance --manager=ns3::RrpaaWifiManager --outputFileName=rrpaa --steps=5 --stepsSize=10", "True", "False"), - ("wifi-rate-adaptation-distance --standard=802.11a --staManager=ns3::MinstrelWifiManager --apManager=ns3::MinstrelWifiManager --outputFileName=minstrel --stepsSize=50 --stepsTime=0.1", "True", "False"), - ("wifi-rate-adaptation-distance --standard=802.11a --staManager=ns3::MinstrelWifiManager --apManager=ns3::MinstrelWifiManager --outputFileName=minstrel --stepsSize=50 --stepsTime=0.1 --STA1_x=-200", "True", "False"), - ("wifi-rate-adaptation-distance --staManager=ns3::MinstrelHtWifiManager --apManager=ns3::MinstrelHtWifiManager --outputFileName=minstrelHt --shortGuardInterval=true --channelWidth=40 --stepsSize=50 --stepsTime=0.1", "True", "False"), + ( + "wifi-power-adaptation-distance --manager=ns3::ParfWifiManager --outputFileName=parf --steps=5 --stepsSize=10", + "True", + "True", + ), + ( + "wifi-power-adaptation-distance --manager=ns3::AparfWifiManager --outputFileName=aparf --steps=5 --stepsSize=10", + "True", + "False", + ), + ( + "wifi-power-adaptation-distance --manager=ns3::RrpaaWifiManager --outputFileName=rrpaa --steps=5 --stepsSize=10", + "True", + "False", + ), + ( + "wifi-rate-adaptation-distance --standard=802.11a --staManager=ns3::MinstrelWifiManager --apManager=ns3::MinstrelWifiManager --outputFileName=minstrel --stepsSize=50 --stepsTime=0.1", + "True", + "False", + ), + ( + "wifi-rate-adaptation-distance --standard=802.11a --staManager=ns3::MinstrelWifiManager --apManager=ns3::MinstrelWifiManager --outputFileName=minstrel --stepsSize=50 --stepsTime=0.1 --STA1_x=-200", + "True", + "False", + ), + ( + "wifi-rate-adaptation-distance --staManager=ns3::MinstrelHtWifiManager --apManager=ns3::MinstrelHtWifiManager --outputFileName=minstrelHt --shortGuardInterval=true --channelWidth=40 --stepsSize=50 --stepsTime=0.1", + "True", + "False", + ), ("wifi-power-adaptation-interference --simuTime=5", "True", "False"), ("wifi-dsss-validation", "True", "True"), ("wifi-ofdm-validation", "True", "True"), @@ -40,37 +64,145 @@ cpp_examples = [ ("wifi-ofdm-he-validation", "True", "True"), ("wifi-error-models-comparison", "True", "True"), ("wifi-80211n-mimo --simulationTime=0.1 --step=10", "True", "True"), - ("wifi-ht-network --simulationTime=0.2 --frequency=5 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=135", "True", "True"), - ("wifi-ht-network --simulationTime=0.2 --frequency=5 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=132", "True", "True"), - ("wifi-ht-network --simulationTime=0.2 --frequency=2.4 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=132", "True", "True"), - ("wifi-ht-network --simulationTime=0.2 --frequency=2.4 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=129", "True", "True"), - ("wifi-vht-network --simulationTime=0.2 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=583", "True", "True"), - ("wifi-vht-network --simulationTime=0.2 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=557", "True", "True"), - ("wifi-he-network --simulationTime=0.25 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=844", "True", "True"), - ("wifi-he-network --simulationTime=0.3 --frequency=5 --useRts=0 --useExtendedBlockAck=1 --minExpectedThroughput=6 --maxExpectedThroughput=1033", "True", "True"), - ("wifi-he-network --simulationTime=0.3 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=745", "True", "True"), - ("wifi-he-network --simulationTime=0.25 --frequency=2.4 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=238", "True", "True"), - ("wifi-he-network --simulationTime=0.3 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=223", "True", "True"), - ("wifi-he-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=4 --minExpectedThroughput=20 --maxExpectedThroughput=212", "True", "True"), - ("wifi-he-network --simulationTime=0.3 --frequency=2.4 --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --minExpectedThroughput=27 --maxExpectedThroughput=50", "True", "True"), - ("wifi-he-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --minExpectedThroughput=31 --maxExpectedThroughput=290", "True", "True"), - ("wifi-he-network --simulationTime=0.3 --udp=1 --downlink=0 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --muSchedAccessReqInterval=50ms --minExpectedThroughput=46 --maxExpectedThroughput=327", "True", "True"), - ("wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=550", "True", "True"), - ("wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=0 --useExtendedBlockAck=1 --frequency2=6 --minExpectedThroughput=12 --maxExpectedThroughput=550", "True", "True"), - ("wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=547", "True", "True"), - ("wifi-eht-network --simulationTime=0.1 --frequency=2.4 --useRts=0 --useExtendedBlockAck=1 --frequency2=5 --minExpectedThroughput=12 --maxExpectedThroughput=500", "True", "True"), - ("wifi-eht-network --simulationTime=0.1 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=212", "True", "True"), - ("wifi-eht-network --simulationTime=0.23 --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=4 --frequency2=6 --minExpectedThroughput=35 --maxExpectedThroughput=280", "True", "True"), - ("wifi-eht-network --simulationTime=0.25 --frequency=2.4 --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --frequency2=5 --useExtendedBlockAck=1 --minExpectedThroughput=40 --maxExpectedThroughput=100", "True", "True"), - ("wifi-eht-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --frequency2=2.4 --minExpectedThroughput=50 --maxExpectedThroughput=140", "True", "True"), - ("wifi-eht-network --simulationTime=0.2 --udp=1 --downlink=0 --useRts=0 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --muSchedAccessReqInterval=50ms --frequency2=6 --minExpectedThroughput=70 --maxExpectedThroughput=715", "True", "True"), - ("wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=0 --nMpdus=32 --minExpectedThroughput=59 --maxExpectedThroughput=60", "True", "True"), - ("wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=1 --nMpdus=32 --minExpectedThroughput=57 --maxExpectedThroughput=58", "True", "True"), + ( + "wifi-ht-network --simulationTime=0.2 --frequency=5 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=135", + "True", + "True", + ), + ( + "wifi-ht-network --simulationTime=0.2 --frequency=5 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=132", + "True", + "True", + ), + ( + "wifi-ht-network --simulationTime=0.2 --frequency=2.4 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=132", + "True", + "True", + ), + ( + "wifi-ht-network --simulationTime=0.2 --frequency=2.4 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=129", + "True", + "True", + ), + ( + "wifi-vht-network --simulationTime=0.2 --useRts=0 --minExpectedThroughput=5 --maxExpectedThroughput=583", + "True", + "True", + ), + ( + "wifi-vht-network --simulationTime=0.2 --useRts=1 --minExpectedThroughput=5 --maxExpectedThroughput=557", + "True", + "True", + ), + ( + "wifi-he-network --simulationTime=0.25 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=844", + "True", + "True", + ), + ( + "wifi-he-network --simulationTime=0.3 --frequency=5 --useRts=0 --useExtendedBlockAck=1 --minExpectedThroughput=6 --maxExpectedThroughput=1033", + "True", + "True", + ), + ( + "wifi-he-network --simulationTime=0.3 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=745", + "True", + "True", + ), + ( + "wifi-he-network --simulationTime=0.25 --frequency=2.4 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=238", + "True", + "True", + ), + ( + "wifi-he-network --simulationTime=0.3 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=223", + "True", + "True", + ), + ( + "wifi-he-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=4 --minExpectedThroughput=20 --maxExpectedThroughput=212", + "True", + "True", + ), + ( + "wifi-he-network --simulationTime=0.3 --frequency=2.4 --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --minExpectedThroughput=27 --maxExpectedThroughput=50", + "True", + "True", + ), + ( + "wifi-he-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --minExpectedThroughput=31 --maxExpectedThroughput=290", + "True", + "True", + ), + ( + "wifi-he-network --simulationTime=0.3 --udp=1 --downlink=0 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --muSchedAccessReqInterval=50ms --minExpectedThroughput=46 --maxExpectedThroughput=327", + "True", + "True", + ), + ( + "wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=0 --minExpectedThroughput=6 --maxExpectedThroughput=550", + "True", + "True", + ), + ( + "wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=0 --useExtendedBlockAck=1 --frequency2=6 --minExpectedThroughput=12 --maxExpectedThroughput=550", + "True", + "True", + ), + ( + "wifi-eht-network --simulationTime=0.1 --frequency=5 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=547", + "True", + "True", + ), + ( + "wifi-eht-network --simulationTime=0.1 --frequency=2.4 --useRts=0 --useExtendedBlockAck=1 --frequency2=5 --minExpectedThroughput=12 --maxExpectedThroughput=500", + "True", + "True", + ), + ( + "wifi-eht-network --simulationTime=0.1 --frequency=2.4 --useRts=1 --minExpectedThroughput=6 --maxExpectedThroughput=212", + "True", + "True", + ), + ( + "wifi-eht-network --simulationTime=0.23 --udp=0 --downlink=1 --useRts=0 --nStations=4 --dlAckType=ACK-SU-FORMAT --enableUlOfdma=1 --enableBsrp=0 --mcs=4 --frequency2=6 --minExpectedThroughput=35 --maxExpectedThroughput=280", + "True", + "True", + ), + ( + "wifi-eht-network --simulationTime=0.25 --frequency=2.4 --udp=0 --downlink=1 --useRts=0 --nStations=5 --dlAckType=MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --frequency2=5 --useExtendedBlockAck=1 --minExpectedThroughput=40 --maxExpectedThroughput=100", + "True", + "True", + ), + ( + "wifi-eht-network --simulationTime=0.3 --udp=0 --downlink=1 --useRts=1 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=0 --mcs=6 --muSchedAccessReqInterval=50ms --frequency2=2.4 --minExpectedThroughput=50 --maxExpectedThroughput=140", + "True", + "True", + ), + ( + "wifi-eht-network --simulationTime=0.2 --udp=1 --downlink=0 --useRts=0 --nStations=5 --dlAckType=AGGR-MU-BAR --enableUlOfdma=1 --enableBsrp=1 --mcs=5 --muSchedAccessReqInterval=50ms --frequency2=6 --minExpectedThroughput=70 --maxExpectedThroughput=715", + "True", + "True", + ), + ( + "wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=0 --nMpdus=32 --minExpectedThroughput=59 --maxExpectedThroughput=60", + "True", + "True", + ), + ( + "wifi-simple-ht-hidden-stations --simulationTime=1 --enableRts=1 --nMpdus=32 --minExpectedThroughput=57 --maxExpectedThroughput=58", + "True", + "True", + ), ("wifi-mixed-network --simulationTime=1", "True", "True"), ("wifi-aggregation --simulationTime=1 --verifyResults=1", "True", "True"), ("wifi-txop-aggregation --simulationTime=1 --verifyResults=1", "True", "True"), ("wifi-80211e-txop --simulationTime=1 --verifyResults=1", "True", "True"), - ("wifi-multi-tos --simulationTime=1 --nWifi=16 --useRts=1 --useShortGuardInterval=1", "True", "True"), + ( + "wifi-multi-tos --simulationTime=1 --nWifi=16 --useRts=1 --useShortGuardInterval=1", + "True", + "True", + ), ("wifi-tcp", "True", "True"), ("wifi-hidden-terminal --wifiManager=Arf", "True", "True"), ("wifi-hidden-terminal --wifiManager=Aarf", "True", "True"), @@ -81,14 +213,42 @@ cpp_examples = [ ("wifi-hidden-terminal --wifiManager=Cara", "True", "True"), ("wifi-hidden-terminal --wifiManager=Rraa", "True", "True"), ("wifi-hidden-terminal --wifiManager=Rrpaa", "True", "True"), - ("wifi-spectrum-per-example --distance=52 --index=3 --wifiType=ns3::SpectrumWifiPhy --simulationTime=1", "True", "True"), - ("wifi-spectrum-per-example --distance=24 --index=31 --wifiType=ns3::YansWifiPhy --simulationTime=1", "True", "False"), - ("wifi-spectrum-per-interference --distance=24 --index=31 --simulationTime=1 --waveformPower=0.1", "True", "True"), + ( + "wifi-spectrum-per-example --distance=52 --index=3 --wifiType=ns3::SpectrumWifiPhy --simulationTime=1", + "True", + "True", + ), + ( + "wifi-spectrum-per-example --distance=24 --index=31 --wifiType=ns3::YansWifiPhy --simulationTime=1", + "True", + "False", + ), + ( + "wifi-spectrum-per-interference --distance=24 --index=31 --simulationTime=1 --waveformPower=0.1", + "True", + "True", + ), ("wifi-spectrum-saturation-example --simulationTime=1 --index=63", "True", "True"), - ("wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --simulationTime=1", "True", "True"), - ("wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --apRaa=Ideal --staRaa=Ideal --simulationTime=1", "True", "False"), - ("wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --simulationTime=1", "True", "False"), - ("wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --apRaa=Ideal --staRaa=Ideal --simulationTime=1", "True", "False"), + ( + "wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --simulationTime=1", + "True", + "True", + ), + ( + "wifi-backward-compatibility --apVersion=80211a --staVersion=80211n_5GHZ --apRaa=Ideal --staRaa=Ideal --simulationTime=1", + "True", + "False", + ), + ( + "wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --simulationTime=1", + "True", + "False", + ), + ( + "wifi-backward-compatibility --apVersion=80211a --staVersion=80211ac --apRaa=Ideal --staRaa=Ideal --simulationTime=1", + "True", + "False", + ), ] # A list of Python examples to run in order to ensure that they remain diff --git a/examples/wireless/mixed-wired-wireless.py b/examples/wireless/mixed-wired-wireless.py index e8b7b1dbc..d34f099c4 100644 --- a/examples/wireless/mixed-wired-wireless.py +++ b/examples/wireless/mixed-wired-wireless.py @@ -70,12 +70,14 @@ except ModuleNotFoundError: # std.cout << "CourseChange " << path << " x=" << position.x << ", y=" << position.y << ", z=" << position.z << std.endl; # } + def main(argv): # # First, we initialize a few local variables that control some # simulation parameters. # - from ctypes import c_int, c_double + from ctypes import c_double, c_int + backboneNodes = c_int(10) infraNodes = c_int(2) lanNodes = c_int(2) @@ -106,8 +108,8 @@ def main(argv): # cmd.Parse(argv) - if (stopTime.value < 10): - print ("Use a simulation stop time >= 10 seconds") + if stopTime.value < 10: + print("Use a simulation stop time >= 10 seconds") exit(1) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / # # @@ -128,8 +130,9 @@ def main(argv): wifi = ns.wifi.WifiHelper() mac = ns.wifi.WifiMacHelper() mac.SetType("ns3::AdhocWifiMac") - wifi.SetRemoteStationManager("ns3::ConstantRateWifiManager", - "DataMode", ns.core.StringValue("OfdmRate54Mbps")) + wifi.SetRemoteStationManager( + "ns3::ConstantRateWifiManager", "DataMode", ns.core.StringValue("OfdmRate54Mbps") + ) wifiPhy = ns.wifi.YansWifiPhyHelper() wifiPhy.SetPcapDataLinkType(wifiPhy.DLT_IEEE802_11_RADIO) wifiChannel = ns.wifi.YansWifiChannelHelper.Default() @@ -138,11 +141,12 @@ def main(argv): # # Add the IPv4 protocol stack to the nodes in our container # - print ("Enabling OLSR routing on all backbone nodes") + print("Enabling OLSR routing on all backbone nodes") internet = ns.internet.InternetStackHelper() olsr = ns.olsr.OlsrHelper() - internet.SetRoutingHelper(olsr); # has effect on the next Install () - internet.Install(backbone); + internet.SetRoutingHelper(olsr) + # has effect on the next Install () + internet.Install(backbone) # re-initialize for non-olsr routing. # internet.Reset() # @@ -158,17 +162,30 @@ def main(argv): # each of the nodes we just finished building. # mobility = ns.mobility.MobilityHelper() - mobility.SetPositionAllocator("ns3::GridPositionAllocator", - "MinX", ns.core.DoubleValue(20.0), - "MinY", ns.core.DoubleValue(20.0), - "DeltaX", ns.core.DoubleValue(20.0), - "DeltaY", ns.core.DoubleValue(20.0), - "GridWidth", ns.core.UintegerValue(5), - "LayoutType", ns.core.StringValue("RowFirst")) - mobility.SetMobilityModel("ns3::RandomDirection2dMobilityModel", - "Bounds", ns.mobility.RectangleValue(ns.mobility.Rectangle(-500, 500, -500, 500)), - "Speed", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=2]"), - "Pause", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=0.2]")) + mobility.SetPositionAllocator( + "ns3::GridPositionAllocator", + "MinX", + ns.core.DoubleValue(20.0), + "MinY", + ns.core.DoubleValue(20.0), + "DeltaX", + ns.core.DoubleValue(20.0), + "DeltaY", + ns.core.DoubleValue(20.0), + "GridWidth", + ns.core.UintegerValue(5), + "LayoutType", + ns.core.StringValue("RowFirst"), + ) + mobility.SetMobilityModel( + "ns3::RandomDirection2dMobilityModel", + "Bounds", + ns.mobility.RectangleValue(ns.mobility.Rectangle(-500, 500, -500, 500)), + "Speed", + ns.core.StringValue("ns3::ConstantRandomVariable[Constant=2]"), + "Pause", + ns.core.StringValue("ns3::ConstantRandomVariable[Constant=0.2]"), + ) mobility.Install(backbone) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / @@ -182,7 +199,7 @@ def main(argv): ipAddrs.SetBase(ns.network.Ipv4Address("172.16.0.0"), ns.network.Ipv4Mask("255.255.255.0")) for i in range(backboneNodes.value): - print ("Configuring local area network for backbone node ", i) + print("Configuring local area network for backbone node ", i) # # Create a container to manage the nodes of the LAN. We need # two containers here; one with all of the new nodes, and one @@ -221,12 +238,12 @@ def main(argv): mobilityLan = ns.mobility.MobilityHelper() positionAlloc = ns.mobility.ListPositionAllocator() for j in range(newLanNodes.GetN()): - positionAlloc.Add(ns.core.Vector(0.0, (j*10 + 10), 0.0)) + positionAlloc.Add(ns.core.Vector(0.0, (j * 10 + 10), 0.0)) mobilityLan.SetPositionAllocator(positionAlloc) mobilityLan.PushReferenceMobilityModel(backbone.Get(i)) mobilityLan.SetMobilityModel("ns3::ConstantPositionMobilityModel") - mobilityLan.Install(newLanNodes); + mobilityLan.Install(newLanNodes) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / # # @@ -239,7 +256,7 @@ def main(argv): ipAddrs.SetBase(ns.network.Ipv4Address("10.0.0.0"), ns.network.Ipv4Mask("255.255.255.0")) tempRef = [] # list of references to be held to prevent garbage collection for i in range(backboneNodes.value): - print ("Configuring wireless network for backbone node ", i) + print("Configuring wireless network for backbone node ", i) # # Create a container to manage the nodes of the LAN. We need # two containers here; one with all of the new nodes, and one @@ -252,18 +269,16 @@ def main(argv): # # Create another ad hoc network and devices # - ssid = ns.wifi.Ssid('wifi-infra' + str(i)) + ssid = ns.wifi.Ssid("wifi-infra" + str(i)) wifiInfra = ns.wifi.WifiHelper() wifiPhy.SetChannel(wifiChannel.Create()) - macInfra = ns.wifi.WifiMacHelper(); - macInfra.SetType("ns3::StaWifiMac", - "Ssid", ns.wifi.SsidValue(ssid)) + macInfra = ns.wifi.WifiMacHelper() + macInfra.SetType("ns3::StaWifiMac", "Ssid", ns.wifi.SsidValue(ssid)) # setup stas staDevices = wifiInfra.Install(wifiPhy, macInfra, stas) # setup ap. - macInfra.SetType("ns3::ApWifiMac", - "Ssid", ns.wifi.SsidValue(ssid)) + macInfra.SetType("ns3::ApWifiMac", "Ssid", ns.wifi.SsidValue(ssid)) apDevices = wifiInfra.Install(wifiPhy, macInfra, backbone.Get(i)) # Collect all of these new devices infraDevices = ns.network.NetDeviceContainer(apDevices, staDevices) @@ -298,10 +313,15 @@ def main(argv): mobility.PushReferenceMobilityModel(backbone.Get(i)) mobility.SetPositionAllocator(subnetAlloc) - mobility.SetMobilityModel("ns3::RandomDirection2dMobilityModel", - "Bounds", ns.mobility.RectangleValue(ns.mobility.Rectangle(-10, 10, -10, 10)), - "Speed", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=3]"), - "Pause", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=0.4]")) + mobility.SetMobilityModel( + "ns3::RandomDirection2dMobilityModel", + "Bounds", + ns.mobility.RectangleValue(ns.mobility.Rectangle(-10, 10, -10, 10)), + "Speed", + ns.core.StringValue("ns3::ConstantRandomVariable[Constant=3]"), + "Pause", + ns.core.StringValue("ns3::ConstantRandomVariable[Constant=0.4]"), + ) mobility.Install(stas) # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / @@ -312,18 +332,25 @@ def main(argv): # Create the OnOff application to send UDP datagrams of size # 210 bytes at a rate of 448 Kb/s, between two nodes - print ("Create Applications.") - port = 9 # Discard port(RFC 863) + print("Create Applications.") + port = 9 # Discard port(RFC 863) appSource = ns.network.NodeList.GetNode(backboneNodes.value) - lastNodeIndex = backboneNodes.value + backboneNodes.value*(lanNodes.value - 1) + backboneNodes.value*(infraNodes.value - 1) - 1 + lastNodeIndex = ( + backboneNodes.value + + backboneNodes.value * (lanNodes.value - 1) + + backboneNodes.value * (infraNodes.value - 1) + - 1 + ) appSink = ns.network.NodeList.GetNode(lastNodeIndex) - ns.cppyy.cppdef(""" + ns.cppyy.cppdef( + """ Ipv4Address getIpv4AddressFromNode(Ptr node){ return node->GetObject()->GetAddress(1,0).GetLocal(); } - """) + """ + ) # Let's fetch the IP address of the last node, which is on Ipv4Interface 1 remoteAddr = ns.cppyy.gbl.getIpv4AddressFromNode(appSink) socketAddr = ns.network.InetSocketAddress(remoteAddr, port) @@ -333,8 +360,12 @@ def main(argv): apps.Stop(ns.core.Seconds(stopTime.value - 1)) # Create a packet sink to receive these packets - sink = ns.applications.PacketSinkHelper("ns3::UdpSocketFactory", - ns.network.InetSocketAddress(ns.network.InetSocketAddress(ns.network.Ipv4Address.GetAny(), port)).ConvertTo()) + sink = ns.applications.PacketSinkHelper( + "ns3::UdpSocketFactory", + ns.network.InetSocketAddress( + ns.network.InetSocketAddress(ns.network.Ipv4Address.GetAny(), port) + ).ConvertTo(), + ) sinkContainer = ns.network.NodeContainer(appSink) apps = sink.Install(sinkContainer) apps.Start(ns.core.Seconds(3)) @@ -345,16 +376,16 @@ def main(argv): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # / - print ("Configure Tracing.") + print("Configure Tracing.") csma = ns.csma.CsmaHelper() # # Let's set up some ns-2-like ascii traces, using another helper class # - ascii = ns.network.AsciiTraceHelper(); - stream = ascii.CreateFileStream("mixed-wireless.tr"); - wifiPhy.EnableAsciiAll(stream); - csma.EnableAsciiAll(stream); - internet.EnableAsciiIpv4All(stream); + ascii = ns.network.AsciiTraceHelper() + stream = ascii.CreateFileStream("mixed-wireless.tr") + wifiPhy.EnableAsciiAll(stream) + csma.EnableAsciiAll(stream) + internet.EnableAsciiIpv4All(stream) # Csma captures in non-promiscuous mode csma.EnablePcapAll("mixed-wireless", False) @@ -362,11 +393,10 @@ def main(argv): wifiPhy.EnablePcap("mixed-wireless", backboneDevices) wifiPhy.EnablePcap("mixed-wireless", appSink.GetId(), 0) -# #ifdef ENABLE_FOR_TRACING_EXAMPLE -# Config.Connect("/NodeList/*/$MobilityModel/CourseChange", -# MakeCallback(&CourseChangeCallback)) -# #endif - + # #ifdef ENABLE_FOR_TRACING_EXAMPLE + # Config.Connect("/NodeList/*/$MobilityModel/CourseChange", + # MakeCallback(&CourseChangeCallback)) + # #endif # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # @@ -374,13 +404,13 @@ def main(argv): # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # # - print ("Run Simulation.") + print("Run Simulation.") ns.core.Simulator.Stop(ns.core.Seconds(stopTime.value)) ns.core.Simulator.Run() ns.core.Simulator.Destroy() -if __name__ == '__main__': + +if __name__ == "__main__": import sys + main(sys.argv) - - diff --git a/examples/wireless/wifi-ap.py b/examples/wireless/wifi-ap.py index ef1561997..464d9dfe5 100644 --- a/examples/wireless/wifi-ap.py +++ b/examples/wireless/wifi-ap.py @@ -77,7 +77,8 @@ except ModuleNotFoundError: # std::cout << " start="< node){ Ptr mob = node->GetObject(); @@ -87,7 +88,9 @@ ns.cppyy.cppdef(""" return; mob->SetPosition(pos); Simulator::Schedule(Seconds(1.0), AdvancePosition, node); - }""") + }""" +) + def main(argv): ns.core.CommandLine().Parse(argv) @@ -98,7 +101,7 @@ def main(argv): mobility = ns.mobility.MobilityHelper() stas = ns.network.NodeContainer() ap = ns.network.NodeContainer() - #NetDeviceContainer staDevs; + # NetDeviceContainer staDevs; packetSocket = ns.network.PacketSocketHelper() stas.Create(2) @@ -116,15 +119,16 @@ def main(argv): wifiMac = ns.wifi.WifiMacHelper() # setup stas. - wifiMac.SetType("ns3::StaWifiMac", - "ActiveProbing", - ns.core.BooleanValue(True), - "Ssid", - ns.wifi.SsidValue(ssid)) + wifiMac.SetType( + "ns3::StaWifiMac", + "ActiveProbing", + ns.core.BooleanValue(True), + "Ssid", + ns.wifi.SsidValue(ssid), + ) staDevs = wifi.Install(wifiPhy, wifiMac, stas) # setup ap. - wifiMac.SetType("ns3::ApWifiMac", - "Ssid", ns.wifi.SsidValue(ssid)) + wifiMac.SetType("ns3::ApWifiMac", "Ssid", ns.wifi.SsidValue(ssid)) wifi.Install(wifiPhy, wifiMac, ap) # mobility. @@ -139,7 +143,7 @@ def main(argv): socket.SetProtocol(1) onoff = ns.applications.OnOffHelper("ns3::PacketSocketFactory", socket.ConvertTo()) - onoff.SetConstantRate (ns.network.DataRate ("500kb/s")) + onoff.SetConstantRate(ns.network.DataRate("500kb/s")) apps = onoff.Install(ns.network.NodeContainer(stas.Get(0))) apps.Start(ns.core.Seconds(0.5)) @@ -147,13 +151,12 @@ def main(argv): ns.core.Simulator.Stop(ns.core.Seconds(44.0)) - # Config::Connect("/NodeList/*/DeviceList/*/Tx", MakeCallback(&DevTxTrace)); - # Config::Connect("/NodeList/*/DeviceList/*/Rx", MakeCallback(&DevRxTrace)); - # Config::Connect("/NodeList/*/DeviceList/*/Phy/RxOk", MakeCallback(&PhyRxOkTrace)); - # Config::Connect("/NodeList/*/DeviceList/*/Phy/RxError", MakeCallback(&PhyRxErrorTrace)); - # Config::Connect("/NodeList/*/DeviceList/*/Phy/Tx", MakeCallback(&PhyTxTrace)); - # Config::Connect("/NodeList/*/DeviceList/*/Phy/State", MakeCallback(&PhyStateTrace)); - + # Config::Connect("/NodeList/*/DeviceList/*/Tx", MakeCallback(&DevTxTrace)); + # Config::Connect("/NodeList/*/DeviceList/*/Rx", MakeCallback(&DevRxTrace)); + # Config::Connect("/NodeList/*/DeviceList/*/Phy/RxOk", MakeCallback(&PhyRxOkTrace)); + # Config::Connect("/NodeList/*/DeviceList/*/Phy/RxError", MakeCallback(&PhyRxErrorTrace)); + # Config::Connect("/NodeList/*/DeviceList/*/Phy/Tx", MakeCallback(&PhyTxTrace)); + # Config::Connect("/NodeList/*/DeviceList/*/Phy/State", MakeCallback(&PhyStateTrace)); ns.core.Simulator.Run() ns.core.Simulator.Destroy() @@ -161,6 +164,5 @@ def main(argv): return 0 -if __name__ == '__main__': +if __name__ == "__main__": sys.exit(main(sys.argv)) - diff --git a/ns3 b/ns3 index 25af048e6..755c63c5b 100755 --- a/ns3 +++ b/ns3 @@ -32,7 +32,7 @@ def exit_handler(dry_run): return if print_buffer == "": return - print_buffer = print_buffer.replace('\\', '/').replace('//', '/').replace('/', os.sep) + print_buffer = print_buffer.replace("\\", "/").replace("//", "/").replace("/", os.sep) if dry_run: print("The following commands would be executed:") elif run_verbose: @@ -41,12 +41,18 @@ def exit_handler(dry_run): def on_off_argument(parser, option_name, help_on, help_off=None): - parser.add_argument('--enable-%s' % option_name, - help=('Enable %s' % help_on) if help_off is None else help_on, - action="store_true", default=None) - parser.add_argument('--disable-%s' % option_name, - help=('Disable %s' % help_on) if help_off is None else help_off, - action="store_true", default=None) + parser.add_argument( + "--enable-%s" % option_name, + help=("Enable %s" % help_on) if help_off is None else help_on, + action="store_true", + default=None, + ) + parser.add_argument( + "--disable-%s" % option_name, + help=("Disable %s" % help_on) if help_off is None else help_off, + action="store_true", + default=None, + ) return parser @@ -63,36 +69,42 @@ def on_off_condition(args, cmake_flag, option_name): return cmake_arg -def add_argument_to_subparsers(parsers: list, - arguments: list, - help_msg: str, - dest: str, - action="store_true", - default_value=None): +def add_argument_to_subparsers( + parsers: list, + arguments: list, + help_msg: str, + dest: str, + action="store_true", + default_value=None, +): # Instead of copying and pasting repeated arguments for each parser, we add them here for subparser in parsers: subparser_name = subparser.prog.replace("ns3", "").strip() destination = ("%s_%s" % (subparser_name, dest)) if subparser_name else dest - subparser.add_argument(*arguments, - help=help_msg, - action=action, - default=default_value, - dest=destination) + subparser.add_argument( + *arguments, help=help_msg, action=action, default=default_value, dest=destination + ) def parse_args(argv): - parser = argparse.ArgumentParser(description="ns-3 wrapper for the CMake build system", add_help=False) + parser = argparse.ArgumentParser( + description="ns-3 wrapper for the CMake build system", add_help=False + ) sub_parser = parser.add_subparsers() - parser.add_argument('-h', '--help', - help="Print a summary of available commands", - action="store_true", default=None, dest="main_help") - parser_help = sub_parser.add_parser('help', - help='Print a summary of available commands') - parser_help.add_argument('help', - help='Print a summary of available commands', - action="store_true", default=False) + parser.add_argument( + "-h", + "--help", + help="Print a summary of available commands", + action="store_true", + default=None, + dest="main_help", + ) + parser_help = sub_parser.add_parser("help", help="Print a summary of available commands") + parser_help.add_argument( + "help", help="Print a summary of available commands", action="store_true", default=False + ) # parser.add_argument('--docset', # help=( # 'Create Docset, without building. This requires the docsetutil tool from Xcode 9.2 or earlier.' @@ -100,34 +112,56 @@ def parse_args(argv): # action="store_true", default=None, # dest="docset_build") - parser_build = sub_parser.add_parser('build', - help=('Accepts a list of targets to build,' - ' or builds the entire project if no target is given'), - formatter_class=argparse.RawTextHelpFormatter) - parser_build.add_argument('build', - help=('Build the entire project or the specified target and its dependencies.\n' - 'To get the list of targets, use:\n' - './ns3 show targets\n'), - action="store", nargs='*', default=None, metavar='target') + parser_build = sub_parser.add_parser( + "build", + help=( + "Accepts a list of targets to build," + " or builds the entire project if no target is given" + ), + formatter_class=argparse.RawTextHelpFormatter, + ) + parser_build.add_argument( + "build", + help=( + "Build the entire project or the specified target and its dependencies.\n" + "To get the list of targets, use:\n" + "./ns3 show targets\n" + ), + action="store", + nargs="*", + default=None, + metavar="target", + ) - parser_configure = sub_parser.add_parser('configure', - help='Try "./ns3 configure --help" for more configuration options') - parser_configure.add_argument('configure', - action='store_true', default=False) - parser_configure.add_argument('-d', '--build-profile', - help='Build profile', - dest='build_profile', - choices=["debug", "default", "release", "optimized", "minsizerel"], - action="store", type=str, default=None) + parser_configure = sub_parser.add_parser( + "configure", help='Try "./ns3 configure --help" for more configuration options' + ) + parser_configure.add_argument("configure", action="store_true", default=False) + parser_configure.add_argument( + "-d", + "--build-profile", + help="Build profile", + dest="build_profile", + choices=["debug", "default", "release", "optimized", "minsizerel"], + action="store", + type=str, + default=None, + ) - parser_configure.add_argument('-G', - help=('CMake generator ' - '(e.g. https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)'), - action="store", type=str, default=None) + parser_configure.add_argument( + "-G", + help=( + "CMake generator " + "(e.g. https://cmake.org/cmake/help/latest/manual/cmake-generators.7.html)" + ), + action="store", + type=str, + default=None, + ) - parser_configure.add_argument('--cxx-standard', - help='Compile NS-3 with the given C++ standard', - type=str, default=None) + parser_configure.add_argument( + "--cxx-standard", help="Compile NS-3 with the given C++ standard", type=str, default=None + ) # On-Off options # First positional is transformed into --enable-option --disable-option @@ -136,9 +170,11 @@ def parse_args(argv): # and the third is used as is as the 'disable' description on_off_options = [ ("asserts", "the asserts regardless of the compile mode"), - ("des-metrics", "Logging all events in a json file with the name of the executable " - "(which must call CommandLine::Parse(argc, argv))" - ), + ( + "des-metrics", + "Logging all events in a json file with the name of the executable " + "(which must call CommandLine::Parse(argc, argv))", + ), ("build-version", "embedding git changes as a build version during build"), ("clang-tidy", "clang-tidy static analysis"), ("dpdk", "the fd-net-device DPDK features"), @@ -150,181 +186,310 @@ def parse_args(argv): ("logs", "the logs regardless of the compile mode"), ("monolib", "a single shared library with all ns-3 modules"), ("mpi", "the MPI support for distributed simulation"), - ("ninja-tracing", "the conversion of the Ninja generator log file into about://tracing format"), + ( + "ninja-tracing", + "the conversion of the Ninja generator log file into about://tracing format", + ), ("precompiled-headers", "precompiled headers"), ("python-bindings", "python bindings"), ("tests", "the ns-3 tests"), ("sanitizers", "address, memory leaks and undefined behavior sanitizers"), - ("static", "Build a single static library with all ns-3", - "Restore the shared libraries" - ), + ("static", "Build a single static library with all ns-3", "Restore the shared libraries"), ("sudo", "use of sudo to setup suid bits on ns3 executables."), ("verbose", "printing of additional build system messages"), ("warnings", "compiler warnings"), - ("werror", "Treat compiler warnings as errors", - "Treat compiler warnings as warnings" - ), + ("werror", "Treat compiler warnings as errors", "Treat compiler warnings as warnings"), ] for on_off_option in on_off_options: parser_configure = on_off_argument(parser_configure, *on_off_option) - parser_configure.add_argument('--enable-modules', - help='List of modules to build (e.g. \"core;network;internet\")', - action="store", type=str, default=None) - parser_configure.add_argument('--disable-modules', - help='List of modules not to build (e.g. \"lte;wimax\")', - action="store", type=str, default=None) - parser_configure.add_argument('--filter-module-examples-and-tests', - help=('List of modules that should have their examples ' - 'and tests built (e.g. \"lte;wifi\")'), - action="store", type=str, default=None) - parser_configure.add_argument('--lcov-report', - help=('Generate a code coverage report ' - '(use this option after configuring with --enable-gcov and running a program)'), - action="store_true", default=None) - parser_configure.add_argument('--lcov-zerocounters', - help=('Zero the lcov counters' - ' (use this option before rerunning a program' - ' when generating repeated lcov reports)'), - action="store_true", default=None) + parser_configure.add_argument( + "--enable-modules", + help='List of modules to build (e.g. "core;network;internet")', + action="store", + type=str, + default=None, + ) + parser_configure.add_argument( + "--disable-modules", + help='List of modules not to build (e.g. "lte;wimax")', + action="store", + type=str, + default=None, + ) + parser_configure.add_argument( + "--filter-module-examples-and-tests", + help=( + "List of modules that should have their examples " 'and tests built (e.g. "lte;wifi")' + ), + action="store", + type=str, + default=None, + ) + parser_configure.add_argument( + "--lcov-report", + help=( + "Generate a code coverage report " + "(use this option after configuring with --enable-gcov and running a program)" + ), + action="store_true", + default=None, + ) + parser_configure.add_argument( + "--lcov-zerocounters", + help=( + "Zero the lcov counters" + " (use this option before rerunning a program" + " when generating repeated lcov reports)" + ), + action="store_true", + default=None, + ) - parser_configure.add_argument('--out', '--output-directory', - help=('Directory to store build artifacts'), - type=str, default=None, dest="output_directory") - parser_configure.add_argument('--with-brite', - help=('Use BRITE integration support, given by the indicated path,' - ' to allow the use of the BRITE topology generator'), - type=str, default=None) - parser_configure.add_argument('--with-click', - help='Path to Click source or installation prefix for NS-3 Click Integration support', - type=str, default=None) - parser_configure.add_argument('--with-openflow', - help='Path to OFSID source for NS-3 OpenFlow Integration support', - type=str, default=None) - parser_configure.add_argument('--force-refresh', - help='Force refresh the CMake cache by deleting' - ' the cache and reconfiguring the project', - action="store_true", default=None) - parser_configure.add_argument('--prefix', - help='Target output directory to install', - action="store", default=None) - parser_configure.add_argument('--trace-performance', - help="Generate a performance trace log for the CMake configuration", - action="store_true", default=None, dest="trace_cmake_perf") + parser_configure.add_argument( + "--out", + "--output-directory", + help=("Directory to store build artifacts"), + type=str, + default=None, + dest="output_directory", + ) + parser_configure.add_argument( + "--with-brite", + help=( + "Use BRITE integration support, given by the indicated path," + " to allow the use of the BRITE topology generator" + ), + type=str, + default=None, + ) + parser_configure.add_argument( + "--with-click", + help="Path to Click source or installation prefix for NS-3 Click Integration support", + type=str, + default=None, + ) + parser_configure.add_argument( + "--with-openflow", + help="Path to OFSID source for NS-3 OpenFlow Integration support", + type=str, + default=None, + ) + parser_configure.add_argument( + "--force-refresh", + help="Force refresh the CMake cache by deleting" " the cache and reconfiguring the project", + action="store_true", + default=None, + ) + parser_configure.add_argument( + "--prefix", help="Target output directory to install", action="store", default=None + ) + parser_configure.add_argument( + "--trace-performance", + help="Generate a performance trace log for the CMake configuration", + action="store_true", + default=None, + dest="trace_cmake_perf", + ) - parser_clean = sub_parser.add_parser('clean', help='Removes files created by ns3') - parser_clean.add_argument('clean', action="store_true", default=False) + parser_clean = sub_parser.add_parser("clean", help="Removes files created by ns3") + parser_clean.add_argument("clean", action="store_true", default=False) - parser_distclean = sub_parser.add_parser('distclean', help='Removes files created by ns3, tests and documentation') - parser_distclean.add_argument('distclean', action="store_true", default=False) + parser_distclean = sub_parser.add_parser( + "distclean", help="Removes files created by ns3, tests and documentation" + ) + parser_distclean.add_argument("distclean", action="store_true", default=False) - parser_install = sub_parser.add_parser('install', help='Install ns-3') - parser_install.add_argument('install', action="store_true", default=False) + parser_install = sub_parser.add_parser("install", help="Install ns-3") + parser_install.add_argument("install", action="store_true", default=False) - parser_uninstall = sub_parser.add_parser('uninstall', help='Uninstall ns-3') - parser_uninstall.add_argument('uninstall', action="store_true", default=False) + parser_uninstall = sub_parser.add_parser("uninstall", help="Uninstall ns-3") + parser_uninstall.add_argument("uninstall", action="store_true", default=False) - parser_run = sub_parser.add_parser('run', - help='Try "./ns3 run --help" for more runtime options', - formatter_class=argparse.RawTextHelpFormatter) - parser_run.add_argument('run', - help=('Build and run the target executable.\n' - 'If --no-build is present, the build step is skipped.\n' - 'To get the list of targets, use:\n' - './ns3 show targets\n' - 'Arguments can be passed down to a program in one of the following ways:\n' - './ns3 run "target --help"\n' - './ns3 run target -- --help\n' - './ns3 run target --command-template="%%s --help"\n'), - default='', nargs='?', metavar='target') - parser_run.add_argument('--no-build', - help='Skip build step.', - action="store_true", default=False) - parser_run.add_argument('--command-template', - help=('Template of the command used to run the program given by run;' - ' It should be a shell command string containing %%s inside,' - ' which will be replaced by the actual program.'), - type=str, default=None) - parser_run.add_argument('--cwd', - help='Set the working directory for a program.', - action="store", type=str, default=None) - parser_run.add_argument('--gdb', - help='Change the default command template to run programs with gdb', - action="store_true", default=None) - parser_run.add_argument('--lldb', - help='Change the default command template to run programs with lldb', - action="store_true", default=None) - parser_run.add_argument('-g', '--valgrind', - help='Change the default command template to run programs with valgrind', - action="store_true", default=None) - parser_run.add_argument('--memray', - help='Use Memray memory profiler for Python scripts. Output will be saved to memray.output', - action="store_true", default=None) - parser_run.add_argument('--heaptrack', - help='Use Heaptrack memory profiler for C++', - action="store_true", default=None) - parser_run.add_argument('--perf', - help='Use Linux\'s perf to profile a program', - action="store_true", default=None) - parser_run.add_argument('--vis', '--visualize', - help='Modify --run arguments to enable the visualizer', - action="store_true", dest="visualize", default=None) - parser_run.add_argument('--enable-sudo', - help='Use sudo to setup suid bits on ns3 executables.', - dest='enable_sudo', action='store_true', - default=False) + parser_run = sub_parser.add_parser( + "run", + help='Try "./ns3 run --help" for more runtime options', + formatter_class=argparse.RawTextHelpFormatter, + ) + parser_run.add_argument( + "run", + help=( + "Build and run the target executable.\n" + "If --no-build is present, the build step is skipped.\n" + "To get the list of targets, use:\n" + "./ns3 show targets\n" + "Arguments can be passed down to a program in one of the following ways:\n" + './ns3 run "target --help"\n' + "./ns3 run target -- --help\n" + './ns3 run target --command-template="%%s --help"\n' + ), + default="", + nargs="?", + metavar="target", + ) + parser_run.add_argument( + "--no-build", help="Skip build step.", action="store_true", default=False + ) + parser_run.add_argument( + "--command-template", + help=( + "Template of the command used to run the program given by run;" + " It should be a shell command string containing %%s inside," + " which will be replaced by the actual program." + ), + type=str, + default=None, + ) + parser_run.add_argument( + "--cwd", + help="Set the working directory for a program.", + action="store", + type=str, + default=None, + ) + parser_run.add_argument( + "--gdb", + help="Change the default command template to run programs with gdb", + action="store_true", + default=None, + ) + parser_run.add_argument( + "--lldb", + help="Change the default command template to run programs with lldb", + action="store_true", + default=None, + ) + parser_run.add_argument( + "-g", + "--valgrind", + help="Change the default command template to run programs with valgrind", + action="store_true", + default=None, + ) + parser_run.add_argument( + "--memray", + help="Use Memray memory profiler for Python scripts. Output will be saved to memray.output", + action="store_true", + default=None, + ) + parser_run.add_argument( + "--heaptrack", + help="Use Heaptrack memory profiler for C++", + action="store_true", + default=None, + ) + parser_run.add_argument( + "--perf", help="Use Linux's perf to profile a program", action="store_true", default=None + ) + parser_run.add_argument( + "--vis", + "--visualize", + help="Modify --run arguments to enable the visualizer", + action="store_true", + dest="visualize", + default=None, + ) + parser_run.add_argument( + "--enable-sudo", + help="Use sudo to setup suid bits on ns3 executables.", + dest="enable_sudo", + action="store_true", + default=False, + ) - parser_shell = sub_parser.add_parser('shell', - help='Try "./ns3 shell --help" for more shell options') - parser_shell.add_argument('shell', - help='Export necessary environment variables and open a shell', - action="store_true", default=False) + parser_shell = sub_parser.add_parser( + "shell", help='Try "./ns3 shell --help" for more shell options' + ) + parser_shell.add_argument( + "shell", + help="Export necessary environment variables and open a shell", + action="store_true", + default=False, + ) - parser_docs = sub_parser.add_parser('docs', - help='Try "./ns3 docs --help" for more documentation options') - parser_docs.add_argument('docs', - help='Build project documentation', - choices=["contributing", "installation", "manual", "models", "tutorial", - "sphinx", "doxygen-no-build", "doxygen", "all"], - action="store", type=str, default=None) + parser_docs = sub_parser.add_parser( + "docs", help='Try "./ns3 docs --help" for more documentation options' + ) + parser_docs.add_argument( + "docs", + help="Build project documentation", + choices=[ + "contributing", + "installation", + "manual", + "models", + "tutorial", + "sphinx", + "doxygen-no-build", + "doxygen", + "all", + ], + action="store", + type=str, + default=None, + ) - parser_show = sub_parser.add_parser('show', - help='Try "./ns3 show --help" for more show options') - parser_show.add_argument('show', - help=('Print the current ns-3 build profile type, configuration or version, ' - 'or a list of buildable/runnable targets'), - choices=["profile", "version", "config", "targets", "all"], - action="store", type=str, nargs="?", default="all") + parser_show = sub_parser.add_parser( + "show", help='Try "./ns3 show --help" for more show options' + ) + parser_show.add_argument( + "show", + help=( + "Print the current ns-3 build profile type, configuration or version, " + "or a list of buildable/runnable targets" + ), + choices=["profile", "version", "config", "targets", "all"], + action="store", + type=str, + nargs="?", + default="all", + ) add_argument_to_subparsers( - [parser, parser_build, parser_configure, parser_clean, parser_distclean, parser_docs, parser_run, parser_show], + [ + parser, + parser_build, + parser_configure, + parser_clean, + parser_distclean, + parser_docs, + parser_run, + parser_show, + ], ["--dry-run"], help_msg="Do not execute the commands.", - dest="dry_run") + dest="dry_run", + ) - add_argument_to_subparsers([parser, parser_build, parser_run], - ['-j', '--jobs'], - help_msg="Set number of parallel jobs.", - dest="jobs", - action="store", - default_value=max_cpu_threads) + add_argument_to_subparsers( + [parser, parser_build, parser_run], + ["-j", "--jobs"], + help_msg="Set number of parallel jobs.", + dest="jobs", + action="store", + default_value=max_cpu_threads, + ) - add_argument_to_subparsers([parser, parser_build, parser_configure, parser_run, parser_show], - ["--quiet"], - help_msg="Don't print task lines, i.e. messages saying which tasks are being executed.", - dest="quiet") + add_argument_to_subparsers( + [parser, parser_build, parser_configure, parser_run, parser_show], + ["--quiet"], + help_msg="Don't print task lines, i.e. messages saying which tasks are being executed.", + dest="quiet", + ) - add_argument_to_subparsers([parser, parser_build, parser_configure, parser_docs, parser_run], - ['-v', '--verbose'], - help_msg='Print which commands were executed', - dest='verbose', - default_value=False) + add_argument_to_subparsers( + [parser, parser_build, parser_configure, parser_docs, parser_run], + ["-v", "--verbose"], + help_msg="Print which commands were executed", + dest="verbose", + default_value=False, + ) # Try to split -- separated arguments into two lists for ns3 and for the runnable target try: - args_separator_index = argv.index('--') + args_separator_index = argv.index("--") ns3_args = argv[:args_separator_index] - runnable_args = argv[args_separator_index + 1:] + runnable_args = argv[args_separator_index + 1 :] except ValueError: ns3_args = argv runnable_args = [] @@ -333,17 +498,19 @@ def parse_args(argv): args, unknown_args = parser.parse_known_args(ns3_args) # If run doesn't have a target, print the help message of the run parser - if "run" in args and args.run == '': + if "run" in args and args.run == "": parser_run.print_help() exit(-1) # Merge attributes attributes_to_merge = ["dry_run", "help", "verbose", "quiet"] filtered_attributes = list( - filter(lambda x: x if ("disable" not in x and "enable" not in x) else None, args.__dir__())) + filter(lambda x: x if ("disable" not in x and "enable" not in x) else None, args.__dir__()) + ) for attribute in attributes_to_merge: merging_attributes = list( - map(lambda x: args.__getattribute__(x) if attribute in x else None, filtered_attributes)) + map(lambda x: args.__getattribute__(x) if attribute in x else None, filtered_attributes) + ) setattr(args, attribute, merging_attributes.count(True) > 0) if args.help: @@ -353,8 +520,8 @@ def parse_args(argv): # retrieve subparsers from parser subparsers_actions = [ - action for action in parser._actions - if isinstance(action, argparse._SubParsersAction)] + action for action in parser._actions if isinstance(action, argparse._SubParsersAction) + ] # there will probably only be one subparser_action, # but better safe than sorry for subparsers_action in subparsers_actions: @@ -364,18 +531,36 @@ def parse_args(argv): if len(subcommand) > 1: print(subcommand) - print(parser.format_help().replace(parser.description, "").replace(parser.format_usage(), "")) + print( + parser.format_help().replace(parser.description, "").replace(parser.format_usage(), "") + ) exit(0) attributes_to_merge = ["jobs"] - filtered_attributes = list(filter(lambda x: x if ("disable" not in x and "enable" not in x) else 0, args.__dir__())) + filtered_attributes = list( + filter(lambda x: x if ("disable" not in x and "enable" not in x) else 0, args.__dir__()) + ) for attribute in attributes_to_merge: merging_attributes = list( - map(lambda x: int(args.__getattribute__(x)) if attribute in x else max_cpu_threads, filtered_attributes)) + map( + lambda x: int(args.__getattribute__(x)) if attribute in x else max_cpu_threads, + filtered_attributes, + ) + ) setattr(args, attribute, min(merging_attributes)) # If some positional options are not in args, set them to false. - for option in ["clean", "configure", "docs", "install", "run", "shell", "uninstall", "show", "distclean"]: + for option in [ + "clean", + "configure", + "docs", + "install", + "run", + "shell", + "uninstall", + "show", + "distclean", + ]: if option not in args: setattr(args, option, False) @@ -387,9 +572,11 @@ def parse_args(argv): # Emit error in case of unknown arguments if unknown_args: - msg = ("Unknown options were given: {options}.\n" - "To see the allowed options add the `--help` option.\n" - "To forward configuration or runtime options, put them after '--'.\n") + msg = ( + "Unknown options were given: {options}.\n" + "To see the allowed options add the `--help` option.\n" + "To forward configuration or runtime options, put them after '--'.\n" + ) if args.run: msg += "Try: ./ns3 run {target} -- {options}\n" if args.configure: @@ -404,14 +591,15 @@ def check_lock_data(output_directory): ns3_modules_tests = [] ns3_modules = None - build_info = {"NS3_ENABLED_MODULES": [], - "BUILD_PROFILE": None, - "VERSION": None, - "ENABLE_EXAMPLES": False, - "ENABLE_SUDO": False, - "ENABLE_TESTS": False, - "BUILD_VERSION_STRING": None - } + build_info = { + "NS3_ENABLED_MODULES": [], + "BUILD_PROFILE": None, + "VERSION": None, + "ENABLE_EXAMPLES": False, + "ENABLE_SUDO": False, + "ENABLE_TESTS": False, + "BUILD_VERSION_STRING": None, + } if output_directory and os.path.exists(lock_file): exec(open(lock_file).read(), globals(), build_info) ns3_modules = build_info["NS3_ENABLED_MODULES"] @@ -432,15 +620,18 @@ def print_and_buffer(message): def remove_dir(dir_to_remove, dry_run, directory_qualifier=""): dir_to_remove = os.path.abspath(dir_to_remove) if os.path.exists(dir_to_remove): - if (".." in os.path.relpath(dir_to_remove, ns3_path) - or os.path.abspath(dir_to_remove) == os.path.abspath(ns3_path)): + if ".." in os.path.relpath(dir_to_remove, ns3_path) or os.path.abspath( + dir_to_remove + ) == os.path.abspath(ns3_path): # In case the directory to remove isn't within # the current ns-3 directory, print an error # message for the dry-run case # Or throw an exception in a normal run - error_message = (f"The {directory_qualifier} directory '{dir_to_remove}' " - "is not within the current ns-3 directory. " - "Deleting it can cause data loss.") + error_message = ( + f"The {directory_qualifier} directory '{dir_to_remove}' " + "is not within the current ns-3 directory. " + "Deleting it can cause data loss." + ) if dry_run: print_and_buffer(error_message) return @@ -468,11 +659,7 @@ def clean_cmake_artifacts(dry_run=False): dirname = os.path.dirname(cmake_cache_file) remove_dir(dirname, dry_run, "CMake cache") - dirs_to_remove = ["testpy-output", - "__pycache__", - "build", - "cmake-cache" - ] + dirs_to_remove = ["testpy-output", "__pycache__", "build", "cmake-cache"] for dir_to_remove in map(append_to_ns3_path, dirs_to_remove): remove_dir(dir_to_remove, dry_run) @@ -480,18 +667,21 @@ def clean_cmake_artifacts(dry_run=False): def clean_docs_and_tests_artifacts(dry_run=False): - docs_dir = append_to_ns3_path('doc') + docs_dir = append_to_ns3_path("doc") - file_artifacts = ["doxygen.log", - "doxygen.warnings.log", - "introspected-command-line.h", - "introspected-doxygen.h", - "ns3-object.txt"] + file_artifacts = [ + "doxygen.log", + "doxygen.warnings.log", + "introspected-command-line.h", + "introspected-doxygen.h", + "ns3-object.txt", + ] docs_files = [os.path.join(docs_dir, filename) for filename in file_artifacts] - docs_and_tests_dirs = [os.path.join(docs_dir, "html"), - os.path.join(docs_dir, "html-warn"), - ] + docs_and_tests_dirs = [ + os.path.join(docs_dir, "html"), + os.path.join(docs_dir, "html-warn"), + ] docs_and_tests_dirs.extend(glob.glob(f"{docs_dir}/**/build", recursive=True)) docs_and_tests_dirs.extend(glob.glob(f"{docs_dir}/**/source-temp", recursive=True)) @@ -503,10 +693,7 @@ def clean_docs_and_tests_artifacts(dry_run=False): def clean_pip_packaging_artifacts(dry_run=False): - pip_dirs = ["dist", - "nsnam.egg-info", - "wheelhouse" - ] + pip_dirs = ["dist", "nsnam.egg-info", "wheelhouse"] for directory in map(append_to_ns3_path, pip_dirs): remove_dir(directory, dry_run) @@ -556,10 +743,7 @@ def search_cmake_cache(build_profile): if not current_cmake_generator: # Search for available generators - cmake_generator_map = {"ninja": "Ninja", - "make": "Unix Makefiles", - "xcodebuild": "Xcode" - } + cmake_generator_map = {"ninja": "Ninja", "make": "Unix Makefiles", "xcodebuild": "Xcode"} available_generators = [] for generator in cmake_generator_map.keys(): if shutil.which(generator): @@ -599,7 +783,9 @@ def project_configured(current_cmake_cache_folder): return True -def configure_cmake(cmake, args, current_cmake_cache_folder, current_cmake_generator, output, dry_run=False): +def configure_cmake( + cmake, args, current_cmake_cache_folder, current_cmake_generator, output, dry_run=False +): # Aggregate all flags to configure CMake cmake_args = [cmake, "-S", ns3_path] @@ -623,6 +809,7 @@ def configure_cmake(cmake, args, current_cmake_cache_folder, current_cmake_gener # CMake with the respective installation if args.enable_python_bindings is True: import sysconfig + cmake_args.append(f"-DPython3_LIBRARY_DIRS={sysconfig.get_config_var('LIBDIR')}") cmake_args.append(f"-DPython3_INCLUDE_DIRS={sysconfig.get_config_var('INCLUDEPY')}") cmake_args.append(f"-DPython3_EXECUTABLE={sys.executable}") @@ -636,54 +823,66 @@ def configure_cmake(cmake, args, current_cmake_cache_folder, current_cmake_gener # Build type if args.build_profile is not None: args.build_profile = args.build_profile.lower() - if args.build_profile not in ["debug", "default", "release", "optimized", "minsizerel", "relwithdebinfo"]: + if args.build_profile not in [ + "debug", + "default", + "release", + "optimized", + "minsizerel", + "relwithdebinfo", + ]: raise Exception("Unknown build type") else: if args.build_profile == "debug": cmake_args.extend( - "-DCMAKE_BUILD_TYPE=debug -DNS3_ASSERT=ON -DNS3_LOG=ON -DNS3_WARNINGS_AS_ERRORS=ON".split()) + "-DCMAKE_BUILD_TYPE=debug -DNS3_ASSERT=ON -DNS3_LOG=ON -DNS3_WARNINGS_AS_ERRORS=ON".split() + ) elif args.build_profile in ["default", "relwithdebinfo"]: cmake_args.extend( - "-DCMAKE_BUILD_TYPE=default -DNS3_ASSERT=ON -DNS3_LOG=ON -DNS3_WARNINGS_AS_ERRORS=OFF".split()) + "-DCMAKE_BUILD_TYPE=default -DNS3_ASSERT=ON -DNS3_LOG=ON -DNS3_WARNINGS_AS_ERRORS=OFF".split() + ) elif args.build_profile in ["release", "optimized"]: cmake_args.extend( - "-DCMAKE_BUILD_TYPE=release -DNS3_ASSERT=OFF -DNS3_LOG=OFF -DNS3_WARNINGS_AS_ERRORS=OFF".split()) + "-DCMAKE_BUILD_TYPE=release -DNS3_ASSERT=OFF -DNS3_LOG=OFF -DNS3_WARNINGS_AS_ERRORS=OFF".split() + ) else: cmake_args.extend( "-DCMAKE_BUILD_TYPE=minsizerel -DNS3_ASSERT=OFF -DNS3_LOG=OFF -DNS3_WARNINGS_AS_ERRORS=OFF".split() ) - cmake_args.append("-DNS3_NATIVE_OPTIMIZATIONS=%s" % on_off((args.build_profile == "optimized"))) + cmake_args.append( + "-DNS3_NATIVE_OPTIMIZATIONS=%s" % on_off((args.build_profile == "optimized")) + ) - options = (("ASSERT", "asserts"), - ("CLANG_TIDY", "clang_tidy"), - ("COVERAGE", "gcov"), - ("DES_METRICS", "des_metrics"), - ("DPDK", "dpdk"), - ("EIGEN", "eigen"), - ("ENABLE_BUILD_VERSION", "build_version"), - ("ENABLE_SUDO", "sudo"), - ("EXAMPLES", "examples"), - ("GSL", "gsl"), - ("GTK3", "gtk"), - ("LOG", "logs"), - ("MONOLIB", "monolib"), - ("MPI", "mpi"), - ("NINJA_TRACING", "ninja_tracing"), - ("PRECOMPILE_HEADERS", "precompiled_headers"), - ("PYTHON_BINDINGS", "python_bindings"), - ("SANITIZE", "sanitizers"), - ("STATIC", "static"), - ("TESTS", "tests"), - ("VERBOSE", "verbose"), - ("WARNINGS", "warnings"), - ("WARNINGS_AS_ERRORS", "werror"), - ) - for (cmake_flag, option_name) in options: + options = ( + ("ASSERT", "asserts"), + ("CLANG_TIDY", "clang_tidy"), + ("COVERAGE", "gcov"), + ("DES_METRICS", "des_metrics"), + ("DPDK", "dpdk"), + ("EIGEN", "eigen"), + ("ENABLE_BUILD_VERSION", "build_version"), + ("ENABLE_SUDO", "sudo"), + ("EXAMPLES", "examples"), + ("GSL", "gsl"), + ("GTK3", "gtk"), + ("LOG", "logs"), + ("MONOLIB", "monolib"), + ("MPI", "mpi"), + ("NINJA_TRACING", "ninja_tracing"), + ("PRECOMPILE_HEADERS", "precompiled_headers"), + ("PYTHON_BINDINGS", "python_bindings"), + ("SANITIZE", "sanitizers"), + ("STATIC", "static"), + ("TESTS", "tests"), + ("VERBOSE", "verbose"), + ("WARNINGS", "warnings"), + ("WARNINGS_AS_ERRORS", "werror"), + ) + for cmake_flag, option_name in options: arg = on_off_condition(args, cmake_flag, option_name) if arg: is_on = "=ON" in arg - reverse = arg.replace("=ON" if is_on else "=OFF", - "=OFF" if is_on else "=ON") + reverse = arg.replace("=ON" if is_on else "=OFF", "=OFF" if is_on else "=ON") if reverse in cmake_args: cmake_args.remove(reverse) cmake_args.append(arg) @@ -715,17 +914,21 @@ def configure_cmake(cmake, args, current_cmake_cache_folder, current_cmake_gener cmake_args.append("-DNS3_DISABLED_MODULES=%s" % args.disable_modules) if args.filter_module_examples_and_tests is not None: - cmake_args.append("-DNS3_FILTER_MODULE_EXAMPLES_AND_TESTS=%s" % args.filter_module_examples_and_tests) + cmake_args.append( + "-DNS3_FILTER_MODULE_EXAMPLES_AND_TESTS=%s" % args.filter_module_examples_and_tests + ) # Try to set specified generator (will probably fail if there is an old cache) if args.G: cmake_args.extend(["-G", args.G]) if args.trace_cmake_perf: - cmake_performance_trace = os.path.join(os.path.relpath(ns3_path, ns3_path), - "cmake_performance_trace.log") - cmake_args.extend(["--profiling-format=google-trace", - "--profiling-output=" + cmake_performance_trace]) + cmake_performance_trace = os.path.join( + os.path.relpath(ns3_path, ns3_path), "cmake_performance_trace.log" + ) + cmake_args.extend( + ["--profiling-format=google-trace", "--profiling-output=" + cmake_performance_trace] + ) # Enable warnings for uninitialized variable usage cmake_args.append("--warn-uninitialized") @@ -776,11 +979,13 @@ def get_program_shortcuts(build_profile, ns3_version): temp_path = program.replace(out_dir, "") # Sometimes Windows uses \\, sometimes / # quite the mess - temp_path = temp_path.split(os.sep if os.sep in temp_path else '/') + temp_path = temp_path.split(os.sep if os.sep in temp_path else "/") temp_path.pop(0) # remove first path separator # Remove version prefix and build type suffix from shortcuts (or keep them too?) - temp_path[-1] = temp_path[-1].replace("-" + build_profile, "").replace("ns" + ns3_version + "-", "") + temp_path[-1] = ( + temp_path[-1].replace("-" + build_profile, "").replace("ns" + ns3_version + "-", "") + ) # Deal with scratch subdirs if "scratch" in temp_path and len(temp_path) > 3: @@ -831,7 +1036,7 @@ def get_program_shortcuts(build_profile, ns3_version): # Filter collisions collisions = list(filter(lambda x: x if len(x[1]) > 1 else None, longest_shortcut_map.items())) - for (colliding_shortcut, longest_shortcuts) in collisions: + for colliding_shortcut, longest_shortcuts in collisions: ns3_program_map[colliding_shortcut] = longest_shortcuts if programs_dict["ns3_runnable_scripts"]: @@ -861,18 +1066,23 @@ def cmake_check_version(): cmake = cmake3 if cmake3 else shutil.which("cmake") if not cmake: print( - f"Error: CMake not found; please install version {minimum_cmake_version} or greater, or modify {path_variable}") + f"Error: CMake not found; please install version {minimum_cmake_version} or greater, or modify {path_variable}" + ) exit(1) cmake = cmake.replace(".EXE", "").replace(".exe", "") # Trim cmake executable extension cmake_output = subprocess.check_output([cmake, "--version"]).decode("utf-8") version = re.findall("version (.*)", cmake_output)[0] if parse_version(version) < parse_version(minimum_cmake_version): - print(f"Error: CMake found at {cmake} but version {version} is older than {minimum_cmake_version}") + print( + f"Error: CMake found at {cmake} but version {version} is older than {minimum_cmake_version}" + ) exit(1) return cmake, version -def cmake_build(current_cmake_cache_folder, output, jobs, target=None, dry_run=False, build_verbose=False): +def cmake_build( + current_cmake_cache_folder, output, jobs, target=None, dry_run=False, build_verbose=False +): cmake, version = cmake_check_version() cmake_args = [cmake, "--build", current_cmake_cache_folder] @@ -885,8 +1095,7 @@ def cmake_build(current_cmake_cache_folder, output, jobs, target=None, dry_run=F print_and_buffer(" ".join(cmake_args)) if not dry_run: # Assume quiet is not enabled, and print things normally - kwargs = {"stdout": None, - "stderr": None} + kwargs = {"stdout": None, "stderr": None} proc_env = os.environ.copy() if build_verbose: @@ -900,10 +1109,11 @@ def cmake_build(current_cmake_cache_folder, output, jobs, target=None, dry_run=F kwargs["stdout"] = subprocess.PIPE kwargs["stderr"] = subprocess.PIPE - ret = subprocess.run(cmake_args, - env=proc_env, - **kwargs, - ) + ret = subprocess.run( + cmake_args, + env=proc_env, + **kwargs, + ) # Print errors in case compilation fails and output != None (quiet) if ret.returncode != 0 and output is not None: @@ -917,18 +1127,24 @@ def cmake_build(current_cmake_cache_folder, output, jobs, target=None, dry_run=F def extract_cmakecache_settings(current_cmake_cache_folder): try: - with open(current_cmake_cache_folder + os.sep + "CMakeCache.txt", "r", encoding="utf-8") as f: + with open( + current_cmake_cache_folder + os.sep + "CMakeCache.txt", "r", encoding="utf-8" + ) as f: contents = f.read() except FileNotFoundError as e: raise e current_settings = re.findall("(NS3_.*):.*=(.*)", contents) # extract NS3 specific settings - current_settings.extend(re.findall("(CMAKE_BUILD_TYPE):.*=(.*)", contents)) # extract build type + current_settings.extend( + re.findall("(CMAKE_BUILD_TYPE):.*=(.*)", contents) + ) # extract build type current_settings.extend(re.findall("(CMAKE_GENERATOR):.*=(.*)", contents)) # extract generator current_settings.extend(re.findall("(CMAKE_CXX_COMPILER):.*=(.*)", contents)) # C++ compiler current_settings.extend(re.findall("(CMAKE_CXX_FLAGS):.*=(.*)", contents)) # C++ flags current_settings.extend(re.findall("(CMAKE_C_COMPILER):.*=(.*)", contents)) # C compiler current_settings.extend(re.findall("(CMAKE_C_FLAGS):.*=(.*)", contents)) # C flags - current_settings.extend(re.findall("(CMAKE_INSTALL_PREFIX):.*=(.*)", contents)) # installation directory + current_settings.extend( + re.findall("(CMAKE_INSTALL_PREFIX):.*=(.*)", contents) + ) # installation directory # Transform list into dictionary settings_dictionary = dict(current_settings) @@ -940,6 +1156,7 @@ def extract_cmakecache_settings(current_cmake_cache_folder): def reconfigure_cmake_to_force_refresh(cmake, current_cmake_cache_folder, output, dry_run=False): import json + settings_bak_file = "settings.json" # Extract settings or recover from the backup @@ -968,11 +1185,14 @@ def reconfigure_cmake_to_force_refresh(cmake, current_cmake_cache_folder, output cmake_args.append("..") # Echo out the configure command - print_and_buffer("cd %s; %s ; cd %s" % (os.path.relpath(ns3_path, current_cmake_cache_folder), - " ".join(cmake_args), - os.path.relpath(current_cmake_cache_folder, ns3_path) - ) - ) + print_and_buffer( + "cd %s; %s ; cd %s" + % ( + os.path.relpath(ns3_path, current_cmake_cache_folder), + " ".join(cmake_args), + os.path.relpath(current_cmake_cache_folder, ns3_path), + ) + ) # Call cmake if not dry_run: @@ -982,8 +1202,10 @@ def reconfigure_cmake_to_force_refresh(cmake, current_cmake_cache_folder, output if ret.returncode == 0: os.remove(settings_bak_file) else: - raise Exception("Reconfiguring CMake to force refresh failed. " - "A backup of the settings was saved in %s" % settings_bak_file) + raise Exception( + "Reconfiguring CMake to force refresh failed. " + "A backup of the settings was saved in %s" % settings_bak_file + ) update_scratches_list(current_cmake_cache_folder) @@ -996,7 +1218,9 @@ def get_target_to_build(program_path, ns3_version, build_profile): program_name = "" try: - program_name = "".join(*re.findall("(.*)ns%s-(.*)%s" % (ns3_version, build_profile_suffix), program_path)) + program_name = "".join( + *re.findall("(.*)ns%s-(.*)%s" % (ns3_version, build_profile_suffix), program_path) + ) except TypeError: print("Target to build does not exist: %s" % program_path) exit(1) @@ -1010,8 +1234,9 @@ def get_target_to_build(program_path, ns3_version, build_profile): return program_name.split("/")[-1] -def configuration_step(current_cmake_cache_folder, current_cmake_generator, args, - output, dry_run=False): +def configuration_step( + current_cmake_cache_folder, current_cmake_generator, args, output, dry_run=False +): # Search for the CMake binary cmake, _ = cmake_check_version() @@ -1022,56 +1247,56 @@ def configuration_step(current_cmake_cache_folder, current_cmake_generator, args exit(0) # Call cmake to configure/reconfigure/refresh the project - configure_cmake(cmake, - args, - current_cmake_cache_folder, - current_cmake_generator, - output, - dry_run - ) + configure_cmake( + cmake, args, current_cmake_cache_folder, current_cmake_generator, output, dry_run + ) # If manually configuring, we end the script earlier exit(0) -def build_step(args, - build_and_run, - target_to_run, - current_cmake_cache_folder, - ns3_modules, - ns3_version, - build_profile, - output): +def build_step( + args, + build_and_run, + target_to_run, + current_cmake_cache_folder, + ns3_modules, + ns3_version, + build_profile, + output, +): # There is one scenario where we build everything: ./ns3 build if "build" in args and len(args.build) == 0: - cmake_build(current_cmake_cache_folder, - jobs=args.jobs, - output=output, - dry_run=args.dry_run, - build_verbose=args.verbose - ) + cmake_build( + current_cmake_cache_folder, + jobs=args.jobs, + output=output, + dry_run=args.dry_run, + build_verbose=args.verbose, + ) # If we are building specific targets, we build them one by one if "build" in args: - non_executable_targets = ["assemble-introspected-command-line", - "check-version", - "cmake-format", - "cmake-format-check", - "coverage_gcc", - "docs", - "doxygen", - "doxygen-no-build", - "installation", - "sphinx", - "manual", - "models", - "ninjaTrace", - "timeTraceReport", - "tutorial", - "contributing", - "install", - "uninstall", - ] + non_executable_targets = [ + "assemble-introspected-command-line", + "check-version", + "cmake-format", + "cmake-format-check", + "coverage_gcc", + "docs", + "doxygen", + "doxygen-no-build", + "installation", + "sphinx", + "manual", + "models", + "ninjaTrace", + "timeTraceReport", + "tutorial", + "contributing", + "install", + "uninstall", + ] # Build targets in the list for target in args.build: if target in ns3_modules: @@ -1092,22 +1317,25 @@ def build_step(args, global run_verbose run_verbose = False # Do not print the equivalent cmake command - cmake_build(current_cmake_cache_folder, - jobs=args.jobs, - target=target, - output=output, - dry_run=args.dry_run, - build_verbose=args.verbose) + cmake_build( + current_cmake_cache_folder, + jobs=args.jobs, + target=target, + output=output, + dry_run=args.dry_run, + build_verbose=args.verbose, + ) # The remaining case is when we want to build something to run if build_and_run: - cmake_build(current_cmake_cache_folder, - jobs=args.jobs, - target=get_target_to_build(target_to_run, ns3_version, build_profile), - output=output, - dry_run=args.dry_run, - build_verbose=args.verbose - ) + cmake_build( + current_cmake_cache_folder, + jobs=args.jobs, + target=get_target_to_build(target_to_run, ns3_version, build_profile), + output=output, + dry_run=args.dry_run, + build_verbose=args.verbose, + ) def check_program_installed(program_name: str) -> str: @@ -1120,6 +1348,7 @@ def check_program_installed(program_name: str) -> str: def check_module_installed(module_name: str): import importlib + try: importlib.import_module(module_name) except ImportError: @@ -1130,14 +1359,15 @@ def check_module_installed(module_name: str): def run_step(args, target_to_run, target_args): libdir = "%s/lib" % out_dir - custom_env = {"PATH": libdir, - "PYTHONPATH": "%s/bindings/python" % out_dir, - } + custom_env = { + "PATH": libdir, + "PYTHONPATH": "%s/bindings/python" % out_dir, + } if sys.platform != "win32": custom_env["LD_LIBRARY_PATH"] = libdir proc_env = os.environ.copy() - for (key, value) in custom_env.items(): + for key, value in custom_env.items(): if key in proc_env: proc_env[key] += path_sep + value else: @@ -1160,7 +1390,14 @@ def run_step(args, target_to_run, target_args): # running with memray? if args.memray: check_module_installed("memray") - target_args = ["-m", "memray", "run", "-o", "memray.output", "--native"] + target_args + target_args = [ + "-m", + "memray", + "run", + "-o", + "memray.output", + "--native", + ] + target_args # running from ns-3-dev (ns3_path) or cwd if args.cwd: @@ -1173,7 +1410,8 @@ def run_step(args, target_to_run, target_args): # running valgrind? if args.valgrind: debugging_software.extend( - [check_program_installed("valgrind"), "--leak-check=full", "--show-leak-kinds=all"]) + [check_program_installed("valgrind"), "--leak-check=full", "--show-leak-kinds=all"] + ) # running gdb? if args.gdb: @@ -1188,11 +1426,16 @@ def run_step(args, target_to_run, target_args): # running with perf? if args.perf: - debugging_software.extend([ - check_program_installed("perf"), - "record", "--call-graph", "dwarf", "-e", - "cache-misses,branch-misses,cpu-cycles,stalled-cycles-frontend,stalled-cycles-backend" - ]) + debugging_software.extend( + [ + check_program_installed("perf"), + "record", + "--call-graph", + "dwarf", + "-e", + "cache-misses,branch-misses,cpu-cycles,stalled-cycles-frontend,stalled-cycles-backend", + ] + ) # running with the visualizer? if args.visualize: @@ -1215,24 +1458,31 @@ def run_step(args, target_to_run, target_args): if run_verbose or args.dry_run: exported_variables = "export " - for (variable, value) in custom_env.items(): + for variable, value in custom_env.items(): if variable == "PATH": value = path_variable + path_sep + libdir exported_variables += "%s=%s " % (variable, value) - print_and_buffer("cd %s; %s; %s" % (os.path.relpath(ns3_path, working_dir), - exported_variables, - " ".join(program_arguments) - ) - ) + print_and_buffer( + "cd %s; %s; %s" + % ( + os.path.relpath(ns3_path, working_dir), + exported_variables, + " ".join(program_arguments), + ) + ) if not args.dry_run: try: - subprocess.run(program_arguments, env=proc_env, cwd=working_dir, shell=use_shell, check=True) + subprocess.run( + program_arguments, env=proc_env, cwd=working_dir, shell=use_shell, check=True + ) except subprocess.CalledProcessError as e: # Replace list of arguments with a single string e.cmd = " ".join(e.cmd) # Replace full path to binary to relative path - e.cmd = e.cmd.replace(os.path.abspath(target_to_run), os.path.relpath(target_to_run, ns3_path)) + e.cmd = e.cmd.replace( + os.path.abspath(target_to_run), os.path.relpath(target_to_run, ns3_path) + ) # Print error message and forward the return code print(e) exit(e.returncode) @@ -1246,7 +1496,7 @@ def run_step(args, target_to_run, target_args): def non_ambiguous_program_target_list(programs: dict) -> list: # Assembles a dictionary of all the possible shortcuts a program have list_of_shortcuts = {} - for (shortcut, possible_programs) in programs.items(): + for shortcut, possible_programs in programs.items(): if len(possible_programs) == 1: if possible_programs[0] not in list_of_shortcuts: list_of_shortcuts[possible_programs[0]] = [shortcut] @@ -1296,11 +1546,13 @@ def print_targets_list(ns3_modules: list, ns3_programs: dict) -> None: output += large_item + "\n" return output - print("""Buildable targets:{buildables}\n\nRunnable/Buildable targets:{runnables} - """.format(buildables=list_to_table(sorted(ns3_modules)), - runnables=list_to_table(non_ambiguous_program_target_list(ns3_programs)) - ) - ) + print( + """Buildable targets:{buildables}\n\nRunnable/Buildable targets:{runnables} + """.format( + buildables=list_to_table(sorted(ns3_modules)), + runnables=list_to_table(non_ambiguous_program_target_list(ns3_programs)), + ) + ) return @@ -1318,16 +1570,26 @@ def show_build_version(build_version_string, exit_early=True): if build_version_string is None: project_not_configured() - if build_version_string == '' and shutil.which("git") and os.path.exists(append_to_ns3_path(".git")): + if ( + build_version_string == "" + and shutil.which("git") + and os.path.exists(append_to_ns3_path(".git")) + ): try: - build_version_string = subprocess.check_output(["git", "describe", "--dirty"], cwd=ns3_path).decode() - build_version_string += ("Reconfigure with './ns3 configure --enable-build-version' " - "to bake the version into the libraries.") + build_version_string = subprocess.check_output( + ["git", "describe", "--dirty"], cwd=ns3_path + ).decode() + build_version_string += ( + "Reconfigure with './ns3 configure --enable-build-version' " + "to bake the version into the libraries." + ) except subprocess.CalledProcessError: pass - if build_version_string == '': - print("Build version feature disabled. Reconfigure ns-3 with ./ns3 configure --enable-build-version") + if build_version_string == "": + print( + "Build version feature disabled. Reconfigure ns-3 with ./ns3 configure --enable-build-version" + ) else: print("ns-3 version: %s" % build_version_string) @@ -1338,18 +1600,18 @@ def show_build_version(build_version_string, exit_early=True): # Debugging this with PyCharm is a no no. It refuses to work hanging indefinitely def sudo_command(command: list, password: str): # Run command and feed the sudo password - proc = subprocess.Popen(['sudo', '-S', *command], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE - ).communicate(input=password.encode() + b'\n') + proc = subprocess.Popen( + ["sudo", "-S", *command], + stdin=subprocess.PIPE, + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + ).communicate(input=password.encode() + b"\n") stdout, stderr = proc[0].decode(), proc[1].decode() # Clean sudo password after each command - subprocess.Popen(["sudo", "-k"], - stdin=subprocess.PIPE, - stdout=subprocess.PIPE, - stderr=subprocess.PIPE).communicate() + subprocess.Popen( + ["sudo", "-k"], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE + ).communicate() # Check if the password is wrong if "try again" in stderr: @@ -1374,9 +1636,11 @@ def sudo_step(args, target_to_run, configure_post_build: set): if not args.dry_run: if password is None: from getpass import getpass + password = getpass(prompt="Sudo password:") import stat + for target in targets_to_sudo: # Check if the file was already built if not os.path.exists(target): @@ -1409,7 +1673,9 @@ def refuse_run_as_root(): # Check if the user is root and refuse to run username = os.getenv("USER", "") if username == "root": - raise Exception("Refusing to run as root. --enable-sudo will request your password when needed") + raise Exception( + "Refusing to run as root. --enable-sudo will request your password when needed" + ) def main(): @@ -1459,9 +1725,9 @@ def main(): # Installation and uninstallation options become cmake targets if args.install: - args.build = ['install'] + args.build = ["install"] if args.uninstall: - args.build = ['uninstall'] + args.build = ["uninstall"] # Get build profile and other settings build_info, ns3_modules = check_lock_data(out_dir) @@ -1473,10 +1739,14 @@ def main(): # Docs subparser options become cmake targets if args.docs: args.build = [args.docs] if args.docs != "all" else ["sphinx", "doxygen"] - if "doxygen" in args.build and (not build_info["ENABLE_EXAMPLES"] or not build_info["ENABLE_TESTS"]): - print('The "./ns3 docs doxygen" and "./ns3 docs all" commands,\n' - 'requires examples and tests to generate introspected documentation.\n' - 'Try "./ns3 docs doxygen-no-build" or enable examples and tests.') + if "doxygen" in args.build and ( + not build_info["ENABLE_EXAMPLES"] or not build_info["ENABLE_TESTS"] + ): + print( + 'The "./ns3 docs doxygen" and "./ns3 docs all" commands,\n' + "requires examples and tests to generate introspected documentation.\n" + 'Try "./ns3 docs doxygen-no-build" or enable examples and tests.' + ) exit(1) if args.show == "profile": @@ -1505,7 +1775,7 @@ def main(): if len(target_to_run) > 0: # While testing a weird case appeared where the target to run is between quotes, # so we remove in case they exist - if target_to_run[0] in ["\"", "'"] and target_to_run[-1] in ["\"", "'"]: + if target_to_run[0] in ['"', "'"] and target_to_run[-1] in ['"', "'"]: target_to_run = target_to_run[1:-1] target_to_run = target_to_run.split() target_to_run, target_args = target_to_run[0], target_to_run[1:] @@ -1523,22 +1793,24 @@ def main(): # Check for changes in scratch sources and trigger a reconfiguration if sources changed if current_cmake_cache_folder: - current_scratch_sources = glob.glob(append_to_ns3_path("scratch", "**", "*.cc"), - recursive=True) + current_scratch_sources = glob.glob( + append_to_ns3_path("scratch", "**", "*.cc"), recursive=True + ) scratches_file = os.path.join(current_cmake_cache_folder, "ns3scratches") if os.path.exists(scratches_file): with open(scratches_file, "r") as f: - previous_scratches_sources = f.read().split('\n') + previous_scratches_sources = f.read().split("\n") if previous_scratches_sources != current_scratch_sources: refresh_cmake(current_cmake_cache_folder, output) if args.configure: - configuration_step(current_cmake_cache_folder, - current_cmake_generator, - args, - output, - args.dry_run, - ) + configuration_step( + current_cmake_cache_folder, + current_cmake_generator, + args, + output, + args.dry_run, + ) if not project_configured(current_cmake_cache_folder): project_not_configured() @@ -1562,14 +1834,19 @@ def main(): check_config(current_cmake_cache_folder) print("---- Summary of buildable targets:") print("Buildable targets: %4.d" % len(ns3_modules)) - print("Runnable/Buildable targets: %4.d" % len(non_ambiguous_program_target_list(ns3_programs))) + print( + "Runnable/Buildable targets: %4.d" + % len(non_ambiguous_program_target_list(ns3_programs)) + ) exit(0) def check_ambiguous_target(target_type, target_to_check, programs): if len(programs[target_to_check]) > 1: - print('%s target "%s" is ambiguous. Try one of these: "%s"' - % (target_type, target_to_check, '", "'.join(programs[target_to_check]))) + print( + '%s target "%s" is ambiguous. Try one of these: "%s"' + % (target_type, target_to_check, '", "'.join(programs[target_to_check])) + ) exit(1) return programs[target_to_check][0] @@ -1586,33 +1863,46 @@ def main(): if "build" in args: complete_targets = [] for target in args.build: - build_target = check_ambiguous_target("Build", target, ns3_programs) if target in ns3_programs else target + build_target = ( + check_ambiguous_target("Build", target, ns3_programs) + if target in ns3_programs + else target + ) complete_targets.append(build_target) args.build = complete_targets del complete_targets if not run_only: - build_step(args, - build_and_run, - target_to_run, - current_cmake_cache_folder, - ns3_modules, - ns3_version, - build_profile, - output - ) + build_step( + args, + build_and_run, + target_to_run, + current_cmake_cache_folder, + ns3_modules, + ns3_version, + build_profile, + output, + ) if not args.shell and target_to_run and ".py" not in target_to_run: if sys.platform == "win32": target_to_run += ".exe" # If we're only trying to run the target, we need to check if it actually exists first - if (run_only or build_and_run) and ".py" not in target_to_run and not os.path.exists(target_to_run): + if ( + (run_only or build_and_run) + and ".py" not in target_to_run + and not os.path.exists(target_to_run) + ): raise Exception("Executable has not been built yet") # Setup program as sudo if enable_sudo or (args.run and args.enable_sudo): - sudo_step(args, target_to_run, set(map(lambda x: x[0], ns3_programs.values())) if enable_sudo else set()) + sudo_step( + args, + target_to_run, + set(map(lambda x: x[0], ns3_programs.values())) if enable_sudo else set(), + ) # Finally, we try to run it if args.shell or run_only or build_and_run: diff --git a/setup.py b/setup.py index 8aa256955..7d39253bd 100644 --- a/setup.py +++ b/setup.py @@ -1,14 +1,15 @@ -import cmake_build_extension -import setuptools import sys import sysconfig +import cmake_build_extension +import setuptools + setuptools.setup( cmdclass=dict(build_ext=cmake_build_extension.BuildExtension), - packages=['ns', 'visualizer'], + packages=["ns", "visualizer"], package_dir={ - 'ns': './build-support/pip-wheel/ns', - 'visualizer': './build-support/pip-wheel/visualizer' + "ns": "./build-support/pip-wheel/ns", + "visualizer": "./build-support/pip-wheel/visualizer", }, ext_modules=[ cmake_build_extension.CMakeExtension( @@ -28,8 +29,8 @@ setuptools.setup( # https://catherineh.github.io/programming/2021/11/16/python-binary-distributions-whls-with-c17-cmake-auditwheel-and-manylinux f"-DPython3_LIBRARY_DIRS={sysconfig.get_config_var('LIBDIR')}", f"-DPython3_INCLUDE_DIRS={sysconfig.get_config_var('INCLUDEPY')}", - f"-DPython3_EXECUTABLE={sys.executable}" - ] + f"-DPython3_EXECUTABLE={sys.executable}", + ], ), ], ) diff --git a/src/antenna/doc/source/conf.py b/src/antenna/doc/source/conf.py index ad2f0c3ec..da78e5a8e 100644 --- a/src/antenna/doc/source/conf.py +++ b/src/antenna/doc/source/conf.py @@ -11,205 +11,209 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.imgmath'] +extensions = ["sphinx.ext.imgmath"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = u'LENA' -copyright = u'2011-2012, CTTC' +project = "LENA" +copyright = "2011-2012, CTTC" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = 'ns-3-dev' +version = "ns-3-dev" # The full version, including alpha/beta/rc tags. -release = 'ns-3-dev' +release = "ns-3-dev" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = "default" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ['_static'] +# html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -#htmlhelp_basename = 'ns-3doc' +# htmlhelp_basename = 'ns-3doc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('antenna', 'antenna.tex', u'Antenna Module Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), + ( + "antenna", + "antenna.tex", + "Antenna Module Documentation", + "Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)", + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'ns-3-model-library', u'ns-3 Model Library', - [u'ns-3 project'], 1) -] +man_pages = [("index", "ns-3-model-library", "ns-3 Model Library", ["ns-3 project"], 1)] diff --git a/src/bridge/examples/csma-bridge.py b/src/bridge/examples/csma-bridge.py index c0002cb3c..73294e672 100644 --- a/src/bridge/examples/csma-bridge.py +++ b/src/bridge/examples/csma-bridge.py @@ -44,7 +44,6 @@ except ModuleNotFoundError: def main(argv): - # # Allow the user to override any of the defaults and the above Bind() at # run-time, via command-line arguments @@ -55,14 +54,14 @@ def main(argv): # # Explicitly create the nodes required by the topology(shown above). # - #print "Create nodes." + # print "Create nodes." terminals = ns.network.NodeContainer() terminals.Create(4) csmaSwitch = ns.network.NodeContainer() csmaSwitch.Create(1) - #print "Build Topology" + # print "Build Topology" csma = ns.csma.CsmaHelper() csma.SetChannelAttribute("DataRate", ns.network.DataRateValue(ns.network.DataRate(5000000))) csma.SetChannelAttribute("Delay", ns.core.TimeValue(ns.core.MilliSeconds(2))) @@ -73,7 +72,9 @@ def main(argv): switchDevices = ns.network.NetDeviceContainer() for i in range(4): - link = csma.Install(ns.network.NodeContainer(ns.network.NodeContainer(terminals.Get(i)), csmaSwitch)) + link = csma.Install( + ns.network.NodeContainer(ns.network.NodeContainer(terminals.Get(i)), csmaSwitch) + ) terminalDevices.Add(link.Get(0)) switchDevices.Add(link.Get(1)) @@ -91,7 +92,7 @@ def main(argv): # We've got the "hardware" in place. Now we need to add IP addresses. # - #print "Assign IP Addresses." + # print "Assign IP Addresses." ipv4 = ns.internet.Ipv4AddressHelper() ipv4.SetBase(ns.network.Ipv4Address("10.1.1.0"), ns.network.Ipv4Mask("255.255.255.0")) ipv4.Assign(terminalDevices) @@ -99,12 +100,12 @@ def main(argv): # # Create an OnOff application to send UDP datagrams from node zero to node 1. # - #print "Create Applications." - port = 9 # Discard port(RFC 863) + # print "Create Applications." + port = 9 # Discard port(RFC 863) inet_sock_address = ns.network.InetSocketAddress(ns.network.Ipv4Address("10.1.1.2"), port) onoff = ns.applications.OnOffHelper("ns3::UdpSocketFactory", inet_sock_address.ConvertTo()) - onoff.SetConstantRate (ns.network.DataRate ("500kb/s")) + onoff.SetConstantRate(ns.network.DataRate("500kb/s")) app = onoff.Install(ns.network.NodeContainer(terminals.Get(0))) # Start the application @@ -121,8 +122,7 @@ def main(argv): # Create a similar flow from n3 to n0, starting at time 1.1 seconds # inet_address = ns.network.InetSocketAddress(ns.network.Ipv4Address("10.1.1.1"), port) - onoff.SetAttribute("Remote", - ns.network.AddressValue(inet_address.ConvertTo())) + onoff.SetAttribute("Remote", ns.network.AddressValue(inet_address.ConvertTo())) app = onoff.Install(ns.network.NodeContainer(terminals.Get(3))) app.Start(ns.core.Seconds(1.1)) app.Stop(ns.core.Seconds(10.0)) @@ -134,9 +134,9 @@ def main(argv): # Configure tracing of all enqueue, dequeue, and NetDevice receive events. # Trace output will be sent to the file "csma-bridge.tr" # - #print "Configure Tracing." - #ascii = ns.network.AsciiTraceHelper(); - #csma.EnableAsciiAll(ascii.CreateFileStream ("csma-bridge.tr")); + # print "Configure Tracing." + # ascii = ns.network.AsciiTraceHelper(); + # csma.EnableAsciiAll(ascii.CreateFileStream ("csma-bridge.tr")); # # Also configure some tcpdump traces; each interface will be traced. @@ -150,14 +150,13 @@ def main(argv): # # Now, do the actual simulation. # - #print "Run Simulation." + # print "Run Simulation." ns.core.Simulator.Run() ns.core.Simulator.Destroy() - #print "Done." + # print "Done." - -if __name__ == '__main__': +if __name__ == "__main__": import sys - main(sys.argv) + main(sys.argv) diff --git a/src/brite/examples/brite-generic-example.py b/src/brite/examples/brite-generic-example.py index c6f9c5262..d5647e30d 100644 --- a/src/brite/examples/brite-generic-example.py +++ b/src/brite/examples/brite-generic-example.py @@ -95,7 +95,7 @@ serverApps.Stop(ns.Seconds(5.0)) echoClient = ns.UdpEchoClientHelper(serverInterfaces.GetAddress(0).ConvertTo(), 9) echoClient.SetAttribute("MaxPackets", ns.UintegerValue(1)) -echoClient.SetAttribute("Interval", ns.TimeValue(ns.Seconds(1.))) +echoClient.SetAttribute("Interval", ns.TimeValue(ns.Seconds(1.0))) echoClient.SetAttribute("PacketSize", ns.UintegerValue(1024)) clientApps = echoClient.Install(client.Get(0)) diff --git a/src/buildings/doc/source/conf.py b/src/buildings/doc/source/conf.py index 3e9955680..f6ff4466d 100644 --- a/src/buildings/doc/source/conf.py +++ b/src/buildings/doc/source/conf.py @@ -11,206 +11,209 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.imgmath', - 'sphinxcontrib.seqdiag'] +extensions = ["sphinx.ext.imgmath", "sphinxcontrib.seqdiag"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'buildings' +master_doc = "buildings" # General information about the project. -project = u'LENA' -copyright = u'2011-2012, CTTC' +project = "LENA" +copyright = "2011-2012, CTTC" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = 'M2' +version = "M2" # The full version, including alpha/beta/rc tags. -release = 'M2' +release = "M2" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = "default" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ['_static'] +# html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -#htmlhelp_basename = 'ns-3doc' +# htmlhelp_basename = 'ns-3doc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('buildings', 'buildings.tex', u'Buildings Module Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), + ( + "buildings", + "buildings.tex", + "Buildings Module Documentation", + "Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)", + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True +# latex_domain_indices = True # -- Options for manual page output -------------------------------------------- # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'ns-3-model-library', u'ns-3 Model Library', - [u'ns-3 project'], 1) -] +man_pages = [("index", "ns-3-model-library", "ns-3 Model Library", ["ns-3 project"], 1)] diff --git a/src/click/examples/nsclick-simple-lan.py b/src/click/examples/nsclick-simple-lan.py index 83b5f40ab..58760374c 100644 --- a/src/click/examples/nsclick-simple-lan.py +++ b/src/click/examples/nsclick-simple-lan.py @@ -47,8 +47,9 @@ internet.Install(csmaNodes.Get(1)) # Install Click on node A clickinternet = ns.ClickInternetStackHelper() -clickinternet.SetClickFile(csmaNodes.Get(0), - clickConfigFolder + "/nsclick-lan-single-interface.click") +clickinternet.SetClickFile( + csmaNodes.Get(0), clickConfigFolder + "/nsclick-lan-single-interface.click" +) clickinternet.SetRoutingTableElement(csmaNodes.Get(0), "rt") clickinternet.Install(csmaNodes.Get(0)) diff --git a/src/click/test/examples-to-run.py b/src/click/test/examples-to-run.py index 342e58a9f..09d23ea39 100644 --- a/src/click/test/examples-to-run.py +++ b/src/click/test/examples-to-run.py @@ -9,8 +9,16 @@ cpp_examples = [ ("nsclick-simple-lan --clickConfigFolder=../../src/click/examples", "NSCLICK == True", "False"), ("nsclick-raw-wlan --clickConfigFolder=../../src/click/examples", "NSCLICK == True", "False"), - ("nsclick-udp-client-server-csma --clickConfigFolder=../../src/click/examples", "NSCLICK == True", "False"), - ("nsclick-udp-client-server-wifi --clickConfigFolder=../../src/click/examples", "NSCLICK == True", "False"), + ( + "nsclick-udp-client-server-csma --clickConfigFolder=../../src/click/examples", + "NSCLICK == True", + "False", + ), + ( + "nsclick-udp-client-server-wifi --clickConfigFolder=../../src/click/examples", + "NSCLICK == True", + "False", + ), ("nsclick-routing --clickConfigFolder=../../src/click/examples", "NSCLICK == True", "False"), ("nsclick-defines --clickConfigFolder=../../src/click/examples", "NSCLICK == True", "False"), ] diff --git a/src/core/examples/sample-rng-plot.py b/src/core/examples/sample-rng-plot.py index 5b800f934..32304b9c3 100644 --- a/src/core/examples/sample-rng-plot.py +++ b/src/core/examples/sample-rng-plot.py @@ -22,10 +22,12 @@ # This is adapted from Gustavo Carneiro's ns-3 tutorial -import numpy as np -import matplotlib.pyplot as plt -import sys import argparse +import sys + +import matplotlib.pyplot as plt +import numpy as np + ## Import ns-3 try: from ns import ns @@ -39,9 +41,7 @@ except ModuleNotFoundError: def main(): parser = argparse.ArgumentParser("sample-rng-plot") - parser.add_argument("--not-blocking", - action="store_true", - default=False) + parser.add_argument("--not-blocking", action="store_true", default=False) args = parser.parse_args(sys.argv[1:]) # mu, var = 100, 225 @@ -59,16 +59,16 @@ def main(): ## Make a probability density histogram density = 1 ## Plot color - facecolor = 'g' + facecolor = "g" ## Plot alpha value (transparency) alpha = 0.75 # We don't really need the plot results, we're just going to show it later. # n, bins, patches = plt.hist(x, 50, density=1, facecolor='g', alpha=0.75) - n, bins, patches = plt.hist(x, 50, density=True, facecolor='g', alpha=0.75) + n, bins, patches = plt.hist(x, 50, density=True, facecolor="g", alpha=0.75) - plt.title('ns-3 histogram') - plt.text(60, .025, r'$\mu=100,\ \sigma=15$') + plt.title("ns-3 histogram") + plt.text(60, 0.025, r"$\mu=100,\ \sigma=15$") plt.axis([40, 160, 0, 0.03]) plt.grid(True) plt.show(block=not args.not_blocking) diff --git a/src/core/examples/sample-simulator.py b/src/core/examples/sample-simulator.py index ac8ca55bd..b52330f91 100755 --- a/src/core/examples/sample-simulator.py +++ b/src/core/examples/sample-simulator.py @@ -34,17 +34,21 @@ except ModuleNotFoundError: " or your PYTHONPATH might not be properly configured" ) + ## Example function - triggered at a random time. ## \return None. def RandomFunction(): - print ("RandomFunction received event at", ns.core.Simulator.Now().GetSeconds(), "s") + print("RandomFunction received event at", ns.core.Simulator.Now().GetSeconds(), "s") + ## Example function - triggered if an event is canceled (should not be called). ## \return None. def CancelledEvent(): - print ("I should never be called... ") + print("I should never be called... ") -ns.cppyy.cppdef(""" + +ns.cppyy.cppdef( + """ #include "CPyCppyy/API.h" using namespace ns3; @@ -106,7 +110,8 @@ ns.cppyy.cppdef(""" { return MakeEvent(&CancelledFunctionCpp); } - """) + """ +) def main(argv): @@ -132,6 +137,8 @@ def main(argv): ns.core.Simulator.Destroy() -if __name__ == '__main__': + +if __name__ == "__main__": import sys + main(sys.argv) diff --git a/src/energy/examples/generic-battery-discharge-example.py b/src/energy/examples/generic-battery-discharge-example.py index ed18534d6..379c564d9 100644 --- a/src/energy/examples/generic-battery-discharge-example.py +++ b/src/energy/examples/generic-battery-discharge-example.py @@ -29,6 +29,7 @@ except ModuleNotFoundError: " or your PYTHONPATH might not be properly configured" ) + def main(argv): """The main function in this Battery discharge example @@ -39,7 +40,7 @@ def main(argv): ns.core.LogComponentEnable("GenericBatteryModel", ns.core.LOG_LEVEL_DEBUG) node = ns.network.Node() - batteryHelper = ns.energy.GenericBatteryModelHelper() + batteryHelper = ns.energy.GenericBatteryModelHelper() batteryModel = ns.CreateObject("GenericBatteryModel") devicesEnergyModel = ns.energy.SimpleDeviceEnergyModel() @@ -47,14 +48,14 @@ def main(argv): batteryModel.SetAttribute("MaxCapacity", ns.core.DoubleValue(7.0)) # Q batteryModel.SetAttribute("NominalVoltage", ns.core.DoubleValue(1.18)) # Vnom - batteryModel.SetAttribute("NominalCapacity", ns.core.DoubleValue(6.25)) # QNom + batteryModel.SetAttribute("NominalCapacity", ns.core.DoubleValue(6.25)) # QNom - batteryModel.SetAttribute("ExponentialVoltage", ns.core.DoubleValue(1.28)) # Vexp - batteryModel.SetAttribute("ExponentialCapacity", ns.core.DoubleValue(1.3)) # Qexp + batteryModel.SetAttribute("ExponentialVoltage", ns.core.DoubleValue(1.28)) # Vexp + batteryModel.SetAttribute("ExponentialCapacity", ns.core.DoubleValue(1.3)) # Qexp - batteryModel.SetAttribute("InternalResistance", ns.core.DoubleValue(0.0046)) # R - batteryModel.SetAttribute("TypicalDischargeCurrent", ns.core.DoubleValue(1.3)) # i typical - batteryModel.SetAttribute("CutoffVoltage", ns.core.DoubleValue(1.0)) # End of charge. + batteryModel.SetAttribute("InternalResistance", ns.core.DoubleValue(0.0046)) # R + batteryModel.SetAttribute("TypicalDischargeCurrent", ns.core.DoubleValue(1.3)) # i typical + batteryModel.SetAttribute("CutoffVoltage", ns.core.DoubleValue(1.0)) # End of charge. batteryModel.SetAttribute("BatteryType", ns.core.EnumValue(ns.NIMH_NICD)) # Battery type @@ -64,14 +65,12 @@ def main(argv): devicesEnergyModel.SetCurrentA(6.5) - ns.core.Simulator.Stop(ns.core.Seconds(3600)) ns.core.Simulator.Run() ns.core.Simulator.Destroy() - -if __name__ == '__main__': +if __name__ == "__main__": import sys - main(sys.argv) + main(sys.argv) diff --git a/src/flow-monitor/examples/flowmon-parse-results.py b/src/flow-monitor/examples/flowmon-parse-results.py index 00e4fb854..afe68aa09 100644 --- a/src/flow-monitor/examples/flowmon-parse-results.py +++ b/src/flow-monitor/examples/flowmon-parse-results.py @@ -1,18 +1,20 @@ from __future__ import division -import sys + import os +import sys + try: from xml.etree import cElementTree as ElementTree except ImportError: from xml.etree import ElementTree + def parse_time_ns(tm): - if tm.endswith('ns'): + if tm.endswith("ns"): return float(tm[:-2]) raise ValueError(tm) - ## FiveTuple class FiveTuple(object): ## class variables @@ -28,17 +30,19 @@ class FiveTuple(object): # destination port ## @var __slots_ # class variable list - __slots_ = ['sourceAddress', 'destinationAddress', 'protocol', 'sourcePort', 'destinationPort'] + __slots_ = ["sourceAddress", "destinationAddress", "protocol", "sourcePort", "destinationPort"] + def __init__(self, el): - '''! The initializer. + """! The initializer. @param self The object pointer. @param el The element. - ''' - self.sourceAddress = el.get('sourceAddress') - self.destinationAddress = el.get('destinationAddress') - self.sourcePort = int(el.get('sourcePort')) - self.destinationPort = int(el.get('destinationPort')) - self.protocol = int(el.get('protocol')) + """ + self.sourceAddress = el.get("sourceAddress") + self.destinationAddress = el.get("destinationAddress") + self.sourcePort = int(el.get("sourcePort")) + self.destinationPort = int(el.get("destinationPort")) + self.protocol = int(el.get("protocol")) + ## Histogram class Histogram(object): @@ -47,17 +51,21 @@ class Histogram(object): # histogram bins ## @var __slots_ # class variable list - __slots_ = 'bins', 'nbins', 'number_of_flows' + __slots_ = "bins", "nbins", "number_of_flows" + def __init__(self, el=None): - '''! The initializer. + """! The initializer. @param self The object pointer. @param el The element. - ''' + """ self.bins = [] if el is not None: - #self.nbins = int(el.get('nBins')) - for bin in el.findall('bin'): - self.bins.append( (float(bin.get("start")), float(bin.get("width")), int(bin.get("count"))) ) + # self.nbins = int(el.get('nBins')) + for bin in el.findall("bin"): + self.bins.append( + (float(bin.get("start")), float(bin.get("width")), int(bin.get("count"))) + ) + ## Flow class Flow(object): @@ -84,46 +92,63 @@ class Flow(object): # receive duration ## @var __slots_ # class variable list - __slots_ = ['flowId', 'delayMean', 'packetLossRatio', 'rxBitrate', 'txBitrate', - 'fiveTuple', 'packetSizeMean', 'probe_stats_unsorted', - 'hopCount', 'flowInterruptionsHistogram', 'rx_duration'] + __slots_ = [ + "flowId", + "delayMean", + "packetLossRatio", + "rxBitrate", + "txBitrate", + "fiveTuple", + "packetSizeMean", + "probe_stats_unsorted", + "hopCount", + "flowInterruptionsHistogram", + "rx_duration", + ] + def __init__(self, flow_el): - '''! The initializer. + """! The initializer. @param self The object pointer. @param flow_el The element. - ''' - self.flowId = int(flow_el.get('flowId')) - rxPackets = float(flow_el.get('rxPackets')) - txPackets = float(flow_el.get('txPackets')) + """ + self.flowId = int(flow_el.get("flowId")) + rxPackets = float(flow_el.get("rxPackets")) + txPackets = float(flow_el.get("txPackets")) - tx_duration = (parse_time_ns (flow_el.get('timeLastTxPacket')) - parse_time_ns(flow_el.get('timeFirstTxPacket')))*1e-9 - rx_duration = (parse_time_ns (flow_el.get('timeLastRxPacket')) - parse_time_ns(flow_el.get('timeFirstRxPacket')))*1e-9 + tx_duration = ( + parse_time_ns(flow_el.get("timeLastTxPacket")) + - parse_time_ns(flow_el.get("timeFirstTxPacket")) + ) * 1e-9 + rx_duration = ( + parse_time_ns(flow_el.get("timeLastRxPacket")) + - parse_time_ns(flow_el.get("timeFirstRxPacket")) + ) * 1e-9 self.rx_duration = rx_duration self.probe_stats_unsorted = [] if rxPackets: - self.hopCount = float(flow_el.get('timesForwarded')) / rxPackets + 1 + self.hopCount = float(flow_el.get("timesForwarded")) / rxPackets + 1 else: self.hopCount = -1000 if rxPackets: - self.delayMean = float(flow_el.get('delaySum')[:-2]) / rxPackets * 1e-9 - self.packetSizeMean = float(flow_el.get('rxBytes')) / rxPackets + self.delayMean = float(flow_el.get("delaySum")[:-2]) / rxPackets * 1e-9 + self.packetSizeMean = float(flow_el.get("rxBytes")) / rxPackets else: self.delayMean = None self.packetSizeMean = None if rx_duration > 0: - self.rxBitrate = float(flow_el.get('rxBytes'))*8 / rx_duration + self.rxBitrate = float(flow_el.get("rxBytes")) * 8 / rx_duration else: self.rxBitrate = None if tx_duration > 0: - self.txBitrate = float(flow_el.get('txBytes'))*8 / tx_duration + self.txBitrate = float(flow_el.get("txBytes")) * 8 / tx_duration else: self.txBitrate = None - lost = float(flow_el.get('lostPackets')) - #print "rxBytes: %s; txPackets: %s; rxPackets: %s; lostPackets: %s" % (flow_el.get('rxBytes'), txPackets, rxPackets, lost) + lost = float(flow_el.get("lostPackets")) + # print "rxBytes: %s; txPackets: %s; rxPackets: %s; lostPackets: %s" % (flow_el.get('rxBytes'), txPackets, rxPackets, lost) if rxPackets == 0: self.packetLossRatio = None else: - self.packetLossRatio = (lost / (rxPackets + lost)) + self.packetLossRatio = lost / (rxPackets + lost) interrupt_hist_elem = flow_el.find("flowInterruptionsHistogram") if interrupt_hist_elem is None: @@ -131,6 +156,7 @@ class Flow(object): else: self.flowInterruptionsHistogram = Histogram(interrupt_hist_elem) + ## ProbeFlowStats class ProbeFlowStats(object): ## class variables @@ -140,7 +166,8 @@ class ProbeFlowStats(object): # bytes ## @var __slots_ # class variable list - __slots_ = ['probeId', 'packets', 'bytes', 'delayFromFirstProbe'] + __slots_ = ["probeId", "packets", "bytes", "delayFromFirstProbe"] + ## Simulation class Simulation(object): @@ -148,31 +175,33 @@ class Simulation(object): ## @var flows # list of flows def __init__(self, simulation_el): - '''! The initializer. + """! The initializer. @param self The object pointer. @param simulation_el The element. - ''' + """ self.flows = [] - FlowClassifier_el, = simulation_el.findall("Ipv4FlowClassifier") + (FlowClassifier_el,) = simulation_el.findall("Ipv4FlowClassifier") flow_map = {} for flow_el in simulation_el.findall("FlowStats/Flow"): flow = Flow(flow_el) flow_map[flow.flowId] = flow self.flows.append(flow) for flow_cls in FlowClassifier_el.findall("Flow"): - flowId = int(flow_cls.get('flowId')) + flowId = int(flow_cls.get("flowId")) flow_map[flowId].fiveTuple = FiveTuple(flow_cls) for probe_elem in simulation_el.findall("FlowProbes/FlowProbe"): - probeId = int(probe_elem.get('index')) + probeId = int(probe_elem.get("index")) for stats in probe_elem.findall("FlowStats"): - flowId = int(stats.get('flowId')) + flowId = int(stats.get("flowId")) s = ProbeFlowStats() - s.packets = int(stats.get('packets')) - s.bytes = float(stats.get('bytes')) + s.packets = int(stats.get("packets")) + s.bytes = float(stats.get("bytes")) s.probeId = probeId if s.packets > 0: - s.delayFromFirstProbe = parse_time_ns(stats.get('delayFromFirstProbeSum')) / float(s.packets) + s.delayFromFirstProbe = parse_time_ns( + stats.get("delayFromFirstProbeSum") + ) / float(s.packets) else: s.delayFromFirstProbe = 0 flow_map[flowId].probe_stats_unsorted.append(s) @@ -190,38 +219,46 @@ def main(argv): level += 1 if event == "end": level -= 1 - if level == 0 and elem.tag == 'FlowMonitor': + if level == 0 and elem.tag == "FlowMonitor": sim = Simulation(elem) sim_list.append(sim) - elem.clear() # won't need this any more + elem.clear() # won't need this any more sys.stdout.write(".") sys.stdout.flush() print(" done.") - for sim in sim_list: for flow in sim.flows: t = flow.fiveTuple - proto = {6: 'TCP', 17: 'UDP'} [t.protocol] - print("FlowID: %i (%s %s/%s --> %s/%i)" % \ - (flow.flowId, proto, t.sourceAddress, t.sourcePort, t.destinationAddress, t.destinationPort)) + proto = {6: "TCP", 17: "UDP"}[t.protocol] + print( + "FlowID: %i (%s %s/%s --> %s/%i)" + % ( + flow.flowId, + proto, + t.sourceAddress, + t.sourcePort, + t.destinationAddress, + t.destinationPort, + ) + ) if flow.txBitrate is None: print("\tTX bitrate: None") else: - print("\tTX bitrate: %.2f kbit/s" % (flow.txBitrate*1e-3,)) + print("\tTX bitrate: %.2f kbit/s" % (flow.txBitrate * 1e-3,)) if flow.rxBitrate is None: print("\tRX bitrate: None") else: - print("\tRX bitrate: %.2f kbit/s" % (flow.rxBitrate*1e-3,)) + print("\tRX bitrate: %.2f kbit/s" % (flow.rxBitrate * 1e-3,)) if flow.delayMean is None: print("\tMean Delay: None") else: - print("\tMean Delay: %.2f ms" % (flow.delayMean*1e3,)) + print("\tMean Delay: %.2f ms" % (flow.delayMean * 1e3,)) if flow.packetLossRatio is None: print("\tPacket Loss Ratio: None") else: - print("\tPacket Loss Ratio: %.2f %%" % (flow.packetLossRatio*100)) + print("\tPacket Loss Ratio: %.2f %%" % (flow.packetLossRatio * 100)) -if __name__ == '__main__': +if __name__ == "__main__": main(sys.argv) diff --git a/src/flow-monitor/examples/wifi-olsr-flowmon.py b/src/flow-monitor/examples/wifi-olsr-flowmon.py index 84fdd56de..3c45f8a5f 100644 --- a/src/flow-monitor/examples/wifi-olsr-flowmon.py +++ b/src/flow-monitor/examples/wifi-olsr-flowmon.py @@ -17,6 +17,7 @@ # Authors: Gustavo Carneiro from __future__ import print_function + import sys try: @@ -28,13 +29,13 @@ except ModuleNotFoundError: " or your PYTHONPATH might not be properly configured" ) -DISTANCE = 20 # (m) +DISTANCE = 20 # (m) NUM_NODES_SIDE = 3 def main(argv): + from ctypes import c_bool, c_char_p, c_int, create_string_buffer - from ctypes import c_int, c_bool, c_char_p, create_string_buffer NumNodesSide = c_int(2) Plot = c_bool(False) BUFFLEN = 4096 @@ -42,7 +43,11 @@ def main(argv): Results = c_char_p(ResultsBuffer.raw) cmd = ns.CommandLine(__file__) - cmd.AddValue("NumNodesSide", "Grid side number of nodes (total number of nodes will be this number squared)", NumNodesSide) + cmd.AddValue( + "NumNodesSide", + "Grid side number of nodes (total number of nodes will be this number squared)", + NumNodesSide, + ) cmd.AddValue("Results", "Write XML results to file", Results, BUFFLEN) cmd.AddValue("Plot", "Plot the results using the matplotlib python module", Plot) cmd.Parse(argv) @@ -53,8 +58,7 @@ def main(argv): wifiChannel = ns.wifi.YansWifiChannelHelper.Default() wifiPhy.SetChannel(wifiChannel.Create()) ssid = ns.wifi.Ssid("wifi-default") - wifiMac.SetType ("ns3::AdhocWifiMac", - "Ssid", ns.wifi.SsidValue(ssid)) + wifiMac.SetType("ns3::AdhocWifiMac", "Ssid", ns.wifi.SsidValue(ssid)) internet = ns.internet.InternetStackHelper() list_routing = ns.internet.Ipv4ListRoutingHelper() @@ -67,12 +71,16 @@ def main(argv): ipv4Addresses = ns.internet.Ipv4AddressHelper() ipv4Addresses.SetBase(ns.network.Ipv4Address("10.0.0.0"), ns.network.Ipv4Mask("255.255.255.0")) - port = 9 # Discard port(RFC 863) + port = 9 # Discard port(RFC 863) inetAddress = ns.network.InetSocketAddress(ns.network.Ipv4Address("10.0.0.1"), port) onOffHelper = ns.applications.OnOffHelper("ns3::UdpSocketFactory", inetAddress.ConvertTo()) onOffHelper.SetAttribute("DataRate", ns.network.DataRateValue(ns.network.DataRate("100kbps"))) - onOffHelper.SetAttribute("OnTime", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=1]")) - onOffHelper.SetAttribute("OffTime", ns.core.StringValue ("ns3::ConstantRandomVariable[Constant=0]")) + onOffHelper.SetAttribute( + "OnTime", ns.core.StringValue("ns3::ConstantRandomVariable[Constant=1]") + ) + onOffHelper.SetAttribute( + "OffTime", ns.core.StringValue("ns3::ConstantRandomVariable[Constant=0]") + ) addresses = [] nodes = [] @@ -82,18 +90,17 @@ def main(argv): else: num_nodes_side = NumNodesSide.value - nodes = ns.NodeContainer(num_nodes_side*num_nodes_side) + nodes = ns.NodeContainer(num_nodes_side * num_nodes_side) accumulator = 0 for xi in range(num_nodes_side): for yi in range(num_nodes_side): - node = nodes.Get(accumulator) accumulator += 1 container = ns.network.NodeContainer(node) internet.Install(container) mobility = ns.CreateObject("ConstantPositionMobilityModel") - mobility.SetPosition(ns.core.Vector(xi*DISTANCE, yi*DISTANCE, 0)) + mobility.SetPosition(ns.core.Vector(xi * DISTANCE, yi * DISTANCE, 0)) node.AggregateObject(mobility) device = wifi.Install(wifiPhy, wifiMac, node) @@ -102,17 +109,20 @@ def main(argv): for i, node in [(i, nodes.Get(i)) for i in range(nodes.GetN())]: destaddr = addresses[(len(addresses) - 1 - i) % len(addresses)] - #print (i, destaddr) - onOffHelper.SetAttribute("Remote", ns.network.AddressValue(ns.network.InetSocketAddress(destaddr, port).ConvertTo())) + # print (i, destaddr) + onOffHelper.SetAttribute( + "Remote", + ns.network.AddressValue(ns.network.InetSocketAddress(destaddr, port).ConvertTo()), + ) container = ns.network.NodeContainer(node) app = onOffHelper.Install(container) - urv = ns.CreateObject("UniformRandomVariable")#ns.cppyy.gbl.get_rng() + urv = ns.CreateObject("UniformRandomVariable") # ns.cppyy.gbl.get_rng() startDelay = ns.Seconds(urv.GetValue(20, 30)) app.Start(startDelay) - #internet.EnablePcapAll("wifi-olsr") + # internet.EnablePcapAll("wifi-olsr") flowmon_helper = ns.flow_monitor.FlowMonitorHelper() - #flowmon_helper.SetMonitorAttribute("StartTime", ns.core.TimeValue(ns.core.Seconds(31))) + # flowmon_helper.SetMonitorAttribute("StartTime", ns.core.TimeValue(ns.core.Seconds(31))) monitor = flowmon_helper.InstallAll() monitor = flowmon_helper.GetMonitor() monitor.SetAttribute("DelayBinWidth", ns.core.DoubleValue(0.001)) @@ -123,33 +133,60 @@ def main(argv): ns.core.Simulator.Run() def print_stats(os, st): - print (" Tx Bytes: ", st.txBytes, file=os) - print (" Rx Bytes: ", st.rxBytes, file=os) - print (" Tx Packets: ", st.txPackets, file=os) - print (" Rx Packets: ", st.rxPackets, file=os) - print (" Lost Packets: ", st.lostPackets, file=os) + print(" Tx Bytes: ", st.txBytes, file=os) + print(" Rx Bytes: ", st.rxBytes, file=os) + print(" Tx Packets: ", st.txPackets, file=os) + print(" Rx Packets: ", st.rxPackets, file=os) + print(" Lost Packets: ", st.lostPackets, file=os) if st.rxPackets > 0: - print (" Mean{Delay}: ", (st.delaySum.GetSeconds() / st.rxPackets), file=os) - print (" Mean{Jitter}: ", (st.jitterSum.GetSeconds() / (st.rxPackets-1)), file=os) - print (" Mean{Hop Count}: ", float(st.timesForwarded) / st.rxPackets + 1, file=os) + print(" Mean{Delay}: ", (st.delaySum.GetSeconds() / st.rxPackets), file=os) + print(" Mean{Jitter}: ", (st.jitterSum.GetSeconds() / (st.rxPackets - 1)), file=os) + print(" Mean{Hop Count}: ", float(st.timesForwarded) / st.rxPackets + 1, file=os) if 0: - print ("Delay Histogram", file=os) - for i in range(st.delayHistogram.GetNBins () ): - print (" ",i,"(", st.delayHistogram.GetBinStart (i), "-", \ - st.delayHistogram.GetBinEnd (i), "): ", st.delayHistogram.GetBinCount (i), file=os) - print ("Jitter Histogram", file=os) - for i in range(st.jitterHistogram.GetNBins () ): - print (" ",i,"(", st.jitterHistogram.GetBinStart (i), "-", \ - st.jitterHistogram.GetBinEnd (i), "): ", st.jitterHistogram.GetBinCount (i), file=os) - print ("PacketSize Histogram", file=os) - for i in range(st.packetSizeHistogram.GetNBins () ): - print (" ",i,"(", st.packetSizeHistogram.GetBinStart (i), "-", \ - st.packetSizeHistogram.GetBinEnd (i), "): ", st.packetSizeHistogram.GetBinCount (i), file=os) + print("Delay Histogram", file=os) + for i in range(st.delayHistogram.GetNBins()): + print( + " ", + i, + "(", + st.delayHistogram.GetBinStart(i), + "-", + st.delayHistogram.GetBinEnd(i), + "): ", + st.delayHistogram.GetBinCount(i), + file=os, + ) + print("Jitter Histogram", file=os) + for i in range(st.jitterHistogram.GetNBins()): + print( + " ", + i, + "(", + st.jitterHistogram.GetBinStart(i), + "-", + st.jitterHistogram.GetBinEnd(i), + "): ", + st.jitterHistogram.GetBinCount(i), + file=os, + ) + print("PacketSize Histogram", file=os) + for i in range(st.packetSizeHistogram.GetNBins()): + print( + " ", + i, + "(", + st.packetSizeHistogram.GetBinStart(i), + "-", + st.packetSizeHistogram.GetBinEnd(i), + "): ", + st.packetSizeHistogram.GetBinCount(i), + file=os, + ) for reason, drops in enumerate(st.packetsDropped): - print (" Packets dropped by reason %i: %i" % (reason, drops), file=os) - #for reason, drops in enumerate(st.bytesDropped): + print(" Packets dropped by reason %i: %i" % (reason, drops), file=os) + # for reason, drops in enumerate(st.bytesDropped): # print "Bytes dropped by reason %i: %i" % (reason, drops) monitor.CheckForLostPackets() @@ -158,17 +195,26 @@ def main(argv): if Results.value != b"output.xml": for flow_id, flow_stats in monitor.GetFlowStats(): t = classifier.FindFlow(flow_id) - proto = {6: 'TCP', 17: 'UDP'} [t.protocol] - print ("FlowID: %i (%s %s/%s --> %s/%i)" % \ - (flow_id, proto, t.sourceAddress, t.sourcePort, t.destinationAddress, t.destinationPort)) + proto = {6: "TCP", 17: "UDP"}[t.protocol] + print( + "FlowID: %i (%s %s/%s --> %s/%i)" + % ( + flow_id, + proto, + t.sourceAddress, + t.sourcePort, + t.destinationAddress, + t.destinationPort, + ) + ) print_stats(sys.stdout, flow_stats) else: res = monitor.SerializeToXmlFile(Results.value.decode("utf-8"), True, True) - print (res) - + print(res) if Plot.value: import pylab + delays = [] for flow_id, flow_stats in monitor.GetFlowStats(): tupl = classifier.FindFlow(flow_id) @@ -183,6 +229,5 @@ def main(argv): return 0 -if __name__ == '__main__': +if __name__ == "__main__": sys.exit(main(sys.argv)) - diff --git a/src/lte/doc/source/conf.py b/src/lte/doc/source/conf.py index c11eb3bae..5852c5f6f 100644 --- a/src/lte/doc/source/conf.py +++ b/src/lte/doc/source/conf.py @@ -11,202 +11,208 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.imgmath'] +extensions = ["sphinx.ext.imgmath"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'lte' +master_doc = "lte" # General information about the project. -project = u'LENA' -copyright = u'CTTC' +project = "LENA" +copyright = "CTTC" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = 'v10' +version = "v10" # The full version, including alpha/beta/rc tags. -release = 'v10' +release = "v10" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = "default" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ['_static'] +# html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -#htmlhelp_basename = 'ns-3doc' +# htmlhelp_basename = 'ns-3doc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ -# ('lte-testing', 'lte-doc-testing.tex', u'LTE Simulator Testing Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), -# ('lte-design', 'lte-doc-design.tex', u'LTE Simulator Design Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), -# ('lte-user', 'lte-doc-user.tex', u'LTE Simulator User Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), - ('lte', 'lena-lte-module-doc.tex', u'The LENA ns-3 LTE Module Documentation', u'Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)', 'manual'), + # ('lte-testing', 'lte-doc-testing.tex', u'LTE Simulator Testing Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), + # ('lte-design', 'lte-doc-design.tex', u'LTE Simulator Design Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), + # ('lte-user', 'lte-doc-user.tex', u'LTE Simulator User Documentation', u'Centre Tecnologic de Telecomunicacions de Catalunya (CTTC)', 'manual'), + ( + "lte", + "lena-lte-module-doc.tex", + "The LENA ns-3 LTE Module Documentation", + "Centre Tecnològic de Telecomunicacions de Catalunya (CTTC)", + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True - +# latex_domain_indices = True # add page breaks in the pdf. Level 1 is for top-level sections, level 2 for subsections, and so on. @@ -217,7 +223,4 @@ pdf_break_level = 4 # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'ns-3-model-library', u'ns-3 Model Library', - [u'ns-3 project'], 1) -] +man_pages = [("index", "ns-3-model-library", "ns-3 Model Library", ["ns-3 project"], 1)] diff --git a/src/lte/test/examples-to-run.py b/src/lte/test/examples-to-run.py index 413403833..b54504f18 100644 --- a/src/lte/test/examples-to-run.py +++ b/src/lte/test/examples-to-run.py @@ -9,14 +9,34 @@ cpp_examples = [ ("lena-cqi-threshold", "True", "True"), ("lena-dual-stripe", "True", "True"), - ("lena-dual-stripe --simTime=0.0 --nApartmentsX=1 --homeEnbDeploymentRatio=0.5 --nMacroEnbSites=0 --macroUeDensity=0 --nBlocks=1", "True", "True"), - ("lena-dual-stripe --epc=1 --simTime=0.0 --nApartmentsX=1 --homeEnbDeploymentRatio=0.5 --nMacroEnbSites=0 --macroUeDensity=0 --nBlocks=1", "True", "True"), + ( + "lena-dual-stripe --simTime=0.0 --nApartmentsX=1 --homeEnbDeploymentRatio=0.5 --nMacroEnbSites=0 --macroUeDensity=0 --nBlocks=1", + "True", + "True", + ), + ( + "lena-dual-stripe --epc=1 --simTime=0.0 --nApartmentsX=1 --homeEnbDeploymentRatio=0.5 --nMacroEnbSites=0 --macroUeDensity=0 --nBlocks=1", + "True", + "True", + ), ("lena-dual-stripe --simTime=0.01", "True", "True"), ("lena-dual-stripe --epc=1 --simTime=0.01", "True", "True"), ("lena-dual-stripe --epc=1 --useUdp=0 --simTime=0.01", "True", "True"), - ("lena-dual-stripe --epc=1 --fadingTrace=../../src/lte/model/fading-traces/fading_trace_EPA_3kmph.fad --simTime=0.01", "True", "True"), - ("lena-dual-stripe --nBlocks=1 --nMacroEnbSites=0 --macroUeDensity=0 --homeEnbDeploymentRatio=1 --homeEnbActivationRatio=1 --homeUesHomeEnbRatio=2 --macroEnbTxPowerDbm=0 --simTime=0.01", "True", "True"), - ("lena-dual-stripe --nMacroEnbSites=0 --macroUeDensity=0 --nBlocks=1 --nApartmentsX=4 --nMacroEnbSitesX=0 --homeEnbDeploymentRatio=1 --homeEnbActivationRatio=1 --macroEnbTxPowerDbm=0 --epcDl=1 --epcUl=0 --epc=1 --numBearersPerUe=4 --homeUesHomeEnbRatio=15 --simTime=0.01", "True", "True"), + ( + "lena-dual-stripe --epc=1 --fadingTrace=../../src/lte/model/fading-traces/fading_trace_EPA_3kmph.fad --simTime=0.01", + "True", + "True", + ), + ( + "lena-dual-stripe --nBlocks=1 --nMacroEnbSites=0 --macroUeDensity=0 --homeEnbDeploymentRatio=1 --homeEnbActivationRatio=1 --homeUesHomeEnbRatio=2 --macroEnbTxPowerDbm=0 --simTime=0.01", + "True", + "True", + ), + ( + "lena-dual-stripe --nMacroEnbSites=0 --macroUeDensity=0 --nBlocks=1 --nApartmentsX=4 --nMacroEnbSitesX=0 --homeEnbDeploymentRatio=1 --homeEnbActivationRatio=1 --macroEnbTxPowerDbm=0 --epcDl=1 --epcUl=0 --epc=1 --numBearersPerUe=4 --homeUesHomeEnbRatio=15 --simTime=0.01", + "True", + "True", + ), ("lena-fading", "True", "True"), ("lena-gtpu-tunnel", "True", "True"), ("lena-intercell-interference --simTime=0.1", "True", "True"), @@ -30,23 +50,71 @@ cpp_examples = [ ("lena-simple", "True", "True"), ("lena-simple-epc", "True", "True"), ("lena-x2-handover", "True", "True"), - ("lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::TtaFfMacScheduler", "args.valgrind", "True"), - ("lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::TdTbfqFfMacScheduler", "args.valgrind", "True"), - ("lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::TdMtFfMacScheduler", "args.valgrind", "True"), - ("lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::TdBetFfMacScheduler", "args.valgrind", "True"), - ("lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::RrFfMacScheduler", "args.valgrind", "True"), - ("lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::PssFfMacScheduler", "args.valgrind", "True"), - ("lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::PfFfMacScheduler", "args.valgrind", "True"), - ("lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::FdTbfqFfMacScheduler", "args.valgrind", "True"), - ("lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::FdMtFfMacScheduler", "args.valgrind", "True"), - ("lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::FdBetFfMacScheduler", "args.valgrind", "True"), + ( + "lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::TtaFfMacScheduler", + "args.valgrind", + "True", + ), + ( + "lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::TdTbfqFfMacScheduler", + "args.valgrind", + "True", + ), + ( + "lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::TdMtFfMacScheduler", + "args.valgrind", + "True", + ), + ( + "lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::TdBetFfMacScheduler", + "args.valgrind", + "True", + ), + ( + "lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::RrFfMacScheduler", + "args.valgrind", + "True", + ), + ( + "lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::PssFfMacScheduler", + "args.valgrind", + "True", + ), + ( + "lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::PfFfMacScheduler", + "args.valgrind", + "True", + ), + ( + "lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::FdTbfqFfMacScheduler", + "args.valgrind", + "True", + ), + ( + "lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::FdMtFfMacScheduler", + "args.valgrind", + "True", + ), + ( + "lena-simple-epc --simTime=1.1 --ns3::LteHelper::Scheduler=ns3::FdBetFfMacScheduler", + "args.valgrind", + "True", + ), ("lena-ipv6-addr-conf", "True", "True"), ("lena-ipv6-ue-rh", "True", "True"), ("lena-ipv6-ue-ue", "True", "True"), ("lena-radio-link-failure --numberOfEnbs=1 --simTime=17", "True", "True"), - ("lena-radio-link-failure --numberOfEnbs=2 --interSiteDistance=700 --simTime=17", "True", "True"), + ( + "lena-radio-link-failure --numberOfEnbs=2 --interSiteDistance=700 --simTime=17", + "True", + "True", + ), ("lena-radio-link-failure --numberOfEnbs=1 --useIdealRrc=0 --simTime=17", "True", "True"), - ("lena-radio-link-failure --numberOfEnbs=2 --useIdealRrc=0 --interSiteDistance=700 --simTime=17", "True", "True"), + ( + "lena-radio-link-failure --numberOfEnbs=2 --useIdealRrc=0 --interSiteDistance=700 --simTime=17", + "True", + "True", + ), ] # A list of Python examples to run in order to ensure that they remain diff --git a/src/mesh/doc/source/conf.py b/src/mesh/doc/source/conf.py index 68f8de4dd..aeb32e05a 100644 --- a/src/mesh/doc/source/conf.py +++ b/src/mesh/doc/source/conf.py @@ -11,202 +11,208 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.imgmath'] +extensions = ["sphinx.ext.imgmath"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'mesh' +master_doc = "mesh" # General information about the project. -project = u'ns-3' -copyright = u'ns-3 project' +project = "ns-3" +copyright = "ns-3 project" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = 'ns-3-dev' +version = "ns-3-dev" # The full version, including alpha/beta/rc tags. -release = 'ns-3-dev' +release = "ns-3-dev" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = "default" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ['_static'] +# html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -#htmlhelp_basename = 'ns-3doc' +# htmlhelp_basename = 'ns-3doc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ -# ('mesh-testing', 'mesh-doc-testing.tex', u'Mesh Wi-Fi Testing Documentation', u'ns-3 project', 'manual'), -# ('mesh-design', 'mesh-doc-design.tex', u'Mesh Wi-Fi Design Documentation', u'ns-3 project', 'manual'), -# ('mesh-user', 'mesh-doc-user.tex', u'Mesh Wi-Fi User Documentation', u'ns-3 project', 'manual'), - ('mesh', 'mesh-module-doc.tex', u'The ns-3 Mesh Wi-Fi Module Documentation', u'ns-3 project', 'manual'), + # ('mesh-testing', 'mesh-doc-testing.tex', u'Mesh Wi-Fi Testing Documentation', u'ns-3 project', 'manual'), + # ('mesh-design', 'mesh-doc-design.tex', u'Mesh Wi-Fi Design Documentation', u'ns-3 project', 'manual'), + # ('mesh-user', 'mesh-doc-user.tex', u'Mesh Wi-Fi User Documentation', u'ns-3 project', 'manual'), + ( + "mesh", + "mesh-module-doc.tex", + "The ns-3 Mesh Wi-Fi Module Documentation", + "ns-3 project", + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True - +# latex_domain_indices = True # add page breaks in the pdf. Level 1 is for top-level sections, level 2 for subsections, and so on. @@ -217,7 +223,4 @@ pdf_break_level = 4 # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'ns-3-model-library', u'ns-3 Model Library', - [u'ns-3 project'], 1) -] +man_pages = [("index", "ns-3-model-library", "ns-3 Model Library", ["ns-3 project"], 1)] diff --git a/src/netanim/_required_netanim_version.py b/src/netanim/_required_netanim_version.py index 8c211ab4f..0c7a9c370 100644 --- a/src/netanim/_required_netanim_version.py +++ b/src/netanim/_required_netanim_version.py @@ -6,4 +6,4 @@ # on 'git describe --tags' command. Example, if the latest release was 3.108, # and 'git describe --tags' reports "netanim-3.108-6-g8e7c0a9", then write the # version string below as 'netanim-3.108.post6+ng8e7c0a9' -__required_netanim_version__ = 'netanim-3.109' +__required_netanim_version__ = "netanim-3.109" diff --git a/src/nix-vector-routing/test/examples-to-run.py b/src/nix-vector-routing/test/examples-to-run.py index 7232c920a..a4987da19 100644 --- a/src/nix-vector-routing/test/examples-to-run.py +++ b/src/nix-vector-routing/test/examples-to-run.py @@ -8,7 +8,7 @@ # See test.py for more information. cpp_examples = [ ("nix-simple", "True", "True"), - ("nms-p2p-nix", "False", "True"), # Takes too long to run + ("nms-p2p-nix", "False", "True"), # Takes too long to run ] # A list of Python examples to run in order to ensure that they remain diff --git a/src/openflow/examples/openflow-switch.py b/src/openflow/examples/openflow-switch.py index 036f5e746..a0122cd1b 100644 --- a/src/openflow/examples/openflow-switch.py +++ b/src/openflow/examples/openflow-switch.py @@ -67,7 +67,9 @@ ipv4.Assign(terminalDevices) port = 9 -onoff = ns.OnOffHelper("ns3::UdpSocketFactory", ns.InetSocketAddress(ns.Ipv4Address("10.1.1.2"), port).ConvertTo()) +onoff = ns.OnOffHelper( + "ns3::UdpSocketFactory", ns.InetSocketAddress(ns.Ipv4Address("10.1.1.2"), port).ConvertTo() +) onoff.SetConstantRate(ns.DataRate("500kb/s")) app = onoff.Install(terminals.Get(0)) @@ -75,12 +77,15 @@ app = onoff.Install(terminals.Get(0)) app.Start(ns.Seconds(1.0)) app.Stop(ns.Seconds(10.0)) -sink = ns.PacketSinkHelper("ns3::UdpSocketFactory", - ns.InetSocketAddress(ns.Ipv4Address.GetAny(), port).ConvertTo()) +sink = ns.PacketSinkHelper( + "ns3::UdpSocketFactory", ns.InetSocketAddress(ns.Ipv4Address.GetAny(), port).ConvertTo() +) app = sink.Install(terminals.Get(1)) app.Start(ns.Seconds(0.0)) -onoff.SetAttribute("Remote", ns.AddressValue(ns.InetSocketAddress(ns.Ipv4Address("10.1.1.1"), port).ConvertTo())) +onoff.SetAttribute( + "Remote", ns.AddressValue(ns.InetSocketAddress(ns.Ipv4Address("10.1.1.1"), port).ConvertTo()) +) app = onoff.Install(terminals.Get(3)) app.Start(ns.Seconds(1.1)) app.Stop(ns.Seconds(10.0)) diff --git a/src/spectrum/test/examples-to-run.py b/src/spectrum/test/examples-to-run.py index 7f68e1a9e..c7d74178b 100644 --- a/src/spectrum/test/examples-to-run.py +++ b/src/spectrum/test/examples-to-run.py @@ -10,7 +10,7 @@ cpp_examples = [ ("adhoc-aloha-ideal-phy", "True", "True"), ("adhoc-aloha-ideal-phy-with-microwave-oven", "True", "True"), ("adhoc-aloha-ideal-phy-matrix-propagation-loss-model", "True", "True"), - ("three-gpp-channel-example", "True", "True") + ("three-gpp-channel-example", "True", "True"), ] # A list of Python examples to run in order to ensure that they remain diff --git a/src/spectrum/utils/two-ray-to-three-gpp-ch-calibration.py b/src/spectrum/utils/two-ray-to-three-gpp-ch-calibration.py index 8e8556446..441b6b148 100644 --- a/src/spectrum/utils/two-ray-to-three-gpp-ch-calibration.py +++ b/src/spectrum/utils/two-ray-to-three-gpp-ch-calibration.py @@ -19,42 +19,67 @@ You should have received a copy of the GNU General Public License along with this program. If not, see . """ -import pandas as pd -from matplotlib import pyplot as plt -import seaborn as sns -import numpy as np -from pathlib import Path -from itertools import product -from tqdm import tqdm -import joblib -import contextlib import argparse as argp +import contextlib +from itertools import product +from pathlib import Path +import joblib +import numpy as np +import pandas as pd +import seaborn as sns +from matplotlib import pyplot as plt +from tqdm import tqdm # Command line arguments parser = argp.ArgumentParser(formatter_class=argp.ArgumentDefaultsHelpFormatter) -parser.add_argument("--num_search_grid_params", default=30, - help="Number of values for each parameter of the search grids") -parser.add_argument("--num_refinements", default=1, - help="Number of refinement local search runs to be carried out") -parser.add_argument("--ref_data_fname", default="two-ray-to-three-gpp-splm-calibration.csv", - help="Filename of the fit reference data, obtained from ns-3") -parser.add_argument("--fit_out_fname", default="two-ray-splm-fitted-params.txt", - help="Filename of the fit results") -parser.add_argument("--c_plus_plus_out_fname", default="two-ray-cplusplus-fitted-params.txt", - help="Filename of the fit results, encoded as a C++ data structure to be imported in ns-3") -parser.add_argument("--figs_folder", default="FiguresTwoRayThreeGppChCalibration/", - help="Output folder for the fit results figures") -parser.add_argument("--epsilon", default=1e-7, - help="Tolerance value for the preliminary tests") -parser.add_argument("--preliminary_fit_test", default=True, - help="Whether to run preliminary tests which check the correctness of the script functions") -parser.add_argument("--fit_ftr_to_threegpp", default=True, - help="Whether to run the calibration with respect to the 3GPP reference channel gains") -parser.add_argument("--output_ns3_table", default=True, - help="Whether to output the code for importing the calibration results in ns-3") -parser.add_argument("--plot_fit_results", default=False, - help="Whether to plot a comparison of the reference data ECDFs vs the fitted FTR distributions") +parser.add_argument( + "--num_search_grid_params", + default=30, + help="Number of values for each parameter of the search grids", +) +parser.add_argument( + "--num_refinements", default=1, help="Number of refinement local search runs to be carried out" +) +parser.add_argument( + "--ref_data_fname", + default="two-ray-to-three-gpp-splm-calibration.csv", + help="Filename of the fit reference data, obtained from ns-3", +) +parser.add_argument( + "--fit_out_fname", default="two-ray-splm-fitted-params.txt", help="Filename of the fit results" +) +parser.add_argument( + "--c_plus_plus_out_fname", + default="two-ray-cplusplus-fitted-params.txt", + help="Filename of the fit results, encoded as a C++ data structure to be imported in ns-3", +) +parser.add_argument( + "--figs_folder", + default="FiguresTwoRayThreeGppChCalibration/", + help="Output folder for the fit results figures", +) +parser.add_argument("--epsilon", default=1e-7, help="Tolerance value for the preliminary tests") +parser.add_argument( + "--preliminary_fit_test", + default=True, + help="Whether to run preliminary tests which check the correctness of the script functions", +) +parser.add_argument( + "--fit_ftr_to_threegpp", + default=True, + help="Whether to run the calibration with respect to the 3GPP reference channel gains", +) +parser.add_argument( + "--output_ns3_table", + default=True, + help="Whether to output the code for importing the calibration results in ns-3", +) +parser.add_argument( + "--plot_fit_results", + default=False, + help="Whether to plot a comparison of the reference data ECDFs vs the fitted FTR distributions", +) args = parser.parse_args() # Number of values for each parameter of the search grids @@ -84,10 +109,11 @@ plot_fit_results = bool(args.plot_fit_results) @contextlib.contextmanager def tqdm_joblib(tqdm_object): """ - Context manager to patch joblib to report into tqdm progress bar given as argument. - Taken from: https://stackoverflow.com/questions/24983493/tracking-progress-of-joblib-parallel-execution + Context manager to patch joblib to report into tqdm progress bar given as argument. + Taken from: https://stackoverflow.com/questions/24983493/tracking-progress-of-joblib-parallel-execution """ + class TqdmBatchCompletionCallback(joblib.parallel.BatchCompletionCallBack): def __call__(self, *args, **kwargs): tqdm_object.update(n=self.batch_size) @@ -114,13 +140,13 @@ class FtrParams: # Parameter delta [0, 1]. Expresses how similar the amplitudes of the two dominant specular components are. def __init__(self, m: float, sigma: float, k: float, delta: float): - '''! The initializer. + """! The initializer. @param self: the object pointer @param m: Parameter m for the Gamma variable. Used both as the shape and rate parameters. @param sigma: Parameter sigma. Used as the variance of the amplitudes of the normal diffuse components. @param k: Parameter K. Expresses ratio between dominant specular components and diffuse components. @param delta: Parameter delta [0, 1]. Expresses how similar the amplitudes of the two dominant specular components are. - ''' + """ self.m = m self.sigma = sigma @@ -128,9 +154,9 @@ class FtrParams: self.delta = delta def __init__(self): - '''! The initializer with default values. + """! The initializer with default values. @param self: the object pointer - ''' + """ self.m = 1 self.sigma = 1.0 @@ -138,37 +164,36 @@ class FtrParams: self.delta = 0.0 def __str__(self): - '''! The initializer with default values. + """! The initializer with default values. @param self: the object pointer @returns A string reporting the value of each of the FTR fading model parameters - ''' + """ - return f'm: {self.m}, sigma: {self.sigma}, k: {self.k}, delta: {self.delta}' + return f"m: {self.m}, sigma: {self.sigma}, k: {self.k}, delta: {self.delta}" def get_ftr_ecdf(params: FtrParams, n_samples: int, db=False): - '''! Returns the ECDF for the FTR fading model, for a given parameter grid. - @param params: The FTR parameters grid. - @param n_samples: The number of samples of the output ECDF - @param db: Whether to return the ECDF with the gain expressed in dB - @returns The ECDF for the FTR fading model - ''' + """! Returns the ECDF for the FTR fading model, for a given parameter grid. + @param params: The FTR parameters grid. + @param n_samples: The number of samples of the output ECDF + @param db: Whether to return the ECDF with the gain expressed in dB + @returns The ECDF for the FTR fading model + """ - assert (params.delta >= 0 and params.delta <= 1.0) + assert params.delta >= 0 and params.delta <= 1.0 # Compute the specular components amplitudes from the FTR parameters cmn_sqrt_term = np.sqrt(1 - params.delta**2) v1 = np.sqrt(params.sigma) * np.sqrt(params.k * (1 - cmn_sqrt_term)) v2 = np.sqrt(params.sigma) * np.sqrt(params.k * (1 + cmn_sqrt_term)) - assert (abs((v1**2 + v2**2)/(2*params.sigma) - params.k) < 1e-5) + assert abs((v1**2 + v2**2) / (2 * params.sigma) - params.k) < 1e-5 if params.k > 0: - assert (abs((2*v1*v2)/(v1**2 + v2**2) - params.delta) < 1e-4) + assert abs((2 * v1 * v2) / (v1**2 + v2**2) - params.delta) < 1e-4 else: - assert (v1 == v2 == params.k) + assert v1 == v2 == params.k - sqrt_gamma = np.sqrt(np.random.gamma( - shape=params.m, scale=1/params.m, size=n_samples)) + sqrt_gamma = np.sqrt(np.random.gamma(shape=params.m, scale=1 / params.m, size=n_samples)) # Sample the random phases of the specular components, which are uniformly distributed in [0, 2*PI] phi1 = np.random.uniform(low=0, high=1.0, size=n_samples) @@ -182,75 +207,78 @@ def get_ftr_ecdf(params: FtrParams, n_samples: int, db=False): compl_phi1 = np.vectorize(complex)(np.cos(phi1), np.sin(phi1)) compl_phi2 = np.vectorize(complex)(np.cos(phi2), np.sin(phi2)) compl_xy = np.vectorize(complex)(x, y) - h = np.multiply(sqrt_gamma, compl_phi1) * v1 + \ - np.multiply(sqrt_gamma, compl_phi2) * v2 + compl_xy + h = ( + np.multiply(sqrt_gamma, compl_phi1) * v1 + + np.multiply(sqrt_gamma, compl_phi2) * v2 + + compl_xy + ) # Compute the squared norms power = np.square(np.absolute(h)) if db: - power = 10*np.log10(power) + power = 10 * np.log10(power) return np.sort(power) def compute_ftr_mean(params: FtrParams): - '''! Computes the mean of the FTR fading model, given a specific set of parameters. - @param params: The FTR fading model parameters. - ''' + """! Computes the mean of the FTR fading model, given a specific set of parameters. + @param params: The FTR fading model parameters. + """ cmn_sqrt_term = np.sqrt(1 - params.delta**2) v1 = np.sqrt(params.sigma) * np.sqrt(params.k * (1 - cmn_sqrt_term)) v2 = np.sqrt(params.sigma) * np.sqrt(params.k * (1 + cmn_sqrt_term)) - mean = v1**2 + v2**2 + 2*params.sigma + mean = v1**2 + v2**2 + 2 * params.sigma return mean def compute_ftr_th_mean(params: FtrParams): - '''! Computes the mean of the FTR fading model using the formula reported in the corresponding paper, - given a specific set of parameters. - @param params: The FTR fading model parameters. - ''' + """! Computes the mean of the FTR fading model using the formula reported in the corresponding paper, + given a specific set of parameters. + @param params: The FTR fading model parameters. + """ return 2 * params.sigma * (1 + params.k) def compute_anderson_darling_measure(ref_ecdf: list, target_ecdf: list) -> float: - '''! Computes the Anderson-Darling measure for the specified reference and targets distributions. - In particular, the Anderson-Darling measure is defined as: - \f$A^2 = -N -S\f$, where \f$S = \sum_{i=1}^N \frac{2i - 1}{N} \left[ ln F(Y_i) + ln F(Y_{N + 1 - i}) \right]\f$. + """! Computes the Anderson-Darling measure for the specified reference and targets distributions. + In particular, the Anderson-Darling measure is defined as: + \f$A^2 = -N -S\f$, where \f$S = \sum_{i=1}^N \frac{2i - 1}{N} \left[ ln F(Y_i) + ln F(Y_{N + 1 - i}) \right]\f$. - See https://www.itl.nist.gov/div898/handbook/eda/section3/eda35e.htm for further details. + See https://www.itl.nist.gov/div898/handbook/eda/section3/eda35e.htm for further details. - @param ref_ecdf: The reference ECDF. - @param target_ecdf: The target ECDF we wish to match the reference distribution to. - @returns The Anderson-Darling measure for the specified reference and targets distributions. - ''' + @param ref_ecdf: The reference ECDF. + @param target_ecdf: The target ECDF we wish to match the reference distribution to. + @returns The Anderson-Darling measure for the specified reference and targets distributions. + """ - assert (len(ref_ecdf) == len(target_ecdf)) + assert len(ref_ecdf) == len(target_ecdf) n = len(ref_ecdf) - mult_factors = np.linspace(start=1, stop=n, num=n)*2 + 1 + mult_factors = np.linspace(start=1, stop=n, num=n) * 2 + 1 ecdf_values = compute_ecdf_value(ref_ecdf, target_ecdf) # First and last elements of the ECDF may lead to NaNs - with np.errstate(divide='ignore'): + with np.errstate(divide="ignore"): log_a_plus_b = np.log(ecdf_values) + np.log(1 - np.flip(ecdf_values)) valid_idxs = np.isfinite(log_a_plus_b) - A_sq = - np.dot(mult_factors[valid_idxs], log_a_plus_b[valid_idxs]) + A_sq = -np.dot(mult_factors[valid_idxs], log_a_plus_b[valid_idxs]) return A_sq def compute_ecdf_value(ecdf: list, data_points: float) -> np.ndarray: - '''! Given an ECDF and data points belonging to its domain, returns their associated EDCF value. - @param ecdf: The ECDF, represented as a sorted list of samples. - @param data_points: A list of data points belonging to the same domain as the samples. - @returns The ECDF value of the domain points of the specified ECDF - ''' + """! Given an ECDF and data points belonging to its domain, returns their associated EDCF value. + @param ecdf: The ECDF, represented as a sorted list of samples. + @param data_points: A list of data points belonging to the same domain as the samples. + @returns The ECDF value of the domain points of the specified ECDF + """ ecdf_values = [] for point in data_points: @@ -261,36 +289,39 @@ def compute_ecdf_value(ecdf: list, data_points: float) -> np.ndarray: def get_sigma_from_k(k: float) -> float: - '''! Computes the value for the FTR parameter sigma, given k, yielding a unit-mean fading process. - @param k: The K parameter of the FTR fading model, which represents the ratio of the average power - of the dominant components to the power of the remaining diffuse multipath. - @returns The value for the FTR parameter sigma, given k, yielding a unit-mean fading process. - ''' + """! Computes the value for the FTR parameter sigma, given k, yielding a unit-mean fading process. + @param k: The K parameter of the FTR fading model, which represents the ratio of the average power + of the dominant components to the power of the remaining diffuse multipath. + @returns The value for the FTR parameter sigma, given k, yielding a unit-mean fading process. + """ return 1 / (2 + 2 * k) -def fit_ftr_to_reference(ref_data: pd.DataFrame, ref_params_combo: tuple, num_params: int, num_refinements: int) -> str: - '''! Estimate the FTR parameters yielding the closest ECDF to the reference one. +def fit_ftr_to_reference( + ref_data: pd.DataFrame, ref_params_combo: tuple, num_params: int, num_refinements: int +) -> str: + """! Estimate the FTR parameters yielding the closest ECDF to the reference one. - Uses a global search to estimate the FTR parameters yielding the best fit to the reference ECDF. - Then, the search is refined by repeating the procedure in the neighborhood of the parameters - identified with the global search. Such a neighborhood is determined as the interval whose center - is the previous iteration best value, and the lower and upper bounds are the first lower and upper - values which were previously considered, respectively. + Uses a global search to estimate the FTR parameters yielding the best fit to the reference ECDF. + Then, the search is refined by repeating the procedure in the neighborhood of the parameters + identified with the global search. Such a neighborhood is determined as the interval whose center + is the previous iteration best value, and the lower and upper bounds are the first lower and upper + values which were previously considered, respectively. - @param ref_data: The reference data, represented as a DataFrame of samples. - @param ref_params_combo: The specific combination of simulation parameters corresponding - to the reference ECDF - @param num_params: The number of values of each parameter in the global and local search grids. - @param num_refinements: The number of local refinement search to be carried out after the global search. + @param ref_data: The reference data, represented as a DataFrame of samples. + @param ref_params_combo: The specific combination of simulation parameters corresponding + to the reference ECDF + @param num_params: The number of values of each parameter in the global and local search grids. + @param num_refinements: The number of local refinement search to be carried out after the global search. - @returns An estimate of the FTR parameters yielding the closest ECDF to the reference one. - ''' + @returns An estimate of the FTR parameters yielding the closest ECDF to the reference one. + """ # Retrieve the reference ECDF ref_ecdf = ref_data.query( - 'scen == @ref_params_combo[0] and cond == @ref_params_combo[1] and fc == @ref_params_combo[2]') + "scen == @ref_params_combo[0] and cond == @ref_params_combo[1] and fc == @ref_params_combo[2]" + ) # Perform the fit n_samples = len(ref_ecdf) @@ -303,21 +334,26 @@ def fit_ftr_to_reference(ref_data: pd.DataFrame, ref_params_combo: tuple, num_p m_and_k_step = (m_and_k_ub - m_and_k_lb) / n_samples # The delta parameter can range in [0, 1] - delta_step = 1/n_samples + delta_step = 1 / n_samples # Define the coarse grid coarse_search_grid = { # m must be in [0, +inf] - 'm': np.power(np.ones(num_params)*10, np.linspace(start=m_and_k_lb, stop=m_and_k_ub, endpoint=True, num=num_params)), + "m": np.power( + np.ones(num_params) * 10, + np.linspace(start=m_and_k_lb, stop=m_and_k_ub, endpoint=True, num=num_params), + ), # k must be in [0, +inf] - 'k': np.power(np.ones(num_params)*10, np.linspace(start=m_and_k_lb, stop=m_and_k_ub, endpoint=True, num=num_params)), + "k": np.power( + np.ones(num_params) * 10, + np.linspace(start=m_and_k_lb, stop=m_and_k_ub, endpoint=True, num=num_params), + ), # delta must be in [0, 1] - 'delta': np.linspace(start=0.0, stop=1.0, endpoint=True, num=num_params) + "delta": np.linspace(start=0.0, stop=1.0, endpoint=True, num=num_params) # sigma determined from k, due to the unit-mean constraint } for element in product(*coarse_search_grid.values()): - # Create FTR params object params = FtrParams() params.m = element[0] @@ -329,36 +365,48 @@ def fit_ftr_to_reference(ref_data: pd.DataFrame, ref_params_combo: tuple, num_p ftr_ecdf = get_ftr_ecdf(params, n_samples, db=True) ad_meas = compute_anderson_darling_measure(ref_ecdf, ftr_ecdf) - if (ad_meas < best_ad): + if ad_meas < best_ad: best_params = params best_ad = ad_meas for _ in range(num_refinements): # Refine search in the neighborhood of the previously identified params finer_search_grid = { - 'm': np.power(np.ones(num_params)*10, - np.linspace(start=max(0, np.log10(best_params.m) - m_and_k_step), - stop=np.log10(best_params.m) + - m_and_k_step, - endpoint=True, num=num_params)), - 'k': np.power(np.ones(num_params)*10, - np.linspace(start=max(0, np.log10(best_params.k) - m_and_k_step), - stop=np.log10(best_params.k) + - m_and_k_step, - endpoint=True, num=num_params)), - 'delta': np.linspace(start=max(0, best_params.delta - delta_step), - stop=min(1, best_params.delta + delta_step), - endpoint=True, num=num_params) + "m": np.power( + np.ones(num_params) * 10, + np.linspace( + start=max(0, np.log10(best_params.m) - m_and_k_step), + stop=np.log10(best_params.m) + m_and_k_step, + endpoint=True, + num=num_params, + ), + ), + "k": np.power( + np.ones(num_params) * 10, + np.linspace( + start=max(0, np.log10(best_params.k) - m_and_k_step), + stop=np.log10(best_params.k) + m_and_k_step, + endpoint=True, + num=num_params, + ), + ), + "delta": np.linspace( + start=max(0, best_params.delta - delta_step), + stop=min(1, best_params.delta + delta_step), + endpoint=True, + num=num_params, + ) # sigma determined from k, due to the unit-mean constraint } - m_and_k_step = (np.log10(best_params.m) + m_and_k_step - - max(0, np.log10(best_params.m) - m_and_k_step)) / n_samples - delta_step = (min(1, best_params.delta + 1/num_params) - - max(0, best_params.delta - 1/num_params)) / n_samples + m_and_k_step = ( + np.log10(best_params.m) + m_and_k_step - max(0, np.log10(best_params.m) - m_and_k_step) + ) / n_samples + delta_step = ( + min(1, best_params.delta + 1 / num_params) - max(0, best_params.delta - 1 / num_params) + ) / n_samples for element in product(*finer_search_grid.values()): - # Create FTR params object params = FtrParams() params.m = element[0] @@ -370,19 +418,21 @@ def fit_ftr_to_reference(ref_data: pd.DataFrame, ref_params_combo: tuple, num_p ftr_ecdf = get_ftr_ecdf(params, n_samples, db=True) ad_meas = compute_anderson_darling_measure(ref_ecdf, ftr_ecdf) - if (ad_meas < best_ad): + if ad_meas < best_ad: best_params = params best_ad = ad_meas - out_str = f"{ref_params_combo[0]}\t{ref_params_combo[1]}\t{ref_params_combo[2]}" + \ - f" \t{best_params.sigma}\t{best_params.k}\t{best_params.delta}\t{best_params.m}\n" + out_str = ( + f"{ref_params_combo[0]}\t{ref_params_combo[1]}\t{ref_params_combo[2]}" + + f" \t{best_params.sigma}\t{best_params.k}\t{best_params.delta}\t{best_params.m}\n" + ) return out_str def append_ftr_params_to_cpp_string(text: str, params: FtrParams) -> str: - text += f'TwoRaySpectrumPropagationLossModel::FtrParams({np.format_float_scientific(params.m)}, {np.format_float_scientific(params.sigma)}, \ - {np.format_float_scientific(params.k)}, {np.format_float_scientific(params.delta)})' + text += f"TwoRaySpectrumPropagationLossModel::FtrParams({np.format_float_scientific(params.m)}, {np.format_float_scientific(params.sigma)}, \ + {np.format_float_scientific(params.k)}, {np.format_float_scientific(params.delta)})" return text @@ -396,74 +446,71 @@ def print_cplusplus_map_from_fit_results(fit: pd.DataFrame, out_fname: str): out_fname (str): The name of the file to print the C++ code to. """ - out_str = '{' + out_str = "{" - for scen in set(fit['scen']): - out_str += f'{{\"{scen}\",\n{{' + for scen in set(fit["scen"]): + out_str += f'{{"{scen}",\n{{' - for cond in set(fit['cond']): - out_str += f'{{ChannelCondition::LosConditionValue::{cond}, \n' + for cond in set(fit["cond"]): + out_str += f"{{ChannelCondition::LosConditionValue::{cond}, \n" # Print vector of carrier frequencies - freqs = np.sort(list(set(fit['fc']))) + freqs = np.sort(list(set(fit["fc"]))) out_str += "{{" for fc in freqs: - out_str += f'{float(fc)}, ' + out_str += f"{float(fc)}, " out_str = out_str[0:-2] - out_str += '},\n{' + out_str += "},\n{" # Load corresponding fit results for fc in freqs: - fit_line = fit.query( - 'scen == @scen and cond == @cond and fc == @fc') - assert(fit_line.reset_index().shape[0] == 1) + fit_line = fit.query("scen == @scen and cond == @cond and fc == @fc") + assert fit_line.reset_index().shape[0] == 1 params = FtrParams() - params.m = fit_line.iloc[0]['m'] - params.k = fit_line.iloc[0]['k'] - params.delta = fit_line.iloc[0]['delta'] - params.sigma = fit_line.iloc[0]['sigma'] + params.m = fit_line.iloc[0]["m"] + params.k = fit_line.iloc[0]["k"] + params.delta = fit_line.iloc[0]["delta"] + params.sigma = fit_line.iloc[0]["sigma"] # Print vector of corresponding FTR parameters out_str = append_ftr_params_to_cpp_string(out_str, params) - out_str += ', ' + out_str += ", " out_str = out_str[0:-2] - out_str += '}' - out_str += '}},\n' + out_str += "}" + out_str += "}},\n" out_str = out_str[0:-2] - out_str += '}},\n' + out_str += "}},\n" out_str = out_str[0:-2] - out_str += '}\n' + out_str += "}\n" with open(out_fname, "w", encoding="utf-8") as f: f.write(out_str) -if __name__ == '__main__': - +if __name__ == "__main__": ######################### ## Data pre-processing ## ######################### # Load reference data obtained from the ns-3 TR 38.901 implementation - df = pd.read_csv(ref_data_fname, sep='\t') + df = pd.read_csv(ref_data_fname, sep="\t") # Linear gain --> gain in dB - df['gain'] = 10*np.log10(df['gain']) + df["gain"] = 10 * np.log10(df["gain"]) # Retrieve the possible parameters configurations - scenarios = set(df['scen']) - is_los = set(df['cond']) - frequencies = np.sort(list(set(df['fc']))) + scenarios = set(df["scen"]) + is_los = set(df["cond"]) + frequencies = np.sort(list(set(df["fc"]))) #################################################################################################### ## Fit Fluctuating Two Ray model to the 3GPP TR 38.901 using the Anderson-Darling goodness-of-fit ## #################################################################################################### if preliminary_fit_test: - params = FtrParams() get_ftr_ecdf(params, 100) @@ -492,11 +539,19 @@ if __name__ == '__main__': assert np.all(np.abs(mean_th_list - np.float64(1.0)) < epsilon) if fit_ftr_to_threegpp: - # Parallel search for the different simulation parameters combination - with tqdm_joblib(tqdm(desc="Fitting FTR to the 3GPP fading model", total=(len(scenarios) * len(is_los) * len(frequencies)))) as progress_bar: + with tqdm_joblib( + tqdm( + desc="Fitting FTR to the 3GPP fading model", + total=(len(scenarios) * len(is_los) * len(frequencies)), + ) + ) as progress_bar: res = joblib.Parallel(n_jobs=10)( - joblib.delayed(fit_ftr_to_reference)(df, params_comb, num_search_grid_params, num_refinements) for params_comb in product(scenarios, is_los, frequencies)) + joblib.delayed(fit_ftr_to_reference)( + df, params_comb, num_search_grid_params, num_refinements + ) + for params_comb in product(scenarios, is_los, frequencies) + ) with open(fit_out_fname, "w", encoding="utf-8") as f: f.write("scen\tcond\tfc\tsigma\tk\tdelta\tm\n") @@ -504,64 +559,61 @@ if __name__ == '__main__': f.write(line) if output_ns3_table: - # Load the fit results - fit = pd.read_csv(fit_out_fname, delimiter='\t') + fit = pd.read_csv(fit_out_fname, delimiter="\t") # Output the C++ data structure print_cplusplus_map_from_fit_results(fit, c_plus_plus_out_fname) if plot_fit_results: - # Set Seaborn defaults and setup output folder - sns.set(rc={'figure.figsize': (7, 5)}) + sns.set(rc={"figure.figsize": (7, 5)}) sns.set_theme() - sns.set_style('darkgrid') + sns.set_style("darkgrid") - fit = pd.read_csv(fit_out_fname, delimiter='\t') + fit = pd.read_csv(fit_out_fname, delimiter="\t") # Create folder if it does not exist Path(figs_folder).mkdir(parents=True, exist_ok=True) ad_measures = [] for params_comb in product(scenarios, is_los, frequencies): - - data_query = 'scen == @params_comb[0] and cond == @params_comb[1] and fc == @params_comb[2]' + data_query = ( + "scen == @params_comb[0] and cond == @params_comb[1] and fc == @params_comb[2]" + ) # Load corresponding reference data ref_data = df.query(data_query) # Create FTR params object fit_line = fit.query(data_query) - assert(fit_line.reset_index().shape[0] == 1) + assert fit_line.reset_index().shape[0] == 1 params = FtrParams() - params.m = fit_line.iloc[0]['m'] - params.k = fit_line.iloc[0]['k'] - params.delta = fit_line.iloc[0]['delta'] - params.sigma = fit_line.iloc[0]['sigma'] + params.m = fit_line.iloc[0]["m"] + params.k = fit_line.iloc[0]["k"] + params.delta = fit_line.iloc[0]["delta"] + params.sigma = fit_line.iloc[0]["sigma"] # Retrieve the corresponding FTR ECDF ftr_ecdf = get_ftr_ecdf(params, len(ref_data), db=True) # Compute the AD measure - ad_meas = compute_anderson_darling_measure( - np.sort(ref_data['gain']), ftr_ecdf) + ad_meas = compute_anderson_darling_measure(np.sort(ref_data["gain"]), ftr_ecdf) ad_measures.append(np.sqrt(ad_meas)) - sns.ecdfplot(data=ref_data, x='gain', - label='38.901 reference model') - sns.ecdfplot( - ftr_ecdf, label=f'Fitted FTR, sqrt(AD)={round(np.sqrt(ad_meas), 2)}') - plt.xlabel( - 'End-to-end channel gain due to small scale fading [dB]') + sns.ecdfplot(data=ref_data, x="gain", label="38.901 reference model") + sns.ecdfplot(ftr_ecdf, label=f"Fitted FTR, sqrt(AD)={round(np.sqrt(ad_meas), 2)}") + plt.xlabel("End-to-end channel gain due to small scale fading [dB]") plt.legend() plt.savefig( - f'{figs_folder}{params_comb[0]}_{params_comb[1]}_{params_comb[2]/1e9}GHz_fit.png', dpi=500, bbox_inches='tight') + f"{figs_folder}{params_comb[0]}_{params_comb[1]}_{params_comb[2]/1e9}GHz_fit.png", + dpi=500, + bbox_inches="tight", + ) plt.clf() # Plot ECDF of the scaled and normalized AD measures - sns.ecdfplot(ad_measures, label='AD measures') - plt.xlabel('Anderson-Darling goodness-of-fit') + sns.ecdfplot(ad_measures, label="AD measures") + plt.xlabel("Anderson-Darling goodness-of-fit") plt.legend() - plt.savefig(f'{figs_folder}AD_measures.png', - dpi=500, bbox_inches='tight') + plt.savefig(f"{figs_folder}AD_measures.png", dpi=500, bbox_inches="tight") plt.clf() diff --git a/src/tap-bridge/examples/tap-csma-virtual-machine.py b/src/tap-bridge/examples/tap-csma-virtual-machine.py index 93c6350d7..4f96860dd 100644 --- a/src/tap-bridge/examples/tap-csma-virtual-machine.py +++ b/src/tap-bridge/examples/tap-csma-virtual-machine.py @@ -27,8 +27,8 @@ except ModuleNotFoundError: " or your PYTHONPATH might not be properly configured" ) -def main(argv): +def main(argv): ns.core.CommandLine().Parse(argv) # @@ -36,7 +36,9 @@ def main(argv): # interact in real-time and therefore we have to use the real-time simulator # and take the time to calculate checksums. # - ns.core.GlobalValue.Bind("SimulatorImplementationType", ns.core.StringValue("ns3::RealtimeSimulatorImpl")) + ns.core.GlobalValue.Bind( + "SimulatorImplementationType", ns.core.StringValue("ns3::RealtimeSimulatorImpl") + ) ns.core.GlobalValue.Bind("ChecksumEnabled", ns.core.BooleanValue(True)) # @@ -45,7 +47,7 @@ def main(argv): # the right side. # nodes = ns.network.NodeContainer() - nodes.Create (2) + nodes.Create(2) # # Use a CsmaHelper to get a CSMA channel created, and the needed net @@ -64,24 +66,25 @@ def main(argv): # for this configuration. # tapBridge = ns.tap_bridge.TapBridgeHelper() - tapBridge.SetAttribute ("Mode", ns.core.StringValue ("UseLocal")) - tapBridge.SetAttribute ("DeviceName", ns.core.StringValue ("tap-left")) - tapBridge.Install (nodes.Get (0), devices.Get (0)) + tapBridge.SetAttribute("Mode", ns.core.StringValue("UseLocal")) + tapBridge.SetAttribute("DeviceName", ns.core.StringValue("tap-left")) + tapBridge.Install(nodes.Get(0), devices.Get(0)) # # Connect the right side tap to the right side wifi device on the right-side # ghost node. # - tapBridge.SetAttribute ("DeviceName", ns.core.StringValue ("tap-right")) - tapBridge.Install (nodes.Get (1), devices.Get (1)) + tapBridge.SetAttribute("DeviceName", ns.core.StringValue("tap-right")) + tapBridge.Install(nodes.Get(1), devices.Get(1)) # # Run the simulation for ten minutes to give the user time to play around # - ns.core.Simulator.Stop (ns.core.Seconds (600)) - ns.core.Simulator.Run()#signal_check_frequency = -1 + ns.core.Simulator.Stop(ns.core.Seconds(600)) + ns.core.Simulator.Run() # signal_check_frequency = -1 ns.core.Simulator.Destroy() return 0 -if __name__ == '__main__': + +if __name__ == "__main__": sys.exit(main(sys.argv)) diff --git a/src/tap-bridge/examples/tap-wifi-virtual-machine.py b/src/tap-bridge/examples/tap-wifi-virtual-machine.py index ea72e2a48..82d3cc4d4 100644 --- a/src/tap-bridge/examples/tap-wifi-virtual-machine.py +++ b/src/tap-bridge/examples/tap-wifi-virtual-machine.py @@ -17,6 +17,7 @@ # import sys + try: from ns import ns except ModuleNotFoundError: @@ -26,8 +27,8 @@ except ModuleNotFoundError: " or your PYTHONPATH might not be properly configured" ) -def main(argv): +def main(argv): ns.core.CommandLine().Parse(argv) # @@ -35,7 +36,9 @@ def main(argv): # interact in real-time and therefore we have to use the real-time simulator # and take the time to calculate checksums. # - ns.core.GlobalValue.Bind("SimulatorImplementationType", ns.core.StringValue("ns3::RealtimeSimulatorImpl")) + ns.core.GlobalValue.Bind( + "SimulatorImplementationType", ns.core.StringValue("ns3::RealtimeSimulatorImpl") + ) ns.core.GlobalValue.Bind("ChecksumEnabled", ns.core.BooleanValue(True)) # @@ -44,20 +47,22 @@ def main(argv): # the right side. # nodes = ns.network.NodeContainer() - nodes.Create (2); + nodes.Create(2) # # We're going to use 802.11 A so set up a wifi helper to reflect that. # wifi = ns.wifi.WifiHelper() - wifi.SetStandard (ns.wifi.WIFI_STANDARD_80211a); - wifi.SetRemoteStationManager ("ns3::ConstantRateWifiManager", "DataMode", ns.core.StringValue ("OfdmRate54Mbps")); + wifi.SetStandard(ns.wifi.WIFI_STANDARD_80211a) + wifi.SetRemoteStationManager( + "ns3::ConstantRateWifiManager", "DataMode", ns.core.StringValue("OfdmRate54Mbps") + ) # # No reason for pesky access points, so we'll use an ad-hoc network. # wifiMac = ns.wifi.WifiMacHelper() - wifiMac.SetType ("ns3::AdhocWifiMac"); + wifiMac.SetType("ns3::AdhocWifiMac") # # Configure the physical layer. @@ -80,7 +85,7 @@ def main(argv): positionAlloc.Add(ns.core.Vector(0.0, 0.0, 0.0)) positionAlloc.Add(ns.core.Vector(5.0, 0.0, 0.0)) mobility.SetPositionAllocator(positionAlloc) - mobility.SetMobilityModel ("ns3::ConstantPositionMobilityModel") + mobility.SetMobilityModel("ns3::ConstantPositionMobilityModel") mobility.Install(nodes) # @@ -92,25 +97,25 @@ def main(argv): # for this configuration. # tapBridge = ns.tap_bridge.TapBridgeHelper() - tapBridge.SetAttribute ("Mode", ns.core.StringValue ("UseLocal")); - tapBridge.SetAttribute ("DeviceName", ns.core.StringValue ("tap-left")); - tapBridge.Install (nodes.Get (0), devices.Get (0)); + tapBridge.SetAttribute("Mode", ns.core.StringValue("UseLocal")) + tapBridge.SetAttribute("DeviceName", ns.core.StringValue("tap-left")) + tapBridge.Install(nodes.Get(0), devices.Get(0)) # # Connect the right side tap to the right side wifi device on the right-side # ghost node. # - tapBridge.SetAttribute ("DeviceName", ns.core.StringValue ("tap-right")); - tapBridge.Install (nodes.Get (1), devices.Get (1)); + tapBridge.SetAttribute("DeviceName", ns.core.StringValue("tap-right")) + tapBridge.Install(nodes.Get(1), devices.Get(1)) # # Run the simulation for ten minutes to give the user time to play around # - ns.core.Simulator.Stop (ns.core.Seconds (600)); - ns.core.Simulator.Run()#signal_check_frequency = -1 + ns.core.Simulator.Stop(ns.core.Seconds(600)) + ns.core.Simulator.Run() # signal_check_frequency = -1 ns.core.Simulator.Destroy() return 0 -if __name__ == '__main__': - sys.exit(main(sys.argv)) +if __name__ == "__main__": + sys.exit(main(sys.argv)) diff --git a/src/tap-bridge/test/examples-to-run.py b/src/tap-bridge/test/examples-to-run.py index 68c6cf080..3ca81e2bb 100644 --- a/src/tap-bridge/test/examples-to-run.py +++ b/src/tap-bridge/test/examples-to-run.py @@ -7,7 +7,7 @@ # # See test.py for more information. cpp_examples = [ - ("tap-wifi-dumbbell", "False", "True"), # Requires manual configuration + ("tap-wifi-dumbbell", "False", "True"), # Requires manual configuration ] # A list of Python examples to run in order to ensure that they remain @@ -17,6 +17,6 @@ cpp_examples = [ # # See test.py for more information. python_examples = [ - ("tap-csma-virtual-machine.py", "False"), # requires enable-sudo - ("tap-wifi-virtual-machine.py", "False"), # requires enable-sudo + ("tap-csma-virtual-machine.py", "False"), # requires enable-sudo + ("tap-wifi-virtual-machine.py", "False"), # requires enable-sudo ] diff --git a/src/traffic-control/test/examples-to-run.py b/src/traffic-control/test/examples-to-run.py index 74583f1cc..103e3854b 100644 --- a/src/traffic-control/test/examples-to-run.py +++ b/src/traffic-control/test/examples-to-run.py @@ -21,7 +21,11 @@ cpp_examples = [ ("adaptive-red-tests --testNumber=13", "True", "True"), ("adaptive-red-tests --testNumber=14", "True", "True"), ("adaptive-red-tests --testNumber=15", "True", "True"), - ("codel-vs-pfifo-asymmetric --routerWanQueueDiscType=PfifoFast --simDuration=10", "True", "True"), + ( + "codel-vs-pfifo-asymmetric --routerWanQueueDiscType=PfifoFast --simDuration=10", + "True", + "True", + ), ("codel-vs-pfifo-asymmetric --routerWanQueueDiscType=CoDel --simDuration=10", "True", "False"), ("codel-vs-pfifo-basic-test --queueDiscType=PfifoFast --simDuration=10", "True", "False"), ("codel-vs-pfifo-basic-test --queueDiscType=CoDel --simDuration=10", "True", "False"), diff --git a/src/visualizer/visualizer/__init__.py b/src/visualizer/visualizer/__init__.py index 7829ac513..ced8c69d4 100644 --- a/src/visualizer/visualizer/__init__.py +++ b/src/visualizer/visualizer/__init__.py @@ -2,14 +2,27 @@ from ns import * # Some useful tricks for visualizer # we need to check if the node has a mobility model, but we can't pass Ptr to python -ns.cppyy.cppdef("""using namespace ns3; bool hasMobilityModel(Ptr node){ return !(node->GetObject() == 0); };""") -ns.cppyy.cppdef("""using namespace ns3; Vector3D getNodePosition(Ptr node){ return node->GetObject()->GetPosition(); };""") -ns.cppyy.cppdef("""using namespace ns3; Ptr getNodeIpv4(Ptr node){ return node->GetObject(); };""") -ns.cppyy.cppdef("""using namespace ns3; Ptr getNodeIpv6(Ptr node){ return node->GetObject(); };""") -ns.cppyy.cppdef("""using namespace ns3; std::string getMobilityModelName(Ptr node){ return node->GetObject()->GetInstanceTypeId().GetName(); };""") -ns.cppyy.cppdef("""using namespace ns3; bool hasOlsr(Ptr node){ return !(node->GetObject() == 0); };""") -ns.cppyy.cppdef("""using namespace ns3; Ptr getNodeOlsr(Ptr node){ return node->GetObject(); };""") +ns.cppyy.cppdef( + """using namespace ns3; bool hasMobilityModel(Ptr node){ return !(node->GetObject() == 0); };""" +) +ns.cppyy.cppdef( + """using namespace ns3; Vector3D getNodePosition(Ptr node){ return node->GetObject()->GetPosition(); };""" +) +ns.cppyy.cppdef( + """using namespace ns3; Ptr getNodeIpv4(Ptr node){ return node->GetObject(); };""" +) +ns.cppyy.cppdef( + """using namespace ns3; Ptr getNodeIpv6(Ptr node){ return node->GetObject(); };""" +) +ns.cppyy.cppdef( + """using namespace ns3; std::string getMobilityModelName(Ptr node){ return node->GetObject()->GetInstanceTypeId().GetName(); };""" +) +ns.cppyy.cppdef( + """using namespace ns3; bool hasOlsr(Ptr node){ return !(node->GetObject() == 0); };""" +) +ns.cppyy.cppdef( + """using namespace ns3; Ptr getNodeOlsr(Ptr node){ return node->GetObject(); };""" +) -from .core import start, register_plugin, set_bounds, add_initialization_hook - +from .core import add_initialization_hook, register_plugin, set_bounds, start diff --git a/src/visualizer/visualizer/base.py b/src/visualizer/visualizer/base.py index 98bacc887..12160de04 100644 --- a/src/visualizer/visualizer/base.py +++ b/src/visualizer/visualizer/base.py @@ -1,8 +1,10 @@ -from gi.repository import GObject import os.path import sys -PIXELS_PER_METER = 3.0 # pixels-per-meter, at 100% zoom level +from gi.repository import GObject + +PIXELS_PER_METER = 3.0 # pixels-per-meter, at 100% zoom level + ## PyVizObject class class PyVizObject(GObject.GObject): @@ -16,6 +18,7 @@ class PyVizObject(GObject.GObject): def tooltip_query(self, tooltip): tooltip.set_text("TODO: tooltip for %r" % self) + ## Link class class Link(PyVizObject): pass @@ -29,6 +32,7 @@ class InformationWindow(object): def update(self): raise NotImplementedError + ## NetDeviceTraits class class NetDeviceTraits(object): ## class variables @@ -47,6 +51,7 @@ class NetDeviceTraits(object): self.is_wireless = is_wireless self.is_virtual = is_virtual + netdevice_traits = { ns.PointToPointNetDevice: NetDeviceTraits(is_wireless=False), ns.CsmaNetDevice: NetDeviceTraits(is_wireless=False), @@ -60,36 +65,42 @@ netdevice_traits = { ns.LteEnbNetDevice: NetDeviceTraits(is_wireless=True), } + def lookup_netdevice_traits(class_type): try: return netdevice_traits[class_type] except KeyError: - sys.stderr.write("WARNING: no NetDeviceTraits registered for device type %r; " - "I will assume this is a non-virtual wireless device, " - "but you should edit %r, variable 'netdevice_traits'," - " to make sure.\n" % (class_type.__name__, __file__)) + sys.stderr.write( + "WARNING: no NetDeviceTraits registered for device type %r; " + "I will assume this is a non-virtual wireless device, " + "but you should edit %r, variable 'netdevice_traits'," + " to make sure.\n" % (class_type.__name__, __file__) + ) t = NetDeviceTraits(is_virtual=False, is_wireless=True) netdevice_traits[class_type] = t return t + def transform_distance_simulation_to_canvas(d): - return d*PIXELS_PER_METER + return d * PIXELS_PER_METER + def transform_point_simulation_to_canvas(x, y): - return x*PIXELS_PER_METER, y*PIXELS_PER_METER + return x * PIXELS_PER_METER, y * PIXELS_PER_METER + def transform_distance_canvas_to_simulation(d): - return d/PIXELS_PER_METER + return d / PIXELS_PER_METER + def transform_point_canvas_to_simulation(x, y): - return x/PIXELS_PER_METER, y/PIXELS_PER_METER - - + return x / PIXELS_PER_METER, y / PIXELS_PER_METER plugins = [] plugin_modules = {} + def register_plugin(plugin_init_func, plugin_name=None, plugin_module=None): """ Register a plugin. @@ -102,18 +113,21 @@ def register_plugin(plugin_init_func, plugin_name=None, plugin_module=None): if plugin_module is not None: plugin_modules[plugin_name] = plugin_module + plugins_loaded = False + + def load_plugins(): global plugins_loaded if plugins_loaded: return plugins_loaded = True - plugins_dir = os.path.join(os.path.dirname(__file__), 'plugins') + plugins_dir = os.path.join(os.path.dirname(__file__), "plugins") old_path = list(sys.path) sys.path.insert(0, plugins_dir) for filename in os.listdir(plugins_dir): name, ext = os.path.splitext(filename) - if ext != '.py': + if ext != ".py": continue try: plugin_module = __import__(name) @@ -125,7 +139,6 @@ def load_plugins(): except AttributeError: print("Plugin %r has no 'register' function" % name, file=sys.stderr) else: - #print("Plugin %r registered" % name, file=sys.stderr) + # print("Plugin %r registered" % name, file=sys.stderr) register_plugin(plugin_func, name, plugin_module) sys.path = old_path - diff --git a/src/visualizer/visualizer/core.py b/src/visualizer/visualizer/core.py index e31662635..80cdcb720 100644 --- a/src/visualizer/visualizer/core.py +++ b/src/visualizer/visualizer/core.py @@ -1,10 +1,12 @@ # -*- Mode: python; coding: utf-8 -*- from ctypes import c_double -LAYOUT_ALGORITHM = 'neato' # ['neato'|'dot'|'twopi'|'circo'|'fdp'|'nop'] +LAYOUT_ALGORITHM = "neato" # ['neato'|'dot'|'twopi'|'circo'|'fdp'|'nop'] REPRESENT_CHANNELS_AS_NODES = 1 -DEFAULT_NODE_SIZE = 1.0 # default node size in meters -DEFAULT_TRANSMISSIONS_MEMORY = 5 # default number of of past intervals whose transmissions are remembered +DEFAULT_NODE_SIZE = 1.0 # default node size in meters +DEFAULT_TRANSMISSIONS_MEMORY = ( + 5 # default number of of past intervals whose transmissions are remembered +) BITRATE_FONT_SIZE = 10 # internal constants, normally not meant to be changed @@ -12,8 +14,9 @@ SAMPLE_PERIOD = 0.1 PRIORITY_UPDATE_MODEL = -100 PRIORITY_UPDATE_VIEW = 200 -import warnings import platform +import warnings + if platform.system() == "Windows": SHELL_FONT = "Lucida Console 9" else: @@ -52,16 +55,12 @@ except ImportError: svgitem = None try: - gi.require_version('GooCanvas', '2.0') - gi.require_version('Gtk', '3.0') - gi.require_version('Gdk', '3.0') + gi.require_version("GooCanvas", "2.0") + gi.require_version("Gtk", "3.0") + gi.require_version("Gdk", "3.0") gi.require_foreign("cairo") - from gi.repository import GObject - from gi.repository import GLib - from gi.repository import Gtk - from gi.repository import Gdk - from gi.repository import Pango - from gi.repository import GooCanvas + from gi.repository import Gdk, GLib, GObject, GooCanvas, Gtk, Pango + from . import hud except ImportError as e: _import_error = e @@ -73,13 +72,24 @@ try: except ImportError: ipython_view = None -from .base import InformationWindow, PyVizObject, Link, lookup_netdevice_traits, PIXELS_PER_METER -from .base import transform_distance_simulation_to_canvas, transform_point_simulation_to_canvas -from .base import transform_distance_canvas_to_simulation, transform_point_canvas_to_simulation -from .base import load_plugins, register_plugin, plugins +from .base import ( + PIXELS_PER_METER, + InformationWindow, + Link, + PyVizObject, + load_plugins, + lookup_netdevice_traits, + plugins, + register_plugin, + transform_distance_canvas_to_simulation, + transform_distance_simulation_to_canvas, + transform_point_canvas_to_simulation, + transform_point_simulation_to_canvas, +) + +PI_OVER_2 = math.pi / 2 +PI_TIMES_2 = math.pi * 2 -PI_OVER_2 = math.pi/2 -PI_TIMES_2 = math.pi*2 ## Node class class Node(PyVizObject): @@ -122,7 +132,7 @@ class Node(PyVizObject): ## the first signal parameter is a python list of strings, to which ## information can be appended __gsignals__ = { - 'query-extra-tooltip-info': (GObject.SignalFlags.RUN_LAST, None, (object,)), + "query-extra-tooltip-info": (GObject.SignalFlags.RUN_LAST, None, (object,)), } def __init__(self, visualizer, node_index): @@ -141,7 +151,7 @@ class Node(PyVizObject): self._has_mobility = None self._selected = False self._highlighted = False - self._color = 0x808080ff + self._color = 0x808080FF self._size = DEFAULT_NODE_SIZE self.canvas_item.connect("enter-notify-event", self.on_enter_notify_event) self.canvas_item.connect("leave-notify-event", self.on_leave_notify_event) @@ -152,7 +162,7 @@ class Node(PyVizObject): self._label = None self._label_canvas_item = None - self._update_appearance() # call this last + self._update_appearance() # call this last def set_svg_icon(self, file_base_name, width=None, height=None, align_x=0.5, align_y=0.5): """! @@ -191,9 +201,9 @@ class Node(PyVizObject): if height is not None: self.svg_item.props.height = transform_distance_simulation_to_canvas(height) - #threshold1 = 10.0/self.svg_item.props.height - #threshold2 = 10.0/self.svg_item.props.width - #self.svg_item.props.visibility_threshold = min(threshold1, threshold2) + # threshold1 = 10.0/self.svg_item.props.height + # threshold2 = 10.0/self.svg_item.props.width + # self.svg_item.props.visibility_threshold = min(threshold1, threshold2) self.svg_align_x = align_x self.svg_align_y = align_y @@ -224,9 +234,9 @@ class Node(PyVizObject): """ w = self.svg_item.width h = self.svg_item.height - self.svg_item.set_properties(x=(x - (1-self.svg_align_x)*w), - y=(y - (1-self.svg_align_y)*h)) - + self.svg_item.set_properties( + x=(x - (1 - self.svg_align_x) * w), y=(y - (1 - self.svg_align_y) * h) + ) def tooltip_query(self, tooltip): """! @@ -242,52 +252,62 @@ class Node(PyVizObject): ipv4 = ns.cppyy.gbl.getNodeIpv4(ns3_node) ipv6 = ns.cppyy.gbl.getNodeIpv6(ns3_node) - name = 'Node %i' % self.node_index - node_name = ns.Names.FindName (ns3_node) - if len(node_name)!=0: - name += ' (' + node_name + ')' + name = "Node %i" % self.node_index + node_name = ns.Names.FindName(ns3_node) + if len(node_name) != 0: + name += " (" + node_name + ")" lines = [name] - lines.append('') + lines.append("") self.emit("query-extra-tooltip-info", lines) mob = ns.cppyy.gbl.hasMobilityModel(ns3_node) if mob: mobility_model_name = ns.cppyy.gbl.getMobilityModelName(ns3_node) - lines.append(' Mobility Model: %s' % ns.cppyy.gbl.getMobilityModelName(ns3_node)) + lines.append( + " Mobility Model: %s" % ns.cppyy.gbl.getMobilityModelName(ns3_node) + ) for devI in range(ns3_node.GetNDevices()): - lines.append('') - lines.append(' NetDevice %i:' % devI) + lines.append("") + lines.append(" NetDevice %i:" % devI) dev = ns3_node.GetDevice(devI) name = ns.Names.FindName(dev) if name: - lines.append(' Name: %s' % name) + lines.append(" Name: %s" % name) devname = dev.GetInstanceTypeId().GetName() - lines.append(' Type: %s' % devname) + lines.append(" Type: %s" % devname) if ipv4 is not None: ipv4_idx = ipv4.GetInterfaceForDevice(dev) if ipv4_idx != -1: addresses = [ - '%s/%s' % (ipv4.GetAddress(ipv4_idx, i).GetLocal(), - ipv4.GetAddress(ipv4_idx, i).GetMask()) - for i in range(ipv4.GetNAddresses(ipv4_idx))] - lines.append(' IPv4 Addresses: %s' % '; '.join(addresses)) + "%s/%s" + % ( + ipv4.GetAddress(ipv4_idx, i).GetLocal(), + ipv4.GetAddress(ipv4_idx, i).GetMask(), + ) + for i in range(ipv4.GetNAddresses(ipv4_idx)) + ] + lines.append(" IPv4 Addresses: %s" % "; ".join(addresses)) if ipv6 is not None: ipv6_idx = ipv6.GetInterfaceForDevice(dev) if ipv6_idx != -1: addresses = [ - '%s/%s' % (ipv6.GetAddress(ipv6_idx, i).GetAddress(), - ipv6.GetAddress(ipv6_idx, i).GetPrefix()) - for i in range(ipv6.GetNAddresses(ipv6_idx))] - lines.append(' IPv6 Addresses: %s' % '; '.join(addresses)) + "%s/%s" + % ( + ipv6.GetAddress(ipv6_idx, i).GetAddress(), + ipv6.GetAddress(ipv6_idx, i).GetPrefix(), + ) + for i in range(ipv6.GetNAddresses(ipv6_idx)) + ] + lines.append(" IPv6 Addresses: %s" % "; ".join(addresses)) - lines.append(' MAC Address: %s' % (dev.GetAddress(),)) + lines.append(" MAC Address: %s" % (dev.GetAddress(),)) - tooltip.set_markup('\n'.join(lines)) + tooltip.set_markup("\n".join(lines)) finally: self.visualizer.simulation.lock.release() @@ -327,6 +347,7 @@ class Node(PyVizObject): """ self._selected = value self._update_appearance() + def _get_selected(self): """! Get selected function. @@ -348,6 +369,7 @@ class Node(PyVizObject): """ self._highlighted = value self._update_appearance() + def _get_highlighted(self): """! Get highlighted function. @@ -382,33 +404,37 @@ class Node(PyVizObject): if self.svg_item is not None: alpha = 0x80 else: - alpha = 0xff - fill_color_rgba = (self._color & 0xffffff00) | alpha - self.canvas_item.set_properties(radius_x=size, radius_y=size, - fill_color_rgba=fill_color_rgba) + alpha = 0xFF + fill_color_rgba = (self._color & 0xFFFFFF00) | alpha + self.canvas_item.set_properties( + radius_x=size, radius_y=size, fill_color_rgba=fill_color_rgba + ) if self._selected: - line_width = size*.3 + line_width = size * 0.3 else: - line_width = size*.15 + line_width = size * 0.15 if self.highlighted: - stroke_color = 'yellow' + stroke_color = "yellow" else: - stroke_color = 'black' + stroke_color = "black" self.canvas_item.set_properties(line_width=line_width, stroke_color=stroke_color) if self._label is not None: if self._label_canvas_item is None: - self._label_canvas_item = GooCanvas.CanvasText(visibility_threshold=0.5, - font="Sans Serif 10", - fill_color_rgba=0x808080ff, - alignment=Pango.Alignment.CENTER, - anchor=GooCanvas.CanvasAnchorType.N, - parent=self.visualizer.canvas.get_root_item(), - pointer_events=GooCanvas.CanvasPointerEvents.NONE) + self._label_canvas_item = GooCanvas.CanvasText( + visibility_threshold=0.5, + font="Sans Serif 10", + fill_color_rgba=0x808080FF, + alignment=Pango.Alignment.CENTER, + anchor=GooCanvas.CanvasAnchorType.N, + parent=self.visualizer.canvas.get_root_item(), + pointer_events=GooCanvas.CanvasPointerEvents.NONE, + ) self._label_canvas_item.lower(None) - self._label_canvas_item.set_properties(visibility=GooCanvas.CanvasItemVisibility.VISIBLE_ABOVE_THRESHOLD, - text=self._label) + self._label_canvas_item.set_properties( + visibility=GooCanvas.CanvasItemVisibility.VISIBLE_ABOVE_THRESHOLD, text=self._label + ) self._update_position() def set_position(self, x, y): @@ -429,7 +455,7 @@ class Node(PyVizObject): link.update_points() if self._label_canvas_item is not None: - self._label_canvas_item.set_properties(x=x, y=(y+self._size*3)) + self._label_canvas_item.set_properties(x=x, y=(y + self._size * 3)) # If the location of the point is now beyond the bounds of the # canvas then those bounds now need to be increased @@ -458,7 +484,10 @@ class Node(PyVizObject): @param self: class object. @return x and y position """ - return (self.canvas_item.get_property("center_x"), self.canvas_item.get_property("center_y")) + return ( + self.canvas_item.get_property("center_x"), + self.canvas_item.get_property("center_y"), + ) def _update_position(self): """! @@ -480,7 +509,12 @@ class Node(PyVizObject): """ if isinstance(color, str): color = Gdk.color_parse(color) - color = ((color.red>>8) << 24) | ((color.green>>8) << 16) | ((color.blue>>8) << 8) | 0xff + color = ( + ((color.red >> 8) << 24) + | ((color.green >> 8) << 16) + | ((color.blue >> 8) << 8) + | 0xFF + ) self._color = color self._update_appearance() @@ -537,11 +571,15 @@ class Channel(PyVizObject): @param channel: channel. """ self.channel = channel - self.canvas_item = GooCanvas.CanvasEllipse(radius_x=30, radius_y=30, - fill_color="white", - stroke_color="grey", line_width=2.0, - line_dash=GooCanvas.CanvasLineDash.newv([10.0, 10.0 ]), - visibility=GooCanvas.CanvasItemVisibility.VISIBLE) + self.canvas_item = GooCanvas.CanvasEllipse( + radius_x=30, + radius_y=30, + fill_color="white", + stroke_color="grey", + line_width=2.0, + line_dash=GooCanvas.CanvasLineDash.newv([10.0, 10.0]), + visibility=GooCanvas.CanvasItemVisibility.VISIBLE, + ) self.canvas_item.pyviz_object = self self.links = [] @@ -567,7 +605,10 @@ class Channel(PyVizObject): @param self: class object. @return x / y position. """ - return (self.canvas_item.get_property("center_x"), self.canvas_item.get_property("center_y")) + return ( + self.canvas_item.get_property("center_x"), + self.canvas_item.get_property("center_y"), + ) ## WiredLink @@ -633,11 +674,11 @@ class SimulationThread(threading.Thread): """ super(SimulationThread, self).__init__() assert isinstance(viz, Visualizer) - self.viz = viz # Visualizer object + self.viz = viz # Visualizer object self.lock = threading.Lock() self.go = threading.Event() self.go.clear() - self.target_time = 0 # in seconds + self.target_time = 0 # in seconds self.quit = False self.sim_helper = ns.PyViz() self.pause_messages = [] @@ -664,30 +705,31 @@ class SimulationThread(threading.Thread): @return none """ while not self.quit: - #print "sim: Wait for go" - self.go.wait() # wait until the main (view) thread gives us the go signal + # print "sim: Wait for go" + self.go.wait() # wait until the main (view) thread gives us the go signal self.go.clear() if self.quit: break - #self.go.clear() - #print "sim: Acquire lock" + # self.go.clear() + # print "sim: Acquire lock" self.lock.acquire() try: if 0: if ns3.Simulator.IsFinished(): self.viz.play_button.set_sensitive(False) break - #print "sim: Current time is %f; Run until: %f" % (ns3.Simulator.Now ().GetSeconds (), self.target_time) - #if ns3.Simulator.Now ().GetSeconds () > self.target_time: + # print "sim: Current time is %f; Run until: %f" % (ns3.Simulator.Now ().GetSeconds (), self.target_time) + # if ns3.Simulator.Now ().GetSeconds () > self.target_time: # print "skipping, model is ahead of view!" self.sim_helper.SimulatorRunUntil(ns.Seconds(self.target_time)) - #print "sim: Run until ended at current time: ", ns3.Simulator.Now ().GetSeconds () + # print "sim: Run until ended at current time: ", ns3.Simulator.Now ().GetSeconds () self.pause_messages.extend(self.sim_helper.GetPauseMessages()) GLib.idle_add(self.viz.update_model, priority=PRIORITY_UPDATE_MODEL) - #print "sim: Run until: ", self.target_time, ": finished." + # print "sim: Run until: ", self.target_time, ": finished." finally: self.lock.release() - #print "sim: Release lock, loop." + # print "sim: Release lock, loop." + ## ShowTransmissionsMode class ShowTransmissionsMode(object): @@ -700,10 +742,13 @@ class ShowTransmissionsMode(object): ## enumeration __slots__ = [] + + ShowTransmissionsMode.ALL = ShowTransmissionsMode() ShowTransmissionsMode.NONE = ShowTransmissionsMode() ShowTransmissionsMode.SELECTED = ShowTransmissionsMode() + ## Visualizer class Visualizer(GObject.GObject): ## @var INSTANCE @@ -712,20 +757,22 @@ class Visualizer(GObject.GObject): if _import_error is None: __gsignals__ = { - # signal emitted whenever a right-click-on-node popup menu is being constructed - 'populate-node-menu': (GObject.SignalFlags.RUN_LAST, None, (object, Gtk.Menu,)), - + "populate-node-menu": ( + GObject.SignalFlags.RUN_LAST, + None, + ( + object, + Gtk.Menu, + ), + ), # signal emitted after every simulation period (SAMPLE_PERIOD seconds of simulated time) # the simulation lock is acquired while the signal is emitted - 'simulation-periodic-update': (GObject.SignalFlags.RUN_LAST, None, ()), - + "simulation-periodic-update": (GObject.SignalFlags.RUN_LAST, None, ()), # signal emitted right after the topology is scanned - 'topology-scanned': (GObject.SignalFlags.RUN_LAST, None, ()), - + "topology-scanned": (GObject.SignalFlags.RUN_LAST, None, ()), # signal emitted when it's time to update the view objects - 'update-view': (GObject.SignalFlags.RUN_LAST, None, ()), - + "update-view": (GObject.SignalFlags.RUN_LAST, None, ()), } def __init__(self): @@ -738,14 +785,14 @@ class Visualizer(GObject.GObject): assert Visualizer.INSTANCE is None Visualizer.INSTANCE = self super(Visualizer, self).__init__() - self.nodes = {} # node index -> Node - self.channels = {} # id(ns3.Channel) -> Channel - self.window = None # toplevel window - self.canvas = None # GooCanvas.Canvas - self.time_label = None # Gtk.Label - self.play_button = None # Gtk.ToggleButton - self.zoom = None # Gtk.Adjustment - self._scrolled_window = None # Gtk.ScrolledWindow + self.nodes = {} # node index -> Node + self.channels = {} # id(ns3.Channel) -> Channel + self.window = None # toplevel window + self.canvas = None # GooCanvas.Canvas + self.time_label = None # Gtk.Label + self.play_button = None # Gtk.ToggleButton + self.zoom = None # Gtk.Adjustment + self._scrolled_window = None # Gtk.ScrolledWindow self.links_group = GooCanvas.CanvasGroup() self.channels_group = GooCanvas.CanvasGroup() @@ -753,7 +800,7 @@ class Visualizer(GObject.GObject): self._update_timeout_id = None self.simulation = SimulationThread(self) - self.selected_node = None # node currently selected + self.selected_node = None # node currently selected self.speed = 1.0 self.information_windows = [] self._transmission_arrows = [] @@ -811,9 +858,9 @@ class Visualizer(GObject.GObject): main_hbox1 = GObject.new(Gtk.HBox, border_width=8, visible=True) main_vbox.pack_start(main_hbox1, True, True, 0) - show_transmissions_group = GObject.new(Gtk.HeaderBar, - title="Show transmissions", - visible=True) + show_transmissions_group = GObject.new( + Gtk.HeaderBar, title="Show transmissions", visible=True + ) main_hbox1.pack_start(show_transmissions_group, False, False, 8) vbox = Gtk.VBox(homogeneous=True, spacing=4) @@ -841,16 +888,19 @@ class Visualizer(GObject.GObject): def toggled(radio): if radio.get_active(): self.set_show_transmissions_mode(ShowTransmissionsMode.ALL) + all_nodes.connect("toggled", toggled) def toggled(radio): if radio.get_active(): self.set_show_transmissions_mode(ShowTransmissionsMode.NONE) + no_node.connect("toggled", toggled) def toggled(radio): if radio.get_active(): self.set_show_transmissions_mode(ShowTransmissionsMode.SELECTED) + selected_node.connect("toggled", toggled) # -- misc settings @@ -866,9 +916,11 @@ class Visualizer(GObject.GObject): vbox.pack_start(GObject.new(Gtk.Label, label="Node Size", visible=True), True, True, 0) settings_hbox.pack_start(vbox, False, False, 6) self.node_size_adjustment = scale.get_adjustment() + def node_size_changed(adj): for node in self.nodes.values(): node.set_size(adj.get_value()) + self.node_size_adjustment.connect("value-changed", node_size_changed) self.node_size_adjustment.set_lower(0.01) self.node_size_adjustment.set_upper(20) @@ -879,14 +931,16 @@ class Visualizer(GObject.GObject): vbox = GObject.new(Gtk.VBox, border_width=0, visible=True) scale = GObject.new(Gtk.HScale, visible=True, digits=1) vbox.pack_start(scale, True, True, 0) - vbox.pack_start(GObject.new(Gtk.Label, label="Tx. Smooth Factor (s)", visible=True), True, True, 0) + vbox.pack_start( + GObject.new(Gtk.Label, label="Tx. Smooth Factor (s)", visible=True), True, True, 0 + ) settings_hbox.pack_start(vbox, False, False, 6) self.transmissions_smoothing_adjustment = scale.get_adjustment() adj = self.transmissions_smoothing_adjustment adj.set_lower(0.1) adj.set_upper(10) adj.set_step_increment(0.1) - adj.set_value(DEFAULT_TRANSMISSIONS_MEMORY*0.1) + adj.set_value(DEFAULT_TRANSMISSIONS_MEMORY * 0.1) return expander @@ -894,7 +948,7 @@ class Visualizer(GObject.GObject): class _PanningState(object): ## @var __slots__ # internal variables - __slots__ = ['initial_mouse_pos', 'initial_canvas_pos', 'motion_signal'] + __slots__ = ["initial_mouse_pos", "initial_canvas_pos", "motion_signal"] def _begin_panning(self, widget, event): """! @@ -913,7 +967,9 @@ class Visualizer(GObject.GObject): x = self._scrolled_window.get_hadjustment().get_value() y = self._scrolled_window.get_vadjustment().get_value() self._panning_state.initial_canvas_pos = (x, y) - self._panning_state.motion_signal = self.canvas.connect("motion-notify-event", self._panning_motion) + self._panning_state.motion_signal = self.canvas.connect( + "motion-notify-event", self._panning_motion + ) def _end_panning(self, event): """! @@ -979,6 +1035,7 @@ class Visualizer(GObject.GObject): def get_hadjustment(self): return self._scrolled_window.get_hadjustment() + def get_vadjustment(self): return self._scrolled_window.get_vadjustment() @@ -996,7 +1053,8 @@ class Visualizer(GObject.GObject): self.canvas.props.has_tooltip = True self.canvas.connect("query-tooltip", self._canvas_tooltip_cb) self.canvas.show() - sw = Gtk.ScrolledWindow(); sw.show() + sw = Gtk.ScrolledWindow() + sw.show() self._scrolled_window = sw sw.add(self.canvas) vbox.pack_start(sw, True, True, 4) @@ -1004,7 +1062,6 @@ class Visualizer(GObject.GObject): self.canvas.set_bounds(-10000, -10000, 10000, 10000) self.canvas.scroll_to(0, 0) - self.canvas.get_root_item().add_child(self.links_group, -1) self.links_group.set_property("visibility", GooCanvas.CanvasItemVisibility.VISIBLE) @@ -1018,17 +1075,24 @@ class Visualizer(GObject.GObject): self.hud = hud.Axes(self) - hbox = Gtk.HBox(); hbox.show() + hbox = Gtk.HBox() + hbox.show() vbox.pack_start(hbox, False, False, 4) # zoom - zoom_adj = Gtk.Adjustment(value=1.0, lower=0.01, upper=10.0, - step_increment=0.02, - page_increment=1.0, - page_size=1.0) + zoom_adj = Gtk.Adjustment( + value=1.0, + lower=0.01, + upper=10.0, + step_increment=0.02, + page_increment=1.0, + page_size=1.0, + ) self.zoom = zoom_adj + def _zoom_changed(adj): self.canvas.set_scale(adj.get_value()) + zoom_adj.connect("value-changed", _zoom_changed) zoom = Gtk.SpinButton.new(zoom_adj, 0.1, 1) zoom.set_digits(3) @@ -1038,13 +1102,15 @@ class Visualizer(GObject.GObject): _zoom_changed(zoom_adj) # speed - speed_adj = Gtk.Adjustment(value=1.0, lower=0.01, upper=10.0, - step_increment=0.02, - page_increment=1.0, page_size=0) + speed_adj = Gtk.Adjustment( + value=1.0, lower=0.01, upper=10.0, step_increment=0.02, page_increment=1.0, page_size=0 + ) + def _speed_changed(adj): self.speed = adj.get_value() - self.sample_period = SAMPLE_PERIOD*adj.get_value() + self.sample_period = SAMPLE_PERIOD * adj.get_value() self._start_update_timer() + speed_adj.connect("value-changed", _speed_changed) speed = Gtk.SpinButton.new(speed_adj, 1, 0) speed.set_digits(3) @@ -1059,10 +1125,13 @@ class Visualizer(GObject.GObject): hbox.pack_start(self.time_label, False, False, 4) # Screenshot button - screenshot_button = GObject.new(Gtk.Button, - label="Snapshot", - relief=Gtk.ReliefStyle.NONE, focus_on_click=False, - visible=True) + screenshot_button = GObject.new( + Gtk.Button, + label="Snapshot", + relief=Gtk.ReliefStyle.NONE, + focus_on_click=False, + visible=True, + ) hbox.pack_start(screenshot_button, False, False, 4) def load_button_icon(button, icon_name): @@ -1078,24 +1147,31 @@ class Visualizer(GObject.GObject): # Shell button if ipython_view is not None: - shell_button = GObject.new(Gtk.Button, - label="Shell", - relief=Gtk.ReliefStyle.NONE, focus_on_click=False, - visible=True) + shell_button = GObject.new( + Gtk.Button, + label="Shell", + relief=Gtk.ReliefStyle.NONE, + focus_on_click=False, + visible=True, + ) hbox.pack_start(shell_button, False, False, 4) load_button_icon(shell_button, "gnome-terminal") shell_button.connect("clicked", self._start_shell) # Play button - self.play_button = GObject.new(Gtk.ToggleButton, - label="Simulate (F3)", - relief=Gtk.ReliefStyle.NONE, focus_on_click=False, - visible=True) + self.play_button = GObject.new( + Gtk.ToggleButton, + label="Simulate (F3)", + relief=Gtk.ReliefStyle.NONE, + focus_on_click=False, + visible=True, + ) load_button_icon(self.play_button, "media-playback-start") accel_group = Gtk.AccelGroup() self.window.add_accel_group(accel_group) - self.play_button.add_accelerator("clicked", accel_group, - Gdk.KEY_F3, 0, Gtk.AccelFlags.VISIBLE) + self.play_button.add_accelerator( + "clicked", accel_group, Gdk.KEY_F3, 0, Gtk.AccelFlags.VISIBLE + ) self.play_button.connect("toggled", self._on_play_button_toggled) hbox.pack_start(self.play_button, False, False, 4) @@ -1125,7 +1201,10 @@ class Visualizer(GObject.GObject): for nodeI in range(ns.NodeList.GetNNodes()): seen_nodes += 1 if seen_nodes == 100: - print("scan topology... %i nodes visited (%.1f%%)" % (nodeI, 100*nodeI/ns.NodeList.GetNNodes())) + print( + "scan topology... %i nodes visited (%.1f%%)" + % (nodeI, 100 * nodeI / ns.NodeList.GetNNodes()) + ) seen_nodes = 0 node = ns.NodeList.GetNode(nodeI) node_name = "Node %i" % nodeI @@ -1136,7 +1215,7 @@ class Visualizer(GObject.GObject): node_view.set_color("red") pos = ns.cppyy.gbl.getNodePosition(node) node_view.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) - #print "node has mobility position -> ", "%f,%f" % (pos.x, pos.y) + # print "node has mobility position -> ", "%f,%f" % (pos.x, pos.y) else: graph.add_node(node_name) @@ -1181,12 +1260,12 @@ class Visualizer(GObject.GObject): print("scanning topology: calling graphviz layout") graph.layout(LAYOUT_ALGORITHM) for node in graph.iternodes(): - #print node, "=>", node.attr['pos'] - node_type, node_id = node.split(' ') - pos_x, pos_y = [float(s) for s in node.attr['pos'].split(',')] - if node_type == 'Node': + # print node, "=>", node.attr['pos'] + node_type, node_id = node.split(" ") + pos_x, pos_y = [float(s) for s in node.attr["pos"].split(",")] + if node_type == "Node": obj = self.nodes[int(node_id)] - elif node_type == 'Channel': + elif node_type == "Channel": obj = self.channels[int(node_id)] obj.set_position(pos_x, pos_y) @@ -1201,7 +1280,9 @@ class Visualizer(GObject.GObject): self.nodes[index] = node self.nodes_group.add_child(node.canvas_item, -1) node.canvas_item.connect("button-press-event", self.on_node_button_press_event, node) - node.canvas_item.connect("button-release-event", self.on_node_button_release_event, node) + node.canvas_item.connect( + "button-release-event", self.on_node_button_release_event, node + ) return node def get_channel(self, ns3_channel): @@ -1219,7 +1300,7 @@ class Visualizer(GObject.GObject): link.canvas_item.lower(None) def update_view(self): - #print "update_view" + # print "update_view" self.time_label.set_text("Time: %f s" % ns.Simulator.Now().GetSeconds()) @@ -1275,7 +1356,7 @@ class Visualizer(GObject.GObject): self.simulation.lock.release() def do_simulation_periodic_update(self): - smooth_factor = int(self.transmissions_smoothing_adjustment.get_value()*10) + smooth_factor = int(self.transmissions_smoothing_adjustment.get_value() * 10) transmissions = self.simulation.sim_helper.GetTransmissionSamples() self._last_transmissions.append(transmissions) @@ -1291,12 +1372,13 @@ class Visualizer(GObject.GObject): hadj = self._scrolled_window.get_hadjustment() vadj = self._scrolled_window.get_vadjustment() bounds_x1, bounds_y1 = self.canvas.convert_from_pixels(hadj.get_value(), vadj.get_value()) - bounds_x2, bounds_y2 = self.canvas.convert_from_pixels(hadj.get_value() + hadj.get_page_size(), - vadj.get_value() + vadj.get_page_size()) - ns.PyViz.LineClipping(bounds_x1, bounds_y1, - bounds_x2, bounds_y2, - pos1_x, pos1_y, pos2_x, pos2_y) - return (pos1_x.value + pos2_x.value)/2, (pos1_y.value + pos2_y.value)/2 + bounds_x2, bounds_y2 = self.canvas.convert_from_pixels( + hadj.get_value() + hadj.get_page_size(), vadj.get_value() + vadj.get_page_size() + ) + ns.PyViz.LineClipping( + bounds_x1, bounds_y1, bounds_x2, bounds_y2, pos1_x, pos1_y, pos2_x, pos2_y + ) + return (pos1_x.value + pos2_x.value) / 2, (pos1_y.value + pos2_y.value) / 2 def _update_transmissions_view(self): transmissions_average = {} @@ -1314,7 +1396,7 @@ class Visualizer(GObject.GObject): label.set_property("visibility", GooCanvas.CanvasItemVisibility.HIDDEN) new_arrows = [] - k = self.node_size_adjustment.get_value()/5 + k = self.node_size_adjustment.get_value() / 5 for (transmitter_id, receiver_id), (rx_bytes, rx_count) in transmissions_average.items(): transmitter = self.get_node(transmitter_id) @@ -1322,15 +1404,24 @@ class Visualizer(GObject.GObject): try: arrow, label = old_arrows.pop() except IndexError: - arrow = GooCanvas.CanvasPolyline(line_width=2.0, stroke_color_rgba=0x00C000C0, close_path=False, end_arrow=True, pointer_events=GooCanvas.CanvasPointerEvents.NONE) + arrow = GooCanvas.CanvasPolyline( + line_width=2.0, + stroke_color_rgba=0x00C000C0, + close_path=False, + end_arrow=True, + pointer_events=GooCanvas.CanvasPointerEvents.NONE, + ) arrow.set_property("parent", self.canvas.get_root_item()) arrow.raise_(None) - label = GooCanvas.CanvasText(parent=self.canvas.get_root_item(), pointer_events=GooCanvas.CanvasPointerEvents.NONE) + label = GooCanvas.CanvasText( + parent=self.canvas.get_root_item(), + pointer_events=GooCanvas.CanvasPointerEvents.NONE, + ) label.raise_(None) arrow.set_property("visibility", GooCanvas.CanvasItemVisibility.VISIBLE) - line_width = max(0.1, math.log(float(rx_bytes)/rx_count/self.sample_period)*k) + line_width = max(0.1, math.log(float(rx_bytes) / rx_count / self.sample_period) * k) arrow.set_property("line-width", line_width) pos1_x, pos1_y = transmitter.get_position() @@ -1340,40 +1431,49 @@ class Visualizer(GObject.GObject): points.set_point(1, pos2_x, pos2_y) arrow.set_property("points", points) - kbps = float(rx_bytes*8)/1e3/rx_count/self.sample_period - label.set_properties(visibility=GooCanvas.CanvasItemVisibility.VISIBLE_ABOVE_THRESHOLD, - visibility_threshold=0.5, - font=("Sans Serif %f" % int(1+BITRATE_FONT_SIZE*k))) + kbps = float(rx_bytes * 8) / 1e3 / rx_count / self.sample_period + label.set_properties( + visibility=GooCanvas.CanvasItemVisibility.VISIBLE_ABOVE_THRESHOLD, + visibility_threshold=0.5, + font=("Sans Serif %f" % int(1 + BITRATE_FONT_SIZE * k)), + ) angle = math.atan2((pos2_y - pos1_y), (pos2_x - pos1_x)) if -PI_OVER_2 <= angle <= PI_OVER_2: - label.set_properties(text=("%.2f kbit/s →" % (kbps,)), - alignment=Pango.Alignment.CENTER, - anchor=GooCanvas.CanvasAnchorType.S, - x=0, y=-line_width/2) + label.set_properties( + text=("%.2f kbit/s →" % (kbps,)), + alignment=Pango.Alignment.CENTER, + anchor=GooCanvas.CanvasAnchorType.S, + x=0, + y=-line_width / 2, + ) else: - label.set_properties(text=("← %.2f kbit/s" % (kbps,)), - alignment=Pango.Alignment.CENTER, - anchor=GooCanvas.CanvasAnchorType.N, - x=0, y=line_width/2) + label.set_properties( + text=("← %.2f kbit/s" % (kbps,)), + alignment=Pango.Alignment.CENTER, + anchor=GooCanvas.CanvasAnchorType.N, + x=0, + y=line_width / 2, + ) M = cairo.Matrix() - lx, ly = self._get_label_over_line_position(c_double(pos1_x), c_double(pos1_y), - c_double(pos2_x), c_double(pos2_y)) + lx, ly = self._get_label_over_line_position( + c_double(pos1_x), c_double(pos1_y), c_double(pos2_x), c_double(pos2_y) + ) M.translate(lx, ly) M.rotate(angle) try: label.set_transform(M) except KeyError: # https://gitlab.gnome.org/GNOME/pygobject/issues/16 - warnings.warn("PyGobject bug causing label position error; " - "should be fixed in PyGObject >= 3.29.1") - label.set_properties(x=(lx + label.props.x), - y=(ly + label.props.y)) + warnings.warn( + "PyGobject bug causing label position error; " + "should be fixed in PyGObject >= 3.29.1" + ) + label.set_properties(x=(lx + label.props.x), y=(ly + label.props.y)) new_arrows.append((arrow, label)) self._transmission_arrows = new_arrows + old_arrows - def _update_drops_view(self): drops_average = {} for drop_set in self._last_drops: @@ -1395,23 +1495,34 @@ class Visualizer(GObject.GObject): bottom_y = vadjustment.get_value() + vadjustment.get_page_size() dummy, edge_y = self.canvas.convert_from_pixels(0, bottom_y) - k = self.node_size_adjustment.get_value()/5 + k = self.node_size_adjustment.get_value() / 5 for transmitter_id, (drop_bytes, drop_count) in drops_average.items(): transmitter = self.get_node(transmitter_id) try: arrow, label = old_arrows.pop() except IndexError: - arrow = GooCanvas.CanvasPolyline(line_width=2.0, stroke_color_rgba=0xC00000C0, close_path=False, end_arrow=True, pointer_events=GooCanvas.CanvasPointerEvents.NONE) + arrow = GooCanvas.CanvasPolyline( + line_width=2.0, + stroke_color_rgba=0xC00000C0, + close_path=False, + end_arrow=True, + pointer_events=GooCanvas.CanvasPointerEvents.NONE, + ) arrow.set_property("parent", self.canvas.get_root_item()) arrow.raise_(None) - label = GooCanvas.CanvasText(pointer_events=GooCanvas.CanvasPointerEvents.NONE)#, fill_color_rgba=0x00C000C0) + label = GooCanvas.CanvasText( + pointer_events=GooCanvas.CanvasPointerEvents.NONE + ) # , fill_color_rgba=0x00C000C0) label.set_property("parent", self.canvas.get_root_item()) label.raise_(None) arrow.set_property("visibility", GooCanvas.CanvasItemVisibility.VISIBLE) - arrow.set_property("line-width", max(0.1, math.log(float(drop_bytes)/drop_count/self.sample_period)*k)) + arrow.set_property( + "line-width", + max(0.1, math.log(float(drop_bytes) / drop_count / self.sample_period) * k), + ) pos1_x, pos1_y = transmitter.get_position() pos2_x, pos2_y = pos1_x, edge_y points = GooCanvas.CanvasPoints.new(2) @@ -1419,21 +1530,24 @@ class Visualizer(GObject.GObject): points.set_point(1, pos2_x, pos2_y) arrow.set_property("points", points) - label.set_properties(visibility=GooCanvas.CanvasItemVisibility.VISIBLE_ABOVE_THRESHOLD, - visibility_threshold=0.5, - font=("Sans Serif %i" % int(1+BITRATE_FONT_SIZE*k)), - text=("%.2f kbit/s" % (float(drop_bytes*8)/1e3/drop_count/self.sample_period,)), - alignment=Pango.Alignment.CENTER, - x=(pos1_x + pos2_x)/2, - y=(pos1_y + pos2_y)/2) + label.set_properties( + visibility=GooCanvas.CanvasItemVisibility.VISIBLE_ABOVE_THRESHOLD, + visibility_threshold=0.5, + font=("Sans Serif %i" % int(1 + BITRATE_FONT_SIZE * k)), + text=( + "%.2f kbit/s" % (float(drop_bytes * 8) / 1e3 / drop_count / self.sample_period,) + ), + alignment=Pango.Alignment.CENTER, + x=(pos1_x + pos2_x) / 2, + y=(pos1_y + pos2_y) / 2, + ) new_arrows.append((arrow, label)) self._drop_arrows = new_arrows + old_arrows - def update_view_timeout(self): - #print "view: update_view_timeout called at real time ", time.time() + # print "view: update_view_timeout called at real time ", time.time() # while the simulator is busy, run the gtk event loop while not self.simulation.lock.acquire(False): @@ -1443,15 +1557,20 @@ class Visualizer(GObject.GObject): self.simulation.pause_messages = [] try: self.update_view() - self.simulation.target_time = ns.Simulator.Now ().GetSeconds () + self.sample_period - #print "view: target time set to %f" % self.simulation.target_time + self.simulation.target_time = ns.Simulator.Now().GetSeconds() + self.sample_period + # print "view: target time set to %f" % self.simulation.target_time finally: self.simulation.lock.release() if pause_messages: - #print pause_messages - dialog = Gtk.MessageDialog(parent=self.window, flags=0, type=Gtk.MessageType.WARNING, buttons=Gtk.ButtonsType.OK, - message_format='\n'.join(pause_messages)) + # print pause_messages + dialog = Gtk.MessageDialog( + parent=self.window, + flags=0, + type=Gtk.MessageType.WARNING, + buttons=Gtk.ButtonsType.OK, + message_format="\n".join(pause_messages), + ) dialog.connect("response", lambda d, r: d.destroy()) dialog.show() self.play_button.set_active(False) @@ -1461,18 +1580,20 @@ class Visualizer(GObject.GObject): self._update_timeout_id = None return False - #print "view: self.simulation.go.set()" + # print "view: self.simulation.go.set()" self.simulation.go.set() - #print "view: done." + # print "view: done." return True def _start_update_timer(self): if self._update_timeout_id is not None: GLib.source_remove(self._update_timeout_id) - #print "start_update_timer" - self._update_timeout_id = GLib.timeout_add(int(SAMPLE_PERIOD/min(self.speed, 1)*1e3), - self.update_view_timeout, - priority=PRIORITY_UPDATE_VIEW) + # print "start_update_timer" + self._update_timeout_id = GLib.timeout_add( + int(SAMPLE_PERIOD / min(self.speed, 1) * 1e3), + self.update_view_timeout, + priority=PRIORITY_UPDATE_VIEW, + ) def _on_play_button_toggled(self, button): if button.get_active(): @@ -1498,15 +1619,18 @@ class Visualizer(GObject.GObject): # that is executed. original_runcode = self.ipython.runcode + def runcode(ip, *args): - #print "lock" + # print "lock" self.simulation.lock.acquire() try: return original_runcode(*args) finally: - #print "unlock" + # print "unlock" self.simulation.lock.release() + import types + self.ipython.runcode = types.MethodType(runcode, self.ipython) def autoscale_view(self): @@ -1514,8 +1638,8 @@ class Visualizer(GObject.GObject): return self._update_node_positions() positions = [node.get_position() for node in self.nodes.values()] - min_x, min_y = min(x for (x,y) in positions), min(y for (x,y) in positions) - max_x, max_y = max(x for (x,y) in positions), max(y for (x,y) in positions) + min_x, min_y = min(x for (x, y) in positions), min(y for (x, y) in positions) + max_x, max_y = max(x for (x, y) in positions), max(y for (x, y) in positions) min_x_px, min_y_px = self.canvas.convert_to_pixels(min_x, min_y) max_x_px, max_y_px = self.canvas.convert_to_pixels(max_x, max_y) dx = max_x - min_x @@ -1524,31 +1648,30 @@ class Visualizer(GObject.GObject): dy_px = max_y_px - min_y_px hadj = self._scrolled_window.get_hadjustment() vadj = self._scrolled_window.get_vadjustment() - new_dx, new_dy = 1.5*dx_px, 1.5*dy_px + new_dx, new_dy = 1.5 * dx_px, 1.5 * dy_px if new_dx == 0 or new_dy == 0: return - self.zoom.set_value(min(hadj.get_page_size()/new_dx, vadj.get_page_size()/new_dy)) + self.zoom.set_value(min(hadj.get_page_size() / new_dx, vadj.get_page_size() / new_dy)) x1, y1 = self.canvas.convert_from_pixels(hadj.get_value(), vadj.get_value()) - x2, y2 = self.canvas.convert_from_pixels((hadj.get_value() + - hadj.get_page_size()), - (vadj.get_value() + - vadj.get_page_size())) + x2, y2 = self.canvas.convert_from_pixels( + (hadj.get_value() + hadj.get_page_size()), (vadj.get_value() + vadj.get_page_size()) + ) width = x2 - x1 height = y2 - y1 center_x = (min_x + max_x) / 2 center_y = (min_y + max_y) / 2 - self.canvas.scroll_to(center_x - width/2, center_y - height/2) + self.canvas.scroll_to(center_x - width / 2, center_y - height / 2) return False def start(self): self.scan_topology() self.window.connect("delete-event", self._quit) - #self._start_update_timer() + # self._start_update_timer() GLib.timeout_add(200, self.autoscale_view) self.simulation.start() @@ -1561,7 +1684,6 @@ class Visualizer(GObject.GObject): Gtk.main() - def on_root_button_press_event(self, view, target, event): if event.button == 1: self.select_node(None) @@ -1609,7 +1731,9 @@ class Visualizer(GObject.GObject): devpos = self.canvas.get_window().get_device_position(event.device) x0, y0 = self.canvas.convert_from_pixels(devpos.x, devpos.y) self.node_drag_state = self.NodeDragState(x0, y0, pos.x, pos.y) - self.node_drag_state.motion_signal = node.canvas_item.connect("motion-notify-event", self.node_drag_motion, node) + self.node_drag_state.motion_signal = node.canvas_item.connect( + "motion-notify-event", self.node_drag_motion, node + ) def node_drag_motion(self, item, targe_item, event, node): self.simulation.lock.acquire() @@ -1622,12 +1746,12 @@ class Visualizer(GObject.GObject): return False devpos = self.canvas.get_window().get_device_position(event.device) canvas_x, canvas_y = self.canvas.convert_from_pixels(devpos.x, devpos.y) - dx = (canvas_x - self.node_drag_state.canvas_x0) - dy = (canvas_y - self.node_drag_state.canvas_y0) + dx = canvas_x - self.node_drag_state.canvas_x0 + dy = canvas_y - self.node_drag_state.canvas_y0 pos = mob.GetPosition() pos.x = self.node_drag_state.sim_x0 + transform_distance_canvas_to_simulation(dx) pos.y = self.node_drag_state.sim_y0 + transform_distance_canvas_to_simulation(dy) - #print "SetPosition(%G, %G)" % (pos.x, pos.y) + # print "SetPosition(%G, %G)" % (pos.x, pos.y) mob.SetPosition(pos) node.set_position(*transform_point_simulation_to_canvas(pos.x, pos.y)) finally: @@ -1662,8 +1786,7 @@ class Visualizer(GObject.GObject): ns3_node = ns.NodeList.GetNode(self.selected_node.node_index) finally: self.simulation.lock.release() - self.ipython.updateNamespace({'selected_node': ns3_node}) - + self.ipython.updateNamespace({"selected_node": ns3_node}) def select_node(self, node): if isinstance(node, ns.Node): @@ -1694,7 +1817,6 @@ class Visualizer(GObject.GObject): self._update_ipython_selected_node() - def add_information_window(self, info_win): self.information_windows.append(info_win) self.simulation.lock.acquire() @@ -1707,12 +1829,12 @@ class Visualizer(GObject.GObject): self.information_windows.remove(info_win) def _canvas_tooltip_cb(self, canvas, x, y, keyboard_mode, tooltip): - #print "tooltip query: ", x, y + # print "tooltip query: ", x, y hadj = self._scrolled_window.get_hadjustment() vadj = self._scrolled_window.get_vadjustment() x, y = self.canvas.convert_from_pixels(hadj.get_value() + x, vadj.get_value() + y) item = self.canvas.get_item_at(x, y, True) - #print "items at (%f, %f): %r | keyboard_mode=%r" % (x, y, item, keyboard_mode) + # print "items at (%f, %f): %r | keyboard_mode=%r" % (x, y, item, keyboard_mode) if not item: return False while item is not None: @@ -1724,10 +1846,9 @@ class Visualizer(GObject.GObject): return False def _get_export_file_name(self): - sel = Gtk.FileChooserNative.new("Save...", self.canvas.get_toplevel(), - Gtk.FileChooserAction.SAVE, - "_Save", - "_Cancel") + sel = Gtk.FileChooserNative.new( + "Save...", self.canvas.get_toplevel(), Gtk.FileChooserAction.SAVE, "_Save", "_Cancel" + ) sel.set_local_only(True) sel.set_do_overwrite_confirmation(True) sel.set_current_name("Unnamed.pdf") @@ -1757,7 +1878,7 @@ class Visualizer(GObject.GObject): return file_name def _take_screenshot(self, dummy_button): - #print "Cheese!" + # print "Cheese!" file_name = self._get_export_file_name() if file_name is None: return @@ -1772,23 +1893,25 @@ class Visualizer(GObject.GObject): bounds.x2, bounds.y2 = self.canvas.convert_from_pixels(x2, y2) dest_width = bounds.x2 - bounds.x1 dest_height = bounds.y2 - bounds.y1 - #print bounds.x1, bounds.y1, " -> ", bounds.x2, bounds.y2 + # print bounds.x1, bounds.y1, " -> ", bounds.x2, bounds.y2 dummy, extension = os.path.splitext(file_name) extension = extension.lower() - if extension == '.eps': + if extension == ".eps": surface = cairo.PSSurface(file_name, dest_width, dest_height) - elif extension == '.pdf': + elif extension == ".pdf": surface = cairo.PDFSurface(file_name, dest_width, dest_height) - elif extension == '.svg': + elif extension == ".svg": surface = cairo.SVGSurface(file_name, dest_width, dest_height) else: - dialog = Gtk.MessageDialog(parent = self.canvas.get_toplevel(), - flags = Gtk.DialogFlags.DESTROY_WITH_PARENT, - type = Gtk.MessageType.ERROR, - buttons = Gtk.ButtonsType.OK, - message_format = "Unknown extension '%s' (valid extensions are '.eps', '.svg', and '.pdf')" - % (extension,)) + dialog = Gtk.MessageDialog( + parent=self.canvas.get_toplevel(), + flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, + type=Gtk.MessageType.ERROR, + buttons=Gtk.ButtonsType.OK, + message_format="Unknown extension '%s' (valid extensions are '.eps', '.svg', and '.pdf')" + % (extension,), + ) dialog.run() dialog.destroy() return @@ -1811,11 +1934,10 @@ class Visualizer(GObject.GObject): return self.shell_window = Gtk.Window() - self.shell_window.set_size_request(750,550) + self.shell_window.set_size_request(750, 550) self.shell_window.set_resizable(True) scrolled_window = Gtk.ScrolledWindow() - scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, - Gtk.PolicyType.AUTOMATIC) + scrolled_window.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC) self.ipython = ipython_view.IPythonView() self.ipython.modify_font(Pango.FontDescription(SHELL_FONT)) self.ipython.set_wrap_mode(Gtk.WrapMode.CHAR) @@ -1824,11 +1946,10 @@ class Visualizer(GObject.GObject): scrolled_window.show() self.shell_window.add(scrolled_window) self.shell_window.show() - self.shell_window.connect('destroy', self._on_shell_window_destroy) + self.shell_window.connect("destroy", self._on_shell_window_destroy) self._update_ipython_selected_node() - self.ipython.updateNamespace({'viz': self}) - + self.ipython.updateNamespace({"viz": self}) def _on_shell_window_destroy(self, window): self.shell_window = None @@ -1836,6 +1957,7 @@ class Visualizer(GObject.GObject): initialization_hooks = [] + def add_initialization_hook(hook, *args): """ Adds a callback to be called after @@ -1847,12 +1969,14 @@ def add_initialization_hook(hook, *args): def set_bounds(x1, y1, x2, y2): - assert x2>x1 - assert y2>y1 + assert x2 > x1 + assert y2 > y1 + def hook(viz): cx1, cy1 = transform_point_simulation_to_canvas(x1, y1) cx2, cy2 = transform_point_simulation_to_canvas(x2, y2) viz.canvas.set_bounds(cx1, cy1, cx2, cy2) + add_initialization_hook(hook) @@ -1860,8 +1984,8 @@ def start(): assert Visualizer.INSTANCE is None if _import_error is not None: import sys - print("No visualization support (%s)." % (str(_import_error),), - file=sys.stderr) + + print("No visualization support (%s)." % (str(_import_error),), file=sys.stderr) ns.Simulator.Run() return load_plugins() diff --git a/src/visualizer/visualizer/hud.py b/src/visualizer/visualizer/hud.py index fb4b20d5c..1ba063264 100644 --- a/src/visualizer/visualizer/hud.py +++ b/src/visualizer/visualizer/hud.py @@ -1,8 +1,8 @@ import math + +from gi.repository import GooCanvas, Gtk, Pango + from .base import PIXELS_PER_METER -from gi.repository import Pango -from gi.repository import Gtk -from gi.repository import GooCanvas ## Axes class @@ -28,16 +28,22 @@ class Axes(object): """ self.viz = viz self.color = 0x8080C0FF - self.hlines = GooCanvas.CanvasPath(parent=viz.canvas.get_root_item(), stroke_color_rgba=self.color) + self.hlines = GooCanvas.CanvasPath( + parent=viz.canvas.get_root_item(), stroke_color_rgba=self.color + ) self.hlines.lower(None) - self.vlines = GooCanvas.CanvasPath(parent=viz.canvas.get_root_item(), stroke_color_rgba=self.color) + self.vlines = GooCanvas.CanvasPath( + parent=viz.canvas.get_root_item(), stroke_color_rgba=self.color + ) self.vlines.lower(None) self.labels = [] hadj = self.viz.get_hadjustment() vadj = self.viz.get_vadjustment() + def update(adj): if self.visible: self.update_view() + hadj.connect("value-changed", update) vadj.connect("value-changed", update) hadj.connect("changed", update) @@ -76,7 +82,7 @@ class Axes(object): dx = xf - xi size = dx ndiv = 5 - text_width = dx/ndiv/2 + text_width = dx / ndiv / 2 def rint(x): """! @@ -85,26 +91,25 @@ class Axes(object): @param x: x @return x rounded up """ - return math.floor(x+0.5) + return math.floor(x + 0.5) dx_over_ndiv = dx / ndiv - for n in range(5): # iterate 5 times to find optimum division size + for n in range(5): # iterate 5 times to find optimum division size # div: length of each division # looking for approx. 'ndiv' divisions in a length 'dx' tbe = math.log10(dx_over_ndiv) # div: power of 10 closest to dx/ndiv div = pow(10, rint(tbe)) # test if div/2 is closer to dx/ndiv - if math.fabs(div/2 - dx_over_ndiv) < math.fabs(div - dx_over_ndiv): + if math.fabs(div / 2 - dx_over_ndiv) < math.fabs(div - dx_over_ndiv): div /= 2 - elif math.fabs(div*2 - dx_over_ndiv) < math.fabs(div - dx_over_ndiv): - div *= 2 # test if div*2 is closer to dx/ndiv - x0 = div*math.ceil(xi / div) - div + elif math.fabs(div * 2 - dx_over_ndiv) < math.fabs(div - dx_over_ndiv): + div *= 2 # test if div*2 is closer to dx/ndiv + x0 = div * math.ceil(xi / div) - div if n > 1: ndiv = rint(size / text_width) return x0, div - def update_view(self): """! Update view function @@ -119,6 +124,7 @@ class Axes(object): self.labels = [] for label in unused_labels: label.set_property("visibility", GooCanvas.CanvasItemVisibility.HIDDEN) + def get_label(): """! Get label function @@ -129,7 +135,9 @@ class Axes(object): try: label = unused_labels.pop(0) except IndexError: - label = GooCanvas.CanvasText(parent=self.viz.canvas.get_root_item(), stroke_color_rgba=self.color) + label = GooCanvas.CanvasText( + parent=self.viz.canvas.get_root_item(), stroke_color_rgba=self.color + ) else: label.set_property("visibility", GooCanvas.CanvasItemVisibility.VISIBLE) label.lower(None) @@ -139,31 +147,37 @@ class Axes(object): hadj = self.viz.get_hadjustment() vadj = self.viz.get_vadjustment() zoom = self.viz.zoom.get_value() - offset = 10/zoom + offset = 10 / zoom x1, y1 = self.viz.canvas.convert_from_pixels(hadj.get_value(), vadj.get_value()) - x2, y2 = self.viz.canvas.convert_from_pixels(hadj.get_value() + hadj.get_page_size(), vadj.get_value() + vadj.get_page_size()) - line_width = 5.0/self.viz.zoom.get_value() + x2, y2 = self.viz.canvas.convert_from_pixels( + hadj.get_value() + hadj.get_page_size(), vadj.get_value() + vadj.get_page_size() + ) + line_width = 5.0 / self.viz.zoom.get_value() # draw the horizontal axis self.hlines.set_property("line-width", line_width) - yc = y2 - line_width/2 + yc = y2 - line_width / 2 - sim_x1 = x1/PIXELS_PER_METER - sim_x2 = x2/PIXELS_PER_METER + sim_x1 = x1 / PIXELS_PER_METER + sim_x2 = x2 / PIXELS_PER_METER x0, xdiv = self._compute_divisions(sim_x1, sim_x2) path = ["M %r %r L %r %r" % (x1, yc, x2, yc)] x = x0 while x < sim_x2: - path.append("M %r %r L %r %r" % (PIXELS_PER_METER*x, yc - offset, PIXELS_PER_METER*x, yc)) + path.append( + "M %r %r L %r %r" % (PIXELS_PER_METER * x, yc - offset, PIXELS_PER_METER * x, yc) + ) label = get_label() - label.set_properties(font=("Sans Serif %f" % int(12/zoom)), - text=("%G" % x), - fill_color_rgba=self.color, - alignment=Pango.Alignment.CENTER, - # anchor=Gtk.Widget.ANCHOR_S, - x=PIXELS_PER_METER*x, - y=(yc - offset)) + label.set_properties( + font=("Sans Serif %f" % int(12 / zoom)), + text=("%G" % x), + fill_color_rgba=self.color, + alignment=Pango.Alignment.CENTER, + # anchor=Gtk.Widget.ANCHOR_S, + x=PIXELS_PER_METER * x, + y=(yc - offset), + ) x += xdiv del x @@ -171,29 +185,30 @@ class Axes(object): # draw the vertical axis self.vlines.set_property("line-width", line_width) - xc = x1 + line_width/2 - - sim_y1 = y1/PIXELS_PER_METER - sim_y2 = y2/PIXELS_PER_METER + xc = x1 + line_width / 2 + sim_y1 = y1 / PIXELS_PER_METER + sim_y2 = y2 / PIXELS_PER_METER y0, ydiv = self._compute_divisions(sim_y1, sim_y2) path = ["M %r %r L %r %r" % (xc, y1, xc, y2)] y = y0 while y < sim_y2: - path.append("M %r %r L %r %r" % (xc, PIXELS_PER_METER*y, xc + offset, PIXELS_PER_METER*y)) + path.append( + "M %r %r L %r %r" % (xc, PIXELS_PER_METER * y, xc + offset, PIXELS_PER_METER * y) + ) label = get_label() - label.set_properties(font=("Sans Serif %f" % int(12/zoom)), - text=("%G" % y), - fill_color_rgba=self.color, - alignment=Pango.Alignment.LEFT, - # anchor=Gtk.ANCHOR_W, - x=xc + offset, - y=PIXELS_PER_METER*y) + label.set_properties( + font=("Sans Serif %f" % int(12 / zoom)), + text=("%G" % y), + fill_color_rgba=self.color, + alignment=Pango.Alignment.LEFT, + # anchor=Gtk.ANCHOR_W, + x=xc + offset, + y=PIXELS_PER_METER * y, + ) y += ydiv self.vlines.set_property("data", " ".join(path)) - - self.labels.extend(unused_labels) diff --git a/src/visualizer/visualizer/ipython_view.py b/src/visualizer/visualizer/ipython_view.py index a982b39ab..27ce0ff0c 100644 --- a/src/visualizer/visualizer/ipython_view.py +++ b/src/visualizer/visualizer/ipython_view.py @@ -14,698 +14,718 @@ is available at U{http://www.opensource.org/licenses/bsd-license.php} # https://wiki.gnome.org/Apps/Accerciser import gi -gi.require_version('Gtk', '3.0') -from gi.repository import Gtk -from gi.repository import Gdk -from gi.repository import GLib -from gi.repository import Pango - -from pkg_resources import parse_version +gi.require_version("Gtk", "3.0") +import os import re import sys -import os - -from io import StringIO from functools import reduce +from io import StringIO + +from gi.repository import Gdk, GLib, Gtk, Pango +from pkg_resources import parse_version ## Try to import IPython try: - import IPython + import IPython except ImportError: - ##@ var IPython - # - IPython = None + ##@ var IPython + # + IPython = None + ## IterableIPShell class class IterableIPShell: - ## @var IP - # IP - ## @var iter_more - # iterate more - ## @var history_level - # history level - ## @var complete_sep - # separators - ## @var no_input_splitter - # no input splitter - ## @var lines - # lines - ## @var indent_spaces - # indent spaces - ## @var prompt - # prompt - ## @var header - # header - ## @var config - # config - ## @var colors - # colors - ## @var raw_input - # raw input + ## @var IP + # IP + ## @var iter_more + # iterate more + ## @var history_level + # history level + ## @var complete_sep + # separators + ## @var no_input_splitter + # no input splitter + ## @var lines + # lines + ## @var indent_spaces + # indent spaces + ## @var prompt + # prompt + ## @var header + # header + ## @var config + # config + ## @var colors + # colors + ## @var raw_input + # raw input - def __init__(self, argv=[], user_ns=None, user_global_ns=None, - cin=None, cout=None, cerr=None, input_func=None): - """! - Constructor for the IterableIPShell class - @param self: this object - @param argv: Command line options for IPython - @param user_ns: User namespace. - @param user_global_ns: User global namespace. - @param cin: Console standard input. - @param cout: Console standard output. - @param cerr: Console standard error. - @param input_func: Replacement for builtin raw_input() - """ - io = IPython.utils.io - if input_func: - IPython.terminal.interactiveshell.raw_input_original = input_func - if IPython.version_info < (8,): - if cin: - io.stdin = io.IOStream(cin) - if cout: - io.stdout = io.IOStream(cout) - if cerr: - io.stderr = io.IOStream(cerr) - else: - if cin: - sys.stdin = cin - if cout: - sys.stdout = cout - if cerr: - sys.stderr = cerr + def __init__( + self, + argv=[], + user_ns=None, + user_global_ns=None, + cin=None, + cout=None, + cerr=None, + input_func=None, + ): + """! + Constructor for the IterableIPShell class + @param self: this object + @param argv: Command line options for IPython + @param user_ns: User namespace. + @param user_global_ns: User global namespace. + @param cin: Console standard input. + @param cout: Console standard output. + @param cerr: Console standard error. + @param input_func: Replacement for builtin raw_input() + """ + io = IPython.utils.io + if input_func: + IPython.terminal.interactiveshell.raw_input_original = input_func + if IPython.version_info < (8,): + if cin: + io.stdin = io.IOStream(cin) + if cout: + io.stdout = io.IOStream(cout) + if cerr: + io.stderr = io.IOStream(cerr) + else: + if cin: + sys.stdin = cin + if cout: + sys.stdout = cout + if cerr: + sys.stderr = cerr - # This is to get rid of the blockage that occurs during - # IPython.Shell.InteractiveShell.user_setup() - io.raw_input = lambda x: None + # This is to get rid of the blockage that occurs during + # IPython.Shell.InteractiveShell.user_setup() + io.raw_input = lambda x: None - os.environ['TERM'] = 'dumb' - excepthook = sys.excepthook + os.environ["TERM"] = "dumb" + excepthook = sys.excepthook - from traitlets.config.loader import Config - cfg = Config() - cfg.InteractiveShell.colors = "Linux" - cfg.Completer.use_jedi = False + from traitlets.config.loader import Config - if IPython.version_info < (8,): - # InteractiveShell's __init__ overwrites io.stdout,io.stderr with - # sys.stdout, sys.stderr, this makes sure they are right - old_stdout, old_stderr = sys.stdout, sys.stderr - sys.stdout, sys.stderr = io.stdout.stream, io.stderr.stream + cfg = Config() + cfg.InteractiveShell.colors = "Linux" + cfg.Completer.use_jedi = False - # InteractiveShell inherits from SingletonConfigurable, so use instance() - # - self.IP = IPython.terminal.embed.InteractiveShellEmbed.instance(\ - config=cfg, user_ns=user_ns) + if IPython.version_info < (8,): + # InteractiveShell's __init__ overwrites io.stdout,io.stderr with + # sys.stdout, sys.stderr, this makes sure they are right + old_stdout, old_stderr = sys.stdout, sys.stderr + sys.stdout, sys.stderr = io.stdout.stream, io.stderr.stream - if IPython.version_info < (8,): - sys.stdout, sys.stderr = old_stdout, old_stderr + # InteractiveShell inherits from SingletonConfigurable, so use instance() + # + self.IP = IPython.terminal.embed.InteractiveShellEmbed.instance(config=cfg, user_ns=user_ns) - self.IP.system = lambda cmd: self.shell(self.IP.var_expand(cmd), - header='IPython system call: ') -# local_ns=user_ns) - #global_ns=user_global_ns) - #verbose=self.IP.rc.system_verbose) + if IPython.version_info < (8,): + sys.stdout, sys.stderr = old_stdout, old_stderr - self.IP.raw_input = input_func - sys.excepthook = excepthook - self.iter_more = 0 - self.history_level = 0 - self.complete_sep = re.compile('[\s\{\}\[\]\(\)]') - self.updateNamespace({'exit':lambda:None}) - self.updateNamespace({'quit':lambda:None}) - # Workaround for updating namespace with sys.modules - # - self.__update_namespace() + self.IP.system = lambda cmd: self.shell( + self.IP.var_expand(cmd), header="IPython system call: " + ) + # local_ns=user_ns) + # global_ns=user_global_ns) + # verbose=self.IP.rc.system_verbose) - # Avoid using input splitter when not really needed. - # Perhaps it could work even before 5.8.0 - # But it definitely does not work any more with >= 7.0.0 - self.no_input_splitter = parse_version(IPython.release.version) >= parse_version('5.8.0') - self.lines = [] - self.indent_spaces = '' + self.IP.raw_input = input_func + sys.excepthook = excepthook + self.iter_more = 0 + self.history_level = 0 + self.complete_sep = re.compile("[\s\{\}\[\]\(\)]") + self.updateNamespace({"exit": lambda: None}) + self.updateNamespace({"quit": lambda: None}) + # Workaround for updating namespace with sys.modules + # + self.__update_namespace() - def __update_namespace(self): - """! - Update self.IP namespace for autocompletion with sys.modules - @return none - """ - for k, v in list(sys.modules.items()): - if not '.' in k: - self.IP.user_ns.update({k:v}) + # Avoid using input splitter when not really needed. + # Perhaps it could work even before 5.8.0 + # But it definitely does not work any more with >= 7.0.0 + self.no_input_splitter = parse_version(IPython.release.version) >= parse_version("5.8.0") + self.lines = [] + self.indent_spaces = "" - def execute(self): - """! - Executes the current line provided by the shell object. - @return none - """ - self.history_level = 0 + def __update_namespace(self): + """! + Update self.IP namespace for autocompletion with sys.modules + @return none + """ + for k, v in list(sys.modules.items()): + if not "." in k: + self.IP.user_ns.update({k: v}) - if IPython.version_info < (8,): - # this is needed because some functions in IPython use 'print' to print - # output (like 'who') + def execute(self): + """! + Executes the current line provided by the shell object. + @return none + """ + self.history_level = 0 - orig_stdout = sys.stdout - sys.stdout = IPython.utils.io.stdout + if IPython.version_info < (8,): + # this is needed because some functions in IPython use 'print' to print + # output (like 'who') - orig_stdin = sys.stdin - sys.stdin = IPython.utils.io.stdin + orig_stdout = sys.stdout + sys.stdout = IPython.utils.io.stdout - self.prompt = self.generatePrompt(self.iter_more) + orig_stdin = sys.stdin + sys.stdin = IPython.utils.io.stdin + + self.prompt = self.generatePrompt(self.iter_more) + + self.IP.hooks.pre_prompt_hook() + if self.iter_more: + try: + self.prompt = self.generatePrompt(True) + except: + self.IP.showtraceback() + if self.IP.autoindent: + self.IP.rl_do_indent = True - self.IP.hooks.pre_prompt_hook() - if self.iter_more: try: - self.prompt = self.generatePrompt(True) + line = self.IP.raw_input(self.prompt) + except KeyboardInterrupt: + self.IP.write("\nKeyboardInterrupt\n") + if self.no_input_splitter: + self.lines = [] + else: + self.IP.input_splitter.reset() except: self.IP.showtraceback() - if self.IP.autoindent: - self.IP.rl_do_indent = True + else: + if self.no_input_splitter: + self.lines.append(line) + (status, self.indent_spaces) = self.IP.check_complete("\n".join(self.lines)) + self.iter_more = status == "incomplete" + else: + self.IP.input_splitter.push(line) + self.iter_more = self.IP.input_splitter.push_accepts_more() + if not self.iter_more: + if self.no_input_splitter: + source_raw = "\n".join(self.lines) + self.lines = [] + else: + source_raw = self.IP.input_splitter.raw_reset() + self.IP.run_cell(source_raw, store_history=True) + self.IP.rl_do_indent = False + else: + # TODO: Auto-indent + # + self.IP.rl_do_indent = True + pass + self.prompt = self.generatePrompt(self.iter_more) - try: - line = self.IP.raw_input(self.prompt) - except KeyboardInterrupt: - self.IP.write('\nKeyboardInterrupt\n') - if self.no_input_splitter: - self.lines = [] - else: - self.IP.input_splitter.reset() - except: - self.IP.showtraceback() - else: - if self.no_input_splitter: - self.lines.append(line) - (status, self.indent_spaces) = self.IP.check_complete('\n'.join(self.lines)) - self.iter_more = status == 'incomplete' - else: - self.IP.input_splitter.push(line) - self.iter_more = self.IP.input_splitter.push_accepts_more() - if not self.iter_more: - if self.no_input_splitter: - source_raw = '\n'.join(self.lines) - self.lines = [] - else: - source_raw = self.IP.input_splitter.raw_reset() - self.IP.run_cell(source_raw, store_history=True) - self.IP.rl_do_indent = False - else: - # TODO: Auto-indent - # - self.IP.rl_do_indent = True - pass - self.prompt = self.generatePrompt(self.iter_more) + if IPython.version_info < (8,): + sys.stdout = orig_stdout + sys.stdin = orig_stdin - if IPython.version_info < (8,): - sys.stdout = orig_stdout - sys.stdin = orig_stdin - - def generatePrompt(self, is_continuation): - """! - Generate prompt depending on is_continuation value - - @param is_continuation - @return: The prompt string representation - - """ - - if is_continuation: - prompt = '... ' - else: - prompt = '>>> ' - return prompt - - - def historyBack(self): - """! - Provides one history command back. - - @param self this object - @return: The command string. - """ - self.history_level -= 1 - if not self._getHistory(): - self.history_level +=1 - return self._getHistory() - - def historyForward(self): - """! - Provides one history command forward. - - @param self this object - @return: The command string. - """ - if self.history_level < 0: - self.history_level += 1 - return self._getHistory() - - def _getHistory(self): - """! - Gets the command string of the current history level. - - @param self this object - @return: Historic command string. - """ - try: - rv = self.IP.user_ns['In'][self.history_level].strip('\n') - except IndexError: - rv = '' - return rv - - def updateNamespace(self, ns_dict): - """! - Add the current dictionary to the shell namespace. - - @param ns_dict: A dictionary of symbol-values. - @return none - """ - self.IP.user_ns.update(ns_dict) - - def complete(self, line): - """! - Returns an auto completed line and/or possibilities for completion. - - @param line: Given line so far. - @return: Line completed as for as possible, and possible further completions. - """ - split_line = self.complete_sep.split(line) - if split_line[-1]: - possibilities = self.IP.complete(split_line[-1]) - else: - completed = line - possibilities = ['', []] - if possibilities: - def _commonPrefix(str1, str2): + def generatePrompt(self, is_continuation): """! - Reduction function. returns common prefix of two given strings. + Generate prompt depending on is_continuation value + + @param is_continuation + @return: The prompt string representation - @param str1: First string. - @param str2: Second string - @return: Common prefix to both strings. """ - for i in range(len(str1)): - if not str2.startswith(str1[:i+1]): - return str1[:i] - return str1 - if possibilities[1]: - common_prefix = reduce(_commonPrefix, possibilities[1]) or split_line[-1] - completed = line[:-len(split_line[-1])]+common_prefix - else: - completed = line - else: - completed = line - return completed, possibilities[1] + if is_continuation: + prompt = "... " + else: + prompt = ">>> " + return prompt - def shell(self, cmd,verbose=0,debug=0,header=''): - """! - Replacement method to allow shell commands without them blocking. + def historyBack(self): + """! + Provides one history command back. + + @param self this object + @return: The command string. + """ + self.history_level -= 1 + if not self._getHistory(): + self.history_level += 1 + return self._getHistory() + + def historyForward(self): + """! + Provides one history command forward. + + @param self this object + @return: The command string. + """ + if self.history_level < 0: + self.history_level += 1 + return self._getHistory() + + def _getHistory(self): + """! + Gets the command string of the current history level. + + @param self this object + @return: Historic command string. + """ + try: + rv = self.IP.user_ns["In"][self.history_level].strip("\n") + except IndexError: + rv = "" + return rv + + def updateNamespace(self, ns_dict): + """! + Add the current dictionary to the shell namespace. + + @param ns_dict: A dictionary of symbol-values. + @return none + """ + self.IP.user_ns.update(ns_dict) + + def complete(self, line): + """! + Returns an auto completed line and/or possibilities for completion. + + @param line: Given line so far. + @return: Line completed as for as possible, and possible further completions. + """ + split_line = self.complete_sep.split(line) + if split_line[-1]: + possibilities = self.IP.complete(split_line[-1]) + else: + completed = line + possibilities = ["", []] + if possibilities: + + def _commonPrefix(str1, str2): + """! + Reduction function. returns common prefix of two given strings. + + @param str1: First string. + @param str2: Second string + @return: Common prefix to both strings. + """ + for i in range(len(str1)): + if not str2.startswith(str1[: i + 1]): + return str1[:i] + return str1 + + if possibilities[1]: + common_prefix = reduce(_commonPrefix, possibilities[1]) or split_line[-1] + completed = line[: -len(split_line[-1])] + common_prefix + else: + completed = line + else: + completed = line + return completed, possibilities[1] + + def shell(self, cmd, verbose=0, debug=0, header=""): + """! + Replacement method to allow shell commands without them blocking. + + @param cmd: Shell command to execute. + @param verbose: Verbosity + @param debug: Debug level + @param header: Header to be printed before output + @return none + """ + stat = 0 + if verbose or debug: + print(header + cmd) + # flush stdout so we don't mangle python's buffering + if not debug: + input, output = os.popen4(cmd) + print(output.read()) + output.close() + input.close() - @param cmd: Shell command to execute. - @param verbose: Verbosity - @param debug: Debug level - @param header: Header to be printed before output - @return none - """ - stat = 0 - if verbose or debug: print(header+cmd) - # flush stdout so we don't mangle python's buffering - if not debug: - input, output = os.popen4(cmd) - print(output.read()) - output.close() - input.close() ## ConsoleView class class ConsoleView(Gtk.TextView): - ## @var ANSI_COLORS - # color list - ## @var text_buffer - # text buffer - ## @var mark - # scroll mark - ## @var color_pat - # color pattern - ## @var line_start - # line start - """ - Specialized text view for console-like workflow. - - @cvar ANSI_COLORS: Mapping of terminal control sequence values to - tuples containing foreground and background color names. - @type ANSI_COLORS: dictionary - - @ivar text_buffer: Widget's text buffer. - @type text_buffer: Gtk.TextBuffer - @ivar color_pat: Regex of terminal color pattern - @type color_pat: _sre.SRE_Pattern - @ivar mark: Scroll mark for automatic scrolling on input. - @type mark: Gtk.TextMark - @ivar line_start: Start of command line mark. - @type line_start: Gtk.TextMark - """ - ANSI_COLORS = {'0;30': ('Black', None), - '0;31': ('Red', None), - '0;32': ('Green', None), - '0;33': ('Brown', None), - '0;34': ('Blue', None), - '0;35': ('Purple', None), - '0;36': ('Cyan', None), - '0;37': ('LightGray', None), - '1;30': ('DarkGray', None), - '1;31': ('DarkRed', None), - '1;32': ('SeaGreen', None), - '1;33': ('Yellow', None), - '1;34': ('LightBlue', None), - '1;35': ('MediumPurple', None), - '1;36': ('LightCyan', None), - '1;37': ('White', None), - '38;5;124;43': ('DarkRed', 'Yellow'), - '38;5;241': ('Gray', None), - '38;5;241;43': ('Gray', 'Yellow'), - '39': ('Black', None), - '39;49': ('Red', 'White'), - '43': (None, 'Yellow'), - '49': (None, 'White')} - - def __init__(self): + ## @var ANSI_COLORS + # color list + ## @var text_buffer + # text buffer + ## @var mark + # scroll mark + ## @var color_pat + # color pattern + ## @var line_start + # line start """ - Initialize console view. + Specialized text view for console-like workflow. + + @cvar ANSI_COLORS: Mapping of terminal control sequence values to + tuples containing foreground and background color names. + @type ANSI_COLORS: dictionary + + @ivar text_buffer: Widget's text buffer. + @type text_buffer: Gtk.TextBuffer + @ivar color_pat: Regex of terminal color pattern + @type color_pat: _sre.SRE_Pattern + @ivar mark: Scroll mark for automatic scrolling on input. + @type mark: Gtk.TextMark + @ivar line_start: Start of command line mark. + @type line_start: Gtk.TextMark """ - Gtk.TextView.__init__(self) - self.modify_font(Pango.FontDescription('Mono')) - self.set_cursor_visible(True) - self.text_buffer = self.get_buffer() - self.mark = self.text_buffer.create_mark('scroll_mark', - self.text_buffer.get_end_iter(), - False) - for code in self.ANSI_COLORS: - self.text_buffer.create_tag(code, - foreground=self.ANSI_COLORS[code][0], - background=self.ANSI_COLORS[code][1], - weight=700) - self.text_buffer.create_tag('0') - self.text_buffer.create_tag('notouch', editable=False) - self.color_pat = re.compile('\x01?\x1b\[(.*?)m\x02?') - self.line_start = \ - self.text_buffer.create_mark('line_start', - self.text_buffer.get_end_iter(), True) - self.connect('key-press-event', self.onKeyPress) + ANSI_COLORS = { + "0;30": ("Black", None), + "0;31": ("Red", None), + "0;32": ("Green", None), + "0;33": ("Brown", None), + "0;34": ("Blue", None), + "0;35": ("Purple", None), + "0;36": ("Cyan", None), + "0;37": ("LightGray", None), + "1;30": ("DarkGray", None), + "1;31": ("DarkRed", None), + "1;32": ("SeaGreen", None), + "1;33": ("Yellow", None), + "1;34": ("LightBlue", None), + "1;35": ("MediumPurple", None), + "1;36": ("LightCyan", None), + "1;37": ("White", None), + "38;5;124;43": ("DarkRed", "Yellow"), + "38;5;241": ("Gray", None), + "38;5;241;43": ("Gray", "Yellow"), + "39": ("Black", None), + "39;49": ("Red", "White"), + "43": (None, "Yellow"), + "49": (None, "White"), + } - def write(self, text, editable=False): - """! - Write given text to buffer. + def __init__(self): + """ + Initialize console view. + """ + Gtk.TextView.__init__(self) + self.modify_font(Pango.FontDescription("Mono")) + self.set_cursor_visible(True) + self.text_buffer = self.get_buffer() + self.mark = self.text_buffer.create_mark( + "scroll_mark", self.text_buffer.get_end_iter(), False + ) + for code in self.ANSI_COLORS: + self.text_buffer.create_tag( + code, + foreground=self.ANSI_COLORS[code][0], + background=self.ANSI_COLORS[code][1], + weight=700, + ) + self.text_buffer.create_tag("0") + self.text_buffer.create_tag("notouch", editable=False) + self.color_pat = re.compile("\x01?\x1b\[(.*?)m\x02?") + self.line_start = self.text_buffer.create_mark( + "line_start", self.text_buffer.get_end_iter(), True + ) + self.connect("key-press-event", self.onKeyPress) - @param text: Text to append. - @param editable: If true, added text is editable. - @return none - """ - GLib.idle_add(self._write, text, editable) + def write(self, text, editable=False): + """! + Write given text to buffer. - def _write(self, text, editable=False): - """! - Write given text to buffer. + @param text: Text to append. + @param editable: If true, added text is editable. + @return none + """ + GLib.idle_add(self._write, text, editable) - @param text: Text to append. - @param editable: If true, added text is editable. - @return none - """ - segments = self.color_pat.split(text) - segment = segments.pop(0) - start_mark = self.text_buffer.create_mark(None, - self.text_buffer.get_end_iter(), - True) - self.text_buffer.insert(self.text_buffer.get_end_iter(), segment) + def _write(self, text, editable=False): + """! + Write given text to buffer. - if segments: - ansi_tags = self.color_pat.findall(text) - for tag in ansi_tags: - i = segments.index(tag) - self.text_buffer.insert_with_tags_by_name(self.text_buffer.get_end_iter(), - segments[i+1], str(tag)) - segments.pop(i) - if not editable: - self.text_buffer.apply_tag_by_name('notouch', - self.text_buffer.get_iter_at_mark(start_mark), - self.text_buffer.get_end_iter()) - self.text_buffer.delete_mark(start_mark) - self.scroll_mark_onscreen(self.mark) + @param text: Text to append. + @param editable: If true, added text is editable. + @return none + """ + segments = self.color_pat.split(text) + segment = segments.pop(0) + start_mark = self.text_buffer.create_mark(None, self.text_buffer.get_end_iter(), True) + self.text_buffer.insert(self.text_buffer.get_end_iter(), segment) - def showPrompt(self, prompt): - """! - Prints prompt at start of line. + if segments: + ansi_tags = self.color_pat.findall(text) + for tag in ansi_tags: + i = segments.index(tag) + self.text_buffer.insert_with_tags_by_name( + self.text_buffer.get_end_iter(), segments[i + 1], str(tag) + ) + segments.pop(i) + if not editable: + self.text_buffer.apply_tag_by_name( + "notouch", + self.text_buffer.get_iter_at_mark(start_mark), + self.text_buffer.get_end_iter(), + ) + self.text_buffer.delete_mark(start_mark) + self.scroll_mark_onscreen(self.mark) - @param prompt: Prompt to print. - @return none - """ - GLib.idle_add(self._showPrompt, prompt) + def showPrompt(self, prompt): + """! + Prints prompt at start of line. - def _showPrompt(self, prompt): - """! - Prints prompt at start of line. + @param prompt: Prompt to print. + @return none + """ + GLib.idle_add(self._showPrompt, prompt) - @param prompt: Prompt to print. - @return none - """ - self._write(prompt) - self.text_buffer.move_mark(self.line_start, - self.text_buffer.get_end_iter()) + def _showPrompt(self, prompt): + """! + Prints prompt at start of line. - def changeLine(self, text): - """! - Replace currently entered command line with given text. + @param prompt: Prompt to print. + @return none + """ + self._write(prompt) + self.text_buffer.move_mark(self.line_start, self.text_buffer.get_end_iter()) - @param text: Text to use as replacement. - @return none - """ - GLib.idle_add(self._changeLine, text) + def changeLine(self, text): + """! + Replace currently entered command line with given text. - def _changeLine(self, text): - """! - Replace currently entered command line with given text. + @param text: Text to use as replacement. + @return none + """ + GLib.idle_add(self._changeLine, text) - @param text: Text to use as replacement. - @return none - """ - iter = self.text_buffer.get_iter_at_mark(self.line_start) - iter.forward_to_line_end() - self.text_buffer.delete(self.text_buffer.get_iter_at_mark(self.line_start), iter) - self._write(text, True) + def _changeLine(self, text): + """! + Replace currently entered command line with given text. - def getCurrentLine(self): - """! - Get text in current command line. + @param text: Text to use as replacement. + @return none + """ + iter = self.text_buffer.get_iter_at_mark(self.line_start) + iter.forward_to_line_end() + self.text_buffer.delete(self.text_buffer.get_iter_at_mark(self.line_start), iter) + self._write(text, True) - @return Text of current command line. - """ - rv = self.text_buffer.get_slice( - self.text_buffer.get_iter_at_mark(self.line_start), - self.text_buffer.get_end_iter(), False) - return rv + def getCurrentLine(self): + """! + Get text in current command line. - def showReturned(self, text): - """! - Show returned text from last command and print new prompt. + @return Text of current command line. + """ + rv = self.text_buffer.get_slice( + self.text_buffer.get_iter_at_mark(self.line_start), + self.text_buffer.get_end_iter(), + False, + ) + return rv - @param text: Text to show. - @return none - """ - GLib.idle_add(self._showReturned, text) + def showReturned(self, text): + """! + Show returned text from last command and print new prompt. - def _showReturned(self, text): - """! - Show returned text from last command and print new prompt. + @param text: Text to show. + @return none + """ + GLib.idle_add(self._showReturned, text) - @param text: Text to show. - @return none - """ - iter = self.text_buffer.get_iter_at_mark(self.line_start) - iter.forward_to_line_end() - self.text_buffer.apply_tag_by_name( - 'notouch', - self.text_buffer.get_iter_at_mark(self.line_start), - iter) - self._write('\n'+text) - if text: - self._write('\n') - self._showPrompt(self.prompt) - self.text_buffer.move_mark(self.line_start, self.text_buffer.get_end_iter()) - self.text_buffer.place_cursor(self.text_buffer.get_end_iter()) + def _showReturned(self, text): + """! + Show returned text from last command and print new prompt. - if self.IP.rl_do_indent: - if self.no_input_splitter: - indentation = self.indent_spaces - else: - indentation = self.IP.input_splitter.indent_spaces * ' ' - self.text_buffer.insert_at_cursor(indentation) + @param text: Text to show. + @return none + """ + iter = self.text_buffer.get_iter_at_mark(self.line_start) + iter.forward_to_line_end() + self.text_buffer.apply_tag_by_name( + "notouch", self.text_buffer.get_iter_at_mark(self.line_start), iter + ) + self._write("\n" + text) + if text: + self._write("\n") + self._showPrompt(self.prompt) + self.text_buffer.move_mark(self.line_start, self.text_buffer.get_end_iter()) + self.text_buffer.place_cursor(self.text_buffer.get_end_iter()) - def onKeyPress(self, widget, event): - """! - Key press callback used for correcting behavior for console-like - interfaces. For example 'home' should go to prompt, not to beginning of - line. + if self.IP.rl_do_indent: + if self.no_input_splitter: + indentation = self.indent_spaces + else: + indentation = self.IP.input_splitter.indent_spaces * " " + self.text_buffer.insert_at_cursor(indentation) - @param widget: Widget that key press accored in. - @param event: Event object - @return Return True if event should not trickle. - """ - insert_mark = self.text_buffer.get_insert() - insert_iter = self.text_buffer.get_iter_at_mark(insert_mark) - selection_mark = self.text_buffer.get_selection_bound() - selection_iter = self.text_buffer.get_iter_at_mark(selection_mark) - start_iter = self.text_buffer.get_iter_at_mark(self.line_start) - if event.keyval == Gdk.KEY_Home: - if event.state & Gdk.ModifierType.CONTROL_MASK or event.state & Gdk.ModifierType.MOD1_MASK: + def onKeyPress(self, widget, event): + """! + Key press callback used for correcting behavior for console-like + interfaces. For example 'home' should go to prompt, not to beginning of + line. + + @param widget: Widget that key press accored in. + @param event: Event object + @return Return True if event should not trickle. + """ + insert_mark = self.text_buffer.get_insert() + insert_iter = self.text_buffer.get_iter_at_mark(insert_mark) + selection_mark = self.text_buffer.get_selection_bound() + selection_iter = self.text_buffer.get_iter_at_mark(selection_mark) + start_iter = self.text_buffer.get_iter_at_mark(self.line_start) + if event.keyval == Gdk.KEY_Home: + if ( + event.state & Gdk.ModifierType.CONTROL_MASK + or event.state & Gdk.ModifierType.MOD1_MASK + ): + pass + elif event.state & Gdk.ModifierType.SHIFT_MASK: + self.text_buffer.move_mark(insert_mark, start_iter) + return True + else: + self.text_buffer.place_cursor(start_iter) + return True + elif event.keyval == Gdk.KEY_Left: + insert_iter.backward_cursor_position() + if not insert_iter.editable(True): + return True + elif event.state & Gdk.ModifierType.CONTROL_MASK and event.keyval in [ord("L"), ord("l")]: + # clear previous output on Ctrl+L, but remember current input line + cursor position + cursor_offset = self.text_buffer.get_property("cursor-position") + cursor_pos_in_line = cursor_offset - start_iter.get_offset() + len(self.prompt) + current_input = self.text_buffer.get_text( + start_iter, self.text_buffer.get_end_iter(), False + ) + self.text_buffer.set_text(self.prompt + current_input) + self.text_buffer.move_mark( + self.line_start, self.text_buffer.get_iter_at_offset(len(self.prompt)) + ) + self.text_buffer.place_cursor(self.text_buffer.get_iter_at_offset(cursor_pos_in_line)) + return True + elif event.state & Gdk.ModifierType.CONTROL_MASK and event.keyval in [Gdk.KEY_k, Gdk.KEY_K]: + # clear text after input cursor on Ctrl+K + if insert_iter.editable(True): + self.text_buffer.delete(insert_iter, self.text_buffer.get_end_iter()) + return True + elif event.state & Gdk.ModifierType.CONTROL_MASK and event.keyval == Gdk.KEY_C: + # copy selection on Ctrl+C (upper-case 'C' only) + self.text_buffer.copy_clipboard(Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)) + return True + elif not event.string: + pass + elif start_iter.compare(insert_iter) <= 0 and start_iter.compare(selection_iter) <= 0: + pass + elif start_iter.compare(insert_iter) > 0 and start_iter.compare(selection_iter) > 0: + self.text_buffer.place_cursor(start_iter) + elif insert_iter.compare(selection_iter) < 0: + self.text_buffer.move_mark(insert_mark, start_iter) + elif insert_iter.compare(selection_iter) > 0: + self.text_buffer.move_mark(selection_mark, start_iter) + + return self.onKeyPressExtend(event) + + def onKeyPressExtend(self, event): + """! + For some reason we can't extend onKeyPress directly (bug #500900). + @param event key press + @return none + """ pass - elif event.state & Gdk.ModifierType.SHIFT_MASK: - self.text_buffer.move_mark(insert_mark, start_iter) - return True - else: - self.text_buffer.place_cursor(start_iter) - return True - elif event.keyval == Gdk.KEY_Left: - insert_iter.backward_cursor_position() - if not insert_iter.editable(True): - return True - elif event.state & Gdk.ModifierType.CONTROL_MASK and event.keyval in [ord('L'), ord('l')]: - # clear previous output on Ctrl+L, but remember current input line + cursor position - cursor_offset = self.text_buffer.get_property('cursor-position') - cursor_pos_in_line = cursor_offset - start_iter.get_offset() + len(self.prompt) - current_input = self.text_buffer.get_text(start_iter, self.text_buffer.get_end_iter(), False) - self.text_buffer.set_text(self.prompt + current_input) - self.text_buffer.move_mark(self.line_start, self.text_buffer.get_iter_at_offset(len(self.prompt))) - self.text_buffer.place_cursor(self.text_buffer.get_iter_at_offset(cursor_pos_in_line)) - return True - elif event.state & Gdk.ModifierType.CONTROL_MASK and event.keyval in [Gdk.KEY_k, Gdk.KEY_K]: - # clear text after input cursor on Ctrl+K - if insert_iter.editable(True): - self.text_buffer.delete(insert_iter, self.text_buffer.get_end_iter()) - return True - elif event.state & Gdk.ModifierType.CONTROL_MASK and event.keyval == Gdk.KEY_C: - # copy selection on Ctrl+C (upper-case 'C' only) - self.text_buffer.copy_clipboard(Gtk.Clipboard.get(Gdk.SELECTION_CLIPBOARD)) - return True - elif not event.string: - pass - elif start_iter.compare(insert_iter) <= 0 and \ - start_iter.compare(selection_iter) <= 0: - pass - elif start_iter.compare(insert_iter) > 0 and \ - start_iter.compare(selection_iter) > 0: - self.text_buffer.place_cursor(start_iter) - elif insert_iter.compare(selection_iter) < 0: - self.text_buffer.move_mark(insert_mark, start_iter) - elif insert_iter.compare(selection_iter) > 0: - self.text_buffer.move_mark(selection_mark, start_iter) - return self.onKeyPressExtend(event) - - def onKeyPressExtend(self, event): - """! - For some reason we can't extend onKeyPress directly (bug #500900). - @param event key press - @return none - """ - pass ## IPythonView class class IPythonView(ConsoleView, IterableIPShell): - ## @var cout - # cout - ## @var interrupt - # interrupt - ## @var execute - # execute - ## @var prompt - # prompt - ## @var showPrompt - # show prompt - ## @var history_pos - # history list - ## @var window - # GTK Window - """ - Sub-class of both modified IPython shell and L{ConsoleView} this makes - a GTK+ IPython console. - """ - def __init__(self): + ## @var cout + # cout + ## @var interrupt + # interrupt + ## @var execute + # execute + ## @var prompt + # prompt + ## @var showPrompt + # show prompt + ## @var history_pos + # history list + ## @var window + # GTK Window """ - Initialize. Redirect I/O to console. - """ - ConsoleView.__init__(self) - self.cout = StringIO() - IterableIPShell.__init__(self, cout=self.cout, cerr=self.cout, - input_func=self.raw_input) - self.interrupt = False - self.execute() - self.prompt = self.generatePrompt(False) - self.cout.truncate(0) - self.showPrompt(self.prompt) - - def raw_input(self, prompt=''): - """! - Custom raw_input() replacement. Gets current line from console buffer. - - @param prompt: Prompt to print. Here for compatibility as replacement. - @return The current command line text. - """ - if self.interrupt: - self.interrupt = False - raise KeyboardInterrupt - return self.getCurrentLine() - - def onKeyPressExtend(self, event): - """! - Key press callback with plenty of shell goodness, like history, - autocompletions, etc. - - @param event: Event object. - @return True if event should not trickle. + Sub-class of both modified IPython shell and L{ConsoleView} this makes + a GTK+ IPython console. """ - if event.get_state() & Gdk.ModifierType.CONTROL_MASK and event.keyval == 99: - self.interrupt = True - self._processLine() - return True - elif event.keyval == Gdk.KEY_Return: - self._processLine() - return True - elif event.keyval == Gdk.KEY_Up: - self.changeLine(self.historyBack()) - return True - elif event.keyval == Gdk.KEY_Down: - self.changeLine(self.historyForward()) - return True - elif event.keyval == Gdk.KEY_Tab: - if not self.getCurrentLine().strip(): - return False - completed, possibilities = self.complete(self.getCurrentLine()) - if len(possibilities) > 1: - slice = self.getCurrentLine() - self.write('\n') - for symbol in possibilities: - self.write(symbol+'\n') + def __init__(self): + """ + Initialize. Redirect I/O to console. + """ + ConsoleView.__init__(self) + self.cout = StringIO() + IterableIPShell.__init__(self, cout=self.cout, cerr=self.cout, input_func=self.raw_input) + self.interrupt = False + self.execute() + self.prompt = self.generatePrompt(False) + self.cout.truncate(0) self.showPrompt(self.prompt) - self.changeLine(completed or slice) - return True - def _processLine(self): - """! - Process current command line. - @return none - """ - self.history_pos = 0 - self.execute() - rv = self.cout.getvalue() - if rv: rv = rv.strip('\n') - self.showReturned(rv) - self.cout.truncate(0) - self.cout.seek(0) + def raw_input(self, prompt=""): + """! + Custom raw_input() replacement. Gets current line from console buffer. + + @param prompt: Prompt to print. Here for compatibility as replacement. + @return The current command line text. + """ + if self.interrupt: + self.interrupt = False + raise KeyboardInterrupt + return self.getCurrentLine() + + def onKeyPressExtend(self, event): + """! + Key press callback with plenty of shell goodness, like history, + autocompletions, etc. + + @param event: Event object. + @return True if event should not trickle. + """ + + if event.get_state() & Gdk.ModifierType.CONTROL_MASK and event.keyval == 99: + self.interrupt = True + self._processLine() + return True + elif event.keyval == Gdk.KEY_Return: + self._processLine() + return True + elif event.keyval == Gdk.KEY_Up: + self.changeLine(self.historyBack()) + return True + elif event.keyval == Gdk.KEY_Down: + self.changeLine(self.historyForward()) + return True + elif event.keyval == Gdk.KEY_Tab: + if not self.getCurrentLine().strip(): + return False + completed, possibilities = self.complete(self.getCurrentLine()) + if len(possibilities) > 1: + slice = self.getCurrentLine() + self.write("\n") + for symbol in possibilities: + self.write(symbol + "\n") + self.showPrompt(self.prompt) + self.changeLine(completed or slice) + return True + + def _processLine(self): + """! + Process current command line. + @return none + """ + self.history_pos = 0 + self.execute() + rv = self.cout.getvalue() + if rv: + rv = rv.strip("\n") + self.showReturned(rv) + self.cout.truncate(0) + self.cout.seek(0) + if __name__ == "__main__": - window = Gtk.Window() - window.set_default_size(640, 320) - window.connect('delete-event', lambda x, y: Gtk.main_quit()) - window.add(IPythonView()) - window.show_all() - Gtk.main() - + window = Gtk.Window() + window.set_default_size(640, 320) + window.connect("delete-event", lambda x, y: Gtk.main_quit()) + window.add(IPythonView()) + window.show_all() + Gtk.main() diff --git a/src/visualizer/visualizer/plugins/interface_statistics.py b/src/visualizer/visualizer/plugins/interface_statistics.py index 7d394ea49..5e44fa360 100644 --- a/src/visualizer/visualizer/plugins/interface_statistics.py +++ b/src/visualizer/visualizer/plugins/interface_statistics.py @@ -13,6 +13,7 @@ class StatisticsCollector(object): """ Collects interface statistics for all nodes. """ + ## @var node_statistics # node statistics ## @var visualizer @@ -21,8 +22,16 @@ class StatisticsCollector(object): ## NetDevStats class class NetDevStats(object): ## class members - __slots__ = ['rxPackets', 'rxBytes', 'txPackets', 'txBytes', - 'rxPacketRate', 'rxBitRate', 'txPacketRate', 'txBitRate'] + __slots__ = [ + "rxPackets", + "rxBytes", + "txPackets", + "txBytes", + "rxPacketRate", + "rxBitRate", + "txPacketRate", + "txBitRate", + ] def __init__(self, visualizer): """! @@ -30,7 +39,7 @@ class StatisticsCollector(object): @param self this object @param visualizer visualizer object """ - self.node_statistics = {} # nodeid -> list(raw statistics) + self.node_statistics = {} # nodeid -> list(raw statistics) self.visualizer = visualizer def simulation_periodic_update(self, viz): @@ -66,7 +75,7 @@ class StatisticsCollector(object): if len(raw_stats_list) < NODE_STATISTICS_MEMORY: return [] assert len(raw_stats_list) == NODE_STATISTICS_MEMORY - tx_packets1 = [] # transmitted packets, one value per interface + tx_packets1 = [] # transmitted packets, one value per interface rx_packets1 = [] tx_bytes1 = [] rx_bytes1 = [] @@ -78,7 +87,7 @@ class StatisticsCollector(object): retval = [] - k = self.visualizer.sample_period*(NODE_STATISTICS_MEMORY-1) + k = self.visualizer.sample_period * (NODE_STATISTICS_MEMORY - 1) for iface, stats in enumerate(raw_stats_list[-1]): outStat = self.NetDevStats() outStat.txPackets = stats.transmittedPackets @@ -86,10 +95,10 @@ class StatisticsCollector(object): outStat.rxPackets = stats.receivedPackets outStat.rxBytes = stats.receivedBytes - outStat.txPacketRate = (stats.transmittedPackets - tx_packets1[iface])/k - outStat.rxPacketRate = (stats.receivedPackets - rx_packets1[iface])/k - outStat.txBitRate = (stats.transmittedBytes - tx_bytes1[iface])*8/k - outStat.rxBitRate = (stats.receivedBytes - rx_bytes1[iface])*8/k + outStat.txPacketRate = (stats.transmittedPackets - tx_packets1[iface]) / k + outStat.rxPacketRate = (stats.receivedPackets - rx_packets1[iface]) / k + outStat.txBitRate = (stats.transmittedBytes - tx_bytes1[iface]) * 8 / k + outStat.rxBitRate = (stats.receivedBytes - rx_bytes1[iface]) * 8 / k retval.append(outStat) return retval @@ -110,17 +119,14 @@ class ShowInterfaceStatistics(InformationWindow): # table model ( COLUMN_INTERFACE, - COLUMN_TX_PACKETS, COLUMN_TX_BYTES, COLUMN_TX_PACKET_RATE, COLUMN_TX_BIT_RATE, - COLUMN_RX_PACKETS, COLUMN_RX_BYTES, COLUMN_RX_PACKET_RATE, COLUMN_RX_BIT_RATE, - ) = range(9) def __init__(self, visualizer, node_index, statistics_collector): @@ -132,9 +138,11 @@ class ShowInterfaceStatistics(InformationWindow): @param statistics_collector statistics collector class """ InformationWindow.__init__(self) - self.win = Gtk.Dialog(parent=visualizer.window, - flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, - buttons=("_Close", Gtk.ResponseType.CLOSE)) + self.win = Gtk.Dialog( + parent=visualizer.window, + flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, + buttons=("_Close", Gtk.ResponseType.CLOSE), + ) self.win.connect("response", self._response_cb) self.win.set_title("Statistics for node %i" % node_index) self.visualizer = visualizer @@ -142,7 +150,7 @@ class ShowInterfaceStatistics(InformationWindow): self.node_index = node_index self.viz_node = visualizer.get_node(node_index) - self.table_model = Gtk.ListStore(*([str]*13)) + self.table_model = Gtk.ListStore(*([str] * 13)) treeview = Gtk.TreeView(self.table_model) treeview.show() @@ -193,23 +201,30 @@ class ShowInterfaceStatistics(InformationWindow): interface_name = ns.Names.FindName(netdevice) if not interface_name: interface_name = "(interface %i)" % iface - self.table_model.set(tree_iter, - self.COLUMN_INTERFACE, interface_name, - - self.COLUMN_TX_PACKETS, str(stats.txPackets), - self.COLUMN_TX_BYTES, str(stats.txBytes), - self.COLUMN_TX_PACKET_RATE, str(stats.txPacketRate), - self.COLUMN_TX_BIT_RATE, str(stats.txBitRate), - - self.COLUMN_RX_PACKETS, str(stats.rxPackets), - self.COLUMN_RX_BYTES, str(stats.rxBytes), - self.COLUMN_RX_PACKET_RATE, str(stats.rxPacketRate), - self.COLUMN_RX_BIT_RATE, str(stats.rxBitRate) - ) + self.table_model.set( + tree_iter, + self.COLUMN_INTERFACE, + interface_name, + self.COLUMN_TX_PACKETS, + str(stats.txPackets), + self.COLUMN_TX_BYTES, + str(stats.txBytes), + self.COLUMN_TX_PACKET_RATE, + str(stats.txPacketRate), + self.COLUMN_TX_BIT_RATE, + str(stats.txBitRate), + self.COLUMN_RX_PACKETS, + str(stats.rxPackets), + self.COLUMN_RX_BYTES, + str(stats.rxBytes), + self.COLUMN_RX_PACKET_RATE, + str(stats.rxPacketRate), + self.COLUMN_RX_BIT_RATE, + str(stats.rxBitRate), + ) def populate_node_menu(viz, node, menu, statistics_collector): - menu_item = Gtk.MenuItem("Show Interface Statistics") menu_item.show() diff --git a/src/visualizer/visualizer/plugins/ipv4_routing_table.py b/src/visualizer/visualizer/plugins/ipv4_routing_table.py index 5cb8fb4ae..3bf0942fc 100644 --- a/src/visualizer/visualizer/plugins/ipv4_routing_table.py +++ b/src/visualizer/visualizer/plugins/ipv4_routing_table.py @@ -5,6 +5,7 @@ try: except ModuleNotFoundError: from visualizer.base import InformationWindow + ## ShowIpv4RoutingTable class class ShowIpv4RoutingTable(InformationWindow): ## @var win @@ -41,9 +42,11 @@ class ShowIpv4RoutingTable(InformationWindow): @param node_index the node index """ InformationWindow.__init__(self) - self.win = Gtk.Dialog(parent=visualizer.window, - flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, - buttons=("_Close", Gtk.ResponseType.CLOSE)) + self.win = Gtk.Dialog( + parent=visualizer.window, + flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, + buttons=("_Close", Gtk.ResponseType.CLOSE), + ) self.win.connect("response", self._response_cb) self.win.set_title("IPv4 routing table for node %i" % node_index) self.visualizer = visualizer @@ -54,36 +57,34 @@ class ShowIpv4RoutingTable(InformationWindow): treeview = Gtk.TreeView(self.table_model) treeview.show() sw = Gtk.ScrolledWindow() - sw.set_properties(hscrollbar_policy=Gtk.PolicyType.AUTOMATIC, - vscrollbar_policy=Gtk.PolicyType.AUTOMATIC) + sw.set_properties( + hscrollbar_policy=Gtk.PolicyType.AUTOMATIC, vscrollbar_policy=Gtk.PolicyType.AUTOMATIC + ) sw.show() sw.add(treeview) self.win.vbox.add(sw) self.win.set_default_size(600, 300) # Dest. - column = Gtk.TreeViewColumn('Destination', Gtk.CellRendererText(), - text=self.COLUMN_DESTINATION) + column = Gtk.TreeViewColumn( + "Destination", Gtk.CellRendererText(), text=self.COLUMN_DESTINATION + ) treeview.append_column(column) # Next hop - column = Gtk.TreeViewColumn('Next hop', Gtk.CellRendererText(), - text=self.COLUMN_NEXT_HOP) + column = Gtk.TreeViewColumn("Next hop", Gtk.CellRendererText(), text=self.COLUMN_NEXT_HOP) treeview.append_column(column) # Interface - column = Gtk.TreeViewColumn('Interface', Gtk.CellRendererText(), - text=self.COLUMN_INTERFACE) + column = Gtk.TreeViewColumn("Interface", Gtk.CellRendererText(), text=self.COLUMN_INTERFACE) treeview.append_column(column) # Type - column = Gtk.TreeViewColumn('Type', Gtk.CellRendererText(), - text=self.COLUMN_TYPE) + column = Gtk.TreeViewColumn("Type", Gtk.CellRendererText(), text=self.COLUMN_TYPE) treeview.append_column(column) # Prio - column = Gtk.TreeViewColumn('Prio', Gtk.CellRendererText(), - text=self.COLUMN_PRIO) + column = Gtk.TreeViewColumn("Prio", Gtk.CellRendererText(), text=self.COLUMN_PRIO) treeview.append_column(column) self.visualizer.add_information_window(self) @@ -112,7 +113,7 @@ class ShowIpv4RoutingTable(InformationWindow): if routing is None: return - routing_protocols = [] # list of (protocol, type_string, priority) + routing_protocols = [] # list of (protocol, type_string, priority) if isinstance(routing, ns.Ipv4StaticRouting): ipv4_routing = routing_protocols.append((routing, "static", 0)) @@ -134,17 +135,24 @@ class ShowIpv4RoutingTable(InformationWindow): tree_iter = self.table_model.append() netdevice = ipv4.GetNetDevice(route.GetInterface()) if netdevice is None: - interface_name = 'lo' + interface_name = "lo" else: interface_name = ns.Names.FindName(netdevice) if not interface_name: interface_name = "(interface %i)" % route.GetInterface() - self.table_model.set(tree_iter, - self.COLUMN_DESTINATION, str(route.GetDest()), - self.COLUMN_NEXT_HOP, str(route.GetGateway()), - self.COLUMN_INTERFACE, interface_name, - self.COLUMN_TYPE, type_string, - self.COLUMN_PRIO, prio) + self.table_model.set( + tree_iter, + self.COLUMN_DESTINATION, + str(route.GetDest()), + self.COLUMN_NEXT_HOP, + str(route.GetGateway()), + self.COLUMN_INTERFACE, + interface_name, + self.COLUMN_TYPE, + type_string, + self.COLUMN_PRIO, + prio, + ) def populate_node_menu(viz, node, menu): @@ -157,5 +165,6 @@ def populate_node_menu(viz, node, menu): menu_item.connect("activate", _show_ipv4_routing_table) menu.add(menu_item) + def register(viz): viz.connect("populate-node-menu", populate_node_menu) diff --git a/src/visualizer/visualizer/plugins/olsr.py b/src/visualizer/visualizer/plugins/olsr.py index 8035fc84b..4a27962ee 100644 --- a/src/visualizer/visualizer/plugins/olsr.py +++ b/src/visualizer/visualizer/plugins/olsr.py @@ -1,11 +1,11 @@ -from gi.repository import Gtk -from gi.repository import Gdk +from gi.repository import Gdk, Gtk try: from ns3.visualizer.base import InformationWindow except ModuleNotFoundError: from visualizer.base import InformationWindow + ## ShowOlsrRoutingTable class class ShowOlsrRoutingTable(InformationWindow): ## @var win @@ -31,10 +31,12 @@ class ShowOlsrRoutingTable(InformationWindow): @param node_index the node index """ InformationWindow.__init__(self) - self.win = Gtk.Dialog(parent=visualizer.window, - flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, - buttons=("_Close", Gtk.ResponseType.CLOSE)) - self.win.set_default_size(Gdk.Screen.width()/2, Gdk.Screen.height()/2) + self.win = Gtk.Dialog( + parent=visualizer.window, + flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, + buttons=("_Close", Gtk.ResponseType.CLOSE), + ) + self.win.set_default_size(Gdk.Screen.width() / 2, Gdk.Screen.height() / 2) self.win.connect("response", self._response_cb) self.win.set_title("OLSR routing table for node %i" % node_index) self.visualizer = visualizer @@ -45,30 +47,29 @@ class ShowOlsrRoutingTable(InformationWindow): treeview = Gtk.TreeView(self.table_model) treeview.show() sw = Gtk.ScrolledWindow() - sw.set_properties(hscrollbar_policy=Gtk.PolicyType.AUTOMATIC, - vscrollbar_policy=Gtk.PolicyType.AUTOMATIC) + sw.set_properties( + hscrollbar_policy=Gtk.PolicyType.AUTOMATIC, vscrollbar_policy=Gtk.PolicyType.AUTOMATIC + ) sw.show() sw.add(treeview) self.win.vbox.add(sw) # Dest. - column = Gtk.TreeViewColumn('Destination', Gtk.CellRendererText(), - text=self.COLUMN_DESTINATION) + column = Gtk.TreeViewColumn( + "Destination", Gtk.CellRendererText(), text=self.COLUMN_DESTINATION + ) treeview.append_column(column) # Next hop - column = Gtk.TreeViewColumn('Next hop', Gtk.CellRendererText(), - text=self.COLUMN_NEXT_HOP) + column = Gtk.TreeViewColumn("Next hop", Gtk.CellRendererText(), text=self.COLUMN_NEXT_HOP) treeview.append_column(column) # Interface - column = Gtk.TreeViewColumn('Interface', Gtk.CellRendererText(), - text=self.COLUMN_INTERFACE) + column = Gtk.TreeViewColumn("Interface", Gtk.CellRendererText(), text=self.COLUMN_INTERFACE) treeview.append_column(column) # Num. Hops - column = Gtk.TreeViewColumn('Num. Hops', Gtk.CellRendererText(), - text=self.COLUMN_NUM_HOPS) + column = Gtk.TreeViewColumn("Num. Hops", Gtk.CellRendererText(), text=self.COLUMN_NUM_HOPS) treeview.append_column(column) self.visualizer.add_information_window(self) @@ -102,16 +103,22 @@ class ShowOlsrRoutingTable(InformationWindow): tree_iter = self.table_model.append() netdevice = ipv4.GetNetDevice(route.interface) if netdevice is None: - interface_name = 'lo' + interface_name = "lo" else: interface_name = ns.Names.FindName(netdevice) if not interface_name: interface_name = "(interface %i)" % route.interface - self.table_model.set(tree_iter, - self.COLUMN_DESTINATION, str(route.destAddr), - self.COLUMN_NEXT_HOP, str(route.nextAddr), - self.COLUMN_INTERFACE, interface_name, - self.COLUMN_NUM_HOPS, route.distance) + self.table_model.set( + tree_iter, + self.COLUMN_DESTINATION, + str(route.destAddr), + self.COLUMN_NEXT_HOP, + str(route.nextAddr), + self.COLUMN_INTERFACE, + interface_name, + self.COLUMN_NUM_HOPS, + route.distance, + ) def populate_node_menu(viz, node, menu): @@ -129,5 +136,6 @@ def populate_node_menu(viz, node, menu): menu_item.connect("activate", _show_ipv4_routing_table) menu.add(menu_item) + def register(viz): viz.connect("populate-node-menu", populate_node_menu) diff --git a/src/visualizer/visualizer/plugins/show_last_packets.py b/src/visualizer/visualizer/plugins/show_last_packets.py index 54bfa388c..dfda5ac64 100644 --- a/src/visualizer/visualizer/plugins/show_last_packets.py +++ b/src/visualizer/visualizer/plugins/show_last_packets.py @@ -1,5 +1,4 @@ -from gi.repository import GObject -from gi.repository import Gtk +from gi.repository import GObject, Gtk try: from ns import ns @@ -15,7 +14,8 @@ try: except ModuleNotFoundError: from visualizer.base import InformationWindow -from kiwi.ui.objectlist import ObjectList, Column +from kiwi.ui.objectlist import Column, ObjectList + ## ShowLastPackets class class ShowLastPackets(InformationWindow): @@ -47,6 +47,7 @@ class ShowLastPackets(InformationWindow): """ PacketList class """ + ## @var table_model # table model ( @@ -54,7 +55,7 @@ class ShowLastPackets(InformationWindow): COLUMN_INTERFACE, COLUMN_SIZE, COLUMN_CONTENTS, - ) = range(4) + ) = range(4) def __init__(self): """ @@ -62,9 +63,11 @@ class ShowLastPackets(InformationWindow): @param self this object """ super(ShowLastPackets.PacketList, self).__init__() - self.set_properties(hscrollbar_policy=Gtk.PolicyType.AUTOMATIC, - vscrollbar_policy=Gtk.PolicyType.AUTOMATIC) - self.table_model = Gtk.ListStore(*([str]*4)) + self.set_properties( + hscrollbar_policy=Gtk.PolicyType.AUTOMATIC, + vscrollbar_policy=Gtk.PolicyType.AUTOMATIC, + ) + self.table_model = Gtk.ListStore(*([str] * 4)) treeview = Gtk.TreeView(self.table_model) treeview.show() self.add(treeview) @@ -95,13 +98,17 @@ class ShowLastPackets(InformationWindow): interface_name = ns.core.Names.FindName(sample.device) if not interface_name: interface_name = "(interface %i)" % sample.device.GetIfIndex() - self.table_model.set(tree_iter, - self.COLUMN_TIME, str(sample.time.GetSeconds()), - self.COLUMN_INTERFACE, interface_name, - self.COLUMN_SIZE, str(sample.packet.GetSize ()), - self.COLUMN_CONTENTS, str(sample.packet) - ) - + self.table_model.set( + tree_iter, + self.COLUMN_TIME, + str(sample.time.GetSeconds()), + self.COLUMN_INTERFACE, + interface_name, + self.COLUMN_SIZE, + str(sample.packet.GetSize()), + self.COLUMN_CONTENTS, + str(sample.packet), + ) def __init__(self, visualizer, node_index): """! @@ -111,9 +118,11 @@ class ShowLastPackets(InformationWindow): @param node_index the node index """ InformationWindow.__init__(self) - self.win = Gtk.Dialog(parent=visualizer.window, - flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, - buttons=("_Close", Gtk.ResponseType.CLOSE)) + self.win = Gtk.Dialog( + parent=visualizer.window, + flags=Gtk.DialogFlags.DESTROY_WITH_PARENT, + buttons=("_Close", Gtk.ResponseType.CLOSE), + ) self.win.connect("response", self._response_cb) self.win.set_title("Last packets for node %i" % node_index) self.visualizer = visualizer @@ -122,9 +131,13 @@ class ShowLastPackets(InformationWindow): def smart_expand(expander, vbox): if expander.get_expanded(): - vbox.set_child_packing(expander, expand=True, fill=True, padding=0, pack_type=Gtk.PACK_START) + vbox.set_child_packing( + expander, expand=True, fill=True, padding=0, pack_type=Gtk.PACK_START + ) else: - vbox.set_child_packing(expander, expand=False, fill=False, padding=0, pack_type=Gtk.PACK_START) + vbox.set_child_packing( + expander, expand=False, fill=False, padding=0, pack_type=Gtk.PACK_START + ) main_hbox = Gtk.HBox(False, 4) main_hbox.show() @@ -157,7 +170,6 @@ class ShowLastPackets(InformationWindow): main_vbox.pack_start(group, expand=False, fill=False) group.connect_after("activate", smart_expand, main_vbox) - # Packet Filter # - options @@ -176,17 +188,20 @@ class ShowLastPackets(InformationWindow): sel_buttons_box.add(select_all_button) sel_buttons_box.add(select_none_button) - self.packet_filter_widget = ObjectList([ - Column('selected', title="Sel.", data_type=bool, editable=True), - Column('name', title="Header"), - ], sortable=True) + self.packet_filter_widget = ObjectList( + [ + Column("selected", title="Sel.", data_type=bool, editable=True), + Column("name", title="Header"), + ], + sortable=True, + ) self.packet_filter_widget.show() packet_filter_vbox.pack_start(self.packet_filter_widget, True, True, 4) class TypeIdConfig(object): - __slots__ = ['name', 'selected', 'typeid'] + __slots__ = ["name", "selected", "typeid"] - self.packet_filter_list = [] # list of TypeIdConfig instances + self.packet_filter_list = [] # list of TypeIdConfig instances Header = ns.core.TypeId.LookupByName("ns3::Header") Trailer = ns.core.TypeId.LookupByName("ns3::Trailer") @@ -216,15 +231,22 @@ class ShowLastPackets(InformationWindow): def update_capture_options(): if self.op_AND_button.props.active: - self.packet_capture_options.mode = ns.visualizer.PyViz.PACKET_CAPTURE_FILTER_HEADERS_AND + self.packet_capture_options.mode = ( + ns.visualizer.PyViz.PACKET_CAPTURE_FILTER_HEADERS_AND + ) else: - self.packet_capture_options.mode = ns.visualizer.PyViz.PACKET_CAPTURE_FILTER_HEADERS_OR + self.packet_capture_options.mode = ( + ns.visualizer.PyViz.PACKET_CAPTURE_FILTER_HEADERS_OR + ) self.packet_capture_options.numLastPackets = 100 - self.packet_capture_options.headers = [c.typeid for c in self.packet_filter_list if c.selected] + self.packet_capture_options.headers = [ + c.typeid for c in self.packet_filter_list if c.selected + ] self.visualizer.simulation.lock.acquire() try: self.visualizer.simulation.sim_helper.SetPacketCaptureOptions( - self.node.GetId(), self.packet_capture_options) + self.node.GetId(), self.packet_capture_options + ) finally: self.visualizer.simulation.lock.release() @@ -247,7 +269,9 @@ class ShowLastPackets(InformationWindow): op_buttons_box.show() packet_filter_vbox.pack_start(op_buttons_box, False, False, 4) self.op_AND_button = GObject.new(Gtk.RadioButton, label="AND", visible=True) - self.op_OR_button = GObject.new(Gtk.RadioButton, label="OR", visible=True, group=self.op_AND_button) + self.op_OR_button = GObject.new( + Gtk.RadioButton, label="OR", visible=True, group=self.op_AND_button + ) op_buttons_box.add(self.op_AND_button) op_buttons_box.add(self.op_OR_button) self.op_OR_button.props.active = True @@ -256,6 +280,7 @@ class ShowLastPackets(InformationWindow): def cell_edited(l, obj, attribute): update_capture_options() + self.packet_filter_widget.connect("cell-edited", cell_edited) update_capture_options() @@ -298,5 +323,6 @@ def populate_node_menu(viz, node, menu): menu_item.connect("activate", _show_it) menu.add(menu_item) + def register(viz): viz.connect("populate-node-menu", populate_node_menu) diff --git a/src/visualizer/visualizer/plugins/wifi_intrastructure_link.py b/src/visualizer/visualizer/plugins/wifi_intrastructure_link.py index d8580548b..0ace27b99 100644 --- a/src/visualizer/visualizer/plugins/wifi_intrastructure_link.py +++ b/src/visualizer/visualizer/plugins/wifi_intrastructure_link.py @@ -1,4 +1,5 @@ import math + try: from ns import ns except ModuleNotFoundError: @@ -14,6 +15,7 @@ try: except ModuleNotFoundError: from visualizer.base import Link, transform_distance_canvas_to_simulation + ## WifiLink class class WifiLink(Link): ## @var node1 @@ -38,15 +40,19 @@ class WifiLink(Link): super(WifiLink, self).__init__() self.node1 = sta self.dev = dev - self.node2 = None # ap + self.node2 = None # ap self.canvas_item = GooCanvas.CanvasGroup(parent=parent_canvas_item) - self.invisible_line = GooCanvas.CanvasPolyline(parent=self.canvas_item, - line_width=25.0, - visibility=GooCanvas.CanvasItemVisibility.HIDDEN) - self.visible_line = GooCanvas.CanvasPolyline(parent=self.canvas_item, - line_width=1.0, - stroke_color_rgba=0xC00000FF, - line_dash=GooCanvas.CanvasLineDash.newv([2.0, 2.0 ])) + self.invisible_line = GooCanvas.CanvasPolyline( + parent=self.canvas_item, + line_width=25.0, + visibility=GooCanvas.CanvasItemVisibility.HIDDEN, + ) + self.visible_line = GooCanvas.CanvasPolyline( + parent=self.canvas_item, + line_width=1.0, + stroke_color_rgba=0xC00000FF, + line_dash=GooCanvas.CanvasLineDash.newv([2.0, 2.0]), + ) # self.invisible_line.set_property("pointer-events", (GooCanvas.CanvasPointerEvents.STROKE_MASK # |GooCanvas.CanvasPointerEvents.FILL_MASK # |GooCanvas.CanvasPointerEvents.PAINTED_MASK)) @@ -106,13 +112,17 @@ class WifiLink(Link): pos2_x, pos2_y = self.node2.get_position() dx = pos2_x - pos1_x dy = pos2_y - pos1_y - d = transform_distance_canvas_to_simulation(math.sqrt(dx*dx + dy*dy)) + d = transform_distance_canvas_to_simulation(math.sqrt(dx * dx + dy * dy)) mac = self.dev.GetMac() - tooltip.set_text(("WiFi link between STA Node %i and AP Node %i; distance=%.2f m.\n" - "SSID: %s\n" - "BSSID: %s") - % (self.node1.node_index, self.node2.node_index, d, - mac.GetSsid(), mac.GetBssid())) + tooltip.set_text( + ( + "WiFi link between STA Node %i and AP Node %i; distance=%.2f m.\n" + "SSID: %s\n" + "BSSID: %s" + ) + % (self.node1.node_index, self.node2.node_index, d, mac.GetSsid(), mac.GetBssid()) + ) + ## WifiLinkMonitor class class WifiLinkMonitor(object): @@ -125,8 +135,8 @@ class WifiLinkMonitor(object): @param self The object pointer. @param dummy_viz A dummy visualizer """ - self.access_points = {} # bssid -> node - self.stations = [] # list of (sta_netdevice, viz_node, wifi_link) + self.access_points = {} # bssid -> node + self.stations = [] # list of (sta_netdevice, viz_node, wifi_link) def scan_nodes(self, viz): """! Scan nodes function. @@ -134,7 +144,7 @@ class WifiLinkMonitor(object): @param viz The visualizer object @return none """ - for (sta_netdevice, viz_node, wifi_link) in self.stations: + for sta_netdevice, viz_node, wifi_link in self.stations: wifi_link.destroy() self.access_points = {} @@ -153,8 +163,8 @@ class WifiLinkMonitor(object): elif isinstance(wifi_mac, ns.wifi.ApWifiMac): bssid = ns.network.Mac48Address.ConvertFrom(dev.GetAddress()) self.access_points[str(bssid)] = node - #print "APs: ", self.access_points - #print "STAs: ", self.stations + # print "APs: ", self.access_points + # print "STAs: ", self.stations def simulation_periodic_update(self, viz): """! Simulation Periodic Update function. @@ -162,12 +172,12 @@ class WifiLinkMonitor(object): @param viz The visualizer object @return none """ - for (sta_netdevice, viz_node, wifi_link) in self.stations: + for sta_netdevice, viz_node, wifi_link in self.stations: if not sta_netdevice.IsLinkUp(): wifi_link.set_ap(None) continue bssid = str(sta_netdevice.GetMac().GetBssid()) - if bssid == '00:00:00:00:00:00': + if bssid == "00:00:00:00:00:00": wifi_link.set_ap(None) continue ap = self.access_points[bssid] @@ -179,7 +189,7 @@ class WifiLinkMonitor(object): @param viz The visualizer object @return none """ - for (dummy_sta_netdevice, dummy_viz_node, wifi_link) in self.stations: + for dummy_sta_netdevice, dummy_viz_node, wifi_link in self.stations: if wifi_link is not None: wifi_link.update_points() diff --git a/src/visualizer/visualizer/svgitem.py b/src/visualizer/visualizer/svgitem.py index d1d2954bb..90c06795c 100644 --- a/src/visualizer/visualizer/svgitem.py +++ b/src/visualizer/visualizer/svgitem.py @@ -1,8 +1,9 @@ -from gi.repository import GObject, GooCanvas -import rsvg -#import cairo +# import cairo import os.path +import rsvg +from gi.repository import GObject, GooCanvas + ## SvgItem class class SvgItem(GooCanvas.ItemSimple): @@ -35,38 +36,43 @@ class SvgItem(GooCanvas.ItemSimple): ## setup our custom properties __gproperties__ = { - 'x': (float, # property type - 'X', # property nick name - 'The x coordinate of a SVG image', # property description - -10e6, # property minimum value - 10e6, # property maximum value - 0, # property default value - GObject.PARAM_READWRITE), # property flags - - 'y': (float, - 'Y', - 'The y coordinate of a SVG image', - -10e6, - 10e6, - 0, - GObject.PARAM_READWRITE), - - 'width': (float, - 'Width', - 'The width of the SVG Image', - 0, - 10e6, - 0, - GObject.PARAM_READWRITE), - - 'height': (float, - 'Height', - 'The width of the SVG Image', - 0, - 10e6, - 0, - GObject.PARAM_READWRITE), - } + "x": ( + float, # property type + "X", # property nick name + "The x coordinate of a SVG image", # property description + -10e6, # property minimum value + 10e6, # property maximum value + 0, # property default value + GObject.PARAM_READWRITE, + ), # property flags + "y": ( + float, + "Y", + "The y coordinate of a SVG image", + -10e6, + 10e6, + 0, + GObject.PARAM_READWRITE, + ), + "width": ( + float, + "Width", + "The width of the SVG Image", + 0, + 10e6, + 0, + GObject.PARAM_READWRITE, + ), + "height": ( + float, + "Height", + "The width of the SVG Image", + 0, + 10e6, + 0, + GObject.PARAM_READWRITE, + ), + } def __init__(self, x, y, rsvg_handle, **kwargs): """! @@ -97,26 +103,26 @@ class SvgItem(GooCanvas.ItemSimple): @param value property value @return exception if unknown property """ - if pspec.name == 'x': + if pspec.name == "x": self.x = value # make sure we update the display self.changed(True) - elif pspec.name == 'y': + elif pspec.name == "y": self.y = value # make sure we update the display self.changed(True) - elif pspec.name == 'width': + elif pspec.name == "width": self.custom_width = value self._size_changed() # make sure we update the display self.changed(True) - elif pspec.name == 'height': + elif pspec.name == "height": self.custom_height = value self._size_changed() @@ -124,7 +130,7 @@ class SvgItem(GooCanvas.ItemSimple): self.changed(True) else: - raise AttributeError('unknown property %s' % pspec.name) + raise AttributeError("unknown property %s" % pspec.name) def _size_changed(self): """! @@ -141,12 +147,12 @@ class SvgItem(GooCanvas.ItemSimple): self.width = self.custom_width self.sx = self.custom_width / self.handle.props.width self.sy = self.sx - self.height = self.handle.props.height*self.sy + self.height = self.handle.props.height * self.sy elif self.custom_width is None and self.custom_height is not None: self.height = self.custom_height self.sy = self.custom_height / self.handle.props.height - self.sx = self.sy - self.width = self.handle.props.width*self.sx + self.sx = self.sy + self.width = self.handle.props.width * self.sx else: self.width = self.custom_width self.height = self.custom_height @@ -160,23 +166,23 @@ class SvgItem(GooCanvas.ItemSimple): @param pspec property name @return property value or exception if unknown property """ - if pspec.name == 'x': + if pspec.name == "x": return self.x - elif pspec.name == 'y': + elif pspec.name == "y": return self.y - elif pspec.name == 'width': + elif pspec.name == "width": self.width = self.handle.props.width self.height = self.handle.props.height return self.width - elif pspec.name == 'height': + elif pspec.name == "height": return self.height else: - raise AttributeError('unknown property %s' % pspec.name) + raise AttributeError("unknown property %s" % pspec.name) def do_simple_paint(self, cr, bounds): """! @@ -212,7 +218,9 @@ class SvgItem(GooCanvas.ItemSimple): @param is_pointer_event is the event a pointer event @return true if at or false if not """ - if ((x < self.x) or (x > self.x + self.width)) or ((y < self.y) or (y > self.y + self.height)): + if ((x < self.x) or (x > self.x + self.width)) or ( + (y < self.y) or (y > self.y + self.height) + ): return False else: return True @@ -220,12 +228,12 @@ class SvgItem(GooCanvas.ItemSimple): _rsvg_cache = dict() + def rsvg_handle_factory(base_file_name): try: return _rsvg_cache[base_file_name] except KeyError: - full_path = os.path.join(os.path.dirname(__file__), 'resource', base_file_name) + full_path = os.path.join(os.path.dirname(__file__), "resource", base_file_name) rsvg_handle = rsvg.Handle(full_path) _rsvg_cache[base_file_name] = rsvg_handle return rsvg_handle - diff --git a/src/wifi/doc/source/conf.py b/src/wifi/doc/source/conf.py index f84fecb06..f193b0845 100644 --- a/src/wifi/doc/source/conf.py +++ b/src/wifi/doc/source/conf.py @@ -11,202 +11,208 @@ # All configuration values have a default; values that are commented out # serve to show the default. -import sys, os +import os +import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. -#sys.path.insert(0, os.path.abspath('.')) +# sys.path.insert(0, os.path.abspath('.')) # -- General configuration ----------------------------------------------------- # If your documentation needs a minimal Sphinx version, state it here. -#needs_sphinx = '1.0' +# needs_sphinx = '1.0' # Add any Sphinx extension module names here, as strings. They can be extensions # coming with Sphinx (named 'sphinx.ext.*') or your custom ones. -extensions = ['sphinx.ext.imgmath'] +extensions = ["sphinx.ext.imgmath"] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix of source filenames. -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. -#source_encoding = 'utf-8-sig' +# source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'wifi' +master_doc = "wifi" # General information about the project. -project = u'ns-3' -copyright = u'ns-3 project' +project = "ns-3" +copyright = "ns-3 project" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the # built documents. # # The short X.Y version. -version = 'ns-3-dev' +version = "ns-3-dev" # The full version, including alpha/beta/rc tags. -release = 'ns-3-dev' +release = "ns-3-dev" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. -#language = None +# language = None # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: -#today = '' +# today = '' # Else, today_fmt is used as the format for a strftime call. -#today_fmt = '%B %d, %Y' +# today_fmt = '%B %d, %Y' # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. exclude_patterns = [] # The reST default role (used for this markup: `text`) to use for all documents. -#default_role = None +# default_role = None # If true, '()' will be appended to :func: etc. cross-reference text. -#add_function_parentheses = True +# add_function_parentheses = True # If true, the current module name will be prepended to all description # unit titles (such as .. function::). -#add_module_names = True +# add_module_names = True # If true, sectionauthor and moduleauthor directives will be shown in the # output. They are ignored by default. -#show_authors = False +# show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. -#modindex_common_prefix = [] +# modindex_common_prefix = [] # -- Options for HTML output --------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. -html_theme = 'default' +html_theme = "default" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. -#html_theme_options = {} +# html_theme_options = {} # Add any paths that contain custom themes here, relative to this directory. -#html_theme_path = [] +# html_theme_path = [] # The name for this set of Sphinx documents. If None, it defaults to # " v documentation". -#html_title = None +# html_title = None # A shorter title for the navigation bar. Default is the same as html_title. -#html_short_title = None +# html_short_title = None # The name of an image file (relative to this directory) to place at the top # of the sidebar. -#html_logo = None +# html_logo = None # The name of an image file (within the static path) to use as favicon of the # docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32 # pixels large. -#html_favicon = None +# html_favicon = None # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". -#html_static_path = ['_static'] +# html_static_path = ['_static'] # If not '', a 'Last updated on:' timestamp is inserted at every page bottom, # using the given strftime format. -#html_last_updated_fmt = '%b %d, %Y' +# html_last_updated_fmt = '%b %d, %Y' # If true, SmartyPants will be used to convert quotes and dashes to # typographically correct entities. -#html_use_smartypants = True +# html_use_smartypants = True # Custom sidebar templates, maps document names to template names. -#html_sidebars = {} +# html_sidebars = {} # Additional templates that should be rendered to pages, maps page names to # template names. -#html_additional_pages = {} +# html_additional_pages = {} # If false, no module index is generated. -#html_domain_indices = True +# html_domain_indices = True # If false, no index is generated. -#html_use_index = True +# html_use_index = True # If true, the index is split into individual pages for each letter. -#html_split_index = False +# html_split_index = False # If true, links to the reST sources are added to the pages. -#html_show_sourcelink = True +# html_show_sourcelink = True # If true, "Created using Sphinx" is shown in the HTML footer. Default is True. -#html_show_sphinx = True +# html_show_sphinx = True # If true, "(C) Copyright ..." is shown in the HTML footer. Default is True. -#html_show_copyright = True +# html_show_copyright = True # If true, an OpenSearch description file will be output, and all pages will # contain a tag referring to it. The value of this option must be the # base URL from which the finished HTML is served. -#html_use_opensearch = '' +# html_use_opensearch = '' # This is the file name suffix for HTML files (e.g. ".xhtml"). -#html_file_suffix = None +# html_file_suffix = None # Output file base name for HTML help builder. -#htmlhelp_basename = 'ns-3doc' +# htmlhelp_basename = 'ns-3doc' # -- Options for LaTeX output -------------------------------------------------- # The paper size ('letter' or 'a4'). -#latex_paper_size = 'letter' +# latex_paper_size = 'letter' # The font size ('10pt', '11pt' or '12pt'). -#latex_font_size = '10pt' +# latex_font_size = '10pt' # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ -# ('wifi-testing', 'wifi-doc-testing.tex', u'Wi-Fi Testing Documentation', u'ns-3 project', 'manual'), -# ('wifi-design', 'wifi-doc-design.tex', u'Wi-Fi Design Documentation', u'ns-3 project', 'manual'), -# ('wifi-user', 'wifi-doc-user.tex', u'Wi-Fi User Documentation', u'ns-3 project', 'manual'), - ('wifi', 'wifi-module-doc.tex', u'The ns-3 Wi-Fi Module Documentation', u'ns-3 project', 'manual'), + # ('wifi-testing', 'wifi-doc-testing.tex', u'Wi-Fi Testing Documentation', u'ns-3 project', 'manual'), + # ('wifi-design', 'wifi-doc-design.tex', u'Wi-Fi Design Documentation', u'ns-3 project', 'manual'), + # ('wifi-user', 'wifi-doc-user.tex', u'Wi-Fi User Documentation', u'ns-3 project', 'manual'), + ( + "wifi", + "wifi-module-doc.tex", + "The ns-3 Wi-Fi Module Documentation", + "ns-3 project", + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of # the title page. -#latex_logo = None +# latex_logo = None # For "manual" documents, if this is true, then toplevel headings are parts, # not chapters. -#latex_use_parts = False +# latex_use_parts = False # If true, show page references after internal links. -#latex_show_pagerefs = False +# latex_show_pagerefs = False # If true, show URL addresses after external links. -#latex_show_urls = False +# latex_show_urls = False # Additional stuff for the LaTeX preamble. -#latex_preamble = '' +# latex_preamble = '' # Documents to append as an appendix to all manuals. -#latex_appendices = [] +# latex_appendices = [] # If false, no module index is generated. -#latex_domain_indices = True - +# latex_domain_indices = True # add page breaks in the pdf. Level 1 is for top-level sections, level 2 for subsections, and so on. @@ -217,7 +223,4 @@ pdf_break_level = 4 # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - ('index', 'ns-3-model-library', u'ns-3 Model Library', - [u'ns-3 project'], 1) -] +man_pages = [("index", "ns-3-model-library", "ns-3 Model Library", ["ns-3 project"], 1)] diff --git a/src/wifi/examples/reference/bianchi11ax.py b/src/wifi/examples/reference/bianchi11ax.py index 5f8b5c953..fe0a50ad5 100644 --- a/src/wifi/examples/reference/bianchi11ax.py +++ b/src/wifi/examples/reference/bianchi11ax.py @@ -16,113 +16,185 @@ # # Authors: Hao Yin and Sebastien Deronne # -import numpy as np import math +import numpy as np + def bianchi_ax(data_rate, ack_rate, k, difs): # Parameters for 11ax nA = np.linspace(5, 50, 10) CWmin = 15 CWmax = 1023 - L_DATA = 1500 * 8 # data size in bits - L_ACK = 14 * 8 # ACK size in bits - #B = 1/(CWmin+1) - B=0 - EP = L_DATA/(1-B) - T_GI = 800e-9 # guard interval in seconds - T_SYMBOL_ACK = 4e-6 # symbol duration in seconds (for ACK) - T_SYMBOL_DATA = 12.8e-6 + T_GI # symbol duration in seconds (for DATA) - T_PHY_ACK = 20e-6 # PHY preamble & header duration in seconds (for ACK) - T_PHY_DATA = 44e-6 # PHY preamble & header duration in seconds (for DATA) - L_SERVICE = 16 # service field length in bits - L_TAIL = 6 # tail length in bits - L_MAC = (30) * 8 # MAC header size in bits - L_APP_HDR = 8 * 8 # bits added by the upper layer(s) + L_DATA = 1500 * 8 # data size in bits + L_ACK = 14 * 8 # ACK size in bits + # B = 1/(CWmin+1) + B = 0 + EP = L_DATA / (1 - B) + T_GI = 800e-9 # guard interval in seconds + T_SYMBOL_ACK = 4e-6 # symbol duration in seconds (for ACK) + T_SYMBOL_DATA = 12.8e-6 + T_GI # symbol duration in seconds (for DATA) + T_PHY_ACK = 20e-6 # PHY preamble & header duration in seconds (for ACK) + T_PHY_DATA = 44e-6 # PHY preamble & header duration in seconds (for DATA) + L_SERVICE = 16 # service field length in bits + L_TAIL = 6 # tail length in bits + L_MAC = (30) * 8 # MAC header size in bits + L_APP_HDR = 8 * 8 # bits added by the upper layer(s) T_SIFS = 16e-6 T_DIFS = 34e-6 T_SLOT = 9e-6 delta = 1e-7 - Aggregation_Type = 'A_MPDU' #A_MPDU or A_MSDU (HYBRID not fully supported) + Aggregation_Type = "A_MPDU" # A_MPDU or A_MSDU (HYBRID not fully supported) K_MSDU = 1 K_MPDU = k L_MPDU_HEADER = 4 L_MSDU_HEADER = 14 * 8 - if (k <= 1): - Aggregation_Type = 'NONE' + if k <= 1: + Aggregation_Type = "NONE" - N_DBPS = data_rate * T_SYMBOL_DATA # number of data bits per OFDM symbol + N_DBPS = data_rate * T_SYMBOL_DATA # number of data bits per OFDM symbol - if (Aggregation_Type == 'NONE'): - N_SYMBOLS = math.ceil((L_SERVICE + (L_MAC + L_DATA + L_APP_HDR) + L_TAIL)/N_DBPS) + if Aggregation_Type == "NONE": + N_SYMBOLS = math.ceil((L_SERVICE + (L_MAC + L_DATA + L_APP_HDR) + L_TAIL) / N_DBPS) T_DATA = T_PHY_DATA + (T_SYMBOL_DATA * N_SYMBOLS) K_MPDU = 1 K_MSDU = 1 - if (Aggregation_Type == 'A_MSDU'): - N_SYMBOLS = math.ceil((L_SERVICE + K_MPDU*(L_MAC + L_MPDU_HEADER + K_MSDU*(L_MSDU_HEADER + L_DATA + L_APP_HDR)) + L_TAIL)/N_DBPS) + if Aggregation_Type == "A_MSDU": + N_SYMBOLS = math.ceil( + ( + L_SERVICE + + K_MPDU * (L_MAC + L_MPDU_HEADER + K_MSDU * (L_MSDU_HEADER + L_DATA + L_APP_HDR)) + + L_TAIL + ) + / N_DBPS + ) T_DATA = T_PHY_DATA + (T_SYMBOL_DATA * N_SYMBOLS) - if (Aggregation_Type == 'A_MPDU'): - N_SYMBOLS = math.ceil((L_SERVICE + K_MPDU*(L_MAC + L_MPDU_HEADER + L_DATA + L_APP_HDR) + L_TAIL)/N_DBPS) + if Aggregation_Type == "A_MPDU": + N_SYMBOLS = math.ceil( + (L_SERVICE + K_MPDU * (L_MAC + L_MPDU_HEADER + L_DATA + L_APP_HDR) + L_TAIL) / N_DBPS + ) T_DATA = T_PHY_DATA + (T_SYMBOL_DATA * N_SYMBOLS) - #Calculate ACK Duration - N_DBPS = ack_rate * T_SYMBOL_ACK # number of data bits per OFDM symbol - N_SYMBOLS = math.ceil((L_SERVICE + L_ACK + L_TAIL)/N_DBPS) + # Calculate ACK Duration + N_DBPS = ack_rate * T_SYMBOL_ACK # number of data bits per OFDM symbol + N_SYMBOLS = math.ceil((L_SERVICE + L_ACK + L_TAIL) / N_DBPS) T_ACK = T_PHY_ACK + (T_SYMBOL_ACK * N_SYMBOLS) T_s = T_DATA + T_SIFS + T_ACK + T_DIFS - if difs == 1: #DIFS + if difs == 1: # DIFS T_C = T_DATA + T_DIFS else: T_s = T_DATA + T_SIFS + T_ACK + T_DIFS + delta T_C = T_DATA + T_DIFS + T_SIFS + T_ACK + delta - T_S = T_s/(1-B) + T_SLOT + T_S = T_s / (1 - B) + T_SLOT S_bianchi = np.zeros(len(nA)) for j in range(len(nA)): - n = nA[j]*1 + n = nA[j] * 1 W = CWmin + 1 - m = math.log2((CWmax + 1)/(CWmin + 1)) + m = math.log2((CWmax + 1) / (CWmin + 1)) tau1 = np.linspace(0, 0.1, 100000) - p = 1 - np.power((1 - tau1),(n - 1)) - ps = p*0 + p = 1 - np.power((1 - tau1), (n - 1)) + ps = p * 0 for i in range(int(m)): - ps = ps + np.power(2*p, i) + ps = ps + np.power(2 * p, i) - taup = 2./(1 + W + p*W*ps) + taup = 2.0 / (1 + W + p * W * ps) b = np.argmin(np.abs(tau1 - taup)) tau = taup[b] Ptr = 1 - math.pow((1 - tau), int(n)) - Ps = n*tau*math.pow((1 - tau), int(n-1))/Ptr + Ps = n * tau * math.pow((1 - tau), int(n - 1)) / Ptr - S_bianchi[j] = K_MSDU*K_MPDU*Ps*Ptr*EP/((1-Ptr)*T_SLOT+Ptr*Ps*T_S+Ptr*(1-Ps)*T_C)/1e6 + S_bianchi[j] = ( + K_MSDU + * K_MPDU + * Ps + * Ptr + * EP + / ((1 - Ptr) * T_SLOT + Ptr * Ps * T_S + Ptr * (1 - Ps) * T_C) + / 1e6 + ) bianchi_result = S_bianchi return bianchi_result + def str_result(bianchi_result, mcs, bw): - str_bianchi = ' {' + '\"HeMcs{:d}'.format(mcs) + '_{:d}MHz\"'.format(bw) + ', {\n' - for i in range (len(bianchi_result)): - str_tmp = ' {' + '{:d}, {:.4f}'.format(5*(i+1), bianchi_result[i]) +'},\n' - str_bianchi = str_bianchi + str_tmp + str_bianchi = " {" + '"HeMcs{:d}'.format(mcs) + '_{:d}MHz"'.format(bw) + ", {\n" + for i in range(len(bianchi_result)): + str_tmp = " {" + "{:d}, {:.4f}".format(5 * (i + 1), bianchi_result[i]) + "},\n" + str_bianchi = str_bianchi + str_tmp str_bianchi = str_bianchi + " }},\n" print(str_bianchi) return str_bianchi + # Settings for different MCS and mode -data_rates_20MHz = [8.603e6, 17.206e6, 25.8e6, 34.4e6, 51.5e6, 68.8e6, 77.4e6, 86e6, 103.2e6, 114.7e6, 129e6, 143.4e6] +data_rates_20MHz = [ + 8.603e6, + 17.206e6, + 25.8e6, + 34.4e6, + 51.5e6, + 68.8e6, + 77.4e6, + 86e6, + 103.2e6, + 114.7e6, + 129e6, + 143.4e6, +] ack_rates_20MHz = [6e6, 12e6, 12e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6] -data_rates_40MHz = [17.2e6, 34.4e6, 51.5e6, 68.8e6, 103.2e6, 137.6e6, 154.9e6, 172.1e6, 206.5e6, 229.4e6, 258.1e6, 286.8e6] +data_rates_40MHz = [ + 17.2e6, + 34.4e6, + 51.5e6, + 68.8e6, + 103.2e6, + 137.6e6, + 154.9e6, + 172.1e6, + 206.5e6, + 229.4e6, + 258.1e6, + 286.8e6, +] ack_rates_40MHz = [6e6, 12e6, 12e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6] -data_rates_80MHz = [36e6, 72.1e6, 108.1e6, 144.1e6, 216.2e6, 288.2e6, 324.3e6, 360.3e6, 432.4e6, 480.4e6, 540.4e6, 600.5e6] +data_rates_80MHz = [ + 36e6, + 72.1e6, + 108.1e6, + 144.1e6, + 216.2e6, + 288.2e6, + 324.3e6, + 360.3e6, + 432.4e6, + 480.4e6, + 540.4e6, + 600.5e6, +] ack_rates_80MHz = [6e6, 12e6, 12e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6] -data_rates_160MHz = [72.1e6, 144.1e6, 216.2e6, 288.2e6, 432.4e6, 576.5e6, 648.5e6, 720.6e6, 864.7e6, 960.8e6, 1080.9e6, 1201e6] +data_rates_160MHz = [ + 72.1e6, + 144.1e6, + 216.2e6, + 288.2e6, + 432.4e6, + 576.5e6, + 648.5e6, + 720.6e6, + 864.7e6, + 960.8e6, + 1080.9e6, + 1201e6, +] ack_rates_160MHz = [6e6, 12e6, 12e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6, 24e6] # Generate results with frame aggregation disabled diff --git a/src/wifi/test/examples-to-run.py b/src/wifi/test/examples-to-run.py index 852d62e72..34c7b5778 100644 --- a/src/wifi/test/examples-to-run.py +++ b/src/wifi/test/examples-to-run.py @@ -29,448 +29,2160 @@ cpp_examples = [ ("wifi-phy-configuration --testCase=19", "True", "False"), ("wifi-phy-configuration --testCase=20", "True", "False"), ("wifi-manager-example --wifiManager=Aarf --standard=802.11a --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Aarf --standard=802.11a --rtsThreshold=0 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Aarf --standard=802.11a --maxSlrc=1 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Aarf --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Aarf --standard=802.11a --rtsThreshold=0 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Aarf --standard=802.11a --maxSlrc=1 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Aarf --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Aarf --standard=802.11g --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Aarf --standard=802.11p-10MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Aarf --standard=802.11p-5MHz --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Aarf --standard=802.11p-10MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Aarf --standard=802.11p-5MHz --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Aarfcd --standard=802.11a --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Aarfcd --standard=802.11a --rtsThreshold=0 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Aarfcd --standard=802.11a --maxSlrc=1 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Aarfcd --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Aarfcd --standard=802.11g --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Aarfcd --standard=802.11p-10MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Aarfcd --standard=802.11p-5MHz --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Aarfcd --standard=802.11a --rtsThreshold=0 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Aarfcd --standard=802.11a --maxSlrc=1 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Aarfcd --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Aarfcd --standard=802.11g --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Aarfcd --standard=802.11p-10MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Aarfcd --standard=802.11p-5MHz --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Amrr --standard=802.11a --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Amrr --standard=802.11a --rtsThreshold=0 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Amrr --standard=802.11a --maxSlrc=1 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Amrr --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Amrr --standard=802.11a --rtsThreshold=0 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Amrr --standard=802.11a --maxSlrc=1 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Amrr --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Amrr --standard=802.11g --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Amrr --standard=802.11p-10MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Amrr --standard=802.11p-5MHz --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Amrr --standard=802.11p-10MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Amrr --standard=802.11p-5MHz --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Arf --standard=802.11a --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Arf --standard=802.11a --rtsThreshold=0 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Arf --standard=802.11a --maxSlrc=1 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Arf --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Arf --standard=802.11a --rtsThreshold=0 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Arf --standard=802.11a --maxSlrc=1 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Arf --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Arf --standard=802.11g --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Arf --standard=802.11p-10MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Arf --standard=802.11p-5MHz --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Arf --standard=802.11p-10MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Arf --standard=802.11p-5MHz --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Cara --standard=802.11a --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Cara --standard=802.11a --rtsThreshold=0 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Cara --standard=802.11a --maxSlrc=1 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Cara --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Cara --standard=802.11a --rtsThreshold=0 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Cara --standard=802.11a --maxSlrc=1 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Cara --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Cara --standard=802.11g --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Cara --standard=802.11p-10MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Cara --standard=802.11p-5MHz --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Cara --standard=802.11p-10MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Cara --standard=802.11p-5MHz --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Onoe --standard=802.11a --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Onoe --standard=802.11a --rtsThreshold=0 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Onoe --standard=802.11a --maxSlrc=1 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Onoe --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Onoe --standard=802.11a --rtsThreshold=0 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Onoe --standard=802.11a --maxSlrc=1 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Onoe --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Onoe --standard=802.11g --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Onoe --standard=802.11p-10MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Onoe --standard=802.11p-5MHz --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Onoe --standard=802.11p-10MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Onoe --standard=802.11p-5MHz --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Rraa --standard=802.11a --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Rraa --standard=802.11a --rtsThreshold=0 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Rraa --standard=802.11a --maxSlrc=1 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Rraa --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Rraa --standard=802.11a --rtsThreshold=0 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Rraa --standard=802.11a --maxSlrc=1 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Rraa --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Rraa --standard=802.11g --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Rraa --standard=802.11p-10MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Rraa --standard=802.11p-5MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Minstrel --standard=802.11a --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Minstrel --standard=802.11a --rtsThreshold=0 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Minstrel --standard=802.11a --maxSlrc=1 --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Minstrel --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Minstrel --standard=802.11g --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Minstrel --standard=802.11p-10MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Minstrel --standard=802.11p-5MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11a --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11g --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11p-10MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11p-5MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), + ( + "wifi-manager-example --wifiManager=Rraa --standard=802.11p-10MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Rraa --standard=802.11p-5MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Minstrel --standard=802.11a --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Minstrel --standard=802.11a --rtsThreshold=0 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Minstrel --standard=802.11a --maxSlrc=1 --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=Minstrel --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Minstrel --standard=802.11g --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Minstrel --standard=802.11p-10MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Minstrel --standard=802.11p-5MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11a --stepTime=0.1", + "True", + "True", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11g --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11p-10MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11p-5MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), ("wifi-manager-example --wifiManager=Ideal --standard=802.11a --stepTime=0.1", "True", "True"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", "True", "False"), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11b --serverChannelWidth=22 --clientChannelWidth=22 --stepTime=0.1", + "True", + "False", + ), ("wifi-manager-example --wifiManager=Ideal --standard=802.11g --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11p-10MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11p-5MHz --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", "False", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", "True", "False"), - ("wifi-test-interference-helper --enableCapture=0 --txPowerA=5 --txPowerB=15 --delay=10 --txModeA=OfdmRate6Mbps --txModeB=OfdmRate6Mbps --checkResults=1 --expectRxASuccessful=0 --expectRxBSuccessful=0", "True", "True"), - ("wifi-test-interference-helper --enableCapture=0 --txPowerA=5 --txPowerB=15 --delay=17 --standard=WIFI_PHY_STANDARD_80211ac --preamble=WIFI_PREAMBLE_VHT_SU --txModeA=VhtMcs0 --txModeB=VhtMcs0 --checkResults=1 --expectRxASuccessful=0 --expectRxBSuccessful=0", "True", "True"), - ("wifi-test-interference-helper --enableCapture=0 --txPowerA=5 --txPowerB=15 --delay=20 --standard=WIFI_PHY_STANDARD_80211ac --preamble=WIFI_PREAMBLE_VHT_SU --txModeA=VhtMcs0 --txModeB=VhtMcs0 --checkResults=1 --expectRxASuccessful=0 --expectRxBSuccessful=0", "True", "True"), - ("wifi-test-interference-helper --enableCapture=0 --txPowerA=5 --txPowerB=15 --delay=27 --standard=WIFI_PHY_STANDARD_80211ac --preamble=WIFI_PREAMBLE_VHT_SU --txModeA=VhtMcs0 --txModeB=VhtMcs0 --checkResults=1 --expectRxASuccessful=0 --expectRxBSuccessful=0", "True", "True"), - ("wifi-test-interference-helper --enableCapture=1 --txPowerA=5 --txPowerB=15 --delay=10 --txModeA=OfdmRate6Mbps --txModeB=OfdmRate6Mbps --checkResults=1 --expectRxASuccessful=0 --expectRxBSuccessful=1", "True", "False"), - ("wifi-bianchi --validate --phyMode=OfdmRate54Mbps --nMinStas=5 --nMaxStas=10 --duration=5", "False", "False"), # TODO: run from N=5 to N=50 for 100s (TAKES_FOREVER) when issue #170 is fixed - ("wifi-bianchi --validate --phyMode=OfdmRate6Mbps --nMinStas=5 --nMaxStas=10 --duration=15", "True", "False"), # TODO: run from N=5 to N=50 for 400s (TAKES_FOREVER) when issue #170 is fixed - ("wifi-bianchi --validate --phyMode=OfdmRate54Mbps --nMinStas=5 --nMaxStas=10 --duration=5 --infra", "False", "False"), # TODO: run from N=5 to N=50 for 100s (TAKES_FOREVER) when issue #170 is fixed - ("wifi-bianchi --validate --phyMode=OfdmRate6Mbps --nMinStas=5 --nMaxStas=10 --duration=20 --infra", "False", "False"), # TODO: run from N=5 to N=50 for 600s (TAKES_FOREVER) when issue #170 is fixed + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11p-10MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11p-5MHz --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11n-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ac --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=400 --clientShortGuardInterval=400 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=Ideal --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-5GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-2.4GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=1 --clientNss=1 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=2 --clientNss=2 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=3 --clientNss=3 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=20 --clientChannelWidth=20 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=40 --clientChannelWidth=40 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=80 --clientChannelWidth=80 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=800 --clientShortGuardInterval=800 --serverNss=4 --clientNss=4 --stepTime=0.1", + "False", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=1600 --clientShortGuardInterval=1600 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-manager-example --wifiManager=MinstrelHt --standard=802.11ax-6GHz --serverChannelWidth=160 --clientChannelWidth=160 --serverShortGuardInterval=3200 --clientShortGuardInterval=3200 --serverNss=4 --clientNss=4 --stepTime=0.1", + "True", + "False", + ), + ( + "wifi-test-interference-helper --enableCapture=0 --txPowerA=5 --txPowerB=15 --delay=10 --txModeA=OfdmRate6Mbps --txModeB=OfdmRate6Mbps --checkResults=1 --expectRxASuccessful=0 --expectRxBSuccessful=0", + "True", + "True", + ), + ( + "wifi-test-interference-helper --enableCapture=0 --txPowerA=5 --txPowerB=15 --delay=17 --standard=WIFI_PHY_STANDARD_80211ac --preamble=WIFI_PREAMBLE_VHT_SU --txModeA=VhtMcs0 --txModeB=VhtMcs0 --checkResults=1 --expectRxASuccessful=0 --expectRxBSuccessful=0", + "True", + "True", + ), + ( + "wifi-test-interference-helper --enableCapture=0 --txPowerA=5 --txPowerB=15 --delay=20 --standard=WIFI_PHY_STANDARD_80211ac --preamble=WIFI_PREAMBLE_VHT_SU --txModeA=VhtMcs0 --txModeB=VhtMcs0 --checkResults=1 --expectRxASuccessful=0 --expectRxBSuccessful=0", + "True", + "True", + ), + ( + "wifi-test-interference-helper --enableCapture=0 --txPowerA=5 --txPowerB=15 --delay=27 --standard=WIFI_PHY_STANDARD_80211ac --preamble=WIFI_PREAMBLE_VHT_SU --txModeA=VhtMcs0 --txModeB=VhtMcs0 --checkResults=1 --expectRxASuccessful=0 --expectRxBSuccessful=0", + "True", + "True", + ), + ( + "wifi-test-interference-helper --enableCapture=1 --txPowerA=5 --txPowerB=15 --delay=10 --txModeA=OfdmRate6Mbps --txModeB=OfdmRate6Mbps --checkResults=1 --expectRxASuccessful=0 --expectRxBSuccessful=1", + "True", + "False", + ), + ( + "wifi-bianchi --validate --phyMode=OfdmRate54Mbps --nMinStas=5 --nMaxStas=10 --duration=5", + "False", + "False", + ), # TODO: run from N=5 to N=50 for 100s (TAKES_FOREVER) when issue #170 is fixed + ( + "wifi-bianchi --validate --phyMode=OfdmRate6Mbps --nMinStas=5 --nMaxStas=10 --duration=15", + "True", + "False", + ), # TODO: run from N=5 to N=50 for 400s (TAKES_FOREVER) when issue #170 is fixed + ( + "wifi-bianchi --validate --phyMode=OfdmRate54Mbps --nMinStas=5 --nMaxStas=10 --duration=5 --infra", + "False", + "False", + ), # TODO: run from N=5 to N=50 for 100s (TAKES_FOREVER) when issue #170 is fixed + ( + "wifi-bianchi --validate --phyMode=OfdmRate6Mbps --nMinStas=5 --nMaxStas=10 --duration=20 --infra", + "False", + "False", + ), # TODO: run from N=5 to N=50 for 600s (TAKES_FOREVER) when issue #170 is fixed ] # A list of Python examples to run in order to ensure that they remain diff --git a/test.py b/test.py index 41ce6d6fc..16ab66880 100755 --- a/test.py +++ b/test.py @@ -27,23 +27,42 @@ import threading import time import xml.etree.ElementTree as ET - from utils import get_list_from_file # Global variable args = None # imported from waflib Logs -colors_lst={'USE':True,'BOLD':'\x1b[01;1m','RED':'\x1b[01;31m','GREEN':'\x1b[32m','YELLOW':'\x1b[33m','PINK':'\x1b[35m','BLUE':'\x1b[01;34m','CYAN':'\x1b[36m','GREY':'\x1b[37m','NORMAL':'\x1b[0m','cursor_on':'\x1b[?25h','cursor_off':'\x1b[?25l',} +colors_lst = { + "USE": True, + "BOLD": "\x1b[01;1m", + "RED": "\x1b[01;31m", + "GREEN": "\x1b[32m", + "YELLOW": "\x1b[33m", + "PINK": "\x1b[35m", + "BLUE": "\x1b[01;34m", + "CYAN": "\x1b[36m", + "GREY": "\x1b[37m", + "NORMAL": "\x1b[0m", + "cursor_on": "\x1b[?25h", + "cursor_off": "\x1b[?25l", +} + + def get_color(cl): - if colors_lst['USE']: - return colors_lst.get(cl, '') - return '' + if colors_lst["USE"]: + return colors_lst.get(cl, "") + return "" + + class color_dict(object): def __getattr__(self, a): return get_color(a) + def __call__(self, a): return get_color(a) + + colors = color_dict() # @@ -117,6 +136,7 @@ core_valgrind_skip_tests = [ "lte-pss-ff-mac-scheduler", ] + # # Parse the examples-to-run file if it exists. # @@ -129,8 +149,8 @@ def parse_examples_to_run_file( python_script_dir, example_tests, example_names_original, - python_tests): - + python_tests, +): # Look for the examples-to-run file exists. if not os.path.exists(examples_to_run_path): return @@ -153,15 +173,14 @@ def parse_examples_to_run_file( # cpp_examples = get_list_from_file(examples_to_run_path, "cpp_examples") for example_name, do_run, do_valgrind_run in cpp_examples: - # Separate the example name from its arguments. example_name_original = example_name - example_name_parts = example_name.split(' ', 1) + example_name_parts = example_name.split(" ", 1) if len(example_name_parts) == 1: - example_name = example_name_parts[0] + example_name = example_name_parts[0] example_arguments = "" else: - example_name = example_name_parts[0] + example_name = example_name_parts[0] example_arguments = example_name_parts[1] # Add the proper prefix and suffix to the example name to @@ -170,10 +189,8 @@ def parse_examples_to_run_file( # Set the full path for the example. example_path = os.path.join(cpp_executable_dir, example_path) - example_path += '.exe' if sys.platform == 'win32' else '' - example_name = os.path.join( - os.path.relpath(cpp_executable_dir, NS3_BUILDDIR), - example_name) + example_path += ".exe" if sys.platform == "win32" else "" + example_name = os.path.join(os.path.relpath(cpp_executable_dir, NS3_BUILDDIR), example_name) # Add all of the C++ examples that were built, i.e. found # in the directory, to the list of C++ examples to run. if os.path.exists(example_path): @@ -201,12 +218,12 @@ def parse_examples_to_run_file( python_examples = get_list_from_file(examples_to_run_path, "python_examples") for example_name, do_run in python_examples: # Separate the example name from its arguments. - example_name_parts = example_name.split(' ', 1) + example_name_parts = example_name.split(" ", 1) if len(example_name_parts) == 1: - example_name = example_name_parts[0] + example_name = example_name_parts[0] example_arguments = "" else: - example_name = example_name_parts[0] + example_name = example_name_parts[0] example_arguments = example_name_parts[1] # Set the full path for the example. @@ -222,6 +239,7 @@ def parse_examples_to_run_file( # Add this example. python_tests.append((example_path, do_run)) + # # The test suites are going to want to output status. They are running # concurrently. This means that unless we are careful, the output of @@ -236,61 +254,65 @@ def parse_examples_to_run_file( # TMP_OUTPUT_DIR = "testpy-output" + def read_test(test): - result = test.find('Result').text - name = test.find('Name').text - if not test.find('Reason') is None: - reason = test.find('Reason').text + result = test.find("Result").text + name = test.find("Name").text + if not test.find("Reason") is None: + reason = test.find("Reason").text else: - reason = '' - if not test.find('Time') is None: - time_real = test.find('Time').get('real') + reason = "" + if not test.find("Time") is None: + time_real = test.find("Time").get("real") else: - time_real = '' + time_real = "" return (result, name, reason, time_real) + # # A simple example of writing a text file with a test result summary. It is # expected that this output will be fine for developers looking for problems. # -def node_to_text(test, f, test_type='Suite'): +def node_to_text(test, f, test_type="Suite"): (result, name, reason, time_real) = read_test(test) if reason: reason = " (%s)" % reason - output = "%s: Test %s \"%s\" (%s)%s\n" % (result, test_type, name, time_real, reason) + output = '%s: Test %s "%s" (%s)%s\n' % (result, test_type, name, time_real, reason) f.write(output) - for details in test.findall('FailureDetails'): + for details in test.findall("FailureDetails"): f.write(" Details:\n") - f.write(" Message: %s\n" % details.find('Message').text) - f.write(" Condition: %s\n" % details.find('Condition').text) - f.write(" Actual: %s\n" % details.find('Actual').text) - f.write(" Limit: %s\n" % details.find('Limit').text) - f.write(" File: %s\n" % details.find('File').text) - f.write(" Line: %s\n" % details.find('Line').text) - for child in test.findall('Test'): - node_to_text(child, f, 'Case') + f.write(" Message: %s\n" % details.find("Message").text) + f.write(" Condition: %s\n" % details.find("Condition").text) + f.write(" Actual: %s\n" % details.find("Actual").text) + f.write(" Limit: %s\n" % details.find("Limit").text) + f.write(" File: %s\n" % details.find("File").text) + f.write(" Line: %s\n" % details.find("Line").text) + for child in test.findall("Test"): + node_to_text(child, f, "Case") + def translate_to_text(results_file, text_file): - text_file += ('.txt' if '.txt' not in text_file else '') - print('Writing results to text file \"%s\"...' % text_file, end='') + text_file += ".txt" if ".txt" not in text_file else "" + print('Writing results to text file "%s"...' % text_file, end="") et = ET.parse(results_file) - with open(text_file, 'w', encoding='utf-8') as f: - for test in et.findall('Test'): + with open(text_file, "w", encoding="utf-8") as f: + for test in et.findall("Test"): node_to_text(test, f) - for example in et.findall('Example'): - result = example.find('Result').text - name = example.find('Name').text - if not example.find('Time') is None: - time_real = example.find('Time').get('real') + for example in et.findall("Example"): + result = example.find("Result").text + name = example.find("Name").text + if not example.find("Time") is None: + time_real = example.find("Time").get("real") else: - time_real = '' - output = "%s: Example \"%s\" (%s)\n" % (result, name, time_real) + time_real = "" + output = '%s: Example "%s" (%s)\n' % (result, name, time_real) f.write(output) - print('done.') + print("done.") + # # A simple example of writing an HTML file with a test result summary. It is @@ -299,10 +321,10 @@ def translate_to_text(results_file, text_file): # since it will probably grow over time. # def translate_to_html(results_file, html_file): - html_file += ('.html' if '.html' not in html_file else '') - print('Writing results to html file %s...' % html_file, end='') + html_file += ".html" if ".html" not in html_file else "" + print("Writing results to html file %s..." % html_file, end="") - with open(html_file, 'w', encoding='utf-8') as f: + with open(html_file, "w", encoding="utf-8") as f: f.write("\n") f.write("\n") f.write("

ns-3 Test Results

\n") @@ -316,7 +338,7 @@ def translate_to_html(results_file, html_file): # Iterate through the test suites # f.write("

Test Suites

\n") - for suite in et.findall('Test'): + for suite in et.findall("Test"): # # For each test suite, get its name, result and execution time info # @@ -329,16 +351,19 @@ def translate_to_html(results_file, html_file): # and print in red. # if result == "PASS": - f.write("

%s: %s (%s)

\n" % (result, name, time)) + f.write('

%s: %s (%s)

\n' % (result, name, time)) elif result == "SKIP": - f.write("

%s: %s (%s) (%s)

\n" % (result, name, time, reason)) + f.write( + '

%s: %s (%s) (%s)

\n' + % (result, name, time, reason) + ) else: - f.write("

%s: %s (%s)

\n" % (result, name, time)) + f.write('

%s: %s (%s)

\n' % (result, name, time)) # # The test case information goes in a table. # - f.write("\n") + f.write('
\n') # # The first column of the table has the heading Result @@ -360,9 +385,9 @@ def translate_to_html(results_file, html_file): if result in ["CRASH", "SKIP", "VALGR"]: f.write("\n") if result == "SKIP": - f.write("\n" % result) + f.write('\n' % result) else: - f.write("\n" % result) + f.write('\n' % result) f.write("\n") f.write("
%s%s%s%s
\n") continue @@ -392,8 +417,7 @@ def translate_to_html(results_file, html_file): # # Now iterate through all the test cases. # - for case in suite.findall('Test'): - + for case in suite.findall("Test"): # # Get the name, result and timing information from xml to use in # printing table below. @@ -423,8 +447,7 @@ def translate_to_html(results_file, html_file): # first_row = True - for details in case.findall('FailureDetails'): - + for details in case.findall("FailureDetails"): # # Start a new row in the table for each possible Failure Detail # @@ -432,7 +455,7 @@ def translate_to_html(results_file, html_file): if first_row: first_row = False - f.write("%s\n" % result) + f.write('%s\n' % result) f.write("%s\n" % name) f.write("%s\n" % time) else: @@ -441,12 +464,12 @@ def translate_to_html(results_file, html_file): f.write("\n") f.write("") - f.write("Message: %s, " % details.find('Message').text) - f.write("Condition: %s, " % details.find('Condition').text) - f.write("Actual: %s, " % details.find('Actual').text) - f.write("Limit: %s, " % details.find('Limit').text) - f.write("File: %s, " % details.find('File').text) - f.write("Line: %s" % details.find('Line').text) + f.write("Message: %s, " % details.find("Message").text) + f.write("Condition: %s, " % details.find("Condition").text) + f.write("Actual: %s, " % details.find("Actual").text) + f.write("Limit: %s, " % details.find("Limit").text) + f.write("File: %s, " % details.find("File").text) + f.write("Line: %s" % details.find("Line").text) f.write("\n") # @@ -467,7 +490,7 @@ def translate_to_html(results_file, html_file): # +--------+----------------+------+---------+ # f.write("\n") - f.write("%s\n" % result) + f.write('%s\n' % result) f.write("%s\n" % name) f.write("%s\n" % time) f.write("%s\n" % reason) @@ -486,7 +509,7 @@ def translate_to_html(results_file, html_file): # # Example status is rendered in a table just like the suites. # - f.write("\n") + f.write('
\n') # # The table headings look like, @@ -504,7 +527,6 @@ def translate_to_html(results_file, html_file): # Now iterate through all the examples # for example in et.findall("Example"): - # # Start a new row for each example # @@ -520,11 +542,11 @@ def translate_to_html(results_file, html_file): # in red; otherwise green. This goes in a table data # if result == "PASS": - f.write("\n" % result) + f.write('\n' % result) elif result == "SKIP": - f.write("\n" % result) + f.write('\n' % result) # # Write the example name as a new tag data. @@ -557,7 +579,8 @@ def translate_to_html(results_file, html_file): f.write("\n") f.write("\n") - print('done.') + print("done.") + # # Python Control-C handling is broken in the presence of multiple threads. @@ -567,6 +590,7 @@ def translate_to_html(results_file, html_file): # thread_exit = False + def sigint_hook(signal, frame): global thread_exit thread_exit = True @@ -597,14 +621,17 @@ def read_ns3_config(): with open(lock_filename, "rt", encoding="utf-8") as f: for line in f: if line.startswith("top_dir ="): - key, val = line.split('=') + key, val = line.split("=") top_dir = eval(val.strip()) if line.startswith("out_dir ="): - key, val = line.split('=') + key, val = line.split("=") out_dir = eval(val.strip()) except FileNotFoundError: - print('The .lock-ns3 file was not found. You must configure before running test.py.', file=sys.stderr) + print( + "The .lock-ns3 file was not found. You must configure before running test.py.", + file=sys.stderr, + ) sys.exit(2) global NS3_BASEDIR @@ -612,7 +639,7 @@ def read_ns3_config(): global NS3_BUILDDIR NS3_BUILDDIR = out_dir - with open(lock_filename, encoding='utf-8') as f: + with open(lock_filename, encoding="utf-8") as f: for line in f.readlines(): for item in interesting_config_items: if line.startswith(item): @@ -622,6 +649,7 @@ def read_ns3_config(): for item in interesting_config_items: print("%s ==" % item, eval(item)) + # # It seems pointless to fork a process to run ns3 to fork a process to run # the test runner, so we just run the test runner directly. The main thing @@ -657,7 +685,7 @@ def make_paths(): os.environ["PYTHONPATH"] += ":" + pypath if args.verbose: - print("os.environ[\"PYTHONPATH\"] == %s" % os.environ["PYTHONPATH"]) + print('os.environ["PYTHONPATH"] == %s' % os.environ["PYTHONPATH"]) if sys.platform == "darwin": if not have_DYLD_LIBRARY_PATH: @@ -665,28 +693,29 @@ def make_paths(): for path in NS3_MODULE_PATH: os.environ["DYLD_LIBRARY_PATH"] += ":" + path if args.verbose: - print("os.environ[\"DYLD_LIBRARY_PATH\"] == %s" % os.environ["DYLD_LIBRARY_PATH"]) + print('os.environ["DYLD_LIBRARY_PATH"] == %s' % os.environ["DYLD_LIBRARY_PATH"]) elif sys.platform == "win32": if not have_PATH: os.environ["PATH"] = "" for path in NS3_MODULE_PATH: - os.environ["PATH"] += ';' + path + os.environ["PATH"] += ";" + path if args.verbose: - print("os.environ[\"PATH\"] == %s" % os.environ["PATH"]) + print('os.environ["PATH"] == %s' % os.environ["PATH"]) elif sys.platform == "cygwin": if not have_PATH: os.environ["PATH"] = "" for path in NS3_MODULE_PATH: os.environ["PATH"] += ":" + path if args.verbose: - print("os.environ[\"PATH\"] == %s" % os.environ["PATH"]) + print('os.environ["PATH"] == %s' % os.environ["PATH"]) else: if not have_LD_LIBRARY_PATH: os.environ["LD_LIBRARY_PATH"] = "" for path in NS3_MODULE_PATH: os.environ["LD_LIBRARY_PATH"] += ":" + str(path) if args.verbose: - print("os.environ[\"LD_LIBRARY_PATH\"] == %s" % os.environ["LD_LIBRARY_PATH"]) + print('os.environ["LD_LIBRARY_PATH"] == %s' % os.environ["LD_LIBRARY_PATH"]) + # # Short note on generating suppressions: @@ -774,8 +803,8 @@ def make_paths(): # VALGRIND_SUPPRESSIONS_FILE = "testpy.supp" VALGRIND_SUPPRESSIONS_FILE = None -def run_job_synchronously(shell_command, directory, valgrind, is_python, build_path=""): +def run_job_synchronously(shell_command, directory, valgrind, is_python, build_path=""): if VALGRIND_SUPPRESSIONS_FILE is not None: suppressions_path = os.path.join(NS3_BASEDIR, VALGRIND_SUPPRESSIONS_FILE) @@ -789,10 +818,15 @@ def run_job_synchronously(shell_command, directory, valgrind, is_python, build_p if valgrind: if VALGRIND_SUPPRESSIONS_FILE: - cmd = "valgrind --suppressions=%s --leak-check=full --show-reachable=yes --error-exitcode=2 --errors-for-leak-kinds=all %s" % (suppressions_path, - path_cmd) + cmd = ( + "valgrind --suppressions=%s --leak-check=full --show-reachable=yes --error-exitcode=2 --errors-for-leak-kinds=all %s" + % (suppressions_path, path_cmd) + ) else: - cmd = "valgrind --leak-check=full --show-reachable=yes --error-exitcode=2 --errors-for-leak-kinds=all %s" % (path_cmd) + cmd = ( + "valgrind --leak-check=full --show-reachable=yes --error-exitcode=2 --errors-for-leak-kinds=all %s" + % (path_cmd) + ) else: cmd = path_cmd @@ -800,7 +834,9 @@ def run_job_synchronously(shell_command, directory, valgrind, is_python, build_p print("Synchronously execute %s" % cmd) start_time = time.time() - proc = subprocess.Popen(cmd, shell=True, cwd=directory, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc = subprocess.Popen( + cmd, shell=True, cwd=directory, stdout=subprocess.PIPE, stderr=subprocess.PIPE + ) stdout_results, stderr_results = proc.communicate() elapsed_time = time.time() - start_time @@ -810,6 +846,7 @@ def run_job_synchronously(shell_command, directory, valgrind, is_python, build_p try: stream_results = stream_results.decode() except UnicodeDecodeError: + def decode(byte_array: bytes): try: byte_array.decode() @@ -819,7 +856,9 @@ def run_job_synchronously(shell_command, directory, valgrind, is_python, build_p # Find lines where the decoding error happened non_utf8_lines = list(map(lambda line: decode(line), stream_results.splitlines())) non_utf8_lines = list(filter(lambda line: line is not None, non_utf8_lines)) - print(f"Non-decodable characters found in {stream_name} output of {cmd}: {non_utf8_lines}") + print( + f"Non-decodable characters found in {stream_name} output of {cmd}: {non_utf8_lines}" + ) # Continue decoding on errors stream_results = stream_results.decode(errors="backslashreplace") @@ -834,6 +873,7 @@ def run_job_synchronously(shell_command, directory, valgrind, is_python, build_p return (retval, stdout_results, stderr_results, elapsed_time) + # # This class defines a unit of testing work. It will typically refer to # a test suite to run using the test-runner, or an example to run directly. @@ -969,6 +1009,7 @@ class Job: def set_elapsed_time(self, elapsed_time): self.elapsed_time = elapsed_time + # # The worker thread class that handles the actual running of a given test. # Once spawned, it receives requests for work through its input_queue and @@ -1022,8 +1063,14 @@ class worker_thread(threading.Thread): # know. It will be something like "examples/udp/udp-echo" or # "examples/wireless/mixed-wireless.py" # - (job.returncode, job.standard_out, job.standard_err, et) = run_job_synchronously(job.shell_command, - job.cwd, args.valgrind, job.is_pyexample, job.build_path) + ( + job.returncode, + job.standard_out, + job.standard_err, + et, + ) = run_job_synchronously( + job.shell_command, job.cwd, args.valgrind, job.is_pyexample, job.build_path + ) else: # # If we're a test suite, we need to provide a little more info @@ -1031,12 +1078,22 @@ class worker_thread(threading.Thread): # file name # if args.update_data: - update_data = '--update-data' + update_data = "--update-data" else: - update_data = '' - (job.returncode, job.standard_out, job.standard_err, et) = run_job_synchronously(job.shell_command + - " --xml --tempdir=%s --out=%s %s" % (job.tempdir, job.tmp_file_name, update_data), - job.cwd, args.valgrind, False) + update_data = "" + ( + job.returncode, + job.standard_out, + job.standard_err, + et, + ) = run_job_synchronously( + job.shell_command + + " --xml --tempdir=%s --out=%s %s" + % (job.tempdir, job.tmp_file_name, update_data), + job.cwd, + args.valgrind, + False, + ) job.set_elapsed_time(et) @@ -1050,17 +1107,21 @@ class worker_thread(threading.Thread): self.output_queue.put(job) + # # This function loads the list of previously successful or skipped examples and test suites. # def load_previously_successful_tests(): import glob + previously_run_tests_to_skip = {"test": [], "example": []} previous_results = glob.glob(f"{TMP_OUTPUT_DIR}/*-results.xml") if not previous_results: print("No previous runs to rerun") exit(-1) - latest_result_file = list(sorted(previous_results, key=lambda x: os.path.basename(x), reverse=True))[0] + latest_result_file = list( + sorted(previous_results, key=lambda x: os.path.basename(x), reverse=True) + )[0] try: previous_run_results = ET.parse(latest_result_file) @@ -1070,15 +1131,18 @@ def load_previously_successful_tests(): for test_type in ["Test", "Example"]: if previous_run_results.find(test_type): - temp = list(map(lambda x: (x.find('Name').text, x.find('Result').text), - previous_run_results.findall(test_type) - ) - ) - temp = list(filter(lambda x: x[1] in ['PASS', 'SKIP'], temp)) + temp = list( + map( + lambda x: (x.find("Name").text, x.find("Result").text), + previous_run_results.findall(test_type), + ) + ) + temp = list(filter(lambda x: x[1] in ["PASS", "SKIP"], temp)) temp = [x[0] for x in temp] previously_run_tests_to_skip[test_type.lower()] = temp return previously_run_tests_to_skip + # # This is the main function that does the work of interacting with the # test-runner itself. @@ -1096,7 +1160,7 @@ def run_tests(): # Set the proper suffix. # global BUILD_PROFILE_SUFFIX - if BUILD_PROFILE == 'release': + if BUILD_PROFILE == "release": BUILD_PROFILE_SUFFIX = "" else: BUILD_PROFILE_SUFFIX = "-" + BUILD_PROFILE @@ -1106,7 +1170,7 @@ def run_tests(): # match what is done in the CMakeLists.txt file. # test_runner_name = "%s%s-%s%s" % (APPNAME, VERSION, "test-runner", BUILD_PROFILE_SUFFIX) - test_runner_name += '.exe' if sys.platform == 'win32' else '' + test_runner_name += ".exe" if sys.platform == "win32" else "" # # Run ns3 to make sure that everything is built, configured and ready to go @@ -1115,7 +1179,6 @@ def run_tests(): # we allow users that know what they're doing to not invoke ns3 at all. # if not args.no_build: - # If the user only wants to run a single example, then we can just build # that example. # @@ -1138,7 +1201,6 @@ def run_tests(): print("ns3 died. Not running tests", file=sys.stderr) return proc.returncode - # # Dynamically set up paths. # @@ -1153,7 +1215,10 @@ def run_tests(): ns3_runnable_scripts = get_list_from_file(lock_filename, "ns3_runnable_scripts") ns3_runnable_scripts = [os.path.basename(script) for script in ns3_runnable_scripts] else: - print('The build status file was not found. You must configure before running test.py.', file=sys.stderr) + print( + "The build status file was not found. You must configure before running test.py.", + file=sys.stderr, + ) sys.exit(2) # @@ -1173,10 +1238,10 @@ def run_tests(): python_tests = [] for directory in EXAMPLE_DIRECTORIES: # Set the directories and paths for this example. - example_directory = os.path.join("examples", directory) + example_directory = os.path.join("examples", directory) examples_to_run_path = os.path.join(example_directory, "examples-to-run.py") - cpp_executable_dir = os.path.join(NS3_BUILDDIR, example_directory) - python_script_dir = os.path.join(example_directory) + cpp_executable_dir = os.path.join(NS3_BUILDDIR, example_directory) + python_script_dir = os.path.join(example_directory) # Parse this example directory's file. parse_examples_to_run_file( @@ -1185,18 +1250,19 @@ def run_tests(): python_script_dir, example_tests, example_names_original, - python_tests) + python_tests, + ) for module in NS3_ENABLED_MODULES: # Remove the "ns3-" from the module name. - module = module[len("ns3-"):] + module = module[len("ns3-") :] # Set the directories and paths for this example. - module_directory = os.path.join("src", module) - example_directory = os.path.join(module_directory, "examples") + module_directory = os.path.join("src", module) + example_directory = os.path.join(module_directory, "examples") examples_to_run_path = os.path.join(module_directory, "test", "examples-to-run.py") - cpp_executable_dir = os.path.join(NS3_BUILDDIR, example_directory) - python_script_dir = os.path.join(example_directory) + cpp_executable_dir = os.path.join(NS3_BUILDDIR, example_directory) + python_script_dir = os.path.join(example_directory) # Parse this module's file. parse_examples_to_run_file( @@ -1205,18 +1271,19 @@ def run_tests(): python_script_dir, example_tests, example_names_original, - python_tests) + python_tests, + ) for module in NS3_ENABLED_CONTRIBUTED_MODULES: # Remove the "ns3-" from the module name. - module = module[len("ns3-"):] + module = module[len("ns3-") :] # Set the directories and paths for this example. - module_directory = os.path.join("contrib", module) - example_directory = os.path.join(module_directory, "examples") + module_directory = os.path.join("contrib", module) + example_directory = os.path.join(module_directory, "examples") examples_to_run_path = os.path.join(module_directory, "test", "examples-to-run.py") - cpp_executable_dir = os.path.join(NS3_BUILDDIR, example_directory) - python_script_dir = os.path.join(example_directory) + cpp_executable_dir = os.path.join(NS3_BUILDDIR, example_directory) + python_script_dir = os.path.join(example_directory) # Parse this module's file. parse_examples_to_run_file( @@ -1225,7 +1292,8 @@ def run_tests(): python_script_dir, example_tests, example_names_original, - python_tests) + python_tests, + ) # # If lots of logging is enabled, we can crash Python when it tries to @@ -1242,25 +1310,41 @@ def run_tests(): # if args.kinds: path_cmd = os.path.join("utils", test_runner_name + " --print-test-type-list") - (rc, standard_out, standard_err, et) = run_job_synchronously(path_cmd, os.getcwd(), False, False) + (rc, standard_out, standard_err, et) = run_job_synchronously( + path_cmd, os.getcwd(), False, False + ) print(standard_out) if args.list: list_items = [] if ENABLE_TESTS: if len(args.constrain): - path_cmd = os.path.join("utils", test_runner_name + " --print-test-name-list --print-test-types --test-type=%s" % args.constrain) + path_cmd = os.path.join( + "utils", + test_runner_name + + " --print-test-name-list --print-test-types --test-type=%s" % args.constrain, + ) else: - path_cmd = os.path.join("utils", test_runner_name + " --print-test-name-list --print-test-types") - (rc, standard_out, standard_err, et) = run_job_synchronously(path_cmd, os.getcwd(), False, False) + path_cmd = os.path.join( + "utils", test_runner_name + " --print-test-name-list --print-test-types" + ) + (rc, standard_out, standard_err, et) = run_job_synchronously( + path_cmd, os.getcwd(), False, False + ) if rc != 0: # This is usually a sign that ns-3 crashed or exited uncleanly - print(('test.py error: test-runner return code returned {}'.format(rc))) - print(('To debug, try running {}\n'.format('\'./ns3 run \"test-runner --print-test-name-list\"\''))) + print(("test.py error: test-runner return code returned {}".format(rc))) + print( + ( + "To debug, try running {}\n".format( + "'./ns3 run \"test-runner --print-test-name-list\"'" + ) + ) + ) return if isinstance(standard_out, bytes): standard_out = standard_out.decode() - list_items = standard_out.split('\n') + list_items = standard_out.split("\n") list_items.sort() print("Test Type Test Name") print("--------- ---------") @@ -1273,8 +1357,8 @@ def run_tests(): examples_sorted.sort() if ENABLE_PYTHON_BINDINGS: python_examples_sorted = [] - for (x, y) in python_tests: - if y == 'True': + for x, y in python_tests: + if y == "True": python_examples_sorted.append(x) python_examples_sorted.sort() examples_sorted.extend(python_examples_sorted) @@ -1330,9 +1414,9 @@ def run_tests(): # The file is created outside the directory that gets automatically deleted. # xml_results_file = os.path.join(TMP_OUTPUT_DIR, f"{date_and_time}-results.xml") - with open(xml_results_file, 'w', encoding='utf-8') as f: + with open(xml_results_file, "w", encoding="utf-8") as f: f.write('\n') - f.write('\n') + f.write("\n") # # We need to figure out what test suites to execute. We are either given one @@ -1371,20 +1455,30 @@ def run_tests(): suites_found = fnmatch.filter(suites.split("\n"), args.suite) if not suites_found: - print('The test suite was not run because an unknown test suite name was requested.', file=sys.stderr) + print( + "The test suite was not run because an unknown test suite name was requested.", + file=sys.stderr, + ) sys.exit(2) elif len(suites_found) == 1: single_suite = True - suites = '\n'.join(suites_found) + suites = "\n".join(suites_found) elif ENABLE_TESTS and len(args.example) == 0 and len(args.pyexample) == 0: if len(args.constrain): - path_cmd = os.path.join("utils", test_runner_name + " --print-test-name-list --test-type=%s" % args.constrain) - (rc, suites, standard_err, et) = run_job_synchronously(path_cmd, os.getcwd(), False, False) + path_cmd = os.path.join( + "utils", + test_runner_name + " --print-test-name-list --test-type=%s" % args.constrain, + ) + (rc, suites, standard_err, et) = run_job_synchronously( + path_cmd, os.getcwd(), False, False + ) else: path_cmd = os.path.join("utils", test_runner_name + " --print-test-name-list") - (rc, suites, standard_err, et) = run_job_synchronously(path_cmd, os.getcwd(), False, False) + (rc, suites, standard_err, et) = run_job_synchronously( + path_cmd, os.getcwd(), False, False + ) else: suites = "" @@ -1398,21 +1492,24 @@ def run_tests(): # if isinstance(suites, bytes): suites = suites.decode() - suite_list = suites.split('\n') + suite_list = suites.split("\n") # # Performance tests should only be run when they are requested, # i.e. they are not run by default in test.py. # If a specific suite was requested we run it, even if # it is a performance test. - if not single_suite and args.constrain != 'performance': - + if not single_suite and args.constrain != "performance": # Get a list of all of the performance tests. - path_cmd = os.path.join("utils", test_runner_name + " --print-test-name-list --test-type=%s" % "performance") - (rc, performance_tests, standard_err, et) = run_job_synchronously(path_cmd, os.getcwd(), False, False) + path_cmd = os.path.join( + "utils", test_runner_name + " --print-test-name-list --test-type=%s" % "performance" + ) + (rc, performance_tests, standard_err, et) = run_job_synchronously( + path_cmd, os.getcwd(), False, False + ) if isinstance(performance_tests, bytes): performance_tests = performance_tests.decode() - performance_test_list = performance_tests.split('\n') + performance_test_list = performance_tests.split("\n") # Remove any performance tests from the suites list. for performance_test in performance_test_list: @@ -1436,10 +1533,12 @@ def run_tests(): processors = 1 if sys.platform != "win32": - if 'SC_NPROCESSORS_ONLN' in os.sysconf_names: - processors = os.sysconf('SC_NPROCESSORS_ONLN') + if "SC_NPROCESSORS_ONLN" in os.sysconf_names: + processors = os.sysconf("SC_NPROCESSORS_ONLN") else: - proc = subprocess.Popen("sysctl -n hw.ncpu", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + proc = subprocess.Popen( + "sysctl -n hw.ncpu", shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE + ) stdout_results, stderr_results = proc.communicate() stdout_results = stdout_results.decode() stderr_results = stderr_results.decode() @@ -1450,10 +1549,10 @@ def run_tests(): if args.process_limit: if processors < args.process_limit: - print('Using all %s processors' % processors) + print("Using all %s processors" % processors) else: processors = args.process_limit - print('Limiting to %s worker processes' % processors) + print("Limiting to %s worker processes" % processors) # # Now, spin up one thread per processor which will eventually mean one test @@ -1502,7 +1601,9 @@ def run_tests(): else: fullness = " --fullness=QUICK" - path_cmd = os.path.join("utils", test_runner_name + " --test-name=%s%s%s" % (test, multiple, fullness)) + path_cmd = os.path.join( + "utils", test_runner_name + " --test-name=%s%s%s" % (test, multiple, fullness) + ) job.set_shell_command(path_cmd) @@ -1558,9 +1659,9 @@ def run_tests(): if ENABLE_EXAMPLES: for name, test, do_run, do_valgrind_run in example_tests: # Remove any arguments and directory names from test. - test_name = test.split(' ', 1)[0] + test_name = test.split(" ", 1)[0] test_name = os.path.basename(test_name) - test_name = test_name[:-4] if sys.platform == 'win32' else test_name + test_name = test_name[:-4] if sys.platform == "win32" else test_name # Don't try to run this example if it isn't runnable. if test_name in ns3_runnable_programs_dictionary: @@ -1580,7 +1681,10 @@ def run_tests(): job.set_is_skip(True) job.set_skip_reason("skip in valgrind runs") - if args.rerun_failed and name in previously_run_tests_to_skip["example"]: + if ( + args.rerun_failed + and name in previously_run_tests_to_skip["example"] + ): job.is_skip = True job.set_skip_reason("didn't fail in the previous run") @@ -1653,7 +1757,7 @@ def run_tests(): if len(args.constrain) == 0 or args.constrain == "pyexample": for test, do_run in python_tests: # Remove any arguments and directory names from test. - test_name = test.split(' ', 1)[0] + test_name = test.split(" ", 1)[0] test_name = os.path.basename(test_name) # Don't try to run this example if it isn't runnable. @@ -1701,6 +1805,7 @@ def run_tests(): # Find the full relative path to file if only a partial path has been given. if not os.path.exists(args.pyexample): import glob + files = glob.glob("./**/%s" % args.pyexample, recursive=True) if files: args.pyexample = files[0] @@ -1798,7 +1903,7 @@ def run_tests(): status = "CRASH" status_print = colors.PINK + status + colors.NORMAL - print("[%d/%d]" % (i, total_tests), end=' ') + print("[%d/%d]" % (i, total_tests), end=" ") if args.duration or args.constrain == "performance": print("%s (%.3f): %s %s" % (status_print, job.elapsed_time, kind, job.display_name)) else: @@ -1814,24 +1919,24 @@ def run_tests(): # XXX We could add some timing information to the examples, i.e. run # them through time and print the results here. # - with open(xml_results_file, 'a', encoding='utf-8') as f: - f.write('\n') + with open(xml_results_file, "a", encoding="utf-8") as f: + f.write("\n") example_name = " %s\n" % job.display_name f.write(example_name) if status == "PASS": - f.write(' PASS\n') + f.write(" PASS\n") elif status == "FAIL": - f.write(' FAIL\n') + f.write(" FAIL\n") elif status == "VALGR": - f.write(' VALGR\n') + f.write(" VALGR\n") elif status == "SKIP": - f.write(' SKIP\n') + f.write(" SKIP\n") else: - f.write(' CRASH\n') + f.write(" CRASH\n") f.write(' \n') + f.write("\n") else: # @@ -1879,16 +1984,18 @@ def run_tests(): # followed by a VALGR failing test suite of the same name. # if job.is_skip: - with open(xml_results_file, 'a', encoding='utf-8') as f: + with open(xml_results_file, "a", encoding="utf-8") as f: f.write("\n") f.write(" %s\n" % job.display_name) - f.write(' SKIP\n') + f.write(" SKIP\n") f.write(" %s\n" % job.skip_reason) f.write("\n") else: failed_jobs.append(job) if job.returncode == 0 or job.returncode == 1 or job.returncode == 2: - with open(xml_results_file, 'a', encoding='utf-8') as f_to, open(job.tmp_file_name, encoding='utf-8') as f_from: + with open(xml_results_file, "a", encoding="utf-8") as f_to, open( + job.tmp_file_name, encoding="utf-8" + ) as f_from: contents = f_from.read() if status == "VALGR": pre = contents.find("") + len("") @@ -1899,10 +2006,10 @@ def run_tests(): if et.find("Result").text in ["PASS", "SKIP"]: failed_jobs.pop() else: - with open(xml_results_file, 'a', encoding='utf-8') as f: + with open(xml_results_file, "a", encoding="utf-8") as f: f.write("\n") f.write(" %s\n" % job.display_name) - f.write(' CRASH\n') + f.write(" CRASH\n") f.write("\n") # @@ -1919,39 +2026,55 @@ def run_tests(): # individual pieces. So, we need to finish off and close out the XML # document # - with open(xml_results_file, 'a', encoding='utf-8') as f: - f.write('\n') + with open(xml_results_file, "a", encoding="utf-8") as f: + f.write("\n") # # Print a quick summary of events # - print("%d of %d tests passed (%d passed, %d skipped, %d failed, %d crashed, %d valgrind errors)" % (passed_tests, - total_tests, passed_tests, skipped_tests, failed_tests, crashed_tests, valgrind_errors)) + print( + "%d of %d tests passed (%d passed, %d skipped, %d failed, %d crashed, %d valgrind errors)" + % ( + passed_tests, + total_tests, + passed_tests, + skipped_tests, + failed_tests, + crashed_tests, + valgrind_errors, + ) + ) # # Repeat summary of skipped, failed, crashed, valgrind events # if skipped_testnames: skipped_testnames.sort() - print('List of SKIPped tests:\n %s' % '\n '.join(map(str, skipped_testnames))) + print("List of SKIPped tests:\n %s" % "\n ".join(map(str, skipped_testnames))) if failed_testnames: failed_testnames.sort() - print('List of FAILed tests:\n %s' % '\n '.join(map(str, failed_testnames))) + print("List of FAILed tests:\n %s" % "\n ".join(map(str, failed_testnames))) if crashed_testnames: crashed_testnames.sort() - print('List of CRASHed tests:\n %s' % '\n '.join(map(str, crashed_testnames))) + print("List of CRASHed tests:\n %s" % "\n ".join(map(str, crashed_testnames))) if valgrind_testnames: valgrind_testnames.sort() - print('List of VALGR failures:\n %s' % '\n '.join(map(str, valgrind_testnames))) + print("List of VALGR failures:\n %s" % "\n ".join(map(str, valgrind_testnames))) if failed_jobs and args.verbose_failed: for job in failed_jobs: if job.standard_out or job.standard_err: - job_type = 'example' if (job.is_example or job.is_pyexample) else 'test suite' - print(f"===================== Begin of {job_type} '{job.display_name}' stdout =====================") + job_type = "example" if (job.is_example or job.is_pyexample) else "test suite" + print( + f"===================== Begin of {job_type} '{job.display_name}' stdout =====================" + ) print(job.standard_out) - print(f"===================== Begin of {job_type} '{job.display_name}' stderr =====================") + print( + f"===================== Begin of {job_type} '{job.display_name}' stderr =====================" + ) print(job.standard_err) - print(f"===================== End of {job_type} '{job.display_name}' ==============================") + print( + f"===================== End of {job_type} '{job.display_name}' ==============================" + ) # # The last things to do are to translate the XML results file to "human- # readable form" if the user asked for it (or make an XML file somewhere) @@ -1966,10 +2089,10 @@ def run_tests(): translate_to_text(xml_results_file, args.text) if len(args.xml): - xml_file = args.xml + ('.xml' if ".xml" not in args.xml else '') - print('Writing results to xml file %s...' % xml_file, end='') + xml_file = args.xml + (".xml" if ".xml" not in args.xml else "") + print("Writing results to xml file %s..." % xml_file, end="") shutil.copyfile(xml_results_file, xml_file) - print('done.') + print("done.") # # Let the user know if they need to turn on tests or examples. @@ -1977,11 +2100,11 @@ def run_tests(): if not ENABLE_TESTS or not ENABLE_EXAMPLES: print() if not ENABLE_TESTS: - print('*** Note: ns-3 tests are currently disabled. Enable them by adding') + print("*** Note: ns-3 tests are currently disabled. Enable them by adding") print('*** "--enable-tests" to ./ns3 configure or modifying your .ns3rc file.') print() if not ENABLE_EXAMPLES: - print('*** Note: ns-3 examples are currently disabled. Enable them by adding') + print("*** Note: ns-3 examples are currently disabled. Enable them by adding") print('*** "--enable-examples" to ./ns3 configure or modifying your .ns3rc file.') print() @@ -1991,8 +2114,8 @@ def run_tests(): # if args.valgrind and not VALGRIND_FOUND: print() - print('*** Note: you are trying to use valgrind, but valgrind could not be found') - print('*** on your machine. All tests and examples will crash or be skipped.') + print("*** Note: you are trying to use valgrind, but valgrind could not be found") + print("*** on your machine. All tests and examples will crash or be skipped.") print() # @@ -2005,93 +2128,212 @@ def run_tests(): shutil.rmtree(testpy_output_dir) if passed_tests + skipped_tests == total_tests: - return 0 # success + return 0 # success else: - return 1 # catchall for general errors + return 1 # catchall for general errors + def main(argv): parser = argparse.ArgumentParser() - parser.add_argument("-b", "--buildpath", action="store", type=str, default="", - help="specify the path where ns-3 was built (defaults to the build directory for the current variant)") + parser.add_argument( + "-b", + "--buildpath", + action="store", + type=str, + default="", + help="specify the path where ns-3 was built (defaults to the build directory for the current variant)", + ) - parser.add_argument("-c", "--constrain", action="store", type=str, default="", - help="constrain the test-runner by kind of test") + parser.add_argument( + "-c", + "--constrain", + action="store", + type=str, + default="", + help="constrain the test-runner by kind of test", + ) - parser.add_argument("-d", "--duration", action="store_true", default=False, - help="print the duration of each test suite and example") + parser.add_argument( + "-d", + "--duration", + action="store_true", + default=False, + help="print the duration of each test suite and example", + ) - parser.add_argument("-e", "--example", action="store", type=str, default="", - help="specify a single example to run (no relative path is needed)") + parser.add_argument( + "-e", + "--example", + action="store", + type=str, + default="", + help="specify a single example to run (no relative path is needed)", + ) - parser.add_argument("-u", "--update-data", action="store_true", default=False, - help="If examples use reference data files, get them to re-generate them") + parser.add_argument( + "-u", + "--update-data", + action="store_true", + default=False, + help="If examples use reference data files, get them to re-generate them", + ) - parser.add_argument("-f", "--fullness", action="store", type=str, default="QUICK", - choices=["QUICK", "EXTENSIVE", "TAKES_FOREVER"], - help="choose the duration of tests to run: QUICK, EXTENSIVE, or TAKES_FOREVER, where EXTENSIVE includes QUICK and TAKES_FOREVER includes QUICK and EXTENSIVE (only QUICK tests are run by default)") + parser.add_argument( + "-f", + "--fullness", + action="store", + type=str, + default="QUICK", + choices=["QUICK", "EXTENSIVE", "TAKES_FOREVER"], + help="choose the duration of tests to run: QUICK, EXTENSIVE, or TAKES_FOREVER, where EXTENSIVE includes QUICK and TAKES_FOREVER includes QUICK and EXTENSIVE (only QUICK tests are run by default)", + ) - parser.add_argument("-g", "--grind", action="store_true", dest="valgrind", default=False, - help="run the test suites and examples using valgrind") + parser.add_argument( + "-g", + "--grind", + action="store_true", + dest="valgrind", + default=False, + help="run the test suites and examples using valgrind", + ) - parser.add_argument("-k", "--kinds", action="store_true", default=False, - help="print the kinds of tests available") + parser.add_argument( + "-k", + "--kinds", + action="store_true", + default=False, + help="print the kinds of tests available", + ) - parser.add_argument("-l", "--list", action="store_true", default=False, - help="print the list of known tests") + parser.add_argument( + "-l", "--list", action="store_true", default=False, help="print the list of known tests" + ) - parser.add_argument("-m", "--multiple", action="store_true", default=False, - help="report multiple failures from test suites and test cases") + parser.add_argument( + "-m", + "--multiple", + action="store_true", + default=False, + help="report multiple failures from test suites and test cases", + ) - parser.add_argument("-n", "--no-build", action="store_true", default=False, - help="do not build before starting testing") + parser.add_argument( + "-n", + "--no-build", + action="store_true", + default=False, + help="do not build before starting testing", + ) - parser.add_argument("-p", "--pyexample", action="store", type=str, default="", - help="specify a single python example to run (with relative path)") + parser.add_argument( + "-p", + "--pyexample", + action="store", + type=str, + default="", + help="specify a single python example to run (with relative path)", + ) - parser.add_argument("-r", "--retain", action="store_true", default=False, - help="retain all temporary files (which are normally deleted)") + parser.add_argument( + "-r", + "--retain", + action="store_true", + default=False, + help="retain all temporary files (which are normally deleted)", + ) - parser.add_argument("-s", "--suite", action="store", type=str, default="", - help="specify a single test suite to run") + parser.add_argument( + "-s", + "--suite", + action="store", + type=str, + default="", + help="specify a single test suite to run", + ) - parser.add_argument("-t", "--text", action="store", type=str, default="", - metavar="TEXT-FILE", - help="write detailed test results into TEXT-FILE.txt") + parser.add_argument( + "-t", + "--text", + action="store", + type=str, + default="", + metavar="TEXT-FILE", + help="write detailed test results into TEXT-FILE.txt", + ) - parser.add_argument("-v", "--verbose", action="store_true", default=False, - help="print progress and informational messages") + parser.add_argument( + "-v", + "--verbose", + action="store_true", + default=False, + help="print progress and informational messages", + ) - parser.add_argument("--verbose-failed", action="store_true", default=False, - help="print progress and informational messages for failed jobs") + parser.add_argument( + "--verbose-failed", + action="store_true", + default=False, + help="print progress and informational messages for failed jobs", + ) - parser.add_argument("-w", "--web", "--html", action="store", type=str, dest="html", default="", - metavar="HTML-FILE", - help="write detailed test results into HTML-FILE.html") + parser.add_argument( + "-w", + "--web", + "--html", + action="store", + type=str, + dest="html", + default="", + metavar="HTML-FILE", + help="write detailed test results into HTML-FILE.html", + ) - parser.add_argument("-x", "--xml", action="store", type=str, default="", - metavar="XML-FILE", - help="write detailed test results into XML-FILE.xml") + parser.add_argument( + "-x", + "--xml", + action="store", + type=str, + default="", + metavar="XML-FILE", + help="write detailed test results into XML-FILE.xml", + ) - parser.add_argument("--nocolor", action="store_true", default=False, - help="do not use colors in the standard output") + parser.add_argument( + "--nocolor", + action="store_true", + default=False, + help="do not use colors in the standard output", + ) - parser.add_argument("--jobs", action="store", type=int, dest="process_limit", default=0, - help="limit number of worker threads") + parser.add_argument( + "--jobs", + action="store", + type=int, + dest="process_limit", + default=0, + help="limit number of worker threads", + ) - parser.add_argument("--rerun-failed", action="store_true", dest="rerun_failed", default=False, - help="rerun failed tests") + parser.add_argument( + "--rerun-failed", + action="store_true", + dest="rerun_failed", + default=False, + help="rerun failed tests", + ) global args args = parser.parse_args() signal.signal(signal.SIGINT, sigint_hook) # From waf/waflib/Options.py - envcolor = os.environ.get('NOCOLOR', '') and 'no' or 'auto' or 'yes' + envcolor = os.environ.get("NOCOLOR", "") and "no" or "auto" or "yes" - if args.nocolor or envcolor == 'no': - colors_lst['USE'] = False + if args.nocolor or envcolor == "no": + colors_lst["USE"] = False return run_tests() -if __name__ == '__main__': + +if __name__ == "__main__": sys.exit(main(sys.argv)) diff --git a/utils.py b/utils.py index c4f5d20d0..33683bd80 100644 --- a/utils.py +++ b/utils.py @@ -8,53 +8,51 @@ import os def get_list_from_file(file_path, list_name): - '''Looks for a Python list called list_name in the file specified + """Looks for a Python list called list_name in the file specified by file_path and returns it. If the file or list name aren't found, this function will return an empty list. - ''' + """ # Read in the file if it exists. if not os.path.exists(file_path): return [] with open(file_path, "r", encoding="utf-8") as file_in: - # Look for the list. list_string = "" parsing_multiline_list = False for line in file_in: - # Remove any comments. - if '#' in line: - (line, comment) = line.split('#', 1) + if "#" in line: + (line, comment) = line.split("#", 1) # Parse the line. if list_name in line or parsing_multiline_list: list_string += line # Handle multiline lists. - if ']' not in list_string: + if "]" not in list_string: parsing_multiline_list = True else: # Evaluate the list once its end is reached. # Make the split function only split it once. - return eval(list_string.split('=', 1)[1].strip()) + return eval(list_string.split("=", 1)[1].strip()) # List name was not found return [] def get_bool_from_file(file_path, bool_name, value_if_missing): - '''Looks for a Python boolean variable called bool_name in the + """Looks for a Python boolean variable called bool_name in the file specified by file_path and returns its value. If the file or boolean variable aren't found, this function will return value_if_missing. - ''' + """ # Read in the file if it exists. if not os.path.exists(file_path): @@ -63,16 +61,15 @@ def get_bool_from_file(file_path, bool_name, value_if_missing): with open(file_path, "r", encoding="utf-8") as file_in: # Look for the boolean variable. for line in file_in: - # Remove any comments. - if '#' in line: - (line, comment) = line.split('#', 1) + if "#" in line: + (line, comment) = line.split("#", 1) # Parse the line. if bool_name in line: # Evaluate the variable's line once it is found. Make # the split function only split it once. - return eval(line.split('=', 1)[1].strip()) + return eval(line.split("=", 1)[1].strip()) # Boolean variable was not found return value_if_missing @@ -85,17 +82,17 @@ def get_bool_from_file(file_path, bool_name, value_if_missing): def read_config_file(): # By default, all modules will be enabled, examples will be disabled, # and tests will be disabled. - modules_enabled = ['all_modules'] + modules_enabled = ["all_modules"] examples_enabled = False - tests_enabled = False + tests_enabled = False # See if the ns3 configuration file exists in the current working # directory and then look for it in the ~ directory. config_file_exists = False - dot_ns3rc_name = '.ns3rc' + dot_ns3rc_name = ".ns3rc" dot_ns3rc_path = dot_ns3rc_name if not os.path.exists(dot_ns3rc_path): - dot_ns3rc_path = os.path.expanduser('~/') + dot_ns3rc_name + dot_ns3rc_path = os.path.expanduser("~/") + dot_ns3rc_name if not os.path.exists(dot_ns3rc_path): # Return all of the default values if the .ns3rc file can't be found. return (config_file_exists, modules_enabled, examples_enabled, tests_enabled) @@ -103,17 +100,17 @@ def read_config_file(): config_file_exists = True # Read in the enabled modules. - modules_enabled = get_list_from_file(dot_ns3rc_path, 'modules_enabled') + modules_enabled = get_list_from_file(dot_ns3rc_path, "modules_enabled") if not modules_enabled: # Enable all modules if the modules_enabled line can't be found. - modules_enabled = ['all_modules'] + modules_enabled = ["all_modules"] # Read in whether examples should be enabled or not. value_if_missing = False - examples_enabled = get_bool_from_file(dot_ns3rc_path, 'examples_enabled', value_if_missing) + examples_enabled = get_bool_from_file(dot_ns3rc_path, "examples_enabled", value_if_missing) # Read in whether tests should be enabled or not. value_if_missing = False - tests_enabled = get_bool_from_file(dot_ns3rc_path, 'tests_enabled', value_if_missing) + tests_enabled = get_bool_from_file(dot_ns3rc_path, "tests_enabled", value_if_missing) return (config_file_exists, modules_enabled, examples_enabled, tests_enabled) diff --git a/utils/check-style-clang-format.py b/utils/check-style-clang-format.py index 5b37b8b46..471586204 100755 --- a/utils/check-style-clang-format.py +++ b/utils/check-style-clang-format.py @@ -42,7 +42,6 @@ import re import shutil import subprocess import sys - from typing import Callable, Dict, List, Tuple ########################################################### @@ -55,76 +54,76 @@ CLANG_FORMAT_VERSIONS = [ 14, ] -CLANG_FORMAT_GUARD_ON = '// clang-format on' -CLANG_FORMAT_GUARD_OFF = '// clang-format off' +CLANG_FORMAT_GUARD_ON = "// clang-format on" +CLANG_FORMAT_GUARD_OFF = "// clang-format off" DIRECTORIES_TO_SKIP = [ - '__pycache__', - '.git', - 'bindings', - 'build', - 'cmake-cache', - 'testpy-output', + "__pycache__", + ".git", + "bindings", + "build", + "cmake-cache", + "testpy-output", ] # List of files entirely copied from elsewhere that should not be checked, # in order to optimize the performance of this script FILES_TO_SKIP = [ - 'valgrind.h', + "valgrind.h", ] FILE_EXTENSIONS_TO_CHECK_FORMATTING = [ - '.c', - '.cc', - '.h', + ".c", + ".cc", + ".h", ] FILE_EXTENSIONS_TO_CHECK_INCLUDE_PREFIXES = FILE_EXTENSIONS_TO_CHECK_FORMATTING FILE_EXTENSIONS_TO_CHECK_WHITESPACE = [ - '.c', - '.cc', - '.click', - '.cmake', - '.conf', - '.css', - '.dot', - '.gnuplot', - '.gp', - '.h', - '.html', - '.js', - '.json', - '.m', - '.md', - '.mob', - '.ns_params', - '.ns_movements', - '.params', - '.pl', - '.plt', - '.py', - '.rst', - '.seqdiag', - '.sh', - '.txt', - '.yml', + ".c", + ".cc", + ".click", + ".cmake", + ".conf", + ".css", + ".dot", + ".gnuplot", + ".gp", + ".h", + ".html", + ".js", + ".json", + ".m", + ".md", + ".mob", + ".ns_params", + ".ns_movements", + ".params", + ".pl", + ".plt", + ".py", + ".rst", + ".seqdiag", + ".sh", + ".txt", + ".yml", ] FILES_TO_CHECK_WHITESPACE = [ - 'Makefile', - 'ns3', + "Makefile", + "ns3", ] FILE_EXTENSIONS_TO_CHECK_TABS = [ - '.c', - '.cc', - '.h', - '.md', - '.py', - '.rst', - '.sh', - '.yml', + ".c", + ".cc", + ".h", + ".md", + ".py", + ".rst", + ".sh", + ".yml", ] TAB_SIZE = 4 @@ -142,14 +141,16 @@ def should_analyze_directory(dirpath: str) -> bool: _, directory = os.path.split(dirpath) - return not (directory in DIRECTORIES_TO_SKIP or - (directory.startswith('.') and directory != '.')) + return not ( + directory in DIRECTORIES_TO_SKIP or (directory.startswith(".") and directory != ".") + ) -def should_analyze_file(path: str, - files_to_check: List[str], - file_extensions_to_check: List[str], - ) -> bool: +def should_analyze_file( + path: str, + files_to_check: List[str], + file_extensions_to_check: List[str], +) -> bool: """ Check whether a file should be analyzed. @@ -166,11 +167,12 @@ def should_analyze_file(path: str, basename, extension = os.path.splitext(filename) - return (basename in files_to_check or - extension in file_extensions_to_check) + return basename in files_to_check or extension in file_extensions_to_check -def find_files_to_check_style(paths: List[str]) -> Tuple[List[str], List[str], List[str], List[str]]: +def find_files_to_check_style( + paths: List[str], +) -> Tuple[List[str], List[str], List[str], List[str]]: """ Find all files to be checked in a given list of paths. @@ -199,7 +201,7 @@ def find_files_to_check_style(paths: List[str]) -> Tuple[List[str], List[str], L files_to_check.extend([os.path.join(dirpath, f) for f in filenames]) else: - raise ValueError(f'Error: {path} is not a file nor a directory') + raise ValueError(f"Error: {path} is not a file nor a directory") files_to_check.sort() @@ -239,47 +241,48 @@ def find_clang_format_path() -> str: # Find exact version for version in CLANG_FORMAT_VERSIONS: - clang_format_path = shutil.which(f'clang-format-{version}') + clang_format_path = shutil.which(f"clang-format-{version}") if clang_format_path: return clang_format_path # Find default version and check if it is supported - clang_format_path = shutil.which('clang-format') + clang_format_path = shutil.which("clang-format") if clang_format_path: process = subprocess.run( - [clang_format_path, '--version'], + [clang_format_path, "--version"], capture_output=True, text=True, check=True, ) - version = process.stdout.strip().split(' ')[-1] - major_version = int(version.split('.')[0]) + version = process.stdout.strip().split(" ")[-1] + major_version = int(version.split(".")[0]) if major_version in CLANG_FORMAT_VERSIONS: return clang_format_path # No supported version of clang-format found raise RuntimeError( - f'Could not find any supported version of clang-format installed on this system. ' - f'List of supported versions: {CLANG_FORMAT_VERSIONS}.' + f"Could not find any supported version of clang-format installed on this system. " + f"List of supported versions: {CLANG_FORMAT_VERSIONS}." ) ########################################################### # CHECK STYLE MAIN FUNCTIONS ########################################################### -def check_style_clang_format(paths: List[str], - enable_check_include_prefixes: bool, - enable_check_formatting: bool, - enable_check_whitespace: bool, - enable_check_tabs: bool, - fix: bool, - verbose: bool, - n_jobs: int = 1, - ) -> bool: +def check_style_clang_format( + paths: List[str], + enable_check_include_prefixes: bool, + enable_check_formatting: bool, + enable_check_whitespace: bool, + enable_check_tabs: bool, + fix: bool, + verbose: bool, + n_jobs: int = 1, +) -> bool: """ Check / fix the coding style of a list of files. @@ -294,10 +297,12 @@ def check_style_clang_format(paths: List[str], @return Whether all files are compliant with all enabled style checks. """ - (files_to_check_include_prefixes, - files_to_check_formatting, - files_to_check_whitespace, - files_to_check_tabs) = find_files_to_check_style(paths) + ( + files_to_check_include_prefixes, + files_to_check_formatting, + files_to_check_whitespace, + files_to_check_tabs, + ) = find_files_to_check_style(paths) check_include_prefixes_successful = True check_formatting_successful = True @@ -316,11 +321,11 @@ def check_style_clang_format(paths: List[str], check_style_line_function=check_include_prefixes_line, ) - print('') + print("") if enable_check_formatting: check_formatting_successful = check_style_files( - 'bad code formatting', + "bad code formatting", check_formatting_file, files_to_check_formatting, fix, @@ -329,11 +334,11 @@ def check_style_clang_format(paths: List[str], clang_format_path=find_clang_format_path(), ) - print('') + print("") if enable_check_whitespace: check_whitespace_successful = check_style_files( - 'trailing whitespace', + "trailing whitespace", check_manually_file, files_to_check_whitespace, fix, @@ -343,11 +348,11 @@ def check_style_clang_format(paths: List[str], check_style_line_function=check_whitespace_line, ) - print('') + print("") if enable_check_tabs: check_tabs_successful = check_style_files( - 'tabs', + "tabs", check_manually_file, files_to_check_tabs, fix, @@ -357,22 +362,25 @@ def check_style_clang_format(paths: List[str], check_style_line_function=check_tabs_line, ) - return all([ - check_include_prefixes_successful, - check_formatting_successful, - check_whitespace_successful, - check_tabs_successful, - ]) + return all( + [ + check_include_prefixes_successful, + check_formatting_successful, + check_whitespace_successful, + check_tabs_successful, + ] + ) -def check_style_files(style_check_str: str, - check_style_file_function: Callable[..., Tuple[str, bool, List[str]]], - filenames: List[str], - fix: bool, - verbose: bool, - n_jobs: int, - **kwargs, - ) -> bool: +def check_style_files( + style_check_str: str, + check_style_file_function: Callable[..., Tuple[str, bool, List[str]]], + filenames: List[str], + fix: bool, + verbose: bool, + n_jobs: int, + **kwargs, +) -> bool: """ Check / fix style of a list of files. @@ -399,7 +407,7 @@ def check_style_files(style_check_str: str, *[arg if isinstance(arg, list) else itertools.repeat(arg) for arg in kwargs.values()], ) - for (filename, is_file_compliant, verbose_infos) in non_compliant_files_results: + for filename, is_file_compliant, verbose_infos in non_compliant_files_results: if not is_file_compliant: non_compliant_files.append(filename) @@ -408,22 +416,22 @@ def check_style_files(style_check_str: str, # Output results if not non_compliant_files: - print(f'- No files detected with {style_check_str}') + print(f"- No files detected with {style_check_str}") return True else: n_non_compliant_files = len(non_compliant_files) if fix: - print(f'- Fixed {style_check_str} in the files ({n_non_compliant_files}):') + print(f"- Fixed {style_check_str} in the files ({n_non_compliant_files}):") else: - print(f'- Detected {style_check_str} in the files ({n_non_compliant_files}):') + print(f"- Detected {style_check_str} in the files ({n_non_compliant_files}):") for f in non_compliant_files: if verbose: - print(*[f' {l}' for l in files_verbose_infos[f]], sep='\n') + print(*[f" {l}" for l in files_verbose_infos[f]], sep="\n") else: - print(f' - {f}') + print(f" - {f}") # If all files were fixed, there are no more non-compliant files return fix @@ -432,11 +440,12 @@ def check_style_files(style_check_str: str, ########################################################### # CHECK STYLE FUNCTIONS ########################################################### -def check_formatting_file(filename: str, - fix: bool, - verbose: bool, - clang_format_path: str, - ) -> Tuple[str, bool, List[str]]: +def check_formatting_file( + filename: str, + fix: bool, + verbose: bool, + clang_format_path: str, +) -> Tuple[str, bool, List[str]]: """ Check / fix the coding style of a file with clang-format. @@ -456,18 +465,18 @@ def check_formatting_file(filename: str, [ clang_format_path, filename, - '-style=file', - '--dry-run', - '--Werror', + "-style=file", + "--dry-run", + "--Werror", # Optimization: In non-verbose mode, only one error is needed to check that the file is not compliant - f'--ferror-limit={0 if verbose else 1}', + f"--ferror-limit={0 if verbose else 1}", ], check=False, capture_output=True, text=True, ) - is_file_compliant = (process.returncode == 0) + is_file_compliant = process.returncode == 0 if verbose: verbose_infos = process.stderr.splitlines() @@ -478,8 +487,8 @@ def check_formatting_file(filename: str, [ clang_format_path, filename, - '-style=file', - '-i', + "-style=file", + "-i", ], check=False, stdout=subprocess.DEVNULL, @@ -489,12 +498,13 @@ def check_formatting_file(filename: str, return (filename, is_file_compliant, verbose_infos) -def check_manually_file(filename: str, - fix: bool, - verbose: bool, - respect_clang_format_guards: bool, - check_style_line_function: Callable[[str, str, int], Tuple[bool, str, List[str]]], - ) -> Tuple[str, bool, List[str]]: +def check_manually_file( + filename: str, + fix: bool, + verbose: bool, + respect_clang_format_guards: bool, + check_style_line_function: Callable[[str, str, int], Tuple[bool, str, List[str]]], +) -> Tuple[str, bool, List[str]]: """ Check / fix a file manually using a function to check / fix each line. @@ -512,11 +522,10 @@ def check_manually_file(filename: str, verbose_infos: List[str] = [] clang_format_enabled = True - with open(filename, 'r', encoding='utf-8') as f: + with open(filename, "r", encoding="utf-8") as f: file_lines = f.readlines() - for (i, line) in enumerate(file_lines): - + for i, line in enumerate(file_lines): # Check clang-format guards if respect_clang_format_guards: line_stripped = line.strip() @@ -526,12 +535,16 @@ def check_manually_file(filename: str, elif line_stripped == CLANG_FORMAT_GUARD_OFF: clang_format_enabled = False - if (not clang_format_enabled and - line_stripped not in (CLANG_FORMAT_GUARD_ON, CLANG_FORMAT_GUARD_OFF)): + if not clang_format_enabled and line_stripped not in ( + CLANG_FORMAT_GUARD_ON, + CLANG_FORMAT_GUARD_OFF, + ): continue # Check if the line is compliant with the style and fix it - (is_line_compliant, line_fixed, line_verbose_infos) = check_style_line_function(line, filename, i) + (is_line_compliant, line_fixed, line_verbose_infos) = check_style_line_function( + line, filename, i + ) if not is_line_compliant: is_file_compliant = False @@ -544,16 +557,17 @@ def check_manually_file(filename: str, # Update file with the fixed lines if fix and not is_file_compliant: - with open(filename, 'w', encoding='utf-8') as f: + with open(filename, "w", encoding="utf-8") as f: f.writelines(file_lines) return (filename, is_file_compliant, verbose_infos) -def check_include_prefixes_line(line: str, - filename: str, - line_number: int, - ) -> Tuple[bool, str, List[str]]: +def check_include_prefixes_line( + line: str, + filename: str, + line_number: int, +) -> Tuple[bool, str, List[str]]: """ Check / fix #include headers from the same module with the "ns3/" prefix in a line. @@ -580,24 +594,31 @@ def check_include_prefixes_line(line: str, if os.path.exists(os.path.join(parent_path, header_file)): is_line_compliant = False - line_fixed = line_stripped.replace( - f'ns3/{header_file}', header_file).replace('<', '"').replace('>', '"') + '\n' + line_fixed = ( + line_stripped.replace(f"ns3/{header_file}", header_file) + .replace("<", '"') + .replace(">", '"') + + "\n" + ) header_index = len('#include "') - verbose_infos.extend([ - f'{filename}:{line_number + 1}:{header_index + 1}: error: #include headers from the same module with the "ns3/" prefix detected', - f' {line_stripped}', - f' {"":{header_index}}^', - ]) + verbose_infos.extend( + [ + f'{filename}:{line_number + 1}:{header_index + 1}: error: #include headers from the same module with the "ns3/" prefix detected', + f" {line_stripped}", + f' {"":{header_index}}^', + ] + ) return (is_line_compliant, line_fixed, verbose_infos) -def check_whitespace_line(line: str, - filename: str, - line_number: int, - ) -> Tuple[bool, str, List[str]]: +def check_whitespace_line( + line: str, + filename: str, + line_number: int, +) -> Tuple[bool, str, List[str]]: """ Check / fix whitespace in a line. @@ -610,7 +631,7 @@ def check_whitespace_line(line: str, """ is_line_compliant = True - line_fixed = line.rstrip() + '\n' + line_fixed = line.rstrip() + "\n" verbose_infos: List[str] = [] if line_fixed != line: @@ -618,18 +639,19 @@ def check_whitespace_line(line: str, line_fixed_stripped_expanded = line_fixed.rstrip().expandtabs(TAB_SIZE) verbose_infos = [ - f'{filename}:{line_number + 1}:{len(line_fixed_stripped_expanded) + 1}: error: Trailing whitespace detected', - f' {line_fixed_stripped_expanded}', + f"{filename}:{line_number + 1}:{len(line_fixed_stripped_expanded) + 1}: error: Trailing whitespace detected", + f" {line_fixed_stripped_expanded}", f' {"":{len(line_fixed_stripped_expanded)}}^', ] return (is_line_compliant, line_fixed, verbose_infos) -def check_tabs_line(line: str, - filename: str, - line_number: int, - ) -> Tuple[bool, str, List[str]]: +def check_tabs_line( + line: str, + filename: str, + line_number: int, +) -> Tuple[bool, str, List[str]]: """ Check / fix tabs in a line. @@ -645,15 +667,15 @@ def check_tabs_line(line: str, line_fixed = line verbose_infos: List[str] = [] - tab_index = line.find('\t') + tab_index = line.find("\t") if tab_index != -1: is_line_compliant = False line_fixed = line.expandtabs(TAB_SIZE) verbose_infos = [ - f'{filename}:{line_number + 1}:{tab_index + 1}: error: Tab detected', - f' {line.rstrip()}', + f"{filename}:{line_number + 1}:{tab_index + 1}: error: Tab detected", + f" {line.rstrip()}", f' {"":{tab_index}}^', ] @@ -663,42 +685,71 @@ def check_tabs_line(line: str, ########################################################### # MAIN ########################################################### -if __name__ == '__main__': - +if __name__ == "__main__": parser = argparse.ArgumentParser( - description='Check and apply the ns-3 coding style recursively to all files in the given PATHs. ' - 'The script checks the formatting of the file with clang-format. ' + description="Check and apply the ns-3 coding style recursively to all files in the given PATHs. " + "The script checks the formatting of the file with clang-format. " 'Additionally, it checks #include headers from the same module with the "ns3/" prefix, ' - 'the presence of trailing whitespace and tabs. ' + "the presence of trailing whitespace and tabs. " 'Formatting, local #include "ns3/" prefixes and tabs checks respect clang-format guards. ' 'When used in "check mode" (default), the script checks if all files are well ' - 'formatted and do not have trailing whitespace nor tabs. ' - 'If it detects non-formatted files, they will be printed and this process exits with a ' - 'non-zero code. When used in "fix mode", this script automatically fixes the files.') + "formatted and do not have trailing whitespace nor tabs. " + "If it detects non-formatted files, they will be printed and this process exits with a " + 'non-zero code. When used in "fix mode", this script automatically fixes the files.' + ) - parser.add_argument('paths', action='store', type=str, nargs='+', - help='List of paths to the files to check',) + parser.add_argument( + "paths", + action="store", + type=str, + nargs="+", + help="List of paths to the files to check", + ) - parser.add_argument('--no-include-prefixes', action='store_true', - help='Do not check / fix #include headers from the same module with the "ns3/" prefix',) + parser.add_argument( + "--no-include-prefixes", + action="store_true", + help='Do not check / fix #include headers from the same module with the "ns3/" prefix', + ) - parser.add_argument('--no-formatting', action='store_true', - help='Do not check / fix code formatting',) + parser.add_argument( + "--no-formatting", + action="store_true", + help="Do not check / fix code formatting", + ) - parser.add_argument('--no-whitespace', action='store_true', - help='Do not check / fix trailing whitespace',) + parser.add_argument( + "--no-whitespace", + action="store_true", + help="Do not check / fix trailing whitespace", + ) - parser.add_argument('--no-tabs', action='store_true', - help='Do not check / fix tabs',) + parser.add_argument( + "--no-tabs", + action="store_true", + help="Do not check / fix tabs", + ) - parser.add_argument('--fix', action='store_true', - help='Fix coding style issues detected in the files',) + parser.add_argument( + "--fix", + action="store_true", + help="Fix coding style issues detected in the files", + ) - parser.add_argument('-v', '--verbose', action='store_true', - help='Show the lines that are not well-formatted',) + parser.add_argument( + "-v", + "--verbose", + action="store_true", + help="Show the lines that are not well-formatted", + ) - parser.add_argument('-j', '--jobs', type=int, default=max(1, os.cpu_count() - 1), - help='Number of parallel jobs',) + parser.add_argument( + "-j", + "--jobs", + type=int, + default=max(1, os.cpu_count() - 1), + help="Number of parallel jobs", + ) args = parser.parse_args() diff --git a/utils/create-module.py b/utils/create-module.py index 46ca29f8b..31f9d14c0 100755 --- a/utils/create-module.py +++ b/utils/create-module.py @@ -1,13 +1,12 @@ #! /usr/bin/env python3 -import sys import argparse import os import re import shutil - +import sys from pathlib import Path -CMAKELISTS_TEMPLATE = '''\ +CMAKELISTS_TEMPLATE = """\ check_include_file_cxx(stdint.h HAVE_STDINT_H) if(HAVE_STDINT_H) add_definitions(-DHAVE_STDINT_H) @@ -30,10 +29,10 @@ build_lib( TEST_SOURCES test/{MODULE}-test-suite.cc ${{examples_as_tests_sources}} ) -''' +""" -MODEL_CC_TEMPLATE = '''\ +MODEL_CC_TEMPLATE = """\ #include "{MODULE}.h" namespace ns3 @@ -42,10 +41,10 @@ namespace ns3 /* ... */ }} -''' +""" -MODEL_H_TEMPLATE = '''\ +MODEL_H_TEMPLATE = """\ #ifndef {INCLUDE_GUARD} #define {INCLUDE_GUARD} @@ -66,10 +65,10 @@ namespace ns3 }} #endif /* {INCLUDE_GUARD} */ -''' +""" -HELPER_CC_TEMPLATE = '''\ +HELPER_CC_TEMPLATE = """\ #include "{MODULE}-helper.h" namespace ns3 @@ -78,10 +77,10 @@ namespace ns3 /* ... */ }} -''' +""" -HELPER_H_TEMPLATE = '''\ +HELPER_H_TEMPLATE = """\ #ifndef {INCLUDE_GUARD} #define {INCLUDE_GUARD} @@ -98,18 +97,18 @@ namespace ns3 }} #endif /* {INCLUDE_GUARD} */ -''' +""" -EXAMPLES_CMAKELISTS_TEMPLATE = '''\ +EXAMPLES_CMAKELISTS_TEMPLATE = """\ build_lib_example( NAME {MODULE}-example SOURCE_FILES {MODULE}-example.cc LIBRARIES_TO_LINK ${{lib{MODULE}}} ) -''' +""" -EXAMPLE_CC_TEMPLATE = '''\ +EXAMPLE_CC_TEMPLATE = """\ #include "ns3/core-module.h" #include "ns3/{MODULE}-helper.h" @@ -137,10 +136,10 @@ main(int argc, char* argv[]) Simulator::Destroy(); return 0; }} -''' +""" -TEST_CC_TEMPLATE = '''\ +TEST_CC_TEMPLATE = """\ // Include a header file from your module to test. #include "ns3/{MODULE}.h" @@ -227,10 +226,10 @@ class {CAPITALIZED}TestSuite : public TestSuite * Static variable for test initialization */ static {CAPITALIZED}TestSuite s{COMPOUND}TestSuite; -''' +""" -DOC_RST_TEMPLATE = '''Example Module Documentation +DOC_RST_TEMPLATE = """Example Module Documentation ---------------------------- .. include:: replace.txt @@ -328,18 +327,19 @@ Validation Describe how the model has been tested/validated. What tests run in the test suite? How much API and code is covered by the tests? Again, references to outside published work may help here. -''' +""" + def create_file(path, template, **kwargs): artifact_path = Path(path) - #open file for (w)rite and in (t)ext mode + # open file for (w)rite and in (t)ext mode with artifact_path.open("wt", encoding="utf-8") as f: f.write(template.format(**kwargs)) def make_cmakelists(moduledir, modname): - path = Path(moduledir, 'CMakeLists.txt') + path = Path(moduledir, "CMakeLists.txt") macro = "build_lib" create_file(path, CMAKELISTS_TEMPLATE, MODULE=modname) @@ -350,14 +350,12 @@ def make_model(moduledir, modname): modelpath = Path(moduledir, "model") modelpath.mkdir(parents=True) - srcfile_path = modelpath.joinpath(modname).with_suffix('.cc') + srcfile_path = modelpath.joinpath(modname).with_suffix(".cc") create_file(srcfile_path, MODEL_CC_TEMPLATE, MODULE=modname) - hfile_path = modelpath.joinpath(modname).with_suffix('.h') - guard = "{}_H".format(modname.replace('-', '_').upper()) - create_file(hfile_path, MODEL_H_TEMPLATE, - MODULE=modname, - INCLUDE_GUARD=guard) + hfile_path = modelpath.joinpath(modname).with_suffix(".h") + guard = "{}_H".format(modname.replace("-", "_").upper()) + create_file(hfile_path, MODEL_H_TEMPLATE, MODULE=modname, INCLUDE_GUARD=guard) return True @@ -366,11 +364,17 @@ def make_test(moduledir, modname): testpath = Path(moduledir, "test") testpath.mkdir(parents=True) - file_path = testpath.joinpath(modname+'-test-suite').with_suffix('.cc') - name_parts = modname.split('-') - create_file(file_path, TEST_CC_TEMPLATE, MODULE=modname, - CAPITALIZED=''.join([word.capitalize() for word in name_parts]), - COMPOUND=''.join([word.capitalize() if index > 0 else word for index, word in enumerate(name_parts)])) + file_path = testpath.joinpath(modname + "-test-suite").with_suffix(".cc") + name_parts = modname.split("-") + create_file( + file_path, + TEST_CC_TEMPLATE, + MODULE=modname, + CAPITALIZED="".join([word.capitalize() for word in name_parts]), + COMPOUND="".join( + [word.capitalize() if index > 0 else word for index, word in enumerate(name_parts)] + ), + ) return True @@ -379,11 +383,11 @@ def make_helper(moduledir, modname): helperpath = Path(moduledir, "helper") helperpath.mkdir(parents=True) - srcfile_path = helperpath.joinpath(modname+'-helper').with_suffix('.cc') + srcfile_path = helperpath.joinpath(modname + "-helper").with_suffix(".cc") create_file(srcfile_path, HELPER_CC_TEMPLATE, MODULE=modname) - h_file_path = helperpath.joinpath(modname+'-helper').with_suffix('.h') - guard = "{}_HELPER_H".format(modname.replace('-', '_').upper()) + h_file_path = helperpath.joinpath(modname + "-helper").with_suffix(".h") + guard = "{}_HELPER_H".format(modname.replace("-", "_").upper()) create_file(h_file_path, HELPER_H_TEMPLATE, MODULE=modname, INCLUDE_GUARD=guard) return True @@ -393,10 +397,10 @@ def make_examples(moduledir, modname): examplespath = Path(moduledir, "examples") examplespath.mkdir(parents=True) - cmakelistspath = Path(examplespath, 'CMakeLists.txt') + cmakelistspath = Path(examplespath, "CMakeLists.txt") create_file(cmakelistspath, EXAMPLES_CMAKELISTS_TEMPLATE, MODULE=modname) - examplesfile_path = examplespath.joinpath(modname+'-example').with_suffix('.cc') + examplesfile_path = examplespath.joinpath(modname + "-example").with_suffix(".cc") create_file(examplesfile_path, EXAMPLE_CC_TEMPLATE, MODULE=modname) return True @@ -406,11 +410,11 @@ def make_doc(moduledir, modname): docpath = Path(moduledir, "doc") docpath.mkdir(parents=True) - #the module_dir template parameter must be a relative path - #instead of an absolute path + # the module_dir template parameter must be a relative path + # instead of an absolute path mod_relpath = os.path.relpath(str(moduledir)) - file_name = '{}.rst'.format(modname) + file_name = "{}.rst".format(modname) file_path = Path(docpath, file_name) create_file(file_path, DOC_RST_TEMPLATE, MODULE=modname, MODULE_DIR=mod_relpath) @@ -426,8 +430,7 @@ def make_module(modpath, modname): print("Creating module {}".format(modulepath)) - functions = (make_cmakelists, make_model, make_test, - make_helper, make_examples, make_doc) + functions = (make_cmakelists, make_model, make_test, make_helper, make_examples, make_doc) try: modulepath.mkdir(parents=True) @@ -447,6 +450,7 @@ def make_module(modpath, modname): return True + def create_argument_parser(): description = """Generate scaffolding for ns-3 modules @@ -525,25 +529,36 @@ project directory. formatter = argparse.RawDescriptionHelpFormatter - parser = argparse.ArgumentParser(description=description, - epilog=epilog, - formatter_class=formatter) + parser = argparse.ArgumentParser( + description=description, epilog=epilog, formatter_class=formatter + ) - parser.add_argument('--project', default='', - help=("Specify a relative path under the contrib directory " - "where the new modules will be generated. The path " - "will be created if it does not exist.")) + parser.add_argument( + "--project", + default="", + help=( + "Specify a relative path under the contrib directory " + "where the new modules will be generated. The path " + "will be created if it does not exist." + ), + ) - parser.add_argument('modnames', nargs='+', - help=("One or more modules to generate. Module names " - "are limited to the following: letters, numbers, -, " - "_. Modules are generated under the contrib directory " - "except when the module name starts with src/. Modules " - "that start with src/ are generated under the src " - "directory.")) + parser.add_argument( + "modnames", + nargs="+", + help=( + "One or more modules to generate. Module names " + "are limited to the following: letters, numbers, -, " + "_. Modules are generated under the contrib directory " + "except when the module name starts with src/. Modules " + "that start with src/ are generated under the src " + "directory." + ), + ) return parser + def main(argv): parser = create_argument_parser() @@ -554,46 +569,47 @@ def main(argv): base_path = Path.cwd() - src_path = base_path.joinpath('src') - contrib_path = base_path.joinpath('contrib') + src_path = base_path.joinpath("src") + contrib_path = base_path.joinpath("contrib") for p in (src_path, contrib_path): if not p.is_dir(): - parser.error("Cannot find the directory '{}'.\nPlease run this " - "script from the top level of the ns3 directory".format( - p)) + parser.error( + "Cannot find the directory '{}'.\nPlease run this " + "script from the top level of the ns3 directory".format(p) + ) # # Error check the arguments # # Alphanumeric and '-' only - allowedRE = re.compile('^(\w|-)+$') + allowedRE = re.compile("^(\w|-)+$") project_path = None if project: - #project may be a path in the form a/b/c - #remove any leading or trailing path separators + # project may be a path in the form a/b/c + # remove any leading or trailing path separators project_path = Path(project) if project_path.is_absolute(): - #remove leading separator + # remove leading separator project_path = project_path.relative_to(os.sep) if not all(allowedRE.match(part) for part in project_path.parts): - parser.error('Project path may only contain the characters [a-zA-Z0-9_-].') + parser.error("Project path may only contain the characters [a-zA-Z0-9_-].") # # Create each module, if it doesn't exist # modules = [] for name in modnames: if name: - #remove any leading or trailing directory separators + # remove any leading or trailing directory separators name = name.strip(os.sep) if not name: - #skip empty modules + # skip empty modules continue name_path = Path(name) @@ -602,33 +618,41 @@ def main(argv): print("Skipping {}: module name can not be a path".format(name)) continue - #default target directory is contrib + # default target directory is contrib modpath = contrib_path - if name_path.parts[0] == 'src': + if name_path.parts[0] == "src": if project: - parser.error("{}: Cannot specify src/ in a module name when --project option is used".format(name)) + parser.error( + "{}: Cannot specify src/ in a module name when --project option is used".format( + name + ) + ) modpath = src_path - #create a new path without the src part - name_path = name_path.relative_to('src') + # create a new path without the src part + name_path = name_path.relative_to("src") - elif name_path.parts[0] == 'contrib': + elif name_path.parts[0] == "contrib": modpath = contrib_path - #create a new path without the contrib part - name_path = name_path.relative_to('contrib') + # create a new path without the contrib part + name_path = name_path.relative_to("contrib") if project_path: - #if a project path was specified, that overrides other paths - #project paths are always relative to the contrib path + # if a project path was specified, that overrides other paths + # project paths are always relative to the contrib path modpath = contrib_path.joinpath(project_path) modname = name_path.parts[0] if not allowedRE.match(modname): - print("Skipping {}: module name may only contain the characters [a-zA-Z0-9_-]".format(modname)) + print( + "Skipping {}: module name may only contain the characters [a-zA-Z0-9_-]".format( + modname + ) + ) continue modules.append((modpath, modname)) @@ -640,7 +664,8 @@ def main(argv): return 0 -if __name__ == '__main__': + +if __name__ == "__main__": return_value = 0 try: return_value = main(sys.argv) diff --git a/utils/grid.py b/utils/grid.py index 61a07b37e..853ffc125 100644 --- a/utils/grid.py +++ b/utils/grid.py @@ -1,8 +1,9 @@ #!/usr/bin/env python3 -import cairo -import sys import re +import sys + +import cairo import gtk @@ -14,7 +15,7 @@ class DataRange: # end ## @var value # value - def __init__(self, start=0, end=0, value=''): + def __init__(self, start=0, end=0, value=""): """! Initializer @param self this object @param start start @@ -24,13 +25,15 @@ class DataRange: self.start = start self.end = end self.value = value + + ## EventString class class EventString: ## @var at # at ## @var value # value - def __init__(self, at=0, value=''): + def __init__(self, at=0, value=""): """! Initializer @param self this object @param at you @@ -38,6 +41,8 @@ class EventString: """ self.at = at self.value = value + + ## EventFloat class class EventFloat: ## @var at @@ -52,6 +57,8 @@ class EventFloat: """ self.at = at self.value = value + + ## EventInt class class EventInt: ## @var at @@ -66,6 +73,8 @@ class EventInt: """ self.at = at self.value = value + + def ranges_cmp(a, b): diff = a.start - b.start if diff < 0: @@ -74,6 +83,8 @@ def ranges_cmp(a, b): return +1 else: return 0 + + def events_cmp(a, b): diff = a.at - b.at if diff < 0: @@ -82,13 +93,15 @@ def events_cmp(a, b): return +1 else: return 0 + + ## TimelineDataRange class TimelineDataRange: ## @var name # name ## @var ranges # ranges - def __init__(self, name=''): + def __init__(self, name=""): """! Initializer @param self this object @param name name @@ -96,6 +109,7 @@ class TimelineDataRange: self.name = name self.ranges = [] return + def __search(self, key): """! Search @param self this object @@ -103,7 +117,7 @@ class TimelineDataRange: @return index if found or -1 if not found """ l = 0 - u = len(self.ranges)-1 + u = len(self.ranges) - 1 while l <= u: i = int((l + u) / 2) if key >= self.ranges[i].start and key <= self.ranges[i].end: @@ -113,7 +127,8 @@ class TimelineDataRange: else: # key > self.ranges[i].end l = i + 1 - return - 1 + return -1 + def add_range(self, range): """! Add range @param self this object @@ -121,12 +136,14 @@ class TimelineDataRange: @return none """ self.ranges.append(range) + def get_all(self): """! Get all ranges @param self this object @return the ranges """ return self.ranges + def get_ranges(self, start, end): """! Get selected ranges @param self this object @@ -139,11 +156,12 @@ class TimelineDataRange: if s == -1 and e == -1: return [] elif s == -1: - return self.ranges[0:e + 1] + return self.ranges[0 : e + 1] elif e == -1: - return self.ranges[s:len(self.ranges)] + return self.ranges[s : len(self.ranges)] else: - return self.ranges[s:e + 1] + return self.ranges[s : e + 1] + def get_ranges_bounds(self, start, end): """! Get ranges bounds @param self this object @@ -161,12 +179,14 @@ class TimelineDataRange: return (s, len(self.ranges)) else: return (s, e + 1) + def sort(self): """! Sort ranges @param self this object @return none """ self.ranges.sort(ranges_cmp) + def get_bounds(self): """! Get bounds @param self this object @@ -174,23 +194,26 @@ class TimelineDataRange: """ if len(self.ranges) > 0: lo = self.ranges[0].start - hi = self.ranges[len(self.ranges)-1].end + hi = self.ranges[len(self.ranges) - 1].end return (lo, hi) else: return (0, 0) + + ## TimelineEvent class class TimelineEvent: ## @var name # name ## @var events # events - def __init__(self, name=''): + def __init__(self, name=""): """! Get ranges bounds @param self this object @param name name """ self.name = name self.events = [] + def __search(self, key): """! Search function @param self this object @@ -198,7 +221,7 @@ class TimelineEvent: @return event index """ l = 0 - u = len(self.events)-1 + u = len(self.events) - 1 while l <= u: i = int((l + u) / 2) if key == self.events[i].at: @@ -209,6 +232,7 @@ class TimelineEvent: # key > self.events[i].at l = i + 1 return l + def add_event(self, event): """! Add Event @param self this object @@ -216,6 +240,7 @@ class TimelineEvent: @return none """ self.events.append(event) + def get_events(self, start, end): """! Get Events @param self this object @@ -225,7 +250,8 @@ class TimelineEvent: """ s = self.__search(start) e = self.__search(end) - return self.events[s:e + 1] + return self.events[s : e + 1] + def get_events_bounds(self, start, end): """! Get Events Bounds @param self this object @@ -236,12 +262,14 @@ class TimelineEvent: s = self.__search(start) e = self.__search(end) return (s, e + 1) + def sort(self): """! Sort function @param self this object @return none """ self.events.sort(events_cmp) + def get_bounds(self): """! Get Bounds @param self this object @@ -254,6 +282,7 @@ class TimelineEvent: else: return (0, 0) + ## Timeline class class Timeline: ## @var name @@ -264,7 +293,7 @@ class Timeline: # event string ## @var event_int # event int - def __init__(self, name=''): + def __init__(self, name=""): """! Initializer @param self this object @param name name @@ -273,6 +302,7 @@ class Timeline: self.event_str = [] self.event_int = [] self.name = name + def get_range(self, name): """! Get range @param self this object @@ -285,6 +315,7 @@ class Timeline: timeline = TimelineDataRange(name) self.ranges.append(timeline) return timeline + def get_event_str(self, name): """! Get Event String @param self this object @@ -297,6 +328,7 @@ class Timeline: timeline = TimelineEvent(name) self.event_str.append(timeline) return timeline + def get_event_int(self, name): """! Get Event Int @param self this object @@ -309,24 +341,28 @@ class Timeline: timeline = TimelineEvent(name) self.event_int.append(timeline) return timeline + def get_ranges(self): """! Get Ranges @param self this object @return the ranges """ return self.ranges + def get_events_str(self): """! Get Events string @param self this object @return event string """ return self.event_str + def get_events_int(self): """! Get Events int @param self this object @return evrnt int """ return self.event_int + def sort(self): """! Sort the ranges and events @param self this object @@ -338,6 +374,7 @@ class Timeline: event.sort() for event in self.event_str: event.sort() + def get_bounds(self): """! Get Bounds @param self this object @@ -365,15 +402,17 @@ class Timeline: hi = ev_hi return (lo, hi) + ## Timelines class class Timelines: ## @var timelines # timelines def __init__(self): - """ Initializer + """Initializer @param self: this object """ self.timelines = [] + def get(self, name): """! Get Timeline @param self this object @@ -386,12 +425,14 @@ class Timelines: timeline = Timeline(name) self.timelines.append(timeline) return timeline + def get_all(self): """! Get All Timeline @param self this object @return all timelines """ return self.timelines + def sort(self): """! Sort the timelines @param self this object @@ -399,6 +440,7 @@ class Timelines: """ for timeline in self.timelines: timeline.sort() + def get_bounds(self): """! Get Bounds @param self this object @@ -413,6 +455,7 @@ class Timelines: if t_hi > hi: hi = t_hi return (lo, hi) + def get_all_range_values(self): """! Get All Ranges @param self this object @@ -425,6 +468,7 @@ class Timelines: range_values[ran.value] = 1 return range_values.keys() + ## Color class class Color: ## @var r @@ -443,6 +487,7 @@ class Color: self.r = r self.g = g self.b = b + def set(self, r, g, b): """! Set color @param self: this object @@ -455,6 +500,7 @@ class Color: self.g = g self.b = b + ## Colors class class Colors: ## @var __colors @@ -462,12 +508,21 @@ class Colors: ## @var default_colors # default colors ## XXX add more - default_colors = [Color(1, 0, 0), Color(0, 1, 0), Color(0, 0, 1), Color(1, 1, 0), Color(1, 0, 1), Color(0, 1, 1)] + default_colors = [ + Color(1, 0, 0), + Color(0, 1, 0), + Color(0, 0, 1), + Color(1, 1, 0), + Color(1, 0, 1), + Color(0, 1, 1), + ] + def __init__(self): """! Initializer @param self this object """ self.__colors = {} + def add(self, name, color): """! Add @param self this object @@ -476,6 +531,7 @@ class Colors: @return none """ self.__colors[name] = color + def lookup(self, name): """! Lookup name @param self this object @@ -486,6 +542,7 @@ class Colors: self.add(name, self.default_colors.pop()) return self.__colors.get(name) + ## TopLegendRenderer class class TopLegendRenderer: ## @var __padding @@ -503,6 +560,7 @@ class TopLegendRenderer: @param self this object """ self.__padding = 10 + def set_padding(self, padding): """! Set padding @param self this object @@ -510,6 +568,7 @@ class TopLegendRenderer: @return none """ self.__padding = padding + def set_legends(self, legends, colors): """! Set padding @param self this object @@ -519,6 +578,7 @@ class TopLegendRenderer: """ self.__legends = legends self.__colors = colors + def layout(self, width): """! Set padding @param self this object @@ -552,6 +612,7 @@ class TopLegendRenderer: @return height """ return self.__height + def draw(self, ctx): """! Set padding @param self this object @@ -578,15 +639,14 @@ class TopLegendRenderer: ctx.set_source_rgb(0, 0, 0) ctx.set_line_width(2) ctx.stroke_preserve() - ctx.set_source_rgb(self.__colors[i].r, - self.__colors[i].g, - self.__colors[i].b) + ctx.set_source_rgb(self.__colors[i].r, self.__colors[i].g, self.__colors[i].b) ctx.fill() - ctx.move_to(x + self.__padding*2, total_height + t_height) + ctx.move_to(x + self.__padding * 2, total_height + t_height) ctx.set_source_rgb(0, 0, 0) ctx.show_text(legend) i += 1 + ## TimelinesRenderer class class TimelinesRenderer: ## @var padding @@ -617,12 +677,14 @@ class TimelinesRenderer: """ self.padding = 10 return + def get_height(self): """! Get Height @param self this object @return height """ return self.height + def set_timelines(self, timelines, colors): """! Set Timelines @param self this object @@ -632,6 +694,7 @@ class TimelinesRenderer: """ self.timelines = timelines self.colors = colors + def set_render_range(self, start, end): """! Set Render Range @param self this object @@ -641,12 +704,16 @@ class TimelinesRenderer: """ self.start = start self.end = end + def get_data_x_start(self): """! Get Data X Start @param self: this object @return X start """ - return self.padding / 2 + self.left_width + self.padding + self.right_width + self.padding / 2 + return ( + self.padding / 2 + self.left_width + self.padding + self.right_width + self.padding / 2 + ) + def layout(self, width): """! Get Data X Start @param self this object @@ -655,7 +722,9 @@ class TimelinesRenderer: """ surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, 1, 1) ctx = cairo.Context(surface) - max_text_height = ctx.text_extents("ABCDEFGHIJKLMNOPQRSTUVWXYZabcedefghijklmnopqrstuvwxyz0123456789")[3] + max_text_height = ctx.text_extents( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcedefghijklmnopqrstuvwxyz0123456789" + )[3] left_width = 0 right_width = 0 @@ -694,6 +763,7 @@ class TimelinesRenderer: self.max_text_height = max_text_height self.width = width self.height = height + self.padding + def draw_line(self, ctx, x, y, width, height): """! Draw Line @param self this object @@ -711,6 +781,7 @@ class TimelinesRenderer: ctx.set_line_width(1.0) ctx.set_source_rgb(0, 0, 0) ctx.stroke() + def draw_events(self, ctx, events, x, y, width, height): """! Draw Event @param self this object @@ -723,8 +794,7 @@ class TimelinesRenderer: @return none """ if (self.grey_background % 2) == 0: - ctx.rectangle(x, y - self.padding / 2, - width, height + self.padding) + ctx.rectangle(x, y - self.padding / 2, width, height + self.padding) ctx.set_source_rgb(0.9, 0.9, 0.9) ctx.fill() last_x_drawn = int(x) @@ -740,6 +810,7 @@ class TimelinesRenderer: ctx.show_text(str(event.value)) last_x_drawn = real_x self.grey_background += 1 + def draw_ranges(self, ctx, ranges, x, y, width, height): """! Draw Ranges @param self this object @@ -752,8 +823,7 @@ class TimelinesRenderer: @return none """ if (self.grey_background % 2) == 0: - ctx.rectangle(x, y - self.padding / 2, - width, height + self.padding) + ctx.rectangle(x, y - self.padding / 2, width, height + self.padding) ctx.set_source_rgb(0.9, 0.9, 0.9) ctx.fill() last_x_drawn = int(x - 1) @@ -800,34 +870,51 @@ class TimelinesRenderer: (y_bearing, t_width, t_height) = ctx.text_extents(events_int.name)[1:4] ctx.move_to(right_x_start, cur_y + self.max_text_height - (t_height + y_bearing)) ctx.show_text(events_int.name) - self.draw_events(ctx, events_int, data_x_start, cur_y, data_width, self.max_text_height + 5) + self.draw_events( + ctx, events_int, data_x_start, cur_y, data_width, self.max_text_height + 5 + ) cur_y += self.max_text_height + 5 + self.padding - self.draw_line(ctx, right_x_start - self.padding / 2, cur_y - self.padding / 2, - self.right_width + self.padding, 0) + self.draw_line( + ctx, + right_x_start - self.padding / 2, + cur_y - self.padding / 2, + self.right_width + self.padding, + 0, + ) for events_str in timeline.get_events_str(): (y_bearing, t_width, t_height) = ctx.text_extents(events_str.name)[1:4] ctx.move_to(right_x_start, cur_y + self.max_text_height - (t_height + y_bearing)) ctx.show_text(events_str.name) - self.draw_events(ctx, events_str, data_x_start, cur_y, data_width, self.max_text_height + 5) + self.draw_events( + ctx, events_str, data_x_start, cur_y, data_width, self.max_text_height + 5 + ) cur_y += self.max_text_height + 5 + self.padding - self.draw_line(ctx, right_x_start - self.padding / 2, cur_y - self.padding / 2, - self.right_width + self.padding, 0) + self.draw_line( + ctx, + right_x_start - self.padding / 2, + cur_y - self.padding / 2, + self.right_width + self.padding, + 0, + ) for ranges in timeline.get_ranges(): (y_bearing, t_width, t_height) = ctx.text_extents(ranges.name)[1:4] ctx.move_to(right_x_start, cur_y + self.max_text_height - (t_height + y_bearing)) ctx.show_text(ranges.name) self.draw_ranges(ctx, ranges, data_x_start, cur_y, data_width, 10) cur_y += self.max_text_height + self.padding - self.draw_line(ctx, right_x_start - self.padding / 2, cur_y - self.padding / 2, - self.right_width + self.padding, 0) - self.draw_line(ctx, 0, cur_y - self.padding / 2, - self.width, 0) + self.draw_line( + ctx, + right_x_start - self.padding / 2, + cur_y - self.padding / 2, + self.right_width + self.padding, + 0, + ) + self.draw_line(ctx, 0, cur_y - self.padding / 2, self.width, 0) bot_y = cur_y - self.padding / 2 - self.draw_line(ctx, left_x_end + self.padding / 2, 0, - 0, bot_y) - self.draw_line(ctx, right_x_end + self.padding / 2, 0, - 0, bot_y) + self.draw_line(ctx, left_x_end + self.padding / 2, 0, 0, bot_y) + self.draw_line(ctx, right_x_end + self.padding / 2, 0, 0, bot_y) + ## ScaleRenderer class class ScaleRenderer: @@ -851,6 +938,7 @@ class ScaleRenderer: """ self.__top = 0 return + def set_bounds(self, lo, hi): """! Set Bounds @param self this object @@ -860,6 +948,7 @@ class ScaleRenderer: """ self.__lo = lo self.__hi = hi + def get_position(self, x): """! Get Position @param self this object @@ -868,18 +957,21 @@ class ScaleRenderer: """ real_x = (x - self.__lo) * self.__width / (self.__hi - self.__lo) return real_x + def set_top(self): """! Set Top @param self this object @return none """ self.__top = 1 + def set_bot(self): """! Set Bottom @param self this object @return none """ self.__top = 0 + def layout(self, width): """! Layout @param self this object @@ -892,7 +984,7 @@ class ScaleRenderer: # calculate scale delta data_delta = self.__hi - self.__lo closest = 1 - while (closest*10) < data_delta: + while (closest * 10) < data_delta: closest *= 10 if (data_delta / closest) == 0: delta = closest @@ -907,7 +999,9 @@ class ScaleRenderer: self.__width = width # calculate text height - max_text_height = ctx.text_extents("ABCDEFGHIJKLMNOPQRSTUVWXYZabcedefghijklmnopqrstuvwxyz0123456789")[3] + max_text_height = ctx.text_extents( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcedefghijklmnopqrstuvwxyz0123456789" + )[3] self.max_text_height = max_text_height height = max_text_height + 10 self.__height = height @@ -918,6 +1012,7 @@ class ScaleRenderer: @return height """ return self.__height + def draw(self, ctx): """! Draw @param self this object @@ -939,7 +1034,7 @@ class ScaleRenderer: for x in ticks: real_x = (x - self.__lo) * self.__width / (self.__hi - self.__lo) ctx.move_to(real_x, 0) - ctx.line_to(real_x, 5*s) + ctx.line_to(real_x, 5 * s) ctx.close_path() ctx.stroke() (t_y_bearing, t_width, t_height) = ctx.text_extents(str(x))[1:4] @@ -947,7 +1042,7 @@ class ScaleRenderer: text_delta = t_height + t_y_bearing else: text_delta = -t_y_bearing - ctx.move_to(real_x - t_width / 2, (5 + 5 + text_delta)*s) + ctx.move_to(real_x - t_width / 2, (5 + 5 + text_delta) * s) ctx.show_text(str(x)) # draw subticks delta /= 10 @@ -957,7 +1052,7 @@ class ScaleRenderer: for x in range(int(start), int(end + delta), int(delta)): real_x = (x - self.__lo) * self.__width / (self.__hi - self.__lo) ctx.move_to(real_x, 0) - ctx.line_to(real_x, 3*s) + ctx.line_to(real_x, 3 * s) ctx.close_path() ctx.stroke() @@ -1001,18 +1096,21 @@ class GraphicRenderer: self.__bot_scale.set_bot() self.__width = 1 self.__height = 1 + def get_width(self): """! Get Width @param self: this object @return width """ return self.__width + def get_height(self): """! Get Height @param self this object @return height """ return self.__height + # return x, y, width, height def get_data_rectangle(self): """! Get Data Rectangle @@ -1022,6 +1120,7 @@ class GraphicRenderer: y_start = self.__top_legend.get_height() x_start = self.__data.get_data_x_start() return (x_start, y_start, self.__width - x_start, self.__data.get_height()) + def scale_data(self, x): """! Get Data Rectangle @param self this object @@ -1031,17 +1130,24 @@ class GraphicRenderer: x_start = self.__data.get_data_x_start() x_scaled = x / (self.__width - x_start) * (self.__r_end - self.__r_start) return x_scaled + # return x, y, width, height def get_selection_rectangle(self): """! Get Selection Rectangle @param self this object @return rectangle """ - y_start = self.__top_legend.get_height() + self.__data.get_height() + self.__mid_scale.get_height() + 20 + y_start = ( + self.__top_legend.get_height() + + self.__data.get_height() + + self.__mid_scale.get_height() + + 20 + ) y_height = self.__bot_scale.get_height() + 20 x_start = self.__bot_scale.get_position(self.__r_start) x_end = self.__bot_scale.get_position(self.__r_end) return (x_start, y_start, x_end - x_start, y_height) + def scale_selection(self, x): """! Scale Selection @param self this object @@ -1050,6 +1156,7 @@ class GraphicRenderer: """ x_scaled = x / self.__width * (self.__end - self.__start) return x_scaled + def set_range(self, start, end): """! Set Range @param self this object @@ -1066,12 +1173,14 @@ class GraphicRenderer: self.__data.set_render_range(start, end) self.__mid_scale.set_bounds(start, end) self.layout(self.__width, self.__height) + def get_range(self): """! Get Range @param self this object @return range """ return (self.__r_start, self.__r_end) + def set_data(self, data): """! Set Date @param self this object @@ -1079,6 +1188,7 @@ class GraphicRenderer: @return none """ self.__data = data + def set_top_legend(self, top_legend): """! Set Top Legend @param self this object @@ -1086,6 +1196,7 @@ class GraphicRenderer: @return none """ self.__top_legend = top_legend + def layout(self, width, height): """! Set Layout @param self this object @@ -1101,6 +1212,7 @@ class GraphicRenderer: self.__mid_scale.layout(width - self.__data.get_data_x_start()) self.__bot_scale.layout(width) return + def __x_pixel(self, x, width): """! X Pixel @param self this object @@ -1140,15 +1252,16 @@ class GraphicRenderer: # data ctx.save() - ctx.translate(0, - top_legend_height) + ctx.translate(0, top_legend_height) self.__data.draw(ctx) ctx.restore() # scale below data ctx.save() - ctx.translate(self.__data.get_data_x_start(), - top_legend_height + self.__data.get_height() + self.__mid_scale.get_height()) + ctx.translate( + self.__data.get_data_x_start(), + top_legend_height + self.__data.get_height() + self.__mid_scale.get_height(), + ) self.__mid_scale.draw(ctx) ctx.restore() @@ -1202,13 +1315,8 @@ class GraphicRenderer: unused_start = self.__bot_scale.get_position(self.__r_start) unused_end = self.__bot_scale.get_position(self.__r_end) unused_height = self.__bot_scale.get_height() + 20 - ctx.rectangle(0, height_used, - unused_start, - unused_height) - ctx.rectangle(unused_end, - height_used, - self.__width - unused_end, - unused_height) + ctx.rectangle(0, height_used, unused_start, unused_height) + ctx.rectangle(unused_end, height_used, self.__width - unused_end, unused_height) ctx.set_source_rgb(0.9, 0.9, 0.9) ctx.fill() @@ -1248,6 +1356,7 @@ class GraphicRenderer: self.__bot_scale.draw(ctx) ctx.restore() + ## GtkGraphicRenderer class class GtkGraphicRenderer(gtk.DrawingArea): ## @var __data @@ -1296,19 +1405,21 @@ class GtkGraphicRenderer(gtk.DrawingArea): self.add_events(gtk.gdk.BUTTON_PRESS_MASK) self.add_events(gtk.gdk.BUTTON_RELEASE_MASK) self.connect("expose_event", self.expose) - self.connect('size-allocate', self.size_allocate) - self.connect('motion-notify-event', self.motion_notify) - self.connect('button-press-event', self.button_press) - self.connect('button-release-event', self.button_release) + self.connect("size-allocate", self.size_allocate) + self.connect("motion-notify-event", self.motion_notify) + self.connect("button-press-event", self.button_press) + self.connect("button-release-event", self.button_release) + def set_smaller_zoom(self): """! Set Smaller Zoom @param self this object @return none """ (start, end) = self.__data.get_range() - self.__data.set_range(start, start + (end - start)*2) + self.__data.set_range(start, start + (end - start) * 2) self.__force_full_redraw = True self.queue_draw() + def set_bigger_zoom(self): """! Set Bigger Zoom @param self this object @@ -1318,18 +1429,20 @@ class GtkGraphicRenderer(gtk.DrawingArea): self.__data.set_range(start, start + (end - start) / 2) self.__force_full_redraw = True self.queue_draw() + def output_png(self, filename): """! Output PNG @param self this object @param filename file name @return none """ - surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, - self.__data.get_width(), - self.__data.get_height()) + surface = cairo.ImageSurface( + cairo.FORMAT_ARGB32, self.__data.get_width(), self.__data.get_height() + ) ctx = cairo.Context(self.__buffer_surface) self.__data.draw(ctx) surface.write_to_png(filename) + def button_press(self, widget, event): """! Button Press @param self this object @@ -1358,6 +1471,7 @@ class GtkGraphicRenderer(gtk.DrawingArea): self.__moving_top_cur = event.x return True return False + def button_release(self, widget, event): """! Button Release @param self this object @@ -1392,6 +1506,7 @@ class GtkGraphicRenderer(gtk.DrawingArea): if self.__moving_top: self.__moving_top = False return False + def motion_notify(self, widget, event): """! Motion Notify @param self this object @@ -1420,7 +1535,7 @@ class GtkGraphicRenderer(gtk.DrawingArea): return True if self.__moving_both: cur_e = self.__width - (x + width - self.__moving_both_start) - cur_s = (self.__moving_both_start - x) + cur_s = self.__moving_both_start - x if event.x < cur_s: self.__moving_both_cur = cur_s elif event.x > cur_e: @@ -1452,6 +1567,7 @@ class GtkGraphicRenderer(gtk.DrawingArea): return True widget.window.set_cursor(None) return False + def size_allocate(self, widget, allocation): """! Size Allocate @param self this object @@ -1464,6 +1580,7 @@ class GtkGraphicRenderer(gtk.DrawingArea): self.__data.layout(allocation.width, allocation.height) self.__force_full_redraw = True self.queue_draw() + def expose(self, widget, event): """! Expose @param self this object @@ -1472,15 +1589,14 @@ class GtkGraphicRenderer(gtk.DrawingArea): @return false """ if self.__force_full_redraw: - self.__buffer_surface = cairo.ImageSurface(cairo.FORMAT_ARGB32, - self.__data.get_width(), - self.__data.get_height()) + self.__buffer_surface = cairo.ImageSurface( + cairo.FORMAT_ARGB32, self.__data.get_width(), self.__data.get_height() + ) ctx = cairo.Context(self.__buffer_surface) self.__data.draw(ctx) self.__force_full_redraw = False ctx = widget.window.cairo_create() - ctx.rectangle(event.area.x, event.area.y, - event.area.width, event.area.height) + ctx.rectangle(event.area.x, event.area.y, event.area.width, event.area.height) ctx.clip() ctx.set_source_surface(self.__buffer_surface) ctx.paint() @@ -1513,6 +1629,7 @@ class GtkGraphicRenderer(gtk.DrawingArea): ctx.stroke() return False + ## MainWindow class class MainWindow: ## @var __window @@ -1526,6 +1643,7 @@ class MainWindow: @param self this object """ return + def run(self, graphic): """! Run function @param self this object @@ -1551,10 +1669,11 @@ class MainWindow: output_png = gtk.Button("Output Png") output_png.connect("clicked", self.__output_png_cb) hbox.pack_start(output_png) - window.connect('destroy', gtk.main_quit) + window.connect("destroy", gtk.main_quit) window.show_all() - #gtk.bindings_activate(gtk.main_quit, 'q', 0) + # gtk.bindings_activate(gtk.main_quit, 'q', 0) gtk.main() + def __set_smaller_cb(self, widget): """! Set Smaller Callback @param self this object @@ -1562,6 +1681,7 @@ class MainWindow: @return none """ self.__render.set_smaller_zoom() + def __set_bigger_cb(self, widget): """! Set Bigger Callback @param self this object @@ -1569,18 +1689,21 @@ class MainWindow: @return none """ self.__render.set_bigger_zoom() + def __output_png_cb(self, widget): """! Output PNG Callback @param self this object @param widget widget @return none """ - dialog = gtk.FileChooserDialog("Output Png", self.__window, - gtk.FILE_CHOOSER_ACTION_SAVE, ("Save", 1)) + dialog = gtk.FileChooserDialog( + "Output Png", self.__window, gtk.FILE_CHOOSER_ACTION_SAVE, ("Save", 1) + ) self.__dialog = dialog dialog.set_default_response(1) dialog.connect("response", self.__dialog_response_cb) dialog.show() + def __dialog_response_cb(self, widget, response): """! Dialog Response Callback @param self this object @@ -1598,12 +1721,12 @@ class MainWindow: def read_data(filename): timelines = Timelines() colors = Colors() - m1 = re.compile('range ([^ ]+) ([^ ]+) ([^ ]+) ([0-9]+) ([0-9]+)') - m2 = re.compile('event-str ([^ ]+) ([^ ]+) ([^ ]+) ([0-9]+)') - m3 = re.compile('event-int ([^ ]+) ([^ ]+) ([0-9]+) ([0-9]+)') - m4 = re.compile('color ([^ ]+) #([a-fA-F0-9]{2,2})([a-fA-F0-9]{2,2})([a-fA-F0-9]{2,2})') + m1 = re.compile("range ([^ ]+) ([^ ]+) ([^ ]+) ([0-9]+) ([0-9]+)") + m2 = re.compile("event-str ([^ ]+) ([^ ]+) ([^ ]+) ([0-9]+)") + m3 = re.compile("event-int ([^ ]+) ([^ ]+) ([0-9]+) ([0-9]+)") + m4 = re.compile("color ([^ ]+) #([a-fA-F0-9]{2,2})([a-fA-F0-9]{2,2})([a-fA-F0-9]{2,2})") - with open(filename, encoding='utf-8') as fh: + with open(filename, encoding="utf-8") as fh: for line in fh.readlines(): m = m1.match(line) if m: @@ -1658,8 +1781,7 @@ def main(): range_colors = [] for range_value in range_values: range_colors.append(colors.lookup(range_value)) - top_legend.set_legends(range_values, - range_colors) + top_legend.set_legends(range_values, range_colors) graphic.set_top_legend(top_legend) data = TimelinesRenderer() data.set_timelines(timelines, colors) diff --git a/utils/python-unit-tests.py b/utils/python-unit-tests.py index 5053c91b2..1c3cf38e5 100644 --- a/utils/python-unit-tests.py +++ b/utils/python-unit-tests.py @@ -19,6 +19,7 @@ # Author: Gustavo J. A. M. Carneiro import unittest + try: from ns import ns except ModuleNotFoundError: @@ -60,12 +61,14 @@ class TestSimulator(unittest.TestCase): ns.Simulator.Destroy() self._args_received = None self._cb_time = None - ns.cppyy.cppdef(""" + ns.cppyy.cppdef( + """ EventImpl* pythonMakeEvent(void (*f)(std::vector), std::vector l) { return MakeEvent(f, l); } - """) + """ + ) event = ns.cppyy.gbl.pythonMakeEvent(callback, sys.argv) ns.Simulator.ScheduleNow(event) ns.Simulator.Run() @@ -89,12 +92,14 @@ class TestSimulator(unittest.TestCase): ns.Simulator.Destroy() self._args_received = None self._cb_time = None - ns.cppyy.cppdef(""" + ns.cppyy.cppdef( + """ EventImpl* pythonMakeEvent2(void (*f)(std::vector), std::vector l) { return MakeEvent(f, l); } - """) + """ + ) event = ns.cppyy.gbl.pythonMakeEvent2(callback, sys.argv) ns.Simulator.Schedule(ns.Seconds(123), event) ns.Simulator.Run() @@ -120,12 +125,14 @@ class TestSimulator(unittest.TestCase): self._cb_time = None ns.cppyy.cppdef("void null(){ return; }") ns.Simulator.Schedule(ns.Seconds(123), ns.cppyy.gbl.null) - ns.cppyy.cppdef(""" + ns.cppyy.cppdef( + """ EventImpl* pythonMakeEvent3(void (*f)(std::vector), std::vector l) { return MakeEvent(f, l); } - """) + """ + ) event = ns.cppyy.gbl.pythonMakeEvent3(callback, sys.argv) ns.Simulator.ScheduleDestroy(event) ns.Simulator.Run() @@ -153,12 +160,14 @@ class TestSimulator(unittest.TestCase): self._args_received = None self._cb_time = None self._context_received = None - ns.cppyy.cppdef(""" + ns.cppyy.cppdef( + """ EventImpl* pythonMakeEvent4(void (*f)(uint32_t, std::vector), uint32_t context, std::vector l) { return MakeEvent(f, context, l); } - """) + """ + ) event = ns.cppyy.gbl.pythonMakeEvent4(callback, 54321, sys.argv) ns.Simulator.ScheduleWithContext(54321, ns.Seconds(123), event) ns.Simulator.Run() @@ -210,20 +219,29 @@ class TestSimulator(unittest.TestCase): def python_rx_callback(socket) -> None: self._received_packet = socket.Recv(maxSize=UINT32_MAX, flags=0) - ns.cppyy.cppdef(""" + ns.cppyy.cppdef( + """ Callback > make_rx_callback_test_socket(void(*func)(Ptr)) { return MakeCallback(func); } - """) + """ + ) - sink = ns.network.Socket.CreateSocket(node, ns.core.TypeId.LookupByName("ns3::UdpSocketFactory")) + sink = ns.network.Socket.CreateSocket( + node, ns.core.TypeId.LookupByName("ns3::UdpSocketFactory") + ) sink.Bind(ns.network.InetSocketAddress(ns.network.Ipv4Address.GetAny(), 80).ConvertTo()) sink.SetRecvCallback(ns.cppyy.gbl.make_rx_callback_test_socket(python_rx_callback)) - source = ns.network.Socket.CreateSocket(node, ns.core.TypeId.LookupByName("ns3::UdpSocketFactory")) - source.SendTo(ns.network.Packet(19), 0, - ns.network.InetSocketAddress(ns.network.Ipv4Address("127.0.0.1"), 80).ConvertTo()) + source = ns.network.Socket.CreateSocket( + node, ns.core.TypeId.LookupByName("ns3::UdpSocketFactory") + ) + source.SendTo( + ns.network.Packet(19), + 0, + ns.network.InetSocketAddress(ns.network.Ipv4Address("127.0.0.1"), 80).ConvertTo(), + ) ns.Simulator.Run() self.assertTrue(self._received_packet is not None) @@ -297,7 +315,7 @@ class TestSimulator(unittest.TestCase): @param self this object @return None """ - from ctypes import c_bool, c_int, c_double, c_char_p, create_string_buffer + from ctypes import c_bool, c_char_p, c_double, c_int, create_string_buffer test1 = c_bool(True) test2 = c_int(42) @@ -362,12 +380,12 @@ class TestSimulator(unittest.TestCase): stack.Install(nodes) address = ns.internet.Ipv4AddressHelper() - address.SetBase(ns.network.Ipv4Address("10.1.1.0"), - ns.network.Ipv4Mask("255.255.255.0")) + address.SetBase(ns.network.Ipv4Address("10.1.1.0"), ns.network.Ipv4Mask("255.255.255.0")) interfaces = address.Assign(devices) - ns.cppyy.cppdef(""" + ns.cppyy.cppdef( + """ namespace ns3 { Callback > make_rx_callback(void(*func)(Ptr)) @@ -379,7 +397,8 @@ class TestSimulator(unittest.TestCase): return MakeEvent(f, socket, packet, address); } } - """) + """ + ) ## EchoServer application class class EchoServer(ns.applications.Application): @@ -399,9 +418,14 @@ class TestSimulator(unittest.TestCase): ## Listen port for the server self.port = port ## Socket used by the server to listen to port - self.m_socket = ns.network.Socket.CreateSocket(node, - ns.core.TypeId.LookupByName("ns3::UdpSocketFactory")) - self.m_socket.Bind(ns.network.InetSocketAddress(ns.network.Ipv4Address.GetAny(), self.port).ConvertTo()) + self.m_socket = ns.network.Socket.CreateSocket( + node, ns.core.TypeId.LookupByName("ns3::UdpSocketFactory") + ) + self.m_socket.Bind( + ns.network.InetSocketAddress( + ns.network.Ipv4Address.GetAny(), self.port + ).ConvertTo() + ) self.m_socket.SetRecvCallback(ns.make_rx_callback(EchoServer._Receive)) EchoServer.socketToInstanceDict[self.m_socket] = self @@ -422,13 +446,16 @@ class TestSimulator(unittest.TestCase): self.m_socket.SendTo(packet, 0, address) if EchoServer.LOGGING: inetAddress = ns.InetSocketAddress.ConvertFrom(address) - print("At time +{s}s server sent {b} bytes from {ip} port {port}" - .format(s=ns.Simulator.Now().GetSeconds(), - b=packet.__deref__().GetSize(), - ip=inetAddress.GetIpv4(), - port=inetAddress.GetPort()), - file=sys.stderr, - flush=True) + print( + "At time +{s}s server sent {b} bytes from {ip} port {port}".format( + s=ns.Simulator.Now().GetSeconds(), + b=packet.__deref__().GetSize(), + ip=inetAddress.GetIpv4(), + port=inetAddress.GetPort(), + ), + file=sys.stderr, + flush=True, + ) def Receive(self): """! Function to receive a packet from an address @@ -439,13 +466,16 @@ class TestSimulator(unittest.TestCase): packet = self.m_socket.RecvFrom(address) if EchoServer.LOGGING: inetAddress = ns.InetSocketAddress.ConvertFrom(address) - print("At time +{s}s server received {b} bytes from {ip} port {port}" - .format(s=ns.Simulator.Now().GetSeconds(), - b=packet.__deref__().GetSize(), - ip=inetAddress.GetIpv4(), - port=inetAddress.GetPort()), - file=sys.stderr, - flush=True) + print( + "At time +{s}s server received {b} bytes from {ip} port {port}".format( + s=ns.Simulator.Now().GetSeconds(), + b=packet.__deref__().GetSize(), + ip=inetAddress.GetIpv4(), + port=inetAddress.GetPort(), + ), + file=sys.stderr, + flush=True, + ) event = ns.pythonMakeEventSend(EchoServer._Send, self.m_socket, packet, address) ns.Simulator.Schedule(ns.Seconds(1), event) @@ -493,5 +523,5 @@ class TestSimulator(unittest.TestCase): ns.Simulator.Destroy() -if __name__ == '__main__': +if __name__ == "__main__": unittest.main(verbosity=1, failfast=True) diff --git a/utils/tests/TestBase.py b/utils/tests/TestBase.py index dc58a3c75..88ebf4981 100644 --- a/utils/tests/TestBase.py +++ b/utils/tests/TestBase.py @@ -17,42 +17,52 @@ # from __future__ import print_function -import sys -import subprocess + import argparse import os +import subprocess +import sys + def print_case_in_file(case_string, out): for i in range(100): - print("-", end='', file=out) + print("-", end="", file=out) print(file=out) - print("running test case " + case_string, end='\n\n', file=out) + print("running test case " + case_string, end="\n\n", file=out) out.flush() + def print_failed_cases(failed_cases): print("\nFailed Cases:") for case in failed_cases: print(case) + def print_cmds(cmds): - print('Commands to be executed:') + print("Commands to be executed:") for cmd in cmds: - print(cmd.replace(sys.executable, '')) + print(cmd.replace(sys.executable, "")) + def set_workdir(): - dir_files = [f for f in os.listdir('.') if os.path.exists(f)] - if not 'VERSION' in dir_files and not 'ns3' in dir_files: - if os.path.split(os.path.abspath('.'))[1] == 'tests' and os.path.split(os.path.abspath(os.pardir))[1] == 'utils': - os.chdir('../../') + dir_files = [f for f in os.listdir(".") if os.path.exists(f)] + if not "VERSION" in dir_files and not "ns3" in dir_files: + if ( + os.path.split(os.path.abspath("."))[1] == "tests" + and os.path.split(os.path.abspath(os.pardir))[1] == "utils" + ): + os.chdir("../../") else: - print('Error: Invalid working directory') + print("Error: Invalid working directory") sys.exit(1) + ## TestBaseClass class class TestBaseClass: """ - Generic class for testing tools based on provided commands and test cases. + Generic class for testing tools based on provided commands and test cases. """ + ## @var my_env # os environment ## @var mode @@ -72,9 +82,9 @@ class TestBaseClass: """ self.my_env = os.environ set_workdir() - self.my_env['LD_LIBRARY_PATH'] = os.getcwd() + "/build" + self.my_env["LD_LIBRARY_PATH"] = os.getcwd() + "/build" self.mode = mode - self.outfile = 'test-port-'+self.mode+'.out' + self.outfile = "test-port-" + self.mode + ".out" self.options = self.parseargs(argv, desc) def parseargs(self, argv, desc): @@ -86,15 +96,39 @@ class TestBaseClass: @return command line arguments """ parser = argparse.ArgumentParser(description=desc) - parser.add_argument('-f', '--file', action='store', dest='out_file', default=self.outfile, - metavar="FILE", - help='File to be used for storing the command specific output (Default: '+self.outfile+')') - parser.add_argument('-c', action='store_true', dest='cmds', default=False, - help='List out all the commands being tested') - parser.add_argument('-m', action='store_true', dest='mute', default=False, - help='Sends only stderr output to FILE') - parser.add_argument('-x', '--customcmd', action='store', dest='custcmd', default=None, - help='Enter a comma-separated list of commands to override the existing ones. NOT APPLICABLE FOR TEST-PY SUITE.') + parser.add_argument( + "-f", + "--file", + action="store", + dest="out_file", + default=self.outfile, + metavar="FILE", + help="File to be used for storing the command specific output (Default: " + + self.outfile + + ")", + ) + parser.add_argument( + "-c", + action="store_true", + dest="cmds", + default=False, + help="List out all the commands being tested", + ) + parser.add_argument( + "-m", + action="store_true", + dest="mute", + default=False, + help="Sends only stderr output to FILE", + ) + parser.add_argument( + "-x", + "--customcmd", + action="store", + dest="custcmd", + default=None, + help="Enter a comma-separated list of commands to override the existing ones. NOT APPLICABLE FOR TEST-PY SUITE.", + ) return parser.parse_args(argv) def override_cmds(self): @@ -115,38 +149,39 @@ class TestBaseClass: if self.options.cmds: print_cmds(cmds) return - base_dir = os.sep.join(os.path.abspath(__file__).replace(os.path.pathsep, '/').split('/')[:-3]) + base_dir = os.sep.join( + os.path.abspath(__file__).replace(os.path.pathsep, "/").split("/")[:-3] + ) final_return = 0 total_tests = len(cmds) passed = 0 progress = 0.0 failed_cases = [] - with open(self.options.out_file, 'w', encoding='utf-8') as out: + with open(self.options.out_file, "w", encoding="utf-8") as out: outstream = out - with open(os.devnull, 'w', encoding='utf-8') as sink: + with open(os.devnull, "w", encoding="utf-8") as sink: if self.options.mute: outstream = sink for cmd in cmds: - case_string = cmd.replace(sys.executable, '') + case_string = cmd.replace(sys.executable, "") print("running test case: " + case_string) print_case_in_file(case_string, out) progress += 1 - ret = subprocess.call(cmd, - shell=True, - env=self.my_env, - stdout=outstream, - stderr=out, - cwd=base_dir - ) + ret = subprocess.call( + cmd, shell=True, env=self.my_env, stdout=outstream, stderr=out, cwd=base_dir + ) if not ret: passed += 1 else: final_return = 1 failed_cases.append(case_string) - print("[ %s out of %s ] test cases passed; Progress = %.2f%% \n" % (passed, total_tests, progress*100/total_tests)) + print( + "[ %s out of %s ] test cases passed; Progress = %.2f%% \n" + % (passed, total_tests, progress * 100 / total_tests) + ) if final_return != 0: print_failed_cases(failed_cases) else: print("\nAll cases passed") - print("Detailed output available in " + self.options.out_file, end='\n\n') + print("Detailed output available in " + self.options.out_file, end="\n\n") return final_return diff --git a/utils/tests/test-ns3.py b/utils/tests/test-ns3.py index 966f11b66..84bd0249d 100755 --- a/utils/tests/test-ns3.py +++ b/utils/tests/test-ns3.py @@ -44,13 +44,13 @@ os.chdir(ns3_path) # Cmake commands num_threads = max(1, os.cpu_count() - 1) cmake_build_project_command = "cmake --build {cmake_cache} -j".format( - ns3_path=ns3_path, - cmake_cache=os.path.abspath(os.path.join(ns3_path, "cmake-cache")) + ns3_path=ns3_path, cmake_cache=os.path.abspath(os.path.join(ns3_path, "cmake-cache")) +) +cmake_build_target_command = partial( + "cmake --build {cmake_cache} -j {jobs} --target {target}".format, + jobs=num_threads, + cmake_cache=os.path.abspath(os.path.join(ns3_path, "cmake-cache")), ) -cmake_build_target_command = partial("cmake --build {cmake_cache} -j {jobs} --target {target}".format, - jobs=num_threads, - cmake_cache=os.path.abspath(os.path.join(ns3_path, "cmake-cache")) - ) win32 = sys.platform == "win32" platform_makefiles = "MinGW Makefiles" if win32 else "Unix Makefiles" ext = ".exe" if win32 else "" @@ -99,10 +99,10 @@ def run_program(program, args, python=False, cwd=ns3_path, env=None): arguments = [program] if args != "": - arguments.extend(re.findall("(?:\".*?\"|\S)+", args)) # noqa + arguments.extend(re.findall('(?:".*?"|\S)+', args)) # noqa for i in range(len(arguments)): - arguments[i] = arguments[i].replace("\"", "") + arguments[i] = arguments[i].replace('"', "") # Forward environment variables used by the ns3 script current_env = os.environ.copy() @@ -118,10 +118,14 @@ def run_program(program, args, python=False, cwd=ns3_path, env=None): stdout=subprocess.PIPE, stderr=subprocess.PIPE, cwd=cwd, # run process from the ns-3-dev path - env=current_env + env=current_env, ) # Return (error code, stdout and stderr) - return ret.returncode, ret.stdout.decode(sys.stdout.encoding), ret.stderr.decode(sys.stderr.encoding) + return ( + ret.returncode, + ret.stdout.decode(sys.stdout.encoding), + ret.stderr.decode(sys.stderr.encoding), + ) def get_programs_list(): @@ -147,7 +151,7 @@ def get_libraries_list(lib_outdir=usual_lib_outdir): @param lib_outdir: path containing libraries @return list of built libraries. """ - libraries = glob.glob(lib_outdir + '/*', recursive=True) + libraries = glob.glob(lib_outdir + "/*", recursive=True) return list(filter(lambda x: "scratch-nested-subdir-lib" not in x, libraries)) @@ -157,7 +161,7 @@ def get_headers_list(outdir=usual_outdir): @param outdir: path containing headers @return list of headers. """ - return glob.glob(outdir + '/**/*.h', recursive=True) + return glob.glob(outdir + "/**/*.h", recursive=True) def read_lock_entry(entry): @@ -219,11 +223,13 @@ class DockerContainerManager: # Create Docker client instance and start it ## The Python-on-whales container instance - self.container = docker.run(containerName, - interactive=True, detach=True, - tty=False, - volumes=[(ns3_path, "/ns-3-dev")] - ) + self.container = docker.run( + containerName, + interactive=True, + detach=True, + tty=False, + volumes=[(ns3_path, "/ns-3-dev")], + ) # Redefine the execute command of the container def split_exec(docker_container, cmd): @@ -289,7 +295,9 @@ class NS3UnusedSourcesTestCase(unittest.TestCase): continue # Open the examples CMakeLists.txt and read it - with open(os.path.join(example_directory, "CMakeLists.txt"), "r", encoding="utf-8") as f: + with open( + os.path.join(example_directory, "CMakeLists.txt"), "r", encoding="utf-8" + ) as f: cmake_contents = f.read() # For each file, check if it is in the CMake contents @@ -332,8 +340,9 @@ class NS3UnusedSourcesTestCase(unittest.TestCase): unused_sources.add(file) # Remove temporary exceptions - exceptions = ["win32-system-wall-clock-ms.cc", # Should be removed with MR784 - ] + exceptions = [ + "win32-system-wall-clock-ms.cc", # Should be removed with MR784 + ] for exception in exceptions: for unused_source in unused_sources: if os.path.basename(unused_source) == exception: @@ -398,12 +407,13 @@ class NS3DependenciesTestCase(unittest.TestCase): module_name = os.path.relpath(path, ns3_path) module_name_nodir = module_name.replace("src/", "").replace("contrib/", "") - modules[module_name_nodir] = {"sources": set(), - "headers": set(), - "libraries": set(), - "included_headers": set(), - "included_libraries": set(), - } + modules[module_name_nodir] = { + "sources": set(), + "headers": set(), + "libraries": set(), + "included_headers": set(), + "included_libraries": set(), + } # Separate list of source files and header files for line in cmake_contents: @@ -428,15 +438,18 @@ class NS3DependenciesTestCase(unittest.TestCase): source_file = os.path.join(ns3_path, module_name, line.strip()) with open(source_file, "r", encoding="utf-8") as f: source_contents = f.read() - modules[module_name_nodir]["included_headers"].update(map(lambda x: x.replace("ns3/", ""), - re.findall("#include.*[\"|<](.*)[\"|>]", - source_contents) - ) - ) + modules[module_name_nodir]["included_headers"].update( + map( + lambda x: x.replace("ns3/", ""), + re.findall('#include.*["|<](.*)["|>]', source_contents), + ) + ) continue # Extract libraries linked to the module - modules[module_name_nodir]["libraries"].update(re.findall("\\${lib(.*)}", "".join(cmake_contents))) + modules[module_name_nodir]["libraries"].update( + re.findall("\\${lib(.*)}", "".join(cmake_contents)) + ) # Now that we have all the information we need, check if we have all the included libraries linked all_project_headers = set(headers_to_modules.keys()) @@ -445,15 +458,20 @@ class NS3DependenciesTestCase(unittest.TestCase): print(file=sys.stderr) for module in sorted(modules): external_headers = modules[module]["included_headers"].difference(all_project_headers) - project_headers_included = modules[module]["included_headers"].difference(external_headers) + project_headers_included = modules[module]["included_headers"].difference( + external_headers + ) modules[module]["included_libraries"] = set( - [headers_to_modules[x] for x in project_headers_included]).difference( - {module}) + [headers_to_modules[x] for x in project_headers_included] + ).difference({module}) diff = modules[module]["included_libraries"].difference(modules[module]["libraries"]) if len(diff) > 0: - print("Module %s includes modules that are not linked: %s" % (module, ", ".join(list(diff))), - file=sys.stderr) + print( + "Module %s includes modules that are not linked: %s" + % (module, ", ".join(list(diff))), + file=sys.stderr, + ) sys.stderr.flush() # Uncomment this to turn into a real test # self.assertEqual(len(diff), 0, @@ -479,13 +497,12 @@ class NS3StyleTestCase(unittest.TestCase): @return None """ if not NS3StyleTestCase.starting_diff: - if shutil.which("git") is None: self.skipTest("Git is not available") try: - from git import Repo # noqa import git.exc # noqa + from git import Repo # noqa except ImportError: self.skipTest("GitPython is not available") @@ -608,7 +625,9 @@ class NS3ConfigureBuildProfileTestCase(unittest.TestCase): Test the debug build @return None """ - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" -d debug --enable-verbose") + return_code, stdout, stderr = run_ns3( + 'configure -G "{generator}" -d debug --enable-verbose' + ) self.assertEqual(return_code, 0) self.assertIn("Build profile : debug", stdout) self.assertIn("Build files have been written to", stdout) @@ -627,7 +646,7 @@ class NS3ConfigureBuildProfileTestCase(unittest.TestCase): Test the release build @return None """ - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" -d release") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" -d release') self.assertEqual(return_code, 0) self.assertIn("Build profile : release", stdout) self.assertIn("Build files have been written to", stdout) @@ -637,7 +656,9 @@ class NS3ConfigureBuildProfileTestCase(unittest.TestCase): Test the optimized build @return None """ - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" -d optimized --enable-verbose") + return_code, stdout, stderr = run_ns3( + 'configure -G "{generator}" -d optimized --enable-verbose' + ) self.assertEqual(return_code, 0) self.assertIn("Build profile : optimized", stdout) self.assertIn("Build files have been written to", stdout) @@ -656,7 +677,7 @@ class NS3ConfigureBuildProfileTestCase(unittest.TestCase): Test a build type with a typo @return None """ - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" -d Optimized") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" -d Optimized') self.assertEqual(return_code, 2) self.assertIn("invalid choice: 'Optimized'", stderr) @@ -665,7 +686,7 @@ class NS3ConfigureBuildProfileTestCase(unittest.TestCase): Test a build type with another typo @return None """ - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" -d OPTIMIZED") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" -d OPTIMIZED') self.assertEqual(return_code, 2) self.assertIn("invalid choice: 'OPTIMIZED'", stderr) @@ -677,31 +698,37 @@ class NS3ConfigureBuildProfileTestCase(unittest.TestCase): return_code, _, _ = run_ns3("clean") self.assertEqual(return_code, 0) - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --dry-run -d debug") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" --dry-run -d debug') self.assertEqual(return_code, 0) self.assertIn( "-DCMAKE_BUILD_TYPE=debug -DNS3_ASSERT=ON -DNS3_LOG=ON -DNS3_WARNINGS_AS_ERRORS=ON -DNS3_NATIVE_OPTIMIZATIONS=OFF", - stdout) + stdout, + ) return_code, stdout, stderr = run_ns3( - "configure -G \"{generator}\" --dry-run -d debug --disable-asserts --disable-logs --disable-werror") + 'configure -G "{generator}" --dry-run -d debug --disable-asserts --disable-logs --disable-werror' + ) self.assertEqual(return_code, 0) self.assertIn( "-DCMAKE_BUILD_TYPE=debug -DNS3_NATIVE_OPTIMIZATIONS=OFF -DNS3_ASSERT=OFF -DNS3_LOG=OFF -DNS3_WARNINGS_AS_ERRORS=OFF", - stdout) + stdout, + ) - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --dry-run") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" --dry-run') self.assertEqual(return_code, 0) self.assertIn( "-DCMAKE_BUILD_TYPE=default -DNS3_ASSERT=ON -DNS3_LOG=ON -DNS3_WARNINGS_AS_ERRORS=OFF -DNS3_NATIVE_OPTIMIZATIONS=OFF", - stdout) + stdout, + ) return_code, stdout, stderr = run_ns3( - "configure -G \"{generator}\" --dry-run --enable-asserts --enable-logs --enable-werror") + 'configure -G "{generator}" --dry-run --enable-asserts --enable-logs --enable-werror' + ) self.assertEqual(return_code, 0) self.assertIn( "-DCMAKE_BUILD_TYPE=default -DNS3_ASSERT=ON -DNS3_LOG=ON -DNS3_NATIVE_OPTIMIZATIONS=OFF -DNS3_ASSERT=ON -DNS3_LOG=ON -DNS3_WARNINGS_AS_ERRORS=ON", - stdout) + stdout, + ) class NS3BaseTestCase(unittest.TestCase): @@ -736,7 +763,9 @@ class NS3BaseTestCase(unittest.TestCase): # Reconfigure from scratch before each test run_ns3("clean") - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" -d release --enable-verbose") + return_code, stdout, stderr = run_ns3( + 'configure -G "{generator}" -d release --enable-verbose' + ) self.config_ok(return_code, stdout, stderr) # Check if .lock-ns3 exists, then read to get list of executables. @@ -767,7 +796,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): Test enabling and disabling examples @return None """ - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --enable-examples") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" --enable-examples') # This just tests if we didn't break anything, not that we actually have enabled anything. self.config_ok(return_code, stdout, stderr) @@ -776,7 +805,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): self.assertGreater(len(get_programs_list()), len(self.ns3_executables)) # Now we disabled them back. - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --disable-examples") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" --disable-examples') # This just tests if we didn't break anything, not that we actually have enabled anything. self.config_ok(return_code, stdout, stderr) @@ -790,7 +819,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): @return None """ # Try enabling tests - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --enable-tests") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" --enable-tests') self.config_ok(return_code, stdout, stderr) # Then try building the libcore test @@ -801,7 +830,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): self.assertIn("Built target libcore-test", stdout) # Now we disabled the tests - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --disable-tests") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" --disable-tests') self.config_ok(return_code, stdout, stderr) # Now building the library test should fail @@ -817,7 +846,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase): @return None """ # Try filtering enabled modules to network+Wi-Fi and their dependencies - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --enable-modules='network;wifi'") + return_code, stdout, stderr = run_ns3( + "configure -G \"{generator}\" --enable-modules='network;wifi'" + ) self.config_ok(return_code, stdout, stderr) # At this point we should have fewer modules @@ -827,7 +858,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase): self.assertIn("ns3-wifi", enabled_modules) # Try enabling only core - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --enable-modules='core'") + return_code, stdout, stderr = run_ns3( + "configure -G \"{generator}\" --enable-modules='core'" + ) self.config_ok(return_code, stdout, stderr) self.assertIn("ns3-core", get_enabled_modules()) @@ -844,7 +877,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase): @return None """ # Try filtering disabled modules to disable lte and modules that depend on it. - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --disable-modules='lte;wimax'") + return_code, stdout, stderr = run_ns3( + "configure -G \"{generator}\" --disable-modules='lte;wimax'" + ) self.config_ok(return_code, stdout, stderr) # At this point we should have fewer modules. @@ -866,7 +901,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase): @return None """ # Try filtering enabled modules to network+Wi-Fi and their dependencies. - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --enable-modules='network,wifi'") + return_code, stdout, stderr = run_ns3( + "configure -G \"{generator}\" --enable-modules='network,wifi'" + ) self.config_ok(return_code, stdout, stderr) # At this point we should have fewer modules. @@ -888,7 +925,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase): @return None """ # Try filtering disabled modules to disable lte and modules that depend on it. - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --disable-modules='lte,mpi'") + return_code, stdout, stderr = run_ns3( + "configure -G \"{generator}\" --disable-modules='lte,mpi'" + ) self.config_ok(return_code, stdout, stderr) # At this point we should have fewer modules. @@ -934,10 +973,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): " ## map ns3rc templates to types # noqa - ns3rc_templates = { - "python": ns3rc_python_template, - "cmake": ns3rc_cmake_template - } + ns3rc_templates = {"python": ns3rc_python_template, "cmake": ns3rc_cmake_template} def __init__(self, type_ns3rc): self.type = type_ns3rc @@ -945,7 +981,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase): def format(self, **args): # Convert arguments from python-based ns3rc format to CMake if self.type == "cmake": - args["modules"] = args["modules"].replace("'", "").replace("\"", "").replace(",", " ") + args["modules"] = ( + args["modules"].replace("'", "").replace('"', "").replace(",", " ") + ) args["examples"] = "ON" if args["examples"] == "True" else "OFF" args["tests"] = "ON" if args["tests"] == "True" else "OFF" @@ -967,7 +1005,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): f.write(ns3rc_template.format(modules="'lte'", examples="False", tests="True")) # Reconfigure. - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\"") + return_code, stdout, stderr = run_ns3('configure -G "{generator}"') self.config_ok(return_code, stdout, stderr) # Check. @@ -982,7 +1020,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): f.write(ns3rc_template.format(modules="'wifi'", examples="True", tests="False")) # Reconfigure - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\"") + return_code, stdout, stderr = run_ns3('configure -G "{generator}"') self.config_ok(return_code, stdout, stderr) # Check @@ -994,10 +1032,14 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Replace the ns3rc file with multiple modules with open(ns3rc_script, "w", encoding="utf-8") as f: - f.write(ns3rc_template.format(modules="'core','network'", examples="True", tests="False")) + f.write( + ns3rc_template.format( + modules="'core','network'", examples="True", tests="False" + ) + ) # Reconfigure - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\"") + return_code, stdout, stderr = run_ns3('configure -G "{generator}"') self.config_ok(return_code, stdout, stderr) # Check @@ -1012,18 +1054,27 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # in various different ways and with comments with open(ns3rc_script, "w", encoding="utf-8") as f: if ns3rc_type == "python": - f.write(ns3rc_template.format(modules="""'core', #comment + f.write( + ns3rc_template.format( + modules="""'core', #comment 'lte', #comment2, #comment3 - 'network', 'internet','wimax'""", examples="True", tests="True")) + 'network', 'internet','wimax'""", + examples="True", + tests="True", + ) + ) else: - f.write(ns3rc_template.format(modules="'core', 'lte', 'network', 'internet', 'wimax'", - examples="True", - tests="True") - ) + f.write( + ns3rc_template.format( + modules="'core', 'lte', 'network', 'internet', 'wimax'", + examples="True", + tests="True", + ) + ) # Reconfigure - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\"") + return_code, stdout, stderr = run_ns3('configure -G "{generator}"') self.config_ok(return_code, stdout, stderr) # Check @@ -1040,7 +1091,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): os.remove(ns3rc_script) # Reconfigure - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\"") + return_code, stdout, stderr = run_ns3('configure -G "{generator}"') self.config_ok(return_code, stdout, stderr) # Check @@ -1067,7 +1118,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): run_ns3("clean") # Build target before using below - run_ns3("configure -G \"{generator}\" -d release --enable-verbose") + run_ns3('configure -G "{generator}" -d release --enable-verbose') run_ns3("build scratch-simulator") # Run all cases and then check outputs @@ -1113,7 +1164,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): return_code, _, _ = run_ns3("clean") self.assertEqual(return_code, 0) - return_code, _, _ = run_ns3("configure -G \"{generator}\" --enable-examples --enable-tests") + return_code, _, _ = run_ns3('configure -G "{generator}" --enable-examples --enable-tests') self.assertEqual(return_code, 0) # Build necessary executables @@ -1121,25 +1172,30 @@ class NS3ConfigureTestCase(NS3BaseTestCase): self.assertEqual(return_code, 0) # Now some tests will succeed normally - return_code, stdout, stderr = run_ns3("run \"test-runner --test-name=command-line\" --no-build") + return_code, stdout, stderr = run_ns3( + 'run "test-runner --test-name=command-line" --no-build' + ) self.assertEqual(return_code, 0) # Now some tests will fail during NS_COMMANDLINE_INTROSPECTION - return_code, stdout, stderr = run_ns3("run \"test-runner --test-name=command-line\" --no-build", - env={"NS_COMMANDLINE_INTROSPECTION": ".."} - ) + return_code, stdout, stderr = run_ns3( + 'run "test-runner --test-name=command-line" --no-build', + env={"NS_COMMANDLINE_INTROSPECTION": ".."}, + ) self.assertNotEqual(return_code, 0) # Cause a sigsegv sigsegv_example = os.path.join(ns3_path, "scratch", "sigsegv.cc") with open(sigsegv_example, "w", encoding="utf-8") as f: - f.write(""" + f.write( + """ int main (int argc, char *argv[]) { char *s = "hello world"; *s = 'H'; return 0; } - """) + """ + ) return_code, stdout, stderr = run_ns3("run sigsegv") if win32: self.assertEqual(return_code, 4294967295) # unsigned -1 @@ -1151,7 +1207,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Cause an abort abort_example = os.path.join(ns3_path, "scratch", "abort.cc") with open(abort_example, "w", encoding="utf-8") as f: - f.write(""" + f.write( + """ #include "ns3/core-module.h" using namespace ns3; @@ -1160,7 +1217,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): NS_ABORT_IF(true); return 0; } - """) + """ + ) return_code, stdout, stderr = run_ns3("run abort") if win32: self.assertEqual(return_code, 3) @@ -1198,7 +1256,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): if shutil.which("git") is None: self.skipTest("git is not available") - return_code, _, _ = run_ns3("configure -G \"{generator}\" --enable-build-version") + return_code, _, _ = run_ns3('configure -G "{generator}" --enable-build-version') self.assertEqual(return_code, 0) return_code, stdout, stderr = run_ns3("show version") @@ -1212,11 +1270,13 @@ class NS3ConfigureTestCase(NS3BaseTestCase): @return None """ - test_files = ["scratch/main.cc", - "scratch/empty.cc", - "scratch/subdir1/main.cc", - "scratch/subdir2/main.cc", - "scratch/main.test.dots.in.name.cc"] + test_files = [ + "scratch/main.cc", + "scratch/empty.cc", + "scratch/subdir1/main.cc", + "scratch/subdir2/main.cc", + "scratch/main.test.dots.in.name.cc", + ] backup_files = ["scratch/.main.cc"] # hidden files should be ignored # Create test scratch files @@ -1233,15 +1293,17 @@ class NS3ConfigureTestCase(NS3BaseTestCase): f.write("") # Reload the cmake cache to pick them up - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\"") + return_code, stdout, stderr = run_ns3('configure -G "{generator}"') self.assertEqual(return_code, 0) # Try to build them with ns3 and cmake for path in test_files + backup_files: path = path.replace(".cc", "") - return_code1, stdout1, stderr1 = run_program("cmake", "--build . --target %s -j %d" - % (path.replace("/", "_"), num_threads), - cwd=os.path.join(ns3_path, "cmake-cache")) + return_code1, stdout1, stderr1 = run_program( + "cmake", + "--build . --target %s -j %d" % (path.replace("/", "_"), num_threads), + cwd=os.path.join(ns3_path, "cmake-cache"), + ) return_code2, stdout2, stderr2 = run_ns3("build %s" % path) if "main" in path and ".main" not in path: self.assertEqual(return_code1, 0) @@ -1265,7 +1327,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): container.execute("apt-get install -y python3 cmake g++ ninja-build") try: container.execute( - "./ns3 configure --enable-modules=core,network,internet -- -DCMAKE_CXX_COMPILER=/usr/bin/g++") + "./ns3 configure --enable-modules=core,network,internet -- -DCMAKE_CXX_COMPILER=/usr/bin/g++" + ) except DockerException as e: self.fail() for path in test_files: @@ -1286,16 +1349,15 @@ class NS3ConfigureTestCase(NS3BaseTestCase): filename = os.path.basename(path).replace(".cc", "") executable_absolute_path = os.path.dirname(os.path.join(ns3_path, "build", path)) if os.path.exists(executable_absolute_path): - executable_name = list(filter(lambda x: filename in x, - os.listdir(executable_absolute_path) - ) - )[0] + executable_name = list( + filter(lambda x: filename in x, os.listdir(executable_absolute_path)) + )[0] os.remove(os.path.join(executable_absolute_path, executable_name)) if not os.listdir(os.path.dirname(path)): os.rmdir(os.path.dirname(source_absolute_path)) - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\"") + return_code, stdout, stderr = run_ns3('configure -G "{generator}"') self.assertEqual(return_code, 0) def test_14_MpiCommandTemplate(self): @@ -1307,7 +1369,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): if shutil.which("mpiexec") is None or win32: self.skipTest("Mpi is not available") - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --enable-examples") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" --enable-examples') self.assertEqual(return_code, 0) executables = get_programs_list() @@ -1318,8 +1380,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Get executable path sample_simulator_path = list(filter(lambda x: "sample-simulator" in x, executables))[0] - mpi_command = "--dry-run run sample-simulator --command-template=\"mpiexec -np 2 %s\"" - non_mpi_command = "--dry-run run sample-simulator --command-template=\"echo %s\"" + mpi_command = '--dry-run run sample-simulator --command-template="mpiexec -np 2 %s"' + non_mpi_command = '--dry-run run sample-simulator --command-template="echo %s"' # Get the commands to run sample-simulator in two processes with mpi return_code, stdout, stderr = run_ns3(mpi_command) @@ -1331,9 +1393,14 @@ class NS3ConfigureTestCase(NS3BaseTestCase): self.assertEqual(return_code, 0) if os.getenv("USER", "") == "root": if shutil.which("ompi_info"): - self.assertIn("mpiexec --allow-run-as-root --oversubscribe -np 2 %s" % sample_simulator_path, stdout) + self.assertIn( + "mpiexec --allow-run-as-root --oversubscribe -np 2 %s" % sample_simulator_path, + stdout, + ) else: - self.assertIn("mpiexec --allow-run-as-root -np 2 %s" % sample_simulator_path, stdout) + self.assertIn( + "mpiexec --allow-run-as-root -np 2 %s" % sample_simulator_path, stdout + ) else: self.assertIn("mpiexec -np 2 %s" % sample_simulator_path, stdout) @@ -1347,7 +1414,7 @@ class NS3ConfigureTestCase(NS3BaseTestCase): self.assertEqual(return_code, 0) self.assertIn("echo %s" % sample_simulator_path, stdout) - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --disable-examples") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" --disable-examples') self.assertEqual(return_code, 0) def test_15_InvalidLibrariesToLink(self): @@ -1368,15 +1435,18 @@ class NS3ConfigureTestCase(NS3BaseTestCase): f.write("") for invalid_or_nonexistent_library in ["", "gsd", "lib", "libfi", "calibre"]: with open("contrib/borked/CMakeLists.txt", "w", encoding="utf-8") as f: - f.write(""" + f.write( + """ build_lib( LIBNAME borked SOURCE_FILES ${PROJECT_SOURCE_DIR}/build-support/empty.cc LIBRARIES_TO_LINK ${libcore} %s ) - """ % invalid_or_nonexistent_library) + """ + % invalid_or_nonexistent_library + ) - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --enable-examples") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" --enable-examples') if invalid_or_nonexistent_library in ["", "gsd", "libfi", "calibre"]: self.assertEqual(return_code, 0) elif invalid_or_nonexistent_library in ["lib"]: @@ -1394,7 +1464,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase): elif invalid_or_nonexistent_library in ["gsd", "libfi", "calibre"]: self.assertEqual(return_code, 2) # should fail due to missing library if "lld" in stdout + stderr: - self.assertIn("unable to find library -l%s" % invalid_or_nonexistent_library, stderr) + self.assertIn( + "unable to find library -l%s" % invalid_or_nonexistent_library, stderr + ) elif "mold" in stdout + stderr: self.assertIn("library not found: %s" % invalid_or_nonexistent_library, stderr) else: @@ -1407,24 +1479,29 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # - invalid library names (should fail to configure) # - valid library names but nonexistent libraries (should not create a target) with open("contrib/borked/CMakeLists.txt", "w", encoding="utf-8") as f: - f.write(""" + f.write( + """ build_lib( LIBNAME borked SOURCE_FILES ${PROJECT_SOURCE_DIR}/build-support/empty.cc LIBRARIES_TO_LINK ${libcore} ) - """) + """ + ) for invalid_or_nonexistent_library in ["", "gsd", "lib", "libfi", "calibre"]: with open("contrib/borked/examples/CMakeLists.txt", "w", encoding="utf-8") as f: - f.write(""" + f.write( + """ build_lib_example( NAME borked-example SOURCE_FILES ${PROJECT_SOURCE_DIR}/build-support/empty-main.cc LIBRARIES_TO_LINK ${libborked} %s ) - """ % invalid_or_nonexistent_library) + """ + % invalid_or_nonexistent_library + ) - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\"") + return_code, stdout, stderr = run_ns3('configure -G "{generator}"') if invalid_or_nonexistent_library in ["", "gsd", "libfi", "calibre"]: self.assertEqual(return_code, 0) # should be able to configure elif invalid_or_nonexistent_library in ["lib"]: @@ -1461,15 +1538,17 @@ class NS3ConfigureTestCase(NS3BaseTestCase): with open("contrib/calibre/examples/CMakeLists.txt", "w", encoding="utf-8") as f: f.write("") with open("contrib/calibre/CMakeLists.txt", "w", encoding="utf-8") as f: - f.write(""" + f.write( + """ build_lib( LIBNAME calibre SOURCE_FILES ${PROJECT_SOURCE_DIR}/build-support/empty.cc LIBRARIES_TO_LINK ${libcore} ) - """) + """ + ) - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\"") + return_code, stdout, stderr = run_ns3('configure -G "{generator}"') # This only checks if configuration passes self.assertEqual(return_code, 0) @@ -1480,7 +1559,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # This checks not only if "lib" from "calibre" was incorrectly removed, # but also if the pkgconfig file was generated with the correct name self.assertNotIn("care", stdout) - self.assertTrue(os.path.exists(os.path.join(ns3_path, "cmake-cache", "pkgconfig", "ns3-calibre.pc"))) + self.assertTrue( + os.path.exists(os.path.join(ns3_path, "cmake-cache", "pkgconfig", "ns3-calibre.pc")) + ) # Check if we can build this library return_code, stdout, stderr = run_ns3("build calibre") @@ -1504,7 +1585,10 @@ class NS3ConfigureTestCase(NS3BaseTestCase): if win32: self.assertIn("--profiling-format=google-trace --profiling-output=", stdout) else: - self.assertIn("--profiling-format=google-trace --profiling-output=./cmake_performance_trace.log", stdout) + self.assertIn( + "--profiling-format=google-trace --profiling-output=./cmake_performance_trace.log", + stdout, + ) self.assertTrue(os.path.exists(cmake_performance_trace_log)) def test_18_CheckBuildVersionAndVersionCache(self): @@ -1538,17 +1622,18 @@ class NS3ConfigureTestCase(NS3BaseTestCase): self.assertFalse(os.path.exists(os.path.join(ns3_path, "cmake-cache", "build.ninja"))) # Second case: try with a version cache file but without Git (it should succeed) - version_cache_contents = ("CLOSEST_TAG = '\"ns-3.0.0\"'\n" - "VERSION_COMMIT_HASH = '\"0000000000\"'\n" - "VERSION_DIRTY_FLAG = '0'\n" - "VERSION_MAJOR = '3'\n" - "VERSION_MINOR = '0'\n" - "VERSION_PATCH = '0'\n" - "VERSION_RELEASE_CANDIDATE = '\"\"'\n" - "VERSION_TAG = '\"ns-3.0.0\"'\n" - "VERSION_TAG_DISTANCE = '0'\n" - "VERSION_BUILD_PROFILE = 'debug'\n" - ) + version_cache_contents = ( + "CLOSEST_TAG = '\"ns-3.0.0\"'\n" + "VERSION_COMMIT_HASH = '\"0000000000\"'\n" + "VERSION_DIRTY_FLAG = '0'\n" + "VERSION_MAJOR = '3'\n" + "VERSION_MINOR = '0'\n" + "VERSION_PATCH = '0'\n" + "VERSION_RELEASE_CANDIDATE = '\"\"'\n" + "VERSION_TAG = '\"ns-3.0.0\"'\n" + "VERSION_TAG_DISTANCE = '0'\n" + "VERSION_BUILD_PROFILE = 'debug'\n" + ) with open(version_cache_file, "w", encoding="utf-8") as version: version.write(version_cache_contents) @@ -1594,14 +1679,17 @@ class NS3ConfigureTestCase(NS3BaseTestCase): @return None """ # Try filtering enabled modules to core+network and their dependencies - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --enable-examples --enable-tests") + return_code, stdout, stderr = run_ns3( + 'configure -G "{generator}" --enable-examples --enable-tests' + ) self.config_ok(return_code, stdout, stderr) modules_before_filtering = get_enabled_modules() programs_before_filtering = get_programs_list() return_code, stdout, stderr = run_ns3( - "configure -G \"{generator}\" --filter-module-examples-and-tests='core;network'") + "configure -G \"{generator}\" --filter-module-examples-and-tests='core;network'" + ) self.config_ok(return_code, stdout, stderr) modules_after_filtering = get_enabled_modules() @@ -1614,7 +1702,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Try filtering in only core return_code, stdout, stderr = run_ns3( - "configure -G \"{generator}\" --filter-module-examples-and-tests='core'") + "configure -G \"{generator}\" --filter-module-examples-and-tests='core'" + ) self.config_ok(return_code, stdout, stderr) # At this point we should have the same number of modules @@ -1624,7 +1713,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Try cleaning the list of enabled modules to reset to the normal configuration. return_code, stdout, stderr = run_ns3( - "configure -G \"{generator}\" --disable-examples --disable-tests --filter-module-examples-and-tests=''") + "configure -G \"{generator}\" --disable-examples --disable-tests --filter-module-examples-and-tests=''" + ) self.config_ok(return_code, stdout, stderr) # At this point we should have the same amount of modules that we had when we started. @@ -1648,7 +1738,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Check if configuration properly detected lld self.assertTrue(os.path.exists(os.path.join(ns3_path, "cmake-cache", "build.ninja"))) - with open(os.path.join(ns3_path, "cmake-cache", "build.ninja"), "r", encoding="utf-8") as f: + with open( + os.path.join(ns3_path, "cmake-cache", "build.ninja"), "r", encoding="utf-8" + ) as f: self.assertIn("-fuse-ld=lld", f.read()) # Try to build using the lld linker @@ -1660,8 +1752,11 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Now add mold to the PATH if not os.path.exists("./mold-1.4.2-x86_64-linux.tar.gz"): container.execute( - "wget https://github.com/rui314/mold/releases/download/v1.4.2/mold-1.4.2-x86_64-linux.tar.gz") - container.execute("tar xzfC mold-1.4.2-x86_64-linux.tar.gz /usr/local --strip-components=1") + "wget https://github.com/rui314/mold/releases/download/v1.4.2/mold-1.4.2-x86_64-linux.tar.gz" + ) + container.execute( + "tar xzfC mold-1.4.2-x86_64-linux.tar.gz /usr/local --strip-components=1" + ) # Configure should detect and use mold run_ns3("clean") @@ -1669,7 +1764,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Check if configuration properly detected mold self.assertTrue(os.path.exists(os.path.join(ns3_path, "cmake-cache", "build.ninja"))) - with open(os.path.join(ns3_path, "cmake-cache", "build.ninja"), "r", encoding="utf-8") as f: + with open( + os.path.join(ns3_path, "cmake-cache", "build.ninja"), "r", encoding="utf-8" + ) as f: self.assertIn("-fuse-ld=mold", f.read()) # Try to build using the lld linker @@ -1686,7 +1783,9 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Check if configuration properly disabled lld/mold usage self.assertTrue(os.path.exists(os.path.join(ns3_path, "cmake-cache", "build.ninja"))) - with open(os.path.join(ns3_path, "cmake-cache", "build.ninja"), "r", encoding="utf-8") as f: + with open( + os.path.join(ns3_path, "cmake-cache", "build.ninja"), "r", encoding="utf-8" + ) as f: self.assertNotIn("-fuse-ld=mold", f.read()) def test_21_ClangTimeTrace(self): @@ -1704,7 +1803,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Enable ClangTimeTrace without git (it should fail) try: container.execute( - "./ns3 configure -G Ninja --enable-modules=core --enable-examples --enable-tests -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 -DNS3_CLANG_TIMETRACE=ON") + "./ns3 configure -G Ninja --enable-modules=core --enable-examples --enable-tests -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 -DNS3_CLANG_TIMETRACE=ON" + ) except DockerException as e: self.assertIn("could not find git for clone of ClangBuildAnalyzer", e.stderr) @@ -1713,7 +1813,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Enable ClangTimeTrace without git (it should succeed) try: container.execute( - "./ns3 configure -G Ninja --enable-modules=core --enable-examples --enable-tests -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 -DNS3_CLANG_TIMETRACE=ON") + "./ns3 configure -G Ninja --enable-modules=core --enable-examples --enable-tests -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 -DNS3_CLANG_TIMETRACE=ON" + ) except DockerException as e: self.assertIn("could not find git for clone of ClangBuildAnalyzer", e.stderr) @@ -1738,8 +1839,11 @@ class NS3ConfigureTestCase(NS3BaseTestCase): try: container.execute( - "./ns3 configure -G Ninja --enable-modules=core --enable-examples --enable-tests -- -DNS3_CLANG_TIMETRACE=ON") - self.assertTrue(False, "ClangTimeTrace requires Clang, but GCC just passed the checks too") + "./ns3 configure -G Ninja --enable-modules=core --enable-examples --enable-tests -- -DNS3_CLANG_TIMETRACE=ON" + ) + self.assertTrue( + False, "ClangTimeTrace requires Clang, but GCC just passed the checks too" + ) except DockerException as e: self.assertIn("TimeTrace is a Clang feature", e.stderr) @@ -1759,7 +1863,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Enable Ninja tracing without using the Ninja generator try: container.execute( - "./ns3 configure --enable-modules=core --enable-ninja-tracing -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10") + "./ns3 configure --enable-modules=core --enable-ninja-tracing -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10" + ) except DockerException as e: self.assertIn("Ninjatracing requires the Ninja generator", e.stderr) @@ -1770,7 +1875,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Enable Ninjatracing support without git (should fail) try: container.execute( - "./ns3 configure -G Ninja --enable-modules=core --enable-ninja-tracing -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10") + "./ns3 configure -G Ninja --enable-modules=core --enable-ninja-tracing -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10" + ) except DockerException as e: self.assertIn("could not find git for clone of NinjaTracing", e.stderr) @@ -1778,7 +1884,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Enable Ninjatracing support with git (it should succeed) try: container.execute( - "./ns3 configure -G Ninja --enable-modules=core --enable-ninja-tracing -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10") + "./ns3 configure -G Ninja --enable-modules=core --enable-ninja-tracing -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10" + ) except DockerException as e: self.assertTrue(False, "Failed to configure with Ninjatracing") @@ -1806,7 +1913,8 @@ class NS3ConfigureTestCase(NS3BaseTestCase): # Enable Clang TimeTrace feature for more detailed traces try: container.execute( - "./ns3 configure -G Ninja --enable-modules=core --enable-ninja-tracing -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 -DNS3_CLANG_TIMETRACE=ON") + "./ns3 configure -G Ninja --enable-modules=core --enable-ninja-tracing -- -DCMAKE_CXX_COMPILER=/usr/bin/clang++-10 -DNS3_CLANG_TIMETRACE=ON" + ) except DockerException as e: self.assertTrue(False, "Failed to configure Ninjatracing with Clang's TimeTrace") @@ -1862,13 +1970,13 @@ class NS3ConfigureTestCase(NS3BaseTestCase): Check for regressions in test object build. @return None """ - return_code, stdout, stderr = run_ns3('configure') + return_code, stdout, stderr = run_ns3("configure") self.assertEqual(return_code, 0) test_module_cache = os.path.join(ns3_path, "cmake-cache", "src", "test") self.assertFalse(os.path.exists(test_module_cache)) - return_code, stdout, stderr = run_ns3('configure --enable-tests') + return_code, stdout, stderr = run_ns3("configure --enable-tests") self.assertEqual(return_code, 0) self.assertTrue(os.path.exists(test_module_cache)) @@ -1982,7 +2090,7 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): f.write("3-00\n") # Reconfigure. - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\"") + return_code, stdout, stderr = run_ns3('configure -G "{generator}"') self.config_ok(return_code, stdout, stderr) # Build. @@ -2040,9 +2148,13 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): absolute_path = os.sep.join([ns3_path, "build", "release"]) relative_path = os.sep.join(["build", "release"]) for different_out_dir in [absolute_path, relative_path]: - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --out=%s" % different_out_dir) + return_code, stdout, stderr = run_ns3( + 'configure -G "{generator}" --out=%s' % different_out_dir + ) self.config_ok(return_code, stdout, stderr) - self.assertIn("Build directory : %s" % absolute_path.replace(os.sep, '/'), stdout) + self.assertIn( + "Build directory : %s" % absolute_path.replace(os.sep, "/"), stdout + ) # Build run_ns3("build") @@ -2066,7 +2178,9 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): # Restore original output directory. return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --out=''") self.config_ok(return_code, stdout, stderr) - self.assertIn("Build directory : %s" % usual_outdir.replace(os.sep, '/'), stdout) + self.assertIn( + "Build directory : %s" % usual_outdir.replace(os.sep, "/"), stdout + ) # Try re-building. run_ns3("build") @@ -2102,7 +2216,9 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): # Reconfigure setting the installation folder to ns-3-dev/build/install. install_prefix = os.sep.join([ns3_path, "build", "install"]) - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --prefix=%s" % install_prefix) + return_code, stdout, stderr = run_ns3( + 'configure -G "{generator}" --prefix=%s' % install_prefix + ) self.config_ok(return_code, stdout, stderr) # Build. @@ -2126,15 +2242,17 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): # Make sure all headers were installed. installed_headers = get_headers_list(install_prefix) - missing_headers = list(set([os.path.basename(x) for x in headers]) - - (set([os.path.basename(x) for x in installed_headers])) - ) + missing_headers = list( + set([os.path.basename(x) for x in headers]) + - (set([os.path.basename(x) for x in installed_headers])) + ) self.assertEqual(len(missing_headers), 0) # Now create a test CMake project and try to find_package ns-3. test_main_file = os.sep.join([install_prefix, "main.cpp"]) with open(test_main_file, "w", encoding="utf-8") as f: - f.write(""" + f.write( + """ #include using namespace ns3; int main () @@ -2144,7 +2262,8 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): Simulator::Destroy (); return 0; } - """) + """ + ) # We try to use this library without specifying a version, # specifying ns3-01 (text version with 'dev' is not supported) @@ -2157,7 +2276,9 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): list(APPEND CMAKE_PREFIX_PATH ./{lib}/cmake/ns3) find_package(ns3 {version} COMPONENTS libcore) target_link_libraries(test PRIVATE ns3::libcore) - """.format(lib=("lib64" if lib64 else "lib"), version=version) + """.format( + lib=("lib64" if lib64 else "lib"), version=version + ) ns3_import_methods.append(cmake_find_package_import) # Import ns-3 as pkg-config libraries @@ -2166,21 +2287,24 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): include(FindPkgConfig) pkg_check_modules(ns3 REQUIRED IMPORTED_TARGET ns3-core{version}) target_link_libraries(test PUBLIC PkgConfig::ns3) - """.format(lib=("lib64" if lib64 else "lib"), - version="=" + version if version else "" - ) + """.format( + lib=("lib64" if lib64 else "lib"), version="=" + version if version else "" + ) if shutil.which("pkg-config"): ns3_import_methods.append(pkgconfig_import) # Test the multiple ways of importing ns-3 libraries for import_method in ns3_import_methods: - test_cmake_project = """ + test_cmake_project = ( + """ cmake_minimum_required(VERSION 3.12..3.12) project(ns3_consumer CXX) set(CMAKE_CXX_STANDARD 20) set(CMAKE_CXX_STANDARD_REQUIRED ON) add_executable(test main.cpp) - """ + import_method + """ + + import_method + ) test_cmake_project_file = os.sep.join([install_prefix, "CMakeLists.txt"]) with open(test_cmake_project_file, "w", encoding="utf-8") as f: @@ -2190,18 +2314,21 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): cmake = shutil.which("cmake") return_code, stdout, stderr = run_program( cmake, - "-DCMAKE_BUILD_TYPE=debug -G\"{generator}\" .".format(generator=platform_makefiles), - cwd=install_prefix + '-DCMAKE_BUILD_TYPE=debug -G"{generator}" .'.format( + generator=platform_makefiles + ), + cwd=install_prefix, ) if version == "3.00": self.assertEqual(return_code, 1) if import_method == cmake_find_package_import: - self.assertIn('Could not find a configuration file for package "ns3" that is compatible', - stderr.replace("\n", "")) + self.assertIn( + 'Could not find a configuration file for package "ns3" that is compatible', + stderr.replace("\n", ""), + ) elif import_method == pkgconfig_import: - self.assertIn('A required package was not found', - stderr.replace("\n", "")) + self.assertIn("A required package was not found", stderr.replace("\n", "")) else: raise Exception("Unknown import type") else: @@ -2222,11 +2349,17 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): if win32: test_program = os.path.join(install_prefix, "test.exe") env_sep = ";" if ";" in os.environ["PATH"] else ":" - env = {"PATH": env_sep.join([os.environ["PATH"], os.path.join(install_prefix, "lib")])} + env = { + "PATH": env_sep.join( + [os.environ["PATH"], os.path.join(install_prefix, "lib")] + ) + } else: test_program = "./test" env = None - return_code, stdout, stderr = run_program(test_program, "", cwd=install_prefix, env=env) + return_code, stdout, stderr = run_program( + test_program, "", cwd=install_prefix, env=env + ) self.assertEqual(return_code, 0) # Uninstall @@ -2244,14 +2377,15 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): @return None """ # Build. - targets = {"scratch/scratch-simulator": "scratch-simulator", - "scratch/scratch-simulator.cc": "scratch-simulator", - "scratch-simulator": "scratch-simulator", - "scratch/subdir/scratch-subdir": "subdir_scratch-subdir", - "subdir/scratch-subdir": "subdir_scratch-subdir", - "scratch-subdir": "subdir_scratch-subdir", - } - for (target_to_run, target_cmake) in targets.items(): + targets = { + "scratch/scratch-simulator": "scratch-simulator", + "scratch/scratch-simulator.cc": "scratch-simulator", + "scratch-simulator": "scratch-simulator", + "scratch/subdir/scratch-subdir": "subdir_scratch-subdir", + "subdir/scratch-subdir": "subdir_scratch-subdir", + "scratch-subdir": "subdir_scratch-subdir", + } + for target_to_run, target_cmake in targets.items(): # Test if build is working. build_line = "target scratch_%s" % target_cmake return_code, stdout, stderr = run_ns3("build %s" % target_to_run) @@ -2272,14 +2406,14 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): """ # First enable examples - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --enable-examples") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" --enable-examples') self.assertEqual(return_code, 0) # Copy second.cc from the tutorial examples to the scratch folder shutil.copy("./examples/tutorial/second.cc", "./scratch/second.cc") # Reconfigure to re-scan the scratches - return_code, stdout, stderr = run_ns3("configure -G \"{generator}\" --enable-examples") + return_code, stdout, stderr = run_ns3('configure -G "{generator}" --enable-examples') self.assertEqual(return_code, 0) # Try to run second and collide @@ -2287,7 +2421,7 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): self.assertEqual(return_code, 1) self.assertIn( 'Build target "second" is ambiguous. Try one of these: "scratch/second", "examples/tutorial/second"', - stdout.replace(os.sep, '/') + stdout.replace(os.sep, "/"), ) # Try to run scratch/second and succeed @@ -2305,7 +2439,7 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): self.assertEqual(return_code, 1) self.assertIn( 'Run target "second" is ambiguous. Try one of these: "scratch/second", "examples/tutorial/second"', - stdout.replace(os.sep, '/') + stdout.replace(os.sep, "/"), ) # Try to run scratch/second and succeed @@ -2327,7 +2461,8 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): # First enable examples and static build return_code, stdout, stderr = run_ns3( - "configure -G \"{generator}\" --enable-examples --disable-gtk --enable-static") + 'configure -G "{generator}" --enable-examples --disable-gtk --enable-static' + ) if win32: # Configuration should fail explaining Windows @@ -2339,7 +2474,7 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): self.assertEqual(return_code, 0) # Then try to build one example - return_code, stdout, stderr = run_ns3('build sample-simulator') + return_code, stdout, stderr = run_ns3("build sample-simulator") self.assertEqual(return_code, 0) self.assertIn("Built target", stdout) @@ -2357,7 +2492,8 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): # First enable examples and static build return_code, stdout, stderr = run_ns3( - "configure -G \"{generator}\" --enable-examples --enable-python-bindings") + 'configure -G "{generator}" --enable-examples --enable-python-bindings' + ) # If configuration passes, we are half way done self.assertEqual(return_code, 0) @@ -2371,7 +2507,9 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): self.assertEqual(return_code, 0) # Then try to run a specific test with the full relative path - return_code, stdout, stderr = run_program("test.py", "-p ./examples/wireless/mixed-wired-wireless", python=True) + return_code, stdout, stderr = run_program( + "test.py", "-p ./examples/wireless/mixed-wired-wireless", python=True + ) self.assertEqual(return_code, 0) def test_13_FetchOptionalComponents(self): @@ -2409,10 +2547,14 @@ class NS3BuildBaseTestCase(NS3BaseTestCase): shutil.rmtree(destination_src) # Always use a fresh copy - shutil.copytree(os.path.join(ns3_path, "build-support/test-files/test-contrib-dependency"), - destination_contrib) - shutil.copytree(os.path.join(ns3_path, "build-support/test-files/test-src-dependent-on-contrib"), - destination_src) + shutil.copytree( + os.path.join(ns3_path, "build-support/test-files/test-contrib-dependency"), + destination_contrib, + ) + shutil.copytree( + os.path.join(ns3_path, "build-support/test-files/test-src-dependent-on-contrib"), + destination_src, + ) # Then configure return_code, stdout, stderr = run_ns3("configure --enable-examples") @@ -2443,7 +2585,8 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): # On top of the release build configured by NS3ConfigureTestCase, also enable examples, tests and docs. return_code, stdout, stderr = run_ns3( - "configure -d release -G \"{generator}\" --enable-examples --enable-tests") + 'configure -d release -G "{generator}" --enable-examples --enable-tests' + ) self.config_ok(return_code, stdout, stderr) # Check if .lock-ns3 exists, then read to get list of executables. @@ -2506,7 +2649,7 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): Try to run test-runner without building @return None """ - return_code, stdout, stderr = run_ns3('build test-runner') + return_code, stdout, stderr = run_ns3("build test-runner") self.assertEqual(return_code, 0) return_code, stdout, stderr = run_ns3('run "test-runner --list" --no-build --verbose') @@ -2543,7 +2686,9 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): return_code, stdout, stderr = run_ns3("build scratch-simulator") self.assertEqual(return_code, 0) - return_code, stdout, stderr = run_ns3("run scratch-simulator --gdb --verbose --no-build", env={"gdb_eval": "1"}) + return_code, stdout, stderr = run_ns3( + "run scratch-simulator --gdb --verbose --no-build", env={"gdb_eval": "1"} + ) self.assertEqual(return_code, 0) self.assertIn("scratch-simulator", stdout) if win32: @@ -2562,7 +2707,9 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): return_code, stdout, stderr = run_ns3("build scratch-simulator") self.assertEqual(return_code, 0) - return_code, stdout, stderr = run_ns3("run scratch-simulator --valgrind --verbose --no-build") + return_code, stdout, stderr = run_ns3( + "run scratch-simulator --valgrind --verbose --no-build" + ) self.assertEqual(return_code, 0) self.assertIn("scratch-simulator", stderr) self.assertIn("Memcheck", stderr) @@ -2699,39 +2846,43 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): self.assertFalse(enable_sudo is True) # First we run to ensure the program was built - return_code, stdout, stderr = run_ns3('run scratch-simulator') + return_code, stdout, stderr = run_ns3("run scratch-simulator") self.assertEqual(return_code, 0) self.assertIn("Built target scratch_scratch-simulator", stdout) self.assertIn(cmake_build_target_command(target="scratch_scratch-simulator"), stdout) - scratch_simulator_path = list(filter(lambda x: x if "scratch-simulator" in x else None, - self.ns3_executables - ) - )[-1] + scratch_simulator_path = list( + filter(lambda x: x if "scratch-simulator" in x else None, self.ns3_executables) + )[-1] prev_fstat = os.stat(scratch_simulator_path) # we get the permissions before enabling sudo # Now try setting the sudo bits from the run subparser - return_code, stdout, stderr = run_ns3('run scratch-simulator --enable-sudo', - env={"SUDO_PASSWORD": sudo_password}) + return_code, stdout, stderr = run_ns3( + "run scratch-simulator --enable-sudo", env={"SUDO_PASSWORD": sudo_password} + ) self.assertEqual(return_code, 0) self.assertIn("Built target scratch_scratch-simulator", stdout) self.assertIn(cmake_build_target_command(target="scratch_scratch-simulator"), stdout) fstat = os.stat(scratch_simulator_path) import stat + # If we are on Windows, these permissions mean absolutely nothing, # and on Fuse builds they might not make any sense, so we need to skip before failing - likely_fuse_mount = ((prev_fstat.st_mode & stat.S_ISUID) == (fstat.st_mode & stat.S_ISUID)) and \ - prev_fstat.st_uid == 0 # noqa + likely_fuse_mount = ( + (prev_fstat.st_mode & stat.S_ISUID) == (fstat.st_mode & stat.S_ISUID) + ) and prev_fstat.st_uid == 0 # noqa if win32 or likely_fuse_mount: self.skipTest("Windows or likely a FUSE mount") # If this is a valid platform, we can continue self.assertEqual(fstat.st_uid, 0) # check the file was correctly chown'ed by root - self.assertEqual(fstat.st_mode & stat.S_ISUID, stat.S_ISUID) # check if normal users can run as sudo + self.assertEqual( + fstat.st_mode & stat.S_ISUID, stat.S_ISUID + ) # check if normal users can run as sudo # Now try setting the sudo bits as a post-build step (as set by configure subparser) - return_code, stdout, stderr = run_ns3('configure --enable-sudo') + return_code, stdout, stderr = run_ns3("configure --enable-sudo") self.assertEqual(return_code, 0) # Check if it was properly set in the lock file @@ -2744,7 +2895,7 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): os.remove(executable) # Try to build and then set sudo bits as a post-build step - return_code, stdout, stderr = run_ns3('build', env={"SUDO_PASSWORD": sudo_password}) + return_code, stdout, stderr = run_ns3("build", env={"SUDO_PASSWORD": sudo_password}) self.assertEqual(return_code, 0) # Check if commands are being printed for every target @@ -2756,7 +2907,9 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): # Check scratch simulator yet again fstat = os.stat(scratch_simulator_path) self.assertEqual(fstat.st_uid, 0) # check the file was correctly chown'ed by root - self.assertEqual(fstat.st_mode & stat.S_ISUID, stat.S_ISUID) # check if normal users can run as sudo + self.assertEqual( + fstat.st_mode & stat.S_ISUID, stat.S_ISUID + ) # check if normal users can run as sudo def test_15_CommandTemplate(self): """! @@ -2765,7 +2918,7 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): """ # Command templates that are empty or do not have a '%s' should fail - return_code0, stdout0, stderr0 = run_ns3('run sample-simulator --command-template') + return_code0, stdout0, stderr0 = run_ns3("run sample-simulator --command-template") self.assertEqual(return_code0, 2) self.assertIn("argument --command-template: expected one argument", stderr0) @@ -2777,8 +2930,12 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): self.assertIn("not all arguments converted during string formatting", stderr) # Command templates with %s should at least continue and try to run the target - return_code4, stdout4, _ = run_ns3('run sample-simulator --command-template "%s --PrintVersion" --verbose') - return_code5, stdout5, _ = run_ns3('run sample-simulator --command-template="%s --PrintVersion" --verbose') + return_code4, stdout4, _ = run_ns3( + 'run sample-simulator --command-template "%s --PrintVersion" --verbose' + ) + return_code5, stdout5, _ = run_ns3( + 'run sample-simulator --command-template="%s --PrintVersion" --verbose' + ) self.assertEqual((return_code4, return_code5), (0, 0)) self.assertIn("sample-simulator{ext} --PrintVersion".format(ext=ext), stdout4) @@ -2793,8 +2950,10 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): # Test if all argument passing flavors are working return_code0, stdout0, stderr0 = run_ns3('run "sample-simulator --help" --verbose') - return_code1, stdout1, stderr1 = run_ns3('run sample-simulator --command-template="%s --help" --verbose') - return_code2, stdout2, stderr2 = run_ns3('run sample-simulator --verbose -- --help') + return_code1, stdout1, stderr1 = run_ns3( + 'run sample-simulator --command-template="%s --help" --verbose' + ) + return_code2, stdout2, stderr2 = run_ns3("run sample-simulator --verbose -- --help") self.assertEqual((return_code0, return_code1, return_code2), (0, 0, 0)) self.assertIn("sample-simulator{ext} --help".format(ext=ext), stdout0) @@ -2803,8 +2962,10 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): # Test if the same thing happens with an additional run argument (e.g. --no-build) return_code0, stdout0, stderr0 = run_ns3('run "sample-simulator --help" --no-build') - return_code1, stdout1, stderr1 = run_ns3('run sample-simulator --command-template="%s --help" --no-build') - return_code2, stdout2, stderr2 = run_ns3('run sample-simulator --no-build -- --help') + return_code1, stdout1, stderr1 = run_ns3( + 'run sample-simulator --command-template="%s --help" --no-build' + ) + return_code2, stdout2, stderr2 = run_ns3("run sample-simulator --no-build -- --help") self.assertEqual((return_code0, return_code1, return_code2), (0, 0, 0)) self.assertEqual(stdout0, stdout1) self.assertEqual(stdout1, stdout2) @@ -2829,11 +2990,14 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): # The order of the arguments is command template, # arguments passed with the target itself # and forwarded arguments after the -- separator - self.assertIn("sample-simulator{ext} --PrintGroups --PrintGlobals --PrintTypeIds".format(ext=ext), stdout) + self.assertIn( + "sample-simulator{ext} --PrintGroups --PrintGlobals --PrintTypeIds".format(ext=ext), + stdout, + ) # Check if it complains about the missing -- separator cmd0 = 'run sample-simulator --command-template="%s " --PrintTypeIds' - cmd1 = 'run sample-simulator --PrintTypeIds' + cmd1 = "run sample-simulator --PrintTypeIds" return_code0, stdout0, stderr0 = run_ns3(cmd0) return_code1, stdout1, stderr1 = run_ns3(cmd1) @@ -2877,8 +3041,10 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): shutil.rmtree(destination_src) # Always use a fresh copy - shutil.copytree(os.path.join(ns3_path, "build-support/test-files/test-package-managers"), - destination_src) + shutil.copytree( + os.path.join(ns3_path, "build-support/test-files/test-package-managers"), + destination_src, + ) with DockerContainerManager(self, "ubuntu:22.04") as container: # Install toolchain @@ -2888,8 +3054,7 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): # Verify that Armadillo is not available and that we did not # add any new unnecessary dependency when features are not used try: - container.execute( - "./ns3 configure -- -DTEST_PACKAGE_MANAGER:STRING=ON") + container.execute("./ns3 configure -- -DTEST_PACKAGE_MANAGER:STRING=ON") self.skipTest("Armadillo is already installed") except DockerException as e: pass @@ -2904,14 +3069,14 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): # Install Armadillo with CPM try: container.execute( - "./ns3 configure -- -DNS3_CPM=ON -DTEST_PACKAGE_MANAGER:STRING=CPM") + "./ns3 configure -- -DNS3_CPM=ON -DTEST_PACKAGE_MANAGER:STRING=CPM" + ) except DockerException as e: self.fail() # Try to build module using CPM's Armadillo try: - container.execute( - "./ns3 build test-package-managers") + container.execute("./ns3 build test-package-managers") except DockerException as e: self.fail() @@ -2927,8 +3092,7 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): # Install VcPkg try: - container.execute( - "./ns3 configure -- -DNS3_VCPKG=ON") + container.execute("./ns3 configure -- -DNS3_VCPKG=ON") except DockerException as e: self.fail() @@ -2940,8 +3104,7 @@ class NS3ExpectedUseTestCase(NS3BaseTestCase): # Try to build module using VcPkg's Armadillo try: - container.execute( - "./ns3 build test-package-managers") + container.execute("./ns3 build test-package-managers") except DockerException as e: self.fail() @@ -2973,40 +3136,42 @@ class NS3QualityControlTestCase(unittest.TestCase): try: import requests import urllib3 + urllib3.disable_warnings() except ImportError: requests = None # noqa self.skipTest("Requests library is not available") - regex = re.compile(r'((http|https)://[^\ \n\)\"\'\}\>\<\]\;\`\\]*)') # noqa + regex = re.compile(r"((http|https)://[^\ \n\)\"\'\}\>\<\]\;\`\\]*)") # noqa skipped_files = [] - whitelisted_urls = {"https://gitlab.com/your-user-name/ns-3-dev", - "https://www.nsnam.org/release/ns-allinone-3.31.rc1.tar.bz2", - "https://www.nsnam.org/release/ns-allinone-3.X.rcX.tar.bz2", - "https://www.nsnam.org/releases/ns-3-x", - "https://www.nsnam.org/releases/ns-allinone-3.(x-1", - "https://www.nsnam.org/releases/ns-allinone-3.x.tar.bz2", - "https://ns-buildmaster.ee.washington.edu:8010/", - # split due to command-line formatting - "https://cmake.org/cmake/help/latest/manual/cmake-", - "http://www.ieeeghn.org/wiki/index.php/First-Hand:Digital_Television:_The_", - # Dia placeholder xmlns address - "http://www.lysator.liu.se/~alla/dia/", - # Fails due to bad regex - "http://www.ieeeghn.org/wiki/index.php/First-Hand:Digital_Television:_The_Digital_Terrestrial_Television_Broadcasting_(DTTB", - "http://en.wikipedia.org/wiki/Namespace_(computer_science", - "http://en.wikipedia.org/wiki/Bonobo_(component_model", - "http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85", - # historical links - "http://www.research.att.com/info/kpv/", - "http://www.research.att.com/~gsf/", - "http://nsnam.isi.edu/nsnam/index.php/Contributed_Code", - "http://scan5.coverity.com/cgi-bin/upload.py", - # terminal output - "https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.tar.gz-", - "http://mirrors.kernel.org/fedora/releases/11/Everything/i386/os/Packages/", - } + whitelisted_urls = { + "https://gitlab.com/your-user-name/ns-3-dev", + "https://www.nsnam.org/release/ns-allinone-3.31.rc1.tar.bz2", + "https://www.nsnam.org/release/ns-allinone-3.X.rcX.tar.bz2", + "https://www.nsnam.org/releases/ns-3-x", + "https://www.nsnam.org/releases/ns-allinone-3.(x-1", + "https://www.nsnam.org/releases/ns-allinone-3.x.tar.bz2", + "https://ns-buildmaster.ee.washington.edu:8010/", + # split due to command-line formatting + "https://cmake.org/cmake/help/latest/manual/cmake-", + "http://www.ieeeghn.org/wiki/index.php/First-Hand:Digital_Television:_The_", + # Dia placeholder xmlns address + "http://www.lysator.liu.se/~alla/dia/", + # Fails due to bad regex + "http://www.ieeeghn.org/wiki/index.php/First-Hand:Digital_Television:_The_Digital_Terrestrial_Television_Broadcasting_(DTTB", + "http://en.wikipedia.org/wiki/Namespace_(computer_science", + "http://en.wikipedia.org/wiki/Bonobo_(component_model", + "http://msdn.microsoft.com/en-us/library/aa365247(v=vs.85", + # historical links + "http://www.research.att.com/info/kpv/", + "http://www.research.att.com/~gsf/", + "http://nsnam.isi.edu/nsnam/index.php/Contributed_Code", + "http://scan5.coverity.com/cgi-bin/upload.py", + # terminal output + "https://github.com/Kitware/CMake/releases/download/v3.27.1/cmake-3.27.1-linux-x86_64.tar.gz-", + "http://mirrors.kernel.org/fedora/releases/11/Everything/i386/os/Packages/", + } # Scan for all URLs in all files we can parse files_and_urls = set() @@ -3014,7 +3179,7 @@ class NS3QualityControlTestCase(unittest.TestCase): for topdir in ["bindings", "doc", "examples", "src", "utils"]: for root, dirs, files in os.walk(topdir): # do not parse files in build directories - if "build" in root or "_static" in root or "source-temp" in root or 'html' in root: + if "build" in root or "_static" in root or "source-temp" in root or "html" in root: continue for file in files: filepath = os.path.join(root, file) @@ -3034,7 +3199,9 @@ class NS3QualityControlTestCase(unittest.TestCase): # Get first group for each match (containing the URL) # and strip final punctuation or commas in matched links # commonly found in the docs - urls = list(map(lambda x: x[0][:-1] if x[0][-1] in ".," else x[0], matches)) + urls = list( + map(lambda x: x[0][:-1] if x[0][-1] in ".," else x[0], matches) + ) except UnicodeDecodeError: skipped_files.append(filepath) continue @@ -3045,13 +3212,14 @@ class NS3QualityControlTestCase(unittest.TestCase): files_and_urls.add((filepath, url)) # Instantiate the Django URL validator - from django.core.validators import URLValidator # noqa from django.core.exceptions import ValidationError # noqa + from django.core.validators import URLValidator # noqa + validate_url = URLValidator() # User agent string to make ACM and Elsevier let us check if links to papers are working headers = { - 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36' + "User-Agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_5) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/50.0.2661.102 Safari/537.36" # noqa } @@ -3086,17 +3254,22 @@ class NS3QualityControlTestCase(unittest.TestCase): # People use the wrong code, but the reason # can still be correct if response.status_code in [302, 308, 500, 503]: - if response.reason.lower() in ['found', - 'moved temporarily', - 'permanent redirect', - 'ok', - 'service temporarily unavailable' - ]: + if response.reason.lower() in [ + "found", + "moved temporarily", + "permanent redirect", + "ok", + "service temporarily unavailable", + ]: dead_link_msg = None break # In case it didn't pass in any of the previous tests, # set dead_link_msg with the most recent error and try again - dead_link_msg = "%s: URL %s: returned code %d" % (test_filepath, test_url, response.status_code) + dead_link_msg = "%s: URL %s: returned code %d" % ( + test_filepath, + test_url, + response.status_code, + ) except requests.exceptions.InvalidURL: dead_link_msg = "%s: URL %s: invalid URL" % (test_filepath, test_url) except requests.exceptions.SSLError: @@ -3108,12 +3281,17 @@ class NS3QualityControlTestCase(unittest.TestCase): error_msg = e.args[0].reason.__str__() except AttributeError: error_msg = e.args[0] - dead_link_msg = "%s: URL %s: failed with exception: %s" % (test_filepath, test_url, error_msg) + dead_link_msg = "%s: URL %s: failed with exception: %s" % ( + test_filepath, + test_url, + error_msg, + ) tries -= 1 return dead_link_msg # Dispatch threads to test multiple URLs concurrently from concurrent.futures import ThreadPoolExecutor + with ThreadPoolExecutor(max_workers=100) as executor: dead_links = list(executor.map(test_file_url, list(files_and_urls))) @@ -3127,7 +3305,8 @@ class NS3QualityControlTestCase(unittest.TestCase): @return None """ return_code, stdout, stderr = run_ns3( - "configure --enable-tests --enable-examples --enable-sanitizers -d optimized") + "configure --enable-tests --enable-examples --enable-sanitizers -d optimized" + ) self.assertEqual(return_code, 0) test_return_code, stdout, stderr = run_program("test.py", "", python=True) @@ -3152,18 +3331,22 @@ class NS3QualityControlTestCase(unittest.TestCase): images += list(Path("./doc").glob("**/figures/**/*.{ext}".format(ext=extension))) # Get the brightness of an image on a scale of 0-100% - imagemagick_get_image_brightness = \ - 'convert {image} -colorspace HSI -channel b -separate +channel -scale 1x1 -format "%[fx:100*u]" info:' + imagemagick_get_image_brightness = 'convert {image} -colorspace HSI -channel b -separate +channel -scale 1x1 -format "%[fx:100*u]" info:' # We could invert colors of target image to increase its brightness # convert source.png -channel RGB -negate target.png brightness_threshold = 50 for image in images: - brightness = subprocess.check_output(imagemagick_get_image_brightness.format(image=image).split()) + brightness = subprocess.check_output( + imagemagick_get_image_brightness.format(image=image).split() + ) brightness = float(brightness.decode().strip("'\"")) - self.assertGreater(brightness, brightness_threshold, - "Image darker than threshold (%d < %d): %s" % (brightness, brightness_threshold, image) - ) + self.assertGreater( + brightness, + brightness_threshold, + "Image darker than threshold (%d < %d): %s" + % (brightness, brightness_threshold, image), + ) def main(): @@ -3173,45 +3356,41 @@ def main(): """ test_completeness = { - "style": [NS3UnusedSourcesTestCase, - NS3StyleTestCase, - ], - "build": [NS3CommonSettingsTestCase, - NS3ConfigureBuildProfileTestCase, - NS3ConfigureTestCase, - NS3BuildBaseTestCase, - NS3ExpectedUseTestCase, - ], - "complete": [NS3UnusedSourcesTestCase, - NS3StyleTestCase, - NS3CommonSettingsTestCase, - NS3ConfigureBuildProfileTestCase, - NS3ConfigureTestCase, - NS3BuildBaseTestCase, - NS3ExpectedUseTestCase, - NS3QualityControlTestCase, - ], - "extras": [NS3DependenciesTestCase, - ] + "style": [ + NS3UnusedSourcesTestCase, + NS3StyleTestCase, + ], + "build": [ + NS3CommonSettingsTestCase, + NS3ConfigureBuildProfileTestCase, + NS3ConfigureTestCase, + NS3BuildBaseTestCase, + NS3ExpectedUseTestCase, + ], + "complete": [ + NS3UnusedSourcesTestCase, + NS3StyleTestCase, + NS3CommonSettingsTestCase, + NS3ConfigureBuildProfileTestCase, + NS3ConfigureTestCase, + NS3BuildBaseTestCase, + NS3ExpectedUseTestCase, + NS3QualityControlTestCase, + ], + "extras": [ + NS3DependenciesTestCase, + ], } import argparse parser = argparse.ArgumentParser("Test suite for the ns-3 buildsystem") - parser.add_argument("-c", "--completeness", - choices=test_completeness.keys(), - default="complete") - parser.add_argument("-tn", "--test-name", - action="store", - default=None, - type=str) - parser.add_argument("-rtn", "--resume-from-test-name", - action="store", - default=None, - type=str) - parser.add_argument("-q", "--quiet", - action="store_true", - default=False) + parser.add_argument( + "-c", "--completeness", choices=test_completeness.keys(), default="complete" + ) + parser.add_argument("-tn", "--test-name", action="store", default=None, type=str) + parser.add_argument("-rtn", "--resume-from-test-name", action="store", default=None, type=str) + parser.add_argument("-q", "--quiet", action="store_true", default=False) args = parser.parse_args(sys.argv[1:]) loader = unittest.TestLoader() @@ -3255,5 +3434,5 @@ def main(): shutil.move(ns3rc_script_bak, ns3rc_script) -if __name__ == '__main__': +if __name__ == "__main__": main() diff --git a/utils/tests/test-test.py b/utils/tests/test-test.py index 3ffff07ed..5731b015e 100644 --- a/utils/tests/test-test.py +++ b/utils/tests/test-test.py @@ -61,61 +61,67 @@ # write detailed test results into XML-FILE.xml - from __future__ import print_function -from TestBase import TestBaseClass + import sys +from TestBase import TestBaseClass + + def main(argv): """ - Prepares test cases and executes + Prepares test cases and executes """ test_cases = [ - '', - '-h', - '--help', - '-b build/', - '--buildpath=build/', - '-c performance', - '--constrain=performance', - '-d', - '--duration', - '-e socket-options-ipv6', - '--example=socket-options-ipv6', - '-u', - '--update-data', - '-f EXTENSIVE', - '--fullness=EXTENSIVE', - '-g', - '--grind', - '-l', - '--list', - '-m', - '--multiple', - '-n', - '--no-build', - '-p first', - '--pyexample=first', - '-r', - '--retain', - '-s ns3-tcp-state', - '--suite=ns3-tcp-state', - '-t t_opt.txt', - '--text=t_opt.txt && rm t_opt.txt', - '-v', - '--verbose', - '-w t_opt.html && rm t_opt.html', - '--web=t_opt.html && rm t_opt.html', - '--html=t_opt.html && rm t_opt.html', - '-x t_opt.xml && rm t_opt.xml', - '--xml=t_opt.xml && rm t_opt.xml', + "", + "-h", + "--help", + "-b build/", + "--buildpath=build/", + "-c performance", + "--constrain=performance", + "-d", + "--duration", + "-e socket-options-ipv6", + "--example=socket-options-ipv6", + "-u", + "--update-data", + "-f EXTENSIVE", + "--fullness=EXTENSIVE", + "-g", + "--grind", + "-l", + "--list", + "-m", + "--multiple", + "-n", + "--no-build", + "-p first", + "--pyexample=first", + "-r", + "--retain", + "-s ns3-tcp-state", + "--suite=ns3-tcp-state", + "-t t_opt.txt", + "--text=t_opt.txt && rm t_opt.txt", + "-v", + "--verbose", + "-w t_opt.html && rm t_opt.html", + "--web=t_opt.html && rm t_opt.html", + "--html=t_opt.html && rm t_opt.html", + "-x t_opt.xml && rm t_opt.xml", + "--xml=t_opt.xml && rm t_opt.xml", ] - configure_string = sys.executable + ' ns3 configure --enable-tests --enable-examples' - clean_string = sys.executable + ' ns3 clean' - cmd_execute_list = ['%s && %s test.py %s && %s' % (configure_string, sys.executable, option, clean_string) for option in test_cases] - runner = TestBaseClass(argv[1:], "Test suite for the ns-3 unit test runner", 'test-py') + configure_string = sys.executable + " ns3 configure --enable-tests --enable-examples" + clean_string = sys.executable + " ns3 clean" + cmd_execute_list = [ + "%s && %s test.py %s && %s" % (configure_string, sys.executable, option, clean_string) + for option in test_cases + ] + runner = TestBaseClass(argv[1:], "Test suite for the ns-3 unit test runner", "test-py") return runner.runtests(cmd_execute_list) -if __name__ == '__main__': + +if __name__ == "__main__": sys.exit(main(sys.argv))
... %s%s%s\n" % result) + f.write('%s\n' % result) else: - f.write("%s%s