<commit_before>*** Settings ***
Suite Setup    Set CLI ENV ready
Suite Teardown    Close All Connections
Resource    ./common/assets/secrets.txt
Resource    ./common/assets/resource.txt
Resource    local_resource.txt
#Library    NovaClient
Library    SSHLibrary
Library    OperatingSystem

*** Variables ***
${USERNAME}     debian
${ID_RSA}    /home/user/.ssh/id_rsa
${KEYRING_PASS}    ${EMPTY}
#${PASSWORD}    ${VALID_PASSWORD}
#${HOST}     support-test.forgeservicelab.fi
${HOST}      192.168.127.12
${FLAVOR}    m1.tiny 
${TENANT}    Digile.Devel
${IMAGE_NAME}    image_name

*** Test Cases ***

Run-Keyword-If
    Run Keyword If    '${FLAVOR}' == 'm1.tiny'     test_m1_tiny
    Run Keyword If    '${FLAVOR}' == 'm1.small'     test_m1_small
    Run Keyword If    '${FLAVOR}' == 'm1.medium'     test_m1_medium
    Run Keyword If    '${FLAVOR}' == 'm1.large'     test_m1_large
    Run Keyword If    '${FLAVOR}' == 'm1.xlarge'     test_m1_xlarge

*** Keywords ***
test_m1_tiny
    Open Connection    ${HOST}
    Login With Public Key    ${username}    ${ID_RSA}    ${KEYRING_PASS}
    Log    CPU(s)
    ${output}    Execute Command    lscpu | grep 'CPU(s):' | grep -v NUMA
    Should Match Regexp     ${output}    ^CPU\\(s\\):\\s+1.*$
    Log    Memory
    ${output}    Execute Command    free -mh | grep Mem
    Should Match Regexp     ${output}    ^Mem:\\s+(?:1\\.0G|9\\d{2}M).*$
    Log    DISK
    ${output}    Execute Command    df -h | grep /dev/.da1
    Should Match Regexp     ${output}    ^/dev/.da1\\s+9.\\dG.*$
    Log    Reached this point despite of error
#   LOGIN TO HORIZON AND CHECK LOGS
    Login to OpenStack
    Wait Until Page Contains   Instances
    Click Element    css=h3
    Click Link    ${TENANT}
    Click Link    Instances
    Click Link    ${IMAGE_NAME}
    Click Link    Log
    Wait Until Page Contains    Instance Console Log
    ${LOGI}    Get Text     css=pre.logs
    ${LEN}    Get Length    ${LOGI}
    ${VALI}    Set Variable If     ${LEN} > 100    OK    NOK
    Should Be Equal    OK    ${VALI}    Console Log not present
    Click Link    Sign Out
    Close All Browsers
test_m1_small
    Open Connection    ${HOST}
    Login With Public Key    ${username}    ${ID_RSA}    ${KEYRING_PASS}
    Log    CPU(s)
    ${output}    Execute Command    lscpu | grep 'CPU(s):' | grep -v NUMA
    Should Match Regexp     ${output}    ^CPU\\(s\\):\\s+1.*$
    Log    Memory
    ${output}    Execute Command    free -mh | grep Mem
    Should Match Regexp     ${output}    ^Mem:\\s+2\\.0G.*$
    Log    DISK
    ${output}    Execute Command    df -h | grep /dev/.da1
    Should Match Regexp     ${output}    ^/dev/.da1\\s+9.\\dG.*$
    Log    Reached this point despite of error
#   LOGIN TO HORIZON AND CHECK LOGS
    Login to OpenStack
    Wait Until Page Contains   Instances
    Click Element    css=h3
    Click Link    ${TENANT}
    Click Link    Instances
    Click Link    ${IMAGE_NAME}
    Click Link    Log
    Wait Until Page Contains    Instance Console Log
    ${LOGI}    Get Text     css=pre.logs
    ${LEN}    Get Length    ${LOGI}
    ${VALI}    Set Variable If     ${LEN} > 100    OK    NOK
    Should Be Equal    OK    ${VALI}    Console Log not present
    Click Link    Sign Out
    Close All Browsers
test_m1_medium
    Open Connection    ${HOST}
    Login With Public Key    ${username}    ${ID_RSA}    ${KEYRING_PASS}
    Log    CPU(s)
    ${output}    Execute Command    lscpu | grep 'CPU(s):' | grep -v NUMA
    Should Match Regexp     ${output}    ^CPU\\(s\\):\\s+2.*$
    Log    Memory
    ${output}    Execute Command    free -mh | grep Mem
    Should Match Regexp     ${output}    ^Mem:\\s+3\\.9G.*$
    Log    DISK
    ${output}    Execute Command    df -h | grep /dev/.da1
    Should Match Regexp     ${output}    ^/dev/.da1\\s+20G.*$
    Log    Reached this point despite of error
