1*** 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 14Resource ../../lib/bmc_ldap_utils.robot 15Resource ../../lib/snmp/resource.robot 16Resource ../../lib/snmp/redfish_snmp_utils.robot 17 18Suite Setup Suite Setup Execution 19Test Teardown FFDC On Test Case Fail 20Suite Teardown Run Keywords Redfish1.Logout AND Redfish.Logout 21 22*** Test Cases *** 23 24Verify Both Interfaces BMC IP Addresses Accessible Via SSH 25 [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 33Verify 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 53 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 67Verify 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 78Disable 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 88*** 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} 113 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 123 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} 150