bugfix: Comment the config and Using the built-in code config.
This commit is contained in:
@@ -30,17 +30,19 @@ from urllib.parse import urlparse, parse_qs
|
||||
|
||||
class ConfigLoader:
|
||||
def __init__(self, config_path: str):
|
||||
self.__config_path = config_path
|
||||
self.__configs = self._load_configs()
|
||||
self._config_path = config_path
|
||||
self._configs = {}
|
||||
if os.path.exists(self._config_path):
|
||||
self._load_configs()
|
||||
|
||||
def _load_configs(self):
|
||||
config_parser = ConfigParser()
|
||||
config_parser.read(self.__config_path, encoding='UTF-8')
|
||||
config_parser.read(self._config_path, encoding='UTF-8')
|
||||
return config_parser.sections()
|
||||
|
||||
def get_value_by_section_and_key(self, section, key):
|
||||
if section in self.__configs and key in self.__configs[section]:
|
||||
value = self.__configs[section][key]
|
||||
if section in self._configs and key in self._configs[section]:
|
||||
value = self._configs[section][key]
|
||||
if isinstance(value, str) and value.isdigit():
|
||||
return int(value)
|
||||
else:
|
||||
@@ -223,6 +225,7 @@ class TcpPacketsCapture:
|
||||
self._filter = f"tcp and src host {self._server_ip} and src port {self._server_port}"
|
||||
|
||||
def start(self):
|
||||
time.sleep(0.5)
|
||||
self._sniff_thread = AsyncSniffer(iface=self._iface_names, prn=self._packet_callback, filter=self._filter)
|
||||
self._sniff_thread.start()
|
||||
|
||||
@@ -252,8 +255,10 @@ class TcpPacketsCapture:
|
||||
self._quadruple_to_dscp_table[quadruple] = dscp_value
|
||||
|
||||
def stop(self):
|
||||
self._sniff_thread.stop()
|
||||
self._sniff_thread.join()
|
||||
time.sleep(0.5)
|
||||
if self._sniff_thread is not None and self._sniff_thread.running:
|
||||
self._sniff_thread.stop()
|
||||
self._sniff_thread.join()
|
||||
|
||||
def read_dscp_value_by_quadruple(self, quadruple):
|
||||
if quadruple in self._quadruple_to_dscp_table:
|
||||
@@ -1192,7 +1197,7 @@ class FirewallCasesRunner:
|
||||
class ResultExportBuilder:
|
||||
COLUMN_0 = "Test cases"
|
||||
COLUMN_1 = "Result"
|
||||
COLUMN_2 = "Fail Reason"
|
||||
COLUMN_2 = "Description"
|
||||
RESULT_OK = "ok"
|
||||
RESULT_FAIL = "FAIL"
|
||||
DEFAULT_INFO = "-"
|
||||
|
||||
Reference in New Issue
Block a user