#   LOGIN TO HORIZON AND CHECK LOGS
    Login to OpenStack
    Wait Until Page Contains   Instances
    Click Element    css=h3
    Click Link    ${TENANT}
    Click Link    Instances
    Click Link    ${IMAGE_NAME}
    Click Link    Log
    Wait Until Page Contains    Instance Console Log
    ${LOGI}    Get Text     css=pre.logs
    ${LEN}    Get Length    ${LOGI}
    ${VALI}    Set Variable If     ${LEN} > 100    OK    NOK
    Should Be Equal    OK    ${VALI}    Console Log not present
    Click Link    Sign Out
    Close All Browsers
test_m1_large
    Open Connection    ${HOST}
    Login With Public Key    ${username}    ${ID_RSA}    ${KEYRING_PASS}
    Log    CPU(s)
    ${output}    Execute Command    lscpu | grep 'CPU(s):' | grep -v NUMA
    Should Match Regexp     ${output}    ^CPU\\(s\\):\\s+4.*$
    Log    Memory
    ${output}    Execute Command    free -mh | grep Mem
    Should Match Regexp     ${output}    ^Mem:\\s+7\\.8G.*$
    Log    DISK
    ${output}    Execute Command    df -h | grep /dev/.da1
    Should Match Regexp     ${output}    ^/dev/.da1\\s+40G.*$
    Log    Reached this point despite of error
#   LOGIN TO HORIZON AND CHECK LOGS
    Login to OpenStack
    Wait Until Page Contains   Instances
    Click Element    css=h3
    Click Link    ${TENANT}
    Click Link    Instances
    Click Link    ${IMAGE_NAME}
    Click Link    Log
    Wait Until Page Contains    Instance Console Log
    ${LOGI}    Get Text     css=pre.logs
    ${LEN}    Get Length    ${LOGI}
    ${VALI}    Set Variable If     ${LEN} > 100    OK    NOK
    Should Be Equal    OK    ${VALI}    Console Log not present
    Click Link    Sign Out
    Close All Browsers
test_m1_xlarge
    Open Connection    ${HOST}
    Login With Public Key    ${username}    ${ID_RSA}    ${KEYRING_PASS}
    Log    CPU(s)
    ${output}    Execute Command    lscpu | grep 'CPU(s):' | grep -v NUMA
    Should Match Regexp     ${output}    ^CPU\\(s\\):\\s+8.*$
    Log    Memory
    ${output}    Execute Command    free -mh | grep Mem
    Should Match Regexp     ${output}    ^Mem:\\s+15G.*$
    Log    DISK
    ${output}    Execute Command    df -h | grep /dev/.da1
    Should Match Regexp     ${output}    ^/dev/.da1\\s+79G.*$
    Log    Reached this point despite of error
#   LOGIN TO HORIZON AND CHECK LOGS
    Login to OpenStack
    Wait Until Page Contains   Instances
    Click Element    css=h3
    Click Link    ${TENANT}
    Click Link    Instances
    Click Link    ${IMAGE_NAME}
    Click Link    Log
    Wait Until Page Contains    Instance Console Log
    ${LOGI}    Get Text     css=pre.logs
    ${LEN}    Get Length    ${LOGI}<commit_msg>added keyword for horizon part<commit_after>*** Settings ***
Suite Setup    Set CLI ENV ready
Suite Teardown    Close All Connections
Resource    ./common/assets/secrets.txt
Resource    ./common/assets/resource.txt
Resource    local_resource.txt
#Library    NovaClient
Library    SSHLibrary
Library    OperatingSystem

*** Variables ***
${USERNAME}     debian
${ID_RSA}    /home/user/.ssh/id_rsa
${KEYRING_PASS}    ${EMPTY}
#${PASSWORD}    ${VALID_PASSWORD}
#${HOST}     support-test.forgeservicelab.fi
${HOST}      192.168.127.12
${FLAVOR}    m1.tiny 
${TENANT}    Digile.Devel
${IMAGE_NAME}    image_name
#${PROJECT_URL}    https://cloud.forgeservicelab.fi/dashboard/auth/switch/bcfafe4e2bef4ce4b1467a1617456311/?next=/dashboard/project/

*** Test Cases ***

Run-Keyword-If
    Run Keyword If    '${FLAVOR}' == 'm1.tiny'     test_m1_tiny
    Run Keyword If    '${FLAVOR}' == 'm1.small'     test_m1_small
    Run Keyword If    '${FLAVOR}' == 'm1.medium'     test_m1_medium
    Run Keyword If    '${FLAVOR}' == 'm1.large'     test_m1_large
    Run Keyword If    '${FLAVOR}' == 'm1.xlarge'     test_m1_xlarge

