single keyword for wallet initialization (#54)

Signed-off-by: anastasia prasolova <anastasia@nspcc.ru>
This commit is contained in:
Anastasia Prasolova 2021-04-26 20:48:43 +03:00 committed by GitHub
parent 2f31e79327
commit 9c1d4b9b07
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 153 additions and 228 deletions

View file

@ -1,9 +1,18 @@
.DEFAULT_GOAL := help
run:
OUTPUT_DIR = artifacts/
KEYWORDS_PATH = ../neofs-keywords
KEYWORDS_REPO = git@github.com:nspcc-dev/neofs-keywords.git
run: deps
@echo "⇒ Test Run"
@robot --timestampoutputs --outputdir artifacts/ robot/testsuites/integration/
@robot --timestampoutputs --outputdir $(OUTPUT_DIR) robot/testsuites/integration/
deps: $(KEYWORDS_PATH)
$(KEYWORDS_PATH):
@echo "Cloning keywords repo"
@git clone $(KEYWORDS_REPO) $(KEYWORDS_PATH)
help:
@echo "⇒ run Run testcases ${R}"
@echo "⇒ run Run testcases ${R}"

View file

@ -30,6 +30,7 @@
4. Install Testcases dependencies
- `pip3 install -r requirements.txt`
- `make deps`
(replace pip3 with the appropriate python package manager on the system).
@ -37,6 +38,8 @@ Test cases are designed to run on Python 3.7+
### Run
0. Add keywords repo to PYTHONPATH `export PYTHONPATH=${PYTHONPATH}:~/neofs-keywords`
1. Execute the command `make run`
2. Logs will be available in the artifacts/ directory after tests with any of the statuses are completed.
@ -87,7 +90,7 @@ The following UserScenarios and testcases are available for execution:
* services
* http_gate.robot
* s3_gate.robot
## Generation of documentation

View file

@ -367,7 +367,6 @@ def container_existing(private_key: str, cid: str):
_find_cid(complProc.stdout, cid)
return
@keyword('Search object')
def search_object(private_key: str, cid: str, keys: str, bearer: str, filters: str,
expected_objects_list=[], options:str=""):

View file

@ -23,46 +23,6 @@ ROBOT_AUTO_KEYWORDS = False
NEOFS_CLI_EXEC = os.getenv('NEOFS_CLI_EXEC', 'neofs-cli')
NEOGO_CLI_EXEC = os.getenv('NEOGO_CLI_EXEC', 'neo-go')
@keyword('Init wallet')
def init_wallet():
if not os.path.exists(TEMP_DIR):
os.makedirs(TEMP_DIR)
filename = os.getcwd() + '/' + TEMP_DIR + str(uuid.uuid4()) + ".json"
cmd = f"{NEOGO_CLI_EXEC} wallet init -w {filename}"
logger.info(f"Executing command: {cmd}")
stdout = _run_sh(cmd)
logger.info(f"wallet init succeeded with output: {stdout}")
return filename
@keyword('Generate wallet from WIF')
def generate_wallet_from_wif(wallet: str, wif: str):
cmd = f"{NEOGO_CLI_EXEC} wallet import --wallet {wallet} --wif {wif}"
out = _run_sh_wallet_gen(cmd)
logger.info(f"Command completed with output: {out}")
@keyword('Generate wallet')
def generate_wallet(wallet: str):
cmd = f"{NEOGO_CLI_EXEC} wallet create -w {wallet}"
out = _run_sh_wallet_gen(cmd)
logger.info(f"Command completed with output: {out}")
@keyword('Dump Address')
def dump_address(wallet: str):
with open(wallet) as json_file:
data = json.load(json_file)
if len(data['accounts']) != 0:
return data['accounts'][0]['address']
else:
raise Exception("Can not get address.")
@keyword('Dump PrivKey')
def dump_privkey(wallet: str, address: str):
cmd = f"{NEOGO_CLI_EXEC} wallet export -w {wallet} --decrypt {address}"
logger.info(f"Executing command: {cmd}")
out = _run_sh_with_passwd('\r', cmd)
logger.info(f"Command completed with output: {out}")
return out
@keyword('Transfer Mainnet Gas')
def transfer_mainnet_gas(wallet: str, address: str, address_to: str, amount: int, wallet_pass:str=''):
cmd = (
@ -257,15 +217,6 @@ def _get_balance_request(privkey: str):
return output
def _run_sh(args):
complProc = subprocess.run(args, check=True, universal_newlines=True,
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
timeout=150, shell=True)
output, errors = complProc.stdout, complProc.stderr
if errors:
return errors
return output
def _run_sh_with_passwd(passwd, cmd):
p = pexpect.spawn(cmd)
p.expect(".*")
@ -275,20 +226,3 @@ def _run_sh_with_passwd(passwd, cmd):
# take a string with tx hash
tx_hash = p.read().splitlines()[-1]
return tx_hash.decode()
def _run_sh_wallet_gen(cmd):
'''
Internal method.
'''
logger.info(f"Executing command: {cmd}")
p = pexpect.spawn(cmd)
p.expect(".*")
p.sendline('\r')
p.expect(".*")
p.sendline('\r')
p.expect(".*")
p.sendline('\r')
p.wait()
out = p.read()
return out

View file

@ -1,3 +1,8 @@
*** Settings ***
Variables ../../../variables/common.py
Library ${KEYWORDS}/wallet.py
*** Variables ***
${RULE_FOR_ALL} = REP 2 IN X CBF 1 SELECT 4 FROM * AS X
@ -5,16 +10,9 @@ ${RULE_FOR_ALL} = REP 2 IN X CBF 1 SELECT 4 FROM * AS X
*** Keywords ***
Generate Keys
${WALLET} = Init wallet
Generate wallet ${WALLET}
${ADDR} = Dump Address ${WALLET}
${USER_KEY_GEN} = Dump PrivKey ${WALLET} ${ADDR}
${WALLET} ${ADDR} ${USER_KEY_GEN} = Init Wallet with Address ${TEMP_DIR}
${WALLET_OTH} ${ADDR_OTH} ${OTHER_KEY_GEN} = Init Wallet with Address ${TEMP_DIR}
${WALLET_OTH} = Init wallet
Generate wallet ${WALLET_OTH}
${ADDR_OTH} = Dump Address ${WALLET_OTH}
${OTHER_KEY_GEN} = Dump PrivKey ${WALLET_OTH} ${ADDR_OTH}
${SYSTEM_KEY_GEN} = Set Variable ${NEOFS_IR_WIF}
${SYSTEM_KEY_GEN_SN} = Set Variable ${NEOFS_SN_WIF}
@ -23,18 +21,18 @@ Generate Keys
Set Global Variable ${SYSTEM_KEY_IR} ${SYSTEM_KEY_GEN}
Set Global Variable ${SYSTEM_KEY_SN} ${SYSTEM_KEY_GEN_SN}
Payment Operations ${WALLET} ${ADDR} ${USER_KEY}
Payment Operations ${WALLET} ${ADDR} ${USER_KEY}
Payment Operations ${WALLET_OTH} ${ADDR_OTH} ${OTHER_KEY}
# Basic ACL manual page: https://neospcc.atlassian.net/wiki/spaces/NEOF/pages/362348545/NeoFS+ACL
# TODO: X - Sticky bit validation on public container
Payment Operations
[Arguments] ${WALLET} ${ADDR} ${KEY}
${TX} = Transfer Mainnet Gas wallets/wallet.json ${DEF_WALLET_ADDR} ${ADDR} 3
Wait Until Keyword Succeeds 1 min 15 sec
Wait Until Keyword Succeeds 1 min 15 sec
... Transaction accepted in block ${TX}
Get Transaction ${TX}
Expected Mainnet Balance ${ADDR} 3
@ -42,7 +40,7 @@ Payment Operations
${SCRIPT_HASH} = Get ScriptHash ${KEY}
${TX_DEPOSIT} = NeoFS Deposit ${WALLET} ${ADDR} ${SCRIPT_HASH} 2
Wait Until Keyword Succeeds 1 min 15 sec
Wait Until Keyword Succeeds 1 min 15 sec
... Transaction accepted in block ${TX_DEPOSIT}
Get Transaction ${TX_DEPOSIT}
@ -50,17 +48,17 @@ Payment Operations
Create Containers
# Create containers:
Log Create Private Container
Log Create Private Container
${PRIV_CID_GEN} = Create container ${USER_KEY} 0x18888888 ${RULE_FOR_ALL}
Container Existing ${USER_KEY} ${PRIV_CID_GEN}
Container Existing ${USER_KEY} ${PRIV_CID_GEN}
Log Create Public Container
${PUBLIC_CID_GEN} = Create container ${USER_KEY} 0x1FFFFFFF ${RULE_FOR_ALL}
Container Existing ${USER_KEY} ${PUBLIC_CID_GEN}
Container Existing ${USER_KEY} ${PUBLIC_CID_GEN}
Log Create Read-Only Container
Log Create Read-Only Container
${READONLY_CID_GEN} = Create container ${USER_KEY} 0x1FFF88FF ${RULE_FOR_ALL}
Container Existing ${USER_KEY} ${READONLY_CID_GEN}
Container Existing ${USER_KEY} ${READONLY_CID_GEN}
Set Global Variable ${PRIV_CID} ${PRIV_CID_GEN}
Set Global Variable ${PUBLIC_CID} ${PUBLIC_CID_GEN}

View file

@ -1,5 +1,9 @@
*** Variables ***
*** Settings ***
Variables ../../../variables/common.py
Library ${KEYWORDS}/wallet.py
*** Variables ***
${FILE_USR_HEADER} = key1=1,key2=abc
${FILE_USR_HEADER_DEL} = key1=del,key2=del
${FILE_OTH_HEADER} = key1=oth,key2=oth
@ -10,16 +14,9 @@ ${RULE_FOR_ALL} = REP 2 IN X CBF 1 SELECT 4 FROM * AS X
Generate Keys
# Generate new wallets
${WALLET} = Init wallet
Generate wallet ${WALLET}
${ADDR} = Dump Address ${WALLET}
${USER_KEY_GEN} = Dump PrivKey ${WALLET} ${ADDR}
${WALLET} ${ADDR} ${USER_KEY_GEN} = Init Wallet with Address ${TEMP_DIR}
${WALLET_OTH} ${ADDR_OTH} ${OTHER_KEY_GEN} = Init Wallet with Address ${TEMP_DIR}
${WALLET_OTH} = Init wallet
Generate wallet ${WALLET_OTH}
${ADDR_OTH} = Dump Address ${WALLET_OTH}
${OTHER_KEY_GEN} = Dump PrivKey ${WALLET_OTH} ${ADDR_OTH}
# Get pre-defined keys
${EACL_KEY_GEN} = Form WIF from String 782676b81a35c5f07325ec523e8521ee4946b6e5d4c6cd652dd0c3ba51ce03de
${SYSTEM_KEY_GEN} = Set Variable ${NEOFS_IR_WIF}
@ -32,15 +29,15 @@ Generate Keys
Set Global Variable ${SYSTEM_KEY_SN} ${SYSTEM_KEY_GEN_SN}
Set Global Variable ${EACL_KEY} ${EACL_KEY_GEN}
Payment Operations ${WALLET} ${ADDR} ${USER_KEY}
Payment Operations ${WALLET} ${ADDR} ${USER_KEY}
Payment Operations ${WALLET_OTH} ${ADDR_OTH} ${OTHER_KEY}
Payment Operations
[Arguments] ${WALLET} ${ADDR} ${KEY}
${TX} = Transfer Mainnet Gas wallets/wallet.json ${DEF_WALLET_ADDR} ${ADDR} 3
Wait Until Keyword Succeeds 1 min 15 sec
Wait Until Keyword Succeeds 1 min 15 sec
... Transaction accepted in block ${TX}
Get Transaction ${TX}
Expected Mainnet Balance ${ADDR} 3
@ -48,7 +45,7 @@ Payment Operations
${SCRIPT_HASH} = Get ScriptHash ${KEY}
${TX_DEPOSIT} = NeoFS Deposit ${WALLET} ${ADDR} ${SCRIPT_HASH} 2
Wait Until Keyword Succeeds 1 min 15 sec
Wait Until Keyword Succeeds 1 min 15 sec
... Transaction accepted in block ${TX_DEPOSIT}
Get Transaction ${TX_DEPOSIT}
@ -56,7 +53,7 @@ Payment Operations
Create Container Public
Log Create Public Container
${PUBLIC_CID_GEN} = Create container ${USER_KEY} 0x0FFFFFFF
[Return] ${PUBLIC_CID_GEN}
[Return] ${PUBLIC_CID_GEN}
Create Container Inaccessible
@ -67,10 +64,10 @@ Create Container Inaccessible
Generate file
[Arguments] ${SIZE}
${FILE_S_GEN} = Generate file of bytes ${SIZE}
Set Global Variable ${FILE_S} ${FILE_S_GEN}
Prepare eACL Role rules
Log Set eACL for different Role cases
@ -78,10 +75,10 @@ Prepare eACL Role rules
# eACL rules for all operations and similar permissions
@{Roles} = Create List OTHERS USER SYSTEM
FOR ${role} IN @{Roles}
${rule1} = Create Dictionary Operation=GET Access=DENY Role=${role}
${rule2} = Create Dictionary Operation=HEAD Access=DENY Role=${role}
${rule3} = Create Dictionary Operation=PUT Access=DENY Role=${role}
${rule4} = Create Dictionary Operation=DELETE Access=DENY Role=${role}
${rule1} = Create Dictionary Operation=GET Access=DENY Role=${role}
${rule2} = Create Dictionary Operation=HEAD Access=DENY Role=${role}
${rule3} = Create Dictionary Operation=PUT Access=DENY Role=${role}
${rule4} = Create Dictionary Operation=DELETE Access=DENY Role=${role}
${rule5} = Create Dictionary Operation=SEARCH Access=DENY Role=${role}
${rule6} = Create Dictionary Operation=GETRANGE Access=DENY Role=${role}
${rule7} = Create Dictionary Operation=GETRANGEHASH Access=DENY Role=${role}
@ -89,4 +86,4 @@ Prepare eACL Role rules
${eACL_gen} = Create List ${rule1} ${rule2} ${rule3} ${rule4} ${rule5} ${rule6} ${rule7}
Form eACL json common file gen_eacl_deny_all_${role} ${eACL_gen}
Set Global Variable ${EACL_DENY_ALL_${role}} gen_eacl_deny_all_${role}
END
END

View file

@ -1,3 +1,8 @@
*** Settings ***
Variables ../../../variables/common.py
Library ${KEYWORDS}/wallet.py
*** Variables ***
${FILE_USR_HEADER} = key1=1,key2=abc
${FILE_USR_HEADER_DEL} = key1=del,key2=del
@ -7,16 +12,9 @@ ${RULE_FOR_ALL} = REP 2 IN X CBF 1 SELECT 4 FROM * AS X
*** Keywords ***
Generate Keys
${WALLET} = Init wallet
Generate wallet ${WALLET}
${ADDR} = Dump Address ${WALLET}
${USER_KEY_GEN} = Dump PrivKey ${WALLET} ${ADDR}
${WALLET} ${ADDR} ${USER_KEY_GEN} = Init Wallet with Address ${TEMP_DIR}
${WALLET_OTH} ${ADDR_OTH} ${OTHER_KEY_GEN} = Init Wallet with Address ${TEMP_DIR}
${WALLET_OTH} = Init wallet
Generate wallet ${WALLET_OTH}
${ADDR_OTH} = Dump Address ${WALLET_OTH}
${OTHER_KEY_GEN} = Dump PrivKey ${WALLET_OTH} ${ADDR_OTH}
${EACL_KEY_GEN} = Form WIF from String 782676b81a35c5f07325ec523e8521ee4946b6e5d4c6cd652dd0c3ba51ce03de
${SYSTEM_KEY_GEN} = Set Variable ${NEOFS_IR_WIF}
@ -28,16 +26,16 @@ Generate Keys
Set Global Variable ${SYSTEM_KEY_SN} ${SYSTEM_KEY_GEN_SN}
Set Global Variable ${EACL_KEY} ${EACL_KEY_GEN}
Payment Operations ${WALLET} ${ADDR} ${USER_KEY}
Payment Operations ${WALLET} ${ADDR} ${USER_KEY}
Payment Operations ${WALLET_OTH} ${ADDR_OTH} ${OTHER_KEY}
Payment Operations
[Arguments] ${WALLET} ${ADDR} ${KEY}
${TX} = Transfer Mainnet Gas wallets/wallet.json ${DEF_WALLET_ADDR} ${ADDR} 3
Wait Until Keyword Succeeds 1 min 15 sec
Wait Until Keyword Succeeds 1 min 15 sec
... Transaction accepted in block ${TX}
Get Transaction ${TX}
Expected Mainnet Balance ${ADDR} 3
@ -45,7 +43,7 @@ Payment Operations
${SCRIPT_HASH} = Get ScriptHash ${KEY}
${TX_DEPOSIT} = NeoFS Deposit ${WALLET} ${ADDR} ${SCRIPT_HASH} 2
Wait Until Keyword Succeeds 1 min 15 sec
Wait Until Keyword Succeeds 1 min 15 sec
... Transaction accepted in block ${TX_DEPOSIT}
Get Transaction ${TX_DEPOSIT}
@ -54,15 +52,15 @@ Create Container Public
Log Create Public Container
${PUBLIC_CID_GEN} = Create container ${USER_KEY} 0x4FFFFFFF ${RULE_FOR_ALL}
[Return] ${PUBLIC_CID_GEN}
Generate files
[Arguments] ${SIZE}
${FILE_S_GEN_1} = Generate file of bytes ${SIZE}
${FILE_S_GEN_2} = Generate file of bytes ${SIZE}
Set Global Variable ${FILE_S} ${FILE_S_GEN_1}
Set Global Variable ${FILE_S_2} ${FILE_S_GEN_2}
Prepare eACL Role rules
Log Set eACL for different Role cases
@ -70,10 +68,10 @@ Prepare eACL Role rules
# eACL rules for all operations and similar permissions
@{Roles} = Create List OTHERS USER SYSTEM
FOR ${role} IN @{Roles}
${rule1}= Create Dictionary Operation=GET Access=DENY Role=${role}
${rule2}= Create Dictionary Operation=HEAD Access=DENY Role=${role}
${rule3}= Create Dictionary Operation=PUT Access=DENY Role=${role}
${rule4}= Create Dictionary Operation=DELETE Access=DENY Role=${role}
${rule1}= Create Dictionary Operation=GET Access=DENY Role=${role}
${rule2}= Create Dictionary Operation=HEAD Access=DENY Role=${role}
${rule3}= Create Dictionary Operation=PUT Access=DENY Role=${role}
${rule4}= Create Dictionary Operation=DELETE Access=DENY Role=${role}
${rule5}= Create Dictionary Operation=SEARCH Access=DENY Role=${role}
${rule6}= Create Dictionary Operation=GETRANGE Access=DENY Role=${role}
${rule7}= Create Dictionary Operation=GETRANGEHASH Access=DENY Role=${role}
@ -84,10 +82,10 @@ Prepare eACL Role rules
FOR ${role} IN @{Roles}
${rule1}= Create Dictionary Operation=GET Access=ALLOW Role=${role}
${rule2}= Create Dictionary Operation=HEAD Access=ALLOW Role=${role}
${rule3}= Create Dictionary Operation=PUT Access=ALLOW Role=${role}
${rule4}= Create Dictionary Operation=DELETE Access=ALLOW Role=${role}
${rule1}= Create Dictionary Operation=GET Access=ALLOW Role=${role}
${rule2}= Create Dictionary Operation=HEAD Access=ALLOW Role=${role}
${rule3}= Create Dictionary Operation=PUT Access=ALLOW Role=${role}
${rule4}= Create Dictionary Operation=DELETE Access=ALLOW Role=${role}
${rule5}= Create Dictionary Operation=SEARCH Access=ALLOW Role=${role}
${rule6}= Create Dictionary Operation=GETRANGE Access=ALLOW Role=${role}
${rule7}= Create Dictionary Operation=GETRANGEHASH Access=ALLOW Role=${role}
@ -97,17 +95,17 @@ Prepare eACL Role rules
END
${rule1}= Create Dictionary Operation=GET Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule2}= Create Dictionary Operation=HEAD Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule3}= Create Dictionary Operation=PUT Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule4}= Create Dictionary Operation=DELETE Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule5}= Create Dictionary Operation=SEARCH Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule6}= Create Dictionary Operation=GETRANGE Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule7}= Create Dictionary Operation=GETRANGEHASH Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule1}= Create Dictionary Operation=GET Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule2}= Create Dictionary Operation=HEAD Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule3}= Create Dictionary Operation=PUT Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule4}= Create Dictionary Operation=DELETE Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule5}= Create Dictionary Operation=SEARCH Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule6}= Create Dictionary Operation=GETRANGE Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule7}= Create Dictionary Operation=GETRANGEHASH Access=ALLOW Role=A9tDy6Ye+UimXCCzJrlAmRE0FDZHjf3XRyya9rELtgAA
${rule8}= Create Dictionary Operation=GET Access=DENY Role=OTHERS
${rule9}= Create Dictionary Operation=HEAD Access=DENY Role=OTHERS
${rule10}= Create Dictionary Operation=PUT Access=DENY Role=OTHERS
${rule11}= Create Dictionary Operation=DELETE Access=DENY Role=OTHERS
${rule10}= Create Dictionary Operation=PUT Access=DENY Role=OTHERS
${rule11}= Create Dictionary Operation=DELETE Access=DENY Role=OTHERS
${rule12}= Create Dictionary Operation=SEARCH Access=DENY Role=OTHERS
${rule13}= Create Dictionary Operation=GETRANGE Access=DENY Role=OTHERS
${rule14}= Create Dictionary Operation=GETRANGEHASH Access=DENY Role=OTHERS
@ -119,22 +117,22 @@ Prepare eACL Role rules
Set Global Variable ${EACL_DENY_ALL_OTHER} gen_eacl_deny_all_OTHERS
Set Global Variable ${EACL_ALLOW_ALL_OTHER} gen_eacl_allow_all_OTHERS
Set Global Variable ${EACL_DENY_ALL_USER} gen_eacl_deny_all_USER
Set Global Variable ${EACL_ALLOW_ALL_USER} gen_eacl_allow_all_USER
Set Global Variable ${EACL_DENY_ALL_SYSTEM} gen_eacl_deny_all_SYSTEM
Set Global Variable ${EACL_ALLOW_ALL_SYSTEM} gen_eacl_allow_all_SYSTEM
Set Global Variable ${EACL_ALLOW_ALL_Pubkey} gen_eacl_allow_pubkey_deny_OTHERS
# eACL rules for Compound operations: GET/GetRange/GetRangeHash
@{Roles} = Create List OTHERS USER SYSTEM
FOR ${role} IN @{Roles}
${rule1}= Create Dictionary Operation=GET Access=ALLOW Role=${role}
${rule2}= Create Dictionary Operation=GETRANGE Access=ALLOW Role=${role}
${rule3}= Create Dictionary Operation=GETRANGEHASH Access=ALLOW Role=${role}
${rule1}= Create Dictionary Operation=GET Access=ALLOW Role=${role}
${rule2}= Create Dictionary Operation=GETRANGE Access=ALLOW Role=${role}
${rule3}= Create Dictionary Operation=GETRANGEHASH Access=ALLOW Role=${role}
${rule4}= Create Dictionary Operation=HEAD Access=DENY Role=${role}
${eACL_gen}= Create List ${rule1} ${rule2} ${rule3} ${rule4}
Form eACL json common file gen_eacl_compound_get_${role} ${eACL_gen}
@ -144,10 +142,10 @@ Prepare eACL Role rules
# eACL rules for Compound operations: DELETE
@{Roles} = Create List OTHERS USER SYSTEM
FOR ${role} IN @{Roles}
${rule1}= Create Dictionary Operation=DELETE Access=ALLOW Role=${role}
${rule2}= Create Dictionary Operation=PUT Access=DENY Role=${role}
${rule3}= Create Dictionary Operation=HEAD Access=DENY Role=${role}
${eACL_gen}= Create List ${rule1} ${rule2} ${rule3}
${rule1}= Create Dictionary Operation=DELETE Access=ALLOW Role=${role}
${rule2}= Create Dictionary Operation=PUT Access=DENY Role=${role}
${rule3}= Create Dictionary Operation=HEAD Access=DENY Role=${role}
${eACL_gen}= Create List ${rule1} ${rule2} ${rule3}
Form eACL json common file gen_eacl_compound_del_${role} ${eACL_gen}
Set Global Variable ${EACL_COMPOUND_DELETE_${role}} gen_eacl_compound_del_${role}
END
@ -155,10 +153,10 @@ Prepare eACL Role rules
# eACL rules for Compound operations: GETRANGEHASH
@{Roles} = Create List OTHERS USER SYSTEM
FOR ${role} IN @{Roles}
${rule1}= Create Dictionary Operation=GETRANGEHASH Access=ALLOW Role=${role}
${rule2}= Create Dictionary Operation=GETRANGE Access=DENY Role=${role}
${rule3}= Create Dictionary Operation=GET Access=DENY Role=${role}
${eACL_gen}= Create List ${rule1} ${rule2} ${rule3}
${rule1}= Create Dictionary Operation=GETRANGEHASH Access=ALLOW Role=${role}
${rule2}= Create Dictionary Operation=GETRANGE Access=DENY Role=${role}
${rule3}= Create Dictionary Operation=GET Access=DENY Role=${role}
${eACL_gen}= Create List ${rule1} ${rule2} ${rule3}
Form eACL json common file gen_eacl_compound_get_hash_${role} ${eACL_gen}
Set Global Variable ${EACL_COMPOUND_GET_HASH_${role}} gen_eacl_compound_get_hash_${role}
END
@ -191,13 +189,13 @@ Prepare eACL Role rules
${rule5}= Create Dictionary Operation=SEARCH Access=ALLOW Role=OTHERS Filters=${filters}
${rule6}= Create Dictionary Operation=GETRANGE Access=ALLOW Role=OTHERS Filters=${filters}
${rule7}= Create Dictionary Operation=GETRANGEHASH Access=ALLOW Role=OTHERS Filters=${filters}
${rule8}= Create Dictionary Operation=GET Access=DENY Role=OTHERS
${rule9}= Create Dictionary Operation=HEAD Access=DENY Role=OTHERS
${rule10}= Create Dictionary Operation=PUT Access=DENY Role=OTHERS
${rule11}= Create Dictionary Operation=DELETE Access=DENY Role=OTHERS
${rule12}= Create Dictionary Operation=SEARCH Access=DENY Role=OTHERS
${rule13}= Create Dictionary Operation=GETRANGE Access=DENY Role=OTHERS
${rule14}= Create Dictionary Operation=GETRANGEHASH Access=DENY Role=OTHERS
${rule8}= Create Dictionary Operation=GET Access=DENY Role=OTHERS
${rule9}= Create Dictionary Operation=HEAD Access=DENY Role=OTHERS
${rule10}= Create Dictionary Operation=PUT Access=DENY Role=OTHERS
${rule11}= Create Dictionary Operation=DELETE Access=DENY Role=OTHERS
${rule12}= Create Dictionary Operation=SEARCH Access=DENY Role=OTHERS
${rule13}= Create Dictionary Operation=GETRANGE Access=DENY Role=OTHERS
${rule14}= Create Dictionary Operation=GETRANGEHASH Access=DENY Role=OTHERS
${eACL_gen}= Create List ${rule1} ${rule2} ${rule3} ${rule4} ${rule5} ${rule6} ${rule7}
... ${rule8} ${rule9} ${rule10} ${rule11} ${rule12} ${rule13} ${rule14}
Form eACL json common file gen_eacl_xheader_allow_all ${eACL_gen}
@ -209,16 +207,16 @@ Check eACL Deny and Allow All
[Arguments] ${KEY} ${DENY_EACL} ${ALLOW_EACL}
${CID} = Create Container Public
${S_OID_USER} = Put object ${USER_KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_USR_HEADER}
${D_OID_USER} = Put object ${USER_KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_USR_HEADER_DEL}
${S_OID_USER} = Put object ${USER_KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_USR_HEADER}
${D_OID_USER} = Put object ${USER_KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_USR_HEADER_DEL}
@{S_OBJ_H} = Create List ${S_OID_USER}
Put object ${KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_OTH_HEADER}
Put object ${KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_OTH_HEADER}
Get object ${KEY} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl
Search object ${KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} ${S_OBJ_H}
Head object ${KEY} ${CID} ${S_OID_USER} ${EMPTY}
Search object ${KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} ${S_OBJ_H}
Head object ${KEY} ${CID} ${S_OID_USER} ${EMPTY}
Get Range ${KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256
Get Range Hash ${KEY} ${CID} ${S_OID_USER} ${EMPTY} 0:256
Delete object ${KEY} ${CID} ${D_OID_USER} ${EMPTY}
@ -229,13 +227,13 @@ Check eACL Deny and Allow All
Sleep ${NEOFS_CONTRACT_CACHE_TIMEOUT}
Run Keyword And Expect Error *
... Put object ${KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_USR_HEADER}
... Put object ${KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_USR_HEADER}
Run Keyword And Expect Error *
... Get object ${KEY} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl
Run Keyword And Expect Error *
... Search object ${KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} ${S_OBJ_H}
... Search object ${KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} ${S_OBJ_H}
Run Keyword And Expect Error *
... Head object ${KEY} ${CID} ${S_OID_USER} ${EMPTY}
... Head object ${KEY} ${CID} ${S_OID_USER} ${EMPTY}
Run Keyword And Expect Error *
... Get Range ${KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256
Run Keyword And Expect Error *
@ -247,11 +245,11 @@ Check eACL Deny and Allow All
# The current ACL cache lifetime is 30 sec
Sleep ${NEOFS_CONTRACT_CACHE_TIMEOUT}
Put object ${KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_OTH_HEADER}
Put object ${KEY} ${FILE_S} ${CID} ${EMPTY} ${FILE_OTH_HEADER}
Get object ${KEY} ${CID} ${S_OID_USER} ${EMPTY} local_file_eacl
Search object ${KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} ${S_OBJ_H}
Head object ${KEY} ${CID} ${S_OID_USER} ${EMPTY}
Search object ${KEY} ${CID} ${EMPTY} ${EMPTY} ${FILE_USR_HEADER} ${S_OBJ_H}
Head object ${KEY} ${CID} ${S_OID_USER} ${EMPTY}
Get Range ${KEY} ${CID} ${S_OID_USER} s_get_range ${EMPTY} 0:256
Get Range Hash ${KEY} ${CID} ${S_OID_USER} ${EMPTY} 0:256
Delete object ${KEY} ${CID} ${S_OID_USER} ${EMPTY}

View file

@ -3,6 +3,7 @@ Variables ../../../variables/common.py
Library ../${RESOURCES}/neofs.py
Library ../${RESOURCES}/payment_neogo.py
Library ${KEYWORDS}/wallet.py
Library ../${RESOURCES}/utility_keywords.py
@ -73,16 +74,10 @@ Generate file
Set Global Variable ${FILE} ${FILE}
Generate Key and Pre-payment
${WALLET} = Init wallet
Generate wallet ${WALLET}
${ADDR} = Dump Address ${WALLET}
${USER_KEY_GEN} = Dump PrivKey ${WALLET} ${ADDR}
${WALLET} ${ADDR} ${USER_KEY_GEN} = Init Wallet with Address ${TEMP_DIR}
Set Global Variable ${PRIV_KEY} ${USER_KEY_GEN}
Payment Operations ${WALLET} ${ADDR} ${PRIV_KEY}
Payment Operations
[Arguments] ${WALLET} ${ADDR} ${KEY}

View file

@ -3,6 +3,7 @@ Variables ../../../variables/common.py
Library ../${RESOURCES}/neofs.py
Library ../${RESOURCES}/payment_neogo.py
Library ${KEYWORDS}/wallet.py
Library ../${RESOURCES}/utility_keywords.py
*** Test cases ***
@ -13,11 +14,7 @@ NeoFS Object Replication
[Setup] Create Temporary Directory
${WALLET} = Init wallet
Generate wallet ${WALLET}
${ADDR} = Dump Address ${WALLET}
${PRIV_KEY} = Dump PrivKey ${WALLET} ${ADDR}
${WALLET} ${ADDR} ${PRIV_KEY} = Init Wallet with Address ${TEMP_DIR}
${TX} = Transfer Mainnet Gas wallets/wallet.json ${DEF_WALLET_ADDR} ${ADDR} 11
Wait Until Keyword Succeeds 1 min 15 sec
... Transaction accepted in block ${TX}

View file

@ -1,3 +1,8 @@
*** Settings ***
Variables ../../../variables/common.py
Library ${KEYWORDS}/wallet.py
*** Variables ***
${FILE_USR_HEADER} = key1=1,key2=abc
${FILE_USR_HEADER_OTH} = key1=2
@ -8,25 +13,22 @@ ${DEPOSIT_AMOUNT} = 10
*** Keywords ***
Payment operations
${WALLET} = Init wallet
Generate wallet ${WALLET}
${ADDR} = Dump Address ${WALLET}
${PRIV_KEY} = Dump PrivKey ${WALLET} ${ADDR}
${WALLET} ${ADDR} ${PRIV_KEY} = Init Wallet with Address ${TEMP_DIR}
${TX} = Transfer Mainnet Gas ${MAINNET_WALLET_PATH} ${DEF_WALLET_ADDR} ${ADDR} ${TRANSFER_AMOUNT}
Wait Until Keyword Succeeds ${BASENET_WAIT_TIME} ${BASENET_BLOCK_TIME}
Wait Until Keyword Succeeds ${BASENET_WAIT_TIME} ${BASENET_BLOCK_TIME}
... Transaction accepted in block ${TX}
Get Transaction ${TX}
Expected Mainnet Balance ${ADDR} ${TRANSFER_AMOUNT}
${SCRIPT_HASH} = Get ScriptHash ${PRIV_KEY}
${SCRIPT_HASH} = Get ScriptHash ${PRIV_KEY}
${TX_DEPOSIT} = NeoFS Deposit ${WALLET} ${ADDR} ${SCRIPT_HASH} ${DEPOSIT_AMOUNT}
Wait Until Keyword Succeeds ${BASENET_WAIT_TIME} ${BASENET_BLOCK_TIME}
Wait Until Keyword Succeeds ${BASENET_WAIT_TIME} ${BASENET_BLOCK_TIME}
... Transaction accepted in block ${TX_DEPOSIT}
Get Transaction ${TX_DEPOSIT}
${BALANCE} = Wait Until Keyword Succeeds ${NEOFS_EPOCH_TIMEOUT} ${MORPH_BLOCK_TIME}
${BALANCE} = Wait Until Keyword Succeeds ${NEOFS_EPOCH_TIMEOUT} ${MORPH_BLOCK_TIME}
... Expected Balance ${PRIV_KEY} 0 ${DEPOSIT_AMOUNT}
Set Global Variable ${PRIV_KEY} ${PRIV_KEY}
@ -36,9 +38,9 @@ Payment operations
Prepare container
${CID} = Create container ${PRIV_KEY}
Container Existing ${PRIV_KEY} ${CID}
Wait Until Keyword Succeeds ${NEOFS_EPOCH_TIMEOUT} ${MORPH_BLOCK_TIME}
... Expected Balance ${PRIV_KEY} ${DEPOSIT_AMOUNT} ${NEOFS_CREATE_CONTAINER_GAS_FEE}
Set Global Variable ${CID} ${CID}

View file

@ -3,6 +3,7 @@ Variables ../../../variables/common.py
Library ../${RESOURCES}/neofs.py
Library ../${RESOURCES}/payment_neogo.py
Library ${KEYWORDS}/wallet.py
Library ../${RESOURCES}/utility_keywords.py
*** Variables ***
@ -17,11 +18,7 @@ NeoFS Deposit and Withdraw
[Setup] Create Temporary Directory
${WALLET} = Init wallet
Generate wallet ${WALLET}
${ADDR} = Dump Address ${WALLET}
${PRIV_KEY} = Dump PrivKey ${WALLET} ${ADDR}
${WALLET} ${ADDR} ${PRIV_KEY} = Init Wallet with Address ${TEMP_DIR}
${TX} = Transfer Mainnet Gas wallets/wallet.json ${DEF_WALLET_ADDR} ${ADDR} 15
Wait Until Keyword Succeeds 1 min 15 sec
... Transaction accepted in block ${TX}

View file

@ -1,8 +1,11 @@
*** Settings ***
Variables ../../../variables/common.py
<<<<<<< HEAD
Library ../${RESOURCES}/neofs.py
Library ../${RESOURCES}/payment_neogo.py
Library ../${RESOURCES}/gates.py
Library ${KEYWORDS}/wallet.py
Library ../${RESOURCES}/utility_keywords.py
@ -13,11 +16,7 @@ NeoFS HTTP Gateway
[Timeout] 5 min
[Setup] Create Temporary Directory
${WALLET} = Init wallet
Generate wallet ${WALLET}
${ADDR} = Dump Address ${WALLET}
${PRIV_KEY} = Dump PrivKey ${WALLET} ${ADDR}
${WALLET} ${ADDR} ${PRIV_KEY} = Init Wallet with Address ${TEMP_DIR}
${TX} = Transfer Mainnet Gas wallets/wallet.json ${DEF_WALLET_ADDR} ${ADDR} 6
Wait Until Keyword Succeeds 1 min 15 sec

View file

@ -4,6 +4,7 @@ Library Collections
Library ../${RESOURCES}/neofs.py
Library ../${RESOURCES}/payment_neogo.py
Library ../${RESOURCES}/gates.py
Library ${KEYWORDS}/wallet.py
Library ../${RESOURCES}/utility_keywords.py
@ -15,13 +16,8 @@ NeoFS S3 Gateway
[Setup] Create Temporary Directory
${PRIV_KEY} = Form WIF from String 1dd37fba80fec4e6a6f13fd708d8dcb3b29def768017052f6c930fa1c5d90bbb
${WALLET} = Init wallet
Generate wallet from WIF ${WALLET} ${PRIV_KEY}
${ADDR} = Dump Address ${WALLET}
Dump PrivKey ${WALLET} ${ADDR}
${SCRIPT_HASH} = Get ScriptHash ${PRIV_KEY}
${WALLET} ${ADDR} = Init Wallet from WIF ${TEMP_DIR} ${PRIV_KEY}
${SCRIPT_HASH} = Get ScriptHash ${PRIV_KEY}
${TX_DEPOSIT} = NeoFS Deposit ${WALLET} ${ADDR} ${SCRIPT_HASH} 5
Wait Until Keyword Succeeds 1 min 15 sec
... Transaction accepted in block ${TX_DEPOSIT}

View file

@ -4,6 +4,7 @@ ROOT='../..'
RESOURCES="%s/resources/lib" % ROOT
CERT="%s/../../ca" % ROOT
KEYWORDS="%s/../../../neofs-keywords/" % ROOT
# path from repo root is required for object put and get
# in case when test is run from root in docker
@ -15,9 +16,9 @@ NEOFS_CONTRACT_DEPOSIT_GAS_FEE = os.getenv("NEOFS_CONTRACT_DEPOSIT_GAS_FEE", "0.
NEOFS_CONTRACT_WITHDRAW_GAS_FEE = os.getenv("NEOFS_CONTRACT_WITHDRAW_GAS_FEE", "0.0382514")
NEOFS_CREATE_CONTAINER_GAS_FEE = os.getenv("NEOFS_CREATE_CONTAINER_GAS_FEE", "-1e-08")
# NEOFS_EPOCH_TIMEOUT can be declared from neofs-dev-env env variables as NEOFS_IR_TIMERS_EPOCH
# NEOFS_EPOCH_TIMEOUT can be declared from neofs-dev-env env variables as NEOFS_IR_TIMERS_EPOCH
# (high priority is accepted for env as NEOFS_EPOCH_TIMEOUT)
NEOFS_EPOCH_TIMEOUT = (os.getenv("NEOFS_EPOCH_TIMEOUT") if os.getenv("NEOFS_EPOCH_TIMEOUT")
NEOFS_EPOCH_TIMEOUT = (os.getenv("NEOFS_EPOCH_TIMEOUT") if os.getenv("NEOFS_EPOCH_TIMEOUT")
else os.getenv("NEOFS_IR_TIMERS_EPOCH", "300s"))
BASENET_BLOCK_TIME = os.getenv('BASENET_BLOCK_TIME', "15s")
@ -32,12 +33,12 @@ COMPLEX_OBJ_SIZE = os.getenv("COMPLEX_OBJ_SIZE", "70000000")
NEOFS_ENDPOINT = os.getenv("NEOFS_ENDPOINT", "s01.neofs.devenv:8080")
NEOGO_CLI_PREFIX = os.getenv("NEOGO_CLI_PREFIX", "docker exec -it main_chain neo-go")
# NEO_MAINNET_ENDPOINT can be declared from neofs-dev-env env variables as NEOFS_IR_MAINNET_ENDPOINT_CLIENT
# NEO_MAINNET_ENDPOINT can be declared from neofs-dev-env env variables as NEOFS_IR_MAINNET_ENDPOINT_CLIENT
# (high priority is accepted for env as NEO_MAINNET_ENDPOINT)
NEO_MAINNET_ENDPOINT = (os.getenv("NEO_MAINNET_ENDPOINT") if os.getenv("NEO_MAINNET_ENDPOINT")
else os.getenv("NEOFS_IR_MAINNET_ENDPOINT_CLIENT", 'http://main_chain.neofs.devenv:30333'))
# NEOFS_NEO_API_ENDPOINT can be declared from neofs-dev-env env variables as NEOFS_IR_MORPH_ENDPOINT_CLIENT
# NEOFS_NEO_API_ENDPOINT can be declared from neofs-dev-env env variables as NEOFS_IR_MORPH_ENDPOINT_CLIENT
# (high priority is accepted for env as NEOFS_NEO_API_ENDPOINT)
NEOFS_NEO_API_ENDPOINT = (os.getenv("NEOFS_NEO_API_ENDPOINT") if os.getenv("NEOFS_NEO_API_ENDPOINT")
else os.getenv("NEOFS_IR_MORPH_ENDPOINT_CLIENT", 'http://morph_chain.neofs.devenv:30333'))
@ -47,9 +48,9 @@ S3_GATE = os.getenv("S3_GATE", 'https://s3.neofs.devenv:8080')
NEOFS_NETMAP = os.getenv("NEOFS_NETMAP", ['s01.neofs.devenv:8080', 's02.neofs.devenv:8080','s03.neofs.devenv:8080','s04.neofs.devenv:8080'])
GAS_HASH = os.getenv("GAS_HASH", '0xd2a4cff31913016155e38e474a2c06d08be276cf')
# NEOFS_CONTRACT can be declared from neofs-dev-env env variables as NEOFS_IR_CONTRACTS_NEOFS
# NEOFS_CONTRACT can be declared from neofs-dev-env env variables as NEOFS_IR_CONTRACTS_NEOFS
# (high priority is accepted for env as NEOFS_CONTRACT)
NEOFS_CONTRACT = (os.getenv("NEOFS_CONTRACT") if os.getenv("NEOFS_CONTRACT")
NEOFS_CONTRACT = (os.getenv("NEOFS_CONTRACT") if os.getenv("NEOFS_CONTRACT")
else os.getenv("NEOFS_IR_CONTRACTS_NEOFS", 'cfe89912c457754b7eb1f89781dc74bb3e0070bf'))
TEMP_DIR = os.getenv("TEMP_DIR", "TemporaryDir/")
TEMP_DIR = os.getenv("TEMP_DIR", "TemporaryDir/")