CallHome Tests First draft.
[integration/test.git] / csit / suites / netconf / callhome / callhome.robot
1 *** Settings ***
2 Documentation     Test suite to verify callhome functionality where the Call Home Server(CONTROLLER) is provisioned with device
3 ...               certificates when docker-compose is invoked. Every test case does a SED operation to search and replace words
4 ...               to cover the happy path and negative scenarios.
5 Suite Setup       Suite Setup
6 Suite Teardown    Suite Teardown
7 Test Setup        Reset Docker Compose Configuration
8 Test Teardown     Test Teardown
9 Resource          ../../../libraries/NetconfCallHome.robot
10
11 *** Test Cases ***
12 CallHome with Incorrect global Credentials
13     [Documentation]    Incorrect global credentials should result to mount failure. FAILED_AUTH_FAILURE should be the device status.
14     SSHLibrary.Execute_Command    sed -i -e 's/global root/global incorrect/g' docker-compose.yaml
15     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
16     ...    return_rc=True
17     Wait Until Keyword Succeeds    30s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
18     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
19     ...    ${netconf_mount_expected_values}
20
21 CallHome with Incorrect per-device Credentials
22     [Documentation]    Incorrect per-device credentials should result to mount failure. FAILED_AUTH_FAILURE should be the device status.
23     SSHLibrary.Execute_Command    sed -i -e 's/global root/per-device netopeer incorrect/g' docker-compose.yaml
24     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
25     ...    return_rc=True
26     Wait Until Keyword Succeeds    30s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
27     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
28     ...    ${netconf_mount_expected_values}
29
30 CallHome with Incorrect Node-id
31     [Documentation]    CallHome from device that does not have an entry in per-device credential with result to mount point failure.
32     SSHLibrary.Execute_Command    sed -i -e 's/global/per-device incorrect_hostname/g' docker-compose.yaml    return_rc=True
33     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
34     ...    return_rc=True
35     Wait Until Keyword Succeeds    30s    2s    NetconfCallHome.Check Device Status    DISCONNECTED
36     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
37     ...    ${netconf_mount_expected_values}
38
39 CallHome with Rogue Devices
40     [Documentation]    A Rogue Device will fail to callhome and wont be able to mount because the keys are not added in whitelist.
41     ...    FAILED_NOT_ALLOWED should be the device status.
42     SSHLibrary.Execute_Command    sed -i -e 's,\/root\/whitelist_add.sh \$\$\{HOSTNAME\}\;,,g' docker-compose.yaml
43     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
44     ...    return_rc=True
45     Wait Until Keyword Succeeds    30s    2s    NetconfCallHome.Check Device Status    FAILED_NOT_ALLOWED
46     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
47     ...    ${netconf_mount_expected_values}
48
49 Successful CallHome with correct global credentials
50     [Documentation]    Device being in whitelist of the Call Home server along with correct global credentials will result to successful mount.
51     ...    CONNECTED should be the device status.
52     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
53     ...    return_rc=True
54     Wait Until Keyword Succeeds    30s    2s    NetconfCallHome.Check Device Status    CONNECTED
55     Wait Until Keyword Succeeds    30s    2s    Utils.Check For Elements At URI    ${mount_point_url}    ${netconf_mount_expected_values}
56
57 Successful CallHome with correct per-device credentials
58     [Documentation]    Device being in whitelist of the Call Home server along with correct per-device credentials will result to successful mount.
59     ...    CONNECTED should be the device status.
60     SSHLibrary.Execute_Command    sed -i -e 's/global/per-device netopeer/g' docker-compose.yaml
61     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
62     ...    return_rc=True
63     Wait Until Keyword Succeeds    30s    2s    NetconfCallHome.Check Device Status    CONNECTED
64     Wait Until Keyword Succeeds    30s    2s    Utils.Check For Elements At URI    ${mount_point_url}    ${netconf_mount_expected_values}