diff --git a/robot/resources/lib/python_keywords/neofs.py b/robot/resources/lib/python_keywords/neofs.py deleted file mode 100644 index 4553e999..00000000 --- a/robot/resources/lib/python_keywords/neofs.py +++ /dev/null @@ -1,86 +0,0 @@ -#!/usr/bin/python3 - -import json -import os -import random - -from neo3 import wallet -from robot.api import logger -from robot.api.deco import keyword -from robot.libraries.BuiltIn import BuiltIn - -import neofs_verbs -from common import NEOFS_NETMAP_DICT - -ROBOT_AUTO_KEYWORDS = False - -# path to neofs-cli executable -NEOFS_CLI_EXEC = os.getenv('NEOFS_CLI_EXEC', 'neofs-cli') - - -@keyword('Verify Head Tombstone') -def verify_head_tombstone(wallet_path: str, cid: str, oid_ts: str, oid: str): - header = neofs_verbs.head_object(wallet_path, cid, oid_ts) - header = header['header'] - - BuiltIn().should_be_equal(header["containerID"], cid, - msg="Tombstone Header CID is wrong") - - wlt_data = dict() - with open(wallet_path, 'r') as fout: - wlt_data = json.loads(fout.read()) - wlt = wallet.Wallet.from_json(wlt_data, password='') - addr = wlt.accounts[0].address - - BuiltIn().should_be_equal(header["ownerID"], addr, - msg="Tombstone Owner ID is wrong") - - BuiltIn().should_be_equal(header["objectType"], 'TOMBSTONE', - msg="Header Type isn't Tombstone") - - BuiltIn().should_be_equal(header["sessionToken"]["body"]["object"]["verb"], 'DELETE', - msg="Header Session Type isn't DELETE") - - BuiltIn().should_be_equal(header["sessionToken"]["body"]["object"]["address"]["containerID"], - cid, - msg="Header Session ID is wrong") - - BuiltIn().should_be_equal(header["sessionToken"]["body"]["object"]["address"]["objectID"], - oid, - msg="Header Session OID is wrong") - - -@keyword('Get control endpoint and wallet') -def get_control_endpoint_and_wallet(endpoint_number: str = ''): - """ - Gets control endpoint for a random or given node - - Args: - endpoint_number (optional, str): the number of the node - in the form of 's01', 's02', etc. - given in NEOFS_NETMAP_DICT as keys - Returns: - (str): the number of the node - (str): endpoint control for the node - (str): the wallet of the respective node - """ - if endpoint_number == '': - endpoint_num = random.choice(list(NEOFS_NETMAP_DICT.keys())) - logger.info(f'Random node chosen: {endpoint_num}') - else: - endpoint_num = endpoint_number - - endpoint_values = NEOFS_NETMAP_DICT[f'{endpoint_num}'] - endpoint_control = endpoint_values['control'] - wlt = endpoint_values['wallet_path'] - - return endpoint_num, endpoint_control, wlt - - -@keyword('Get Locode') -def get_locode(): - endpoint_values = random.choice(list(NEOFS_NETMAP_DICT.values())) - locode = endpoint_values['UN-LOCODE'] - logger.info(f'Random locode chosen: {locode}') - - return locode diff --git a/robot/resources/lib/python_keywords/nodes_management.py b/robot/resources/lib/python_keywords/nodes_management.py index a671fba0..2ea98fc2 100644 --- a/robot/resources/lib/python_keywords/nodes_management.py +++ b/robot/resources/lib/python_keywords/nodes_management.py @@ -8,6 +8,8 @@ import random import docker +from common import NEOFS_NETMAP_DICT +from robot.api import logger from robot.api.deco import keyword ROBOT_AUTO_KEYWORDS = False @@ -45,3 +47,39 @@ def start_nodes(nodes: list): for node in nodes: node = node.split('.')[0] client.start(node) + + +@keyword('Get control endpoint and wallet') +def get_control_endpoint_and_wallet(endpoint_number: str = ''): + """ + Gets control endpoint for a random or given node + + Args: + endpoint_number (optional, str): the number of the node + in the form of 's01', 's02', etc. + given in NEOFS_NETMAP_DICT as keys + Returns: + (str): the number of the node + (str): endpoint control for the node + (str): the wallet of the respective node + """ + if endpoint_number == '': + endpoint_num = random.choice(list(NEOFS_NETMAP_DICT.keys())) + logger.info(f'Random node chosen: {endpoint_num}') + else: + endpoint_num = endpoint_number + + endpoint_values = NEOFS_NETMAP_DICT[f'{endpoint_num}'] + endpoint_control = endpoint_values['control'] + wlt = endpoint_values['wallet_path'] + + return endpoint_num, endpoint_control, wlt + + +@keyword('Get Locode') +def get_locode(): + endpoint_values = random.choice(list(NEOFS_NETMAP_DICT.values())) + locode = endpoint_values['UN-LOCODE'] + logger.info(f'Random locode chosen: {locode}') + + return locode diff --git a/robot/resources/lib/python_keywords/tombstone.py b/robot/resources/lib/python_keywords/tombstone.py new file mode 100644 index 00000000..59b80ad7 --- /dev/null +++ b/robot/resources/lib/python_keywords/tombstone.py @@ -0,0 +1,49 @@ +#!/usr/bin/python3 + +import json + +from neo3 import wallet +from robot.api.deco import keyword +from robot.libraries.BuiltIn import BuiltIn + +import neofs_verbs + +ROBOT_AUTO_KEYWORDS = False + + +@keyword('Verify Head Tombstone') +def verify_head_tombstone(wallet_path: str, cid: str, oid_ts: str, oid: str): + header = neofs_verbs.head_object(wallet_path, cid, oid_ts) + header = header['header'] + + BuiltIn().should_be_equal(header["containerID"], cid, + msg="Tombstone Header CID is wrong") + + wlt_data = dict() + with open(wallet_path, 'r') as fout: + wlt_data = json.loads(fout.read()) + wlt = wallet.Wallet.from_json(wlt_data, password='') + addr = wlt.accounts[0].address + + BuiltIn().should_be_equal(header["ownerID"], addr, + msg="Tombstone Owner ID is wrong") + + BuiltIn().should_be_equal(header["objectType"], 'TOMBSTONE', + msg="Header Type isn't Tombstone") + + BuiltIn().should_be_equal( + header["sessionToken"]["body"]["object"]["verb"], 'DELETE', + msg="Header Session Type isn't DELETE" + ) + + BuiltIn().should_be_equal( + header["sessionToken"]["body"]["object"]["address"]["containerID"], + cid, + msg="Header Session ID is wrong" + ) + + BuiltIn().should_be_equal( + header["sessionToken"]["body"]["object"]["address"]["objectID"], + oid, + msg="Header Session OID is wrong" + ) diff --git a/robot/resources/lib/robot/common_steps_acl_extended.robot b/robot/resources/lib/robot/common_steps_acl_extended.robot index 17e85bc4..733201f3 100644 --- a/robot/resources/lib/robot/common_steps_acl_extended.robot +++ b/robot/resources/lib/robot/common_steps_acl_extended.robot @@ -4,7 +4,6 @@ Variables eacl_object_filters.py Library acl.py Library container.py -Library neofs.py Library neofs_verbs.py Library Collections diff --git a/robot/resources/lib/robot/verbs.robot b/robot/resources/lib/robot/verbs.robot index 6a626484..0ae1b237 100644 --- a/robot/resources/lib/robot/verbs.robot +++ b/robot/resources/lib/robot/verbs.robot @@ -2,7 +2,7 @@ Variables common.py Library epoch.py -Library neofs.py +Library tombstone.py Library neofs_verbs.py Library utility_keywords.py Library Collections diff --git a/robot/testsuites/integration/acl/acl_extended_deny_replication.robot b/robot/testsuites/integration/acl/acl_extended_deny_replication.robot index 391b8913..75d49ce4 100644 --- a/robot/testsuites/integration/acl/acl_extended_deny_replication.robot +++ b/robot/testsuites/integration/acl/acl_extended_deny_replication.robot @@ -4,7 +4,7 @@ Variables common.py Library acl.py Library container.py Library epoch.py -Library neofs.py +Library nodes_management.py Library neofs_verbs.py Library storage_policy.py Library utility_keywords.py diff --git a/robot/testsuites/integration/acl/acl_extended_filters.robot b/robot/testsuites/integration/acl/acl_extended_filters.robot index f64238f0..4bff0648 100644 --- a/robot/testsuites/integration/acl/acl_extended_filters.robot +++ b/robot/testsuites/integration/acl/acl_extended_filters.robot @@ -3,7 +3,6 @@ Variables common.py Library acl.py Library container.py -Library neofs.py Library neofs_verbs.py Library Collections diff --git a/robot/testsuites/integration/acl/storage_group/bearer_allow_sg.robot b/robot/testsuites/integration/acl/storage_group/bearer_allow_sg.robot index e1ae7bfb..b072305f 100644 --- a/robot/testsuites/integration/acl/storage_group/bearer_allow_sg.robot +++ b/robot/testsuites/integration/acl/storage_group/bearer_allow_sg.robot @@ -4,7 +4,6 @@ Variables common.py Library Collections Library acl.py Library container.py -Library neofs.py Library neofs_verbs.py Library utility_keywords.py diff --git a/robot/testsuites/integration/container/container_attributes.robot b/robot/testsuites/integration/container/container_attributes.robot index 3d85e471..70892415 100644 --- a/robot/testsuites/integration/container/container_attributes.robot +++ b/robot/testsuites/integration/container/container_attributes.robot @@ -2,8 +2,6 @@ Variables common.py Library container.py -Library neofs.py -Library payment_neogo.py Library String Library Collections diff --git a/robot/testsuites/integration/network/netmap_control.robot b/robot/testsuites/integration/network/netmap_control.robot index 03a05629..96e10e52 100644 --- a/robot/testsuites/integration/network/netmap_control.robot +++ b/robot/testsuites/integration/network/netmap_control.robot @@ -3,7 +3,7 @@ Variables common.py Library Process Library epoch.py -Library neofs.py +Library nodes_management.py Library String Library acl.py @@ -13,7 +13,6 @@ Resource payment_operations.robot *** Test Cases *** Control Operations with storage nodes [Documentation] Testcase to check NetworkInfo control command. - [Tags] NeoFSCLI NetworkInfo [Timeout] 5 min [Setup] Setup diff --git a/robot/testsuites/integration/network/netmap_control_drop.robot b/robot/testsuites/integration/network/netmap_control_drop.robot index 1fa23d12..b2395d67 100644 --- a/robot/testsuites/integration/network/netmap_control_drop.robot +++ b/robot/testsuites/integration/network/netmap_control_drop.robot @@ -3,7 +3,7 @@ Variables common.py Variables wellknown_acl.py Library container.py -Library neofs.py +Library nodes_management.py Library neofs_verbs.py Library utility_keywords.py diff --git a/robot/testsuites/integration/object/object_complex.robot b/robot/testsuites/integration/object/object_complex.robot index b2a7ff67..24f0d49e 100644 --- a/robot/testsuites/integration/object/object_complex.robot +++ b/robot/testsuites/integration/object/object_complex.robot @@ -5,7 +5,6 @@ Variables common.py Library container.py Library complex_object_actions.py Library neofs_verbs.py -Library neofs.py Library storage_policy.py Library utility_keywords.py diff --git a/robot/testsuites/integration/object/storage_group/sg_of_complex_objects.robot b/robot/testsuites/integration/object/storage_group/sg_of_complex_objects.robot index 4bff7e4e..9728ab11 100644 --- a/robot/testsuites/integration/object/storage_group/sg_of_complex_objects.robot +++ b/robot/testsuites/integration/object/storage_group/sg_of_complex_objects.robot @@ -1,7 +1,6 @@ *** Settings *** Variables common.py -Library neofs.py Library container.py Library neofs_verbs.py Library storage_group.py diff --git a/robot/testsuites/integration/payment/withdraw.robot b/robot/testsuites/integration/payment/withdraw.robot index 8a317cba..5c5346f0 100644 --- a/robot/testsuites/integration/payment/withdraw.robot +++ b/robot/testsuites/integration/payment/withdraw.robot @@ -1,7 +1,6 @@ *** Settings *** Variables common.py -Library neofs.py Library payment_neogo.py Library utility_keywords.py diff --git a/robot/testsuites/integration/services/http_gate.robot b/robot/testsuites/integration/services/http_gate.robot index 541d6a0d..f53af745 100644 --- a/robot/testsuites/integration/services/http_gate.robot +++ b/robot/testsuites/integration/services/http_gate.robot @@ -3,7 +3,6 @@ Variables common.py Variables wellknown_acl.py Library container.py -Library neofs.py Library neofs_verbs.py Library http_gate.py Library storage_policy.py @@ -25,10 +24,10 @@ NeoFS HTTP Gateway [Setup] Setup Make Up ${INCLUDE_SVC} - ${WALLET} ${_} ${_} = Prepare Wallet And Deposit - ${CID} = Create container ${WALLET} rule=${PLACEMENT_RULE} basic_acl=${PUBLIC_ACL} - ${FILE} ${HASH} = Generate file ${SIMPLE_OBJ_SIZE} - ${FILE_L} ${L_HASH} = Generate file ${COMPLEX_OBJ_SIZE} + ${WALLET} ${_} ${_} = Prepare Wallet And Deposit + ${CID} = Create container ${WALLET} rule=${PLACEMENT_RULE} basic_acl=${PUBLIC_ACL} + ${FILE} ${HASH} = Generate file ${SIMPLE_OBJ_SIZE} + ${FILE_L} ${L_HASH} = Generate file ${COMPLEX_OBJ_SIZE} ${S_OID} = Put object ${WALLET} ${FILE} ${CID} ${L_OID} = Put object ${WALLET} ${FILE_L} ${CID} @@ -38,8 +37,8 @@ NeoFS HTTP Gateway @{GET_NODE_LIST} = Get nodes without object ${WALLET} ${CID} ${S_OID} ${NODE} = Evaluate random.choice($GET_NODE_LIST) random - ${GET_OBJ_S} = Get object ${WALLET} ${CID} ${S_OID} ${EMPTY} s_file_read ${NODE} - ${FILEPATH} = Get via HTTP Gate ${CID} ${S_OID} + ${GET_OBJ_S} = Get object ${WALLET} ${CID} ${S_OID} ${EMPTY} s_file_read ${NODE} + ${FILEPATH} = Get via HTTP Gate ${CID} ${S_OID} ${PLAIN_FILE_HASH} = Get file hash ${GET_OBJ_S} ${GATE_FILE_HASH} = Get file hash ${FILEPATH} @@ -49,8 +48,8 @@ NeoFS HTTP Gateway @{GET_NODE_LIST} = Get nodes without object ${WALLET} ${CID} ${L_OID} ${NODE} = Evaluate random.choice($GET_NODE_LIST) random - ${GET_OBJ_L} = Get object ${WALLET} ${CID} ${L_OID} ${EMPTY} l_file_read ${NODE} - ${FILEPATH} = Get via HTTP Gate ${CID} ${L_OID} + ${GET_OBJ_L} = Get object ${WALLET} ${CID} ${L_OID} ${EMPTY} l_file_read ${NODE} + ${FILEPATH} = Get via HTTP Gate ${CID} ${L_OID} ${PLAIN_FILE_HASH} = Get file hash ${GET_OBJ_L} ${GATE_FILE_HASH} = Get file hash ${FILEPATH} diff --git a/robot/testsuites/integration/services/s3_gate_bucket.robot b/robot/testsuites/integration/services/s3_gate_bucket.robot index 23e1faf7..0e719ed7 100644 --- a/robot/testsuites/integration/services/s3_gate_bucket.robot +++ b/robot/testsuites/integration/services/s3_gate_bucket.robot @@ -4,7 +4,6 @@ Variables common.py Library Collections Library OperatingSystem -Library neofs.py Library container.py Library s3_gate.py Library epoch.py @@ -24,9 +23,9 @@ Buckets in NeoFS S3 Gateway [Setup] Setup Make Up ${INCLUDE_SVC} - ${WALLET} ${_} ${_} = Prepare Wallet And Deposit - ${FILE_S3} ${_} = Generate file ${COMPLEX_OBJ_SIZE} - ${_} ${S3_OBJECT_KEY} = Split Path ${FILE_S3} + ${WALLET} ${_} ${_} = Prepare Wallet And Deposit + ${FILE_S3} ${_} = Generate file ${COMPLEX_OBJ_SIZE} + ${_} ${S3_OBJECT_KEY} = Split Path ${FILE_S3} ${CID} ... ${BUCKET} diff --git a/robot/testsuites/integration/services/s3_gate_object.robot b/robot/testsuites/integration/services/s3_gate_object.robot index b34ab294..57e93086 100644 --- a/robot/testsuites/integration/services/s3_gate_object.robot +++ b/robot/testsuites/integration/services/s3_gate_object.robot @@ -5,7 +5,6 @@ Library Collections Library OperatingSystem Library container.py -Library neofs.py Library s3_gate.py Library utility_keywords.py