Migrate Get Requests invocations(libraries)
[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
7 Resource            ../../../libraries/NetconfCallHome.robot
8 Resource            ../../../libraries/CompareStream.robot
9
10 Suite Setup         Suite Setup
11 Suite Teardown      Suite Teardown
12 Test Setup          Test Setup
13 Test Teardown       Test Teardown
14
15
16 *** Test Cases ***
17 CallHome with Incorrect global Credentials
18     [Documentation]    Incorrect global credentials should result to mount failure. FAILED_AUTH_FAILURE should be the device status.
19     Apply SSH-based Call-Home configuration
20     Register global credentials for SSH call-home devices (APIv1)    incorrect    root
21     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}
22     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command
23     ...    docker-compose up -d
24     ...    return_stdout=True
25     ...    return_stderr=True
26     ...    return_rc=True
27     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
28     Wait Until Keyword Succeeds
29     ...    30s
30     ...    2s
31     ...    Run Keyword And Expect Error
32     ...    *
33     ...    Utils.Check For Elements At URI
34     ...    ${mount_point_url}
35     ...    ${netconf_mount_expected_values}
36
37 CallHome with Incorrect per-device Credentials
38     [Documentation]    Incorrect per-device credentials should result to mount failure. FAILED_AUTH_FAILURE should be the device status.
39     Apply SSH-based Call-Home configuration
40     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}    root    incorrect
41     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command
42     ...    docker-compose up -d
43     ...    return_stdout=True
44     ...    return_stderr=True
45     ...    return_rc=True
46     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
47     Wait Until Keyword Succeeds
48     ...    30s
49     ...    2s
50     ...    Run Keyword And Expect Error
51     ...    *
52     ...    Utils.Check For Elements At URI
53     ...    ${mount_point_url}
54     ...    ${netconf_mount_expected_values}
55
56 CallHome with Incorrect Node-id
57     [Documentation]    CallHome from device that does not have an entry in per-device credential with result to mount point failure.
58     Apply SSH-based Call-Home configuration
59     Register SSH call-home device in ODL controller (APIv1)    incorrect_hostname    ${EMPTY}    root    root
60     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}
61     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command
62     ...    docker-compose up -d
63     ...    return_stdout=True
64     ...    return_stderr=True
65     ...    return_rc=True
66     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    DISCONNECTED
67     Wait Until Keyword Succeeds
68     ...    30s
69     ...    2s
70     ...    Run Keyword And Expect Error
71     ...    *
72     ...    Utils.Check For Elements At URI
73     ...    ${mount_point_url}
74     ...    ${netconf_mount_expected_values}
75
76 CallHome with Rogue Devices
77     [Documentation]    A Rogue Device will fail to callhome and wont be able to mount because the keys are not added in whitelist.
78     ...    FAILED_NOT_ALLOWED should be the device status.
79     Apply SSH-based Call-Home configuration
80     Register SSH call-home device in ODL controller (APIv1)    netopeer2    incorrect-key-value    root    root
81     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command
82     ...    docker-compose up -d
83     ...    return_stdout=True
84     ...    return_stderr=True
85     ...    return_rc=True
86     # Next line is commented due to https://jira.opendaylight.org/browse/NETCONF-574
87     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_NOT_ALLOWED
88     Wait Until Keyword Succeeds
89     ...    30s
90     ...    2s
91     ...    Run Keyword And Expect Error
92     ...    *
93     ...    Utils.Check For Elements At URI
94     ...    ${mount_point_url}
95     ...    ${netconf_mount_expected_values}
96
97 Successful CallHome with correct global credentials
98     [Documentation]    Device being in whitelist of the Call Home server along with correct global credentials will result to successful mount.
99     ...    CONNECTED should be the device status.
100     Apply SSH-based Call-Home configuration
101     Register global credentials for SSH call-home devices (APIv1)    root    root
102     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}
103     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command
104     ...    docker-compose up -d
105     ...    return_stdout=True
106     ...    return_stderr=True
107     ...    return_rc=True
108     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    CONNECTED
109     Wait Until Keyword Succeeds
110     ...    30s
111     ...    2s
112     ...    Utils.Check For Elements At URI
113     ...    ${mount_point_url}
114     ...    ${netconf_mount_expected_values}
115
116 Successful CallHome with correct per-device credentials
117     [Documentation]    Device being in whitelist of the Call Home server along with correct per-device credentials will result to successful mount.
118     ...    CONNECTED should be the device status.
119     Apply SSH-based Call-Home configuration
120     Register SSH call-home device in ODL controller (APIv1)    netopeer2    ${NETOPEER_PUB_KEY}    root    root
121     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command
122     ...    docker-compose up -d
123     ...    return_stdout=True
124     ...    return_stderr=True
125     ...    return_rc=True
126     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    CONNECTED
127     Wait Until Keyword Succeeds
128     ...    30s
129     ...    2s
130     ...    Utils.Check For Elements At URI
131     ...    ${mount_point_url}
132     ...    ${netconf_mount_expected_values}
133
134 CallHome over SSH with correct device credentials (APIv2)
135     [Documentation]    Correct credentials should result to successful mount. CONNECTED should be the device status.
136     CompareStream.Run_Keyword_If_Less_Than_Silicon
137     ...    BuiltIn.Pass_Execution
138     ...    Test case valid only for versions silicon and above.
139     Apply SSH-based Call-Home configuration
140     Register SSH call-home device in ODL controller (APIv2)    netopeer2    ${NETOPEER_PUB_KEY}    root    root
141     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command
142     ...    docker-compose up -d
143     ...    return_stdout=True
144     ...    return_stderr=True
145     ...    return_rc=True
146     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    CONNECTED
147     Wait Until Keyword Succeeds
148     ...    30s
149     ...    2s
150     ...    Utils.Check For Elements At URI
151     ...    ${mount_point_url}
152     ...    ${netconf_mount_expected_values}
153
154 CallHome over SSH with incorrect device credentials (APIv2)
155     [Documentation]    Correct credentials should result to successful mount. CONNECTED should be the device status.
156     CompareStream.Run_Keyword_If_Less_Than_Silicon
157     ...    BuiltIn.Pass_Execution
158     ...    Test case valid only for versions silicon and above.
159     Apply SSH-based Call-Home configuration
160     Register SSH call-home device in ODL controller (APIv2)    netopeer2    ${NETOPEER_PUB_KEY}    root    incorrect
161     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command
162     ...    docker-compose up -d
163     ...    return_stdout=True
164     ...    return_stderr=True
165     ...    return_rc=True
166     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
167     Wait Until Keyword Succeeds
168     ...    30s
169     ...    2s
170     ...    Run Keyword And Expect Error
171     ...    *
172     ...    Utils.Check For Elements At URI
173     ...    ${mount_point_url}
174     ...    ${netconf_mount_expected_values}
175
176 CallHome over SSH with correct global credentials (APIv2)
177     [Documentation]    CallHome SSH device registered via APIv2 with global credentials from APIv1 should result to successful mount.
178     CompareStream.Run_Keyword_If_Less_Than_Silicon
179     ...    BuiltIn.Pass_Execution
180     ...    Test case valid only for versions silicon and above.
181     Apply SSH-based Call-Home configuration
182     Register global credentials for SSH call-home devices (APIv1)    root    root
183     Register SSH call-home device in ODL controller (APIv2)    netopeer2    ${NETOPEER_PUB_KEY}
184     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command
185     ...    docker-compose up -d
186     ...    return_stdout=True
187     ...    return_stderr=True
188     ...    return_rc=True
189     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    CONNECTED
190     Wait Until Keyword Succeeds
191     ...    30s
192     ...    2s
193     ...    Utils.Check For Elements At URI
194     ...    ${mount_point_url}
195     ...    ${netconf_mount_expected_values}
196
197 CallHome over SSH with incorrect global credentials (APIv2)
198     [Documentation]    CallHome SSH device registered via APIv2 with wrong global credentials from APIv1 should fail.
199     CompareStream.Run_Keyword_If_Less_Than_Silicon
200     ...    BuiltIn.Pass_Execution
201     ...    Test case valid only for versions silicon and above.
202     Apply SSH-based Call-Home configuration
203     Register global credentials for SSH call-home devices (APIv1)    root    incorrect
204     Register SSH call-home device in ODL controller (APIv2)    netopeer2    ${NETOPEER_PUB_KEY}
205     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command
206     ...    docker-compose up -d
207     ...    return_stdout=True
208     ...    return_stderr=True
209     ...    return_rc=True
210     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    FAILED_AUTH_FAILURE
211     Wait Until Keyword Succeeds
212     ...    30s
213     ...    2s
214     ...    Run Keyword And Expect Error
215     ...    *
216     ...    Utils.Check For Elements At URI
217     ...    ${mount_point_url}
218     ...    ${netconf_mount_expected_values}
219
220 CallHome over TLS with correct certificate and key (APIv2)
221     [Documentation]    Using correct certificate and key pair should result to successful mount. CONNECTED should be the device status.
222     CompareStream.Run_Keyword_If_Less_Than_Silicon
223     ...    BuiltIn.Pass_Execution
224     ...    Test case valid only for versions silicon and above.
225     Apply TLS-based Call-Home configuration
226     Register keys and certificates in ODL controller
227     Register TLS call-home device in ODL controller (APIv2)    netopeer2    tls-device-key    tls-device-certificate
228     ${stdout}    ${stderr}    ${rc}=    SSHLibrary.Execute Command
229     ...    docker-compose up -d
230     ...    return_stdout=True
231     ...    return_stderr=True
232     ...    return_rc=True
233     Wait Until Keyword Succeeds    90s    2s    NetconfCallHome.Check Device Status    CONNECTED
234     Wait Until Keyword Succeeds
235     ...    30s
236     ...    2s
237     ...    Utils.Check For Elements At URI
238     ...    ${mount_point_url}
239     ...    ${netconf_mount_expected_values}