Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 1 | *** Settings *** |
| 2 | Documentation 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. |
| 6 | Library ../../lib/bmc_redfish.py https://${OPENBMC_HOST_1}:${HTTPS_PORT} |
| 7 | ... ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} WITH NAME Redfish1 |
| 8 | |
| 9 | Resource ../../lib/resource.robot |
| 10 | Resource ../../lib/common_utils.robot |
| 11 | Resource ../../lib/connection_client.robot |
| 12 | Resource ../../lib/bmc_network_utils.robot |
| 13 | Resource ../../lib/openbmc_ffdc.robot |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 14 | Resource ../../lib/bmc_ldap_utils.robot |
Anves Kumar rayankula | 2f9632f | 2021-07-05 04:37:45 -0500 | [diff] [blame] | 15 | Resource ../../lib/snmp/resource.robot |
| 16 | Resource ../../lib/snmp/redfish_snmp_utils.robot |
Anves Kumar rayankula | a38ec2e | 2021-07-10 01:09:23 -0500 | [diff] [blame^] | 17 | Library ../../lib/jobs_processing.py |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 18 | |
| 19 | Suite Setup Suite Setup Execution |
| 20 | Test Teardown FFDC On Test Case Fail |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 21 | Suite Teardown Run Keywords Redfish1.Logout AND Redfish.Logout |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 22 | |
| 23 | *** Test Cases *** |
| 24 | |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 25 | Verify Both Interfaces BMC IP Addresses Accessible Via SSH |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 26 | [Documentation] Verify both interfaces (eth0, eth1) BMC IP addresses accessible via SSH. |
| 27 | [Tags] Verify_Both_Interfaces_BMC_IP_Addresses_Accessible_Via_SSH |
| 28 | |
| 29 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST} |
| 30 | Open Connection And Log In ${OPENBMC_USERNAME} ${OPENBMC_PASSWORD} host=${OPENBMC_HOST_1} |
| 31 | Close All Connections |
| 32 | |
| 33 | |
Anves Kumar rayankula | 55d5192 | 2021-07-01 06:37:00 -0500 | [diff] [blame] | 34 | Verify Redfish Works On Both Interfaces |
| 35 | [Documentation] Verify access BMC with both interfaces (eth0, eth1) IP addresses via Redfish. |
| 36 | [Tags] Verify_Redfish_Works_On_Both_Interfaces |
| 37 | [Teardown] Run Keywords |
| 38 | ... Configure Hostname ${hostname} AND Validate Hostname On BMC ${hostname} |
| 39 | |
| 40 | Redfish1.Login |
| 41 | Redfish.Login |
| 42 | |
| 43 | ${hostname}= Redfish.Get Attribute ${REDFISH_NW_PROTOCOL_URI} HostName |
| 44 | ${data}= Create Dictionary HostName=openbmc |
| 45 | Redfish1.patch ${REDFISH_NW_ETH_IFACE}eth1 body=&{data} |
| 46 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 47 | |
| 48 | Validate Hostname On BMC openbmc |
| 49 | |
| 50 | ${resp1}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0 |
| 51 | ${resp2}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1 |
| 52 | Should Be Equal ${resp1.dict['HostName']} ${resp2.dict['HostName']} |
| 53 | |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 54 | |
| 55 | Verify LDAP Login Works When Eth1 IP Is Not Configured |
| 56 | [Documentation] Verify LDAP login works when eth1 IP is erased. |
| 57 | [Tags] Verify_LDAP_Login_Works_When_Eth1_IP_Is_Not_Configured |
| 58 | [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${2} |
| 59 | ... AND Delete IP Address ${OPENBMC_HOST_1} |
| 60 | [Teardown] Run Keywords Redfish.Login AND |
| 61 | ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway} |
| 62 | |
| 63 | Create LDAP Configuration |
| 64 | Redfish.Login ${LDAP_USER} ${LDAP_USER_PASSWORD} |
| 65 | Redfish.Logout |
| 66 | |
| 67 | |
Anves Kumar rayankula | 2f9632f | 2021-07-05 04:37:45 -0500 | [diff] [blame] | 68 | Verify SNMP Works When Eth1 IP Is Not Configured |
| 69 | [Documentation] Verify SNMP works when eth1 IP is not configured. |
| 70 | [Tags] Verify_SNMP_Works_When_Eth1_IP_Is_Not_Configured |
| 71 | [Setup] Run Keywords Set Test Variable ${CHANNEL_NUMBER} ${2} |
| 72 | ... AND Delete IP Address ${OPENBMC_HOST_1} |
| 73 | [Teardown] Run Keywords Redfish.Login AND |
| 74 | ... Add IP Address ${OPENBMC_HOST_1} ${eth1_subnet_mask} ${eth1_gateway} |
| 75 | |
| 76 | Create Error On BMC And Verify Trap |
| 77 | |
| 78 | |
Anves Kumar rayankula | 04bc48c | 2021-07-08 23:33:37 -0500 | [diff] [blame] | 79 | Disable And Enable Eth0 Interface |
| 80 | [Documentation] Disable and Enable eth0 ethernet interface via redfish. |
| 81 | [Tags] Disable_And_Enable_Eth0_Interface |
| 82 | [Template] Set BMC Ethernet Interfaces State |
| 83 | |
| 84 | # interface_ip interface enabled |
| 85 | ${OPENBMC_HOST} eth0 ${False} |
| 86 | ${OPENBMC_HOST} eth0 ${True} |
| 87 | |
| 88 | |
Anves Kumar rayankula | a38ec2e | 2021-07-10 01:09:23 -0500 | [diff] [blame^] | 89 | Verify Both Interfaces Access Concurrently Via Redfish |
| 90 | [Documentation] Verify both interfaces access conurrently via redfish. |
| 91 | [Tags] Verify_Both_Interfaces_Access_Concurrently_Via_Redfish |
| 92 | |
| 93 | Redfish.Login |
| 94 | Redfish1.Login |
| 95 | |
| 96 | ${dict}= Execute Process Multi Keyword ${2} |
| 97 | ... Redfish.Patch ${REDFISH_NW_ETH_IFACE}eth0 body={'DHCPv4':{'UseDNSServers':${True}}} |
| 98 | ... Redfish1.Patch ${REDFISH_NW_ETH_IFACE}eth1 body={'DHCPv4':{'UseDNSServers':${True}}} |
| 99 | |
| 100 | Dictionary Should Not Contain Value ${dict} False |
| 101 | ... msg=One or more operations has failed. |
| 102 | |
| 103 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}eth0 |
| 104 | ${resp1}= Redfish1.Get ${REDFISH_NW_ETH_IFACE}eth1 |
| 105 | |
| 106 | Should Be Equal ${resp.dict["DHCPv4"]['UseDNSServers']} ${True} |
| 107 | Should Be Equal ${resp1.dict["DHCPv4"]['UseDNSServers']} ${True} |
| 108 | |
Anves Kumar rayankula | d2e98ff | 2021-06-29 05:03:02 -0500 | [diff] [blame] | 109 | *** Keywords *** |
| 110 | |
| 111 | Get Network Configuration Using Channel Number |
| 112 | [Documentation] Get ethernet interface. |
| 113 | [Arguments] ${channel_number} |
| 114 | |
| 115 | # Description of argument(s): |
| 116 | # channel_number Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1"). |
| 117 | |
| 118 | ${active_channel_config}= Get Active Channel Config |
| 119 | ${ethernet_interface}= Set Variable ${active_channel_config['${channel_number}']['name']} |
| 120 | ${resp}= Redfish.Get ${REDFISH_NW_ETH_IFACE}${ethernet_interface} |
| 121 | |
| 122 | @{network_configurations}= Get From Dictionary ${resp.dict} IPv4StaticAddresses |
| 123 | [Return] @{network_configurations} |
| 124 | |
| 125 | |
| 126 | Suite Setup Execution |
| 127 | [Documentation] Do suite setup task. |
| 128 | |
| 129 | Valid Value OPENBMC_HOST_1 |
| 130 | |
| 131 | # Check both interfaces are configured and reachable. |
| 132 | Ping Host ${OPENBMC_HOST} |
| 133 | Ping Host ${OPENBMC_HOST_1} |
Anves Kumar rayankula | 4fa52d7 | 2021-07-04 02:37:30 -0500 | [diff] [blame] | 134 | |
| 135 | ${network_configurations}= Get Network Configuration Using Channel Number ${2} |
| 136 | FOR ${network_configuration} IN @{network_configurations} |
| 137 | |
| 138 | Run Keyword If '${network_configuration['Address']}' == '${OPENBMC_HOST_1}' |
| 139 | ... Run Keywords Set Suite Variable ${eth1_subnet_mask} ${network_configuration['SubnetMask']} |
| 140 | ... AND Set Suite Variable ${eth1_gateway} ${network_configuration['Gateway']} |
| 141 | ... AND Exit For Loop |
| 142 | |
| 143 | END |
Anves Kumar rayankula | 04bc48c | 2021-07-08 23:33:37 -0500 | [diff] [blame] | 144 | |
| 145 | |
| 146 | Set BMC Ethernet Interfaces State |
| 147 | [Documentation] Set BMC ethernet interface state. |
| 148 | [Arguments] ${interface_ip} ${interface} ${enabled} |
| 149 | [Teardown] Redfish1.Logout |
| 150 | |
| 151 | # Description of argument(s): |
| 152 | # interface_ip IP address of ethernet interface. |
| 153 | # interface The ethernet interface name (eg. eth0 or eth1). |
| 154 | # enabled Indicates interface should be enabled (eg. True or False). |
| 155 | |
| 156 | Redfish1.Login |
| 157 | |
| 158 | ${data}= Create Dictionary InterfaceEnabled=${enabled} |
| 159 | |
| 160 | Redfish1.patch ${REDFISH_NW_ETH_IFACE}${interface} body=&{data} |
| 161 | ... valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}] |
| 162 | |
| 163 | Sleep ${NETWORK_TIMEOUT}s |
| 164 | ${interface_status}= Redfish1.Get Attribute ${REDFISH_NW_ETH_IFACE}${interface} InterfaceEnabled |
| 165 | Should Be Equal ${interface_status} ${enabled} |
| 166 | |
| 167 | ${status}= Run Keyword And Return Status Ping Host ${interface_ip} |
| 168 | |
| 169 | Run Keyword If ${enabled} == ${True} Should Be Equal ${status} ${True} |
| 170 | ... ELSE Should Be Equal ${status} ${False} |