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
13364e93d6SGeorge KeishingTest Setup             Printn
14364e93d6SGeorge KeishingTest Teardown          FFDC On Test Case Fail
15364e93d6SGeorge Keishing
16364e93d6SGeorge KeishingForce Tags             IPMI_Network_Config
17364e93d6SGeorge Keishing
18364e93d6SGeorge Keishing
19364e93d6SGeorge Keishing*** Variables ***
20364e93d6SGeorge Keishing${vlan_id}              ${10}
21364e93d6SGeorge Keishing@{vlan_ids}             ${20}  ${30}
22364e93d6SGeorge Keishing${interface}            eth0
23364e93d6SGeorge Keishing${ip}                   10.0.0.1
24364e93d6SGeorge Keishing${initial_lan_config}   &{EMPTY}
25364e93d6SGeorge Keishing${vlan_resource}        ${NETWORK_MANAGER}action/VLAN
26364e93d6SGeorge Keishing
27364e93d6SGeorge Keishing*** Test Cases ***
28364e93d6SGeorge Keishing
29364e93d6SGeorge KeishingVerify IPMI Inband Network Configuration
30364e93d6SGeorge Keishing    [Documentation]  Verify BMC network configuration via inband IPMI.
31364e93d6SGeorge Keishing    [Tags]  Verify_IPMI_Inband_Network_Configuration
32364e93d6SGeorge Keishing    [Teardown]  Run Keywords  Restore Configuration  AND  FFDC On Test Case Fail
33364e93d6SGeorge Keishing
34364e93d6SGeorge Keishing    Redfish Power On
35364e93d6SGeorge Keishing
36364e93d6SGeorge Keishing    Set IPMI Inband Network Configuration  10.10.10.10  255.255.255.0  10.10.10.10
37364e93d6SGeorge Keishing    Sleep  10
38364e93d6SGeorge Keishing
39364e93d6SGeorge Keishing    ${lan_print_output}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
40364e93d6SGeorge Keishing    Valid Value  lan_print_output['IP Address']  ["10.10.10.10"]
41364e93d6SGeorge Keishing    Valid Value  lan_print_output['Subnet Mask']  ["255.255.255.0"]
42364e93d6SGeorge Keishing    Valid Value  lan_print_output['Default Gateway IP']  ["10.10.10.10"]
43364e93d6SGeorge Keishing
44364e93d6SGeorge Keishing
45364e93d6SGeorge KeishingDisable VLAN Via IPMI When Multiple VLAN Exist On BMC
46364e93d6SGeorge Keishing    [Documentation]  Disable  VLAN Via IPMI When Multiple VLAN Exist On BMC.
47364e93d6SGeorge Keishing    [Tags]   Disable_VLAN_Via_IPMI_When_LAN_And_VLAN_Exist_On_BMC
48364e93d6SGeorge Keishing    [Teardown]  Run Keywords  FFDC On Test Case Fail  AND
49364e93d6SGeorge Keishing    ...  Create VLAN Via IPMI  off  AND  Restore Configuration
50364e93d6SGeorge Keishing
51364e93d6SGeorge Keishing    FOR  ${id}  IN  @{vlan_ids}
52364e93d6SGeorge Keishing      @{data_vlan_id}=  Create List  ${interface}  ${id}
53364e93d6SGeorge Keishing      ${data}=  Create Dictionary   data=@{data_vlan_id}
54364e93d6SGeorge Keishing      ${resp}=  OpenBMC Post Request  ${vlan_resource}  data=${data}
55364e93d6SGeorge Keishing    END
56364e93d6SGeorge Keishing
57364e93d6SGeorge Keishing    Create VLAN Via IPMI  off
58364e93d6SGeorge Keishing
59364e93d6SGeorge Keishing    ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
60364e93d6SGeorge Keishing    Valid Value  lan_config['802.1q VLAN ID']  ['Disabled']
61364e93d6SGeorge Keishing
62364e93d6SGeorge Keishing
63364e93d6SGeorge KeishingConfigure IP On VLAN Via IPMI
64364e93d6SGeorge Keishing    [Documentation]   Configure IP On VLAN Via IPMI.
65364e93d6SGeorge Keishing    [Tags]  Configure_IP_On_VLAN_Via_IPMI
66364e93d6SGeorge Keishing    [Teardown]  Run Keywords  FFDC On Test Case Fail  AND
67364e93d6SGeorge Keishing    ...  Create VLAN Via IPMI  off  AND  Restore Configuration
68364e93d6SGeorge Keishing
69364e93d6SGeorge Keishing    Create VLAN Via IPMI  ${vlan_id}
70364e93d6SGeorge Keishing
71364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
72364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} ipaddr ${ip}  login_host=${0}
73364e93d6SGeorge Keishing
74364e93d6SGeorge Keishing    ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
75364e93d6SGeorge Keishing    Valid Value  lan_config['802.1q VLAN ID']  ['${vlan_id}']
76364e93d6SGeorge Keishing    Valid Value  lan_config['IP Address']  ["${ip}"]
77364e93d6SGeorge Keishing
78364e93d6SGeorge Keishing
79364e93d6SGeorge KeishingCreate VLAN Via IPMI When LAN And VLAN Exist On BMC
80364e93d6SGeorge Keishing    [Documentation]  Create VLAN Via IPMI When LAN And VLAN Exist On BMC.
81364e93d6SGeorge Keishing    [Tags]   Create_VLAN_Via_IPMI_When_LAN_And_VLAN_Exist_On_BMC
82364e93d6SGeorge Keishing    [Teardown]  Run Keywords  FFDC On Test Case Fail  AND
83364e93d6SGeorge Keishing    ...  Create VLAN Via IPMI  off  AND  Restore Configuration
84364e93d6SGeorge Keishing
85364e93d6SGeorge Keishing    @{data_vlan_id}=  Create List  ${interface}  ${vlan_id}
86364e93d6SGeorge Keishing    ${data}=  Create Dictionary   data=@{data_vlan_id}
87364e93d6SGeorge Keishing    ${resp}=  OpenBMC Post Request  ${vlan_resource}  data=${data}
88364e93d6SGeorge Keishing
89364e93d6SGeorge Keishing    Create VLAN Via IPMI  ${vlan_id}
90364e93d6SGeorge Keishing
91364e93d6SGeorge Keishing    ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
92364e93d6SGeorge Keishing    Valid Value  lan_config['802.1q VLAN ID']  ['${vlan_id}']
93364e93d6SGeorge Keishing
94364e93d6SGeorge Keishing
95*74ed739fSAnvesh Kumar RayankulaCreate VLAN Via IPMI
96*74ed739fSAnvesh Kumar Rayankula    [Documentation]  Create and verify VLAN via IPMI.
97*74ed739fSAnvesh Kumar Rayankula    [Tags]  Create_VLAN_Via_IPMI_And_Verify
98*74ed739fSAnvesh Kumar Rayankula    [Teardown]  Run Keywords  FFDC On Test Case Fail  AND
99*74ed739fSAnvesh Kumar Rayankula    ...  Create VLAN Via IPMI  off  AND  Restore Configuration
100*74ed739fSAnvesh Kumar Rayankula
101*74ed739fSAnvesh Kumar Rayankula    Create VLAN Via IPMI  ${vlan_id}
102*74ed739fSAnvesh Kumar Rayankula
103*74ed739fSAnvesh Kumar Rayankula    ${lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
104*74ed739fSAnvesh Kumar Rayankula    Valid Value  lan_config['802.1q VLAN ID']  ['${vlan_id}']
105*74ed739fSAnvesh Kumar Rayankula    Valid Value  lan_config['IP Address']  ['${network_configurations[0]['Address']}']
106*74ed739fSAnvesh Kumar Rayankula    Valid Value  lan_config['Subnet Mask']  ['${network_configurations[0]['SubnetMask']}']
107*74ed739fSAnvesh Kumar Rayankula
108*74ed739fSAnvesh Kumar Rayankula
109*74ed739fSAnvesh Kumar RayankulaCreate VLAN Via IPMI And Disable VLAN
110*74ed739fSAnvesh Kumar Rayankula    [Documentation]  Disable VLAN and verify via IPMI.
111*74ed739fSAnvesh Kumar Rayankula    [Tags]  Test_Disable_VLAN_Via_IPMI
112*74ed739fSAnvesh Kumar Rayankula    [Teardown]  Run Keywords  FFDC On Test Case Fail  AND
113*74ed739fSAnvesh Kumar Rayankula    ...  Create VLAN Via IPMI  off  AND  Restore Configuration
114*74ed739fSAnvesh Kumar Rayankula
115*74ed739fSAnvesh Kumar Rayankula    Create VLAN Via IPMI  ${vlan_id}
116*74ed739fSAnvesh Kumar Rayankula    Create VLAN Via IPMI  off
117*74ed739fSAnvesh Kumar Rayankula
118*74ed739fSAnvesh Kumar Rayankula    ${lan_config}=  Get LAN Print Dict
119*74ed739fSAnvesh Kumar Rayankula    Valid Value  lan_config['802.1q VLAN ID']  ['Disabled']
120*74ed739fSAnvesh Kumar Rayankula
121*74ed739fSAnvesh Kumar Rayankula
122364e93d6SGeorge Keishing*** Keywords ***
123364e93d6SGeorge Keishing
124364e93d6SGeorge KeishingCreate VLAN Via IPMI
125364e93d6SGeorge Keishing    [Documentation]  Create VLAN via inband IPMI command.
126364e93d6SGeorge Keishing    [Arguments]  ${vlan_id}  ${channel_number}=${CHANNEL_NUMBER}
127364e93d6SGeorge Keishing
128364e93d6SGeorge Keishing    # Description of argument(s):
129364e93d6SGeorge Keishing    # vlan_id  The VLAN ID (e.g. '10').
130364e93d6SGeorge Keishing
131364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
132364e93d6SGeorge Keishing    ...  lan set ${channel_number} vlan id ${vlan_id}  login_host=${0}
133364e93d6SGeorge Keishing
134364e93d6SGeorge Keishing
135364e93d6SGeorge KeishingSet IPMI Inband Network Configuration
136364e93d6SGeorge Keishing    [Documentation]  Run sequence of standard IPMI command in-band and set
137364e93d6SGeorge Keishing    ...              the IP configuration.
138364e93d6SGeorge Keishing    [Arguments]  ${ip}  ${netmask}  ${gateway}  ${login}=${1}
139364e93d6SGeorge Keishing
140364e93d6SGeorge Keishing    # Description of argument(s):
141364e93d6SGeorge Keishing    # ip       The IP address to be set using ipmitool-inband.
142364e93d6SGeorge Keishing    # netmask  The Netmask to be set using ipmitool-inband.
143364e93d6SGeorge Keishing    # gateway  The Gateway address to be set using ipmitool-inband.
144364e93d6SGeorge Keishing
145364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
146364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} ipsrc static  login_host=${login}
147364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
148364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} ipaddr ${ip}  login_host=${0}
149364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
150364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} netmask ${netmask}  login_host=${0}
151364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
152364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} defgw ipaddr ${gateway}  login_host=${0}
153364e93d6SGeorge Keishing
154364e93d6SGeorge Keishing
155364e93d6SGeorge KeishingRestore Configuration
156364e93d6SGeorge Keishing    [Documentation]  Restore the configuration to its pre-test state
157364e93d6SGeorge Keishing    ${length}=  Get Length  ${initial_lan_config}
158364e93d6SGeorge Keishing    Return From Keyword If  ${length} == ${0}
159364e93d6SGeorge Keishing
160364e93d6SGeorge Keishing    Set IPMI Inband Network Configuration  ${network_configurations[0]['Address']}
161364e93d6SGeorge Keishing    ...  ${network_configurations[0]['SubnetMask']}
162364e93d6SGeorge Keishing    ...  ${initial_lan_config['Default Gateway IP']}  login=${0}
163364e93d6SGeorge Keishing
164364e93d6SGeorge Keishing
165364e93d6SGeorge KeishingSuite Setup Execution
166364e93d6SGeorge Keishing    [Documentation]  Suite Setup Execution.
167364e93d6SGeorge Keishing
168364e93d6SGeorge Keishing    Redfish.Login
169364e93d6SGeorge Keishing
170364e93d6SGeorge Keishing    Run Inband IPMI Standard Command
171364e93d6SGeorge Keishing    ...  lan set ${CHANNEL_NUMBER} ipsrc static  login_host=${1}
172364e93d6SGeorge Keishing
173364e93d6SGeorge Keishing    @{network_configurations}=  Get Network Configuration
174364e93d6SGeorge Keishing    Set Suite Variable  @{network_configurations}
175364e93d6SGeorge Keishing
176364e93d6SGeorge Keishing    ${initial_lan_config}=  Get LAN Print Dict  ${CHANNEL_NUMBER}  ipmi_cmd_type=inband
177364e93d6SGeorge Keishing    Set Suite Variable  ${initial_lan_config}
178