501ee7c7a07e1f367155c0d72f0c43efbfda3b0e
[integration/test.git] / csit / suites / netconf / callhome / callhome.robot
1 *** Settings ***
2 Documentation     Test suite to verify callhome functionality over SSH transport protocol. Registration in OpenDaylight
3 ...               Controller happens via restconf interface. Netopeer2-server docker container plays a role of the
4 ...               netconf device with call-home feature. Docker-compose file is used to configure netopeer2 docker
5 ...               container(netconf configuration templates, host-key).
6 Suite Setup       Suite Setup
7 Suite Teardown    Suite Teardown
8 Test Setup        Test Setup
9 Test Teardown     Test Teardown
10 Resource          ../../../libraries/NetconfCallHome.robot
11
12 *** Test Cases ***
13 CallHome with Incorrect global Credentials
14     [Documentation]    Incorrect global credentials should result to mount failure. FAILED_AUTH_FAILURE should be the device status.
15     Apply SSH-based Call-Home configuration
16     Register global credentials for SSH call-home devices (APIv1)    incorrect    root
17     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}
18     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
19     ...    return_rc=True
20     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
21     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
22     ...    ${netconf_mount_expected_values}
23
24 CallHome with Incorrect per-device Credentials
25     [Documentation]    Incorrect per-device credentials should result to mount failure. FAILED_AUTH_FAILURE should be the device status.
26     Apply SSH-based Call-Home configuration
27     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}    root    incorrect
28     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
29     ...    return_rc=True
30     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
31     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
32     ...    ${netconf_mount_expected_values}
33
34 CallHome with Incorrect Node-id
35     [Documentation]    CallHome from device that does not have an entry in per-device credential with result to mount point failure.
36     Apply SSH-based Call-Home configuration
37     Register SSH call-home device in ODL controller (APIv1)    incorrect_hostname    ${EMPTY}    root    root
38     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}
39     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
40     ...    return_rc=True
41     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    DISCONNECTED
42     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
43     ...    ${netconf_mount_expected_values}
44
45 CallHome with Rogue Devices
46     [Documentation]    A Rogue Device will fail to callhome and wont be able to mount because the keys are not added in whitelist.
47     ...    FAILED_NOT_ALLOWED should be the device status.
48     Apply SSH-based Call-Home configuration
49     Register SSH call-home device in ODL controller (APIv1)    netopeer2    incorrect-key-value    root    root
50     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
51     ...    return_rc=True
52     # Next line is commented due to https://jira.opendaylight.org/browse/NETCONF-574
53     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_NOT_ALLOWED
54     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
55     ...    ${netconf_mount_expected_values}
56
57 Successful CallHome with correct global credentials
58     [Documentation]    Device being in whitelist of the Call Home server along with correct global credentials will result to successful mount.
59     ...    CONNECTED should be the device status.
60     Apply SSH-based Call-Home configuration
61     Register global credentials for SSH call-home devices (APIv1)    root    root
62     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}
63     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
64     ...    return_rc=True
65     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    CONNECTED
66     Wait Until Keyword Succeeds    30s    2s    Utils.Check For Elements At URI    ${mount_point_url}    ${netconf_mount_expected_values}
67
68 Successful CallHome with correct per-device credentials
69     [Documentation]    Device being in whitelist of the Call Home server along with correct per-device credentials will result to successful mount.
70     ...    CONNECTED should be the device status.
71     Apply SSH-based Call-Home configuration
72     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}    root    root
73     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
74     ...    return_rc=True
75     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    CONNECTED
76     Wait Until Keyword Succeeds    30s    2s    Utils.Check For Elements At URI    ${mount_point_url}    ${netconf_mount_expected_values}