2024-11-18 12:17:52 +00:00
|
|
|
from frostfs_testlib.shell.interfaces import Shell
|
|
|
|
from frostfs_testlib.steps.cli.container import get_container
|
|
|
|
from frostfs_testlib.storage.dataclasses.storage_object_info import NodeNetmapInfo
|
2024-11-26 16:42:53 +00:00
|
|
|
|
|
|
|
from ..helpers.utility import placement_policy_from_container
|
2024-11-18 12:17:52 +00:00
|
|
|
|
|
|
|
|
|
|
|
def validate_object_policy(wallet: str, shell: Shell, placement_rule: str, cid: str, endpoint: str):
|
|
|
|
got_policy = placement_policy_from_container(get_container(wallet, cid, shell, endpoint, False))
|
|
|
|
assert got_policy.replace("'", "") == placement_rule.replace(
|
|
|
|
"'", ""
|
|
|
|
), f"Expected \n{placement_rule} and got policy \n{got_policy} are the same"
|
|
|
|
|
|
|
|
|
|
|
|
def get_netmap_param(netmap_info: list[NodeNetmapInfo]) -> dict:
|
|
|
|
dict_external = dict()
|
|
|
|
for node in netmap_info:
|
|
|
|
external_adress = node.external_address[0].split("/")[2]
|
|
|
|
dict_external[external_adress] = {
|
|
|
|
"country": node.country,
|
|
|
|
"country_code": node.country_code,
|
|
|
|
"Price": node.price,
|
|
|
|
"continent": node.continent,
|
|
|
|
"un_locode": node.un_locode,
|
|
|
|
"location": node.location,
|
|
|
|
}
|
|
|
|
return dict_external
|