forked from TrueCloudLab/frostfs-testlib
[#195] Update netmap parser and status check message
Signed-off-by: Andrey Berezin <a.berezin@yadro.com>
This commit is contained in:
parent
11487e983d
commit
2dc5aa8a1e
3 changed files with 26 additions and 24 deletions
|
@ -1,7 +1,7 @@
|
|||
import re
|
||||
|
||||
from frostfs_testlib.storage.cluster import ClusterNode
|
||||
from frostfs_testlib.storage.dataclasses.storage_object_info import NodeNetInfo, NodeNetmapInfo
|
||||
from frostfs_testlib.storage.dataclasses.storage_object_info import NodeNetInfo, NodeNetmapInfo, NodeStatus
|
||||
|
||||
|
||||
class NetmapParser:
|
||||
|
@ -44,7 +44,7 @@ class NetmapParser:
|
|||
regexes = {
|
||||
"node_id": r"\d+: (?P<node_id>\w+)",
|
||||
"node_data_ips": r"(?P<node_data_ips>/ip4/.+?)$",
|
||||
"node_status": r"(?P<node_status>ONLINE|OFFLINE)",
|
||||
"node_status": r"(?P<node_status>ONLINE|MAINTENANCE|OFFLINE)",
|
||||
"cluster_name": r"ClusterName: (?P<cluster_name>\w+)",
|
||||
"continent": r"Continent: (?P<continent>\w+)",
|
||||
"country": r"Country: (?P<country>\w+)",
|
||||
|
@ -62,14 +62,17 @@ class NetmapParser:
|
|||
for node in netmap_nodes:
|
||||
for key, regex in regexes.items():
|
||||
search_result = re.search(regex, node, flags=re.MULTILINE)
|
||||
if search_result == None:
|
||||
result_netmap[key] = None
|
||||
continue
|
||||
if key == "node_data_ips":
|
||||
result_netmap[key] = search_result[key].strip().split(" ")
|
||||
continue
|
||||
if key == "external_address":
|
||||
result_netmap[key] = search_result[key].strip().split(",")
|
||||
continue
|
||||
if search_result == None:
|
||||
result_netmap[key] = None
|
||||
if key == "node_status":
|
||||
result_netmap[key] = NodeStatus(search_result[key].strip().lower())
|
||||
continue
|
||||
result_netmap[key] = search_result[key].strip()
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue