blob: adcf24ba29b00d418c698213b54352aae00925bf [file] [log] [blame]
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -05001*** Settings ***
2Documentation Test BMC multiple network interface functionalities.
3
4# User input BMC IP for the eth1.
5# Use can input as -v OPENBMC_HOST_1:xx.xxx.xx from command line.
6Library ../../lib/bmc_redfish.py https://${OPENBMC_HOST_1}:${HTTPS_PORT}
7... ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} WITH NAME Redfish1
8
9Resource ../../lib/resource.robot
10Resource ../../lib/common_utils.robot
11Resource ../../lib/connection_client.robot
12Resource ../../lib/bmc_network_utils.robot
13Resource ../../lib/openbmc_ffdc.robot
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050014Resource ../../lib/bmc_ldap_utils.robot
Anves Kumar rayankula2f9632f2021-07-05 04:37:45 -050015Resource ../../lib/snmp/resource.robot
16Resource ../../lib/snmp/redfish_snmp_utils.robot
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050017
18Suite Setup Suite Setup Execution
19Test Teardown FFDC On Test Case Fail
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050020Suite Teardown Run Keywords Redfish1.Logout AND Redfish.Logout
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050021
22*** Test Cases ***
23
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050024Verify Both Interfaces BMC IP Addresses Accessible Via SSH
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050025 [Documentation] Verify both interfaces (eth0, eth1) BMC IP addresses accessible via SSH.
26 [Tags] Verify_Both_Interfaces_BMC_IP_Addresses_Accessible_Via_SSH
27
28 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST}
29 Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST_1}
30 Close All Connections
31
32
Anves Kumar rayankula55d51922021-07-01 06:37:00 -050033Verify Redfish Works On Both Interfaces
34 [Documentation] Verify access BMC with both interfaces (eth0, eth1) IP addresses via Redfish.
35 [Tags] Verify_Redfish_Works_On_Both_Interfaces
36 [Teardown] Run Keywords
37 ... Configure Hostname ${hostname} AND Validate Hostname On BMC ${hostname}
38
39 Redfish1.Login
40 Redfish.Login
41
42 ${hostname}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName
43 ${data}= Create Dictionary HostName=openbmc
44 Redfish1.patch ${REDFISH_NW_ETH_IFACE}eth1 body=&{data}
45 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
46
47 Validate Hostname On BMC openbmc
48
49 ${resp1}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0
50 ${resp2}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1
51 Should Be Equal ${resp1.dict['HostName']} ${resp2.dict['HostName']}
52
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -050053
54Verify LDAP Login Works When Eth1 IP Is Not Configured
55 [Documentation] Verify LDAP login works when eth1 IP is erased.
56 [Tags] Verify_LDAP_Login_Works_When_Eth1_IP_Is_Not_Configured
57 [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${2}
58 ... AND Delete IP Address ${OPENBMC_HOST_1}
59 [Teardown] Run Keywords Redfish.Login AND
60 ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway}
61
62 Create LDAP Configuration
63 Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD}
64 Redfish.Logout
65
66
Anves Kumar rayankula2f9632f2021-07-05 04:37:45 -050067Verify SNMP Works When Eth1 IP Is Not Configured
68 [Documentation] Verify SNMP works when eth1 IP is not configured.
69 [Tags] Verify_SNMP_Works_When_Eth1_IP_Is_Not_Configured
70 [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${2}
71 ... AND Delete IP Address ${OPENBMC_HOST_1}
72 [Teardown] Run Keywords Redfish.Login AND
73 ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway}
74
75 Create Error On BMC And Verify Trap
76
77
Anves Kumar rayankula04bc48c2021-07-08 23:33:37 -050078Disable And Enable Eth0 Interface
79 [Documentation] Disable and Enable eth0 ethernet interface via redfish.
80 [Tags] Disable_And_Enable_Eth0_Interface
81 [Template] Set BMC Ethernet Interfaces State
82
83 # interface_ip interface enabled
84 ${OPENBMC_HOST} eth0 ${False}
85 ${OPENBMC_HOST} eth0 ${True}
86
87
Anves Kumar rayankulad2e98ff2021-06-29 05:03:02 -050088*** Keywords ***
89
90Get Network Configuration Using Channel Number
91 [Documentation] Get ethernet interface.
92 [Arguments] ${channel_number}
93
94 # Description of argument(s):
95 # channel_number Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1").
96
97 ${active_channel_config}= Get Active Channel Config
98 ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']}
99 ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
100
101 @{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses
102 [Return] @{network_configurations}
103
104
105Suite Setup Execution
106 [Documentation] Do suite setup task.
107
108 Valid Value OPENBMC_HOST_1
109
110 # Check both interfaces are configured and reachable.
111 Ping Host ${OPENBMC_HOST}
112 Ping Host ${OPENBMC_HOST_1}
Anves Kumar rayankula4fa52d72021-07-04 02:37:30 -0500113
114 ${network_configurations}= Get Network Configuration Using Channel Number ${2}
115 FOR ${network_configuration} IN @{network_configurations}
116
117 Run Keyword If '${network_configuration['Address']}' == '${OPENBMC_HOST_1}'
118 ... Run Keywords Set Suite Variable ${eth1_subnet_mask} ${network_configuration['SubnetMask']}
119 ... AND Set Suite Variable ${eth1_gateway} ${network_configuration['Gateway']}
120 ... AND Exit For Loop
121
122 END
Anves Kumar rayankula04bc48c2021-07-08 23:33:37 -0500123
124
125Set BMC Ethernet Interfaces State
126 [Documentation] Set BMC ethernet interface state.
127 [Arguments] ${interface_ip} ${interface} ${enabled}
128 [Teardown] Redfish1.Logout
129
130 # Description of argument(s):
131 # interface_ip IP address of ethernet interface.
132 # interface The ethernet interface name (eg. eth0 or eth1).
133 # enabled Indicates interface should be enabled (eg. True or False).
134
135 Redfish1.Login
136
137 ${data}= Create Dictionary InterfaceEnabled=${enabled}
138
139 Redfish1.patch ${REDFISH_NW_ETH_IFACE}${interface} body=&{data}
140 ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
141
142 Sleep ${NETWORK_TIMEOUT}s
143 ${interface_status}= Redfish1.Get Attribute ${REDFISH_NW_ETH_IFACE}${interface} InterfaceEnabled
144 Should Be Equal ${interface_status} ${enabled}
145
146 ${status}= Run Keyword And Return Status Ping Host ${interface_ip}
147
148 Run Keyword If ${enabled} == ${True} Should Be Equal ${status} ${True}
149 ... ELSE Should Be Equal ${status} ${False}