*** Keywords ***
test_m1_tiny
    Open Connection    ${HOST}
    Login With Public Key    ${username}    ${ID_RSA}    ${KEYRING_PASS}
    Log    CPU(s)
    ${output}    Execute Command    lscpu | grep 'CPU(s):' | grep -v NUMA
    Should Match Regexp     ${output}    ^CPU\\(s\\):\\s+1.*$
    Log    Memory
    ${output}    Execute Command    free -mh | grep Mem
    Should Match Regexp     ${output}    ^Mem:\\s+(?:1\\.0G|9\\d{2}M).*$
    Log    DISK
    ${output}    Execute Command    df -h | grep /dev/.da1
    Should Match Regexp     ${output}    ^/dev/.da1\\s+9.\\dG.*$
    Log    Reached this point despite of error
    Check horizon
test_m1_small
    Open Connection    ${HOST}
    Login With Public Key    ${username}    ${ID_RSA}    ${KEYRING_PASS}
    Log    CPU(s)
    ${output}    Execute Command    lscpu | grep 'CPU(s):' | grep -v NUMA
    Should Match Regexp     ${output}    ^CPU\\(s\\):\\s+1.*$
    Log    Memory
    ${output}    Execute Command    free -mh | grep Mem
    Should Match Regexp     ${output}    ^Mem:\\s+2\\.0G.*$
    Log    DISK
    ${output}    Execute Command    df -h | grep /dev/.da1
    Should Match Regexp     ${output}    ^/dev/.da1\\s+9.\\dG.*$
    Log    Reached this point despite of error
    Check horizon
test_m1_medium
    Open Connection    ${HOST}
    Login With Public Key    ${username}    ${ID_RSA}    ${KEYRING_PASS}
    Log    CPU(s)
    ${output}    Execute Command    lscpu | grep 'CPU(s):' | grep -v NUMA
    Should Match Regexp     ${output}    ^CPU\\(s\\):\\s+2.*$
    Log    Memory
    ${output}    Execute Command    free -mh | grep Mem
    Should Match Regexp     ${output}    ^Mem:\\s+3\\.9G.*$
    Log    DISK
    ${output}    Execute Command    df -h | grep /dev/.da1
    Should Match Regexp     ${output}    ^/dev/.da1\\s+20G.*$
    Log    Reached this point despite of error
    Check Horizon
test_m1_large
    Open Connection    ${HOST}
    Login With Public Key    ${username}    ${ID_RSA}    ${KEYRING_PASS}
    Log    CPU(s)
    ${output}    Execute Command    lscpu | grep 'CPU(s):' | grep -v NUMA
    Should Match Regexp     ${output}    ^CPU\\(s\\):\\s+4.*$
    Log    Memory
    ${output}    Execute Command    free -mh | grep Mem
    Should Match Regexp     ${output}    ^Mem:\\s+7\\.8G.*$
    Log    DISK
    ${output}    Execute Command    df -h | grep /dev/.da1
    Should Match Regexp     ${output}    ^/dev/.da1\\s+40G.*$
    Log    Reached this point despite of error
    Check Horizon
test_m1_xlarge
    Open Connection    ${HOST}
    Login With Public Key    ${username}    ${ID_RSA}    ${KEYRING_PASS}
    Log    CPU(s)
    ${output}    Execute Command    lscpu | grep 'CPU(s):' | grep -v NUMA
    Should Match Regexp     ${output}    ^CPU\\(s\\):\\s+8.*$
    Log    Memory
    ${output}    Execute Command    free -mh | grep Mem
    Should Match Regexp     ${output}    ^Mem:\\s+15G.*$
    Log    DISK
    ${output}    Execute Command    df -h | grep /dev/.da1
    Should Match Regexp     ${output}    ^/dev/.da1\\s+79G.*$
    Log    Reached this point despite of error
    Check Horizon

Check Horizon
#   LOGIN TO HORIZON AND CHECK LOGS
    Login to OpenStack
    Wait Until Page Contains   Instances
    Click Element    css=h3
    Click Link    ${TENANT}
#    Go to    ${PROJECT_URL}
    Click Link    Instances
    Click Link    ${IMAGE_NAME}
    Click Link    Log
    Wait Until Page Contains    Instance Console Log
    ${LOGI}    Get Text     css=pre.logs
    ${LEN}    Get Length    ${LOGI}
{'fraction_non_alphanumeric': 0.11728060671722644, 'fraction_numerical': 0.01444564824846515, 'mean_word_length': 2.1158931082981716, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 2, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '52511', 'n_tokens_mistral': 3915, 'n_tokens_neox': 3752, 'n_words': 1156}