1364e93d6SGeorge Keishing*** Settings ***
2364e93d6SGeorge Keishing
3364e93d6SGeorge KeishingDocumentation          Module to test IPMI network functionality.
4364e93d6SGeorge KeishingResource               ../lib/ipmi_client.robot
5364e93d6SGeorge KeishingResource               ../lib/openbmc_ffdc.robot
6364e93d6SGeorge KeishingResource               ../lib/bmc_network_utils.robot
7364e93d6SGeorge KeishingLibrary                ../lib/ipmi_utils.py
8364e93d6SGeorge KeishingLibrary                ../lib/gen_robot_valid.py
9364e93d6SGeorge KeishingLibrary                ../lib/var_funcs.py
10364e93d6SGeorge KeishingLibrary                ../lib/bmc_network_utils.py
11364e93d6SGeorge Keishing
12364e93d6SGeorge KeishingSuite Setup            Suite Setup Execution
13*e354c1c0SAnvesh Kumar RayankulaSuite Teardown         Redfish.Logout
14364e93d6SGeorge KeishingTest Setup             Printn
15*e354c1c0SAnvesh Kumar RayankulaTest Teardown          Test Teardown Execution
16364e93d6SGeorge Keishing
17364e93d6SGeorge KeishingForce Tags             IPMI_Network_Config
18364e93d6SGeorge Keishing
19364e93d6SGeorge Keishing
20364e93d6SGeorge Keishing*** Variables ***
21*e354c1c0SAnvesh Kumar Rayankula${vlan_id_for_ipmi}     ${10}
22364e93d6SGeorge Keishing@{vlan_ids}             ${20}  ${30}
23364e93d6SGeorge Keishing${interface}            eth0
24364e93d6SGeorge Keishing${ip}                   10.0.0.1
25364e93d6SGeorge Keishing${initial_lan_config}   &{EMPTY}
26364e93d6SGeorge Keishing${vlan_resource}        ${NETWORK_MANAGER}action/VLAN
27*e354c1c0SAnvesh Kumar Rayankula${netmask}              ${24}
28*e354c1c0SAnvesh Kumar Rayankula${gateway}              0.0.0.0
29*e354c1c0SAnvesh Kumar Rayankula${vlan_id_for_rest}     ${30}
30*e354c1c0SAnvesh Kumar Rayankula
31364e93d6SGeorge Keishing
32364e93d6SGeorge Keishing*** Test Cases ***
33364e93d6SGeorge Keishing
34364e93d6SGeorge KeishingVerify IPMI Inband Network Configuration
35364e93d6SGeorge Keishing    [Documentation]  Verify BMC network configuration via inband IPMI.
36364e93d6SGeorge Keishing    [Tags]  Verify_IPMI_Inband_Network_Configuration
37364e93d6SGeorge Keishing    [Teardown]  Run Keywords  Restore Configuration  AND  FFDC On Test Case Fail
38364e93d6SGeorge Keishing
39364e93d6SGeorge Keishing    Redfish Power On
40364e93d6SGeorge Keishing
41364e93d6SGeorge Keishing    Set IPMI Inband Network Configuration  10.10.10.10  255.255.255.0  10.10.10.10
42364e93d6SGeorge Keishing    Sleep  10
43364e93d6SGeorge Keishing
44364e93d6SGeorge Keishing    ${lan_print_output}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
45364e93d6SGeorge Keishing    Valid Value  lan_print_output['IP Address']  ["10.10.10.10"]
46364e93d6SGeorge Keishing    Valid Value  lan_print_output['Subnet Mask']  ["255.255.255.0"]
47364e93d6SGeorge Keishing    Valid Value  lan_print_output['Default Gateway IP']  ["10.10.10.10"]
48364e93d6SGeorge Keishing
49364e93d6SGeorge Keishing
50364e93d6SGeorge KeishingDisable VLAN Via IPMI When Multiple VLAN Exist On BMC
51364e93d6SGeorge Keishing    [Documentation]  Disable  VLAN Via IPMI When Multiple VLAN Exist On BMC.
52364e93d6SGeorge Keishing    [Tags]   Disable_VLAN_Via_IPMI_When_LAN_And_VLAN_Exist_On_BMC
53364e93d6SGeorge Keishing
54364e93d6SGeorge Keishing    FOR  ${id}  IN  @{vlan_ids}
55*e354c1c0SAnvesh Kumar Rayankula      Create VLAN  ${vlan_id_for_rest}
56364e93d6SGeorge Keishing    END
57364e93d6SGeorge Keishing
58364e93d6SGeorge Keishing    Create VLAN Via IPMI  off
59364e93d6SGeorge Keishing
60364e93d6SGeorge Keishing    ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
61364e93d6SGeorge Keishing    Valid Value  lan_config['802.1q VLAN ID']  ['Disabled']
62364e93d6SGeorge Keishing
63364e93d6SGeorge Keishing
64364e93d6SGeorge KeishingConfigure IP On VLAN Via IPMI
65364e93d6SGeorge Keishing    [Documentation]   Configure IP On VLAN Via IPMI.
66364e93d6SGeorge Keishing    [Tags]  Configure_IP_On_VLAN_Via_IPMI
67364e93d6SGeorge Keishing
68*e354c1c0SAnvesh Kumar Rayankula    Create VLAN Via IPMI  ${vlan_id_for_ipmi}
69364e93d6SGeorge Keishing
70364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
71364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} ipaddr ${ip}  login_host=${0}
72364e93d6SGeorge Keishing
73364e93d6SGeorge Keishing    ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
74*e354c1c0SAnvesh Kumar Rayankula    Valid Value  lan_config['802.1q VLAN ID']  ['${vlan_id_for_ipmi}']
75364e93d6SGeorge Keishing    Valid Value  lan_config['IP Address']  ["${ip}"]
76364e93d6SGeorge Keishing
77364e93d6SGeorge Keishing
78364e93d6SGeorge KeishingCreate VLAN Via IPMI When LAN And VLAN Exist On BMC
79364e93d6SGeorge Keishing    [Documentation]  Create VLAN Via IPMI When LAN And VLAN Exist On BMC.
80364e93d6SGeorge Keishing    [Tags]   Create_VLAN_Via_IPMI_When_LAN_And_VLAN_Exist_On_BMC
81*e354c1c0SAnvesh Kumar Rayankula    [Setup]  Create VLAN  ${vlan_id_for_rest}
82364e93d6SGeorge Keishing
83*e354c1c0SAnvesh Kumar Rayankula    Create VLAN Via IPMI  ${vlan_id_for_ipmi}
84364e93d6SGeorge Keishing
85364e93d6SGeorge Keishing    ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
86*e354c1c0SAnvesh Kumar Rayankula    Valid Value  lan_config['802.1q VLAN ID']  ['${vlan_id_for_ipmi}']
87364e93d6SGeorge Keishing
88364e93d6SGeorge Keishing
89*e354c1c0SAnvesh Kumar RayankulaCreate VLAN Via IPMI And Verify
9074ed739fSAnvesh Kumar Rayankula    [Documentation]  Create and verify VLAN via IPMI.
9174ed739fSAnvesh Kumar Rayankula    [Tags]  Create_VLAN_Via_IPMI_And_Verify
9274ed739fSAnvesh Kumar Rayankula
93*e354c1c0SAnvesh Kumar Rayankula    Create VLAN Via IPMI  ${vlan_id_for_ipmi}
9474ed739fSAnvesh Kumar Rayankula
9574ed739fSAnvesh Kumar Rayankula    ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
96*e354c1c0SAnvesh Kumar Rayankula    Valid Value  lan_config['802.1q VLAN ID']  ['${vlan_id_for_ipmi}']
9774ed739fSAnvesh Kumar Rayankula    Valid Value  lan_config['IP Address']  ['${network_configurations[0]['Address']}']
9874ed739fSAnvesh Kumar Rayankula    Valid Value  lan_config['Subnet Mask']  ['${network_configurations[0]['SubnetMask']}']
9974ed739fSAnvesh Kumar Rayankula
10074ed739fSAnvesh Kumar Rayankula
101*e354c1c0SAnvesh Kumar RayankulaTest Disabling Of VLAN Via IPMI
10274ed739fSAnvesh Kumar Rayankula    [Documentation]  Disable VLAN and verify via IPMI.
103*e354c1c0SAnvesh Kumar Rayankula    [Tags]  Test_Disabling_Of_VLAN_Via_IPMI
10474ed739fSAnvesh Kumar Rayankula
105*e354c1c0SAnvesh Kumar Rayankula    Create VLAN Via IPMI  ${vlan_id_for_ipmi}
10674ed739fSAnvesh Kumar Rayankula    Create VLAN Via IPMI  off
10774ed739fSAnvesh Kumar Rayankula
108*e354c1c0SAnvesh Kumar Rayankula    ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
10974ed739fSAnvesh Kumar Rayankula    Valid Value  lan_config['802.1q VLAN ID']  ['Disabled']
11074ed739fSAnvesh Kumar Rayankula
11174ed739fSAnvesh Kumar Rayankula
112*e354c1c0SAnvesh Kumar RayankulaCreate VLAN When LAN And VLAN Exist With IP Address Configured
113*e354c1c0SAnvesh Kumar Rayankula   [Documentation]  Create VLAN when LAN and VLAN exist with IP address configured.
114*e354c1c0SAnvesh Kumar Rayankula   [Tags]  Create_VLAN_When_LAN_And_VLAN_Exist_With_IP_Address_Configured
115*e354c1c0SAnvesh Kumar Rayankula   [Setup]  Run Keywords  Create VLAN  ${vlan_id_for_rest}  AND  Configure Network Settings On VLAN
116*e354c1c0SAnvesh Kumar Rayankula   ...  ${vlan_id_for_rest}  ${ip}  ${netmask}  ${gateway}
117*e354c1c0SAnvesh Kumar Rayankula
118*e354c1c0SAnvesh Kumar Rayankula   Create VLAN Via IPMI   ${vlan_id_for_ipmi}
119*e354c1c0SAnvesh Kumar Rayankula
120*e354c1c0SAnvesh Kumar Rayankula   ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
121*e354c1c0SAnvesh Kumar Rayankula   Valid Value  lan_config['802.1q VLAN ID']  ['${vlan_id_for_ipmi}']
122*e354c1c0SAnvesh Kumar Rayankula   Valid Value  lan_config['IP Address']  ['${ip}']
123*e354c1c0SAnvesh Kumar Rayankula
124364e93d6SGeorge Keishing*** Keywords ***
125364e93d6SGeorge Keishing
126364e93d6SGeorge KeishingCreate VLAN Via IPMI
127364e93d6SGeorge Keishing    [Documentation]  Create VLAN via inband IPMI command.
128364e93d6SGeorge Keishing    [Arguments]  ${vlan_id}  ${channel_number}=${CHANNEL_NUMBER}
129364e93d6SGeorge Keishing
130364e93d6SGeorge Keishing    # Description of argument(s):
131364e93d6SGeorge Keishing    # vlan_id  The VLAN ID (e.g. '10').
132364e93d6SGeorge Keishing
133364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
134364e93d6SGeorge Keishing    ...  lan set ${channel_number} vlan id ${vlan_id}  login_host=${0}
135364e93d6SGeorge Keishing
136364e93d6SGeorge Keishing
137364e93d6SGeorge KeishingSet IPMI Inband Network Configuration
138364e93d6SGeorge Keishing    [Documentation]  Run sequence of standard IPMI command in-band and set
139364e93d6SGeorge Keishing    ...              the IP configuration.
140364e93d6SGeorge Keishing    [Arguments]  ${ip}  ${netmask}  ${gateway}  ${login}=${1}
141364e93d6SGeorge Keishing
142364e93d6SGeorge Keishing    # Description of argument(s):
143364e93d6SGeorge Keishing    # ip       The IP address to be set using ipmitool-inband.
144364e93d6SGeorge Keishing    # netmask  The Netmask to be set using ipmitool-inband.
145364e93d6SGeorge Keishing    # gateway  The Gateway address to be set using ipmitool-inband.
146364e93d6SGeorge Keishing
147364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
148364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} ipsrc static  login_host=${login}
149364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
150364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} ipaddr ${ip}  login_host=${0}
151364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
152364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} netmask ${netmask}  login_host=${0}
153364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
154364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} defgw ipaddr ${gateway}  login_host=${0}
155364e93d6SGeorge Keishing
156364e93d6SGeorge Keishing
157364e93d6SGeorge KeishingRestore Configuration
158364e93d6SGeorge Keishing    [Documentation]  Restore the configuration to its pre-test state
159364e93d6SGeorge Keishing    ${length}=  Get Length  ${initial_lan_config}
160364e93d6SGeorge Keishing    Return From Keyword If  ${length} == ${0}
161364e93d6SGeorge Keishing
162364e93d6SGeorge Keishing    Set IPMI Inband Network Configuration  ${network_configurations[0]['Address']}
163364e93d6SGeorge Keishing    ...  ${network_configurations[0]['SubnetMask']}
164364e93d6SGeorge Keishing    ...  ${initial_lan_config['Default Gateway IP']}  login=${0}
165364e93d6SGeorge Keishing
166364e93d6SGeorge Keishing
167364e93d6SGeorge KeishingSuite Setup Execution
168364e93d6SGeorge Keishing    [Documentation]  Suite Setup Execution.
169364e93d6SGeorge Keishing
170364e93d6SGeorge Keishing    Redfish.Login
171364e93d6SGeorge Keishing
172364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
173364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} ipsrc static  login_host=${1}
174364e93d6SGeorge Keishing
175364e93d6SGeorge Keishing    @{network_configurations}=  Get Network Configuration
176364e93d6SGeorge Keishing    Set Suite Variable  @{network_configurations}
177364e93d6SGeorge Keishing
178364e93d6SGeorge Keishing    ${initial_lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
179364e93d6SGeorge Keishing    Set Suite Variable  ${initial_lan_config}
180*e354c1c0SAnvesh Kumar Rayankula
181*e354c1c0SAnvesh Kumar Rayankula
182*e354c1c0SAnvesh Kumar RayankulaTest Teardown Execution
183*e354c1c0SAnvesh Kumar Rayankula   [Documentation]  Test Teardown Execution.
184*e354c1c0SAnvesh Kumar Rayankula
185*e354c1c0SAnvesh Kumar Rayankula   FFDC On Test Case Fail
186*e354c1c0SAnvesh Kumar Rayankula   Create VLAN Via IPMI  off
187*e354c1c0SAnvesh Kumar Rayankula   Restore Configuration
188*e354c1c0SAnvesh Kumar Rayankula
189