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
14
15Suite Setup     Suite Setup Execution
16Test Teardown   FFDC On Test Case Fail
17
18
19*** Test Cases ***
20
21Verify Both Interfaces BMC IP Addreeses Accessible Via SSH
22    [Documentation]  Verify both interfaces (eth0, eth1) BMC IP addresses accessible via SSH.
23    [Tags]  Verify_Both_Interfaces_BMC_IP_Addresses_Accessible_Via_SSH
24
25    Open Connection And Log In  ${OPENBMC_USERNAME}  ${OPENBMC_PASSWORD}  host=${OPENBMC_HOST}
26    Open Connection And Log In  ${OPENBMC_USERNAME}  ${OPENBMC_PASSWORD}  host=${OPENBMC_HOST_1}
27    Close All Connections
28
29
30Verify Redfish Works On Both Interfaces
31    [Documentation]  Verify access BMC with both interfaces (eth0, eth1) IP addresses via Redfish.
32    [Tags]  Verify_Redfish_Works_On_Both_Interfaces
33    [Teardown]  Run Keywords
34    ...  Configure Hostname  ${hostname}  AND  Validate Hostname On BMC  ${hostname}
35
36    Redfish1.Login
37    Redfish.Login
38
39    ${hostname}=  Redfish.Get Attribute  ${REDFISH_NW_PROTOCOL_URI}  HostName
40    ${data}=  Create Dictionary  HostName=openbmc
41    Redfish1.patch  ${REDFISH_NW_ETH_IFACE}eth1  body=&{data}
42    ...  valid_status_codes=[${HTTP_OK}, ${HTTP_NO_CONTENT}]
43
44    Validate Hostname On BMC  openbmc
45
46    ${resp1}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}eth0
47    ${resp2}=  Redfish1.Get  ${REDFISH_NW_ETH_IFACE}eth1
48    Should Be Equal  ${resp1.dict['HostName']}  ${resp2.dict['HostName']}
49
50*** Keywords ***
51
52Get Network Configuration Using Channel Number
53    [Documentation]  Get ethernet interface.
54    [Arguments]  ${channel_number}
55
56    # Description of argument(s):
57    # channel_number   Ethernet channel number, 1 is for eth0 and 2 is for eth1 (e.g. "1").
58
59    ${active_channel_config}=  Get Active Channel Config
60    ${ethernet_interface}=  Set Variable  ${active_channel_config['${channel_number}']['name']}
61    ${resp}=  Redfish.Get  ${REDFISH_NW_ETH_IFACE}${ethernet_interface}
62
63    @{network_configurations}=  Get From Dictionary  ${resp.dict}  IPv4StaticAddresses
64    [Return]  @{network_configurations}
65
66
67Suite Setup Execution
68    [Documentation]  Do suite setup task.
69
70    Valid Value  OPENBMC_HOST_1
71
72    # Check both interfaces are configured and reachable.
73    Ping Host  ${OPENBMC_HOST}
74    Ping Host  ${OPENBMC_HOST_1}
75