From d1595b78ca237dc586b9e0a4c010989c1e78ca9e Mon Sep 17 00:00:00 2001 From: anastasia prasolova Date: Thu, 19 May 2022 13:54:07 +0300 Subject: [PATCH] get rid of duplicated "create container" keywords for extended acl suites Signed-off-by: anastasia prasolova --- .../lib/robot/common_steps_acl_extended.robot | 110 +++++++++--------- .../acl/acl_extended_actions_pubkey.robot | 3 +- .../acl/acl_extended_actions_system.robot | 7 +- .../acl/acl_extended_compound.robot | 30 ++--- .../acl/acl_extended_filters.robot | 43 +++---- .../creation_epoch_filter.robot | 10 +- .../object_attributes/object_id_filter.robot | 30 +++-- .../payload_length_filter.robot | 10 +- 8 files changed, 119 insertions(+), 124 deletions(-) diff --git a/robot/resources/lib/robot/common_steps_acl_extended.robot b/robot/resources/lib/robot/common_steps_acl_extended.robot index 55df1544..252960f8 100644 --- a/robot/resources/lib/robot/common_steps_acl_extended.robot +++ b/robot/resources/lib/robot/common_steps_acl_extended.robot @@ -8,6 +8,7 @@ Library neofs.py Library neofs_verbs.py Library Collections +Library String Resource common_steps_acl_basic.robot Resource payment_operations.robot @@ -21,11 +22,6 @@ ${EACL_ERR_MSG} = * *** Keywords *** -Create Container Public - [Arguments] ${WALLET} - ${PUBLIC_CID_GEN} = Create container ${WALLET} basic_acl=${PUBLIC_ACL} - [Return] ${PUBLIC_CID_GEN} - Generate files [Arguments] ${SIZE} @@ -38,23 +34,23 @@ Generate files Check eACL Deny and Allow All [Arguments] ${WALLET} ${DENY_EACL} ${ALLOW_EACL} ${USER_WALLET} - ${CID} = Create Container Public ${USER_WALLET} - ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} - ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} - ${D_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER_DEL} - @{S_OBJ_H} = Create List ${S_OID_USER} + ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write + ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} + ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} + ${D_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER_DEL} + @{S_OBJ_H} = Create List ${S_OID_USER} - Put object ${WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} + Put object ${WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} - Get object ${WALLET} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl - Search object ${WALLET} ${CID} ${EMPTY} ${EMPTY} ${USER_HEADER} ${S_OBJ_H} - Head object ${WALLET} ${CID} ${S_OID_USER} + Get object ${WALLET} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl + Search object ${WALLET} ${CID} ${EMPTY} ${EMPTY} ${USER_HEADER} ${S_OBJ_H} + Head object ${WALLET} ${CID} ${S_OID_USER} - Get Range ${WALLET} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 - Get Range Hash ${WALLET} ${CID} ${S_OID_USER} ${EMPTY} 0:256 - Delete object ${WALLET} ${CID} ${D_OID_USER} + Get Range ${WALLET} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + Get Range Hash ${WALLET} ${CID} ${S_OID_USER} ${EMPTY} 0:256 + Delete object ${WALLET} ${CID} ${D_OID_USER} - Set eACL ${USER_WALLET} ${CID} ${DENY_EACL} + Set eACL ${USER_WALLET} ${CID} ${DENY_EACL} # The current ACL cache lifetime is 30 sec Sleep ${NEOFS_CONTRACT_CACHE_TIMEOUT} @@ -88,9 +84,7 @@ Check eACL Deny and Allow All Delete object ${WALLET} ${CID} ${S_OID_USER} Compose eACL Custom - [Arguments] ${CID} ${HEADER_DICT} ${MATCH_TYPE} ${FILTER} ${ACCESS} ${ROLE} - - ${filter_value} = Get From dictionary ${HEADER_DICT} ${EACL_OBJ_FILTERS}[${FILTER}] + [Arguments] ${CID} ${filter_value} ${MATCH_TYPE} ${FILTER} ${ACCESS} ${ROLE} ${filters} = Set Variable obj:${FILTER}${MATCH_TYPE}${filter_value} ${rule_get}= Set Variable ${ACCESS} get ${filters} ${ROLE} @@ -107,16 +101,6 @@ Compose eACL Custom [Return] ${EACL_CUSTOM} -Object Header Decoded - [Arguments] ${WALLET} ${CID} ${OID} - - &{HEADER} = Head Object ${WALLET} ${CID} ${OID} - # FIXME - # 'objectID' key repositioning in dictionary for the calling keyword might - # work uniformly with any key from 'header' - Set To Dictionary ${HEADER}[header] objectID ${HEADER}[objectID] - - [Return] &{HEADER}[header] Check eACL Filters with MatchType String Equal [Arguments] ${FILTER} @@ -124,23 +108,30 @@ Check eACL Filters with MatchType String Equal ${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit - ${CID} = Create Container Public ${WALLET} - ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} + ${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write + ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} ${S_OID_USER} = Put Object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} ${D_OID_USER} = Put object ${WALLET} ${FILE_S} ${CID} - @{S_OBJ_H} = Create List ${S_OID_USER} + @{S_OBJ_H} = Create List ${S_OID_USER} - Get Object ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl - Search Object ${WALLET_OTH} ${CID} ${EMPTY} ${EMPTY} ${USER_HEADER} ${S_OBJ_H} - Head Object ${WALLET_OTH} ${CID} ${S_OID_USER} - Get Range ${WALLET_OTH} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 - Get Range Hash ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} 0:256 - Delete Object ${WALLET_OTH} ${CID} ${D_OID_USER} + Get Object ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl + Search Object ${WALLET_OTH} ${CID} ${EMPTY} ${EMPTY} ${USER_HEADER} ${S_OBJ_H} + &{HEADER} = Head Object ${WALLET_OTH} ${CID} ${S_OID_USER} + Get Range ${WALLET_OTH} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + Get Range Hash ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} 0:256 + Delete Object ${WALLET_OTH} ${CID} ${D_OID_USER} - &{HEADER_DICT} = Object Header Decoded ${WALLET} ${CID} ${S_OID_USER} - ${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER_DICT} = ${FILTER} DENY OTHERS - Set eACL ${WALLET} ${CID} ${EACL_CUSTOM} + ${K} ${V} = Split String ${FILTER} : + ${EACL_CUSTOM} = Set Variable + IF """${v}""" == """objectID""" + ${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[${V}] + ... = ${FILTER} DENY OTHERS + ELSE + ${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[header][${V}] + ... = ${FILTER} DENY OTHERS + END + Set eACL ${WALLET} ${CID} ${EACL_CUSTOM} # The current ACL cache lifetime is 30 sec Sleep ${NEOFS_CONTRACT_CACHE_TIMEOUT} @@ -176,23 +167,30 @@ Check eACL Filters with MatchType String Not Equal ${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit - ${CID} = Create Container Public ${WALLET} + ${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} - ${S_OID_OTH} = Put Object ${WALLET_OTH} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} - ${S_OID_USER} = Put Object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} - ${D_OID_USER} = Put object ${WALLET} ${FILE_S} ${CID} - @{S_OBJ_H} = Create List ${S_OID_USER} + ${S_OID_OTH} = Put Object ${WALLET_OTH} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} + ${S_OID_USER} = Put Object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} + ${D_OID_USER} = Put object ${WALLET} ${FILE_S} ${CID} + @{S_OBJ_H} = Create List ${S_OID_USER} - Get Object ${WALLET} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl - Head Object ${WALLET} ${CID} ${S_OID_USER} - Search Object ${WALLET} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} ${S_OBJ_H} - Get Range ${WALLET} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 - Get Range Hash ${WALLET} ${CID} ${S_OID_USER} ${EMPTY} 0:256 + Get Object ${WALLET} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl + &{HEADER} = Head Object ${WALLET} ${CID} ${S_OID_USER} + Search Object ${WALLET} ${CID} ${EMPTY} ${EMPTY} ${USER_HEADER} ${S_OBJ_H} + Get Range ${WALLET} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256 + Get Range Hash ${WALLET} ${CID} ${S_OID_USER} ${EMPTY} 0:256 - &{HEADER_DICT} = Object Header Decoded ${WALLET} ${CID} ${S_OID_USER} - ${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER_DICT} != ${FILTER} deny others - Set eACL ${WALLET} ${CID} ${EACL_CUSTOM} + ${K} ${V} = Split String ${FILTER} : + ${EACL_CUSTOM} = Set Variable + IF """${v}""" == """objectID""" + ${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[${V}] + ... != ${FILTER} DENY OTHERS + ELSE + ${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[header][${V}] + ... != ${FILTER} DENY OTHERS + END + Set eACL ${WALLET} ${CID} ${EACL_CUSTOM} # The current ACL cache lifetime is 30 sec Sleep ${NEOFS_CONTRACT_CACHE_TIMEOUT} diff --git a/robot/testsuites/integration/acl/acl_extended_actions_pubkey.robot b/robot/testsuites/integration/acl/acl_extended_actions_pubkey.robot index 0608b560..6d266fc4 100644 --- a/robot/testsuites/integration/acl/acl_extended_actions_pubkey.robot +++ b/robot/testsuites/integration/acl/acl_extended_actions_pubkey.robot @@ -3,6 +3,7 @@ Variables common.py Library Collections Library acl.py +Library container.py Library neofs.py Library neofs_verbs.py Library payment_neogo.py @@ -47,7 +48,7 @@ Extended ACL Operations Check eACL Deny All Other and Allow All Pubkey [Arguments] ${USER_WALLET} ${FILE_S} ${WALLET_OTH} - ${CID} = Create Container Public ${USER_WALLET} + ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} ${D_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER_DEL} @{S_OBJ_H} = Create List ${S_OID_USER} diff --git a/robot/testsuites/integration/acl/acl_extended_actions_system.robot b/robot/testsuites/integration/acl/acl_extended_actions_system.robot index bc1d6914..e26ee659 100644 --- a/robot/testsuites/integration/acl/acl_extended_actions_system.robot +++ b/robot/testsuites/integration/acl/acl_extended_actions_system.robot @@ -2,10 +2,11 @@ Variables common.py Library Collections +Library acl.py +Library container.py Library neofs.py Library neofs_verbs.py Library payment_neogo.py -Library acl.py Resource common_steps_acl_extended.robot Resource payment_operations.robot @@ -46,13 +47,13 @@ Check eACL Deny and Allow All System ${WALLET_SN} ${_} = Prepare Wallet with WIF And Deposit ${NEOFS_SN_WIF} ${WALLET_IR} ${_} = Prepare Wallet with WIF And Deposit ${NEOFS_IR_WIF} - ${CID} = Create Container Public ${WALLET} + ${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write ${S_OID_USER} = Put object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} ${D_OID_USER_S} = Put object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER_DEL} ${D_OID_USER_SN} = Put object ${WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER_DEL} - @{S_OBJ_H} = Create List ${S_OID_USER} + @{S_OBJ_H} = Create List ${S_OID_USER} Put object ${WALLET_IR} ${FILE_S} ${CID} user_headers=${ANOTHER_USER_HEADER} Put object ${WALLET_SN} ${FILE_S} ${CID} user_headers=${ANOTHER_USER_HEADER} diff --git a/robot/testsuites/integration/acl/acl_extended_compound.robot b/robot/testsuites/integration/acl/acl_extended_compound.robot index 0b249ebb..e5c8d9bc 100644 --- a/robot/testsuites/integration/acl/acl_extended_compound.robot +++ b/robot/testsuites/integration/acl/acl_extended_compound.robot @@ -2,10 +2,11 @@ Variables common.py Library Collections +Library acl.py +Library container.py Library neofs.py Library neofs_verbs.py Library payment_neogo.py -Library acl.py Resource common_steps_acl_extended.robot Resource payment_operations.robot @@ -31,7 +32,7 @@ Extended ACL Operations Log Check extended ACL with simple object ${FILE_S} = Generate file of bytes ${SIMPLE_OBJ_SIZE} - Check Сompound Operations ${WALLET} ${WALLET_OTH} ${FILE_S} + Check Сompound Operations ${WALLET} ${WALLET_OTH} ${FILE_S} Log Check extended ACL with complex object ${FILE_S} = Generate file of bytes ${COMPLEX_OBJ_SIZE} @@ -48,22 +49,22 @@ Check Сompound Operations ${WALLET_SYS} ${ADDR_SYS} = Prepare Wallet with WIF And Deposit ${SYSTEM_KEY} - Check eACL Сompound Get ${WALLET_OTH} ${EACL_COMPOUND_GET_OTHERS} ${FILE_S} ${WALLET} ${WALLET_SYS} - Check eACL Сompound Get ${WALLET} ${EACL_COMPOUND_GET_USER} ${FILE_S} ${WALLET} ${WALLET_SYS} - Check eACL Сompound Get ${WALLET_SYS} ${EACL_COMPOUND_GET_SYSTEM} ${FILE_S} ${WALLET} ${WALLET_SYS} + Check eACL Сompound Get ${WALLET_OTH} ${EACL_COMPOUND_GET_OTHERS} ${FILE_S} ${WALLET} ${WALLET_SYS} + Check eACL Сompound Get ${WALLET} ${EACL_COMPOUND_GET_USER} ${FILE_S} ${WALLET} ${WALLET_SYS} + Check eACL Сompound Get ${WALLET_SYS} ${EACL_COMPOUND_GET_SYSTEM} ${FILE_S} ${WALLET} ${WALLET_SYS} - Check eACL Сompound Delete ${WALLET_OTH} ${EACL_COMPOUND_DELETE_OTHERS} ${FILE_S} ${WALLET} ${WALLET_SYS} - Check eACL Сompound Delete ${WALLET} ${EACL_COMPOUND_DELETE_USER} ${FILE_S} ${WALLET} ${WALLET_SYS} - Check eACL Сompound Delete ${WALLET_SYS} ${EACL_COMPOUND_DELETE_SYSTEM} ${FILE_S} ${WALLET} ${WALLET_SYS} + Check eACL Сompound Delete ${WALLET_OTH} ${EACL_COMPOUND_DELETE_OTHERS} ${FILE_S} ${WALLET} ${WALLET_SYS} + Check eACL Сompound Delete ${WALLET} ${EACL_COMPOUND_DELETE_USER} ${FILE_S} ${WALLET} ${WALLET_SYS} + Check eACL Сompound Delete ${WALLET_SYS} ${EACL_COMPOUND_DELETE_SYSTEM} ${FILE_S} ${WALLET} ${WALLET_SYS} - Check eACL Сompound Get Range Hash ${WALLET_OTH} ${EACL_COMPOUND_GET_HASH_OTHERS} ${FILE_S} ${WALLET} ${WALLET_SYS} - Check eACL Сompound Get Range Hash ${WALLET} ${EACL_COMPOUND_GET_HASH_USER} ${FILE_S} ${WALLET} ${WALLET_SYS} - Check eACL Сompound Get Range Hash ${WALLET_SYS} ${EACL_COMPOUND_GET_HASH_SYSTEM} ${FILE_S} ${WALLET} ${WALLET_SYS} + Check eACL Сompound Get Range Hash ${WALLET_OTH} ${EACL_COMPOUND_GET_HASH_OTHERS} ${FILE_S} ${WALLET} ${WALLET_SYS} + Check eACL Сompound Get Range Hash ${WALLET} ${EACL_COMPOUND_GET_HASH_USER} ${FILE_S} ${WALLET} ${WALLET_SYS} + Check eACL Сompound Get Range Hash ${WALLET_SYS} ${EACL_COMPOUND_GET_HASH_SYSTEM} ${FILE_S} ${WALLET} ${WALLET_SYS} Check eACL Сompound Get [Arguments] ${WALLET} ${DENY_EACL} ${FILE_S} ${USER_WALLET} ${WALLET_SYS} - ${CID} = Create Container Public ${USER_WALLET} + ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} Put object ${WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} @@ -89,7 +90,7 @@ Check eACL Сompound Get Check eACL Сompound Delete [Arguments] ${WALLET} ${DENY_EACL} ${FILE_S} ${USER_WALLET} ${WALLET_SYS} - ${CID} = Create Container Public ${USER_WALLET} + ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} ${D_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} @@ -118,11 +119,10 @@ Check eACL Сompound Delete END - Check eACL Сompound Get Range Hash [Arguments] ${WALLET} ${DENY_EACL} ${FILE_S} ${USER_WALLET} ${WALLET_SYS} - ${CID} = Create Container Public ${USER_WALLET} + ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} Put object ${WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} diff --git a/robot/testsuites/integration/acl/acl_extended_filters.robot b/robot/testsuites/integration/acl/acl_extended_filters.robot index a990ffca..4ec029ec 100644 --- a/robot/testsuites/integration/acl/acl_extended_filters.robot +++ b/robot/testsuites/integration/acl/acl_extended_filters.robot @@ -2,11 +2,12 @@ Variables common.py Library acl.py +Library container.py +Library contract_keywords.py Library neofs.py Library neofs_verbs.py Library payment_neogo.py Library Collections -Library contract_keywords.py Resource common_steps_acl_extended.robot Resource payment_operations.robot @@ -47,18 +48,19 @@ Extended ACL Operations Check Filters [Arguments] ${WALLET} ${WALLET_OTH} - Check eACL MatchType String Equal Object ${WALLET} ${WALLET_OTH} - Check eACL MatchType String Not Equal Object ${WALLET} ${WALLET_OTH} - Check eACL MatchType String Equal Request Deny ${WALLET} ${WALLET_OTH} - Check eACL MatchType String Equal Request Allow ${WALLET} ${WALLET_OTH} + Check eACL MatchType String Equal Object ${WALLET} ${WALLET_OTH} + Check eACL MatchType String Not Equal Object ${WALLET} ${WALLET_OTH} + Check eACL MatchType String Equal Request Deny ${WALLET} ${WALLET_OTH} + Check eACL MatchType String Equal Request Allow ${WALLET} ${WALLET_OTH} + Check eACL MatchType String Equal Request Deny [Arguments] ${USER_WALLET} ${OTHER_WALLET} - ${CID} = Create Container Public ${USER_WALLET} - ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} - Get object ${USER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} + ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write + ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} + Get object ${USER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} - Set eACL ${USER_WALLET} ${CID} ${EACL_XHEADER_DENY_ALL} + Set eACL ${USER_WALLET} ${CID} ${EACL_XHEADER_DENY_ALL} # The current ACL cache lifetime is 30 sec Sleep ${NEOFS_CONTRACT_CACHE_TIMEOUT} @@ -94,9 +96,9 @@ Check eACL MatchType String Equal Request Deny Check eACL MatchType String Equal Request Allow [Arguments] ${USER_WALLET} ${OTHER_WALLET} - ${CID} = Create Container Public ${USER_WALLET} - ${S_OID_USER} = Put Object ${USER_WALLET} ${FILE_S} ${CID} - Get Object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} + ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write + ${S_OID_USER} = Put Object ${USER_WALLET} ${FILE_S} ${CID} + Get Object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} Set eACL ${USER_WALLET} ${CID} ${EACL_XHEADER_ALLOW_ALL} @@ -134,7 +136,7 @@ Check eACL MatchType String Equal Request Allow Check eACL MatchType String Equal Object [Arguments] ${USER_WALLET} ${OTHER_WALLET} - ${CID} = Create Container Public ${USER_WALLET} + ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write ${S_OID_USER} = Put Object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} Get Object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} @@ -147,11 +149,10 @@ Check eACL MatchType String Equal Object ${rule1} = Set Variable deny get ${filters} others ${eACL_gen} = Create List ${rule1} ${EACL_CUSTOM} = Create eACL ${CID} ${eACL_gen} - Set eACL ${USER_WALLET} ${CID} ${EACL_CUSTOM} + Set eACL ${USER_WALLET} ${CID} ${EACL_CUSTOM} Run Keyword And Expect Error * ... Get object ${OTHER_WALLET} ${CID} ${S_OID_USER} ${EMPTY} ${PATH} - Log Set eACL for Deny GET operation with StringEqual Object Extended User Header ${S_OID_USER_OTH} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} @@ -170,7 +171,7 @@ Check eACL MatchType String Equal Object Check eACL MatchType String Not Equal Object [Arguments] ${USER_WALLET} ${OTHER_WALLET} - ${CID} = Create Container Public ${USER_WALLET} + ${CID} = Create Container ${USER_WALLET} basic_acl=eacl-public-read-write ${S_OID_USER} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${USER_HEADER} ${S_OID_OTHER} = Put object ${OTHER_WALLET} ${FILE_S_2} ${CID} user_headers=${ANOTHER_HEADER} @@ -194,11 +195,11 @@ Check eACL MatchType String Not Equal Object Log Set eACL for Deny GET operation with StringEqual Object Extended User Header - ${S_OID_USER_OTH} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} - ${filters} = Set Variable obj:${CUSTOM_FILTER}!=1 - ${rule1} = Set Variable deny get ${filters} others - ${eACL_gen} = Create List ${rule1} - ${EACL_CUSTOM} = Create eACL ${CID} ${eACL_gen} + ${S_OID_USER_OTH} = Put object ${USER_WALLET} ${FILE_S} ${CID} user_headers=${ANOTHER_HEADER} + ${filters} = Set Variable obj:${CUSTOM_FILTER}!=1 + ${rule1} = Set Variable deny get ${filters} others + ${eACL_gen} = Create List ${rule1} + ${EACL_CUSTOM} = Create eACL ${CID} ${eACL_gen} Set eACL ${USER_WALLET} ${CID} ${EACL_CUSTOM} Run Keyword And Expect Error * diff --git a/robot/testsuites/integration/acl/object_attributes/creation_epoch_filter.robot b/robot/testsuites/integration/acl/object_attributes/creation_epoch_filter.robot index b16cc778..be540bd0 100644 --- a/robot/testsuites/integration/acl/object_attributes/creation_epoch_filter.robot +++ b/robot/testsuites/integration/acl/object_attributes/creation_epoch_filter.robot @@ -3,6 +3,7 @@ Variables common.py Variables eacl_object_filters.py Library acl.py +Library container.py Library neofs.py Library Collections Library contract_keywords.py @@ -24,9 +25,7 @@ Creation Epoch Object Filter for Extended ACL [Setup] Setup - Log Check eACL creationEpoch Filter with MatchType String Equal Check eACL Filters with MatchType String Equal $Object:creationEpoch - Log Check eACL creationEpoch Filter with MatchType String Not Equal Check $Object:creationEpoch Filter with MatchType String Not Equal $Object:creationEpoch [Teardown] Teardown creation_epoch_filter @@ -39,17 +38,16 @@ Check $Object:creationEpoch Filter with MatchType String Not Equal ${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit - ${CID} = Create Container Public ${WALLET} + ${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} ${S_OID} = Put Object ${WALLET} ${FILE_S} ${CID} - Tick Epoch ${S_OID_NEW} = Put Object ${WALLET} ${FILE_S} ${CID} Get Object ${WALLET} ${CID} ${S_OID_NEW} ${EMPTY} local_file_eacl + &{HEADER} = Head Object ${WALLET} ${CID} ${S_OID_NEW} - &{HEADER_DICT} = Head Object ${WALLET} ${CID} ${S_OID_NEW} - ${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER_DICT} != ${FILTER} DENY OTHERS + ${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[header][creationEpoch] != ${FILTER} DENY OTHERS Set eACL ${WALLET} ${CID} ${EACL_CUSTOM} Run Keyword And Expect Error ${EACL_ERR_MSG} diff --git a/robot/testsuites/integration/acl/object_attributes/object_id_filter.robot b/robot/testsuites/integration/acl/object_attributes/object_id_filter.robot index ce234c7e..eb449b9f 100644 --- a/robot/testsuites/integration/acl/object_attributes/object_id_filter.robot +++ b/robot/testsuites/integration/acl/object_attributes/object_id_filter.robot @@ -3,6 +3,7 @@ Variables common.py Variables eacl_object_filters.py Library acl.py +Library container.py Library neofs.py Library Collections @@ -18,48 +19,44 @@ ${EACL_ERR_MSG} = * *** Test cases *** Object ID Object Filter for Extended ACL [Documentation] Testcase to validate if $Object:objectID eACL filter is correctly handled. - [Tags] ACL eACL NeoFS NeoCLI + [Tags] ACL eACL [Timeout] 20 min [Setup] Setup - - Log Check eACL objectID Filter with MatchType String Equal + Check eACL Filters with MatchType String Equal $Object:objectID - Log Check eACL objectID Filter with MatchType String Not Equal Check eACL Filters with MatchType String Not Equal $Object:objectID ################################################################################# # If the first eACL rule contradicts the second, the second one won't be applied ################################################################################# - Log Check if the second rule that contradicts the first is not applied Check eACL Filters with MatchType String Equal with two contradicting filters $Object:objectID ########################################################################################################################### # If both STRING_EQUAL and STRING_NOT_EQUAL matchTypes are applied for the same filter value, no object can be operated on ########################################################################################################################### - Log Check two matchTypes applied Check eACL Filters, two matchTypes $Object:objectID [Teardown] Teardown object_id *** Keywords *** - + Check eACL Filters with MatchType String Equal with two contradicting filters [Arguments] ${FILTER} - ${WALLET} ${_} ${_} = Prepare Wallet And Deposit + ${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit - ${CID} = Create Container Public ${WALLET} + ${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write ${FILE_S_USER} ${_} = Generate file ${SIMPLE_OBJ_SIZE} ${S_OID_USER} = Put Object ${WALLET} ${FILE_S_USER} ${CID} ${EMPTY} - &{HEADER_DICT_USER} = Object Header Decoded ${WALLET} ${CID} ${S_OID_USER} - + Get Object ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} ${OBJECT_PATH} - ${filter_value} = Get From Dictionary ${HEADER_DICT_USER} ${EACL_OBJ_FILTERS}[${FILTER}] + &{HEADER} = Head Object ${WALLET} ${CID} ${S_OID_USER} + ${filter_value} = Get From Dictionary ${HEADER} ${EACL_OBJ_FILTERS}[${FILTER}] ${filters} = Set Variable obj:${FILTER}=${filter_value} ${rule} = Set Variable allow get ${filters} others ${contradicting_filters} = Set Variable obj:$Object:payloadLength=${SIMPLE_OBJ_SIZE} @@ -70,23 +67,24 @@ Check eACL Filters with MatchType String Equal with two contradicting filters Set eACL ${WALLET} ${CID} ${EACL_CUSTOM} Get object ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} ${OBJECT_PATH} + Check eACL Filters, two matchTypes [Arguments] ${FILTER} - ${WALLET} ${_} ${_} = Prepare Wallet And Deposit + ${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit - ${CID} = Create Container Public ${WALLET} + ${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} ${S_OID_USER} = Put Object ${WALLET} ${FILE_S} ${CID} ${EMPTY} ${S_OID_OTHER} = Put Object ${WALLET_OTH} ${FILE_S} ${CID} ${EMPTY} - &{HEADER_DICT_USER} = Object Header Decoded ${WALLET} ${CID} ${S_OID_USER} + &{HEADER} = Head Object ${WALLET} ${CID} ${S_OID_USER} Get Object ${WALLET_OTH} ${CID} ${S_OID_USER} ${EMPTY} ${OBJECT_PATH} Get Object ${WALLET_OTH} ${CID} ${S_OID_OTHER} ${EMPTY} ${OBJECT_PATH} - ${filter_value} = Get From Dictionary ${HEADER_DICT_USER} ${EACL_OBJ_FILTERS}[${FILTER}] + ${filter_value} = Get From Dictionary ${HEADER} ${EACL_OBJ_FILTERS}[${FILTER}] ${noneq_filters} = Set Variable obj:${FILTER}!=${filter_value} ${rule_noneq_filter} = Set Variable deny get ${noneq_filters} others ${eq_filters} = Set Variable obj:${FILTER}=${filter_value} diff --git a/robot/testsuites/integration/acl/object_attributes/payload_length_filter.robot b/robot/testsuites/integration/acl/object_attributes/payload_length_filter.robot index 403e0afa..6d43f559 100644 --- a/robot/testsuites/integration/acl/object_attributes/payload_length_filter.robot +++ b/robot/testsuites/integration/acl/object_attributes/payload_length_filter.robot @@ -3,6 +3,7 @@ Variables common.py Variables eacl_object_filters.py Library acl.py +Library container.py Library neofs.py Library Collections @@ -23,9 +24,7 @@ Payload Length Object Filter for Extended ACL [Setup] Setup - Log Check eACL payloadLength Filter with MatchType String Equal Check eACL Filters with MatchType String Equal $Object:payloadLength - Log Check eACL payloadLength Filter with MatchType String Not Equal Check $Object:payloadLength Filter with MatchType String Not Equal $Object:payloadLength [Teardown] Teardown payload_length_filter @@ -38,7 +37,7 @@ Check $Object:payloadLength Filter with MatchType String Not Equal ${WALLET} ${_} ${_} = Prepare Wallet And Deposit ${WALLET_OTH} ${_} ${_} = Prepare Wallet And Deposit - ${CID} = Create Container Public ${WALLET} + ${CID} = Create Container ${WALLET} basic_acl=eacl-public-read-write ${FILE_S} ${_} = Generate file ${SIMPLE_OBJ_SIZE} ${FILE_0} ${_} = Generate file ${0} @@ -46,10 +45,9 @@ Check $Object:payloadLength Filter with MatchType String Not Equal ${S_OID} = Put Object ${WALLET} ${FILE_S} ${CID} Get Object ${WALLET} ${CID} ${S_OID} ${EMPTY} local_file_eacl - Head Object ${WALLET} ${CID} ${S_OID} + &{HEADER} = Head Object ${WALLET} ${CID} ${S_OID} - &{HEADER_DICT} = Object Header Decoded ${WALLET} ${CID} ${S_OID} - ${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER_DICT} != ${FILTER} DENY OTHERS + ${EACL_CUSTOM} = Compose eACL Custom ${CID} ${HEADER}[header][payloadLength] != ${FILTER} DENY OTHERS Set eACL ${WALLET} ${CID} ${EACL_CUSTOM} Run Keyword And Expect Error ${EACL_ERR_MSG}