Skip to content

Commit 79ba8a2

Browse files
committed
SSH Enable and Disable via Eth1
Changes: - Adding test case to Enable and disable SSH Tested: - Ran and Tested on BMC Environment Change-Id: I3867ad7818d708a46a87975ff35be393d5bbadf3 Signed-off-by: Sweta Potthuri <[email protected]>
1 parent dee4573 commit 79ba8a2

File tree

2 files changed

+70
-4
lines changed

2 files changed

+70
-4
lines changed

lib/protocol_setting_utils.robot

+5-2
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,14 @@ Enable SSH Protocol
3232

3333
Verify SSH Login And Commands Work
3434
[Documentation] Verify if SSH connection works and able to run command on SSH session.
35+
[Arguments] ${host}=${OPENBMC_HOST}
3536
[Teardown] Close All Connections
3637

37-
# Check if we can open SSH connection and login.
38-
Open Connection And Login
38+
# Description of argument(s}:
39+
# host OPENBMC_HOST, OPENBMC_HOST_1, Use eth0 as the default interface
3940

41+
# Check if we can open SSH connection and login.
42+
Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${host}
4043
# Check if we can run command successfully on SSH session.
4144
BMC Execute Command /sbin/ip addr
4245

redfish/managers/test_multiple_interfaces.robot

+65-2
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,14 @@ Resource ../../lib/bmc_ldap_utils.robot
1616
Resource ../../lib/snmp/resource.robot
1717
Resource ../../lib/snmp/redfish_snmp_utils.robot
1818
Resource ../../lib/certificate_utils.robot
19+
Resource ../../lib/protocol_setting_utils.robot
1920
Library ../../lib/jobs_processing.py
2021
Library OperatingSystem
2122

2223
Suite Setup Suite Setup Execution
2324
Test Setup Run Keywords Redfish.Login AND Redfish1.Login
2425
Test Teardown Run Keywords FFDC On Test Case Fail AND Redfish.Logout AND Redfish1.Logout
26+
Suite Teardown Run Keywords Redfish1.Logout AND Redfish.Logout
2527

2628
*** Variables ***
2729

@@ -120,8 +122,8 @@ Verify Both Interfaces Access Concurrently Via Redfish
120122
[Tags] Verify_Both_Interfaces_Access_Concurrently_Via_Redfish
121123
122124
${dict}= Execute Process Multi Keyword ${2}
123-
... Redfish.Patch ${REDFISH_NW_ETH_IFACE}eth0 body={'DHCPv4':{'UseDNSServers':${True}}}
124-
... Redfish1.Patch ${REDFISH_NW_ETH_IFACE}eth1 body={'DHCPv4':{'UseDNSServers':${True}}}
125+
... Redfish.patch ${REDFISH_NW_ETH_IFACE}eth0 body={'DHCPv4':{'UseDNSServers':${True}}}
126+
... Redfish1.patch ${REDFISH_NW_ETH_IFACE}eth1 body={'DHCPv4':{'UseDNSServers':${True}}}
125127

126128
Dictionary Should Not Contain Value ${dict} False
127129
... msg=One or more operations has failed.
@@ -171,6 +173,39 @@ Verify Able To Load Certificates Via Eth1 IP Address
171173
CA Valid Certificate ok
172174
Client Valid Certificate Valid Privatekey ok
173175

176+
Enable SSH Protocol Via Eth1 And Verify On Both Interfaces
177+
[Documentation] Enable SSH protocol via eth1 and verify on both interfaces.
178+
[Tags] Enable_SSH_Protocol_Via_Eth1_And_Verify_On_Both_Interfaces
179+
180+
Set SSH Value Via Eth1 ${True}
181+
# Check if SSH is really enabled via Redfish via eth1.
182+
Verify SSH Protocol State Via Eth1 ${True}
183+
# Check if SSH login and commands on SSH session work on both interfaces.
184+
Verify SSH Login And Commands Work
185+
Verify SSH Login And Commands Work ${OPENBMC_HOST_1}
186+
187+
Disable SSH Protocol Via Eth1 And Verify On Both Interfaces
188+
[Documentation] Disable SSH protocol via eth1 and verify on both interfaces.
189+
[Tags] Disable_SSH_Protocol_Via_Eth1_And_Verify_On_Both_Interfaces
190+
[Teardown] Set SSH Value Via Eth1 ${True}
191+
192+
Set SSH Value Via Eth1 ${False}
193+
# Check if SSH is really disabled via Redfish via eth1.
194+
Verify SSH Protocol State Via Eth1 ${False}
195+
# Check if SSH login and commands fail on eth1.
196+
${status}= Run Keyword And Return Status
197+
... Verify SSH Login And Commands Work ${OPENBMC_HOST_1}
198+
199+
Should Be Equal As Strings ${status} False
200+
... msg=SSH Login and commands are working after disabling SSH via eth1.
201+
202+
# Check if SSH login and commands fail.
203+
${status}= Run Keyword And Return Status
204+
... Verify SSH Login And Commands Work
205+
206+
Should Be Equal As Strings ${status} False
207+
... msg=SSH Login and commands are working after disabling SSH.
208+
174209
*** Keywords ***
175210

176211
Get Network Configuration Using Channel Number
@@ -286,3 +321,31 @@ Install Certificate Via Redfish And Verify
286321
... ${certificate_uri}/${cert_id} CertificateString
287322
Run Keyword If '${expected_status}' == 'ok' Should Contain ${cert_file_content} ${bmc_cert_content}
288323
RETURN ${cert_id}
324+
325+
Set SSH Value Via Eth1
326+
[Documentation] Enable or disable SSH protocol via Eth1.
327+
[Arguments] ${enable_value}=${True}
328+
329+
# Description of argument(s}:
330+
# enable_value Enable or disable SSH, e.g. (true, false).
331+
332+
${ssh_state}= Create Dictionary ProtocolEnabled=${enable_value}
333+
${data}= Create Dictionary SSH=${ssh_state}
334+
335+
Redfish1.Login
336+
Redfish1.patch ${REDFISH_NW_PROTOCOL_URI} body=&{data}
337+
... valid_status_codes=[${HTTP_NO_CONTENT}]
338+
339+
# Wait for timeout for new values to take effect.
340+
Sleep ${NETWORK_TIMEOUT}s
341+
342+
Verify SSH Protocol State Via Eth1
343+
[Documentation] Verify SSH protocol state via eth1.
344+
[Arguments] ${state}=${True}
345+
346+
# Description of argument(s}:
347+
# state Enable or disable SSH, e.g. (true, false)
348+
349+
${resp}= Redfish1.Get ${REDFISH_NW_PROTOCOL_URI}
350+
Should Be Equal As Strings ${resp.dict['SSH']['ProtocolEnabled']} ${state}
351+
... msg=Protocol states are not matching.

0 commit comments

Comments
 (0)