Merge "Rename SDNC Docker Images"
[integration.git] / test / csit / tests / common.robot
1 #Robot functions that will be shared also with other tests
2
3 *** Keywords ***
4 json_from_file
5 #Robot function to extract the json object from a file
6     [Arguments]    ${file_path}
7     ${json_file}=    Get file    ${file_path}
8     ${json_object}=    Evaluate    json.loads('''${json_file}''')    json
9     [return]    ${json_object}
10
11 string_from_json
12 #Robot function to transform the json object to a string
13     [Arguments]    ${json_value}
14     ${json_string}=   Stringify Json     ${json_value}
15     [return]    ${json_string}
16
17 random_ip
18 #Robot function to generate a random IP
19     [Arguments]
20     ${numbers}=    Evaluate    random.sample([x for x in range(1, 256)], 4)    random
21     ${generated_ip}=    Catenate    ${numbers[0]}.${numbers[1]}.${numbers[2]}.${numbers[3]}
22     [return]    ${generated_ip}