Add test cases for new API to netconf/call-home suite
[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 Resource          ../../../libraries/CompareStream.robot
12
13 *** Test Cases ***
14 CallHome with Incorrect global Credentials
15     [Documentation]    Incorrect global credentials should result to mount failure. FAILED_AUTH_FAILURE should be the device status.
16     Apply SSH-based Call-Home configuration
17     Register global credentials for SSH call-home devices (APIv1)    incorrect    root
18     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}
19     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
20     ...    return_rc=True
21     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
22     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
23     ...    ${netconf_mount_expected_values}
24
25 CallHome with Incorrect per-device Credentials
26     [Documentation]    Incorrect per-device credentials should result to mount failure. FAILED_AUTH_FAILURE should be the device status.
27     Apply SSH-based Call-Home configuration
28     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}    root    incorrect
29     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
30     ...    return_rc=True
31     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
32     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
33     ...    ${netconf_mount_expected_values}
34
35 CallHome with Incorrect Node-id
36     [Documentation]    CallHome from device that does not have an entry in per-device credential with result to mount point failure.
37     Apply SSH-based Call-Home configuration
38     Register SSH call-home device in ODL controller (APIv1)    incorrect_hostname    ${EMPTY}    root    root
39     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}
40     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
41     ...    return_rc=True
42     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    DISCONNECTED
43     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
44     ...    ${netconf_mount_expected_values}
45
46 CallHome with Rogue Devices
47     [Documentation]    A Rogue Device will fail to callhome and wont be able to mount because the keys are not added in whitelist.
48     ...    FAILED_NOT_ALLOWED should be the device status.
49     Apply SSH-based Call-Home configuration
50     Register SSH call-home device in ODL controller (APIv1)    netopeer2    incorrect-key-value    root    root
51     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
52     ...    return_rc=True
53     # Next line is commented due to https://jira.opendaylight.org/browse/NETCONF-574
54     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_NOT_ALLOWED
55     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
56     ...    ${netconf_mount_expected_values}
57
58 Successful CallHome with correct global credentials
59     [Documentation]    Device being in whitelist of the Call Home server along with correct global credentials will result to successful mount.
60     ...    CONNECTED should be the device status.
61     Apply SSH-based Call-Home configuration
62     Register global credentials for SSH call-home devices (APIv1)    root    root
63     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}
64     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
65     ...    return_rc=True
66     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    CONNECTED
67     Wait Until Keyword Succeeds    30s    2s    Utils.Check For Elements At URI    ${mount_point_url}    ${netconf_mount_expected_values}
68
69 Successful CallHome with correct per-device credentials
70     [Documentation]    Device being in whitelist of the Call Home server along with correct per-device credentials will result to successful mount.
71     ...    CONNECTED should be the device status.
72     Apply SSH-based Call-Home configuration
73     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}    root    root
74     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
75     ...    return_rc=True
76     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    CONNECTED
77     Wait Until Keyword Succeeds    30s    2s    Utils.Check For Elements At URI    ${mount_point_url}    ${netconf_mount_expected_values}
78
79 CallHome over SSH with correct device credentials (APIv2)
80     [Documentation]    Correct credentials should result to successful mount. CONNECTED should be the device status.
81     CompareStream.Run_Keyword_If_Less_Than_Silicon    BuiltIn.Pass_Execution    Test case valid only for versions silicon and above.
82     Apply SSH-based Call-Home configuration
83     Register SSH call-home device in ODL controller (APIv2)    netopeer2    ${NETOPEER_PUB_KEY}    root    root
84     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
85     ...    return_rc=True
86     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    CONNECTED
87     Wait Until Keyword Succeeds    30s    2s    Utils.Check For Elements At URI    ${mount_point_url}    ${netconf_mount_expected_values}
88
89 CallHome over SSH with incorrect device credentials (APIv2)
90     [Documentation]    Correct credentials should result to successful mount. CONNECTED should be the device status.
91     CompareStream.Run_Keyword_If_Less_Than_Silicon    BuiltIn.Pass_Execution    Test case valid only for versions silicon and above.
92     Apply SSH-based Call-Home configuration
93     Register SSH call-home device in ODL controller (APIv2)    netopeer2    ${NETOPEER_PUB_KEY}    root    incorrect
94     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
95     ...    return_rc=True
96     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
97     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
98     ...    ${netconf_mount_expected_values}
99
100 CallHome over SSH with correct global credentials (APIv2)
101     [Documentation]    CallHome SSH device registered via APIv2 with global credentials from APIv1 should result to successful mount.
102     CompareStream.Run_Keyword_If_Less_Than_Silicon    BuiltIn.Pass_Execution    Test case valid only for versions silicon and above.
103     Apply SSH-based Call-Home configuration
104     Register global credentials for SSH call-home devices (APIv1)    root    root
105     Register SSH call-home device in ODL controller (APIv2)    netopeer2    ${NETOPEER_PUB_KEY}
106     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
107     ...    return_rc=True
108     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    CONNECTED
109     Wait Until Keyword Succeeds    30s    2s    Utils.Check For Elements At URI    ${mount_point_url}    ${netconf_mount_expected_values}
110
111 CallHome over SSH with incorrect global credentials (APIv2)
112     [Documentation]    CallHome SSH device registered via APIv2 with wrong global credentials from APIv1 should fail.
113     CompareStream.Run_Keyword_If_Less_Than_Silicon    BuiltIn.Pass_Execution    Test case valid only for versions silicon and above.
114     Apply SSH-based Call-Home configuration
115     Register global credentials for SSH call-home devices (APIv1)    root    incorrect
116     Register SSH call-home device in ODL controller (APIv2)    netopeer2    ${NETOPEER_PUB_KEY}
117     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command    docker-compose up -d    return_stdout=True    return_stderr=True
118     ...    return_rc=True
119     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
120     Wait Until Keyword Succeeds    30s    2s    Run Keyword And Expect Error    *    Utils.Check For Elements At URI    ${mount_point_url}
121     ...    ${netconf_mount_expected_values}